[PATCH V2 00/12] board: ti: j721e: cleanup

Hi,
This series was originally posted as part of BeagleBone AI-64 enablement, instead, I have spun it off as it's own series on which BeagleBone AI-64 will depend on.
Changes since V1: * Moved j7200 to bootstd in addition to j721e * Dropped a couple of controversial patches around DDR and refactor to move eeprom code into it's own file * Added Kconfig option that makes it feasible to add BeagleBone AI-64 (mmu refactor) * Documentation path updates to ease up BeagleBone AI-64 documentation.
V1: https://lore.kernel.org/u-boot/20231103003805.2420005-1-nm@ti.com/
Complete series including this one can be found here: https://github.com/nmenon/u-boot/commits/beagleboneai64-v2
Boot Logs: J7200 HSEVM:https://gist.github.com/nmenon/5b5850311c2e23ba746c5e9631fc1380 J7200 EVM (GP): https://gist.github.com/nmenon/6e579b74ba8b2e1e0cc108922486b27a J721E IDK/EVM: https://gist.github.com/nmenon/8d03e88aeb10b4d8bd02571325762e90
Nishanth Menon (12): board: ti: j721e: evm: Drop unused headers board: ti: j721e: evm: Drop board check for ESM board: ti: j721e: evm: Switch to using IS_ENABLED board: ti: j721e: j721e.env: Add explicit boot_targets configs: j721e_evm_a72_defconfig: Switch to bootstd arm: mach-k3: Kconfig: Introduce a symbol to indicate J7200 board: ti: j721e: Select SOC_K3_J721E_J7200 for J7200evm arm: mach-k3: arm64-mmu: Refactor to be independent of board arm: mach-k3: j721e: Improve support for UDA FS configs: j7200: Remove HBMC_AM654 config configs: j7200_evm_a72_defconfig: Switch to bootstd doc: board: ti: j721e_evm: Use board relative path for include directives
arch/arm/mach-k3/Kconfig | 5 ++ arch/arm/mach-k3/arm64-mmu.c | 50 ++++++++-------- arch/arm/mach-k3/j721e_init.c | 9 ++- board/ti/j721e/Kconfig | 1 + board/ti/j721e/evm.c | 101 ++++++++++++++------------------ board/ti/j721e/j721e.env | 1 + configs/j7200_evm_a72_defconfig | 6 +- configs/j7200_evm_r5_defconfig | 1 - configs/j721e_evm_a72_defconfig | 5 +- doc/board/ti/j721e_evm.rst | 18 +++--- 10 files changed, 99 insertions(+), 98 deletions(-)

Drop headers that are no longer necessary for build
Signed-off-by: Nishanth Menon nm@ti.com --- board/ti/j721e/evm.c | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index d4f7c1d9f938..aa22f1653fec 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -8,21 +8,13 @@ */
#include <common.h> -#include <env.h> -#include <fdt_support.h> #include <generic-phy.h> #include <image.h> -#include <init.h> -#include <log.h> #include <net.h> #include <asm/arch/hardware.h> -#include <asm/global_data.h> #include <asm/gpio.h> -#include <asm/io.h> #include <spl.h> #include <dm.h> -#include <dm/uclass-internal.h> -#include <linux/printk.h>
#include "../common/board_detect.h"

Hi Nishanth,
On 04/11/23 12:51, Nishanth Menon wrote:
Drop headers that are no longer necessary for build
Signed-off-by: Nishanth Menon nm@ti.com
board/ti/j721e/evm.c | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index d4f7c1d9f938..aa22f1653fec 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -8,21 +8,13 @@ */
#include <common.h> -#include <env.h> -#include <fdt_support.h> #include <generic-phy.h> #include <image.h> -#include <init.h> -#include <log.h> #include <net.h> #include <asm/arch/hardware.h> -#include <asm/global_data.h> #include <asm/gpio.h> -#include <asm/io.h> #include <spl.h> #include <dm.h> -#include <dm/uclass-internal.h> -#include <linux/printk.h>
#include "../common/board_detect.h"
Reviewed-by: Neha Malcom Francis n-francis@ti.com

On Sat, Nov 04, 2023 at 02:21:39AM -0500, Nishanth Menon wrote:
Drop headers that are no longer necessary for build
Signed-off-by: Nishanth Menon nm@ti.com Reviewed-by: Neha Malcom Francis n-francis@ti.com
For the series, applied to u-boot/next, thanks!

When config is enabled, the esm dt probe makes sense. Simplify by dropping board specific checks.
Signed-off-by: Nishanth Menon nm@ti.com --- board/ti/j721e/evm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index aa22f1653fec..8f0996c32ee6 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -523,10 +523,8 @@ err_free_gpio:
void spl_board_init(void) { -#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC) struct udevice *dev; int ret; -#endif
if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) && @@ -535,24 +533,20 @@ void spl_board_init(void) probe_daughtercards(); }
-#ifdef CONFIG_ESM_K3 - if (board_ti_k3_is("J721EX-PM2-SOM")) { + if (IS_ENABLED(CONFIG_ESM_K3)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_esm), &dev); if (ret) printf("ESM init failed: %d\n", ret); } -#endif
-#ifdef CONFIG_ESM_PMIC - if (board_ti_k3_is("J721EX-PM2-SOM")) { + if (IS_ENABLED(CONFIG_ESM_PMIC)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(pmic_esm), &dev); if (ret) printf("ESM PMIC init failed: %d\n", ret); } -#endif if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) && IS_ENABLED(CONFIG_HBMC_AM654)) { struct udevice *dev;

Hi Nishanth,
On 04/11/23 12:51, Nishanth Menon wrote:
When config is enabled, the esm dt probe makes sense. Simplify by dropping board specific checks.
Signed-off-by: Nishanth Menon nm@ti.com
board/ti/j721e/evm.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index aa22f1653fec..8f0996c32ee6 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -523,10 +523,8 @@ err_free_gpio:
void spl_board_init(void) { -#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC) struct udevice *dev; int ret; -#endif
if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) && @@ -535,24 +533,20 @@ void spl_board_init(void) probe_daughtercards(); }
-#ifdef CONFIG_ESM_K3
- if (board_ti_k3_is("J721EX-PM2-SOM")) {
- if (IS_ENABLED(CONFIG_ESM_K3)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_esm), &dev); if (ret) printf("ESM init failed: %d\n", ret); }
-#endif
-#ifdef CONFIG_ESM_PMIC
- if (board_ti_k3_is("J721EX-PM2-SOM")) {
- if (IS_ENABLED(CONFIG_ESM_PMIC)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(pmic_esm), &dev); if (ret) printf("ESM PMIC init failed: %d\n", ret); }
-#endif
Add empty line here?
if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) && IS_ENABLED(CONFIG_HBMC_AM654)) { struct udevice *dev;
Reviewed-by: Neha Malcom Francis n-francis@ti.com

Switch to using IS_ENABLED() for inline function usage.
Signed-off-by: Nishanth Menon nm@ti.com --- board/ti/j721e/evm.c | 83 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 41 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index 8f0996c32ee6..17640ae79665 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -300,53 +300,54 @@ static int probe_daughtercards(void) printf("Detected: %s rev %s\n", ep.name, ep.version); daughter_card_detect_flags[i] = true;
-#ifndef CONFIG_SPL_BUILD - int j; - /* - * Populate any MAC addresses from daughtercard into the U-Boot - * environment, starting with a card-specific offset so we can - * have multiple ext_cards contribute to the MAC pool in a well- - * defined manner. - */ - for (j = 0; j < mac_addr_cnt; j++) { - if (!is_valid_ethaddr((u8 *)mac_addr[j])) - continue; - - eth_env_set_enetaddr_by_index("eth", - ext_cards[i].eth_offset + j, - (uchar *)mac_addr[j]); + if (!IS_ENABLED(CONFIG_SPL_BUILD)) { + int j; + /* + * Populate any MAC addresses from daughtercard into the U-Boot + * environment, starting with a card-specific offset so we can + * have multiple ext_cards contribute to the MAC pool in a well- + * defined manner. + */ + for (j = 0; j < mac_addr_cnt; j++) { + if (!is_valid_ethaddr((u8 *)mac_addr[j])) + continue; + + eth_env_set_enetaddr_by_index("eth", + ext_cards[i].eth_offset + j, + (uchar *)mac_addr[j]); + } } -#endif } -#ifndef CONFIG_SPL_BUILD - char name_overlays[1024] = { 0 };
- for (i = 0; i < ARRAY_SIZE(ext_cards); i++) { - if (!daughter_card_detect_flags[i]) - continue; + if (!IS_ENABLED(CONFIG_SPL_BUILD)) { + char name_overlays[1024] = { 0 };
- /* Skip if no overlays are to be added */ - if (!strlen(ext_cards[i].dtbo_name)) - continue; + for (i = 0; i < ARRAY_SIZE(ext_cards); i++) { + if (!daughter_card_detect_flags[i]) + continue;
- /* - * Make sure we are not running out of buffer space by checking - * if we can fit the new overlay, a trailing space to be used - * as a separator, plus the terminating zero. - */ - if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 > - sizeof(name_overlays)) - return -ENOMEM; - - /* Append to our list of overlays */ - strcat(name_overlays, ext_cards[i].dtbo_name); - strcat(name_overlays, " "); - } + /* Skip if no overlays are to be added */ + if (!strlen(ext_cards[i].dtbo_name)) + continue;
- /* Apply device tree overlay(s) to the U-Boot environment, if any */ - if (strlen(name_overlays)) - return env_set("name_overlays", name_overlays); -#endif + /* + * Make sure we are not running out of buffer space by checking + * if we can fit the new overlay, a trailing space to be used + * as a separator, plus the terminating zero. + */ + if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 > + sizeof(name_overlays)) + return -ENOMEM; + + /* Append to our list of overlays */ + strcat(name_overlays, ext_cards[i].dtbo_name); + strcat(name_overlays, " "); + } + + /* Apply device tree overlay(s) to the U-Boot environment, if any */ + if (strlen(name_overlays)) + return env_set("name_overlays", name_overlays); + }
return 0; }

Hi Nishanth,
On 04/11/23 12:51, Nishanth Menon wrote:
Switch to using IS_ENABLED() for inline function usage.
Signed-off-by: Nishanth Menon nm@ti.com
board/ti/j721e/evm.c | 83 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 41 deletions(-)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index 8f0996c32ee6..17640ae79665 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -300,53 +300,54 @@ static int probe_daughtercards(void) printf("Detected: %s rev %s\n", ep.name, ep.version); daughter_card_detect_flags[i] = true;
-#ifndef CONFIG_SPL_BUILD
int j;
/*
* Populate any MAC addresses from daughtercard into the U-Boot
* environment, starting with a card-specific offset so we can
* have multiple ext_cards contribute to the MAC pool in a well-
* defined manner.
*/
for (j = 0; j < mac_addr_cnt; j++) {
if (!is_valid_ethaddr((u8 *)mac_addr[j]))
continue;
eth_env_set_enetaddr_by_index("eth",
ext_cards[i].eth_offset + j,
(uchar *)mac_addr[j]);
if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
int j;
/*
* Populate any MAC addresses from daughtercard into the U-Boot
* environment, starting with a card-specific offset so we can
* have multiple ext_cards contribute to the MAC pool in a well-
* defined manner.
*/
for (j = 0; j < mac_addr_cnt; j++) {
if (!is_valid_ethaddr((u8 *)mac_addr[j]))
continue;
eth_env_set_enetaddr_by_index("eth",
ext_cards[i].eth_offset + j,
(uchar *)mac_addr[j]);
}}
-#endif } -#ifndef CONFIG_SPL_BUILD
char name_overlays[1024] = { 0 };
for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
if (!daughter_card_detect_flags[i])
continue;
- if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
char name_overlays[1024] = { 0 };
/* Skip if no overlays are to be added */
if (!strlen(ext_cards[i].dtbo_name))
continue;
for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
if (!daughter_card_detect_flags[i])
continue;
/*
* Make sure we are not running out of buffer space by checking
* if we can fit the new overlay, a trailing space to be used
* as a separator, plus the terminating zero.
*/
if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
sizeof(name_overlays))
return -ENOMEM;
/* Append to our list of overlays */
strcat(name_overlays, ext_cards[i].dtbo_name);
strcat(name_overlays, " ");
- }
/* Skip if no overlays are to be added */
if (!strlen(ext_cards[i].dtbo_name))
continue;
- /* Apply device tree overlay(s) to the U-Boot environment, if any */
- if (strlen(name_overlays))
return env_set("name_overlays", name_overlays);
-#endif
/*
* Make sure we are not running out of buffer space by checking
* if we can fit the new overlay, a trailing space to be used
* as a separator, plus the terminating zero.
*/
if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
sizeof(name_overlays))
return -ENOMEM;
/* Append to our list of overlays */
strcat(name_overlays, ext_cards[i].dtbo_name);
strcat(name_overlays, " ");
}
/* Apply device tree overlay(s) to the U-Boot environment, if any */
if (strlen(name_overlays))
return env_set("name_overlays", name_overlays);
}
return 0; }
Reviewed-by: Neha Malcom Francis n-francis@ti.com

Add explicit boot_targets to indicate the specific boot sequence to follow.
Signed-off-by: Nishanth Menon nm@ti.com --- board/ti/j721e/j721e.env | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env index 8cc8232fc131..cb27bf5e2b24 100644 --- a/board/ti/j721e/j721e.env +++ b/board/ti/j721e/j721e.env @@ -31,6 +31,7 @@ addr_mcur5f0_0load=0x89000000 name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw #endif
+boot_targets=mmc1 mmc0 usb pxe dhcp boot=mmc mmcdev=1 bootpart=1:2

Hi Nishanth,
On 04/11/23 12:51, Nishanth Menon wrote:
Add explicit boot_targets to indicate the specific boot sequence to follow.
Signed-off-by: Nishanth Menon nm@ti.com
board/ti/j721e/j721e.env | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/ti/j721e/j721e.env b/board/ti/j721e/j721e.env index 8cc8232fc131..cb27bf5e2b24 100644 --- a/board/ti/j721e/j721e.env +++ b/board/ti/j721e/j721e.env @@ -31,6 +31,7 @@ addr_mcur5f0_0load=0x89000000 name_mcur5f0_0fw=/lib/firmware/j7200-mcu-r5f0_0-fw #endif
+boot_targets=mmc1 mmc0 usb pxe dhcp boot=mmc mmcdev=1 bootpart=1:2
Reviewed-by: Neha Malcom Francis n-francis@ti.com

Switch to using bootstd. Note with this change, we will stop using distro_bootcmd and instead depend entirely on bootflow method of starting the system up.
Signed-off-by: Nishanth Menon nm@ti.com --- configs/j721e_evm_a72_defconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 99e0e168ebf7..98ac7ca59789 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 -CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;" +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_LOGLEVEL=7 CONFIG_SPL_MAX_SIZE=0xc0000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y

Hi Nishanth
On 04/11/23 12:51, Nishanth Menon wrote:
Switch to using bootstd. Note with this change, we will stop using distro_bootcmd and instead depend entirely on bootflow method of starting the system up.
Signed-off-by: Nishanth Menon nm@ti.com
configs/j721e_evm_a72_defconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 99e0e168ebf7..98ac7ca59789 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 -CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;" +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_LOGLEVEL=7 CONFIG_SPL_MAX_SIZE=0xc0000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
Reviewed-by: Neha Malcom Francis n-francis@ti.com

J7200 shares quite a few characteristics with J721E. However a few sets are different. Introduce a Kconfig to differentiate the two to allow for new boards to be introduced in a seamless manner.
Signed-off-by: Nishanth Menon nm@ti.com --- arch/arm/mach-k3/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index 9168bf842dca..57e2dd966eb8 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -24,6 +24,11 @@ config SOC_K3_AM62A7
endchoice
+if SOC_K3_J721E +config SOC_K3_J721E_J7200 + bool "TI's K3 based J7200 SoC variant Family Support" +endif + config SYS_SOC default "k3"

On 11/4/23 2:21 AM, Nishanth Menon wrote:
J7200 shares quite a few characteristics with J721E. However a few sets are different. Introduce a Kconfig to differentiate the two to allow for new boards to be introduced in a seamless manner.
Signed-off-by: Nishanth Menon nm@ti.com
arch/arm/mach-k3/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index 9168bf842dca..57e2dd966eb8 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -24,6 +24,11 @@ config SOC_K3_AM62A7
endchoice
+if SOC_K3_J721E +config SOC_K3_J721E_J7200
I'm sure you know how messy this is :(
We wanted to treat J7200 as a proper subset device of J721e but we also know that didn't happen. These two SoCs ended up more different than expected and although still very similar I believe continuing to try to support both under one name is not the right solution.
We will split out J7200 from J721e in TF-A[0] for similar reasons, might be time to do the same in u-boot.
Andrew
[0] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/23970
- bool "TI's K3 based J7200 SoC variant Family Support"
+endif
- config SYS_SOC default "k3"

