Skip to contentSkip to conversation

AM68: Add support for AM68 Starter Kit

PATCH Superseded Sinthu Raja 3 participants 23 messages Jan 4, 2023 – Jan 10, 2023

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover AM68: Add support for AM68 Starter Kit

From: Sinthu Raja <[email protected]>

Hi All,
This series of patch add initial support for AM68 starter kit. Design files can be referrred from https://www.ti.com/lit/zip/SPRR463

Refer below link to J721S2/AM68 Technical Reference Manual for further details:
http://www.ti.com/lit/pdf/spruj28

Link to kerenl patches:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#mff5847ea8cdef49337d224b7147f877bcc833aee

Changes in V4:
=============
Address review comments:
- In align wih the macro conditional statement which missed it in the previous version

Changes in V3:
=============
Address review comments:
- Rework on DTB selection API clarity about mini-U-Boot vs EVM and family support as suggested.
* board: ti: j721s2: Add board_init and support for selecting DT based
on EEPROM

Changes in V2:
=============
Address review comments:
- Remove support for detecting multiple device trees using different DTB
- Remove board specific API from K3 generic file (arch/arm/mach-k3/j721s2_init.c) and moved to board specific file (board/ti/j721s2/evm.c).
* arch: mach-k3: Update board specific API name to K3 generic API name
* board: ti: j721s2: Add board_init and support for selecting DT based
on EEPROM
- Move board_is_xxx within CONFIG_TI_I2C_BOARD_DETECT block to maintain the "mini" U-Boot concept for this SoC.

V1: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
V2: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v3: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Sinthu Raja (12):
configs: j721s2_evm_r5: Enable support for building multiple dtbs into
FIT
configs: j721s2_evm_a72: Enable support for building multiple dtbs
into FIT
configs: j721s2_evm: Enable configs to store env in MMC FAT partition
board: ti: j721s2: Add support to update board_name for am68-sk
board: ti: j721s2: Enable support for reading EEPROM at next alternate
address
board: ti: j721s2: Add support for detecting multiple device trees
arch: mach-k3: Update board specific API name to K3 generic API name
board: ti: j721s2: Add board_init and support for selecting DT based
on EEPROM
arm: dts: Add initial support for AM68 Starter Kit System on Module
arm: dts: Add support for A72 specific AM68 Starter Kit Base Board
arm: dts: k3-am68-sk: Add r5 specific dt support
include: configs: Update env for selecting right dtb

 arch/arm/dts/Makefile                         |   4 +-
 .../arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 150 ++++++++
 arch/arm/dts/k3-am68-sk-base-board.dts        | 353 ++++++++++++++++++
 arch/arm/dts/k3-am68-sk-r5-base-board.dts     | 194 ++++++++++
 arch/arm/dts/k3-am68-sk-som.dtsi              | 127 +++++++
 arch/arm/mach-k3/include/mach/sys_proto.h     |   3 +
 arch/arm/mach-k3/j721s2_init.c                |  13 +-
 board/ti/j721s2/evm.c                         | 118 +++++-
 configs/j721s2_evm_a72_defconfig              |   4 +-
 configs/j721s2_evm_r5_defconfig               |   4 +
 include/configs/j721s2_evm.h                  |   4 +
 11 files changed, 956 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
 create mode 100644 arch/arm/dts/k3-am68-sk-base-board.dts
 create mode 100644 arch/arm/dts/k3-am68-sk-r5-base-board.dts
 create mode 100644 arch/arm/dts/k3-am68-sk-som.dtsi
Signature · 1 line
2.36.1
#1 lore raw

PATCH v4 1/12 configs: j721s2_evm_r5: Enable support for building multiple dtbs into FIT

From: Sinthu Raja <[email protected]>

Enable configs for building multiple dtbs into a single fit image and load the right dtb for next stage. This will help to use same defconfig for both EVM and SK.

---
 configs/j721s2_evm_r5_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/j721s2_evm_r5_defconfig +3 -0
index 2de5d87bdb..7418dc2900 100644
@@ -84,6 +84,9 @@ CONFIG_CMD_TIME=y
 CONFIG_CMD_FAT=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
+CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_OF_LIST="k3-j721s2-r5-common-proc-board k3-am68-sk-r5-base-board"
+CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
Signature · 1 line
2.36.1
#2 lore raw

PATCH v4 2/12 configs: j721s2_evm_a72: Enable support for building multiple dtbs into FIT

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Enable configs for building multiple dtbs into a single fit image and load the right dtb for next stage. Add k3-am68-sk-base-board dtb along with evm dtb inside DTB FIT image. This helps to use same defconfig for both EVM and SK

---
 configs/j721s2_evm_a72_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/j721s2_evm_a72_defconfig +1 -0
index 2b2f80c4aa..75b4e52238 100644
@@ -89,6 +89,7 @@ CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_OF_LIST="k3-j721s2-common-proc-board k3-am68-sk-base-board"
 CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
Signature · 1 line
2.36.1
#3 lore raw

PATCH v4 3/12 configs: j721s2_evm: Enable configs to store env in MMC FAT partition

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

J721S2 EVM used to store env on eMMC, since EVM and SK uses same defconfig and there is no eMMC on SK, we need to keep env in an interface which available on both EVM and SK. So, save env in FAT partition of MMC SD Card.

Enable defconfigs relevant for storing env on FAT partition of MMC.

---
 configs/j721s2_evm_a72_defconfig | 3 ++-
 configs/j721s2_evm_r5_defconfig  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
configs/j721s2_evm_a72_defconfig +2 -1
index 75b4e52238..1db5b47a24 100644
@@ -92,7 +92,8 @@ CONFIG_SPL_MULTI_DTB_FIT=y
 CONFIG_OF_LIST="k3-j721s2-common-proc-board k3-am68-sk-base-board"
 CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_OVERWRITE=y
-CONFIG_ENV_IS_IN_MMC=y
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
configs/j721s2_evm_r5_defconfig +1 -0
index 7418dc2900..f7805e83e0 100644
@@ -88,6 +88,7 @@ CONFIG_SPL_MULTI_DTB_FIT=y
 CONFIG_SPL_OF_LIST="k3-j721s2-r5-common-proc-board k3-am68-sk-r5-base-board"
 CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ENV_OVERWRITE=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_REGMAP=y
Signature · 1 line
2.36.1
#4 lore raw

PATCH v4 4/12 board: ti: j721s2: Add support to update board_name for am68-sk

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Update setup_board_eeprom_env() to choose the right board name for am68-sk.

---
 board/ti/j721s2/evm.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
board/ti/j721s2/evm.c +10 -2
index e09adc8ad3..f223ccf2c6 100644
@@ -26,8 +26,6 @@
 
 #include "../common/board_detect.h"
 
-#define board_is_j721s2_som()	board_ti_k3_is("J721S2X-PM1-SOM")
-
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
@@ -101,6 +99,14 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #endif
 
 #ifdef CONFIG_TI_I2C_BOARD_DETECT
+/*
+ * Functions specific to EVM and SK designs of J721S2/AM68 family.
+ */
+
+#define board_is_j721s2_som()	board_ti_k3_is("J721S2X-PM1-SOM")
+
+#define board_is_am68_sk_som() board_ti_k3_is("AM68-SK-SOM")
+
 int do_board_detect(void)
 {
 	int ret;
@@ -136,6 +142,8 @@ static void setup_board_eeprom_env(void)
 
 	if (board_is_j721s2_som())
 		name = "j721s2";
+	else if (board_is_am68_sk_som())
+		name = "am68-sk";
 	else
 		printf("Unidentified board claims %s in eeprom header\n",
 		       board_ti_get_name());
Signature · 1 line
2.36.1
#6 lore raw

PATCH v4 5/12 board: ti: j721s2: Enable support for reading EEPROM at next alternate address

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

J721S2 EVM has EEPROM populated at 0x50. AM68 SK has EEPROM populated at next address 0x51 in order to be compatible with RPi. So start looking for TI specific EEPROM at 0x50, if not found look for EEPROM at 0x51.

---
 board/ti/j721s2/evm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
board/ti/j721s2/evm.c +9 -3
index f223ccf2c6..a3adb8704e 100644
@@ -113,9 +113,15 @@ int do_board_detect(void)
 
 	ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
 					 CONFIG_EEPROM_CHIP_ADDRESS);
-	if (ret)
-		pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
-		       CONFIG_EEPROM_CHIP_ADDRESS, ret);
+	if (ret) {
+		printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
+		       CONFIG_EEPROM_CHIP_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS + 1);
+		ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
+						 CONFIG_EEPROM_CHIP_ADDRESS + 1);
+		if (ret)
+			pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
+				CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
+	}
 
 	return ret;
 }
Signature · 1 line
2.36.1
Reviewed-by on v4 5/12
#7 lore raw

Re: [PATCH V4 05/12] board: ti: j721s2: Enable support for reading EEPROM at next alternate address

Quoted 7 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

J721S2 EVM has EEPROM populated at 0x50. AM68 SK has EEPROM populated at next address 0x51 in order to be compatible with RPi. So start looking for TI specific EEPROM at 0x50, if not found look for EEPROM at 0x51.

Signature · 1 line
Tom
#8 lore raw

PATCH v4 6/12 board: ti: j721s2: Add support for detecting multiple device trees

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Update the board_fit_config_name_match() to choose the right dtb based on the board name read from EEPROM.

Also restrict multpile EEPROM reads by verifying if EEPROM is already read

---
 board/ti/j721s2/evm.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
board/ti/j721s2/evm.c +20 -10
index a3adb8704e..a7c4082a7a 100644
@@ -72,16 +72,6 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-#ifdef CONFIG_SPL_LOAD_FIT
-int board_fit_config_name_match(const char *name)
-{
-	if (!strcmp(name, "k3-j721s2-common-proc-board"))
-		return 0;
-
-	return -1;
-}
-#endif
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
@@ -111,6 +101,9 @@ int do_board_detect(void)
 {
 	int ret;
 
+	if (board_ti_was_eeprom_read())
+		return 0;
+
 	ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
 					 CONFIG_EEPROM_CHIP_ADDRESS);
 	if (ret) {
@@ -179,6 +172,23 @@ static void setup_serial(void)
 }
 #endif
 
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	bool eeprom_read = board_ti_was_eeprom_read();
+
+	if (!eeprom_read || board_is_j721s2_som()) {
+		if (!strcmp(name, "k3-j721s2-common-proc-board"))
+			return 0;
+	} else if (!eeprom_read || board_is_am68_sk_som()) {
+		if (!strcmp(name, "k3-am68-sk-base-board"))
+			return 0;
+	}
+
+	return -1;
+}
+#endif
+
 int board_late_init(void)
 {
 	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
Signature · 1 line
2.36.1
#9 lore raw

Re: [PATCH V4 06/12] board: ti: j721s2: Add support for detecting multiple device trees

Hi Sinthu

Quoted 21 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Update the board_fit_config_name_match() to choose the right dtb based on the board name read from EEPROM.

Also restrict multpile EEPROM reads by verifying if EEPROM is already read

---
  board/ti/j721s2/evm.c | 30 ++++++++++++++++++++----------
  1 file changed, 20 insertions(+), 10 deletions(-)
board/ti/j721s2/evm.c +0 -0
index a3adb8704e..a7c4082a7a 100644
@@ -72,16 +72,6 @@ int dram_init_banksize(void)
  	return 0;
  }
 

board/ti/j721s2/evm.c int dram_init_banksize(void) · line 84

Quoted 10 lines
board/ti/j721s2/evm.c +0 -10
-#ifdef CONFIG_SPL_LOAD_FIT
-int board_fit_config_name_match(const char *name)
-{
-	if (!strcmp(name, "k3-j721s2-common-proc-board"))
-		return 0;
-
-	return -1;
-}
-#endif
-

Any reason why the modifications to board_fit_config_name_match was not made here itself and instead shifted, would make patch more readable.

Quoted 16 lines
board/ti/j721s2/evm.c +3 -0
  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
  int ft_board_setup(void *blob, struct bd_info *bd)
  {
@@ -111,6 +101,9 @@ int do_board_detect(void)
  {
  	int ret;
 
+	if (board_ti_was_eeprom_read())
+		return 0;
+
  	ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
  					 CONFIG_EEPROM_CHIP_ADDRESS);
  	if (ret) {
@@ -179,6 +172,23 @@ static void setup_serial(void)
  }
  #endif

board/ti/j721s2/evm.c static void setup_serial(void) · line 183

Quoted 10 lines
board/ti/j721s2/evm.c +9 -0
 
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	bool eeprom_read = board_ti_was_eeprom_read();
+
+	if (!eeprom_read || board_is_j721s2_som()) {
+		if (!strcmp(name, "k3-j721s2-common-proc-board"))
+			return 0;
+	} else if (!eeprom_read || board_is_am68_sk_som()) {

This second eeprom_read check is unnecessary.

Quoted 11 lines
board/ti/j721s2/evm.c +8 -0
+		if (!strcmp(name, "k3-am68-sk-base-board"))
+			return 0;
+	}
+
+	return -1;
+}
+#endif
+
  int board_late_init(void)
  {
  	if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
Signature · 2 lines
Thanking You
Neha Malcom Francis
#10 lore raw

Re: [PATCH V4 06/12] board: ti: j721s2: Add support for detecting multiple device trees

Neha,

Quoted 25 lines · Neha Malcom Francis

Hi Sinthu

Quoted 21 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Update the board_fit_config_name_match() to choose the right dtb based on the board name read from EEPROM.

Also restrict multpile EEPROM reads by verifying if EEPROM is already read

---
  board/ti/j721s2/evm.c | 30 ++++++++++++++++++++----------
  1 file changed, 20 insertions(+), 10 deletions(-)
board/ti/j721s2/evm.c +0 -0
index a3adb8704e..a7c4082a7a 100644
@@ -72,16 +72,6 @@ int dram_init_banksize(void)
      return 0;
  }
 
Quoted 13 lines

board/ti/j721s2/evm.c int dram_init_banksize(void) · line 84

Quoted 10 lines
board/ti/j721s2/evm.c +0 -10
-#ifdef CONFIG_SPL_LOAD_FIT
-int board_fit_config_name_match(const char *name)
-{
-     if (!strcmp(name, "k3-j721s2-common-proc-board"))
-             return 0;
-
-     return -1;
-}
-#endif
-

Any reason why the modifications to board_fit_config_name_match was not made here itself and instead shifted, would make patch more readable.

If you please check patch number 4, we are bringing the Macro board_is_xxxx under CONFIG_TI_I2C_BOARD_DETECT macro to make it as functions specific to EVM and SK designs of J721S2/AM68 family. This modification is suggested by Tom earlier. As we moved board_is_xxxx we have to move board_fit_config_name_match() API also. Without this change we will get an implicit declaration error.

Quoted 18 lines
Quoted 18 lines
board/ti/j721s2/evm.c +3 -0
  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
  int ft_board_setup(void *blob, struct bd_info *bd)
  {
@@ -111,6 +101,9 @@ int do_board_detect(void)
  {
      int ret;
 
+     if (board_ti_was_eeprom_read())
+             return 0;
+
      ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
                                       CONFIG_EEPROM_CHIP_ADDRESS);
      if (ret) {
@@ -179,6 +172,23 @@ static void setup_serial(void)
  }
  #endif
 
Quoted 11 lines

board/ti/j721s2/evm.c static void setup_serial(void) · line 183

Quoted 9 lines
board/ti/j721s2/evm.c +9 -0
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+     bool eeprom_read = board_ti_was_eeprom_read();
+
+     if (!eeprom_read || board_is_j721s2_som()) {
+             if (!strcmp(name, "k3-j721s2-common-proc-board"))
+                     return 0;
+     } else if (!eeprom_read || board_is_am68_sk_som()) {

This second eeprom_read check is unnecessary.

This is to check what board is loaded and to identify if the corresponding DTB file is present in the image. If not this will work only for EVM and not SK.

Quoted 16 lines

board/ti/j721s2/evm.c static void setup_serial(void) · line 194

Quoted 12 lines
board/ti/j721s2/evm.c +8 -0
+             if (!strcmp(name, "k3-am68-sk-base-board"))
+                     return 0;
+     }
+
+     return -1;
+}
+#endif
+
  int board_late_init(void)
  {
      if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {

--
Thanking You
Neha Malcom Francis

Signature · 2 lines
With Regards
Sinthu Raja
#11 lore raw

Re: [PATCH V4 06/12] board: ti: j721s2: Add support for detecting multiple device trees

In reply to Sinthu Raja

On Wed, Jan 04, 2023 at 03:13:44PM +0530, Sinthu Raja wrote:

[snip]

board/ti/j721s2/evm.c static void setup_serial(void) · line 182

Quoted 8 lines
board/ti/j721s2/evm.c +8 -0
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	bool eeprom_read = board_ti_was_eeprom_read();
+
+	if (!eeprom_read || board_is_j721s2_som()) {
+		if (!strcmp(name, "k3-j721s2-common-proc-board"))
+			return 0;

What I'd like to see is a comment above this part noting that this is the safe default for the SoC.

Signature · 1 line
Tom
#12 lore raw

PATCH v4 7/12 arch: mach-k3: Update board specific API name to K3 generic API name

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Although the board_init_f API initialises the SoC, the API name is incorrectly specified and misleads the functionality. This file should only include k3-specific functionality. Change the API's name to something more K3-specific and separate the function to make it more modular.

---
 arch/arm/mach-k3/include/mach/sys_proto.h |  3 +++
 arch/arm/mach-k3/j721s2_init.c            | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
arch/arm/mach-k3/include/mach/sys_proto.h +3 -0
index 60287b261c..3d3d90d02d 100644
@@ -19,4 +19,7 @@ int fdt_disable_node(void *blob, char *node_path);
 bool soc_is_j721e(void);
 bool soc_is_j7200(void);
 
+void k3_spl_init(void);
+void k3_mem_init(void);
+bool check_rom_loaded_sysfw(void);
 #endif
arch/arm/mach-k3/j721s2_init.c +12 -1
index 0206b01d9e..09e55ed456 100644
@@ -93,7 +93,7 @@ static void store_boot_info_from_rom(void)
 	       sizeof(struct rom_extended_boot_data));
 }
 
-void board_init_f(ulong dummy)
+void k3_spl_init(void)
 {
 	struct udevice *dev;
 	int ret;
@@ -154,6 +154,17 @@ void board_init_f(ulong dummy)
 
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
+}
+
+bool check_rom_loaded_sysfw(void)
+{
+	return is_rom_loaded_sysfw(&bootdata);
+}
+
+void k3_mem_init(void)
+{
+	struct udevice *dev;
+	int ret;
 
 	if (IS_ENABLED(CONFIG_TARGET_J721S2_R5_EVM)) {
 		ret = uclass_get_device_by_name(UCLASS_MISC, "msmc", &dev);
Signature · 1 line
2.36.1
Reviewed-by on v4 7/12
#13 lore raw

Re: [PATCH V4 07/12] arch: mach-k3: Update board specific API name to K3 generic API name

Quoted 8 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Although the board_init_f API initialises the SoC, the API name is incorrectly specified and misleads the functionality. This file should only include k3-specific functionality. Change the API's name to something more K3-specific and separate the function to make it more modular.

Signature · 1 line
Tom
#14 lore raw

PATCH v4 8/12 board: ti: j721s2: Add board_init and support for selecting DT based on EEPROM

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Add the board_init_f API for SPL and run the platform-required SoC initialization.

Add the functionality for board name-based DTB selection from FIT within SPL. This will make it easier to utilise one defconfig for both the EVM and the SK.

---

Changes in V4:
=============
Address review comments:
- In align wih the macro conditional statement which missed it in the previous version

V3: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

 board/ti/j721s2/evm.c | 64 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
board/ti/j721s2/evm.c +64 -0
index a7c4082a7a..941b4bd8ae 100644
@@ -23,6 +23,7 @@
 #include <asm/arch/sys_proto.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
+#include <dm/root.h>
 
 #include "../common/board_detect.h"
 
@@ -202,3 +203,66 @@ int board_late_init(void)
 void spl_board_init(void)
 {
 }
+
+/* Support for the various EVM / SK families */
+#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
+void do_dt_magic(void)
+{
+	int ret, rescan, mmc_dev = -1;
+	static struct mmc *mmc;
+
+	do_board_detect();
+
+	/*
+	 * Board detection has been done.
+	 * Let us see if another dtb wouldn't be a better match
+	 * for our board
+	 */
+	if (IS_ENABLED(CONFIG_CPU_V7R)) {
+		ret = fdtdec_resetup(&rescan);
+		if (!ret && rescan) {
+			dm_uninit();
+			dm_init_and_scan(true);
+		}
+	}
+
+	/*
+	 * Because of multi DTB configuration, the MMC device has
+	 * to be re-initialized after reconfiguring FDT inorder to
+	 * boot from MMC. Do this when boot mode is MMC and ROM has
+	 * not loaded SYSFW.
+	 */
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_MMC1:
+		mmc_dev = 0;
+		break;
+	case BOOT_DEVICE_MMC2:
+	case BOOT_DEVICE_MMC2_2:
+		mmc_dev = 1;
+		break;
+	}
+
+	if (mmc_dev > 0 && !check_rom_loaded_sysfw()) {
+		ret = mmc_init_device(mmc_dev);
+		if (!ret) {
+			mmc = find_mmc_device(mmc_dev);
+			if (mmc) {
+				ret = mmc_init(mmc);
+				if (ret)
+					printf("mmc init failed with error: %d\n", ret);
+			}
+		}
+	}
+}
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+void board_init_f(ulong dummy)
+{
+	k3_spl_init();
+#if defined(CONFIG_SPL_OF_LIST) && defined(CONFIG_TI_I2C_BOARD_DETECT)
+	do_dt_magic();
+#endif
+	k3_mem_init();
+}
+#endif
Signature · 1 line
2.36.1
Reviewed-by on v4 8/12
#15 lore raw

Re: [PATCH V4 08/12] board: ti: j721s2: Add board_init and support for selecting DT based on EEPROM

Quoted 10 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Add the board_init_f API for SPL and run the platform-required SoC initialization.

Add the functionality for board name-based DTB selection from FIT within SPL. This will make it easier to utilise one defconfig for both the EVM and the SK.

Signature · 1 line
Tom
#16 lore raw

PATCH v4 9/12 arm: dts: Add initial support for AM68 Starter Kit System on Module

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

AM68 Starter Kit (SK) is a low cost, small form factor board designed for TI’s AM68 SoC. TI’s AM68 SoC comprises of dual core A72, high performance vision accelerators, hardware accelerators, latest C71x DSP, high bandwidth real-time IPs for capture and display. The SoC is power optimized to provide best in class performance for industrial applications.

AM68 SK supports the following interfaces:
* 16 GB LPDDR4 RAM
* x1 Gigabit Ethernet interface
* x1 USB 3.1 Type-C port
* x2 USB 3.1 Type-A ports
* x1 PCIe M.2 M Key
* 512 Mbit OSPI flash
* x2 CSI2 Camera interface (RPi and TI Camera connector)
* 40-pin Raspberry Pi GPIO header

SK's System on Module (SoM) contains the SoC, PMIC, DDR and OSPI flash. Therefore, add support for the components present on the SoM.

Schematics: https://www.ti.com/lit/zip/SPRR463
TRM: http://www.ti.com/lit/pdf/spruj28

---

Hi All,
The Kernel DTSI is under review and waiting to get merged.
Kernel Link: https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#mbfef0638ffc4ecfa71304014efc03131b2b925a9

 arch/arm/dts/k3-am68-sk-som.dtsi | 127 +++++++++++++++++++++++++++++++
 1 file changed, 127 insertions(+)
 create mode 100644 arch/arm/dts/k3-am68-sk-som.dtsi
arch/arm/dts/k3-am68-sk-som.dtsi new file +127 -0
new file mode 100644
index 0000000000..cb1c58fcd1
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+/dts-v1/;
+
+#include "k3-j721s2.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	memory@80000000 {
+		device_type = "memory";
+		/* 16 GB RAM */
+		reg = <0x00 0x80000000 0x00 0x80000000>,
+		      <0x08 0x80000000 0x03 0x80000000>;
+	};
+
+	/* Reserving memory regions still pending */
+	reserved_memory: reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		secure_ddr: optee@9e800000 {
+			reg = <0x00 0x9e800000 0x00 0x01800000>;
+			alignment = <0x1000>;
+			no-map;
+		};
+	};
+};
+
+&mailbox0_cluster0 {
+	status = "disabled";
+};
+
+&mailbox0_cluster1 {
+	status = "disabled";
+};
+
+&mailbox0_cluster2 {
+	status = "disabled";
+};
+
+&mailbox0_cluster3 {
+	status = "disabled";
+};
+
+&mailbox0_cluster4 {
+	status = "disabled";
+};
+
+&mailbox0_cluster5 {
+	status = "disabled";
+};
+
+&mailbox0_cluster6 {
+	status = "disabled";
+};
+
+&mailbox0_cluster7 {
+	status = "disabled";
+};
+
+&mailbox0_cluster8 {
+	status = "disabled";
+};
+
+&mailbox0_cluster9 {
+	status = "disabled";
+};
+
+&mailbox0_cluster10 {
+	status = "disabled";
+};
+
+&mailbox0_cluster11 {
+	status = "disabled";
+};
+
+&mailbox1_cluster0 {
+	status = "disabled";
+};
+
+&mailbox1_cluster1 {
+	status = "disabled";
+};
+
+&mailbox1_cluster2 {
+	status = "disabled";
+};
+
+&mailbox1_cluster3 {
+	status = "disabled";
+};
+
+&mailbox1_cluster4 {
+	status = "disabled";
+};
+
+&mailbox1_cluster5 {
+	status = "disabled";
+};
+
+&mailbox1_cluster6 {
+	status = "disabled";
+};
+
+&mailbox1_cluster7 {
+	status = "disabled";
+};
+
+&mailbox1_cluster8 {
+	status = "disabled";
+};
+
+&mailbox1_cluster9 {
+	status = "disabled";
+};
+
+&mailbox1_cluster10 {
+	status = "disabled";
+};
+
+&mailbox1_cluster11 {
+	status = "disabled";
+};
Signature · 1 line
2.36.1
#17 lore raw

