diff options
Diffstat (limited to 'drivers/net/sundance.c')
-rw-r--r-- | drivers/net/sundance.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index d500a5771dbc..5de0554fd7c6 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -518,6 +518,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
518 | #else | 518 | #else |
519 | int bar = 1; | 519 | int bar = 1; |
520 | #endif | 520 | #endif |
521 | int phy, phy_idx = 0; | ||
521 | 522 | ||
522 | 523 | ||
523 | /* when built into the kernel, we only print version if device is found */ | 524 | /* when built into the kernel, we only print version if device is found */ |
@@ -549,6 +550,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
549 | for (i = 0; i < 3; i++) | 550 | for (i = 0; i < 3; i++) |
550 | ((u16 *)dev->dev_addr)[i] = | 551 | ((u16 *)dev->dev_addr)[i] = |
551 | le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); | 552 | le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); |
553 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | ||
552 | 554 | ||
553 | dev->base_addr = (unsigned long)ioaddr; | 555 | dev->base_addr = (unsigned long)ioaddr; |
554 | dev->irq = irq; | 556 | dev->irq = irq; |
@@ -605,33 +607,31 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
605 | printk("%2.2x:", dev->dev_addr[i]); | 607 | printk("%2.2x:", dev->dev_addr[i]); |
606 | printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); | 608 | printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq); |
607 | 609 | ||
608 | if (1) { | 610 | np->phys[0] = 1; /* Default setting */ |
609 | int phy, phy_idx = 0; | 611 | np->mii_preamble_required++; |
610 | np->phys[0] = 1; /* Default setting */ | 612 | for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) { |
611 | np->mii_preamble_required++; | 613 | int mii_status = mdio_read(dev, phy, MII_BMSR); |
612 | for (phy = 1; phy < 32 && phy_idx < MII_CNT; phy++) { | 614 | int phyx = phy & 0x1f; |
613 | int mii_status = mdio_read(dev, phy, MII_BMSR); | 615 | if (mii_status != 0xffff && mii_status != 0x0000) { |
614 | if (mii_status != 0xffff && mii_status != 0x0000) { | 616 | np->phys[phy_idx++] = phyx; |
615 | np->phys[phy_idx++] = phy; | 617 | np->mii_if.advertising = mdio_read(dev, phyx, MII_ADVERTISE); |
616 | np->mii_if.advertising = mdio_read(dev, phy, MII_ADVERTISE); | 618 | if ((mii_status & 0x0040) == 0) |
617 | if ((mii_status & 0x0040) == 0) | 619 | np->mii_preamble_required++; |
618 | np->mii_preamble_required++; | 620 | printk(KERN_INFO "%s: MII PHY found at address %d, status " |
619 | printk(KERN_INFO "%s: MII PHY found at address %d, status " | 621 | "0x%4.4x advertising %4.4x.\n", |
620 | "0x%4.4x advertising %4.4x.\n", | 622 | dev->name, phyx, mii_status, np->mii_if.advertising); |
621 | dev->name, phy, mii_status, np->mii_if.advertising); | ||
622 | } | ||
623 | } | ||
624 | np->mii_preamble_required--; | ||
625 | |||
626 | if (phy_idx == 0) { | ||
627 | printk(KERN_INFO "%s: No MII transceiver found, aborting. ASIC status %x\n", | ||
628 | dev->name, ioread32(ioaddr + ASICCtrl)); | ||
629 | goto err_out_unregister; | ||
630 | } | 623 | } |
624 | } | ||
625 | np->mii_preamble_required--; | ||
631 | 626 | ||
632 | np->mii_if.phy_id = np->phys[0]; | 627 | if (phy_idx == 0) { |
628 | printk(KERN_INFO "%s: No MII transceiver found, aborting. ASIC status %x\n", | ||
629 | dev->name, ioread32(ioaddr + ASICCtrl)); | ||
630 | goto err_out_unregister; | ||
633 | } | 631 | } |
634 | 632 | ||
633 | np->mii_if.phy_id = np->phys[0]; | ||
634 | |||
635 | /* Parse override configuration */ | 635 | /* Parse override configuration */ |
636 | np->an_enable = 1; | 636 | np->an_enable = 1; |
637 | if (card_idx < MAX_UNITS) { | 637 | if (card_idx < MAX_UNITS) { |
@@ -692,7 +692,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev, | |||
692 | /* Reset the chip to erase previous misconfiguration. */ | 692 | /* Reset the chip to erase previous misconfiguration. */ |
693 | if (netif_msg_hw(np)) | 693 | if (netif_msg_hw(np)) |
694 | printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); | 694 | printk("ASIC Control is %x.\n", ioread32(ioaddr + ASICCtrl)); |
695 | iowrite16(0x007f, ioaddr + ASICCtrl + 2); | 695 | iowrite16(0x00ff, ioaddr + ASICCtrl + 2); |
696 | if (netif_msg_hw(np)) | 696 | if (netif_msg_hw(np)) |
697 | printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); | 697 | printk("ASIC Control is now %x.\n", ioread32(ioaddr + ASICCtrl)); |
698 | 698 | ||
@@ -1619,6 +1619,7 @@ static struct ethtool_ops ethtool_ops = { | |||
1619 | .get_link = get_link, | 1619 | .get_link = get_link, |
1620 | .get_msglevel = get_msglevel, | 1620 | .get_msglevel = get_msglevel, |
1621 | .set_msglevel = set_msglevel, | 1621 | .set_msglevel = set_msglevel, |
1622 | .get_perm_addr = ethtool_op_get_perm_addr, | ||
1622 | }; | 1623 | }; |
1623 | 1624 | ||
1624 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1625 | static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |