Commit 966d8cdb authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Jeff Garzik

[netdrvr 8139too] add more h/w revision ids

parent 3692caa6
...@@ -302,7 +302,6 @@ enum RTL8139_registers { ...@@ -302,7 +302,6 @@ enum RTL8139_registers {
IntrMask = 0x3C, IntrMask = 0x3C,
IntrStatus = 0x3E, IntrStatus = 0x3E,
TxConfig = 0x40, TxConfig = 0x40,
ChipVersion = 0x43,
RxConfig = 0x44, RxConfig = 0x44,
Timer = 0x48, /* A general-purpose counter. */ Timer = 0x48, /* A general-purpose counter. */
RxMissed = 0x4C, /* 24 bits valid, write clears. */ RxMissed = 0x4C, /* 24 bits valid, write clears. */
...@@ -499,9 +498,13 @@ typedef enum { ...@@ -499,9 +498,13 @@ typedef enum {
CH_8139 = 0, CH_8139 = 0,
CH_8139_K, CH_8139_K,
CH_8139A, CH_8139A,
CH_8139A_G,
CH_8139B, CH_8139B,
CH_8130, CH_8130,
CH_8139C, CH_8139C,
CH_8100,
CH_8100B_8139D,
CH_8101,
} chip_t; } chip_t;
enum chip_flags { enum chip_flags {
...@@ -509,43 +512,65 @@ enum chip_flags { ...@@ -509,43 +512,65 @@ enum chip_flags {
HasLWake = (1 << 1), HasLWake = (1 << 1),
}; };
#define HW_REVID(b30, b29, b28, b27, b26, b23, b22) \
(b30<<30 | b29<<29 | b28<<28 | b27<<27 | b26<<26 | b23<<23 | b22<<22)
#define HW_REVID_MASK HW_REVID(1, 1, 1, 1, 1, 1, 1)
/* directly indexed by chip_t, above */ /* directly indexed by chip_t, above */
const static struct { const static struct {
const char *name; const char *name;
u8 version; /* from RTL8139C docs */ u32 version; /* from RTL8139C/RTL8139D docs */
u32 flags; u32 flags;
} rtl_chip_info[] = { } rtl_chip_info[] = {
{ "RTL-8139", { "RTL-8139",
0x40, HW_REVID(1, 0, 0, 0, 0, 0, 0),
HasHltClk, HasHltClk,
}, },
{ "RTL-8139 rev K", { "RTL-8139 rev K",
0x60, HW_REVID(1, 1, 0, 0, 0, 0, 0),
HasHltClk, HasHltClk,
}, },
{ "RTL-8139A", { "RTL-8139A",
0x70, HW_REVID(1, 1, 1, 0, 0, 0, 0),
HasHltClk, /* XXX undocumented? */
},
{ "RTL-8139A rev G",
HW_REVID(1, 1, 1, 0, 0, 1, 0),
HasHltClk, /* XXX undocumented? */ HasHltClk, /* XXX undocumented? */
}, },
{ "RTL-8139B", { "RTL-8139B",
0x78, HW_REVID(1, 1, 1, 1, 0, 0, 0),
HasLWake, HasLWake,
}, },
{ "RTL-8130", { "RTL-8130",
0x7C, HW_REVID(1, 1, 1, 1, 1, 0, 0),
HasLWake, HasLWake,
}, },
{ "RTL-8139C", { "RTL-8139C",
0x74, HW_REVID(1, 1, 1, 0, 1, 0, 0),
HasLWake,
},
{ "RTL-8100",
HW_REVID(1, 1, 1, 1, 0, 1, 0),
HasLWake, HasLWake,
}, },
{ "RTL-8100B/8139D",
HW_REVID(1, 1, 1, 0, 1, 0, 1),
HasLWake,
},
{ "RTL-8101",
HW_REVID(1, 1, 1, 0, 1, 1, 1),
HasLWake,
},
}; };
struct rtl_extra_stats { struct rtl_extra_stats {
...@@ -750,7 +775,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, ...@@ -750,7 +775,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
unsigned int i; unsigned int i;
u32 pio_start, pio_end, pio_flags, pio_len; u32 pio_start, pio_end, pio_flags, pio_len;
unsigned long mmio_start, mmio_end, mmio_flags, mmio_len; unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
u32 tmp; u32 version;
assert (pdev != NULL); assert (pdev != NULL);
...@@ -852,9 +877,9 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, ...@@ -852,9 +877,9 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
} }
/* identify chip attached to board */ /* identify chip attached to board */
tmp = RTL_R8 (ChipVersion); version = RTL_R32 (TxConfig) & HW_REVID_MASK;
for (i = 0; i < ARRAY_SIZE (rtl_chip_info); i++) for (i = 0; i < ARRAY_SIZE (rtl_chip_info); i++)
if (tmp == rtl_chip_info[i].version) { if (version == rtl_chip_info[i].version) {
tp->chipset = i; tp->chipset = i;
goto match; goto match;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment