diff --git a/patches/u-boot/0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch b/patches/u-boot/0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch new file mode 100644 index 0000000..d84ea44 --- /dev/null +++ b/patches/u-boot/0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch @@ -0,0 +1,32 @@ +From fff14a56662e7f4ff86cdb5452e5c1b1e35f28bd Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Sat, 2 Nov 2024 16:31:01 +0100 +Subject: [PATCH 07/10] cmd: tlv_eeprom: don't fail boot when reading eeprom + fails + +When u-boot calls mac_read_from_eeprom during init an error return code +will fail the boot before reaching u-boot shell. + +Return success error code even on error, mac addresses are not critical. + +Signed-off-by: Josua Mayer +--- + cmd/tlv_eeprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c +index bf8d453dc5b..cbc11ebf421 100644 +--- a/cmd/tlv_eeprom.c ++++ b/cmd/tlv_eeprom.c +@@ -1023,7 +1023,7 @@ int mac_read_from_eeprom(void) + + if (read_eeprom(eeprom)) { + printf("Read failed.\n"); +- return -1; ++ return 0; + } + + maccount = 1; +-- +2.43.0 + diff --git a/patches/u-boot/0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch b/patches/u-boot/0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch new file mode 100644 index 0000000..219f6ea --- /dev/null +++ b/patches/u-boot/0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch @@ -0,0 +1,389 @@ +From 23e2133cf0e5bdd8d2556fe0fe63f5b9ab534e65 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Sat, 2 Nov 2024 17:55:53 +0100 +Subject: [PATCH 08/10] board: solidrun: lx2160-cex7: fixup u-boot dts dpmac by + serdes protocol + +LX2160A network interface availability and speed depend on serdes +protocol selected in RCW. Creating device-tree for every possible +combination would be cumbersome and hard to maintain. + +U-Boot dpaa2 driver does not reconfigure network interfaces but leaves +them as brought up by MC firmware, based on serdes protocol. +At the same time, u-boot expects the dt phy-mode property to match +actual interface protocol. + +Fixup u-boot fdt during board_fix_fdt, setting status property and +phy-mode according to default protocol for the running serdes protocol. + +This allows with the same u-boot build and internal device-tree to +enable all available network interfaces as dictatd by a particular RCW. + +Signed-off-by: Josua Mayer +--- + board/solidrun/lx2160acex7/eth_lx2160acex7.c | 312 +++++++++++++++++++ + board/solidrun/lx2160acex7/lx2160a.c | 4 + + 2 files changed, 316 insertions(+) + +diff --git a/board/solidrun/lx2160acex7/eth_lx2160acex7.c b/board/solidrun/lx2160acex7/eth_lx2160acex7.c +index d2c68d34243..63aa6610a02 100644 +--- a/board/solidrun/lx2160acex7/eth_lx2160acex7.c ++++ b/board/solidrun/lx2160acex7/eth_lx2160acex7.c +@@ -12,6 +12,8 @@ + #include + #include + #include ++#include ++#include + + DECLARE_GLOBAL_DATA_PTR; + +@@ -76,13 +78,323 @@ void reset_phy(void) + } + #endif /* CONFIG_RESET_PHY_R */ + ++#ifndef CONFIG_CMD_TLV_EEPROM + int mac_read_from_eeprom(void) + { + return 0; + } ++#endif + + int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) + { + puts("Not implemented.\n"); + return CMD_RET_FAILURE; + } ++ ++static void dpmac_set_phymode(void *fdt, unsigned int id, const char *mode) { ++ char path[34] = {}; ++ int node; ++ ++ snprintf(path, sizeof(path), "/fsl-mc@80c000000/dpmacs/dpmac@%x", id); ++ node = fdt_path_offset(fdt, path); ++ fdt_delprop(fdt, node, "phy-mode"); ++ do_fixup_by_path_string(fdt, path, "phy-connection-type", mode); ++ do_fixup_by_path_string(fdt, path, "status", "okay"); ++} ++ ++/* ++ * Fixup dpmac phy-modes by serdes protocol to fix ethernet driver probe ++ */ ++void board_fix_fdt_eth(void *fdt) { ++ struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR); ++ u32 is_lx2162 = get_svr() & 0x800; ++ u32 srds_s1, srds_s2; ++ ++ srds_s1 = in_le32(&gur->rcwsr[28]) & ++ FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK; ++ srds_s1 >>= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT; ++ ++ srds_s2 = in_le32(&gur->rcwsr[28]) & ++ FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK; ++ srds_s2 >>= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT; ++ ++ /* allocate space in case properties must be added */ ++ fdt_increase_size(fdt, 256); ++ ++ switch (srds_s1) { ++ case 0: ++ case 1: ++ break; ++ case 2: ++ /* 3, 4, 5, 6 = sgmii */ ++ dpmac_set_phymode(fdt, 3, "sgmii"); ++ dpmac_set_phymode(fdt, 4, "sgmii"); ++ dpmac_set_phymode(fdt, 5, "sgmii"); ++ dpmac_set_phymode(fdt, 6, "sgmii"); ++ break; ++ case 3: ++ /* 3, 4, 5, 6 = xgmii */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "xgmii"); ++ dpmac_set_phymode(fdt, 6, "xgmii"); ++ break; ++ case 4: ++ /* 3, 4, 5, 6, 7, 8, 9, 10 = sgmii */ ++ dpmac_set_phymode(fdt, 3, "sgmii"); ++ dpmac_set_phymode(fdt, 4, "sgmii"); ++ dpmac_set_phymode(fdt, 5, "sgmii"); ++ dpmac_set_phymode(fdt, 6, "sgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 7, "sgmii"); ++ dpmac_set_phymode(fdt, 8, "sgmii"); ++ dpmac_set_phymode(fdt, 9, "sgmii"); ++ dpmac_set_phymode(fdt, 10, "sgmii"); ++ break; ++ case 5: ++ /* 7, 8, 9, 10 = xgmii */ ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 7, "xgmii"); ++ dpmac_set_phymode(fdt, 8, "xgmii"); ++ dpmac_set_phymode(fdt, 9, "xgmii"); ++ dpmac_set_phymode(fdt, 10, "xgmii"); ++ break; ++ case 6: ++ /* 3, 4 = xgmii; 5, 6, 7, 8, 9, 10 = sgmii */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "sgmii"); ++ dpmac_set_phymode(fdt, 6, "sgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 7, "sgmii"); ++ dpmac_set_phymode(fdt, 8, "sgmii"); ++ dpmac_set_phymode(fdt, 9, "sgmii"); ++ dpmac_set_phymode(fdt, 10, "sgmii"); ++ break; ++ case 7: ++ /* 3, 4, 5, 6 = xgmii; 7, 8, 9, 10 = sgmii */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "xgmii"); ++ dpmac_set_phymode(fdt, 6, "xgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 7, "sgmii"); ++ dpmac_set_phymode(fdt, 8, "sgmii"); ++ dpmac_set_phymode(fdt, 9, "sgmii"); ++ dpmac_set_phymode(fdt, 10, "sgmii"); ++ break; ++ case 8: ++ /* 3, 4, 5, 6, 7, 8, 9, 10 = xgmii */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "xgmii"); ++ dpmac_set_phymode(fdt, 6, "xgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 7, "xgmii"); ++ dpmac_set_phymode(fdt, 8, "xgmii"); ++ dpmac_set_phymode(fdt, 9, "xgmii"); ++ dpmac_set_phymode(fdt, 10, "xgmii"); ++ break; ++ case 9: ++ /* 4, 5, 6, 8, 9, 10 = sgmii */ ++ dpmac_set_phymode(fdt, 4, "sgmii"); ++ dpmac_set_phymode(fdt, 5, "sgmii"); ++ dpmac_set_phymode(fdt, 6, "sgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 8, "sgmii"); ++ dpmac_set_phymode(fdt, 9, "sgmii"); ++ dpmac_set_phymode(fdt, 10, "sgmii"); ++ break; ++ case 10: ++ /* 4, 5, 6, 8, 9, 10 = xgmii */ ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "xgmii"); ++ dpmac_set_phymode(fdt, 6, "xgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 8, "xgmii"); ++ dpmac_set_phymode(fdt, 9, "xgmii"); ++ dpmac_set_phymode(fdt, 10, "xgmii"); ++ break; ++ case 11: ++ /* 5, 6, 9, 10 = sgmii */ ++ dpmac_set_phymode(fdt, 5, "sgmii"); ++ dpmac_set_phymode(fdt, 6, "sgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 9, "sgmii"); ++ dpmac_set_phymode(fdt, 10, "sgmii"); ++ break; ++ case 12: ++ /* 9, 10 = sgmii */ ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 9, "sgmii"); ++ dpmac_set_phymode(fdt, 10, "sgmii"); ++ break; ++ case 13: ++ /* 1, 2 = caui4 */ ++ dpmac_set_phymode(fdt, 1, "caui4"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 2, "caui4"); ++ break; ++ case 14: ++ /* 1 = caui4 */ ++ dpmac_set_phymode(fdt, 1, "caui4"); ++ break; ++ case 15: ++ /* 1, 2 = caui2 */ ++ dpmac_set_phymode(fdt, 1, "caui2"); ++ dpmac_set_phymode(fdt, 2, "caui2"); ++ break; ++ case 16: ++ /* 1 = caui2; 5, 6 = 25g-aui */ ++ dpmac_set_phymode(fdt, 1, "caui2"); ++ dpmac_set_phymode(fdt, 5, "25g-aui"); ++ dpmac_set_phymode(fdt, 6, "25g-aui"); ++ break; ++ case 17: ++ /* 3, 4, 5, 6 = 25g-aui */ ++ dpmac_set_phymode(fdt, 3, "25g-aui"); ++ dpmac_set_phymode(fdt, 4, "25g-aui"); ++ dpmac_set_phymode(fdt, 5, "25g-aui"); ++ dpmac_set_phymode(fdt, 6, "25g-aui"); ++ break; ++ case 18: ++ /* 3, 4, 7, 8, 9, 10 = xgmii; 5, 6 = 25g-aui */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "25g-aui"); ++ dpmac_set_phymode(fdt, 6, "25g-aui"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 7, "xgmii"); ++ dpmac_set_phymode(fdt, 8, "xgmii"); ++ dpmac_set_phymode(fdt, 9, "xgmii"); ++ dpmac_set_phymode(fdt, 10, "xgmii"); ++ break; ++ case 19: ++ /* 2 = xlaui4; 3, 4 = xgmii; 5, 6 = 25g-aui */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "25g-aui"); ++ dpmac_set_phymode(fdt, 6, "25g-aui"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 2, "xlaui4"); ++ break; ++ case 20: ++ /* 1, 2 = xlaui4 */ ++ dpmac_set_phymode(fdt, 1, "xlaui4"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 2, "xlaui4"); ++ break; ++ case 21: ++ /* 3, 4, 5, 6, 9, 10 = 25g-aui */ ++ dpmac_set_phymode(fdt, 3, "25g-aui"); ++ dpmac_set_phymode(fdt, 4, "25g-aui"); ++ dpmac_set_phymode(fdt, 5, "25g-aui"); ++ dpmac_set_phymode(fdt, 6, "25g-aui"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 9, "25g-aui"); ++ dpmac_set_phymode(fdt, 10, "25g-aui"); ++ break; ++ case 22: ++ /* 3, 4, 5, 6, 9, 10 = xgmii */ ++ dpmac_set_phymode(fdt, 3, "xgmii"); ++ dpmac_set_phymode(fdt, 4, "xgmii"); ++ dpmac_set_phymode(fdt, 5, "xgmii"); ++ dpmac_set_phymode(fdt, 6, "xgmii"); ++ if (is_lx2162) ++ break; ++ dpmac_set_phymode(fdt, 9, "xgmii"); ++ dpmac_set_phymode(fdt, 10, "xgmii"); ++ break; ++ } ++ ++ switch (srds_s2) { ++ case 0: ++ case 1: ++ case 2: ++ case 3: ++ case 4: ++ case 5: ++ break; ++ case 6: ++ /* 13, 14 = xgmii; 15, 16 = sgmii */ ++ dpmac_set_phymode(fdt, 13, "xgmii"); ++ dpmac_set_phymode(fdt, 14, "xgmii"); ++ dpmac_set_phymode(fdt, 15, "sgmii"); ++ dpmac_set_phymode(fdt, 16, "sgmii"); ++ break; ++ case 7: ++ /* 12, 16, 17, 18 = sgmii; 13, 14 = xgmii */ ++ dpmac_set_phymode(fdt, 12, "sgmii"); ++ dpmac_set_phymode(fdt, 13, "xgmii"); ++ dpmac_set_phymode(fdt, 14, "xgmii"); ++ dpmac_set_phymode(fdt, 16, "sgmii"); ++ dpmac_set_phymode(fdt, 17, "sgmii"); ++ dpmac_set_phymode(fdt, 18, "sgmii"); ++ break; ++ case 8: ++ /* 13, 14 = xgmii */ ++ dpmac_set_phymode(fdt, 13, "xgmii"); ++ dpmac_set_phymode(fdt, 14, "xgmii"); ++ break; ++ case 9: ++ /* 11, 12, 13, 14, 15, 16, 17, 18 = sgmii */ ++ dpmac_set_phymode(fdt, 11, "sgmii"); ++ dpmac_set_phymode(fdt, 12, "sgmii"); ++ dpmac_set_phymode(fdt, 13, "sgmii"); ++ dpmac_set_phymode(fdt, 14, "sgmii"); ++ dpmac_set_phymode(fdt, 15, "sgmii"); ++ dpmac_set_phymode(fdt, 16, "sgmii"); ++ dpmac_set_phymode(fdt, 17, "sgmii"); ++ dpmac_set_phymode(fdt, 18, "sgmii"); ++ break; ++ case 10: ++ /* 11, 12, 17, 18 = sgmii */ ++ dpmac_set_phymode(fdt, 11, "sgmii"); ++ dpmac_set_phymode(fdt, 12, "sgmii"); ++ dpmac_set_phymode(fdt, 17, "sgmii"); ++ dpmac_set_phymode(fdt, 18, "sgmii"); ++ break; ++ case 11: ++ /* 12, 13, 14, 16, 17, 18 = sgmii */ ++ dpmac_set_phymode(fdt, 12, "sgmii"); ++ dpmac_set_phymode(fdt, 13, "sgmii"); ++ dpmac_set_phymode(fdt, 14, "sgmii"); ++ dpmac_set_phymode(fdt, 16, "sgmii"); ++ dpmac_set_phymode(fdt, 17, "sgmii"); ++ dpmac_set_phymode(fdt, 18, "sgmii"); ++ break; ++ case 12: ++ /* 11, 12, 17, 18 = sgmii */ ++ dpmac_set_phymode(fdt, 11, "sgmii"); ++ dpmac_set_phymode(fdt, 12, "sgmii"); ++ dpmac_set_phymode(fdt, 17, "sgmii"); ++ dpmac_set_phymode(fdt, 18, "sgmii"); ++ break; ++ case 13: ++ /* 13, 14 = sgmii */ ++ dpmac_set_phymode(fdt, 13, "sgmii"); ++ dpmac_set_phymode(fdt, 14, "sgmii"); ++ break; ++ case 14: ++ /* 13, 14, 17, 18 = sgmii */ ++ dpmac_set_phymode(fdt, 13, "sgmii"); ++ dpmac_set_phymode(fdt, 14, "sgmii"); ++ dpmac_set_phymode(fdt, 17, "sgmii"); ++ dpmac_set_phymode(fdt, 18, "sgmii"); ++ break; ++ } ++} +diff --git a/board/solidrun/lx2160acex7/lx2160a.c b/board/solidrun/lx2160acex7/lx2160a.c +index 08fa6070672..af0a071488a 100644 +--- a/board/solidrun/lx2160acex7/lx2160a.c ++++ b/board/solidrun/lx2160acex7/lx2160a.c +@@ -65,6 +65,8 @@ int board_early_init_f(void) + } + + #ifdef CONFIG_OF_BOARD_FIXUP ++void board_fix_fdt_eth(void *fdt); ++ + int board_fix_fdt(void *fdt) + { + char *reg_names, *reg_name; +@@ -78,6 +80,8 @@ int board_fix_fdt(void *fdt) + }; + int off = -1, i = 0; + ++ board_fix_fdt_eth(fdt); ++ + if (IS_SVR_REV(get_svr(), 1, 0)) + return 0; + +-- +2.43.0 + diff --git a/patches/u-boot/0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch b/patches/u-boot/0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch new file mode 100644 index 0000000..86f89a2 --- /dev/null +++ b/patches/u-boot/0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch @@ -0,0 +1,40 @@ +From 402f33f4a31ebfa8b4a03adee2b1940878cadc74 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Sat, 2 Nov 2024 18:30:53 +0100 +Subject: [PATCH 09/10] board: solidrun: lx2160acex7: enable reading tlv eeprom + mac addresses + +Enable tlv eeprom support in u-boot configuration to execute +mac_read_from_eeprom and populate network interface mac addresses from +tlv data if available. + +Signed-off-by: Josua Mayer +--- + configs/lx2160acex7_tfa_defconfig | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/configs/lx2160acex7_tfa_defconfig b/configs/lx2160acex7_tfa_defconfig +index 8fd603cb87e..803ddb376f4 100644 +--- a/configs/lx2160acex7_tfa_defconfig ++++ b/configs/lx2160acex7_tfa_defconfig +@@ -28,6 +28,7 @@ CONFIG_USE_BOOTARGS=y + CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf" + CONFIG_DEFAULT_FDT_FILE="freescale/fsl-lx2160a-clearfog-cx.dtb" + CONFIG_MISC_INIT_R=y ++CONFIG_CMD_TLV_EEPROM=y + CONFIG_CMD_GREPENV=y + CONFIG_CMD_EEPROM=y + CONFIG_SYS_EEPROM_PAGE_WRITE_BITS=3 +@@ -58,6 +59,9 @@ CONFIG_ECC_INIT_VIA_DDRCONTROLLER=y + CONFIG_MPC8XXX_GPIO=y + CONFIG_DM_I2C=y + CONFIG_I2C_SET_DEFAULT_BUS_NUM=y ++CONFIG_I2C_MUX=y ++CONFIG_I2C_MUX_PCA954x=y ++CONFIG_I2C_EEPROM=y + CONFIG_SYS_I2C_EEPROM_ADDR=0x57 + CONFIG_SUPPORT_EMMC_RPMB=y + CONFIG_SUPPORT_EMMC_BOOT=y +-- +2.43.0 + diff --git a/patches/u-boot/0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch b/patches/u-boot/0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch new file mode 100644 index 0000000..6d2750c --- /dev/null +++ b/patches/u-boot/0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch @@ -0,0 +1,32 @@ +From 86421a6f1f41ea90124e4de2f8b73e43049bc1d4 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Sat, 2 Nov 2024 19:52:31 +0100 +Subject: [PATCH 10/10] board: solidrun: lx2160acex7: disable second usb on + lx2162 + +LX2162 only has single USB controller, disable the second one from +board_fix_fdt. + +Signed-off-by: Josua Mayer +--- + board/solidrun/lx2160acex7/lx2160a.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/board/solidrun/lx2160acex7/lx2160a.c b/board/solidrun/lx2160acex7/lx2160a.c +index af0a071488a..e0a9e6c51eb 100644 +--- a/board/solidrun/lx2160acex7/lx2160a.c ++++ b/board/solidrun/lx2160acex7/lx2160a.c +@@ -79,6 +79,10 @@ int board_fix_fdt(void *fdt) + { "pf_ctrl", "ctrl" } + }; + int off = -1, i = 0; ++ u32 is_lx2162 = get_svr() & 0x800; ++ ++ if (is_lx2162) ++ do_fixup_by_path_string(fdt, "/usb3@3110000", "status", "disabled"); + + board_fix_fdt_eth(fdt); + +-- +2.43.0 +