On 10:45-20231106, Andrew Davis wrote:
On 11/4/23 2:21 AM, Nishanth Menon wrote:
J7200 shares quite a few characteristics with J721E. However a few sets are different. Introduce a Kconfig to differentiate the two to allow for new boards to be introduced in a seamless manner.
Signed-off-by: Nishanth Menon nm@ti.com
arch/arm/mach-k3/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig index 9168bf842dca..57e2dd966eb8 100644 --- a/arch/arm/mach-k3/Kconfig +++ b/arch/arm/mach-k3/Kconfig @@ -24,6 +24,11 @@ config SOC_K3_AM62A7 endchoice +if SOC_K3_J721E +config SOC_K3_J721E_J7200
I'm sure you know how messy this is :(
We wanted to treat J7200 as a proper subset device of J721e but we also know that didn't happen. These two SoCs ended up more different than expected and although still very similar I believe continuing to try to support both under one name is not the right solution.
We will split out J7200 from J721e in TF-A[0] for similar reasons, might be time to do the same in u-boot.
Yes, I am aware. A follow on series to cleanup J7200 will be appreciated.

Enable SOC_K3_J721E_J7200 when board is J7200 EVM - this allows us to differentiate J7200 platform cleanly in board independent codebase.
Signed-off-by: Nishanth Menon nm@ti.com --- board/ti/j721e/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/ti/j721e/Kconfig b/board/ti/j721e/Kconfig index e6cb21f77bd2..a895d7aac4ab 100644 --- a/board/ti/j721e/Kconfig +++ b/board/ti/j721e/Kconfig @@ -30,6 +30,7 @@ config TARGET_J721E_R5_EVM config TARGET_J7200_A72_EVM bool "TI K3 based J7200 EVM running on A72" select ARM64 + select SOC_K3_J721E_J7200 select BOARD_LATE_INIT imply TI_I2C_BOARD_DETECT select SYS_DISABLE_DCACHE_OPS

