board: ti: am335x: Choose CPSW or PRUSS configuration based on jumper setting
PATCH 1/1 board: ti: am335x: Choose CPSW or PRUSS configuration based on jumper setting
The am335x-ice-v2 board's Ethernet ports can be configured in 'MII' or 'RMII' mode to be connected to 'PRUSS' or 'CPSW' Ethernet subsystems.
This patch sets the environment variable 'ice_mii' to 'mii' or 'rmii' accordingly. Based on that we choose the appropriate board devicetree i.e. 'am335x-ice-v2.dtb' or 'am335x-ice-v2-prueth.dtb'.
Since there are 2 Ethernet ports with 2 modes, there can be 4 configurations but for now we consider both ports in different modes to be an invalid configuration and prevent boot in that case.
---
This depends on the currently in-review patch [0].
[0]: [email protected]
board/ti/am335x/board.c | 17 +++++++++++++++++ include/configs/am335x_evm.h | 5 ++++- include/configs/ti_armv7_common.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-)
board/ti/am335x/board.c +17 -0
@@ -11,6 +11,7 @@#include <dm.h> #include <env.h> #include <errno.h> +#include <hang.h> #include <image.h> #include <init.h> #include <malloc.h>
@@ -691,6 +692,8 @@ done: }#endif +static bool prueth_is_mii = true; +/* * Basic board specific setup. Pinmux has been handled already. */
@@ -710,6 +713,8 @@ int board_init(void)if (board_is_icev2 ()) {int rv;u32 reg; +bool eth0_is_mii = true; +bool eth1_is_mii = true;REQUEST_AND_SET_GPIO (GPIO_PR1_MII_CTRL );/* Make J19 status available on GPIO1_26 */
@@ -740,6 +745,7 @@ int board_init(void)writel (reg,GPIO0_IRQSTATUS1 );/* clear irq */ /* RMII mode */ printf ("ETH0, CPSW\n" ); + eth0_is_mii = false; }else {/* MII mode */ printf ("ETH0, PRU\n" );
@@ -752,12 +758,21 @@ int board_init(void)/* RMII mode */ printf ("ETH1, CPSW\n" );gpio_set_value (GPIO_MUX_MII_CTRL ,1 ); + eth1_is_mii = false; }else {/* MII mode */ printf ("ETH1, PRU\n" ); cdce913_data.pdiv2 =4 ;/* 25MHz PHY clk */ } +if (eth0_is_mii != eth1_is_mii) { +printf ("Unsupported Ethernet port configuration\n" ); +printf ("Both ports must be set as RMII or MII\n" ); +hang (); + } + + prueth_is_mii = eth0_is_mii; +/* disable rising edge IRQs */ reg =readl (GPIO0_RISINGDETECT ) & ~BIT (11 );writel (reg,GPIO0_RISINGDETECT );
@@ -852,6 +867,8 @@ int board_late_init(void)if (is_valid_ethaddr (mac_addr)) eth_env_set_enetaddr("eth1addr", mac_addr); } + +env_set ("ice_mii" , prueth_is_mii ?"mii" :"rmii" );#endif if (!env_get ("serial#" )) {
include/configs/am335x_evm.h +4 -1
@@ -143,7 +143,10 @@"if test $board_name = A335X_SK; then " \"setenv fdtfile am335x-evmsk.dtb; fi; " \"if test $board_name = A335_ICE; then " \ -"setenv fdtfile am335x-icev2.dtb; fi; " \ +"setenv fdtfile am335x-icev2.dtb; " \ +"if test $ice_mii = mii; then " \ +"setenv pxe_label_override Pruss; fi;" \ +"fi; " \"if test $fdtfile = undefined; then " \"echo WARNING: Could not determine device tree to use; fi; \0" \"init_console=" \
include/configs/ti_armv7_common.h +1 -0
@@ -37,6 +37,7 @@"fdtaddr=0x88000000\0" \"dtboaddr=0x89000000\0" \"fdt_addr_r=0x88000000\0" \ +"fdtoverlay_addr_r=0x89000000\0" \"rdaddr=0x88080000\0" \"ramdisk_addr_r=0x88080000\0" \"scriptaddr=0x80000000\0" \
Signature · 1 line
2.25.1
Quoted 9 lines · Amjad Ouled-Ameur
The am335x-ice-v2 board's Ethernet ports can be configured in 'MII' or 'RMII' mode to be connected to 'PRUSS' or 'CPSW' Ethernet subsystems.
This patch sets the environment variable '
ice_mii' to 'mii' or 'rmii' accordingly. Based on that we choose the appropriate board devicetree i.e. 'am335x-ice-v2.dtb' or 'am335x-ice-v2-prueth.dtb'.
Quoted 9 lines
Since there are 2 Ethernet ports with 2 modes, there can be 4 configurations but for now we consider both ports in different modes to be an invalid configuration and prevent boot in that case.
Signed-off-by Roger Quadros <[email protected]>[Amjad: use overlay instead of using new am335x-ice-v2-prueth.dtb]Signed-off-by Amjad Ouled-Ameur <[email protected]>
Signature · 1 line
Tom
Quoted 9 lines · Amjad Ouled-Ameur
The am335x-ice-v2 board's Ethernet ports can be configured in 'MII' or 'RMII' mode to be connected to 'PRUSS' or 'CPSW' Ethernet subsystems.
This patch sets the environment variable '
ice_mii' to 'mii' or 'rmii' accordingly. Based on that we choose the appropriate board devicetree i.e. 'am335x-ice-v2.dtb' or 'am335x-ice-v2-prueth.dtb'.
Quoted 8 lines
Since there are 2 Ethernet ports with 2 modes, there can be 4 configurations but for now we consider both ports in different modes to be an invalid configuration and prevent boot in that case.
Signed-off-by Roger Quadros <[email protected]>[Amjad: use overlay instead of using new am335x-ice-v2-prueth.dtb]Signed-off-by Amjad Ouled-Ameur <[email protected]>Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom