Hi Jeff, Yesterday I've bought an el-cheapo encore ENL832-TX-ICNT eth card, sundance based, that didn't worked with the in-kernel sundance driver, after some googling I've found this driver:
http://www.encore-usa.com/Drivers/ENL832-TX-ICNT_Drivers.zip Merged some bits and got this beast working, with some help from Lennert Buytenhek, please take a look and see if its acceptable as I'm more than rusty at driver development :-) Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> - Arnaldo
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 0ab9c38..9ce5d86 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -94,11 +94,14 @@ Version LK1.10 (Philippe De Muyter [EMAIL PROTECTED]): - Make 'unblock interface after Tx underrun' work + Version LK1.11 (Arnaldo Carvalho de Melo [EMAIL PROTECTED]): + - Merge some bits from Encore driver sources (Jesse Huang) to + get the Encore ENL832-TX-ICNT card working. */ #define DRV_NAME "sundance" -#define DRV_VERSION "1.01+LK1.10" -#define DRV_RELDATE "28-Oct-2005" +#define DRV_VERSION "1.01+LK1.11" +#define DRV_RELDATE "19-Dec-2005" /* The user-configurable values. @@ -286,7 +289,8 @@ static struct pci_device_id sundance_pci {0x1186, 0x1002, 0x1186, 0x1012, 0, 0, 2}, {0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3}, {0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, - {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, + {0x13F0, 0x0200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, + {0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6}, {0,} }; MODULE_DEVICE_TABLE(pci, sundance_pci_tbl); @@ -304,6 +308,7 @@ static struct pci_id_info pci_id_tbl[] = {"D-Link DFE-580TX 4 port Server Adapter"}, {"D-Link DFE-530TXS FAST Ethernet Adapter"}, {"D-Link DL10050-based FAST Ethernet Adapter"}, + {"ENCORE 10/100Mbps Fast Ethernet PCI Adapter" }, {"Sundance Technology Alta"}, {NULL,}, /* 0 terminated list. */ }; @@ -475,6 +480,11 @@ struct netdev_private { unsigned char pci_rev_id; }; +static inline int sundance_enl832_tx_icnt(const struct pci_dev *pd) +{ + return pd->device == 0x200 && pd->vendor == 0x13F0; +} + /* The station address location in the EEPROM. */ #define EEPROM_SA_OFFSET 0x10 #define DEFAULT_INTR (IntrRxDMADone | IntrPCIErr | \ @@ -633,7 +643,7 @@ static int __devinit sundance_probe1 (st np->phys[0] = 1; /* Default setting */ np->mii_preamble_required++; - for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) { + for (phy = 0; phy < 32 && phy_idx < MII_CNT; phy++) { int mii_status = mdio_read(dev, phy, MII_BMSR); int phyx = phy & 0x1f; if (mii_status != 0xffff && mii_status != 0x0000) { @@ -700,17 +710,41 @@ static int __devinit sundance_probe1 (st /* If flow control enabled, we need to advertise it.*/ if (np->flowctrl) mdio_write (dev, np->phys[0], MII_ADVERTISE, np->mii_if.advertising | 0x0400); - mdio_write (dev, np->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART); + + if (!sundance_enl832_tx_icnt(pdev)) + mdio_write(dev, np->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART); /* Force media type */ if (!np->an_enable) { - mii_ctl = 0; - mii_ctl |= (np->speed == 100) ? BMCR_SPEED100 : 0; - mii_ctl |= (np->mii_if.full_duplex) ? BMCR_FULLDPLX : 0; - mdio_write (dev, np->phys[0], MII_BMCR, mii_ctl); - printk (KERN_INFO "Override speed=%d, %s duplex\n", - np->speed, np->mii_if.full_duplex ? "Full" : "Half"); + if (!sundance_enl832_tx_icnt(pdev)) { + mii_ctl = 0; + mii_ctl |= np->speed == 100 ? BMCR_SPEED100 : 0; + mii_ctl |= np->mii_if.full_duplex ? BMCR_FULLDPLX : 0; + mdio_write(dev, np->phys[0], MII_BMCR, mii_ctl); + printk(KERN_INFO "Override speed=%d, %s duplex\n", + np->speed, np->mii_if.full_duplex ? "Full" : "Half"); + } else { + u16 mii_avt; - } + mii_ctl = mdio_read(dev, np->phys[0], + MII_BMCR) & 0x0000ffff; + mii_avt = mdio_read(dev, np->phys[0], MII_ADVERTISE) & + ~(ADVERTISE_100FULL + ADVERTISE_100HALF + + ADVERTISE_10FULL + ADVERTISE_10HALF); + if (np->speed == 100) + mii_avt |= np->mii_if.full_duplex ? + ADVERTISE_100FULL : + ADVERTISE_100HALF; + else + mii_avt |= np->mii_if.full_duplex ? + ADVERTISE_10FULL : + ADVERTISE_10HALF; + + mdio_write(dev, np->phys[0], MII_ADVERTISE, mii_avt); + mdio_write(dev, np->phys[0], MII_BMCR, + mii_ctl | BMCR_ANENABLE | BMCR_ANRESTART); + } + } else if (sundance_enl832_tx_icnt(pdev)) + mdio_write(dev, np->phys[0], MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); /* Perhaps move the reset here? */ /* Reset the chip to erase previous misconfiguration. */