PATCH v4 10/12 arm: dts: Add support for A72 specific AM68 Starter Kit Base Board

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

The SK architecture comprises of baseboard and a SOM board. The AM68 Starter Kit's baseboard contains most of the actual connectors, power supply etc. The System on Module (SoM) is plugged on to the base board. Therefore, add support for peripherals brought out in the base board.

Schematics: https://www.ti.com/lit/zip/SPRR463

---
 arch/arm/dts/Makefile                         |   3 +-
 .../arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 150 ++++++++
 arch/arm/dts/k3-am68-sk-base-board.dts        | 353 ++++++++++++++++++
 3 files changed, 505 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
 create mode 100644 arch/arm/dts/k3-am68-sk-base-board.dts
arch/arm/dts/Makefile +2 -1
index 43951a7731..6d49baaaa7 100644
@@ -1249,7 +1249,8 @@ dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \
 			      k3-j7200-r5-common-proc-board.dtb \
 			      k3-j721e-sk.dtb \
 			      k3-j721e-r5-sk.dtb
-dtb-$(CONFIG_SOC_K3_J721S2) += k3-j721s2-common-proc-board.dtb\
+dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-base-board.dtb\
+			       k3-j721s2-common-proc-board.dtb\
 			       k3-j721s2-r5-common-proc-board.dtb
 dtb-$(CONFIG_SOC_K3_AM642) += k3-am642-evm.dtb \
 			      k3-am642-r5-evm.dtb \
arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi new file +150 -0

150 lines not on this page · raw message

arch/arm/dts/k3-am68-sk-base-board.dts new file +353 -0

353 lines not on this page · raw message

Signature · 1 line
2.36.1
#18 lore raw

PATCH v4 11/12 arm: dts: k3-am68-sk: Add r5 specific dt support

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Add initial support for AM68 SK device tree that runs on R5.

---
 arch/arm/dts/Makefile                     |   1 +
 arch/arm/dts/k3-am68-sk-r5-base-board.dts | 194 ++++++++++++++++++++++
 2 files changed, 195 insertions(+)
 create mode 100644 arch/arm/dts/k3-am68-sk-r5-base-board.dts
arch/arm/dts/Makefile +1 -0
index 6d49baaaa7..be6e7b4e79 100644
@@ -1250,6 +1250,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \
 			      k3-j721e-sk.dtb \
 			      k3-j721e-r5-sk.dtb
 dtb-$(CONFIG_SOC_K3_J721S2) += k3-am68-sk-base-board.dtb\
+			       k3-am68-sk-r5-base-board.dtb\
 			       k3-j721s2-common-proc-board.dtb\
 			       k3-j721s2-r5-common-proc-board.dtb
 dtb-$(CONFIG_SOC_K3_AM642) += k3-am642-evm.dtb \
arch/arm/dts/k3-am68-sk-r5-base-board.dts new file +194 -0

194 lines not on this page · raw message

Signature · 1 line
2.36.1
#19 lore raw

PATCH v4 12/12 include: configs: Update env for selecting right dtb

In reply to Sinthu Raja

From: Sinthu Raja <[email protected]>

Now that single defconfig shall be used for booting J721S2 EVM and AM68 SK, the default device tree will not work for selecting dtb for kernel. Update the findfdt env to select right dtb based on board_name env variable.

---
 include/configs/j721s2_evm.h | 4 ++++
 1 file changed, 4 insertions(+)
include/configs/j721s2_evm.h +4 -0
index 932d7d3c8c..715f03048a 100644
@@ -32,6 +32,10 @@
 	"default_device_tree=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"	\
 	"findfdt="							\
 		"setenv name_fdt ${default_device_tree};"		\
+		"if test $board_name = j721s2; then "			\
+			"setenv name_fdt k3-j721s2-common-proc-board.dtb; fi;" \
+		"if test $board_name = am68-sk; then "			\
+			"setenv name_fdt k3-am68-sk-base-board.dtb; fi;"\
 		"setenv fdtfile ${name_fdt}\0"				\
 	"name_kern=Image\0"						\
 	"console=ttyS2,115200n8\0"					\
Signature · 1 line
2.36.1
Reviewed-by on v4 12/12
#20 lore raw

Re: [PATCH V4 12/12] include: configs: Update env for selecting right dtb

Quoted 8 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Now that single defconfig shall be used for booting J721S2 EVM and AM68 SK, the default device tree will not work for selecting dtb for kernel. Update the findfdt env to select right dtb based on board_name env variable.

But please note that the CFG_ENV_EXTRA_SETTINGS logic needs to move to text based environment files, sooner rather than later would be best.

Signature · 1 line
Tom
#21 lore raw

Re: [PATCH V4 12/12] include: configs: Update env for selecting right dtb

Quoted 10 lines · Tom Rini
Quoted 7 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Now that single defconfig shall be used for booting J721S2 EVM and AM68 SK, the default device tree will not work for selecting dtb for kernel. Update the findfdt env to select right dtb based on board_name env variable.

Quoted 6 lines
Quoted 1 line

But please note that the CFG_ENV_EXTRA_SETTINGS logic needs to move to text based environment files, sooner rather than later would be best.

Sure, Tom. We will work on this sooner. Thanks for the review.

Quoted 3 lines

--
Tom

Signature · 2 lines
With Regards
Sinthu Raja
#22 lore raw
In reply to Sinthu Raja
Quoted 7 lines · Sinthu Raja

From: Sinthu Raja <[email protected]>

Hi All,
This series of patch add initial support for AM68 starter kit. Design files can be referrred from https://www.ti.com/lit/zip/SPRR463

Quoted 6 lines

Refer below link to J721S2/AM68 Technical Reference Manual for further details:
http://www.ti.com/lit/pdf/spruj28

Link to kerenl patches:
https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#mff5847ea8cdef49337d224b7147f877bcc833aee

Tom,
Please let me know your comments on this series.

Quoted 64 lines

Changes in V4:
=============
Address review comments:
- In align with the macro conditional statement which missed it in the previous version

Changes in V3:
=============
Address review comments:
- Rework on DTB selection API clarity about mini-U-Boot vs EVM and family support as suggested.
* board: ti: j721s2: Add board_init and support for selecting DT based
on EEPROM

Changes in V2:
=============
Address review comments:
- Remove support for detecting multiple device trees using different DTB
- Remove board specific API from K3 generic file (arch/arm/mach-k3/j721s2_init.c) and moved to board specific file (board/ti/j721s2/evm.c).
* arch: mach-k3: Update board specific API name to K3 generic API name
* board: ti: j721s2: Add board_init and support for selecting DT based
on EEPROM
- Move board_is_xxx within CONFIG_TI_I2C_BOARD_DETECT block to maintain the "mini" U-Boot concept for this SoC.

V1: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
V2: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v3: https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/

Sinthu Raja (12):
configs: j721s2_evm_r5: Enable support for building multiple dtbs into
FIT
configs: j721s2_evm_a72: Enable support for building multiple dtbs
into FIT
configs: j721s2_evm: Enable configs to store env in MMC FAT partition
board: ti: j721s2: Add support to update board_name for am68-sk
board: ti: j721s2: Enable support for reading EEPROM at next alternate
address
board: ti: j721s2: Add support for detecting multiple device trees
arch: mach-k3: Update board specific API name to K3 generic API name
board: ti: j721s2: Add board_init and support for selecting DT based
on EEPROM
arm: dts: Add initial support for AM68 Starter Kit System on Module
arm: dts: Add support for A72 specific AM68 Starter Kit Base Board
arm: dts: k3-am68-sk: Add r5 specific dt support
include: configs: Update env for selecting right dtb

 arch/arm/dts/Makefile                         |   4 +-
 .../arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 150 ++++++++
 arch/arm/dts/k3-am68-sk-base-board.dts        | 353 ++++++++++++++++++
 arch/arm/dts/k3-am68-sk-r5-base-board.dts     | 194 ++++++++++
 arch/arm/dts/k3-am68-sk-som.dtsi              | 127 +++++++
 arch/arm/mach-k3/include/mach/sys_proto.h     |   3 +
 arch/arm/mach-k3/j721s2_init.c                |  13 +-
 board/ti/j721s2/evm.c                         | 118 +++++-
 configs/j721s2_evm_a72_defconfig              |   4 +-
 configs/j721s2_evm_r5_defconfig               |   4 +
 include/configs/j721s2_evm.h                  |   4 +
 11 files changed, 956 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi
 create mode 100644 arch/arm/dts/k3-am68-sk-base-board.dts
 create mode 100644 arch/arm/dts/k3-am68-sk-r5-base-board.dts
 create mode 100644 arch/arm/dts/k3-am68-sk-som.dtsi

--
2.36.1

Signature · 2 lines
With Regards
Sinthu Raja