netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: broadcom MDIO support for broken turn-around
@ 2015-06-10 19:14 Florian Fainelli
  2015-06-10 19:14 ` [PATCH net-next 1/2] net: bcmgenet: handle broken turn-around for specific PHYs Florian Fainelli
  2015-06-10 19:14 ` [PATCH net-next 2/2] net: phy: mdio-bcm-unimac: " Florian Fainelli
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-06-10 19:14 UTC (permalink / raw)
  To: netdev; +Cc: davem, pgynther, jaedon.shin, Florian Fainelli

Hi David,

These two patches update the GENET and UniMAC MDIO controllers to deal with
PHYs that are known to have a broken turn-around bug (e.g: BCM53125 and others)

This utilizes the infrastructure that code recently added to do that in 'net-next'.

Note that the changes look nearly identical and I will try to address the MDIO
code duplication between GENET and UniMAC in a future patch series.

Thanks!

Florian Fainelli (2):
  net: bcmgenet: handle broken turn-around for specific PHYs
  net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs

 drivers/net/ethernet/broadcom/genet/bcmmii.c | 7 ++++++-
 drivers/net/phy/mdio-bcm-unimac.c            | 3 ++-
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] net: bcmgenet: handle broken turn-around for specific PHYs
  2015-06-10 19:14 [PATCH net-next 0/2] net: broadcom MDIO support for broken turn-around Florian Fainelli
@ 2015-06-10 19:14 ` Florian Fainelli
  2015-06-10 19:14 ` [PATCH net-next 2/2] net: phy: mdio-bcm-unimac: " Florian Fainelli
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-06-10 19:14 UTC (permalink / raw)
  To: netdev; +Cc: davem, pgynther, jaedon.shin, Florian Fainelli

Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware
bug which makes them not release the MDIO line during turn-around time.
This gets flagged by the GENET MDIO controller as a read failure, and we
fail the read transaction.

Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading
from and if it is listed in this bitmask, ignore the read failure and
proceed with returning the data we read out of the controller.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 420949cc55aa..6bef04e2f735 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -47,7 +47,12 @@ static int bcmgenet_mii_read(struct mii_bus *bus, int phy_id, int location)
 			   HZ / 100);
 	ret = bcmgenet_umac_readl(priv, UMAC_MDIO_CMD);
 
-	if (ret & MDIO_READ_FAIL)
+	/* Some broken devices are known not to release the line during
+	 * turn-around, e.g: Broadcom BCM53125 external switches, so check for
+	 * that condition here and ignore the MDIO controller read failure
+	 * indication.
+	 */
+	if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (ret & MDIO_READ_FAIL))
 		return -EIO;
 
 	return ret & 0xffff;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs
  2015-06-10 19:14 [PATCH net-next 0/2] net: broadcom MDIO support for broken turn-around Florian Fainelli
  2015-06-10 19:14 ` [PATCH net-next 1/2] net: bcmgenet: handle broken turn-around for specific PHYs Florian Fainelli
@ 2015-06-10 19:14 ` Florian Fainelli
  2015-06-10 19:17   ` Florian Fainelli
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2015-06-10 19:14 UTC (permalink / raw)
  To: netdev; +Cc: davem, pgynther, jaedon.shin, Florian Fainelli

Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug
which makes them not release the MDIO line during turn-around time.  This gets
flagged by the UniMAC MDIO controller as a read failure, and we fail the read
transaction.

Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading
from and if it is listed in this bitmask, ignore the read failure and
proceed with returning the data we read out of the controller.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/mdio-bcm-unimac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c
index 414fdf1f343f..2237d5554e02 100644
--- a/drivers/net/phy/mdio-bcm-unimac.c
+++ b/drivers/net/phy/mdio-bcm-unimac.c
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/delay.h>
+#include <linux/brcmphy.h>
 
 #include <linux/of.h>
 #include <linux/of_platform.h>
@@ -81,7 +82,7 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
 		return -ETIMEDOUT;
 
 	cmd = __raw_readl(priv->base + MDIO_CMD);
-	if (cmd & MDIO_READ_FAIL)
+	if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL))
 		return -EIO;
 
 	return cmd & 0xffff;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 2/2] net: phy: mdio-bcm-unimac: handle broken turn-around for specific PHYs
  2015-06-10 19:14 ` [PATCH net-next 2/2] net: phy: mdio-bcm-unimac: " Florian Fainelli
@ 2015-06-10 19:17   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-06-10 19:17 UTC (permalink / raw)
  To: netdev; +Cc: davem, pgynther, jaedon.shin

On 10/06/15 12:14, Florian Fainelli wrote:
> Some Ethernet PHYs/switches such as Broadcom's BCM53125 have a hardware bug
> which makes them not release the MDIO line during turn-around time.  This gets
> flagged by the UniMAC MDIO controller as a read failure, and we fail the read
> transaction.
> 
> Check the MDIO bus phy_ignore_ta_mask bitmask for the PHY we are reading
> from and if it is listed in this bitmask, ignore the read failure and
> proceed with returning the data we read out of the controller.

Scratch that version, it contains an unnecessary include and does not
have the same comment as the GENET version, let me resubmit that.

> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/net/phy/mdio-bcm-unimac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/mdio-bcm-unimac.c b/drivers/net/phy/mdio-bcm-unimac.c
> index 414fdf1f343f..2237d5554e02 100644
> --- a/drivers/net/phy/mdio-bcm-unimac.c
> +++ b/drivers/net/phy/mdio-bcm-unimac.c
> @@ -16,6 +16,7 @@
>  #include <linux/module.h>
>  #include <linux/io.h>
>  #include <linux/delay.h>
> +#include <linux/brcmphy.h>
>  
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
> @@ -81,7 +82,7 @@ static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg)
>  		return -ETIMEDOUT;
>  
>  	cmd = __raw_readl(priv->base + MDIO_CMD);
> -	if (cmd & MDIO_READ_FAIL)
> +	if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL))
>  		return -EIO;
>  
>  	return cmd & 0xffff;
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-10 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 19:14 [PATCH net-next 0/2] net: broadcom MDIO support for broken turn-around Florian Fainelli
2015-06-10 19:14 ` [PATCH net-next 1/2] net: bcmgenet: handle broken turn-around for specific PHYs Florian Fainelli
2015-06-10 19:14 ` [PATCH net-next 2/2] net: phy: mdio-bcm-unimac: " Florian Fainelli
2015-06-10 19:17   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).