public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] board: ti: am335x: Conditional MDIO PAD configuration instead of static for AM335_ICE
@ 2026-04-07  8:22 Parvathi Pudi
  2026-04-16  7:53 ` Markus Schneider-Pargmann
  0 siblings, 1 reply; 5+ messages in thread
From: Parvathi Pudi @ 2026-04-07  8:22 UTC (permalink / raw)
  To: u-boot, trini, Maarten.Brock, kory.maincent, msp, parvathi,
	sbellary, romain.gantois
  Cc: pratheesh, j-rameshbabu, praneeth, vigneshr, srk, rogerq,
	danishanwar, m-malladi, krishna, mohan, pmohan, basharath

This patch removes the static MDIO pinmux configuration from
rmii1_pin_mux[] and instead configures the MDIO pins conditionally
during board_init(). Previously, the MDIO_CLK and MDIO_DATA pins
were always configured for CPSW in mux.c, which could lead to
unnecessary pin ownership and conflicts in scenarios where CPSW
is not used.

With this change, the MDIO pins are configured only when required,
ensuring that CPSW Ethernet functionality in U-Boot remains unaffected.
This approach keeps Ethernet boot behavior intact and provides cleaner
separation between CPSW and other Ethernet use cases.

Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
---
 board/ti/am335x/board.c | 22 ++++++++++++++++++++++
 board/ti/am335x/mux.c   |  2 --
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 90e37a8d913..abeab809387 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -61,6 +61,18 @@ DECLARE_GLOBAL_DATA_PTR;
 #define GPIO_ETH0_MODE		GPIO_TO_PIN(0, 11)
 #define GPIO_ETH1_MODE		GPIO_TO_PIN(1, 26)
 
+#define AM335X_PIN_MDIO	0x948
+#define AM335X_PIN_MDC		0x94c
+
+#define GPIO_MDIO_DATA		CTRL_BASE + AM335X_PIN_MDIO
+#define GPIO_MDIO_CLK		CTRL_BASE + AM335X_PIN_MDC
+
+/* Enabling MDIO_DATA by setting MUX_MODE to 0, RXACTIVE, PULLUP_EN bits */
+#define PAD_CONFIG_MDIO_DATA	0x30
+
+/* Enabling MDIO_CLK by setting MUX_MODE to 0, PULLUP_EN bit */
+#define PAD_CONFIG_MDIO_CLK	0x10
+
 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 
 #define GPIO0_RISINGDETECT	(AM33XX_GPIO0_BASE + OMAP_GPIO_RISINGDETECT)
@@ -779,6 +791,16 @@ int board_init(void)
 			hang();
 		}
 
+		if (!eth0_is_mii || !eth1_is_mii) {
+			/* Set the Mux Mode to MDIO_DATA */
+			reg = readl(GPIO_MDIO_DATA);
+			writel(reg & PAD_CONFIG_MDIO_DATA, GPIO_MDIO_DATA);
+
+			/* Set the Mux Mode to MDIO_CLK */
+			reg = readl(GPIO_MDIO_CLK);
+			writel(reg & PAD_CONFIG_MDIO_CLK, GPIO_MDIO_CLK);
+		}
+
 		prueth_is_mii = eth0_is_mii;
 
 		/* disable rising edge IRQs */
diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index d2d87c304f6..36d849d2119 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -190,8 +190,6 @@ static struct module_pin_mux mii1_pin_mux[] = {
 };
 
 static struct module_pin_mux rmii1_pin_mux[] = {
-	{OFFSET(mdio_clk), MODE(0) | PULLUP_EN},	/* MDIO_CLK */
-	{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
 	{OFFSET(mii1_crs), MODE(1) | RXACTIVE},		/* MII1_CRS */
 	{OFFSET(mii1_rxerr), MODE(1) | RXACTIVE},	/* MII1_RXERR */
 	{OFFSET(mii1_txen), MODE(1)},			/* MII1_TXEN */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-20 20:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07  8:22 [PATCH] board: ti: am335x: Conditional MDIO PAD configuration instead of static for AM335_ICE Parvathi Pudi
2026-04-16  7:53 ` Markus Schneider-Pargmann
2026-04-17 12:06   ` Parvathi Pudi
2026-04-19 15:35     ` Markus Schneider-Pargmann
2026-04-20 13:27       ` Parvathi Pudi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox