Apply SoM overlays on phyCORE-AM6xx SoMs
cover Apply SoM overlays on phyCORE-AM6xx SoMs
Our SoMs are available in multiple configurations, managed via device tree overlays. To determine the specific variant in use, we read the EEPROM and apply the appropriate overlays during boot to the device tree used by the OS.
Apply overlays for phyCORE-AM62x and phyCORE-AM64x SoMs. Future K3 SoMs will be able to reuse this logic and overlays.
Wadim Egorov (6):
configs: phycore_am62x_a53_defconfig: Add SoM overlays to
OF_OVERLAY_LIST
configs: phycore_am64x_a53_defconfig: Add SoM overlays to
OF_OVERLAY_LIST
configs: phycore_am64x_a53_defconfig: Enable PHYTEC_SOM_DETECTION
arm: dts: k3-am625-phycore-som-binman: Add SoM overlays
arm: dts: k3-am642-phycore-som-binman: Add SoM overlays
board: phytec: common: k3: Apply SoM-specific overlays to OS device
tree
arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 54 +++++++++++++- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 54 +++++++++++++- board/phytec/common/k3/board.c | 73 +++++++++++++++++++ configs/phycore_am62x_a53_defconfig | 1 + configs/phycore_am64x_a53_defconfig | 4 +- 5 files changed, 183 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/6 configs: phycore_am62x_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST
Include SoM dt-overlays for DT control so we can include them into our u-boot FIT image.
--- configs/phycore_am62x_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/phycore_am62x_a53_defconfig +1 -0
@@ -72,6 +72,7 @@ CONFIG_CMD_SMC=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_MULTI_DTB_FIT=y +CONFIG_OF_OVERLAY_LIST="ti/k3-am6xx-phycore-disable-spi-nor ti/k3-am6xx-phycore-disable-rtc ti/k3-am6xx-phycore-disable-eth-phy ti/k3-am6xx-phycore-qspi-nor" CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_OVERWRITE=y
Signature · 1 line
2.34.1
PATCH 2/6 configs: phycore_am64x_a53_defconfig: Add SoM overlays to OF_OVERLAY_LIST
In reply to Wadim EgorovInclude SoM dt-overlays for DT control so we can include them into our u-boot FIT image.
While at it also resync after savedefconfig.
--- configs/phycore_am64x_a53_defconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
configs/phycore_am64x_a53_defconfig +2 -1
@@ -17,13 +17,13 @@ CONFIG_ENV_OFFSET=0x680000 CONFIG_DM_GPIO=y CONFIG_SPL_DM_SPI=y CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am642-phyboard-electra-rdk" -CONFIG_SPL_TEXT_BASE=0x80080000 CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK_R_ADDR=0x82000000 +CONFIG_SPL_TEXT_BASE=0x80080000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x80a00000 CONFIG_SPL_BSS_MAX_SIZE=0x80000
@@ -77,6 +77,7 @@ CONFIG_CMD_TIME=y CONFIG_CMD_SMC=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_OVERLAY_LIST="ti/k3-am6xx-phycore-disable-spi-nor ti/k3-am6xx-phycore-disable-rtc ti/k3-am6xx-phycore-disable-eth-phy ti/k3-am6xx-phycore-qspi-nor" CONFIG_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
Signature · 1 line
2.34.1
PATCH 3/6 configs: phycore_am64x_a53_defconfig: Enable PHYTEC_SOM_DETECTION
In reply to Wadim EgorovEnable CONFIG_PHYTEC_SOM_DETECTION to apply SoM overlays based on EEPROM configuration.
--- configs/phycore_am64x_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/phycore_am64x_a53_defconfig +1 -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
Signature · 1 line
2.34.1
PATCH 4/6 arm: dts: k3-am625-phycore-som-binman: Add SoM overlays
In reply to Wadim EgorovInclude SoM dt-overlays that handle variants of our SoMs into u-boot's FIT image.
--- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)
arch/arm/dts/k3-am625-phycore-som-binman.dtsi +53 -1
@@ -301,6 +301,54 @@ description = "U-Boot for phyCORE-AM62x"; }; + som-no-rtc { + description = "k3-am6xx-phycore-disable-rtc"; + type = "flat_dt"; + compression = "none"; + load = <0x8F000000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-rtc.dtbo"; + }; + }; + + som-no-spi { + description = "k3-am6xx-phycore-disable-spi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F001000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-spi-nor.dtbo"; + }; + }; + + som-no-eth { + description = "k3-am6xx-phycore-disable-eth-phy"; + type = "flat_dt"; + compression = "none"; + load = <0x8F002000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-eth-phy.dtbo"; + }; + }; + + som-qspi { + description = "k3-am6xx-phycore-qspi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F003000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-qspi-nor.dtbo"; + }; + }; + fdt-0 { description = "k3-am625-phyboard-lyra-rdk"; type = "flat_dt";
@@ -325,7 +373,11 @@ conf-0 { description = "k3-am625-phyboard-lyra-rdk"; firmware = "uboot"; - loadables = "uboot"; + loadables = "uboot", + "som-no-rtc", + "som-no-spi", + "som-no-eth", + "som-qspi"; fdt = "fdt-0"; }; };
Signature · 1 line
2.34.1
Re: [PATCH 4/6] arm: dts: k3-am625-phycore-som-binman: Add SoM overlays
Hi Wadim
Quoted 70 lines · Wadim Egorov
Include SoM dt-overlays that handle variants of our SoMs into u-boot's FIT image.
Signed-off-by Wadim Egorov <[email protected]>--- arch/arm/dts/k3-am625-phycore-som-binman.dtsi | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)arch/arm/dts/k3-am625-phycore-som-binman.dtsi +48
-0@@ -301,6 +301,54 @@ description = "U-Boot for phyCORE-AM62x"; }; + som-no-rtc { + description = "k3-am6xx-phycore-disable-rtc"; + type = "flat_dt"; + compression = "none"; + load = <0x8F000000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-rtc.dtbo"; + }; + }; + + som-no-spi { + description = "k3-am6xx-phycore-disable-spi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F001000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-spi-nor.dtbo"; + }; + }; + + som-no-eth { + description = "k3-am6xx-phycore-disable-eth-phy"; + type = "flat_dt"; + compression = "none"; + load = <0x8F002000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-eth-phy.dtbo"; + }; + }; + + som-qspi { + description = "k3-am6xx-phycore-qspi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F003000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-qspi-nor.dtbo"; + }; + }; + fdt-0 { description = "k3-am625-phyboard-lyra-rdk"; type = "flat_dt";@@ -325,7 +373,11 @@ conf-0 { description = "k3-am625-phyboard-lyra-rdk";
arch/arm/dts/k3-am625-phycore-som-binman.dtsi line 383
Quoted 10 lines
arch/arm/dts/k3-am625-phycore-som-binman.dtsi +5
-1firmware = "uboot"; - loadables = "uboot"; + loadables = "uboot", + "som-no-rtc", + "som-no-spi", + "som-no-eth", + "som-qspi"; fdt = "fdt-0"; }; };
Signature · 2 lines
Thanking You Neha Malcom Francis
PATCH 5/6 arm: dts: k3-am642-phycore-som-binman: Add SoM overlays
In reply to Wadim EgorovInclude SoM dt-overlays that handle variants of our SoMs into u-boot's FIT image.
--- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)
arch/arm/dts/k3-am642-phycore-som-binman.dtsi +53 -1
@@ -344,6 +344,54 @@ description = "U-Boot for AM64 board"; }; + som-no-rtc { + description = "k3-am6xx-phycore-disable-rtc"; + type = "flat_dt"; + compression = "none"; + load = <0x8F000000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-rtc.dtbo"; + }; + }; + + som-no-spi { + description = "k3-am6xx-phycore-disable-spi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F001000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-spi-nor.dtbo"; + }; + }; + + som-no-eth { + description = "k3-am6xx-phycore-disable-eth-phy"; + type = "flat_dt"; + compression = "none"; + load = <0x8F002000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-eth-phy.dtbo"; + }; + }; + + som-qspi { + description = "k3-am6xx-phycore-qspi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F003000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-qspi-nor.dtbo"; + }; + }; + fdt-0 { description = "k3-am642-phyboard-electra-rdk"; type = "flat_dt";
@@ -368,7 +416,11 @@ conf-0 { description = "k3-am642-phyboard-electra-rdk"; firmware = "uboot"; - loadables = "uboot"; + loadables = "uboot", + "som-no-rtc", + "som-no-spi", + "som-no-eth", + "som-qspi"; fdt = "fdt-0"; }; };
Signature · 1 line
2.34.1
Re: [PATCH 5/6] arm: dts: k3-am642-phycore-som-binman: Add SoM overlays
Quoted 70 lines · Wadim Egorov
Include SoM dt-overlays that handle variants of our SoMs into u-boot's FIT image.
Signed-off-by Wadim Egorov <[email protected]>--- arch/arm/dts/k3-am642-phycore-som-binman.dtsi | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-)arch/arm/dts/k3-am642-phycore-som-binman.dtsi +48
-0@@ -344,6 +344,54 @@ description = "U-Boot for AM64 board"; }; + som-no-rtc { + description = "k3-am6xx-phycore-disable-rtc"; + type = "flat_dt"; + compression = "none"; + load = <0x8F000000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-rtc.dtbo"; + }; + }; + + som-no-spi { + description = "k3-am6xx-phycore-disable-spi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F001000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-spi-nor.dtbo"; + }; + }; + + som-no-eth { + description = "k3-am6xx-phycore-disable-eth-phy"; + type = "flat_dt"; + compression = "none"; + load = <0x8F002000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-disable-eth-phy.dtbo"; + }; + }; + + som-qspi { + description = "k3-am6xx-phycore-qspi-nor"; + type = "flat_dt"; + compression = "none"; + load = <0x8F003000>; + arch = "arm"; + + blob-ext { + filename = "dts/upstream/src/arm64/ti/k3-am6xx-phycore-qspi-nor.dtbo"; + }; + }; + fdt-0 { description = "k3-am642-phyboard-electra-rdk"; type = "flat_dt";@@ -368,7 +416,11 @@ conf-0 { description = "k3-am642-phyboard-electra-rdk";
arch/arm/dts/k3-am642-phycore-som-binman.dtsi line 426
Quoted 10 lines
arch/arm/dts/k3-am642-phycore-som-binman.dtsi +5
-1firmware = "uboot"; - loadables = "uboot"; + loadables = "uboot", + "som-no-rtc", + "som-no-spi", + "som-no-eth", + "som-qspi"; fdt = "fdt-0"; }; };
Signature · 2 lines
Thanking You Neha Malcom Francis
PATCH 6/6 board: phytec: common: k3: Apply SoM-specific overlays to OS device tree
In reply to Wadim EgorovOur SoMs are available in multiple configurations, managed via device tree overlays. To determine the specific variant in use, we read the EEPROM and apply the appropriate overlays during boot to the device tree used by the OS.
--- board/phytec/common/k3/board.c | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
board/phytec/common/k3/board.c +73 -0
@@ -6,7 +6,9 @@#include <env_internal.h> #include <fdt_support.h> +#include <dm/ofnode.h> #include <spl.h> +#include <malloc.h> #include <asm/arch/hardware.h> #include "../am6_som_detection.h"
@@ -97,8 +99,79 @@ int board_late_init(void)#endif #if IS_ENABLED (CONFIG_OF_LIBFDT ) &&IS_ENABLED (CONFIG_OF_BOARD_SETUP ) +static int fdt_apply_overlay_from_fit (const char *overlay_path,void *fdt) +{ +u64 loadaddr; +ofnode node; +int ret; + + node =ofnode_path (overlay_path); +if (!ofnode_valid (node)) +return -FDT_ERR_NOTFOUND ; + + ret =ofnode_read_u64 (node,"load" , &loadaddr); +if (ret) +return ret; + +return fdt_overlay_apply_verbose (fdt, (void *)loadaddr); +} + +static void fdt_apply_som_overlays (void *blob) +{ +void *fdt_copy; +u32 fdt_size; +struct phytec_eeprom_data data; +int err; + + fdt_size =fdt_totalsize (blob); + fdt_copy =malloc (fdt_size); +if (!fdt_copy) + goto fixup_error; + +memcpy (fdt_copy, blob, fdt_size); + + err =phytec_eeprom_data_setup (&data,0 ,EEPROM_ADDR ); +if (err) + goto fixup_error; + +if (phytec_get_am6_rtc (&data) ==0 ) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-no-rtc" , fdt_copy); +if (err) + goto fixup_error; + } + +if (phytec_get_am6_spi (&data) ==PHYTEC_EEPROM_VALUE_X ) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-no-spi" , fdt_copy); +if (err) + goto fixup_error; + } + +if (phytec_get_am6_eth (&data) ==0 ) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-no-eth" , fdt_copy); +if (err) + goto fixup_error; + } + +if (phytec_am6_is_qspi (&data)) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-qspi-nor" , fdt_copy); +if (err) + goto fixup_error; + } + +memcpy (blob, fdt_copy, fdt_size); + +cleanup: +free (fdt_copy); +return ; + +fixup_error: +pr_err ("Failed to apply SoM overlays\n" ); + goto cleanup; +} +int ft_board_setup (void *blob,struct bd_info *bd) { +fdt_apply_som_overlays (blob);fdt_copy_fixed_partitions (blob);return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH 6/6] board: phytec: common: k3: Apply SoM-specific overlays to OS device tree
Quoted 94 lines · Wadim Egorov
Our SoMs are available in multiple configurations, managed via device tree overlays. To determine the specific variant in use, we read the EEPROM and apply the appropriate overlays during boot to the device tree used by the OS.
Signed-off-by Wadim Egorov <[email protected]>--- board/phytec/common/k3/board.c | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)board/phytec/common/k3/board.c +68
-0@@ -6,7 +6,9 @@#include <env_internal.h> #include <fdt_support.h> +#include <dm/ofnode.h> #include <spl.h> +#include <malloc.h> #include <asm/arch/hardware.h> #include "../am6_som_detection.h" @@ -97,8 +99,79 @@ int board_late_init(void)#endif #if IS_ENABLED (CONFIG_OF_LIBFDT ) &&IS_ENABLED (CONFIG_OF_BOARD_SETUP ) +static int fdt_apply_overlay_from_fit (const char *overlay_path,void *fdt) +{ +u64 loadaddr; +ofnode node; +int ret; + + node =ofnode_path (overlay_path); +if (!ofnode_valid (node)) +return -FDT_ERR_NOTFOUND ; + + ret =ofnode_read_u64 (node,"load" , &loadaddr); +if (ret) +return ret; + +return fdt_overlay_apply_verbose (fdt, (void *)loadaddr); +} + +static void fdt_apply_som_overlays (void *blob) +{ +void *fdt_copy; +u32 fdt_size; +struct phytec_eeprom_data data; +int err; + + fdt_size =fdt_totalsize (blob); + fdt_copy =malloc (fdt_size); +if (!fdt_copy) + goto fixup_error; + +memcpy (fdt_copy, blob, fdt_size); + + err =phytec_eeprom_data_setup (&data,0 ,EEPROM_ADDR ); +if (err) + goto fixup_error; + +if (phytec_get_am6_rtc (&data) ==0 ) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-no-rtc" , fdt_copy); +if (err) + goto fixup_error; + } + +if (phytec_get_am6_spi (&data) ==PHYTEC_EEPROM_VALUE_X ) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-no-spi" , fdt_copy); +if (err) + goto fixup_error; + } + +if (phytec_get_am6_eth (&data) ==0 ) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-no-eth" , fdt_copy); +if (err) + goto fixup_error; + } + +if (phytec_am6_is_qspi (&data)) { + err =fdt_apply_overlay_from_fit ("/fit-images/som-qspi-nor" , fdt_copy); +if (err) + goto fixup_error; + } + +memcpy (blob, fdt_copy, fdt_size); + +cleanup: +free (fdt_copy); +return ; + +fixup_error:
board/phytec/common/k3/board.c int board_late_init(void) · line 177
Quoted 10 lines
board/phytec/common/k3/board.c +5
-0+pr_err ("Failed to apply SoM overlays\n" ); + goto cleanup; +} +int ft_board_setup (void *blob,struct bd_info *bd) { +fdt_apply_som_overlays (blob);fdt_copy_fixed_partitions (blob);return 0 ;
Signature · 2 lines
Thanking You Neha Malcom Francis
Quoted 9 lines · Wadim Egorov
Our SoMs are available in multiple configurations, managed via device tree overlays. To determine the specific variant in use, we read the EEPROM and apply the appropriate overlays during boot to the device tree used by the OS.
Apply overlays for phyCORE-AM62x and phyCORE-AM64x SoMs. Future K3 SoMs will be able to reuse this logic and overlays.
[...]
Applied to u-boot/master, thanks!
Signature · 1 line
Tom