Refactor J721E J7200 definition to make this independent of board macros.
Signed-off-by: Nishanth Menon nm@ti.com --- arch/arm/mach-k3/arm64-mmu.c | 50 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/arch/arm/mach-k3/arm64-mmu.c b/arch/arm/mach-k3/arm64-mmu.c index f8087d2421e7..8cb6614035a5 100644 --- a/arch/arm/mach-k3/arm64-mmu.c +++ b/arch/arm/mach-k3/arm64-mmu.c @@ -68,12 +68,11 @@ struct mm_region *mem_map = am654_mem_map;
#ifdef CONFIG_SOC_K3_J721E
-#ifdef CONFIG_TARGET_J721E_A72_EVM -/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */ -#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 6) +#ifdef CONFIG_SOC_K3_J721E_J7200 +#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 5)
/* ToDo: Add 64bit IO */ -struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { +struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { { .virt = 0x0UL, .phys = 0x0UL, @@ -90,13 +89,13 @@ struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { }, { .virt = 0xa0000000UL, .phys = 0xa0000000UL, - .size = 0x1bc00000UL, + .size = 0x04800000UL, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | PTE_BLOCK_NON_SHARE }, { - .virt = 0xbbc00000UL, - .phys = 0xbbc00000UL, - .size = 0x44400000UL, + .virt = 0xa4800000UL, + .phys = 0xa4800000UL, + .size = 0x5b800000UL, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE }, { @@ -112,26 +111,21 @@ struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - .virt = 0x4d80000000UL, - .phys = 0x4d80000000UL, - .size = 0x0002000000UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | - PTE_BLOCK_INNER_SHARE }, { /* List terminator */ 0, } };
-struct mm_region *mem_map = j721e_mem_map; -#endif /* CONFIG_TARGET_J721E_A72_EVM */ +struct mm_region *mem_map = j7200_mem_map;
-#ifdef CONFIG_TARGET_J7200_A72_EVM -#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 5) +#else /* CONFIG_SOC_K3_J721E_J7200 */ + +/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */ +#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 6)
/* ToDo: Add 64bit IO */ -struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { +struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { { .virt = 0x0UL, .phys = 0x0UL, @@ -148,13 +142,13 @@ struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { }, { .virt = 0xa0000000UL, .phys = 0xa0000000UL, - .size = 0x04800000UL, + .size = 0x1bc00000UL, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | PTE_BLOCK_NON_SHARE }, { - .virt = 0xa4800000UL, - .phys = 0xa4800000UL, - .size = 0x5b800000UL, + .virt = 0xbbc00000UL, + .phys = 0xbbc00000UL, + .size = 0x44400000UL, .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE }, { @@ -170,14 +164,20 @@ struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + .virt = 0x4d80000000UL, + .phys = 0x4d80000000UL, + .size = 0x0002000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | + PTE_BLOCK_INNER_SHARE }, { /* List terminator */ 0, } };
-struct mm_region *mem_map = j7200_mem_map; -#endif /* CONFIG_TARGET_J7200_A72_EVM */ +struct mm_region *mem_map = j721e_mem_map; +#endif /* CONFIG_SOC_K3_J721E_J7200 */
#endif /* CONFIG_SOC_K3_J721E */

On 11/4/23 2:21 AM, Nishanth Menon wrote:
Refactor J721E J7200 definition to make this independent of board macros.
Signed-off-by: Nishanth Menon nm@ti.com
arch/arm/mach-k3/arm64-mmu.c | 50 ++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/arch/arm/mach-k3/arm64-mmu.c b/arch/arm/mach-k3/arm64-mmu.c index f8087d2421e7..8cb6614035a5 100644 --- a/arch/arm/mach-k3/arm64-mmu.c +++ b/arch/arm/mach-k3/arm64-mmu.c @@ -68,12 +68,11 @@ struct mm_region *mem_map = am654_mem_map;
#ifdef CONFIG_SOC_K3_J721E
-#ifdef CONFIG_TARGET_J721E_A72_EVM -/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */ -#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 6) +#ifdef CONFIG_SOC_K3_J721E_J7200 +#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 5)
/* ToDo: Add 64bit IO */ -struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { +struct mm_region j7200_mem_map[NR_MMU_REGIONS] = {
Git diff seems to have gotten confused with your re-ordering, makes this hard to review what you are actually changing here..
Also you reminded me of a patch I forgot to send from long ago, just sent it, should make this patch a little more simple if it goes in first.
Andrew
{ .virt = 0x0UL, .phys = 0x0UL, @@ -90,13 +89,13 @@ struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { }, { .virt = 0xa0000000UL, .phys = 0xa0000000UL,
.size = 0x1bc00000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | PTE_BLOCK_NON_SHARE }, {.size = 0x04800000UL,
.virt = 0xbbc00000UL,
.phys = 0xbbc00000UL,
.size = 0x44400000UL,
.virt = 0xa4800000UL,
.phys = 0xa4800000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE }, {.size = 0x5b800000UL,
@@ -112,26 +111,21 @@ struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN
- }, {
.virt = 0x4d80000000UL,
.phys = 0x4d80000000UL,
.size = 0x0002000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
}, { /* List terminator */ 0, } };PTE_BLOCK_INNER_SHARE
-struct mm_region *mem_map = j721e_mem_map; -#endif /* CONFIG_TARGET_J721E_A72_EVM */ +struct mm_region *mem_map = j7200_mem_map;
-#ifdef CONFIG_TARGET_J7200_A72_EVM -#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 5) +#else /* CONFIG_SOC_K3_J721E_J7200 */
+/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */ +#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 6)
/* ToDo: Add 64bit IO */ -struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { +struct mm_region j721e_mem_map[NR_MMU_REGIONS] = { { .virt = 0x0UL, .phys = 0x0UL, @@ -148,13 +142,13 @@ struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { }, { .virt = 0xa0000000UL, .phys = 0xa0000000UL,
.size = 0x04800000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) | PTE_BLOCK_NON_SHARE }, {.size = 0x1bc00000UL,
.virt = 0xa4800000UL,
.phys = 0xa4800000UL,
.size = 0x5b800000UL,
.virt = 0xbbc00000UL,
.phys = 0xbbc00000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE }, {.size = 0x44400000UL,
@@ -170,14 +164,20 @@ struct mm_region j7200_mem_map[NR_MMU_REGIONS] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN
- }, {
.virt = 0x4d80000000UL,
.phys = 0x4d80000000UL,
.size = 0x0002000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
}, { /* List terminator */ 0, } };PTE_BLOCK_INNER_SHARE
-struct mm_region *mem_map = j7200_mem_map; -#endif /* CONFIG_TARGET_J7200_A72_EVM */ +struct mm_region *mem_map = j721e_mem_map; +#endif /* CONFIG_SOC_K3_J721E_J7200 */
#endif /* CONFIG_SOC_K3_J721E */

Commit 5019170970ad ("arch: arm: mach-k3: j721e: add support for UDA FS") introduced basic UDA FS support, however, we can Take approach similar to commit 0f1c1e8b368b ("arm: mach-k3: am625: Add support for UDA FS"). While boot partition support with EMMC boot is useful, it is constrained by the size of boot hardware partition itself.
In the case of K3 devices, tispl images can contain OP-TEE images that can substantially vary in size and the u-boot image itself can vary over time as we enable various features.
So use the CSD information in the case of EMMC_BOOT configuration being enabled to pick boot partition or UDA FS mode operation to pick.
If EMMC_BOOT is disabled, then depend on filesystem configuration to pick data from UDA.
Signed-off-by: Nishanth Menon nm@ti.com --- arch/arm/mach-k3/j721e_init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c index b1f7e25ed092..bcdfbfc79c4a 100644 --- a/arch/arm/mach-k3/j721e_init.c +++ b/arch/arm/mach-k3/j721e_init.c @@ -294,7 +294,14 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device) { switch (boot_device) { case BOOT_DEVICE_MMC1: - return (spl_mmc_emmc_boot_partition(mmc) ? MMCSD_MODE_EMMCBOOT : MMCSD_MODE_FS); + if (IS_ENABLED(CONFIG_SUPPORT_EMMC_BOOT)) { + if (spl_mmc_emmc_boot_partition(mmc)) + return MMCSD_MODE_EMMCBOOT; + return MMCSD_MODE_FS; + } + if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4)) + return MMCSD_MODE_FS; + return MMCSD_MODE_EMMCBOOT; case BOOT_DEVICE_MMC2: return MMCSD_MODE_FS; default:

Kernel commit 1b77265626a4 ("arm64: dts: ti: k3-j7200-mcu-wakeup: Add HyperBus node") was merged to kernel without its dependent patch [1]. Similar fix is needed in U-Boot, and hbmc currently breaks boot. Till this gets fixed in U-Boot, disable the config by default so that the hbmc probe that happens in board/ti/j721e/evm.c will not take place and lead to boot failure.
This is similar to the approach in commit 5b2671594b80 ("configs: j721e: Remove HBMC_AM654 config"), introduced to j7200 evm platform.
[1] https://lore.kernel.org/all/20230424184810.29453-1-afd@ti.com/
Signed-off-by: Nishanth Menon nm@ti.com --- configs/j7200_evm_a72_defconfig | 1 - configs/j7200_evm_r5_defconfig | 1 - 2 files changed, 2 deletions(-)
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index cb4a141675da..889358afc316 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -138,7 +138,6 @@ CONFIG_CFI_FLASH=y CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y -CONFIG_HBMC_AM654=y CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig index d25dd8134b63..6452c60345fd 100644 --- a/configs/j7200_evm_r5_defconfig +++ b/configs/j7200_evm_r5_defconfig @@ -114,7 +114,6 @@ CONFIG_CFI_FLASH=y CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y -CONFIG_HBMC_AM654=y CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_SFDP_SUPPORT=y

Hi Nishanth,
On 04/11/23 12:51, Nishanth Menon wrote:
Kernel commit 1b77265626a4 ("arm64: dts: ti: k3-j7200-mcu-wakeup: Add HyperBus node") was merged to kernel without its dependent patch [1]. Similar fix is needed in U-Boot, and hbmc currently breaks boot. Till this gets fixed in U-Boot, disable the config by default so that the hbmc probe that happens in board/ti/j721e/evm.c will not take place and lead to boot failure.
This is similar to the approach in commit 5b2671594b80 ("configs: j721e: Remove HBMC_AM654 config"), introduced to j7200 evm platform.
[1] https://lore.kernel.org/all/20230424184810.29453-1-afd@ti.com/
Signed-off-by: Nishanth Menon nm@ti.com
configs/j7200_evm_a72_defconfig | 1 - configs/j7200_evm_r5_defconfig | 1 - 2 files changed, 2 deletions(-)
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index cb4a141675da..889358afc316 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -138,7 +138,6 @@ CONFIG_CFI_FLASH=y CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y -CONFIG_HBMC_AM654=y CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_STMICRO=y diff --git a/configs/j7200_evm_r5_defconfig b/configs/j7200_evm_r5_defconfig index d25dd8134b63..6452c60345fd 100644 --- a/configs/j7200_evm_r5_defconfig +++ b/configs/j7200_evm_r5_defconfig @@ -114,7 +114,6 @@ CONFIG_CFI_FLASH=y CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y CONFIG_FLASH_CFI_MTD=y CONFIG_SYS_FLASH_CFI=y -CONFIG_HBMC_AM654=y CONFIG_SYS_MAX_FLASH_BANKS_DETECT=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_SFDP_SUPPORT=y
Reviewed-by: Neha Malcom Francis n-francis@ti.com

Switch to using bootstd. Note with this change, we will stop using distro_bootcmd and instead depend entirely on bootflow method of starting the system up.
Signed-off-by: Nishanth Menon nm@ti.com --- configs/j7200_evm_a72_defconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index 889358afc316..b7bc9ad178f6 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 -CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;" +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_LOGLEVEL=7 CONFIG_SPL_MAX_SIZE=0xc0000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y

Hi Nishanth,
On 04/11/23 12:51, Nishanth Menon wrote:
Switch to using bootstd. Note with this change, we will stop using distro_bootcmd and instead depend entirely on bootflow method of starting the system up.
Signed-off-by: Nishanth Menon nm@ti.com
configs/j7200_evm_a72_defconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index 889358afc316..b7bc9ad178f6 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -29,10 +29,11 @@ CONFIG_SPL_SPI=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_LOAD_FIT=y CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000 -CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_SYSTEM_SETUP=y -CONFIG_BOOTCOMMAND="run envboot; run distro_bootcmd;" +CONFIG_BOOTSTD_FULL=y +CONFIG_BOOTSTD_DEFAULTS=y +CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_LOGLEVEL=7 CONFIG_SPL_MAX_SIZE=0xc0000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
Reviewed-by: Neha Malcom Francis n-francis@ti.com

When using include directives within a section that is included by non TI board rst file, k3.rst and other include paths need to be relative to doc/board/ base.
Signed-off-by: Nishanth Menon nm@ti.com --- doc/board/ti/j721e_evm.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/doc/board/ti/j721e_evm.rst b/doc/board/ti/j721e_evm.rst index 344a38d37486..b012171b45ee 100644 --- a/doc/board/ti/j721e_evm.rst +++ b/doc/board/ti/j721e_evm.rst @@ -48,7 +48,7 @@ support. Below is the pictorial representation of boot flow: Sources: --------
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_boot_sources :end-before: .. k3_rst_include_end_boot_sources
@@ -56,17 +56,17 @@ Build procedure: ---------------- 0. Setup the environment variables:
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_common_env_vars_desc :end-before: .. k3_rst_include_end_common_env_vars_desc
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_board_env_vars_desc :end-before: .. k3_rst_include_end_board_env_vars_desc
Set the variables corresponding to this platform:
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_common_env_vars_defn :end-before: .. k3_rst_include_end_common_env_vars_defn .. prompt:: bash $ @@ -84,14 +84,14 @@ Set the variables corresponding to this platform:
1. Trusted Firmware-A:
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_tfa :end-before: .. k3_rst_include_end_build_steps_tfa
2. OP-TEE:
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_optee :end-before: .. k3_rst_include_end_build_steps_optee
@@ -99,13 +99,13 @@ Set the variables corresponding to this platform:
* 3.1 R5:
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_spl_r5 :end-before: .. k3_rst_include_end_build_steps_spl_r5
* 3.2 A72:
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_build_steps_uboot :end-before: .. k3_rst_include_end_build_steps_uboot .. j721e_evm_rst_include_end_build_steps @@ -248,7 +248,7 @@ detailed setup information. environment's distribution needs to be updated, it might be necessary to build OpenOCD from the source.
-.. include:: k3.rst +.. include:: ../ti/k3.rst :start-after: .. k3_rst_include_start_openocd_connect_XDS110 :end-before: .. k3_rst_include_end_openocd_connect_XDS110
participants (4)
-
Andrew Davis
-
Neha Malcom Francis
-
Nishanth Menon
-
Tom Rini