From nobody Fri Dec 19 17:10:38 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1C1351C3B for ; Mon, 22 Apr 2024 08:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713775596; cv=none; b=tywwL/yuanAcMk2Rj7ILJK3VP9aiVGSjgGzLlTfCFCd12+TU6n6AlwmhnM89PiqB0FMUY6EKtGu4PCfM5pIqx9rcwH9Ft8cFlVaXN4dpTW+Ls58WfyAAMYEFjN4o+EJNOj2sS+JRAqeW0xuIfG2UmZo9EuSgZCWUqpkbFoL+19U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713775596; c=relaxed/simple; bh=QIpJu9ALWPLds/Oeu/ERZh+j6cvh9IyUasgqi32VFbM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tp64vLyRY+hWUe4q9jIr/GyoQcNkuG0B6zanYSuhKn53Dp6lyiAyibY4xGksqqGhU69xxphRQndRYk/XXk/CZiswDIwualW3sU8iUhxCR+sFaVWjH87/pi0HsiA86pDxT4ibj5zCrJmSmKsk+hUW8WaylYLx1/FdlhxlCIOu+LI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-kernel@vger.kernel.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/Doc= umentation/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 =20 + 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: --=20 2.43.2 From nobody Fri Dec 19 17:10:38 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6B5353380 for ; Mon, 22 Apr 2024 08:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713775596; cv=none; b=k6h7sKvJhEEEYLQTxjerSZGYlTk6X8iyxJVG9KkVMgIT5uea9XV21K4AmmyHZ/HwujOGC8MIbV2WxV5+hdHnz5cXIS6q2pj+JHwcd52qn7jD6wBu4exSi0Je/A7KEel3nvb6Wizucwf8eQX9RiteupNmuInMZNmL/8bb3l4SZzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713775596; c=relaxed/simple; bh=IU6x0P+j4+jOHSGmx6FtiHna/5kD7S4rVr4bL7nsngg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qoPcjhtQ9IK8Dd9kOAnkt+fuVM2aUXfWPSZ0k1Xa66lQhCtIqR0SFCLfM9Z5C2P+YZJZ88D91zifAJOh6tBcdIQ9e6poKzSkumeDtvNV3g+wT8MgKkzBmvSuUwrtPOjkk0GT5qhUJLHe5ljII+/1u6x+Pj1P9kEjOJQENBb5hwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-kernel@vger.kernel.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 =3D <100000000>, <250000000>; intf_mode =3D <&wakeupmix_gpr 0x28>; + enet_clk_sel =3D <&wakeupmix_gpr 0x2c>; snps,clk-csr =3D <0>; status =3D "disabled"; }; --=20 2.43.2 From nobody Fri Dec 19 17:10:38 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5CA4482C1 for ; Mon, 22 Apr 2024 08:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713775597; cv=none; b=HKF9JjjD8V8TJpS7yVGGWL+vW9ScI6aV7RGYVwhXR8QCGkRBjMg7g7f1tlQGdOeRy45EEjpaYnMvyysFs9IBWuS/5sUajMn04WtwqxCTG2DSMspSV4GFsmy3RDyKWQaVMOu5ocB+FCCqDvn7Taa6d+bBAdxvhzcmhN0/TJPkZM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713775597; c=relaxed/simple; bh=hbWncv3O5p+eXPs67WyDuajeTIZwF1P/8g1gar0nJUo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QaP6IhtArjiWEePOBp0BkB59QoG/TEKudKXNMJ3Tls3TIBxZr1wfyk3SF0R1zWNpVMiqunKQ76p0BtpFJAD7loGpe+iQjur5GZrN6o87061boBnjUFXHrD2QRjMfguPGd7jP+z/dn4WNzD1AcHuB6nSvnMV4GfhIWs50SPBz0H4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-kernel@vger.kernel.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) =20 +#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; =20 @@ -116,6 +121,18 @@ static int imx93_set_intf_mode(struct plat_stmmacenet_= data *plat_dat) break; case PHY_INTERFACE_MODE_RMII: val =3D 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 =3D syscon_regmap_lookup_by_phandle(np, "enet_clk= _sel"); + if (IS_ERR(dwmac->enet_clk_regmap)) + return PTR_ERR(dwmac->enet_clk_regmap); + + err =3D of_property_read_u32_index(np, "enet_clk_sel", 1, &dwmac->enet_c= lk_reg_off); + if (err) { + dev_err(dev, "Can't get enet clk sel reg offset (%d)\n", err); + return err; + } } =20 return err; --=20 2.43.2