diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/natsemi.c | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 2e4ecedba057..5dc41462fa01 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -813,6 +813,42 @@ static void move_int_phy(struct net_device *dev, int addr) | |||
813 | udelay(1); | 813 | udelay(1); |
814 | } | 814 | } |
815 | 815 | ||
816 | static void __devinit natsemi_init_media (struct net_device *dev) | ||
817 | { | ||
818 | struct netdev_private *np = netdev_priv(dev); | ||
819 | u32 tmp; | ||
820 | |||
821 | netif_carrier_off(dev); | ||
822 | |||
823 | /* get the initial settings from hardware */ | ||
824 | tmp = mdio_read(dev, MII_BMCR); | ||
825 | np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10; | ||
826 | np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF; | ||
827 | np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE; | ||
828 | np->advertising= mdio_read(dev, MII_ADVERTISE); | ||
829 | |||
830 | if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL | ||
831 | && netif_msg_probe(np)) { | ||
832 | printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s " | ||
833 | "10%s %s duplex.\n", | ||
834 | pci_name(np->pci_dev), | ||
835 | (mdio_read(dev, MII_BMCR) & BMCR_ANENABLE)? | ||
836 | "enabled, advertise" : "disabled, force", | ||
837 | (np->advertising & | ||
838 | (ADVERTISE_100FULL|ADVERTISE_100HALF))? | ||
839 | "0" : "", | ||
840 | (np->advertising & | ||
841 | (ADVERTISE_100FULL|ADVERTISE_10FULL))? | ||
842 | "full" : "half"); | ||
843 | } | ||
844 | if (netif_msg_probe(np)) | ||
845 | printk(KERN_INFO | ||
846 | "natsemi %s: Transceiver status %#04x advertising %#04x.\n", | ||
847 | pci_name(np->pci_dev), mdio_read(dev, MII_BMSR), | ||
848 | np->advertising); | ||
849 | |||
850 | } | ||
851 | |||
816 | static int __devinit natsemi_probe1 (struct pci_dev *pdev, | 852 | static int __devinit natsemi_probe1 (struct pci_dev *pdev, |
817 | const struct pci_device_id *ent) | 853 | const struct pci_device_id *ent) |
818 | { | 854 | { |
@@ -957,34 +993,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
957 | if (mtu) | 993 | if (mtu) |
958 | dev->mtu = mtu; | 994 | dev->mtu = mtu; |
959 | 995 | ||
960 | netif_carrier_off(dev); | 996 | natsemi_init_media(dev); |
961 | |||
962 | /* get the initial settings from hardware */ | ||
963 | tmp = mdio_read(dev, MII_BMCR); | ||
964 | np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10; | ||
965 | np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF; | ||
966 | np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE; | ||
967 | np->advertising= mdio_read(dev, MII_ADVERTISE); | ||
968 | |||
969 | if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL | ||
970 | && netif_msg_probe(np)) { | ||
971 | printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s " | ||
972 | "10%s %s duplex.\n", | ||
973 | pci_name(np->pci_dev), | ||
974 | (mdio_read(dev, MII_BMCR) & BMCR_ANENABLE)? | ||
975 | "enabled, advertise" : "disabled, force", | ||
976 | (np->advertising & | ||
977 | (ADVERTISE_100FULL|ADVERTISE_100HALF))? | ||
978 | "0" : "", | ||
979 | (np->advertising & | ||
980 | (ADVERTISE_100FULL|ADVERTISE_10FULL))? | ||
981 | "full" : "half"); | ||
982 | } | ||
983 | if (netif_msg_probe(np)) | ||
984 | printk(KERN_INFO | ||
985 | "natsemi %s: Transceiver status %#04x advertising %#04x.\n", | ||
986 | pci_name(np->pci_dev), mdio_read(dev, MII_BMSR), | ||
987 | np->advertising); | ||
988 | 997 | ||
989 | /* save the silicon revision for later querying */ | 998 | /* save the silicon revision for later querying */ |
990 | np->srr = readl(ioaddr + SiliconRev); | 999 | np->srr = readl(ioaddr + SiliconRev); |