From 30d60a8288ab6f59939736f5775a7110a8bfff9a Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Mon, 12 Sep 2005 10:48:58 -0400 Subject: [PATCH] sundance: support ETHTOOL_GPERMADDR Add support for ETHTOOL_GPERMADDR to sundance. Signed-off-by: John W. Linville Signed-off-by: Jeff Garzik --- drivers/net/sundance.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/net/sundance.c') diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index d500a5771dbc..e148a7212073 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -549,6 +549,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, for (i = 0; i < 3; i++) ((u16 *)dev->dev_addr)[i] = le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); dev->base_addr = (unsigned long)ioaddr; dev->irq = irq; @@ -1619,6 +1620,7 @@ static struct ethtool_ops ethtool_ops = { .get_link = get_link, .get_msglevel = get_msglevel, .set_msglevel = set_msglevel, + .get_perm_addr = ethtool_op_get_perm_addr, }; static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -- cgit v1.2.2 From 67ec2f805a5260c041b1c3c7a86ecfbc9670db06 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Tue, 18 Oct 2005 21:31:01 -0400 Subject: [PATCH] sundance: remove if (1) { ... } block in sundance_probe1 Remove an if (1) { ... } block in sundance_probe1. Its purpose seems to be only to allow for delaring some extra local variables. But, it also adds ugly indentation without adding any meaning to the code. Signed-off-by: John W. Linville Signed-off-by: Jeff Garzik --- drivers/net/sundance.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'drivers/net/sundance.c') diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index e148a7212073..8c4eb11ab44e 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -518,6 +518,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, #else int bar = 1; #endif + int phy, phy_idx = 0; /* when built into the kernel, we only print version if device is found */ @@ -606,33 +607,30 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, printk("%2.2x:", dev->dev_addr[i]); printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); - if (1) { - int phy, phy_idx = 0; - np->phys[0] = 1; /* Default setting */ - np->mii_preamble_required++; - for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { - int mii_status = mdio_read(dev, phy, MII_BMSR); - if (mii_status != 0xffff && mii_status != 0x0000) { - np->phys[phy_idx++] = phy; - np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); - if ((mii_status & 0x0040) == 0) - np->mii_preamble_required++; - printk(KERN_INFO "%s: MII PHY found at address %d, status " - "0x%4.4x advertising %4.4x.\n", - dev->name, phy, mii_status, np->mii_if.advertising); - } - } - np->mii_preamble_required--; - - if (phy_idx == 0) { - printk(KERN_INFO "%s: No MII transceiver found, aborting. ASIC status %x\n", - dev->name, ioread32(ioaddr + ASICCtrl)); - goto err_out_unregister; + np->phys[0] = 1; /* Default setting */ + np->mii_preamble_required++; + for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { + int mii_status = mdio_read(dev, phy, MII_BMSR); + if (mii_status != 0xffff && mii_status != 0x0000) { + np->phys[phy_idx++] = phy; + np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); + if ((mii_status & 0x0040) == 0) + np->mii_preamble_required++; + printk(KERN_INFO "%s: MII PHY found at address %d, status " + "0x%4.4x advertising %4.4x.\n", + dev->name, phy, mii_status, np->mii_if.advertising); } + } + np->mii_preamble_required--; - np->mii_if.phy_id = np->phys[0]; + if (phy_idx == 0) { + printk(KERN_INFO "%s: No MII transceiver found, aborting. ASIC status %x\n", + dev->name, ioread32(ioaddr + ASICCtrl)); + goto err_out_unregister; } + np->mii_if.phy_id = np->phys[0]; + /* Parse override configuration */ np->an_enable = 1; if (card_idx < MAX_UNITS) { -- cgit v1.2.2 From 2aa1d82db7a967b748c4b41854c4222cd0484114 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Tue, 18 Oct 2005 21:31:02 -0400 Subject: [PATCH] sundance: expand reset mask Expand the mask used when reseting the chip to include the GlobalReset bit. This fix comes from ICPlus and seems to be required for some cards. Signed-off-by: John W. Linville Signed-off-by: Jeff Garzik --- drivers/net/sundance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/sundance.c') diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 8c4eb11ab44e..d8a7e08cab2b 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -691,7 +691,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, /* Reset the chip to erase previous misconfiguration. */ if (netif_msg_hw(np)) printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); - iowrite16(0x007f, ioaddr + ASICCtrl + 2); + iowrite16(0x00ff, ioaddr + ASICCtrl + 2); if (netif_msg_hw(np)) printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); -- cgit v1.2.2 From b06c093ed2dc968b3c140dafa55fa6c7b72169e5 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Wed, 19 Oct 2005 08:07:34 -0400 Subject: [PATCH] sundance: include MII address 0 in PHY probe Include MII address 0 at the end of the PHY scan. This covers the entire range of possible MII addresses. Signed-off-by: John W. Linville Signed-off-by: Jeff Garzik --- drivers/net/sundance.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/net/sundance.c') diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index d8a7e08cab2b..5de0554fd7c6 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -609,16 +609,17 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, np->phys[0] = 1; /* Default setting */ np->mii_preamble_required++; - for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { + for (phy = 1; 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) { - np->phys[phy_idx++] = phy; - np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); + np->phys[phy_idx++] = phyx; + np->mii_if.advertising = mdio_read(dev, phyx, MII_ADVERTISE); if ((mii_status & 0x0040) == 0) np->mii_preamble_required++; printk(KERN_INFO "%s: MII PHY found at address %d, status " "0x%4.4x advertising %4.4x.\n", - dev->name, phy, mii_status, np->mii_if.advertising); + dev->name, phyx, mii_status, np->mii_if.advertising); } } np->mii_preamble_required--; -- cgit v1.2.2