From patchwork Sun Jan 16 21:15:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12714676 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 3D5D9C433F5 for ; Sun, 16 Jan 2022 21:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236182AbiAPVQB (ORCPT ); Sun, 16 Jan 2022 16:16:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233720AbiAPVQA (ORCPT ); Sun, 16 Jan 2022 16:16:00 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6BA5C06161C for ; Sun, 16 Jan 2022 13:15:59 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id d18-20020a05600c251200b0034974323cfaso19828250wma.4 for ; Sun, 16 Jan 2022 13:15:59 -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=PHk1aD/4El+ognxt4Ln9ghxHgBZDWsxupIrwsqWIzL0=; b=d1ha2+4cMc+x6oyVstELvpTRB1yu/umWD4RZCIZY/Q4RZhnCSOAcN8GmNAjE72Ajs/ yFC1jKcFPgXT2ytcbLf7ES1xKcTQEfKIU7NsRa+YZoSjmHqETVezdLkKM6+wPv/9Uymj Y8LujmNoBzvlG0xO5xzjCtZNdh4vRy2O/tB+tVnXs1G5Rc8F8lYegJDnSVOYxcvTnNG0 9hJxypntzwKpFEKCLLCS5rFbf+MxzQtkOGHAgRfW5Kyl9Ibt166bZRhmciq4kh8lIVcp /HDnSfUGHGDcChNXrgjH1VmNor/MFm1PQ5UYrhdqQrQ58U70ZyKHDJPQkstAYZi79Jx1 ZmfA== 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=PHk1aD/4El+ognxt4Ln9ghxHgBZDWsxupIrwsqWIzL0=; b=Ieir/OSjE4aeL0BHioDS/uf7YbfvflaxQr1wBaxswYWxIihDsY2L5Kuq3GmqxC4nJZ y0RoIbR5IEQcEueo65akwN0ZIALDMJ9wyg6I4b4M1H5PZOkKe2MTah9MYpMJyED5nKQ/ h2ClMwOOE0RwAoHtC51yZUx6WwlwuqnE7OZ+OXVTTImzqZqrXfTfH8U3Re1u7K00goZJ RtyyRqJKCZabo/DSqmQK/LVBgWAm38U5Kg09do5I+6axC6rodLjxQjy7SNOzFy8Pkvwk z0ds7wSPZEBbF0MJ0l6wQmKpt6xwDG3awr+omRWf7iI0LD+/nvJOuezKLpFf+7mcLFRn 7NOA== X-Gm-Message-State: AOAM531M2L+w3kzyLw/Rptua7FC1IIdi6WqE95i1+ERcRqe34kXNxkjY SQR+M/96ryodMlHCaC9RY3Ymmw== X-Google-Smtp-Source: ABdhPJyMNUUF4jYuBp45XsHq3CgLjCrJdCwUWVN/OhCa1VZdb89n+IrValiv5eDAfuzUiaOp4P9c+Q== X-Received: by 2002:a1c:f70f:: with SMTP id v15mr17157582wmh.117.1642367758317; Sun, 16 Jan 2022 13:15:58 -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 l12sm8820445wrz.15.2022.01.16.13.15.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jan 2022 13:15:57 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: madalin.bucur@nxp.com, robh+dt@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net 1/4] net/fsl: xgmac_mdio: Add workaround for erratum A-009885 Date: Sun, 16 Jan 2022 22:15:26 +0100 Message-Id: <20220116211529.25604-2-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com> References: <20220116211529.25604-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. 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 Sun Jan 16 21:15:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12714677 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 37636C433FE for ; Sun, 16 Jan 2022 21:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236185AbiAPVQF (ORCPT ); Sun, 16 Jan 2022 16:16:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236162AbiAPVQB (ORCPT ); Sun, 16 Jan 2022 16:16:01 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3448C06161C for ; Sun, 16 Jan 2022 13:16:00 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id n19-20020a7bc5d3000000b003466ef16375so19843392wmk.1 for ; Sun, 16 Jan 2022 13:16:00 -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=OYx9JCI6DcrgKeqxQcsds9tuZxZXQZpFHva5BE3zQL4=; b=tEQ3Z8ArVhbEOydXcPfD6z02encandhWSTEPXG0PyWYE8yDtw+UL8FwKA44xl4SWMU X6Qm+gpBc1Khn7VtlAdiva7ORd8VE7v3PuSx2CseK0ifZb81ijLf3VW2pIo3sELVqspw GTkn8RI1Ghd+0zQb2HIEky2x3wcbVCNPlD1Nr2eiWC2I3OfF4xGUqFjLPkofjAiQTi83 xJwxegF5xZqmhXcgLtyDqteBTAOacAsuRO0xxWXLYFNvZRev6esjHTO+o9rjJGDXU+We FxdF/6w8DrWc9R+QuHPSItS6JmFi8isnosrIMTT3iXb3cyG4FI1RicV5/cB2mOWFKZ8g 1+Yg== 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=OYx9JCI6DcrgKeqxQcsds9tuZxZXQZpFHva5BE3zQL4=; b=F8edTLjxPxFpaPjmCVjQw55iESli4FjhWaPnQaGZ0TUhsHXicA7A9fnv/HLKN1BNIb +O+3ETABnmYGAgzY3WuToqEodU0Rz5ZOs60RxfdqT8CkDjFNLAkFPs8cZNWdWpx+sNIT URlOQ8LLkLrUrIoyp27hi/F+wyIKKJJ/Lc/9SV79kp20V+wJD22rf7XsnalP/aZWgqBa sIXAO6kPlRtb1zCJ1XPd5z9l7gXKM7jzajmV5udwSqcCyZgavsjW34Vsa0vcBqsEj6ZG 6zuyX4vrmL3yenU5yF5MtKn0JoyRPHiANd1Iklexlpsc9QIp5Krh80bTl3W04MKu0Oku Blmg== X-Gm-Message-State: AOAM533JbE1D7O4dclevECXXzeM3QFzaxkWox+gVzRnfo54TNzRAl2LN myENRYIu9Qp1CbrjLZ+TfPhD2A== X-Google-Smtp-Source: ABdhPJwNI6YNksXjvEy8DE/JH4Lfpaq7XmCMwtYuyn8XmgW/tNTS2qAAmHFICjzlNLuvLqxGCA+Ecw== X-Received: by 2002:a05:600c:48a1:: with SMTP id j33mr17126323wmp.143.1642367759452; Sun, 16 Jan 2022 13:15:59 -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 l12sm8820445wrz.15.2022.01.16.13.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jan 2022 13:15:59 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: madalin.bucur@nxp.com, robh+dt@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net 2/4] dt-bindings: net: Document fsl,erratum-a009885 Date: Sun, 16 Jan 2022 22:15:27 +0100 Message-Id: <20220116211529.25604-3-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com> References: <20220116211529.25604-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 Sun Jan 16 21:15:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12714678 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 57B48C4332F for ; Sun, 16 Jan 2022 21:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236192AbiAPVQG (ORCPT ); Sun, 16 Jan 2022 16:16:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236188AbiAPVQC (ORCPT ); Sun, 16 Jan 2022 16:16:02 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03DFBC061401 for ; Sun, 16 Jan 2022 13:16:02 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id o7-20020a05600c510700b00347e10f66d1so6782556wms.0 for ; Sun, 16 Jan 2022 13:16:01 -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=ZRW3oDhOxGZh12nnFCIRwcL+KGVdvZHn8X1zV+9ZLv4=; b=I8cLSRXIcXyA4Kq2yDP6ZcRkV6/IuSdvBN8mh0S+5IHpaYy1QM3dQp/lYGXEQLRxq3 7Es8XLj10aoY1aGuWL1gmcgXCZKeP1KDkQMmTYhu8xd4AzPMgVTc/ttgwFL4lLHoFadW DoS6iUEEvi80m8vN7fwFLKYjpLgGkcLOBW5shTkZ7vy4avnweOaiz4JvgHnrWAID4FHf i+kdgO9SHB0zQrZwgqJQxSYDqjyQpaR/ia8xuNUF2lj6+mTfH2SF5W9SBjl6weGSw9Uw m9mK+enQRtAOg+3GXvGkoYG3g7oVJaK84GHtxRt4e5jEW0glpPL4cJmdhrISdLDLFTv2 EZ6w== 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=ZRW3oDhOxGZh12nnFCIRwcL+KGVdvZHn8X1zV+9ZLv4=; b=DjDe7jxxBVVXZKdNlkAYEmMixgzQnNZn6DekFqSgJ/7wBNFkb4BJMmQMQsfAJTJKfr BNHdhD7eGAmrsBNg9VAlUeZw0zUTG/QbpZ+L+hhf0ExANFpQIGdZzDc55ui1HXvOF1Gf AQU8eh42u57V3l8OWSvliZQw3aIMRlg8QJAgV5wjgKhmvA3McOIk9YgF7ODxmKOohD5T 8gOAq8hCzeKMZauuGjwSG7ApB0B5dv+GuGoHSLO84SNDrBsapM4rhEg+Uh8jsBt26U8h dtOsUWFApEm5InsFbcqGGlsxHc22/59O8aQQ/UjUxjvvGznmd0M8BEYUjy0vmReu2+oe Eijw== X-Gm-Message-State: AOAM5326LTCvWreocwBERC5HPGLGnRlXur/kt2LM1iiFv8dFcsRRJ94e JkmDEbtmJzStM5fJhpfECuymPw== X-Google-Smtp-Source: ABdhPJz3kSbmMli5hJqvOZ83d2ZGQygN/ukAJMlrPaXrgbXJnOmWK3Isz2XTLJ84yNoTdwFX6MrALw== X-Received: by 2002:a1c:a747:: with SMTP id q68mr24369924wme.98.1642367760615; Sun, 16 Jan 2022 13:16:00 -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 l12sm8820445wrz.15.2022.01.16.13.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jan 2022 13:16:00 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: madalin.bucur@nxp.com, robh+dt@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net 3/4] powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses Date: Sun, 16 Jan 2022 22:15:28 +0100 Message-Id: <20220116211529.25604-4-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com> References: <20220116211529.25604-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. 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 Sun Jan 16 21:15:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Waldekranz X-Patchwork-Id: 12714679 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 2F6D4C43217 for ; Sun, 16 Jan 2022 21:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234630AbiAPVQI (ORCPT ); Sun, 16 Jan 2022 16:16:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236194AbiAPVQD (ORCPT ); Sun, 16 Jan 2022 16:16:03 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A224C061574 for ; Sun, 16 Jan 2022 13:16:03 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id v123so16508068wme.2 for ; Sun, 16 Jan 2022 13:16:03 -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=mhkaL5juH4guy48KuGF+fYnZTlI1q0boY2IwcDBWEPQ=; b=AeFRxDPoC2zhcdlERdxoTZs/hjLPyAaR4LmBcGv+bnERRK1afCv7/Jb83hAm2MxNvF gUjoSiL49a55oqlWGKn+yHqb3uG3uySVzV+VOVSnptDokuyAvAKBrlVBftHHfobqOn19 lwJ4g2GuC1VGFmfPJeYMur91L8yO1AdMJpx8GwxAVLXzZ9Hhg0COy+GlVMGW/s1Dsjc5 jDHu17OnNA9+IRP5fNQlNabpSZy/StlcQ3BSuDqoYLR5ObxkWXnmK1JJtBMzahs00pNi 0qk5jyVvU7EQ8DoV1VbYVh6s7FdS6lCKclPiLmUHP09NNb3M0jXBAzZ6AZ6I3OnAR27h HesA== 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=mhkaL5juH4guy48KuGF+fYnZTlI1q0boY2IwcDBWEPQ=; b=ovIYc6pidNzHlhdTnRVgRrtP/P30M9MOBD6zSAl47ALZ8mwMqRCwnsMr/0B1NQ1SbR FqDIRZaFjWcBEEzUJ8pKYXQBUvPLZSLAV6no97f5h7rtUYJN0dUlIEWF2wHN0MarbsdM Ufy1rTA7Oz5FuG+QudhlD5lcOJq9xA2Lo2YszuXSaUhXkV9jdphqUlTyQ2ji9SkbfJU6 UnDZqhDO8E9+hOJru7n2lz6MS/DXzIywRxfhrzbXeTYzEz7gMyaprJz0BdYxlVLwVplB DvMcMNhJxPHGkVKBgVdKtz5kuKGewBRVAhilmEehyV7Jt3OMaKbf0aFGDh8cvc3i5t+A XUCA== X-Gm-Message-State: AOAM532GIe6kFwOEQ5ubB9vYh2xTwoGOIqGYv9xZTPAJjmXf6ax+aJ8g dhrhK0Tplf9m9rSOedKFCPjPNQ== X-Google-Smtp-Source: ABdhPJyl6EaOH2pNOGinkeqLhxtw/E//xARDY73P8G8xmFz/3e3RakxjgzdvwghHMOymGyyM/lgBAg== X-Received: by 2002:adf:eec9:: with SMTP id a9mr16478793wrp.178.1642367761748; Sun, 16 Jan 2022 13:16:01 -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 l12sm8820445wrz.15.2022.01.16.13.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jan 2022 13:16:01 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: madalin.bucur@nxp.com, robh+dt@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH net 4/4] net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module Date: Sun, 16 Jan 2022 22:15:29 +0100 Message-Id: <20220116211529.25604-5-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220116211529.25604-1-tobias@waldekranz.com> References: <20220116211529.25604-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;