From e3c9d9ff5230a3e811e79e476201518d9fda3ec4 Mon Sep 17 00:00:00 2001 From: Josua Mayer Date: Mon, 4 Nov 2024 16:09:56 +0100 Subject: [PATCH] sync with lx2160a_build / read mac addresses from tlv eeprom - activate all soc network interfaces in u-boot console - assign mac addresses from tlv eeprom on lx2160 cex-7 and lx2162 som --- ...on-t-fail-boot-when-reading-eeprom-f.patch | 32 ++ ...x2160-cex7-fixup-u-boot-dts-dpmac-by.patch | 389 ++++++++++++++++++ ...x2160acex7-enable-reading-tlv-eeprom.patch | 40 ++ ...x2160acex7-disable-second-usb-on-lx2.patch | 32 ++ ...x2160acex7-allocate-memory-before-pa.patch | 39 ++ ...upport-specifying-tlv-eeprom-in-DT-a.patch | 58 +++ ...x2160acex7-use-dt-alias-for-tlv-eepr.patch | 90 ++++ .../u-boot/u-boot-qoriq_2022.04.bbappend | 7 + 8 files changed, 687 insertions(+) create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0011-board-solidrun-lx2160acex7-allocate-memory-before-pa.patch create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0012-cmd-tlv_eeprom-support-specifying-tlv-eeprom-in-DT-a.patch create mode 100644 recipes-bsp/u-boot/2022.04-solidrun/0013-board-solidrun-lx2160acex7-use-dt-alias-for-tlv-eepr.patch diff --git a/recipes-bsp/u-boot/2022.04-solidrun/0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch b/recipes-bsp/u-boot/2022.04-solidrun/0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch new file mode 100644 index 0000000..d84ea44 --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/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/recipes-bsp/u-boot/2022.04-solidrun/0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch b/recipes-bsp/u-boot/2022.04-solidrun/0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch new file mode 100644 index 0000000..219f6ea --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/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/recipes-bsp/u-boot/2022.04-solidrun/0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch b/recipes-bsp/u-boot/2022.04-solidrun/0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch new file mode 100644 index 0000000..86f89a2 --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/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/recipes-bsp/u-boot/2022.04-solidrun/0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch b/recipes-bsp/u-boot/2022.04-solidrun/0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch new file mode 100644 index 0000000..6d2750c --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/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 + diff --git a/recipes-bsp/u-boot/2022.04-solidrun/0011-board-solidrun-lx2160acex7-allocate-memory-before-pa.patch b/recipes-bsp/u-boot/2022.04-solidrun/0011-board-solidrun-lx2160acex7-allocate-memory-before-pa.patch new file mode 100644 index 0000000..bc31c15 --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/0011-board-solidrun-lx2160acex7-allocate-memory-before-pa.patch @@ -0,0 +1,39 @@ +From bcabe078a2a27eecaa592e1f2ea640a5f1fc6cda Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Mon, 4 Nov 2024 15:16:27 +0100 +Subject: [PATCH 11/13] board: solidrun: lx2160acex7: allocate memory before + patching lx2162 fdt + +Update of second usb controller fdt node during board_fix_fdt fails due +to lack of space in the fdt. + +Explicitly allocate some extra bytes before to repair this fixup on +lx2162 som. + +Signed-off-by: Josua Mayer +--- + board/solidrun/lx2160acex7/lx2160a.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/board/solidrun/lx2160acex7/lx2160a.c b/board/solidrun/lx2160acex7/lx2160a.c +index e0a9e6c51eb..17160d13154 100644 +--- a/board/solidrun/lx2160acex7/lx2160a.c ++++ b/board/solidrun/lx2160acex7/lx2160a.c +@@ -81,8 +81,13 @@ int board_fix_fdt(void *fdt) + int off = -1, i = 0; + u32 is_lx2162 = get_svr() & 0x800; + +- if (is_lx2162) ++ if (is_lx2162) { ++ /* allocate space for changes */ ++ fdt_increase_size(fdt, 32); ++ ++ /* LX2162 does not have second USB controller, disable */ + do_fixup_by_path_string(fdt, "/usb3@3110000", "status", "disabled"); ++ } + + board_fix_fdt_eth(fdt); + +-- +2.43.0 + diff --git a/recipes-bsp/u-boot/2022.04-solidrun/0012-cmd-tlv_eeprom-support-specifying-tlv-eeprom-in-DT-a.patch b/recipes-bsp/u-boot/2022.04-solidrun/0012-cmd-tlv_eeprom-support-specifying-tlv-eeprom-in-DT-a.patch new file mode 100644 index 0000000..a961cf5 --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/0012-cmd-tlv_eeprom-support-specifying-tlv-eeprom-in-DT-a.patch @@ -0,0 +1,58 @@ +From bc8a68d153dcfd75153d81c52531743e43f23983 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Mon, 4 Nov 2024 15:08:01 +0100 +Subject: [PATCH 12/13] cmd: tlv_eeprom: support specifying tlv eeprom in DT + alias tlv[0-255] + +Systems might have many eeproms of which only some might be used for TLV +data. +If present, use aliases tlv0, tlv1, ... for finding tlv eeproms. + +If no eeproms are found by alias, fall back to current logic if using +first eeproms in the system. + +Signed-off-by: Josua Mayer +--- + cmd/tlv_eeprom.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c +index cbc11ebf421..546ede2dda2 100644 +--- a/cmd/tlv_eeprom.c ++++ b/cmd/tlv_eeprom.c +@@ -899,9 +899,32 @@ static void show_tlv_devices(void) + static int find_tlv_devices(struct udevice **tlv_devices_p) + { + int ret; ++ char alias_name[7]; + int count_dev = 0; ++ int i; ++ ofnode node; + struct udevice *dev; + ++ /* find by alias */ ++ for (int i = 0; i < ARRAY_SIZE(tlv_devices_p); i++) { ++ snprintf(alias_name, sizeof(alias_name), "tlv%d", i); ++ node = ofnode_get_aliases_node(alias_name); ++ if (!ofnode_valid(node)) ++ continue; ++ ++ ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, node, &dev); ++ if (ret) { ++ debug("get device \"%s\" failed with %d\n", alias_name, ret); ++ continue; ++ } ++ ++ tlv_devices_p[i] = dev; ++ count_dev++; ++ } ++ if (count_dev) ++ return 0; ++ ++ /* fall-back: find among all eeproms */ + for (ret = uclass_first_device_check(UCLASS_I2C_EEPROM, &dev); + dev; + ret = uclass_next_device_check(&dev)) { +-- +2.43.0 + diff --git a/recipes-bsp/u-boot/2022.04-solidrun/0013-board-solidrun-lx2160acex7-use-dt-alias-for-tlv-eepr.patch b/recipes-bsp/u-boot/2022.04-solidrun/0013-board-solidrun-lx2160acex7-use-dt-alias-for-tlv-eepr.patch new file mode 100644 index 0000000..5bfa6ff --- /dev/null +++ b/recipes-bsp/u-boot/2022.04-solidrun/0013-board-solidrun-lx2160acex7-use-dt-alias-for-tlv-eepr.patch @@ -0,0 +1,90 @@ +From 38e36f6ceec2ecccc97369bec7e2589933001359 Mon Sep 17 00:00:00 2001 +From: Josua Mayer +Date: Mon, 4 Nov 2024 15:12:04 +0100 +Subject: [PATCH 13/13] board: solidrun: lx2160acex7: use dt alias for tlv + eeprom + +LX2160A CEX-7 (and LX2162A SoM) have various eeproms competing for +tlv_eeprom command. + +Add tlv0 alias to u-boot dts identifying the correct eeprom. + +On LX2162 SoM the eeprom is directly on the bus without a mux. +Add dt patching logic fixing the alias and eeprom nodes when running on +lx2162 soc. + +Signed-off-by: Josua Mayer +--- + arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi | 19 +++++++++---------- + arch/arm/dts/fsl-lx2160a-cex7.dtsi | 2 +- + board/solidrun/lx2160acex7/lx2160a.c | 5 +++++ + 3 files changed, 15 insertions(+), 11 deletions(-) + +diff --git a/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi b/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi +index 9855fcb31cc..5909af2b1b9 100644 +--- a/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi ++++ b/arch/arm/dts/fsl-lx2160a-cex7-u-boot.dtsi +@@ -1,6 +1,10 @@ + // SPDX-License-Identifier: GPL-2.0+ + + / { ++ aliases { ++ tlv0 = &com_eeprom; ++ }; ++ + fanctrl-override { + compatible = "solidrun,lx2160acex7-fanctrl-override"; + override-gpios = <&gpio2 2 0>; +@@ -8,15 +12,10 @@ + }; + + &i2c0 { +- u-boot,dm-pre-reloc; +- +- i2c-mux@77 { +- u-boot,dm-pre-reloc; +- +- i2c@0 { +- eeprom@57 { +- u-boot,dm-pre-reloc; +- }; +- }; ++ /* for LX2162 SoM */ ++ eeprom@57 { ++ compatible = "st,24c02", "atmel,24c02"; ++ reg = <0x57>; ++ status = "disabled"; + }; + }; +diff --git a/arch/arm/dts/fsl-lx2160a-cex7.dtsi b/arch/arm/dts/fsl-lx2160a-cex7.dtsi +index d32a52ab00a..ca87a21aaee 100644 +--- a/arch/arm/dts/fsl-lx2160a-cex7.dtsi ++++ b/arch/arm/dts/fsl-lx2160a-cex7.dtsi +@@ -80,7 +80,7 @@ + reg = <0x53>; + }; + +- eeprom@57 { ++ com_eeprom: eeprom@57 { + compatible = "atmel,24c02"; + reg = <0x57>; + }; +diff --git a/board/solidrun/lx2160acex7/lx2160a.c b/board/solidrun/lx2160acex7/lx2160a.c +index 17160d13154..dcd8d63ddf8 100644 +--- a/board/solidrun/lx2160acex7/lx2160a.c ++++ b/board/solidrun/lx2160acex7/lx2160a.c +@@ -87,6 +87,11 @@ int board_fix_fdt(void *fdt) + + /* LX2162 does not have second USB controller, disable */ + do_fixup_by_path_string(fdt, "/usb3@3110000", "status", "disabled"); ++ ++ /* LX2162 SoM has different tlv eeprom - enable and patch alias */ ++ do_fixup_by_path_string(fdt, "/aliases", "tlv0", "/i2c@2000000/eeprom@57"); ++ do_fixup_by_path_string(fdt, "/i2c@2000000/eeprom@57", "status", "okay"); ++ do_fixup_by_path_string(fdt, "/i2c@2000000/i2c-mux@77/i2c@0/eeprom@57", "status", "disabled"); + } + + board_fix_fdt_eth(fdt); +-- +2.43.0 + diff --git a/recipes-bsp/u-boot/u-boot-qoriq_2022.04.bbappend b/recipes-bsp/u-boot/u-boot-qoriq_2022.04.bbappend index ad85ecc..1986659 100644 --- a/recipes-bsp/u-boot/u-boot-qoriq_2022.04.bbappend +++ b/recipes-bsp/u-boot/u-boot-qoriq_2022.04.bbappend @@ -8,6 +8,13 @@ SRC_URI += "file://0001-add-solidrun-lx2160-cex7-board-support.patch \ file://0004-fsl-lsch3-update-calculation-of-ddr-clock-rate-to-in.patch \ file://0005-armv8-lx2160a-enable-workaround-for-SPI-erratum-A-05.patch \ file://0006-configs-lx2160-cex7-enable-additional-drivers.patch \ + file://0007-cmd-tlv_eeprom-don-t-fail-boot-when-reading-eeprom-f.patch \ + file://0008-board-solidrun-lx2160-cex7-fixup-u-boot-dts-dpmac-by.patch \ + file://0009-board-solidrun-lx2160acex7-enable-reading-tlv-eeprom.patch \ + file://0010-board-solidrun-lx2160acex7-disable-second-usb-on-lx2.patch \ + file://0011-board-solidrun-lx2160acex7-allocate-memory-before-pa.patch \ + file://0012-cmd-tlv_eeprom-support-specifying-tlv-eeprom-in-DT-a.patch \ + file://0013-board-solidrun-lx2160acex7-use-dt-alias-for-tlv-eepr.patch \ " # Override default fdtfile for boards without dedicated uboot config