Extend SOM detection
cover Extend SOM detection
This patchset extends PHYTEC's SOM detection for the K3 platforms.
It adds generic support to apply overlays via the extension framework inside the overlays.env file. Additionally, the K3 mmc boot environment applies these overlays now.
It also adds the 'extension_board_scan' hook to the K3 board code and adds all missing configs in the phyCORE-AM62x and -AM64x A53 defconfigs.
Daniel Schultz (6):
include: env: phytec: overlays: Add extension command
include: env: phytec: k3_mmc: Apply extension overlays
board: phytec: common: k3: Add SOM detection overlays
board: phytec: common: Kconfig: Enable SUPPORT_EXTENSION_SCAN
configs: phytec_am62x_a53_defconfig: Set CONFIG_CMD_EXTENSION
configs: phycore_am64x_a53_defconfig: Enable SOM detection
board/phytec/common/Kconfig | 2 ++ board/phytec/common/k3/board.c | 45 +++++++++++++++++++++++++++++ configs/phycore_am62x_a53_defconfig | 1 + configs/phycore_am64x_a53_defconfig | 2 ++ include/env/phytec/k3_mmc.env | 1 + include/env/phytec/overlays.env | 20 +++++++++++++ 6 files changed, 71 insertions(+)
Signature · 1 line
2.25.1
PATCH 1/6 include: env: phytec: overlays: Add extension command
Add a new environment routine to apply extensions. Our SOM detection adds overlays via the extension framework to alter the kernel device-tree according to the flashed EEPROM image.
--- include/env/phytec/overlays.env | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
include/env/phytec/overlays.env +20 -0
@@ -23,6 +23,16 @@ mmc_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +mmc_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd 'load mmc ${mmcdev}:${mmcpart} + ${fdtoverlay_addr_r} ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +mmc_apply_extensions=echo "no extension command" +#endif net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv} net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay} net_apply_overlays=
@@ -36,3 +46,13 @@ net_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +net_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd '${get_cmd} ${fdtoverlay_addr_r} + ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +net_apply_extensions=echo "no extension command" +#endif
Signature · 1 line
2.25.1
Re: [PATCH 1/6] include: env: phytec: overlays: Add extension command
Hello Daniel,
Quoted 16 lines · Daniel Schultz
Add a new environment routine to apply extensions. Our SOM detection adds overlays via the extension framework to alter the kernel device-tree according to the flashed EEPROM image.
Signed-off-by Daniel Schultz <[email protected]>---
include/env/phytec/overlays.env | 20 ++++++++++++++++++++1 file changed, 20 insertions(+)include/env/phytec/overlays.env +0
-0@@ -23,6 +23,16 @@ mmc_apply_overlays= fi; done;
include/env/phytec/overlays.env mmc_apply_overlays= · line 34
Quoted 10 lines
include/env/phytec/overlays.env +9
-0fi; +#ifdef CONFIG_CMD_EXTENSION +mmc_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd 'load mmc ${mmcdev}:${mmcpart} + ${fdtoverlay_addr_r} ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +mmc_apply_extensions=echo "no extension command"
Do you think it makes sense to make this fail? I would think "apply_extensions" would be unsuccessful if extensions are not working.
Yannic
Quoted 18 lines
include/env/phytec/overlays.env +1
-0+#endif net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv} net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay}net_apply_overlays=
include/env/phytec/overlays.env +10
-0@@ -36,3 +46,13 @@ net_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +net_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd '${get_cmd} ${fdtoverlay_addr_r} + ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +net_apply_extensions=echo "no extension command" +#endif
Re: [PATCH 1/6] include: env: phytec: overlays: Add extension command
Hi Yannic,
Quoted 23 lines · Yannic Moog
Hello Daniel,
Quoted 20 lines · Daniel Schultz
Add a new environment routine to apply extensions. Our SOM detection adds overlays via the extension framework to alter the kernel device-tree according to the flashed EEPROM image.
Signed-off-by Daniel Schultz <[email protected]>--- include/env/phytec/overlays.env | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)include/env/phytec/overlays.env +3
-0@@ -23,6 +23,16 @@ mmc_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +mmc_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r};
Quoted 8 lines
include/env/phytec/overlays.env mmc_apply_overlays= · line 34
Quoted 6 lines
include/env/phytec/overlays.env +6
-0+ setenv extension_overlay_cmd 'load mmc ${mmcdev}:${mmcpart} + ${fdtoverlay_addr_r} ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +mmc_apply_extensions=echo "no extension command"Do you think it makes sense to make this fail? I would think "
apply_extensions" would be unsuccessful if extensions are not working.
Technically, you don't need our SOM detection overlays. They just make the boot nicer and you don't have any probe errors or other error messages. So, in my opinion, it's better not apply them instead of stopping the entire boot.
Regards,
Daniel
Quoted 21 lines
Yannic
Quoted 18 lines
include/env/phytec/overlays.env +11
-0+#endif net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv} net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay} net_apply_overlays=@@ -36,3 +46,13 @@ net_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +net_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd '${get_cmd} ${fdtoverlay_addr_r} + ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +net_apply_extensions=echo "no extension command" +#endif
Re: [PATCH 1/6] include: env: phytec: overlays: Add extension command
Am 09.07.24 um 15:31 schrieb Daniel Schultz:
Quoted 35 lines
Hi Yannic,
Quoted 23 lines · Yannic Moog
Hello Daniel,
Quoted 20 lines · Daniel Schultz
Add a new environment routine to apply extensions. Our SOM detection adds overlays via the extension framework to alter the kernel device-tree according to the flashed EEPROM image.
Signed-off-by Daniel Schultz <[email protected]>---
include/env/phytec/overlays.env | 20 ++++++++++++++++++++1 file changed, 20 insertions(+)include/env/phytec/overlays.env +3
-0@@ -23,6 +23,16 @@ mmc_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +mmc_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r};Quoted 8 lines
include/env/phytec/overlays.env mmc_apply_overlays= · line 34
Quoted 6 lines
include/env/phytec/overlays.env +6
-0+ setenv extension_overlay_cmd 'load mmc ${mmcdev}:${mmcpart} + ${fdtoverlay_addr_r} ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +mmc_apply_extensions=echo "no extension command"Do you think it makes sense to make this fail? I would think "
apply_extensions" would be unsuccessful if extensions are not working.
Quoted 1 line
Technically, you don't need our SOM detection overlays. They just make the boot nicer and you don't have any probe errors or other error messages. So, in my opinion, it's better not apply them instead of stopping the entire boot.
My recommendation is to embed all SoM variant related overlays into u-boot.img's FIT using binman.
This makes the extension command obsolete, and especially the handling for loading of overlays from different boot sources / storage devices.
Having them available directly in the u-boot binary resolves the issue of not found overlays.
We do not know how users will proceed after u-boot booted and if the overlays will be available to the "extension setup". Better to have everything in place and fixup to the best we know using our SoM data stored in the EEPROM.
This kind of overlays should be applied regardless of the boot device.
Quoted 25 lines
Regards,
DanielQuoted 21 lines
Yannic
Quoted 18 lines
include/env/phytec/overlays.env +1
-0+#endif net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv} net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay}net_apply_overlays=
include/env/phytec/overlays.env +10
-0@@ -36,3 +46,13 @@ net_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +net_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd '${get_cmd} ${fdtoverlay_addr_r} + ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +net_apply_extensions=echo "no extension command" +#endif
Re: [PATCH 1/6] include: env: phytec: overlays: Add extension command
Quoted 40 lines · Wadim Egorov
Am 09.07.24 um 15:31 schrieb Daniel Schultz:
Quoted 37 lines
Hi Yannic,
Quoted 33 lines · Yannic Moog
Hello Daniel,
Quoted 17 lines · Daniel Schultz
Add a new environment routine to apply extensions. Our SOM detection adds overlays via the extension framework to alter the kernel device-tree according to the flashed EEPROM image.
Signed-off-by Daniel Schultz <[email protected]>---
include/env/phytec/overlays.env | 20 ++++++++++++++++++++1 file changed, 20 insertions(+)include/env/phytec/overlays.env +0
-0@@ -23,6 +23,16 @@ mmc_apply_overlays= fi; done;include/env/phytec/overlays.env mmc_apply_overlays= · line 34
Quoted 10 lines
include/env/phytec/overlays.env +9
-0fi; +#ifdef CONFIG_CMD_EXTENSION +mmc_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd 'load mmc ${mmcdev}:${mmcpart} + ${fdtoverlay_addr_r} ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +mmc_apply_extensions=echo "no extension command"Do you think it makes sense to make this fail? I would think "
apply_extensions" would be
unsuccessful if extensions are not working.
Quoted 7 lines
Quoted 4 lines
Technically, you don't need our SOM detection overlays. They just make the boot nicer and you don't have any probe errors or other error messages. So, in my opinion, it's better not apply them instead of stopping the entire boot.
My recommendation is to embed all SoM variant related overlays into u-boot.img's FIT using binman.
Didn't think binman would be used for that, but I share your opinion regarding overlay packaging.
Yannic
Quoted 39 lines
This makes the extension command obsolete, and especially the handling for loading of overlays from different boot sources / storage devices.
Having them available directly in the u-boot binary resolves the issue of not found overlays.
We do not know how users will proceed after u-boot booted and if the overlays will be available to the "extension setup". Better to have everything in place and fixup to the best we know using our SoM data stored in the EEPROM.
This kind of overlays should be applied regardless of the boot device.
Quoted 25 lines
Regards,
DanielQuoted 21 lines
Yannic
Quoted 18 lines
include/env/phytec/overlays.env +1
-0+#endif net_load_bootenv=${get_cmd} ${bootenv_addr_r} ${bootenv} net_load_overlay=${get_cmd} ${fdtoverlay_addr_r} ${overlay}net_apply_overlays=
include/env/phytec/overlays.env +10
-0@@ -36,3 +46,13 @@ net_apply_overlays= fi; done; fi; +#ifdef CONFIG_CMD_EXTENSION +net_apply_extensions= + setenv extension_overlay_addr ${fdtoverlay_addr_r}; + setenv extension_overlay_cmd '${get_cmd} ${fdtoverlay_addr_r} + ${extension_overlay_name}'; + extension scan; + extension apply all; +#else +net_apply_extensions=echo "no extension command" +#endif
PATCH 2/6 include: env: phytec: k3_mmc: Apply extension overlays
In reply to Daniel SchultzRun the mmc_apply_extensions routine to apply overlays added by the extension framework.
--- include/env/phytec/k3_mmc.env | 1 + 1 file changed, 1 insertion(+)
include/env/phytec/k3_mmc.env +1 -0
@@ -18,4 +18,5 @@ mmcboot=run mmcargs; run loadimage; run loadfdt; run mmc_apply_overlays; + run mmc_apply_extensions; booti ${loadaddr} - ${fdt_addr_r}
Signature · 1 line
2.25.1
PATCH 3/6 board: phytec: common: k3: Add SOM detection overlays
In reply to Daniel SchultzAdd overlays to disable or alter SOM features according to the EEPROM image content.
--- board/phytec/common/k3/board.c | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
board/phytec/common/k3/board.c +45 -0
@@ -8,6 +8,7 @@#include <fdt_support.h> #include <spl.h> #include <asm/arch/hardware.h> +#include <extension_board.h> #include "../am6_som_detection.h"
@@ -104,3 +105,47 @@ int ft_board_setup(void *blob, struct bd_info *bd)return 0 ; }#endif + +#if IS_ENABLED (CONFIG_CMD_EXTENSION ) +int extension_board_scan (struct list_head *extension_list) +{ +struct extension *extension =NULL ; +struct phytec_eeprom_data data; +int count =0 ; +int ret; + + ret =phytec_eeprom_data_setup (&data,0 ,EEPROM_ADDR ); +if (ret) +return count; + +if (phytec_get_am6_eth (&data) ==0 ) { + extension =phytec_add_extension ("Disable Ethernet phy" , +"k3-am6xx-phycore-disable-eth-phy.dtbo" ,"" ); +list_add_tail (&extension->list, extension_list); + count++; + } + +if (phytec_get_am6_spi (&data) ==PHYTEC_EEPROM_VALUE_X ) { + extension =phytec_add_extension ("Disable SPI NOR Flash" , +"k3-am6xx-phycore-disable-spi-nor.dtbo" ,"" ); +list_add_tail (&extension->list, extension_list); + count++; + } + +if (phytec_am6_is_qspi (&data)) { + extension =phytec_add_extension ("Select QSPI NOR Flash" , +"k3-am6xx-phycore-qspi-nor.dtbo" ,"" ); +list_add_tail (&extension->list, extension_list); + count++; + } + +if (phytec_get_am6_rtc (&data) ==0 ) { + extension =phytec_add_extension ("Disable RTC" , +"k3-am6xx-phycore-disable-rtc.dtbo" ,"" ); +list_add_tail (&extension->list, extension_list); + count++; + } + +return count; +} +#endif
Signature · 1 line
2.25.1
PATCH 4/6 board: phytec: common: Kconfig: Enable SUPPORT_EXTENSION_SCAN
In reply to Daniel SchultzEnable SUPPORT_EXTENSION_SCAN for the phyCORE-AM62x and -AM64x boards.
--- board/phytec/common/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
board/phytec/common/Kconfig +2 -0
@@ -24,6 +24,7 @@ config PHYTEC_AM62_SOM_DETECTION depends on (TARGET_PHYCORE_AM62X_A53 || TARGET_PHYCORE_AM62X_R5) && \ PHYTEC_SOM_DETECTION select PHYTEC_SOM_DETECTION_BLOCKS + select SUPPORT_EXTENSION_SCAN depends on SPL_I2C && DM_I2C default y help
@@ -35,6 +36,7 @@ config PHYTEC_AM64_SOM_DETECTION depends on (TARGET_PHYCORE_AM64X_A53 || TARGET_PHYCORE_AM64X_R5) && \ PHYTEC_SOM_DETECTION select PHYTEC_SOM_DETECTION_BLOCKS + select SUPPORT_EXTENSION_SCAN depends on SPL_I2C && DM_I2C default y help
Signature · 1 line
2.25.1
PATCH 5/6 configs: phytec_am62x_a53_defconfig: Set CONFIG_CMD_EXTENSION
In reply to Daniel SchultzCONFIG_CMD_EXTENSION is required to load SOM detection overlays.
--- configs/phycore_am62x_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/phycore_am62x_a53_defconfig +1 -0
@@ -63,6 +63,7 @@ CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_CMD_EXTENSION=y CONFIG_CMD_DFU=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y
Signature · 1 line
2.25.1
PATCH 6/6 configs: phycore_am64x_a53_defconfig: Enable SOM detection
In reply to Daniel SchultzEnable SOM detection for the phyCORE-AM64x and also set CONFIG_CMD_EXTENSION as requirement for this feature.
--- configs/phycore_am64x_a53_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/phycore_am64x_a53_defconfig +2 -0
@@ -10,6 +10,7 @@ CONFIG_NR_DRAM_BANKS=2 CONFIG_SOC_K3_AM642=y CONFIG_K3_ATF_LOAD_ADDR=0x701c0000 CONFIG_TARGET_PHYCORE_AM64X_A53=y +CONFIG_PHYTEC_SOM_DETECTION=y CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80480000 CONFIG_ENV_SIZE=0x20000
@@ -63,6 +64,7 @@ CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPL_SPI_LOAD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000 CONFIG_SPL_YMODEM_SUPPORT=y +CONFIG_CMD_EXTENSION=y CONFIG_CMD_ASKENV=y CONFIG_CMD_DFU=y CONFIG_CMD_GPT=y
Signature · 1 line
2.25.1
Hey,
please don't apply these patches. We just found an issue while working on another task. Sorry!
Best Regards,
Daniel
Quoted 27 lines · Daniel Schultz
This patchset extends PHYTEC's SOM detection for the K3 platforms.
It adds generic support to apply overlays via the extension framework inside the overlays.env file. Additionally, the K3 mmc boot environment applies these overlays now.
It also adds the '
extension_board_scan' hook to the K3 board code and adds all missing configs in the phyCORE-AM62x and -AM64x A53 defconfigs.Daniel Schultz (6):
include: env: phytec: overlays: Add extension command
include: env: phytec:k3_mmc: Apply extension overlays
board: phytec: common: k3: Add SOM detection overlays
board: phytec: common:Kconfig: EnableSUPPORT_EXTENSION_SCAN
configs:phytec_am62x_a53_defconfig: SetCONFIG_CMD_EXTENSION
configs:phycore_am64x_a53_defconfig: Enable SOM detectionboard/phytec/common/Kconfig | 2 ++ board/phytec/common/k3/board.c | 45 +++++++++++++++++++++++++++++ configs/phycore_am62x_a53_defconfig | 1 + configs/phycore_am64x_a53_defconfig | 2 ++ include/env/phytec/k3_mmc.env | 1 + include/env/phytec/overlays.env | 20 +++++++++++++ 6 files changed, 71 insertions(+)