From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: [PATCH net-next 1/2] net: bcmgenet: handle broken turn-around for specific PHYs Date: Wed, 10 Jun 2015 12:14:02 -0700 Message-ID: <1433963643-15851-2-git-send-email-f.fainelli@gmail.com> References: <1433963643-15851-1-git-send-email-f.fainelli@gmail.com> Cc: davem@davemloft.net, pgynther@google.com, jaedon.shin@gmail.com, Florian Fainelli To: netdev@vger.kernel.org Return-path: Received: from mail-qg0-f46.google.com ([209.85.192.46]:34832 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933001AbbFJTPQ (ORCPT ); Wed, 10 Jun 2015 15:15:16 -0400 Received: by qgg3 with SMTP id 3so19644811qgg.2 for ; Wed, 10 Jun 2015 12:15:16 -0700 (PDT) In-Reply-To: <1433963643-15851-1-git-send-email-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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