Skip to contentSkip to conversation

board: ti: am335x: Conditional MDIO PAD configuration instead of static for AM335_ICE

PATCH Superseded Parvathi Pudi 2 participants 5 messages Apr 22 – May 2

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 board: ti: am335x: Conditional MDIO PAD configuration instead of static for AM335_ICE

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.

---
Changes from v2 to v3 :
*) Addressed a comment from Markus Schneider-Pargmann on this patch. *) Added Reviewed-by: tag from Markus Schneider-Pargmann (TI).

Changes from v1 to v2 :
*) Addressed Markus Schneider-Pargmann's comments on this patch.

 board/ti/am335x/board.c | 10 ++++++++++
 board/ti/am335x/mux.c   |  2 --
 2 files changed, 10 insertions(+), 2 deletions(-)
board/ti/am335x/board.c +10 -0
index 90e37a8d913..9446a92c3dd 100644
@@ -28,6 +28,7 @@
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mem.h>
+#include <asm/arch/mux.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/emif.h>
@@ -72,6 +73,12 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
 #define GPIO0_IRQSTATUSRAW	(AM33XX_GPIO0_BASE + 0x024)
 #define GPIO1_IRQSTATUSRAW	(AM33XX_GPIO1_BASE + 0x024)
 
+static struct module_pin_mux rmii1_mdio_pin_mux[] = {
+	{OFFSET(mdio_clk), MODE(0) | PULLUP_EN},	/* MDIO_CLK */
+	{OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
+	{-1},
+};
+
 /*
  * Read header information from EEPROM into global structure.
  */
@@ -779,6 +786,9 @@ int board_init(void)
 			hang();
 		}
 
+		if (!eth0_is_mii)
+			configure_module_pin_mux(rmii1_mdio_pin_mux);
+
 		prueth_is_mii = eth0_is_mii;
 
 		/* disable rising edge IRQs */
board/ti/am335x/mux.c +0 -2
index d2d87c304f6..36d849d2119 100644
@@ -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 */
Signature · 1 line
2.43.0
#1 lore raw
Quoted 7 lines · Parvathi Pudi

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.

Quoted 7 lines

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.

This leads to failure to build on:
am335x_evm_spiboot am335x_hs_evm am335x_hs_evm_spi am335x_hs_evm_uart

Signature · 1 line
Tom
#2 lore raw

Hi,

Quoted 14 lines · Parvathi Pudi
Quoted 13 lines

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.

Quoted 6 lines
Quoted 2 lines

This leads to failure to build on:
am335x_evm_spiboot am335x_hs_evm am335x_hs_evm_spi am335x_hs_evm_uart

We tested the patch locally with the mentioned defconfigs (am335x_evm_spiboot, am335x_hs_evm, am335x_hs_evm_spi, am335x_hs_evm_uart), and we get the following warning:

‘rmii1_mdio_pin_mux’ defined but not used [-Wunused-variable]

Are you referring to this warning or do you see any other build errors?

Thanks and Regards,
Parvathi

#3 lore raw
Quoted 23 lines · Parvathi Pudi

Hi,

Quoted 14 lines · Parvathi Pudi
Quoted 13 lines

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.

Quoted 6 lines
Quoted 2 lines

This leads to failure to build on:
am335x_evm_spiboot am335x_hs_evm am335x_hs_evm_spi am335x_hs_evm_uart

Quoted 7 lines

We tested the patch locally with the mentioned defconfigs (am335x_evm_spiboot, am335x_hs_evm, am335x_hs_evm_spi, am335x_hs_evm_uart), and we get the following warning:

‘rmii1_mdio_pin_mux’ defined but not used [-Wunused-variable]

Are you referring to this warning or do you see any other build errors?

Yes, warnings are treated as errors by CI and so must be fixed before being applied.

Signature · 1 line
Tom
#4 lore raw

Hi,

Quoted 28 lines · Parvathi Pudi
Quoted 27 lines

Hi,

Quoted 14 lines · Parvathi Pudi
Quoted 13 lines

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.

Quoted 6 lines
Quoted 2 lines

This leads to failure to build on:
am335x_evm_spiboot am335x_hs_evm am335x_hs_evm_spi am335x_hs_evm_uart

We tested the patch locally with the mentioned defconfigs (am335x_evm_spiboot, am335x_hs_evm, am335x_hs_evm_spi, am335x_hs_evm_uart), and we get the following warning:

Quoted 7 lines
Quoted 3 lines

‘rmii1_mdio_pin_mux’ defined but not used [-Wunused-variable]

Are you referring to this warning or do you see any other build errors?

Yes, warnings are treated as errors by CI and so must be fixed before being applied.

Sure, we will fix this in the next version.

Thanks and regards,
Parvathi