diff mbox

[U-Boot,3/6] net: phy: realtek: Use generic genphy_parse_link() for RTL8211E

Message ID 49e06584fffd21613ec604becdf372e8b2c32bd0.1455359979.git.monstr@monstr.eu
State Accepted
Commit 6a10bc5be8b809d43af7ddb66c45eeff7e622da1
Delegated to: Michal Simek
Headers show

Commit Message

Michal Simek Feb. 13, 2016, 10:39 a.m. UTC
The problem with current implementation is that SPDDONE bit is 1
but link bit is zero. That's why phydev->link is setup to 0
which ending up in driver failure that link is not up.

Log:
Zynq> dhcp
ethernet@e000b000 Waiting for PHY auto negotiation to complete.......
done
ethernet@e000b000: No link.

There is at least 1ms delay between spddone bit and link up.

Use genphy_read_status() instead of realtek implemenation which is
working with page 11. Linux driver is also using generic implementation.

Signed-off-by: Michal Simek <monstr@monstr.eu>
---

 drivers/net/phy/realtek.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Michal Simek Feb. 22, 2016, 3:15 p.m. UTC | #1
On 13.2.2016 11:39, Michal Simek wrote:
> The problem with current implementation is that SPDDONE bit is 1
> but link bit is zero. That's why phydev->link is setup to 0
> which ending up in driver failure that link is not up.
> 
> Log:
> Zynq> dhcp
> ethernet@e000b000 Waiting for PHY auto negotiation to complete.......
> done
> ethernet@e000b000: No link.
> 
> There is at least 1ms delay between spddone bit and link up.
> 
> Use genphy_read_status() instead of realtek implemenation which is
> working with page 11. Linux driver is also using generic implementation.
> 
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
> 
>  drivers/net/phy/realtek.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index bba48da4099f..259a87fcc59e 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -203,6 +203,14 @@ static int rtl8211x_startup(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +static int rtl8211e_startup(struct phy_device *phydev)
> +{
> +	genphy_update_link(phydev);
> +	genphy_parse_link(phydev);
> +
> +	return 0;
> +}
> +
>  static int rtl8211f_startup(struct phy_device *phydev)
>  {
>  	/* Read the Status (2x to make sure link is right) */
> @@ -230,7 +238,7 @@ static struct phy_driver RTL8211E_driver = {
>  	.mask = 0xffffff,
>  	.features = PHY_GBIT_FEATURES,
>  	.config = &rtl8211x_config,
> -	.startup = &rtl8211x_startup,
> +	.startup = &rtl8211e_startup,
>  	.shutdown = &genphy_shutdown,
>  };
>  

Applied to zynq repo.

Thanks,
Michal
diff mbox

Patch

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index bba48da4099f..259a87fcc59e 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -203,6 +203,14 @@  static int rtl8211x_startup(struct phy_device *phydev)
 	return 0;
 }
 
+static int rtl8211e_startup(struct phy_device *phydev)
+{
+	genphy_update_link(phydev);
+	genphy_parse_link(phydev);
+
+	return 0;
+}
+
 static int rtl8211f_startup(struct phy_device *phydev)
 {
 	/* Read the Status (2x to make sure link is right) */
@@ -230,7 +238,7 @@  static struct phy_driver RTL8211E_driver = {
 	.mask = 0xffffff,
 	.features = PHY_GBIT_FEATURES,
 	.config = &rtl8211x_config,
-	.startup = &rtl8211x_startup,
+	.startup = &rtl8211e_startup,
 	.shutdown = &genphy_shutdown,
 };