-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
u-boot-iot2050: Add the support for the SM variant
The dts for the new SM variant is idential to the kernel. Since the introduction of the 4G DDR on SM variant, the memory size is now determined by the SEBoot and then passed to the u-boot via scratchpad board info. Also the fdt fixup logic is generalized. BTW a minor coding style change for the iot2050/board.c is hitchhiked. Signed-off-by: Chao Zeng <[email protected]> Signed-off-by: Li Hua Qian <[email protected]> Signed-off-by: Baocheng Su <[email protected]>
- Loading branch information
1 parent
5c7f6a6
commit 540493f
Showing
12 changed files
with
862 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Signed-off-by: Li Hua Qian <[email protected]> | |
1 file changed, 11 insertions(+) | ||
|
||
diff --git a/arch/arm/dts/k3-am65-iot2050-common.dtsi b/arch/arm/dts/k3-am65-iot2050-common.dtsi | ||
index 65da226847f..b6135b849f1 100644 | ||
index 65da226847f4..b6135b849f1a 100644 | ||
--- a/arch/arm/dts/k3-am65-iot2050-common.dtsi | ||
+++ b/arch/arm/dts/k3-am65-iot2050-common.dtsi | ||
@@ -64,6 +64,12 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ Signed-off-by: Jan Kiszka <[email protected]> | |
1 file changed, 6 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/tools/iot2050-sign-fw.sh b/tools/iot2050-sign-fw.sh | ||
index 6b426c854c2..75ffd560823 100755 | ||
index 6b426c854c20..75ffd560823c 100755 | ||
--- a/tools/iot2050-sign-fw.sh | ||
+++ b/tools/iot2050-sign-fw.sh | ||
@@ -5,6 +5,8 @@ if [ -z "$1" ]; then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Signed-off-by: Jan Kiszka <[email protected]> | |
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c | ||
index 15f5310c7bf..e35e55fb5de 100644 | ||
index 15f5310c7bf3..e35e55fb5de8 100644 | ||
--- a/board/siemens/iot2050/board.c | ||
+++ b/board/siemens/iot2050/board.c | ||
@@ -160,7 +160,7 @@ static bool board_is_sr1(void) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ Signed-off-by: Jan Kiszka <[email protected]> | |
1 file changed, 6 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c | ||
index e35e55fb5de..0b0686e2628 100644 | ||
index e35e55fb5de8..0b0686e2628b 100644 | ||
--- a/board/siemens/iot2050/board.c | ||
+++ b/board/siemens/iot2050/board.c | ||
@@ -155,19 +155,20 @@ static bool board_is_advanced(void) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ Reviewed-by: Heinrich Schuchardt <[email protected]> | |
1 file changed, 9 insertions(+) | ||
|
||
diff --git a/include/configs/iot2050.h b/include/configs/iot2050.h | ||
index 4968722d18f..94a9c767882 100644 | ||
index 4968722d18f6..94a9c7678825 100644 | ||
--- a/include/configs/iot2050.h | ||
+++ b/include/configs/iot2050.h | ||
@@ -15,6 +15,15 @@ | ||
|
25 changes: 25 additions & 0 deletions
25
recipes-bsp/u-boot/files/0006-board-siemens-iot2050-Fix-coding-style.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Baocheng Su <[email protected]> | ||
Date: Fri, 1 Dec 2023 19:43:28 +0800 | ||
Subject: [PATCH] board: siemens: iot2050: Fix coding style | ||
|
||
Add a space after the 'if' | ||
|
||
Signed-off-by: Baocheng Su <[email protected]> | ||
--- | ||
board/siemens/iot2050/board.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c | ||
index 0b0686e2628b..1fa71f8da6a4 100644 | ||
--- a/board/siemens/iot2050/board.c | ||
+++ b/board/siemens/iot2050/board.c | ||
@@ -220,7 +220,7 @@ void set_board_info_env(void) | ||
if (board_is_advanced()) { | ||
if (board_is_pg1()) | ||
fdtfile = "ti/k3-am6548-iot2050-advanced.dtb"; | ||
- else if(board_is_m2()) | ||
+ else if (board_is_m2()) | ||
fdtfile = "ti/k3-am6548-iot2050-advanced-m2.dtb"; | ||
else | ||
fdtfile = "ti/k3-am6548-iot2050-advanced-pg2.dtb"; |
51 changes: 51 additions & 0 deletions
51
recipes-bsp/u-boot/files/0007-board-siemens-iot2050-Control-pcie-power-for-all-var.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Baocheng Su <[email protected]> | ||
Date: Wed, 29 Nov 2023 23:01:48 +0800 | ||
Subject: [PATCH] board: siemens: iot2050: Control pcie power for all variants | ||
|
||
The power control pin of pcie interface not only works for M.2 interface | ||
but also for miniPCIE, so promote this logic to all variants to | ||
workaround the module hang issue. | ||
|
||
Signed-off-by: Baocheng Su <[email protected]> | ||
--- | ||
board/siemens/iot2050/board.c | 12 ++++++++---- | ||
1 file changed, 8 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c | ||
index 1fa71f8da6a4..b83d5f8669e8 100644 | ||
--- a/board/siemens/iot2050/board.c | ||
+++ b/board/siemens/iot2050/board.c | ||
@@ -185,6 +185,12 @@ static void remove_mmc1_target(void) | ||
free(boot_targets); | ||
} | ||
|
||
+static void enable_pcie_connector_power(void) | ||
+{ | ||
+ set_pinvalue("gpio@601000_17", "P3V3_PCIE_CON_EN", 1); | ||
+ udelay(4 * 100); | ||
+} | ||
+ | ||
void set_board_info_env(void) | ||
{ | ||
struct iot2050_info *info = IOT2050_INFO_DATA; | ||
@@ -288,10 +294,6 @@ static void m2_connector_setup(void) | ||
struct m2_config_pins config_pins; | ||
unsigned int n; | ||
|
||
- /* enable M.2 connector power */ | ||
- set_pinvalue("gpio@601000_17", "P3V3_M2_EN", 1); | ||
- udelay(4 * 100); | ||
- | ||
if (m2_manual_config < CONNECTOR_MODE_INVALID) { | ||
mode_info = " [manual mode]"; | ||
connector_mode = m2_manual_config; | ||
@@ -429,6 +431,8 @@ int board_late_init(void) | ||
/* change CTRL_MMR register to let serdes0 not output USB3.0 signals. */ | ||
writel(0x3, SERDES0_LANE_SELECT); | ||
|
||
+ enable_pcie_connector_power(); | ||
+ | ||
if (board_is_m2()) | ||
m2_connector_setup(); | ||
|
119 changes: 119 additions & 0 deletions
119
recipes-bsp/u-boot/files/0008-board-siemens-iot2050-Pass-DDR-size-from-FSBL.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Baocheng Su <[email protected]> | ||
Date: Wed, 29 Nov 2023 23:16:15 +0800 | ||
Subject: [PATCH] board: siemens: iot2050: Pass DDR size from FSBL | ||
|
||
Due to new DDR size introduction, the current logic of determining the | ||
DDR size is not able to get the correct size. | ||
|
||
Instead, the DDR size is determined by the FSBL(SEBOOT) then passed to | ||
u-boot through the scratchpad info. | ||
|
||
The SEBoot version must be >= D/V01.04.0x.0x to support this change. | ||
|
||
Also now for some variants, the DDR size may > 2GB, so borrow some code | ||
from the TI evm to iot2050 to support more than 2GB DDR. | ||
|
||
Signed-off-by: Baocheng Su <[email protected]> | ||
--- | ||
board/siemens/iot2050/board.c | 39 ++++++++++++++++++++++++++--------- | ||
doc/board/siemens/iot2050.rst | 5 +++++ | ||
include/configs/iot2050.h | 3 +++ | ||
3 files changed, 37 insertions(+), 10 deletions(-) | ||
|
||
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c | ||
index b83d5f8669e8..d6228b9bd26b 100644 | ||
--- a/board/siemens/iot2050/board.c | ||
+++ b/board/siemens/iot2050/board.c | ||
@@ -38,6 +38,8 @@ struct iot2050_info { | ||
u8 mac_addr_cnt; | ||
u8 mac_addr[8][ARP_HLEN]; | ||
char seboot_version[40 + 1]; | ||
+ u8 padding[3]; | ||
+ u32 ddr_size_mb; | ||
} __packed; | ||
|
||
/* | ||
@@ -341,25 +343,42 @@ int board_init(void) | ||
|
||
int dram_init(void) | ||
{ | ||
- if (board_is_advanced()) | ||
- gd->ram_size = SZ_2G; | ||
- else | ||
- gd->ram_size = SZ_1G; | ||
+ struct iot2050_info *info = IOT2050_INFO_DATA; | ||
+ gd->ram_size = ((phys_size_t)(info->ddr_size_mb)) << 20; | ||
|
||
return 0; | ||
} | ||
|
||
+ulong board_get_usable_ram_top(ulong total_size) | ||
+{ | ||
+ /* Limit RAM used by U-Boot to the DDR low region */ | ||
+ if (gd->ram_top > 0x100000000) | ||
+ return 0x100000000; | ||
+ | ||
+ return gd->ram_top; | ||
+} | ||
+ | ||
int dram_init_banksize(void) | ||
{ | ||
dram_init(); | ||
|
||
- /* Bank 0 declares the memory available in the DDR low region */ | ||
- gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE; | ||
- gd->bd->bi_dram[0].size = gd->ram_size; | ||
+ if (gd->ram_size > SZ_2G) { | ||
+ /* Bank 0 declares the memory available in the DDR low region */ | ||
+ gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE; | ||
+ gd->bd->bi_dram[0].size = SZ_2G; | ||
+ | ||
+ /* Bank 1 declares the memory available in the DDR high region */ | ||
+ gd->bd->bi_dram[1].start = CFG_SYS_SDRAM_BASE1; | ||
+ gd->bd->bi_dram[1].size = gd->ram_size - SZ_2G; | ||
+ } else { | ||
+ /* Bank 0 declares the memory available in the DDR low region */ | ||
+ gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE; | ||
+ gd->bd->bi_dram[0].size = gd->ram_size; | ||
|
||
- /* Bank 1 declares the memory available in the DDR high region */ | ||
- gd->bd->bi_dram[1].start = 0; | ||
- gd->bd->bi_dram[1].size = 0; | ||
+ /* Bank 1 declares the memory available in the DDR high region */ | ||
+ gd->bd->bi_dram[1].start = 0; | ||
+ gd->bd->bi_dram[1].size = 0; | ||
+ } | ||
|
||
return 0; | ||
} | ||
diff --git a/doc/board/siemens/iot2050.rst b/doc/board/siemens/iot2050.rst | ||
index ee3c5c958464..c6bb06750584 100644 | ||
--- a/doc/board/siemens/iot2050.rst | ||
+++ b/doc/board/siemens/iot2050.rst | ||
@@ -29,6 +29,11 @@ The following binaries from that source need to be present in the build folder: | ||
- seboot_pg1.bin | ||
- seboot_pg2.bin | ||
|
||
+Starting from SE-Boot D/V01.04.0x.0x, the DDR size is passed from the SE-Boot to | ||
+the u-boot, this is not compatible with the old version u-boot (<=2023.10) | ||
+anymore. Make sure to use the latest u-boot version, or version contains the | ||
+commit "board: siemens: iot2050: Pass DDR size from FSBL". | ||
+ | ||
When using the watchdog, a related firmware for the R5 core(s) is needed, e.g. | ||
https://github.com/siemens/k3-rti-wdt. The name and location of the image is | ||
configured via CONFIG_WDT_K3_RTI_FW_FILE. | ||
diff --git a/include/configs/iot2050.h b/include/configs/iot2050.h | ||
index 94a9c7678825..5e97ea0d9438 100644 | ||
--- a/include/configs/iot2050.h | ||
+++ b/include/configs/iot2050.h | ||
@@ -24,6 +24,9 @@ | ||
func(USB, usb, 2) | ||
#endif | ||
|
||
+/* DDR Configuration */ | ||
+#define CFG_SYS_SDRAM_BASE1 0x880000000 | ||
+ | ||
/* | ||
* This defines all MMC devices, even if the basic variant has no mmc1. | ||
* The non-supported device will be removed from the boot targets during |
111 changes: 111 additions & 0 deletions
111
recipes-bsp/u-boot/files/0009-board-siemens-iot2050-Generalize-the-fdt-fixup.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Baocheng Su <[email protected]> | ||
Date: Wed, 29 Nov 2023 23:29:12 +0800 | ||
Subject: [PATCH] board: siemens: iot2050: Generalize the fdt fixup | ||
|
||
The fdt fixup logic actually also applies to other possible variants who | ||
also have device tree overlays. So generalize this part by extracting | ||
it from the m.2 specific function and make it a standalone one. | ||
|
||
Since now we only have M.2 variant consuming the overlay, it may not | ||
have immediate effect for other variant, however this makes the future | ||
variant more easier to apply fdt fixups. | ||
|
||
Signed-off-by: Baocheng Su <[email protected]> | ||
--- | ||
board/siemens/iot2050/board.c | 32 +++++++++++++++++++------------- | ||
doc/board/siemens/iot2050.rst | 7 +++++++ | ||
2 files changed, 26 insertions(+), 13 deletions(-) | ||
|
||
diff --git a/board/siemens/iot2050/board.c b/board/siemens/iot2050/board.c | ||
index d6228b9bd26b..32f5280125c0 100644 | ||
--- a/board/siemens/iot2050/board.c | ||
+++ b/board/siemens/iot2050/board.c | ||
@@ -245,23 +245,14 @@ void set_board_info_env(void) | ||
env_save(); | ||
} | ||
|
||
-static void m2_overlay_prepare(void) | ||
+static void do_overlay_prepare(const char *overlay_path) | ||
{ | ||
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) | ||
- const char *overlay_path; | ||
void *overlay; | ||
u64 loadaddr; | ||
ofnode node; | ||
int ret; | ||
|
||
- if (connector_mode == BKEY_PCIEX2) | ||
- return; | ||
- | ||
- if (connector_mode == BKEY_PCIE_EKEY_PCIE) | ||
- overlay_path = "/fit-images/bkey-ekey-pcie-overlay"; | ||
- else | ||
- overlay_path = "/fit-images/bkey-usb3-overlay"; | ||
- | ||
node = ofnode_path(overlay_path); | ||
if (!ofnode_valid(node)) | ||
goto fit_error; | ||
@@ -288,6 +279,21 @@ fit_error: | ||
#endif | ||
} | ||
|
||
+static void m2_overlay_prepare(void) | ||
+{ | ||
+ const char *overlay_path; | ||
+ | ||
+ if (connector_mode == BKEY_PCIEX2) | ||
+ return; | ||
+ | ||
+ if (connector_mode == BKEY_PCIE_EKEY_PCIE) | ||
+ overlay_path = "/fit-images/bkey-ekey-pcie-overlay"; | ||
+ else | ||
+ overlay_path = "/fit-images/bkey-usb3-overlay"; | ||
+ | ||
+ do_overlay_prepare(overlay_path); | ||
+} | ||
+ | ||
static void m2_connector_setup(void) | ||
{ | ||
ulong m2_manual_config = env_get_ulong("m2_manual_config", 10, | ||
@@ -466,7 +472,7 @@ int board_late_init(void) | ||
} | ||
|
||
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) | ||
-static void m2_fdt_fixup(void *blob) | ||
+static void variants_fdt_fixup(void *blob) | ||
{ | ||
void *overlay_copy = NULL; | ||
void *fdt_copy = NULL; | ||
@@ -506,14 +512,14 @@ cleanup: | ||
return; | ||
|
||
fixup_error: | ||
- pr_err("Could not apply M.2 device tree overlay\n"); | ||
+ pr_err("Could not apply device tree overlay\n"); | ||
goto cleanup; | ||
} | ||
|
||
int ft_board_setup(void *blob, struct bd_info *bd) | ||
{ | ||
if (board_is_m2()) | ||
- m2_fdt_fixup(blob); | ||
+ variants_fdt_fixup(blob); | ||
|
||
return 0; | ||
} | ||
diff --git a/doc/board/siemens/iot2050.rst b/doc/board/siemens/iot2050.rst | ||
index c6bb06750584..21fb9d694ffe 100644 | ||
--- a/doc/board/siemens/iot2050.rst | ||
+++ b/doc/board/siemens/iot2050.rst | ||
@@ -167,3 +167,10 @@ the U-Boot environment variable "m2_manual_config" to select the mode manually: | ||
E-key: PCIe, USB 2.0 | ||
"2" - B-key: USB 3.0, | ||
E-key: PCIe, USB 2.0 | ||
+ | ||
+Device tree overlay fixup | ||
+------------------------- | ||
+ | ||
+In rare cases, you may need to add your own device tree overlay, please take use | ||
+of the **do_overlay_prepare** and **variants_fdt_fixup** from | ||
+**board/siemens/iot2050/board.c** to add overlay fixup. |
Oops, something went wrong.