Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169100
b: refs/heads/master
c: dddfbd8
h: refs/heads/master
v: v3
  • Loading branch information
Dominik Brodowski committed Nov 8, 2009
1 parent 8bd1348 commit 67b5e0a
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 323 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 91284224da5b15ec6c2b45e10fa5eccd1c92a204
refs/heads/master: dddfbd824b96a25da0b2f1cf35c0be33ef2422fe
18 changes: 8 additions & 10 deletions trunk/drivers/net/pcmcia/3c574_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ static int tc574_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev);
tuple_t tuple;
__le16 buf[32];
int last_fn, last_ret, i, j;
unsigned int ioaddr;
__be16 *phys_addr;
char *cardname;
__u32 config;
u8 *buf;
size_t len;

phys_addr = (__be16 *)dev->dev_addr;

Expand Down Expand Up @@ -378,16 +378,14 @@ static int tc574_config(struct pcmcia_device *link)
/* The 3c574 normally uses an EEPROM for configuration info, including
the hardware address. The future products may include a modem chip
and put the address in the CIS. */
tuple.Attributes = 0;
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
tuple.DesiredTuple = 0x88;
if (pcmcia_get_first_tuple(link, &tuple) == 0) {
pcmcia_get_tuple_data(link, &tuple);

len = pcmcia_get_tuple(link, 0x88, &buf);
if (buf && len >= 6) {
for (i = 0; i < 3; i++)
phys_addr[i] = htons(le16_to_cpu(buf[i]));
phys_addr[i] = htons(le16_to_cpu(buf[i * 2]));
kfree(buf);
} else {
kfree(buf); /* 0 < len < 6 */
EL3WINDOW(0);
for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
Expand Down
21 changes: 8 additions & 13 deletions trunk/drivers/net/pcmcia/3c589_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,22 +256,16 @@ static int tc589_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
struct el3_private *lp = netdev_priv(dev);
tuple_t tuple;
__le16 buf[32];
__be16 *phys_addr;
int last_fn, last_ret, i, j, multi = 0, fifo;
unsigned int ioaddr;
char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
u8 *buf;
size_t len;

DEBUG(0, "3c589_config(0x%p)\n", link);

phys_addr = (__be16 *)dev->dev_addr;
tuple.Attributes = 0;
tuple.TupleData = (cisdata_t *)buf;
tuple.TupleDataMax = sizeof(buf);
tuple.TupleOffset = 0;
tuple.Attributes = TUPLE_RETURN_COMMON;

/* Is this a 3c562? */
if (link->manf_id != MANFID_3COM)
printk(KERN_INFO "3c589_cs: hmmm, is this really a "
Expand Down Expand Up @@ -301,12 +295,13 @@ static int tc589_config(struct pcmcia_device *link)

/* The 3c589 has an extra EEPROM for configuration info, including
the hardware address. The 3c562 puts the address in the CIS. */
tuple.DesiredTuple = 0x88;
if (pcmcia_get_first_tuple(link, &tuple) == 0) {
pcmcia_get_tuple_data(link, &tuple);
for (i = 0; i < 3; i++)
phys_addr[i] = htons(le16_to_cpu(buf[i]));
len = pcmcia_get_tuple(link, 0x88, &buf);
if (buf && len >= 6) {
for (i = 0; i < 3; i++)
phys_addr[i] = htons(le16_to_cpu(buf[i*2]));
kfree(buf);
} else {
kfree(buf); /* 0 < len < 6 */
for (i = 0; i < 3; i++)
phys_addr[i] = htons(read_eeprom(ioaddr, i));
if (phys_addr[0] == htons(0x6060)) {
Expand Down
50 changes: 22 additions & 28 deletions trunk/drivers/net/pcmcia/fmvj18x_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,32 +350,29 @@ static int fmvj18x_ioprobe(struct pcmcia_device *p_dev,
return 0; /* strange, but that's what the code did already before... */
}


static int fmvj18x_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
local_info_t *lp = netdev_priv(dev);
tuple_t tuple;
u_short buf[32];
int i, last_fn = RequestIO, last_ret = 0, ret;
unsigned int ioaddr;
cardtype_t cardtype;
char *card_name = "unknown";
u_char *node_id;
u8 *buf;
size_t len;
u_char buggybuf[32];

DEBUG(0, "fmvj18x_config(0x%p)\n", link);

tuple.TupleData = (u_char *)buf;
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
tuple.DesiredTuple = CISTPL_FUNCE;
tuple.TupleOffset = 0;
if (pcmcia_get_first_tuple(link, &tuple) == 0) {
len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf);
kfree(buf);

if (len) {
/* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */
last_ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL);
if (last_ret != 0)
goto cs_failed;

/* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */
switch (link->manf_id) {
case MANFID_TDK:
cardtype = TDK;
Expand Down Expand Up @@ -482,21 +479,21 @@ static int fmvj18x_config(struct pcmcia_device *link)
case CONTEC:
case NEC:
case KME:
tuple.DesiredTuple = CISTPL_FUNCE;
tuple.TupleOffset = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
tuple.TupleOffset = 0;
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
if (cardtype == MBH10304) {
/* MBH10304's CIS_FUNCE is corrupted */
node_id = &(tuple.TupleData[5]);
card_name = "FMV-J182";
} else {
while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) {
CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));

len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf);
if (len < 11) {
kfree(buf);
goto failed;
}
node_id = &(tuple.TupleData[2]);
/* Read MACID from CIS */
for (i = 5; i < 11; i++)
dev->dev_addr[i] = buf[i];
kfree(buf);
} else {
if (pcmcia_get_mac_from_cis(link, dev))
goto failed;
if( cardtype == TDK ) {
card_name = "TDK LAK-CD021";
} else if( cardtype == LA501 ) {
Expand All @@ -509,9 +506,6 @@ static int fmvj18x_config(struct pcmcia_device *link)
card_name = "C-NET(PC)C";
}
}
/* Read MACID from CIS */
for (i = 0; i < 6; i++)
dev->dev_addr[i] = node_id[i];
break;
case UNGERMANN:
/* Read MACID from register */
Expand All @@ -521,12 +515,12 @@ static int fmvj18x_config(struct pcmcia_device *link)
break;
case XXX10304:
/* Read MACID from Buggy CIS */
if (fmvj18x_get_hwinfo(link, tuple.TupleData) == -1) {
if (fmvj18x_get_hwinfo(link, buggybuf) == -1) {
printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n");
goto failed;
}
for (i = 0 ; i < 6; i++) {
dev->dev_addr[i] = tuple.TupleData[i];
dev->dev_addr[i] = buggybuf[i];
}
card_name = "FMV-J182";
break;
Expand Down
19 changes: 9 additions & 10 deletions trunk/drivers/net/pcmcia/nmclan_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ static int nmclan_config(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
mace_private *lp = netdev_priv(dev);
tuple_t tuple;
u_char buf[64];
u8 *buf;
size_t len;
int i, last_ret, last_fn;
unsigned int ioaddr;

Expand All @@ -677,14 +677,13 @@ static int nmclan_config(struct pcmcia_device *link)
ioaddr = dev->base_addr;

/* Read the ethernet address from the CIS. */
tuple.DesiredTuple = 0x80 /* CISTPL_CFTABLE_ENTRY_MISC */;
tuple.TupleData = buf;
tuple.TupleDataMax = 64;
tuple.TupleOffset = 0;
tuple.Attributes = 0;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN);
len = pcmcia_get_tuple(link, 0x80, &buf);
if (!buf || len < ETHER_ADDR_LEN) {
kfree(buf);
goto failed;
}
memcpy(dev->dev_addr, buf, ETHER_ADDR_LEN);
kfree(buf);

/* Verify configuration by reading the MACE ID. */
{
Expand Down
Loading

0 comments on commit 67b5e0a

Please sign in to comment.