forked from Minki/linux
[netdrvr] natsemi: Separate out media initialization code
This makes it easier to merge an upcoming patch, and overall makes the code a bit more clean. Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
467c432a4d
commit
5a40f09baa
@ -813,6 +813,42 @@ static void move_int_phy(struct net_device *dev, int addr)
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
static void __devinit natsemi_init_media (struct net_device *dev)
|
||||
{
|
||||
struct netdev_private *np = netdev_priv(dev);
|
||||
u32 tmp;
|
||||
|
||||
netif_carrier_off(dev);
|
||||
|
||||
/* get the initial settings from hardware */
|
||||
tmp = mdio_read(dev, MII_BMCR);
|
||||
np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10;
|
||||
np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF;
|
||||
np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE;
|
||||
np->advertising= mdio_read(dev, MII_ADVERTISE);
|
||||
|
||||
if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL
|
||||
&& netif_msg_probe(np)) {
|
||||
printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s "
|
||||
"10%s %s duplex.\n",
|
||||
pci_name(np->pci_dev),
|
||||
(mdio_read(dev, MII_BMCR) & BMCR_ANENABLE)?
|
||||
"enabled, advertise" : "disabled, force",
|
||||
(np->advertising &
|
||||
(ADVERTISE_100FULL|ADVERTISE_100HALF))?
|
||||
"0" : "",
|
||||
(np->advertising &
|
||||
(ADVERTISE_100FULL|ADVERTISE_10FULL))?
|
||||
"full" : "half");
|
||||
}
|
||||
if (netif_msg_probe(np))
|
||||
printk(KERN_INFO
|
||||
"natsemi %s: Transceiver status %#04x advertising %#04x.\n",
|
||||
pci_name(np->pci_dev), mdio_read(dev, MII_BMSR),
|
||||
np->advertising);
|
||||
|
||||
}
|
||||
|
||||
static int __devinit natsemi_probe1 (struct pci_dev *pdev,
|
||||
const struct pci_device_id *ent)
|
||||
{
|
||||
@ -957,34 +993,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
|
||||
if (mtu)
|
||||
dev->mtu = mtu;
|
||||
|
||||
netif_carrier_off(dev);
|
||||
|
||||
/* get the initial settings from hardware */
|
||||
tmp = mdio_read(dev, MII_BMCR);
|
||||
np->speed = (tmp & BMCR_SPEED100)? SPEED_100 : SPEED_10;
|
||||
np->duplex = (tmp & BMCR_FULLDPLX)? DUPLEX_FULL : DUPLEX_HALF;
|
||||
np->autoneg = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE;
|
||||
np->advertising= mdio_read(dev, MII_ADVERTISE);
|
||||
|
||||
if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL
|
||||
&& netif_msg_probe(np)) {
|
||||
printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s "
|
||||
"10%s %s duplex.\n",
|
||||
pci_name(np->pci_dev),
|
||||
(mdio_read(dev, MII_BMCR) & BMCR_ANENABLE)?
|
||||
"enabled, advertise" : "disabled, force",
|
||||
(np->advertising &
|
||||
(ADVERTISE_100FULL|ADVERTISE_100HALF))?
|
||||
"0" : "",
|
||||
(np->advertising &
|
||||
(ADVERTISE_100FULL|ADVERTISE_10FULL))?
|
||||
"full" : "half");
|
||||
}
|
||||
if (netif_msg_probe(np))
|
||||
printk(KERN_INFO
|
||||
"natsemi %s: Transceiver status %#04x advertising %#04x.\n",
|
||||
pci_name(np->pci_dev), mdio_read(dev, MII_BMSR),
|
||||
np->advertising);
|
||||
natsemi_init_media(dev);
|
||||
|
||||
/* save the silicon revision for later querying */
|
||||
np->srr = readl(ioaddr + SiliconRev);
|
||||
|
Loading…
Reference in New Issue
Block a user