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
#define PFX DRV_NAME ": "
#ifndef TRUE
#define FALSE 0
#define TRUE (!FALSE)
#endif
#define CP_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
NETIF_MSG_PROBE | \
NETIF_MSG_LINK)
......@@ -678,7 +683,7 @@ static void cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
if (status & (TxOK | TxErr | TxEmpty | SWInt))
cp_tx(cp);
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) {
u16 pci_status;
......@@ -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)
{
struct net_device *dev = cp->dev;
cpw16(IntrMask, 0);
cpr16(IntrMask);
cpw8(Cmd, 0);
......@@ -1195,7 +1198,7 @@ static int cp_open (struct net_device *dev)
goto err_out_hw;
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);
return 0;
......
......@@ -3,7 +3,7 @@
mii.c: MII interface library
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)
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;
int advertise, lpa, media, duplex;
......@@ -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",
* 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 */
/* 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)
netif_carrier_on(mii->dev);
/* get MII advertise and LPA values */
if (mii->advertising)
if ((!init_media) && (mii->advertising))
advertise = mii->advertising;
else {
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)
duplex ? "full" : "half",
lpa);
if (mii->full_duplex != duplex) {
if ((init_media) || (mii->full_duplex != duplex)) {
mii->full_duplex = duplex;
return 1; /* duplex changed */
}
......
......@@ -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_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
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 */
......
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