mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] net: designware-imx: i.MX93: set TX_CLK in RMII mode
Date: Wed, 17 Apr 2024 11:11:26 +0200	[thread overview]
Message-ID: <20240417-v2024-03-0-topic-imx93-designware-imx-v1-2-c532c18f9ba5@pengutronix.de> (raw)
In-Reply-To: <20240417-v2024-03-0-topic-imx93-designware-imx-v1-0-c532c18f9ba5@pengutronix.de>

According to NXP AT14149 the TX_CLK direction must be set to output
when the ENET is used in RMII mode.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/net/designware_imx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/designware_imx.c b/drivers/net/designware_imx.c
index ab60d98298..2cc707ecac 100644
--- a/drivers/net/designware_imx.c
+++ b/drivers/net/designware_imx.c
@@ -26,6 +26,10 @@
 
 #define RMII_RESET_SPEED			(0x3 << 14)
 
+#define MX93_GPR_ENET_CLK_SEL_OFFSET		0x4
+#define MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL_MASK	GENMASK(0, 0)
+#define MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL	(0x1 << 0)
+
 struct eqos_imx_soc_data {
 	int (*set_interface_mode)(struct eqos *eqos);
 	void (*fix_soc_reset)(struct eqos *eqos, u32 *mac_regs);
@@ -155,6 +159,14 @@ static int eqos_imx93_set_interface_mode(struct eqos *eqos)
 		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.
+		 */
+		regmap_update_bits(priv->intf_regmap,
+				   priv->intf_reg_off + MX93_GPR_ENET_CLK_SEL_OFFSET,
+				   MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL_MASK,
+				   MX93_ENET_CLK_ENET_QOS_TX_CLK_SEL);
 		break;
 	case PHY_INTERFACE_MODE_RGMII:
 	case PHY_INTERFACE_MODE_RGMII_ID:

-- 
2.43.2




  parent reply	other threads:[~2024-04-17  9:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17  9:11 [PATCH 0/2] net: designware-imx: fix eqos in RMII on i.MX93 Steffen Trumtrar
2024-04-17  9:11 ` [PATCH 1/2] net: designware-imx: add fix_reset callback Steffen Trumtrar
2024-04-17  9:11 ` Steffen Trumtrar [this message]
2024-04-22 12:12   ` [PATCH 2/2] net: designware-imx: i.MX93: set TX_CLK in RMII mode Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240417-v2024-03-0-topic-imx93-designware-imx-v1-2-c532c18f9ba5@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox