Commit 058fd7fa authored by Jeff Garzik's avatar Jeff Garzik

[net drivers] MII lib update:

* add boolean 'init_media' arg to mii_check_media
* update all callers (just 8139cp, for now)
parent c69552c2
...@@ -107,6 +107,11 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered mu ...@@ -107,6 +107,11 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139cp: maximum number of filtered mu
#define PFX DRV_NAME ": " #define PFX DRV_NAME ": "
#ifndef TRUE
#define FALSE 0
#define TRUE (!FALSE)
#endif
#define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ #define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
NETIF_MSG_PROBE | \ NETIF_MSG_PROBE | \
NETIF_MSG_LINK) NETIF_MSG_LINK)
...@@ -678,7 +683,7 @@ static void cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs) ...@@ -678,7 +683,7 @@ static void cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
if (status & (TxOK | TxErr | TxEmpty | SWInt)) if (status & (TxOK | TxErr | TxEmpty | SWInt))
cp_tx(cp); cp_tx(cp);
if (status & LinkChg) if (status & LinkChg)
mii_check_media(&cp->mii_if, netif_msg_link(cp)); mii_check_media(&cp->mii_if, netif_msg_link(cp), FALSE);
if (status & PciErr) { if (status & PciErr) {
u16 pci_status; u16 pci_status;
...@@ -988,8 +993,6 @@ static struct net_device_stats *cp_get_stats(struct net_device *dev) ...@@ -988,8 +993,6 @@ static struct net_device_stats *cp_get_stats(struct net_device *dev)
static void cp_stop_hw (struct cp_private *cp) static void cp_stop_hw (struct cp_private *cp)
{ {
struct net_device *dev = cp->dev;
cpw16(IntrMask, 0); cpw16(IntrMask, 0);
cpr16(IntrMask); cpr16(IntrMask);
cpw8(Cmd, 0); cpw8(Cmd, 0);
...@@ -1195,7 +1198,7 @@ static int cp_open (struct net_device *dev) ...@@ -1195,7 +1198,7 @@ static int cp_open (struct net_device *dev)
goto err_out_hw; goto err_out_hw;
netif_carrier_off(dev); netif_carrier_off(dev);
mii_check_media(&cp->mii_if, netif_msg_link(cp)); mii_check_media(&cp->mii_if, netif_msg_link(cp), TRUE);
netif_start_queue(dev); netif_start_queue(dev);
return 0; return 0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
mii.c: MII interface library mii.c: MII interface library
Maintained by Jeff Garzik <jgarzik@mandrakesoft.com> Maintained by Jeff Garzik <jgarzik@mandrakesoft.com>
Copyright 2001 Jeff Garzik Copyright 2001,2002 Jeff Garzik
*/ */
...@@ -178,7 +178,9 @@ void mii_check_link (struct mii_if_info *mii) ...@@ -178,7 +178,9 @@ void mii_check_link (struct mii_if_info *mii)
netif_carrier_off(mii->dev); netif_carrier_off(mii->dev);
} }
unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print) unsigned int mii_check_media (struct mii_if_info *mii,
unsigned int ok_to_print,
unsigned int init_media)
{ {
unsigned int old_carrier, new_carrier; unsigned int old_carrier, new_carrier;
int advertise, lpa, media, duplex; int advertise, lpa, media, duplex;
...@@ -194,7 +196,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print) ...@@ -194,7 +196,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print)
/* if carrier state did not change, this is a "bounce", /* if carrier state did not change, this is a "bounce",
* just exit as everything is already set correctly * just exit as everything is already set correctly
*/ */
if (old_carrier == new_carrier) if ((!init_media) && (old_carrier == new_carrier))
return 0; /* duplex did not change */ return 0; /* duplex did not change */
/* no carrier, nothing much to do */ /* no carrier, nothing much to do */
...@@ -211,7 +213,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print) ...@@ -211,7 +213,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print)
netif_carrier_on(mii->dev); netif_carrier_on(mii->dev);
/* get MII advertise and LPA values */ /* get MII advertise and LPA values */
if (mii->advertising) if ((!init_media) && (mii->advertising))
advertise = mii->advertising; advertise = mii->advertising;
else { else {
advertise = mii->mdio_read(mii->dev, mii->phy_id, MII_ADVERTISE); advertise = mii->mdio_read(mii->dev, mii->phy_id, MII_ADVERTISE);
...@@ -231,7 +233,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print) ...@@ -231,7 +233,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print)
duplex ? "full" : "half", duplex ? "full" : "half",
lpa); lpa);
if (mii->full_duplex != duplex) { if ((init_media) || (mii->full_duplex != duplex)) {
mii->full_duplex = duplex; mii->full_duplex = duplex;
return 1; /* duplex changed */ return 1; /* duplex changed */
} }
......
...@@ -123,7 +123,9 @@ extern int mii_nway_restart (struct mii_if_info *mii); ...@@ -123,7 +123,9 @@ extern int mii_nway_restart (struct mii_if_info *mii);
extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd); extern int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
extern void mii_check_link (struct mii_if_info *mii); extern void mii_check_link (struct mii_if_info *mii);
extern unsigned int mii_check_media (struct mii_if_info *mii, unsigned int ok_to_print); extern unsigned int mii_check_media (struct mii_if_info *mii,
unsigned int ok_to_print,
unsigned int init_media);
/* This structure is used in all SIOCxMIIxxx ioctl calls */ /* This structure is used in all SIOCxMIIxxx ioctl calls */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment