From patchwork Tue Jan 18 21:50:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12716936 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABD40C433EF for ; Tue, 18 Jan 2022 21:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349626AbiARVvL (ORCPT ); Tue, 18 Jan 2022 16:51:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234970AbiARVvK (ORCPT ); Tue, 18 Jan 2022 16:51:10 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B99C061574 for ; Tue, 18 Jan 2022 13:51:10 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id p27so1011253lfa.1 for ; Tue, 18 Jan 2022 13:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=zCzfaUBZlnSSUo3UCXDV+58rEZH0xND460lZC6VQ+x8=; b=fr442tV30SPPVvNjAJ+6tm6MiDMwOazAaLg67MwH9+7ljvQ3L5qKhW+jYlzbdKVWLX K3ZVTBXEKFrpdt5aOGc2ZyT03uEDbvbW/IN5VayV3XFufPzAHQTwOVN0JbzPksQKF/eq OTmRbWoRp2Qa95RZx0agz2gP2BAk10WI++OelkFnyaUz4+BvWakgmEMKwwRD8brp6IZN DhmnryEr5NSQcPieiCW/WGE+f7tWE5bbOFlf9KJBnGJNBzENL+lSKgYECSTrYsEnw33r Y9lQKFnW19NFURl1IXH2ZLPNGmcWtDjhaRTuIbMEZn/QK5UIcA2mnjvdTsYbYpd3At6b /OkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=zCzfaUBZlnSSUo3UCXDV+58rEZH0xND460lZC6VQ+x8=; b=a74M/NUdNSq4fLRM2cuT1dmZyrP9oEb1HCr7IQNp/mG8kGhl4xGEycCB4JWbOXT4NU p2cdI0ePnsjfSjAve4UDnB2bSRsWJFRJyuBa53fth0R3p+X9eLj9Ppc00bUjSyo+LeNO wptxZmDsooQKNFiB6n+1eA1hPX7zcrbk0vQ8KYxfKQGj9PTiJriy4IhJyEKTEPCAMGVM RoT2KR3fSv8cd9Lh7DZw4xAXjMojsUAjmuhuZP7Kav5aCHBSBwlN9KF2BQIo69I0lbjR lIJcOttEz+5yyBzZvUVXQCczrakFH8DXt8pp8pWZxaCtoHOYSYeJ4Tkc79dR02FupelM hgKQ== X-Gm-Message-State: AOAM532mVRkS+MbaC8TfR+GwTLc5BMt1E/kAdStgLFmwPRcXqS0Shdj/ //ofjKGC/3iIdr5zeZIeOSvrPw== X-Google-Smtp-Source: ABdhPJx8F/qHg4qYSzsPl0mr7Mwad+xTfKkS+TZF/uCxuSb6aG+L14Ml/MPRTFKeEasSt39iP32ybQ== X-Received: by 2002:a05:6512:10d2:: with SMTP id k18mr22808024lfg.640.1642542668486; Tue, 18 Jan 2022 13:51:08 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id w5sm1704808ljm.55.2022.01.18.13.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 13:51:08 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Shruti Kanetkar , Emil Medve , Scott Wood , Igal Liberman , linux-kernel@vger.kernel.org Subject: [PATCH v2 net 1/4] net/fsl: xgmac_mdio: Add workaround for erratum A-009885 Date: Tue, 18 Jan 2022 22:50:50 +0100 Message-Id: <20220118215054.2629314-2-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118215054.2629314-1-tobias@waldekranz.com> References: <20220118215054.2629314-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Once an MDIO read transaction is initiated, we must read back the data register within 16 MDC cycles after the transaction completes. Outside of this window, reads may return corrupt data. Therefore, disable local interrupts in the critical section, to maximize the probability that we can satisfy this requirement. Fixes: d55ad2967d89 ("powerpc/mpc85xx: Create dts components for the FSL QorIQ DPAA FMan") Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- drivers/net/ethernet/freescale/xgmac_mdio.c | 25 ++++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 5b8b9bcf41a2..bf566ac3195b 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -51,6 +51,7 @@ struct tgec_mdio_controller { struct mdio_fsl_priv { struct tgec_mdio_controller __iomem *mdio_base; bool is_little_endian; + bool has_a009885; bool has_a011043; }; @@ -186,10 +187,10 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) { struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; struct tgec_mdio_controller __iomem *regs = priv->mdio_base; + unsigned long flags; uint16_t dev_addr; uint32_t mdio_stat; uint32_t mdio_ctl; - uint16_t value; int ret; bool endian = priv->is_little_endian; @@ -221,12 +222,18 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) return ret; } + if (priv->has_a009885) + /* Once the operation completes, i.e. MDIO_STAT_BSY clears, we + * must read back the data register within 16 MDC cycles. + */ + local_irq_save(flags); + /* Initiate the read */ xgmac_write32(mdio_ctl | MDIO_CTL_READ, ®s->mdio_ctl, endian); ret = xgmac_wait_until_done(&bus->dev, regs, endian); if (ret) - return ret; + goto irq_restore; /* Return all Fs if nothing was there */ if ((xgmac_read32(®s->mdio_stat, endian) & MDIO_STAT_RD_ER) && @@ -234,13 +241,17 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) dev_dbg(&bus->dev, "Error while reading PHY%d reg at %d.%hhu\n", phy_id, dev_addr, regnum); - return 0xffff; + ret = 0xffff; + } else { + ret = xgmac_read32(®s->mdio_data, endian) & 0xffff; + dev_dbg(&bus->dev, "read %04x\n", ret); } - value = xgmac_read32(®s->mdio_data, endian) & 0xffff; - dev_dbg(&bus->dev, "read %04x\n", value); +irq_restore: + if (priv->has_a009885) + local_irq_restore(flags); - return value; + return ret; } static int xgmac_mdio_probe(struct platform_device *pdev) @@ -287,6 +298,8 @@ static int xgmac_mdio_probe(struct platform_device *pdev) priv->is_little_endian = device_property_read_bool(&pdev->dev, "little-endian"); + priv->has_a009885 = device_property_read_bool(&pdev->dev, + "fsl,erratum-a009885"); priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); From patchwork Tue Jan 18 21:50:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12716937 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1568BC433F5 for ; Tue, 18 Jan 2022 21:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349689AbiARVvN (ORCPT ); Tue, 18 Jan 2022 16:51:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349634AbiARVvM (ORCPT ); Tue, 18 Jan 2022 16:51:12 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 033D0C061574 for ; Tue, 18 Jan 2022 13:51:11 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id b14so975255lff.3 for ; Tue, 18 Jan 2022 13:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=a9S0CLeHZ4ew4bWk4chYd42UWn+5cFA6bwUpUuawUus=; b=aBRiSVIU3yEaOaFkGFSoBvmENqnUL2QKwtck0x/uN4RvKh2U7UNHTkhgljqjdXrXQR Xhd4JHegSv+VNhmat5jWWKfdxjz8vu0UOoIEXyzE8/e2qRBqi1MZCnmimb4kVtM/SnYf zN1ZLCa5Y3r1nXz7PO639g85Tj+fbGTqc9f5qIlLjO3XYwC513vesZ5hAhkSwZ2VRu5O xEvuhv+Apj98zxy5zboGO8zbW/6o3u83Wa3KLjrWkoW9KW+dkZtbUFz7Kj0Pqnig2Bx0 dY9oJoHtqjVy4RKn1KvU1C37/I5Wq9pbjGjCFbTvTDTIu/OvK4nZWhjqoSzGDdFF/LTn JKZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=a9S0CLeHZ4ew4bWk4chYd42UWn+5cFA6bwUpUuawUus=; b=lycS+XMywOkWTVt+vNhzXiJv9cDv/wQRSEAec+9Sb1LOv3w6EZAstrUOb5N7ZK9b97 lIlMBTIY81srbcf2h0QfxP+TQ+L0Y2oWWtagifKnlzgSJN0E0gbn1iSvhmq164FKKeon 20OR4o4ZPZ7MAqq+czsUSKguVoDz4tfssFZLn5rbOJFS0K0aRfIeQ0s444fROre10IBl wZC6NtSi566ji8gLsKStuEi5qZj7ZuzlPSW0WroB6xrr8It7rKfWzYNSCG3yUicUSFrA c8Vs1AASOBCQVDGjyh6bjcp0+opLnLNvcEqm3am6SKBHVbKRDI88u6G8nr3QW2lktg3o CLEQ== X-Gm-Message-State: AOAM530B2spcFfx0Hd1y2CkAGM1ZTxe60Hys78UoEJv+MnCilIvkv/EB kbkGULMmtM6MUI4WuSULXdHV0w== X-Google-Smtp-Source: ABdhPJyk4QiT1nBRu2dGik/I04/l1JsCAZrcV6ZDy+E76mPjKchP2tTv5AGOhYzQE2pfCTNTn6lr+Q== X-Received: by 2002:a19:760d:: with SMTP id c13mr23340474lff.289.1642542669413; Tue, 18 Jan 2022 13:51:09 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id w5sm1704808ljm.55.2022.01.18.13.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 13:51:09 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Madalin Bucur , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net 2/4] dt-bindings: net: Document fsl,erratum-a009885 Date: Tue, 18 Jan 2022 22:50:51 +0100 Message-Id: <20220118215054.2629314-3-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118215054.2629314-1-tobias@waldekranz.com> References: <20220118215054.2629314-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Update FMan binding documentation with the newly added workaround for erratum A-009885. Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- Documentation/devicetree/bindings/net/fsl-fman.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/net/fsl-fman.txt b/Documentation/devicetree/bindings/net/fsl-fman.txt index c00fb0d22c7b..020337f3c05f 100644 --- a/Documentation/devicetree/bindings/net/fsl-fman.txt +++ b/Documentation/devicetree/bindings/net/fsl-fman.txt @@ -410,6 +410,15 @@ PROPERTIES The settings and programming routines for internal/external MDIO are different. Must be included for internal MDIO. +- fsl,erratum-a009885 + Usage: optional + Value type: + Definition: Indicates the presence of the A009885 + erratum describing that the contents of MDIO_DATA may + become corrupt unless it is read within 16 MDC cycles + of MDIO_CFG[BSY] being cleared, when performing an + MDIO read operation. + - fsl,erratum-a011043 Usage: optional Value type: From patchwork Tue Jan 18 21:50:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12716938 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4D68C433EF for ; Tue, 18 Jan 2022 21:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349704AbiARVvO (ORCPT ); Tue, 18 Jan 2022 16:51:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349666AbiARVvM (ORCPT ); Tue, 18 Jan 2022 16:51:12 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3912C061746 for ; Tue, 18 Jan 2022 13:51:11 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id x11so995935lfa.2 for ; Tue, 18 Jan 2022 13:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=Fh88UieW6M3tWsjtjC/VnGD/KSjEuK5OFMLJWUnuCow=; b=dxSQq+S4FDQSUQHu6og87yfSFEKZ7VwwgvfVP0ypGeLxAWpyg6p84iP92YGMNP3PbB RNtvkOFn5BYHTjAGLoLMBYk3RTL+qJSWtnEHNQFeXnwQvKFk86F8Opbk9G0UQLy2fIoA bPUCNja0E7VUKDij25LC6ZaxL0oEZKhq5AkQMaCB6pXwv3kh8bza+q+EDV1auYPY+8Uk VL5RtYkp7L5SYJrr6pwHvIvdBw/07aMvd7pCLyyaWHJMCTh/qLr0qOhedf+tiPx3gral TdFIMrs4KzEVqcvsiEIZSzoXnG0CV/TzKz/DAiI7a/BzxLMe2xBtxfjsva++gKE0GiQT aWWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=Fh88UieW6M3tWsjtjC/VnGD/KSjEuK5OFMLJWUnuCow=; b=Z5U8o+E+CMTwee6nfUQVhyfMP6lO97HnEzNO9RouySP0g3LVjGjhZH53ZM5pgNjJ9w fDCplb1zFmsXRQv8DiTLqdpStZQh1/NOxWgl8nqRT/aqHgRfSWN7i6PeHnh66O3u7XCm +7Y+I/1KAxmaX1HMbzgs+O8gXuLBeLNO/UNSpQLVxRzf0ILb4N4sOMV2BulN8OQEJSua nh3V2RQMdwbuDmAma8DXgag3Ml7Wl9MTbZ7e+lpjzo2TMf9cXCnB79lXCkKyUA9FYxVC J3R3Ffj9V1/ZvkC5/5VcEKwbLcaVpnflNV/JAuz4kJxrpa4J3zxRlVFpi+Hxf6H3X2Ho TZvQ== X-Gm-Message-State: AOAM530xZyedQ3S0th0Sx47Ji+HiTAv6S8s7VFVmgCx4TF30wP3Yk0hz h1AQt3H5PxN8B4Itxbn80KWOMg== X-Google-Smtp-Source: ABdhPJxYJU4hIMsPmX47okJRLdOdBxNXXO11G7oGsTPSSdPTN2zTc/EXE0bTmhvpGf1opGlzns8huA== X-Received: by 2002:a2e:144f:: with SMTP id 15mr21537821lju.326.1642542670287; Tue, 18 Jan 2022 13:51:10 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id w5sm1704808ljm.55.2022.01.18.13.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 13:51:09 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Rob Herring , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Shruti Kanetkar , Igal Liberman , Emil Medve , Scott Wood , devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net 3/4] powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses Date: Tue, 18 Jan 2022 22:50:52 +0100 Message-Id: <20220118215054.2629314-4-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118215054.2629314-1-tobias@waldekranz.com> References: <20220118215054.2629314-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This block is used in (at least) T1024 and T1040, including their variants like T1023 etc. Fixes: d55ad2967d89 ("powerpc/mpc85xx: Create dts components for the FSL QorIQ DPAA FMan") Signed-off-by: Tobias Waldekranz --- arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi index c90702b04a53..48e5cd61599c 100644 --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3l-0.dtsi @@ -79,6 +79,7 @@ mdio0: mdio@fc000 { #size-cells = <0>; compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg = <0xfc000 0x1000>; + fsl,erratum-a009885; }; xmdio0: mdio@fd000 { @@ -86,6 +87,7 @@ xmdio0: mdio@fd000 { #size-cells = <0>; compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; reg = <0xfd000 0x1000>; + fsl,erratum-a009885; }; }; From patchwork Tue Jan 18 21:50:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12716939 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95AC6C433EF for ; Tue, 18 Jan 2022 21:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349774AbiARVvT (ORCPT ); Tue, 18 Jan 2022 16:51:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349688AbiARVvN (ORCPT ); Tue, 18 Jan 2022 16:51:13 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D54CAC061574 for ; Tue, 18 Jan 2022 13:51:12 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id b14so975527lff.3 for ; Tue, 18 Jan 2022 13:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:organization:content-transfer-encoding; bh=JeYoWwfchvNJOmrZgHyYDokoWzu/xjtZKfF1uxEPiY0=; b=4PrA+f6BhxoJRVWv4pzCCp7JcgyL+SZ4Hx2xPu+iqc8A34u9z7lX/pHyhw4ZVJ3DFt LbGrgWmC0g5mCDQAsOWOHwNYYYp4ADtFkqWRqC8zNoEACrugXDGqcCFbslSeGmaphapc VRoLdYETqUAuQ6ftH02tRJRcbUE7gh+LqMqgt8vHBSTJFJV1cWDRXYf5wWXhg4X66fMf yj7kyBw7Oei15CA4t4gjSgqEgim/yFU+OvSCLec/OdteG/CEtvdVKo6BJ6ihGUbBElNR XrQKNfC8Yn2lDXitCsoixlImwxs1QuCIdhPEceXSmTQz4ql/JsKktrwvbGP/aPIptWbj PaTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:organization:content-transfer-encoding; bh=JeYoWwfchvNJOmrZgHyYDokoWzu/xjtZKfF1uxEPiY0=; b=qYD4M1Tbwtnh71zlpQ/GIhZtr6w3g1mDDKFWnSAxES3i3YyoTb0PuZObjb4PNgMT1w bS2KMOmAzL2BcsUqI4NdoEWZrkdq65f1nuX1gVx7hI4H7DfLZ6ULqCFhC/v7PgL09DW2 YIunzSl0svV39Lbff4+F/H++XkJTYO6fRLOawHcce82Yns3xs708uzCv3CWjacV1NU/q w7H5zVmOC/dQF2yvIZMCJuW43NkyJEInIDNCJ9urljc5c4b7IRbkiSRcruFPwrurFr0N GbYY0OTsENmK063anitptIIwo3YssdmTLWri1BWPV0M9XJtSUKI0pJ8GN2oj2IQjWIoe z1uQ== X-Gm-Message-State: AOAM532lL5cwX2GSAPc8y08h0WURjXi8MvUu0OSda0ilKd0+iEPR1sgI 9VoMHwjnhUnjfbBzuaDifmH95g== X-Google-Smtp-Source: ABdhPJwG2GbqbOuxYvUygDn3T+Khl6cMcmtGwzlWfulo6HUOsG2urxLos90dWacYQlHql3n4YGYpag== X-Received: by 2002:ac2:531a:: with SMTP id c26mr22724055lfh.356.1642542671173; Tue, 18 Jan 2022 13:51:11 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id w5sm1704808ljm.55.2022.01.18.13.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 13:51:10 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Timur Tabi , linux-kernel@vger.kernel.org Subject: [PATCH v2 net 4/4] net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module Date: Tue, 18 Jan 2022 22:50:53 +0100 Message-Id: <20220118215054.2629314-5-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118215054.2629314-1-tobias@waldekranz.com> References: <20220118215054.2629314-1-tobias@waldekranz.com> MIME-Version: 1.0 Organization: Westermo Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org As reported by sparse: In the remove path, the driver would attempt to unmap its own priv pointer - instead of the io memory that it mapped in probe. Fixes: 9f35a7342cff ("net/fsl: introduce Freescale 10G MDIO driver") Signed-off-by: Tobias Waldekranz Reviewed-by: Andrew Lunn --- drivers/net/ethernet/freescale/xgmac_mdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bf566ac3195b..266e562bd67a 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -331,9 +331,10 @@ static int xgmac_mdio_probe(struct platform_device *pdev) static int xgmac_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus = platform_get_drvdata(pdev); + struct mdio_fsl_priv *priv = bus->priv; mdiobus_unregister(bus); - iounmap(bus->priv); + iounmap(priv->mdio_base); mdiobus_free(bus); return 0;