From patchwork Mon Apr 22 08:46:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Trumtrar X-Patchwork-Id: 13638014 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9F5CC10F15 for ; Mon, 22 Apr 2024 08:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=N3dLTMeidn+sR9NU0JX/tezjU5DTTRH9C+7mpWQZd8U=; b=yYMeaJu6XCSrQL wFLiZSeM717OxorQlJ0elMJ5NRw5vl1qkmQIqXmCLjzgoxsJ2vBnlk/UUVu2ui5oI2Q+GQJE0D8vq A9e99ZbR4Ta9FKfvEnQznyLrAmR/D5XTic9Kw6xIQBIONUBsQCu2VGx8V6pTCXUCuohnxnaIuVzEJ dwKijKCByw6EGnDX1HOoNdABSCYM9fcovkhcsmBSLpYXo2gFR6yJGBzn+OhQ/A25+i8uNOl52gJwQ mRVdGV9RxT7wh0Vnrg6YDhqz9Li3h6Bs305mCTy7UDJ+3Wrj07yQ+jwgRN97Jhq5QImt3l4cFINGT 2Mw7EaDMroEbcSxSLwiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rypJo-0000000Chuj-3BSc; Mon, 22 Apr 2024 08:46:32 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rypJk-0000000Chro-3BEU for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2024 08:46:30 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=ratatoskr.trumtrar.info) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rypJe-0000ML-El; Mon, 22 Apr 2024 10:46:22 +0200 From: Steffen Trumtrar Date: Mon, 22 Apr 2024 10:46:17 +0200 Subject: [PATCH 1/3] dt-bindings: net: mx93: add enet_clk_sel binding MIME-Version: 1.0 Message-Id: <20240422-v6-9-topic-imx93-eqos-rmii-v1-1-30151fca43d2@pengutronix.de> References: <20240422-v6-9-topic-imx93-eqos-rmii-v1-0-30151fca43d2@pengutronix.de> In-Reply-To: <20240422-v6-9-topic-imx93-eqos-rmii-v1-0-30151fca43d2@pengutronix.de> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Clark Wang , Linux Team , Alexandre Torgue , Jose Abreu , Maxime Coquelin Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com X-Mailer: b4 0.13.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.trumtrar@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_014628_835426_79AFB4B7 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When the eQOS on the i.MX93 is used in RMII mode, the TX_CLK must be set to output mode. To do this, the ENET_CLK_SEL register must be accessed. This register is located in a GPR register space. Signed-off-by: Steffen Trumtrar --- Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml b/Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml index 4c01cae7c93a7..1d1c8b90da871 100644 --- a/Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml +++ b/Documentation/devicetree/bindings/net/nxp,dwmac-imx.yaml @@ -56,6 +56,16 @@ properties: - tx - mem + enet_clk_sel: + $ref: /schemas/types.yaml#/definitions/phandle-array + items: + - items: + - description: phandle to the GPR syscon + - description: the offset of the GPR register + description: + Should be phandle/offset pair. The phandle to the syscon node which + encompases the GPR register, and the offset of the GPR register. + intf_mode: $ref: /schemas/types.yaml#/definitions/phandle-array items: From patchwork Mon Apr 22 08:46:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Trumtrar X-Patchwork-Id: 13638016 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0AC4AC10F15 for ; Mon, 22 Apr 2024 08:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hPPz6xwh6xNQRx6XNronJ9sOGUx2ctLtcNa35IlUCWc=; b=Tm7ohCpy6/3TPG UjFXMjdoQA43QfupaP0S74dCW2OsAVqaJt52eXZFFreiNY8jpV289gpW5/WiJMwETofoNXBXPKtSu A3yNO9bT93kFveI5j8+eCPd6ZLKPv2UTYMJRbDT0yr8o24m2sJwjMe4kR6plKVa3sB0M4vwnZgts0 A3APaUMb1QZHd82wG+r1Qh7Ldd1Ajd4ei5U0FpWMaCvuNksMxtEu5l0eXVXfC99yTzBvyTIe8YI51 48hQX1O7wxx4EKzlzg18axbTB7ioolNGD7ckDjwMX1259dUzB97LoveJjS4U7icCCwIokerQQAUdx GTJIFoqu3dGBhEYmSDdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rypK7-0000000Ci5Q-2VpD; Mon, 22 Apr 2024 08:46:51 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rypJl-0000000Chry-1hvb for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2024 08:46:31 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=ratatoskr.trumtrar.info) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rypJf-0000ML-Dr; Mon, 22 Apr 2024 10:46:23 +0200 From: Steffen Trumtrar Date: Mon, 22 Apr 2024 10:46:18 +0200 Subject: [PATCH 2/3] arm64: dts: imx93: add enet_clk_sel MIME-Version: 1.0 Message-Id: <20240422-v6-9-topic-imx93-eqos-rmii-v1-2-30151fca43d2@pengutronix.de> References: <20240422-v6-9-topic-imx93-eqos-rmii-v1-0-30151fca43d2@pengutronix.de> In-Reply-To: <20240422-v6-9-topic-imx93-eqos-rmii-v1-0-30151fca43d2@pengutronix.de> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Clark Wang , Linux Team , Alexandre Torgue , Jose Abreu , Maxime Coquelin Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com X-Mailer: b4 0.13.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.trumtrar@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_014629_479382_380D8BF0 X-CRM114-Status: GOOD ( 10.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The ENET_CLK_SEL register is at offset 0x2c in the wakeupmix_gpr register and needed to set the TX_CLK direction in case of RMII mode. Signed-off-by: Steffen Trumtrar --- arch/arm64/boot/dts/freescale/imx93.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi index 601c94e1fac8e..116ff9c15709b 100644 --- a/arch/arm64/boot/dts/freescale/imx93.dtsi +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi @@ -1051,6 +1051,7 @@ eqos: ethernet@428a0000 { <&clk IMX93_CLK_SYS_PLL_PFD0_DIV2>; assigned-clock-rates = <100000000>, <250000000>; intf_mode = <&wakeupmix_gpr 0x28>; + enet_clk_sel = <&wakeupmix_gpr 0x2c>; snps,clk-csr = <0>; status = "disabled"; }; From patchwork Mon Apr 22 08:46:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Trumtrar X-Patchwork-Id: 13638017 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C8C3C07E8F for ; Mon, 22 Apr 2024 08:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RdAmQkGTBNs0HTa0sPLjlBhMT1cfAOGntNN5Egwrmsw=; b=uXLMNvAnoaInGx JCCQvP2hnvcgKYjR3AYFb+OR753aNuCHkrSYcapKg7hku13wILNF1JQRzRwDEK4dKtdfVr6f7Iije F6yATmewG0zKvrU8O4dVzGWn3wMzAHIfne1Qom6qrarB2vPmRxFOlFDLR2FRXJbsj9SM/QQTX/4WJ HqejWUdSWWEYxSZGgiJpphfektxd6cRjp0A+ZY5c1tW7vAcpmsfmkMmjo8vlDHAK1cfsweTcTJzeQ 24SU2EtdaS6U6ISrKwOh66a9ERFJSLszMrZU8CuX0lL3KBhPE3C4Nv5Qk3ZRripbg6ASlfzFBqLwH Ib5SL3v+pLhjo/DrStCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rypK8-0000000Ci5y-3KgA; Mon, 22 Apr 2024 08:46:52 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rypJl-0000000Chs3-3YsG for linux-arm-kernel@lists.infradead.org; Mon, 22 Apr 2024 08:46:32 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=ratatoskr.trumtrar.info) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rypJg-0000ML-DO; Mon, 22 Apr 2024 10:46:24 +0200 From: Steffen Trumtrar Date: Mon, 22 Apr 2024 10:46:19 +0200 Subject: [PATCH 3/3] net: stmicro: imx: set TX_CLK direction in RMII mode MIME-Version: 1.0 Message-Id: <20240422-v6-9-topic-imx93-eqos-rmii-v1-3-30151fca43d2@pengutronix.de> References: <20240422-v6-9-topic-imx93-eqos-rmii-v1-0-30151fca43d2@pengutronix.de> In-Reply-To: <20240422-v6-9-topic-imx93-eqos-rmii-v1-0-30151fca43d2@pengutronix.de> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Clark Wang , Linux Team , Alexandre Torgue , Jose Abreu , Maxime Coquelin Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com X-Mailer: b4 0.13.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.trumtrar@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240422_014629_915534_C8CBC489 X-CRM114-Status: GOOD ( 15.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In case of RMII connection, the TX_CLK must be set to output direction. Parse the register and offset from the devicetree and set the direction of the TX_CLK when the property was provided. Signed-off-by: Steffen Trumtrar --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 6b65420e11b5c..0fc81a626a664 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -37,6 +37,9 @@ #define MX93_GPR_ENET_QOS_INTF_SEL_RGMII (0x1 << 1) #define MX93_GPR_ENET_QOS_CLK_GEN_EN (0x1 << 0) +#define MX93_GPR_ENET_QOS_TX_CLK_SEL_MASK GENMASK(1, 1) +#define MX93_GPR_ENET_QOS_TX_CLK_SEL (0x1 << 1) + #define DMA_BUS_MODE 0x00001000 #define DMA_BUS_MODE_SFT_RESET (0x1 << 0) #define RMII_RESET_SPEED (0x3 << 14) @@ -57,7 +60,9 @@ struct imx_priv_data { struct clk *clk_tx; struct clk *clk_mem; struct regmap *intf_regmap; + struct regmap *enet_clk_regmap; u32 intf_reg_off; + u32 enet_clk_reg_off; bool rmii_refclk_ext; void __iomem *base_addr; @@ -116,6 +121,18 @@ static int imx93_set_intf_mode(struct plat_stmmacenet_data *plat_dat) break; case PHY_INTERFACE_MODE_RMII: val = MX93_GPR_ENET_QOS_INTF_SEL_RMII; + + /* According to NXP AN14149, the direction of the + * TX_CLK must be set to output in RMII mode. + */ + if (dwmac->enet_clk_regmap) + regmap_update_bits(dwmac->enet_clk_regmap, + dwmac->enet_clk_reg_off, + MX93_GPR_ENET_QOS_TX_CLK_SEL_MASK, + MX93_GPR_ENET_QOS_TX_CLK_SEL); + else + dev_warn(dwmac->dev, "TX_CLK can't be set to output mode.\n"); + break; case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII_ID: @@ -310,6 +327,16 @@ imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev) dev_err(dev, "Can't get intf mode reg offset (%d)\n", err); return err; } + + dwmac->enet_clk_regmap = syscon_regmap_lookup_by_phandle(np, "enet_clk_sel"); + if (IS_ERR(dwmac->enet_clk_regmap)) + return PTR_ERR(dwmac->enet_clk_regmap); + + err = of_property_read_u32_index(np, "enet_clk_sel", 1, &dwmac->enet_clk_reg_off); + if (err) { + dev_err(dev, "Can't get enet clk sel reg offset (%d)\n", err); + return err; + } } return err;