From patchwork Mon Feb 3 16:19:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 232256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5682C35247 for ; Mon, 3 Feb 2020 16:22:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B0112080D for ; Mon, 3 Feb 2020 16:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580746951; bh=yIaFWaVMSt2y25mVFtAuWOnj2Pp75BFUPP6vIWIKgfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2tA4WML5GlCR+MxRvwd4r9SztyiD6fdiNe33tpvyrab3VNQ/FdHbXSqf5+VmjWXRZ C7vvNi02ezKldyvnce6SMyWzMnkU7M1OgtZ6hWjq6frKquV5sZuBGK/I/TCkfxE1mu ByZHMCaxqoy6ILJOGRS0trkZ2R2KMqn3hO0HgG7k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729155AbgBCQVZ (ORCPT ); Mon, 3 Feb 2020 11:21:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:33228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728543AbgBCQVV (ORCPT ); Mon, 3 Feb 2020 11:21:21 -0500 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C77D821582; Mon, 3 Feb 2020 16:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580746881; bh=yIaFWaVMSt2y25mVFtAuWOnj2Pp75BFUPP6vIWIKgfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoSzqCv7UFueQTM0oEdMF7CFYqfdoR2jY5m2PUpJk0JfxoKTHFKHmmVDCVZ+9/SmT 6egURS54et1SobDlVGaOhe1UoDIXHbnwMbuvsB/fo8CIkT+3GTQRhkH9oB0i4emvIg 0+wqvieqDYTUbg1NI6IiirVU6IsGqb3MkduNmp9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Madalin Bucur , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 46/53] net/fsl: treat fsl,erratum-a011043 Date: Mon, 3 Feb 2020 16:19:38 +0000 Message-Id: <20200203161910.963995566@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161902.714326084@linuxfoundation.org> References: <20200203161902.714326084@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Madalin Bucur [ Upstream commit 1d3ca681b9d9575ccf696ebc2840a1ebb1fd4074 ] When fsl,erratum-a011043 is set, adjust for erratum A011043: MDIO reads to internal PCS registers may result in having the MDIO_CFG[MDIO_RD_ER] bit set, even when there is no error and read data (MDIO_DATA[MDIO_DATA]) is correct. Software may get false read error when reading internal PCS registers through MDIO. As a workaround, all internal MDIO accesses should ignore the MDIO_CFG[MDIO_RD_ER] bit. Signed-off-by: Madalin Bucur Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/xgmac_mdio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 7b8fe866f6038..a15b4a97c172d 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -49,6 +49,7 @@ struct tgec_mdio_controller { struct mdio_fsl_priv { struct tgec_mdio_controller __iomem *mdio_base; bool is_little_endian; + bool has_a011043; }; static u32 xgmac_read32(void __iomem *regs, @@ -226,7 +227,8 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) return ret; /* Return all Fs if nothing was there */ - if (xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) { + if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) && + !priv->has_a011043) { dev_err(&bus->dev, "Error while reading PHY%d reg at %d.%hhu\n", phy_id, dev_addr, regnum); @@ -277,6 +279,9 @@ static int xgmac_mdio_probe(struct platform_device *pdev) else priv->is_little_endian = false; + priv->has_a011043 = of_property_read_bool(pdev->dev.of_node, + "fsl,erratum-a011043"); + ret = of_mdiobus_register(bus, np); if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n");