[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c

2007-01-09 Thread timur
From: Timur Tabi [EMAIL PROTECTED]

The local versions of phy_read() and phy_write() in ucc_geth_phy.c conflict
with the prototypes in include/linux/phy.h, so this patch renames them, 
moves them to the top of the file (while eliminating the redundant prototype),
and makes them static.

Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Signed-off-by: Kumar Gala [EMAIL PROTECTED]

---
 drivers/net/ucc_geth_phy.c |  134 ++--
 1 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 5360ec0..3c86592 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -68,8 +68,31 @@ static int gbit_config_aneg(struct ugeth
 static int genmii_config_aneg(struct ugeth_mii_info *mii_info);
 static int genmii_update_link(struct ugeth_mii_info *mii_info);
 static int genmii_read_status(struct ugeth_mii_info *mii_info);
-u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
-void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val);
+
+static u16 ucc_geth_phy_read(struct ugeth_mii_info *mii_info, u16 regnum)
+{
+   u16 retval;
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   retval = mii_info-mdio_read(mii_info-dev, mii_info-mii_id, regnum);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+
+   return retval;
+}
+
+static void ucc_geth_phy_write(struct ugeth_mii_info *mii_info, u16 regnum, 
u16 val)
+{
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   mii_info-mdio_write(mii_info-dev, mii_info-mii_id, regnum, val);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+}
 
 /* Write value to the PHY for this device to the register at regnum, */
 /* waiting until the write is done before it returns.  All PHY */
@@ -184,7 +207,7 @@ static void config_genmii_advert(struct
advertise = mii_info-advertising;
 
/* Setup standard advertisement */
-   adv = phy_read(mii_info, MII_ADVERTISE);
+   adv = ucc_geth_phy_read(mii_info, MII_ADVERTISE);
adv = ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (advertise  ADVERTISED_10baseT_Half)
adv |= ADVERTISE_10HALF;
@@ -194,7 +217,7 @@ static void config_genmii_advert(struct
adv |= ADVERTISE_100HALF;
if (advertise  ADVERTISED_100baseT_Full)
adv |= ADVERTISE_100FULL;
-   phy_write(mii_info, MII_ADVERTISE, adv);
+   ucc_geth_phy_write(mii_info, MII_ADVERTISE, adv);
 }
 
 static void genmii_setup_forced(struct ugeth_mii_info *mii_info)
@@ -204,7 +227,7 @@ static void genmii_setup_forced(struct u
 
ugphy_vdbg(%s: IN, __FUNCTION__);
 
-   ctrl = phy_read(mii_info, MII_BMCR);
+   ctrl = ucc_geth_phy_read(mii_info, MII_BMCR);
 
ctrl =
~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE);
@@ -234,7 +257,7 @@ static void genmii_setup_forced(struct u
break;
}
 
-   phy_write(mii_info, MII_BMCR, ctrl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctrl);
 }
 
 /* Enable and Restart Autonegotiation */
@@ -244,9 +267,9 @@ static void genmii_restart_aneg(struct u
 
ugphy_vdbg(%s: IN, __FUNCTION__);
 
-   ctl = phy_read(mii_info, MII_BMCR);
+   ctl = ucc_geth_phy_read(mii_info, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
-   phy_write(mii_info, MII_BMCR, ctl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctl);
 }
 
 static int gbit_config_aneg(struct ugeth_mii_info *mii_info)
@@ -261,14 +284,14 @@ static int gbit_config_aneg(struct ugeth
config_genmii_advert(mii_info);
advertise = mii_info-advertising;
 
-   adv = phy_read(mii_info, MII_1000BASETCONTROL);
+   adv = ucc_geth_phy_read(mii_info, MII_1000BASETCONTROL);
adv = ~(MII_1000BASETCONTROL_FULLDUPLEXCAP |
 MII_1000BASETCONTROL_HALFDUPLEXCAP);
if (advertise  SUPPORTED_1000baseT_Half)
adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
if (advertise  SUPPORTED_1000baseT_Full)
adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
-   phy_write(mii_info, MII_1000BASETCONTROL, adv);
+   ucc_geth_phy_write(mii_info, MII_1000BASETCONTROL, adv);
 
/* Start/Restart aneg */
genmii_restart_aneg(mii_info);
@@ -298,10 +321,10 @@ static int genmii_update_link(struct uge
ugphy_vdbg(%s: IN, __FUNCTION__);
 
/* Do a fake read */
-   phy_read(mii_info, MII_BMSR);
+   ucc_geth_phy_read(mii_info, MII_BMSR);
 
/* Read link and autonegotiation status */
-   status = phy_read(mii_info, MII_BMSR);
+   status = ucc_geth_phy_read(mii_info, MII_BMSR);
if ((status  BMSR_LSTATUS) == 0)

Re: [PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c

2007-01-05 Thread Kumar Gala

Jeff,

Friendly reminder that this should go in for 2.6.20

- k

On Dec 18, 2006, at 10:24 AM, Kumar Gala wrote:


Jeff,

Can you pickup this patch for 2.6.20.  It addresses a name conflict  
issue with the phylib and the phy handling in the ucc driver.


thanks

- k

On Dec 13, 2006, at 5:08 PM, [EMAIL PROTECTED] wrote:


From: Timur Tabi [EMAIL PROTECTED]

The local versions of phy_read() and phy_write() in ucc_geth_phy.c  
conflict
with the prototypes in include/linux/phy.h, so this patch renames  
them,
moves them to the top of the file (while eliminating the redundant  
prototype),

and makes them static.

Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Signed-off-by: Kumar Gala [EMAIL PROTECTED]

---
 drivers/net/ucc_geth_phy.c |  134 + 
+--

 1 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 5360ec0..3c86592 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -68,8 +68,31 @@ static int gbit_config_aneg(struct ugeth
 static int genmii_config_aneg(struct ugeth_mii_info *mii_info);
 static int genmii_update_link(struct ugeth_mii_info *mii_info);
 static int genmii_read_status(struct ugeth_mii_info *mii_info);
-u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
-void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16  
val);

+
+static u16 ucc_geth_phy_read(struct ugeth_mii_info *mii_info, u16  
regnum)

+{
+   u16 retval;
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+	retval = mii_info-mdio_read(mii_info-dev, mii_info-mii_id,  
regnum);

+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+
+   return retval;
+}
+
+static void ucc_geth_phy_write(struct ugeth_mii_info *mii_info,  
u16 regnum, u16 val)

+{
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   mii_info-mdio_write(mii_info-dev, mii_info-mii_id, regnum, val);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+}

 /* Write value to the PHY for this device to the register at  
regnum, */

 /* waiting until the write is done before it returns.  All PHY */
@@ -184,7 +207,7 @@ static void config_genmii_advert(struct
advertise = mii_info-advertising;

/* Setup standard advertisement */
-   adv = phy_read(mii_info, MII_ADVERTISE);
+   adv = ucc_geth_phy_read(mii_info, MII_ADVERTISE);
adv = ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (advertise  ADVERTISED_10baseT_Half)
adv |= ADVERTISE_10HALF;
@@ -194,7 +217,7 @@ static void config_genmii_advert(struct
adv |= ADVERTISE_100HALF;
if (advertise  ADVERTISED_100baseT_Full)
adv |= ADVERTISE_100FULL;
-   phy_write(mii_info, MII_ADVERTISE, adv);
+   ucc_geth_phy_write(mii_info, MII_ADVERTISE, adv);
 }

 static void genmii_setup_forced(struct ugeth_mii_info *mii_info)
@@ -204,7 +227,7 @@ static void genmii_setup_forced(struct u

ugphy_vdbg(%s: IN, __FUNCTION__);

-   ctrl = phy_read(mii_info, MII_BMCR);
+   ctrl = ucc_geth_phy_read(mii_info, MII_BMCR);

ctrl =
 	~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_SPEED1000 |  
BMCR_ANENABLE);

@@ -234,7 +257,7 @@ static void genmii_setup_forced(struct u
break;
}

-   phy_write(mii_info, MII_BMCR, ctrl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctrl);
 }

 /* Enable and Restart Autonegotiation */
@@ -244,9 +267,9 @@ static void genmii_restart_aneg(struct u

ugphy_vdbg(%s: IN, __FUNCTION__);

-   ctl = phy_read(mii_info, MII_BMCR);
+   ctl = ucc_geth_phy_read(mii_info, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
-   phy_write(mii_info, MII_BMCR, ctl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctl);
 }

 static int gbit_config_aneg(struct ugeth_mii_info *mii_info)
@@ -261,14 +284,14 @@ static int gbit_config_aneg(struct ugeth
config_genmii_advert(mii_info);
advertise = mii_info-advertising;

-   adv = phy_read(mii_info, MII_1000BASETCONTROL);
+   adv = ucc_geth_phy_read(mii_info, MII_1000BASETCONTROL);
adv = ~(MII_1000BASETCONTROL_FULLDUPLEXCAP |
 MII_1000BASETCONTROL_HALFDUPLEXCAP);
if (advertise  SUPPORTED_1000baseT_Half)
adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
if (advertise  SUPPORTED_1000baseT_Full)
adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
-   phy_write(mii_info, MII_1000BASETCONTROL, adv);
+   ucc_geth_phy_write(mii_info, MII_1000BASETCONTROL, adv);

/* Start/Restart aneg */
genmii_restart_aneg(mii_info);
@@ -298,10 +321,10 @@ static int genmii_update_link(struct uge
ugphy_vdbg(%s: IN, 

Re: [PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c

2006-12-18 Thread Kumar Gala

Jeff,

Can you pickup this patch for 2.6.20.  It addresses a name conflict  
issue with the phylib and the phy handling in the ucc driver.


thanks

- k

On Dec 13, 2006, at 5:08 PM, [EMAIL PROTECTED] wrote:


From: Timur Tabi [EMAIL PROTECTED]

The local versions of phy_read() and phy_write() in ucc_geth_phy.c  
conflict
with the prototypes in include/linux/phy.h, so this patch renames  
them,
moves them to the top of the file (while eliminating the redundant  
prototype),

and makes them static.

Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Signed-off-by: Kumar Gala [EMAIL PROTECTED]

---
 drivers/net/ucc_geth_phy.c |  134 + 
+--

 1 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 5360ec0..3c86592 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -68,8 +68,31 @@ static int gbit_config_aneg(struct ugeth
 static int genmii_config_aneg(struct ugeth_mii_info *mii_info);
 static int genmii_update_link(struct ugeth_mii_info *mii_info);
 static int genmii_read_status(struct ugeth_mii_info *mii_info);
-u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
-void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val);
+
+static u16 ucc_geth_phy_read(struct ugeth_mii_info *mii_info, u16  
regnum)

+{
+   u16 retval;
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+	retval = mii_info-mdio_read(mii_info-dev, mii_info-mii_id,  
regnum);

+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+
+   return retval;
+}
+
+static void ucc_geth_phy_write(struct ugeth_mii_info *mii_info,  
u16 regnum, u16 val)

+{
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   mii_info-mdio_write(mii_info-dev, mii_info-mii_id, regnum, val);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+}

 /* Write value to the PHY for this device to the register at  
regnum, */

 /* waiting until the write is done before it returns.  All PHY */
@@ -184,7 +207,7 @@ static void config_genmii_advert(struct
advertise = mii_info-advertising;

/* Setup standard advertisement */
-   adv = phy_read(mii_info, MII_ADVERTISE);
+   adv = ucc_geth_phy_read(mii_info, MII_ADVERTISE);
adv = ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (advertise  ADVERTISED_10baseT_Half)
adv |= ADVERTISE_10HALF;
@@ -194,7 +217,7 @@ static void config_genmii_advert(struct
adv |= ADVERTISE_100HALF;
if (advertise  ADVERTISED_100baseT_Full)
adv |= ADVERTISE_100FULL;
-   phy_write(mii_info, MII_ADVERTISE, adv);
+   ucc_geth_phy_write(mii_info, MII_ADVERTISE, adv);
 }

 static void genmii_setup_forced(struct ugeth_mii_info *mii_info)
@@ -204,7 +227,7 @@ static void genmii_setup_forced(struct u

ugphy_vdbg(%s: IN, __FUNCTION__);

-   ctrl = phy_read(mii_info, MII_BMCR);
+   ctrl = ucc_geth_phy_read(mii_info, MII_BMCR);

ctrl =
 	~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_SPEED1000 |  
BMCR_ANENABLE);

@@ -234,7 +257,7 @@ static void genmii_setup_forced(struct u
break;
}

-   phy_write(mii_info, MII_BMCR, ctrl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctrl);
 }

 /* Enable and Restart Autonegotiation */
@@ -244,9 +267,9 @@ static void genmii_restart_aneg(struct u

ugphy_vdbg(%s: IN, __FUNCTION__);

-   ctl = phy_read(mii_info, MII_BMCR);
+   ctl = ucc_geth_phy_read(mii_info, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
-   phy_write(mii_info, MII_BMCR, ctl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctl);
 }

 static int gbit_config_aneg(struct ugeth_mii_info *mii_info)
@@ -261,14 +284,14 @@ static int gbit_config_aneg(struct ugeth
config_genmii_advert(mii_info);
advertise = mii_info-advertising;

-   adv = phy_read(mii_info, MII_1000BASETCONTROL);
+   adv = ucc_geth_phy_read(mii_info, MII_1000BASETCONTROL);
adv = ~(MII_1000BASETCONTROL_FULLDUPLEXCAP |
 MII_1000BASETCONTROL_HALFDUPLEXCAP);
if (advertise  SUPPORTED_1000baseT_Half)
adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
if (advertise  SUPPORTED_1000baseT_Full)
adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
-   phy_write(mii_info, MII_1000BASETCONTROL, adv);
+   ucc_geth_phy_write(mii_info, MII_1000BASETCONTROL, adv);

/* Start/Restart aneg */
genmii_restart_aneg(mii_info);
@@ -298,10 +321,10 @@ static int genmii_update_link(struct uge
ugphy_vdbg(%s: IN, __FUNCTION__);

/* Do a fake read */
-   phy_read(mii_info, MII_BMSR);
+   ucc_geth_phy_read(mii_info, 

[PATCH] Fix phy_read/write redefinition errors in ucc_geth_phy.c

2006-12-13 Thread timur
From: Timur Tabi [EMAIL PROTECTED]

The local versions of phy_read() and phy_write() in ucc_geth_phy.c conflict
with the prototypes in include/linux/phy.h, so this patch renames them, 
moves them to the top of the file (while eliminating the redundant prototype),
and makes them static.

Signed-off-by: Timur Tabi [EMAIL PROTECTED]
Signed-off-by: Kumar Gala [EMAIL PROTECTED]

---
 drivers/net/ucc_geth_phy.c |  134 ++--
 1 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 5360ec0..3c86592 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -68,8 +68,31 @@ static int gbit_config_aneg(struct ugeth
 static int genmii_config_aneg(struct ugeth_mii_info *mii_info);
 static int genmii_update_link(struct ugeth_mii_info *mii_info);
 static int genmii_read_status(struct ugeth_mii_info *mii_info);
-u16 phy_read(struct ugeth_mii_info *mii_info, u16 regnum);
-void phy_write(struct ugeth_mii_info *mii_info, u16 regnum, u16 val);
+
+static u16 ucc_geth_phy_read(struct ugeth_mii_info *mii_info, u16 regnum)
+{
+   u16 retval;
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   retval = mii_info-mdio_read(mii_info-dev, mii_info-mii_id, regnum);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+
+   return retval;
+}
+
+static void ucc_geth_phy_write(struct ugeth_mii_info *mii_info, u16 regnum, 
u16 val)
+{
+   unsigned long flags;
+
+   ugphy_vdbg(%s: IN, __FUNCTION__);
+
+   spin_lock_irqsave(mii_info-mdio_lock, flags);
+   mii_info-mdio_write(mii_info-dev, mii_info-mii_id, regnum, val);
+   spin_unlock_irqrestore(mii_info-mdio_lock, flags);
+}
 
 /* Write value to the PHY for this device to the register at regnum, */
 /* waiting until the write is done before it returns.  All PHY */
@@ -184,7 +207,7 @@ static void config_genmii_advert(struct
advertise = mii_info-advertising;
 
/* Setup standard advertisement */
-   adv = phy_read(mii_info, MII_ADVERTISE);
+   adv = ucc_geth_phy_read(mii_info, MII_ADVERTISE);
adv = ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (advertise  ADVERTISED_10baseT_Half)
adv |= ADVERTISE_10HALF;
@@ -194,7 +217,7 @@ static void config_genmii_advert(struct
adv |= ADVERTISE_100HALF;
if (advertise  ADVERTISED_100baseT_Full)
adv |= ADVERTISE_100FULL;
-   phy_write(mii_info, MII_ADVERTISE, adv);
+   ucc_geth_phy_write(mii_info, MII_ADVERTISE, adv);
 }
 
 static void genmii_setup_forced(struct ugeth_mii_info *mii_info)
@@ -204,7 +227,7 @@ static void genmii_setup_forced(struct u
 
ugphy_vdbg(%s: IN, __FUNCTION__);
 
-   ctrl = phy_read(mii_info, MII_BMCR);
+   ctrl = ucc_geth_phy_read(mii_info, MII_BMCR);
 
ctrl =
~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_SPEED1000 | BMCR_ANENABLE);
@@ -234,7 +257,7 @@ static void genmii_setup_forced(struct u
break;
}
 
-   phy_write(mii_info, MII_BMCR, ctrl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctrl);
 }
 
 /* Enable and Restart Autonegotiation */
@@ -244,9 +267,9 @@ static void genmii_restart_aneg(struct u
 
ugphy_vdbg(%s: IN, __FUNCTION__);
 
-   ctl = phy_read(mii_info, MII_BMCR);
+   ctl = ucc_geth_phy_read(mii_info, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
-   phy_write(mii_info, MII_BMCR, ctl);
+   ucc_geth_phy_write(mii_info, MII_BMCR, ctl);
 }
 
 static int gbit_config_aneg(struct ugeth_mii_info *mii_info)
@@ -261,14 +284,14 @@ static int gbit_config_aneg(struct ugeth
config_genmii_advert(mii_info);
advertise = mii_info-advertising;
 
-   adv = phy_read(mii_info, MII_1000BASETCONTROL);
+   adv = ucc_geth_phy_read(mii_info, MII_1000BASETCONTROL);
adv = ~(MII_1000BASETCONTROL_FULLDUPLEXCAP |
 MII_1000BASETCONTROL_HALFDUPLEXCAP);
if (advertise  SUPPORTED_1000baseT_Half)
adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
if (advertise  SUPPORTED_1000baseT_Full)
adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
-   phy_write(mii_info, MII_1000BASETCONTROL, adv);
+   ucc_geth_phy_write(mii_info, MII_1000BASETCONTROL, adv);
 
/* Start/Restart aneg */
genmii_restart_aneg(mii_info);
@@ -298,10 +321,10 @@ static int genmii_update_link(struct uge
ugphy_vdbg(%s: IN, __FUNCTION__);
 
/* Do a fake read */
-   phy_read(mii_info, MII_BMSR);
+   ucc_geth_phy_read(mii_info, MII_BMSR);
 
/* Read link and autonegotiation status */
-   status = phy_read(mii_info, MII_BMSR);
+   status = ucc_geth_phy_read(mii_info, MII_BMSR);
if ((status  BMSR_LSTATUS) == 0)