Skip to contentSkip to conversation

QSPI: Falcon or single stage boot mode support

PATCH New Ravi Babu 7 participants 28 messages Apr 18, 2017 – Aug 29, 2017

Subsystems (3)
lore
Share & tools
lore

Ravi Babu

author
#0 lore raw

cover QSPI: Falcon or single stage boot mode support

This patch series fixes the Falcon or single stage boot mode for dra7xx platform.

FDT fixup is added to update the memory DT node based DDR configuration for specific platform.

Test verfied on dra7xx paltforms.

Lokesh Vutla (2):
spl: reorder the assignment of board info to global data
arch: arm: omap: Declare size of ddr very early

Ravi Babu (3):
qspi: dra7xx: enable qspi-boot for dra7x paltform
spl: fdt: support for fdt fixup for falcon boot
boot: fdt: fixup the memory dt nodes falcon boot

 arch/arm/lib/Makefile               |  1 +
 arch/arm/lib/bootm-fdt.c            |  7 ++++++-
 arch/arm/mach-omap2/am33xx/board.c  |  4 ++++
 arch/arm/mach-omap2/hwinit-common.c |  1 +
 common/Makefile                     |  2 +-
 common/spl/spl.c                    | 42 ++++++++++++++++++++++++++++++++++++-
 configs/dra7xx_evm_defconfig        |  6 ++++++
 7 files changed, 60 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/5 spl: reorder the assignment of board info to global data

From: Lokesh Vutla <[email protected]>

Move the assignment of board info to global data a bit early which is safe,
so that ram details can be used to enable caches.

---
 common/spl/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl.c +1 -1
index a3e73b8..f11b370 100644
@@ -322,6 +322,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	struct spl_image_info spl_image;
 
 	debug(">>spl:board_init_r()\n");
+	gd->bd = &bdata;
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
 	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
@@ -383,7 +384,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
  */
 void preloader_console_init(void)
 {
-	gd->bd = &bdata;
 	gd->baudrate = CONFIG_BAUDRATE;
 
 	serial_init();		/* serial communications setup */
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/5 spl: reorder the assignment of board info to global data

Hi Ravi,

Quoted 32 lines

From: Lokesh Vutla <[email protected]>

Move the assignment of board info to global data a bit early which is safe,
so that ram details can be used to enable caches.

---
 common/spl/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl.c +1 -1
index a3e73b8..f11b370 100644
@@ -322,6 +322,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	struct spl_image_info spl_image;
 
 	debug(">>spl:board_init_r()\n");
+	gd->bd = &bdata;
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
 	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
@@ -383,7 +384,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
  */
 void preloader_console_init(void)
 {
-	gd->bd = &bdata;
 	gd->baudrate = CONFIG_BAUDRATE;
 
 	serial_init();		/* serial communications setup
Quoted 1 line

*/

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#3 lore raw

PATCH 1/5 spl: reorder the assignment of board info to global data

In reply to Ravi Babu
Quoted 8 lines · Ravi Babu

From: Lokesh Vutla <[email protected]>

Move the assignment of board info to global data a bit early which is safe,
so that ram details can be used to enable caches.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170418/dac1e276/attachment.sig>
#4 lore raw

PATCH 1/5 spl: reorder the assignment of board info to global data

In reply to Ravi Babu
Quoted 10 lines · Ravi

From: Lokesh Vutla <[email protected]>

Move the assignment of board info to global data a bit early which is safe,
so that ram details can be used to enable caches.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/3fb0d834/attachment.sig>
#5 lore raw

PATCH 1/5 spl: reorder the assignment of board info to global data

In reply to Ravi Babu
Quoted 28 lines · Ravi

From: Lokesh Vutla <[email protected]>

Move the assignment of board info to global data a bit early which is safe,
so that ram details can be used to enable caches.

---
  common/spl/spl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl.c +1 -0
index a3e73b8..f11b370 100644
@@ -322,6 +322,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
  	struct spl_image_info spl_image;
 
  	debug(">>spl:board_init_r()\n");
+	gd->bd = &bdata;
 
  #if defined(CONFIG_SYS_SPL_MALLOC_START)
  	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 389

Quoted 7 lines
common/spl/spl.c +0 -1
@@ -383,7 +384,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
   */
  void preloader_console_init(void)
  {
-	gd->bd = &bdata;
  	gd->baudrate = CONFIG_BAUDRATE;
 
  	serial_init();		/* serial communications setup */

Guys,

I have a crash for SPL boot on at least two platforms. Git bisect points to this change. I have confirmed reverting this commit fixes my crash.

I don't quite understand the change. The commit message says to move the assignment a bit early. However, the preloader_console_init() is called during board_init_f() for many boards. This change actually moves it much later. Do I get it backward?

York

author
#6 lore raw

PATCH 2/5 arch: arm: omap: Declare size of ddr very early

In reply to Ravi Babu

From: Lokesh Vutla <[email protected]>

Declare the size of ddr very early in spl, so that this can be used to enable cache.

---
 arch/arm/mach-omap2/am33xx/board.c  | 4 ++++
 arch/arm/mach-omap2/hwinit-common.c | 1 +
 2 files changed, 5 insertions(+)
arch/arm/mach-omap2/am33xx/board.c +4 -0
index 2bfc864..568f36f 100644
@@ -327,6 +327,10 @@ void board_init_f(ulong dummy)
 	early_system_init();
 	board_early_init_f();
 	sdram_init();
+	/* dram_init must store complete ramsize in gd->ram_size */
+	gd->ram_size = get_ram_size(
+			(void *)CONFIG_SYS_SDRAM_BASE,
+			CONFIG_MAX_RAM_BANK_SIZE);
 }
 #endif
 
arch/arm/mach-omap2/hwinit-common.c +1 -0
index f317293..cac3274 100644
@@ -171,6 +171,7 @@ void board_init_f(ulong dummy)
 #endif
 	/* For regular u-boot sdram_init() is called from dram_init() */
 	sdram_init();
+	gd->ram_size = omap_sdram_size();
 }
 #endif
 
Signature · 1 line
1.9.1
#7 lore raw

PATCH 2/5 arch: arm: omap: Declare size of ddr very early

Hi Ravi,

Quoted 17 lines

From: Lokesh Vutla <[email protected]>

Declare the size of ddr very early in spl, so that this can be used to enable cache.

---
 arch/arm/mach-omap2/am33xx/board.c  | 4 ++++
 arch/arm/mach-omap2/hwinit-common.c | 1 +
 2 files changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/am33xx/board.c index 2bfc864..568f36f 100644

arch/arm/mach-omap2/am33xx/board.c void board_init_f(ulong dummy) · line 333

Quoted 7 lines
arch/arm/mach-omap2/am33xx/board.c +4 -0
@@ -327,6 +327,10 @@ void board_init_f(ulong dummy)
 	early_system_init();
 	board_early_init_f();
 	sdram_init();
+	/* dram_init must store complete ramsize in gd->ram_size */
+	gd->ram_size = get_ram_size(
+			(void *)CONFIG_SYS_SDRAM_BASE,
+			CONFIG_MAX_RAM_BANK_SIZE);

The above call is a bit strange, since the sdram_init() function sets the DDR (EMIF) controller to use the whole SDRAM available.

Why one cannot take this info directly from EMIF controller?

Quoted 8 lines
arch/arm/mach-omap2/am33xx/board.c +0 -0
 }
 #endif
 
(quoted diff) +0 -0

b/arch/arm/mach-omap2/hwinit-common.c index f317293..cac3274 100644

arch/arm/mach-omap2/hwinit-common.c void board_init_f(ulong dummy) · line 177

Quoted 7 lines
arch/arm/mach-omap2/hwinit-common.c +1 -0
@@ -171,6 +171,7 @@ void board_init_f(ulong dummy)
 #endif
 	/* For regular u-boot sdram_init() is called from
 dram_init() */ sdram_init();
+	gd->ram_size = omap_sdram_size();
 }
 #endif
 

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#8 lore raw

PATCH 2/5 arch: arm: omap: Declare size of ddr very early

Hi

Quoted 15 lines

arch/arm/mach-omap2/am33xx/board.c void board_init_f(ulong dummy) · line 333

Quoted 12 lines
(quoted diff) +0 -0

b/arch/arm/mach-omap2/am33xx/board.c index 2bfc864..568f36f 100644

arch/arm/mach-omap2/am33xx/board.c +4 -0
@@ -327,6 +327,10 @@ void board_init_f(ulong dummy)
 	early_system_init();
 	board_early_init_f();
 	sdram_init();
+	/* dram_init must store complete ramsize in gd->ram_size */
+	gd->ram_size = get_ram_size(
+			(void *)CONFIG_SYS_SDRAM_BASE,
+			CONFIG_MAX_RAM_BANK_SIZE);

The above call is a bit strange, since the sdram_init() function sets the DDR (EMIF) controller to use the whole SDRAM available.

Quoted 1 line

Why one cannot take this info directly from EMIF controller?

Lokesh, Can you comment for am335x ?

Regards
Ravi

#9 lore raw

PATCH 2/5 arch: arm: omap: Declare size of ddr very early

In reply to Lukasz Majewski
Quoted 30 lines · Lukasz Majewski

Hi Ravi,

Quoted 17 lines

From: Lokesh Vutla <[email protected]>

Declare the size of ddr very early in spl, so that this can be used to enable cache.

---
 arch/arm/mach-omap2/am33xx/board.c  | 4 ++++
 arch/arm/mach-omap2/hwinit-common.c | 1 +
 2 files changed, 5 insertions(+)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/am33xx/board.c index 2bfc864..568f36f 100644

arch/arm/mach-omap2/am33xx/board.c void board_init_f(ulong dummy) · line 333

Quoted 7 lines
arch/arm/mach-omap2/am33xx/board.c +4 -0
@@ -327,6 +327,10 @@ void board_init_f(ulong dummy)
 	early_system_init();
 	board_early_init_f();
 	sdram_init();
+	/* dram_init must store complete ramsize in gd->ram_size */
+	gd->ram_size = get_ram_size(
+			(void *)CONFIG_SYS_SDRAM_BASE,
+			CONFIG_MAX_RAM_BANK_SIZE);

The above call is a bit strange, since the sdram_init() function sets the DDR (EMIF) controller to use the whole SDRAM available.

Quoted 1 line

Why one cannot take this info directly from EMIF controller?

I guess you are talking about calling omap_sdram_size() which uses DMM to determine the DDR mapped sections. There is no DMM for amx3xx SoCs. Also get_ram_size() checks memory range for valid RAM. A simple memory test determines the actually available RAM size between addresses base' and base + maxsize' and widely being used by entire U-Boot.

Thanks and regards,
Lokesh

#10 lore raw

PATCH 2/5 arch: arm: omap: Declare size of ddr very early

In reply to Ravi Babu
Quoted 7 lines · Ravi

From: Lokesh Vutla <[email protected]>

Declare the size of ddr very early in spl, so that this can be used to enable cache.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/b4d1ad56/attachment.sig>
author
#11 lore raw

PATCH 3/5 qspi: dra7xx: enable qspi-boot for dra7x paltform

In reply to Ravi Babu

Enables qspi boot configuration for dra7xx platform.

---
 configs/dra7xx_evm_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
configs/dra7xx_evm_defconfig +6 -0
index 42f87b3..c510146 100644
@@ -59,6 +59,12 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm"
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_OF_TRANSLATE=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
Signature · 1 line
1.9.1
#12 lore raw

PATCH 3/5 qspi: dra7xx: enable qspi-boot for dra7x paltform

Hi Ravi,

Quoted 14 lines

Enables qspi boot configuration for dra7xx platform.

---
 configs/dra7xx_evm_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/configs/dra7xx_evm_defconfig index 42f87b3..c510146 100644

configs/dra7xx_evm_defconfig +0 -0
@@ -59,6 +59,12 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm"
 CONFIG_DM=y

configs/dra7xx_evm_defconfig CONFIG_SPL_OF_CONTROL=y · line 70

Quoted 10 lines
configs/dra7xx_evm_defconfig +6 -0
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_REGMAP=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_OF_TRANSLATE=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#13 lore raw

PATCH 3/5 qspi: dra7xx: enable qspi-boot for dra7x paltform

In reply to Ravi Babu
Quoted 4 lines · Ravi

Enables qspi boot configuration for dra7xx platform.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/5ad6cf64/attachment.sig>
author
#14 lore raw

PATCH 4/5 spl: fdt: support for fdt fixup for falcon boot

In reply to Ravi Babu

Adding support for fdt fixup to update the memory node in device tree for falcon boot.

This is needed for single stage or falcon bootmode, to pass memory configuration to kernel through DT memory node.

---
 arch/arm/lib/Makefile    | 1 +
 arch/arm/lib/bootm-fdt.c | 7 ++++++-
 common/Makefile          | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/lib/Makefile +1 -0
index 6e96cfb..53d4ed2 100644
@@ -33,6 +33,7 @@ obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 else
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
+obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 endif
 obj-$(CONFIG_$(SPL_)USE_ARCH_MEMSET) += memset.o
 obj-$(CONFIG_$(SPL_)USE_ARCH_MEMCPY) += memcpy.o
arch/arm/lib/bootm-fdt.c +6 -1
index d84789c..eaa817b 100644
@@ -27,8 +27,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int arch_fixup_fdt(void *blob)
 {
+	int ret = 0;
+#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT)
 	bd_t *bd = gd->bd;
-	int bank, ret;
+	int bank;
 	u64 start[CONFIG_NR_DRAM_BANKS];
 	u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -42,9 +44,11 @@ int arch_fixup_fdt(void *blob)
 #endif
 	}
 
+#ifdef CONFIG_OF_LIBFDT
 	ret = fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
 	if (ret)
 		return ret;
+#endif
 
 #ifdef CONFIG_ARMV8_SPIN_TABLE
 	ret = spin_table_update_dt(blob);
@@ -58,6 +62,7 @@ int arch_fixup_fdt(void *blob)
 	if (ret)
 		return ret;
 #endif
+#endif
 
 	return 0;
 }
common/Makefile +1 -1
index 86225f1..bcd2486 100644
@@ -95,7 +95,7 @@ obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
-obj-$(CONFIG_SPL_OF_TRANSLATE) += fdt_support.o
+obj-$(CONFIG_SPL_OF_LIBFDT) += fdt_support.o
 ifdef CONFIG_SPL_USB_HOST_SUPPORT
 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
Signature · 1 line
1.9.1
#15 lore raw

PATCH 4/5 spl: fdt: support for fdt fixup for falcon boot

Hi Ravi,

Quoted 67 lines

Adding support for fdt fixup to update the memory node in device tree for falcon boot.

This is needed for single stage or falcon bootmode, to pass memory configuration to kernel through DT memory node.

---
 arch/arm/lib/Makefile    | 1 +
 arch/arm/lib/bootm-fdt.c | 7 ++++++-
 common/Makefile          | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/lib/Makefile +1 -0
index 6e96cfb..53d4ed2 100644
@@ -33,6 +33,7 @@ obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
 else
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
+obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o
 endif
 obj-$(CONFIG_$(SPL_)USE_ARCH_MEMSET) += memset.o
 obj-$(CONFIG_$(SPL_)USE_ARCH_MEMCPY) += memcpy.o
arch/arm/lib/bootm-fdt.c +6 -1
index d84789c..eaa817b 100644
@@ -27,8 +27,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int arch_fixup_fdt(void *blob)
 {
+	int ret = 0;
+#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT)
 	bd_t *bd = gd->bd;
-	int bank, ret;
+	int bank;
 	u64 start[CONFIG_NR_DRAM_BANKS];
 	u64 size[CONFIG_NR_DRAM_BANKS];
 
@@ -42,9 +44,11 @@ int arch_fixup_fdt(void *blob)
 #endif
 	}
 
+#ifdef CONFIG_OF_LIBFDT
 	ret = fdt_fixup_memory_banks(blob, start, size,
 CONFIG_NR_DRAM_BANKS); if (ret)
 		return ret;
+#endif
 
 #ifdef CONFIG_ARMV8_SPIN_TABLE
 	ret = spin_table_update_dt(blob);
@@ -58,6 +62,7 @@ int arch_fixup_fdt(void *blob)
 	if (ret)
 		return ret;
 #endif
+#endif
 
 	return 0;
 }
common/Makefile +0 -0
index 86225f1..bcd2486 100644

common/Makefile obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o · line 101

Quoted 8 lines
common/Makefile +1 -1
@@ -95,7 +95,7 @@ obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o
 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
-obj-$(CONFIG_SPL_OF_TRANSLATE) += fdt_support.o
+obj-$(CONFIG_SPL_OF_LIBFDT) += fdt_support.o
 ifdef CONFIG_SPL_USB_HOST_SUPPORT
 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
 obj-$(CONFIG_USB_STORAGE) += usb_storage.o

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#16 lore raw

PATCH 4/5 spl: fdt: support for fdt fixup for falcon boot

In reply to Ravi Babu
Quoted 9 lines · Ravi

Adding support for fdt fixup to update the memory node in device tree for falcon boot.

This is needed for single stage or falcon bootmode, to pass memory configuration to kernel through DT memory node.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/63c967b8/attachment.sig>
author
#17 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

In reply to Ravi Babu

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
 common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
common/spl/spl.c +40 -0
index f11b370..b9b1331 100644
@@ -17,6 +17,7 @@
 #include <malloc.h>
 #include <dm/root.h>
 #include <linux/compiler.h>
+#include <fdt_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -56,6 +57,14 @@ __weak int spl_start_uboot(void)
 	return 1;
 }
 
+/* weak default platform specific function to initialize
+ * dram banks
+ */
+__weak int dram_init_banksize(void)
+{
+	return 0;
+}
+
 /*
  * Weak default function for arch specific zImage check. Return zero
  * and fill start and end address if image is recognized.
@@ -66,6 +75,33 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end)
 }
 #endif
 
+void spl_fixup_fdt(void)
+{
+#if defined(CONFIG_SPL_OF_LIBFDT) && defined(CONFIG_SYS_SPL_ARGS_ADDR)
+	void *fdt_blob = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+	int err;
+
+	err = fdt_check_header(fdt_blob);
+	if (err < 0) {
+		printf("fdt_root: %s\n", fdt_strerror(err));
+		return;
+	}
+
+	/* fixup the memory dt node */
+	err = fdt_shrink_to_minimum(fdt_blob, 0);
+	if (err == 0) {
+		printf("spl: fdt_shrink_to_minimum err - %d\n", err);
+		return;
+	}
+
+	err = arch_fixup_fdt(fdt_blob);
+	if (err) {
+		printf("spl: arch_fixup_fdt err - %d\n", err);
+		return;
+	}
+#endif
+}
+
 /*
  * Weak default function for board specific cleanup/preparation before
  * Linux boot. Some boards/platforms might not need it, so just provide
@@ -323,6 +359,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 
 	debug(">>spl:board_init_r()\n");
 	gd->bd = &bdata;
+#ifdef CONFIG_SPL_OS_BOOT
+	dram_init_banksize();
+#endif
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
 	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
@@ -361,6 +400,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #ifdef CONFIG_SPL_OS_BOOT
 	case IH_OS_LINUX:
 		debug("Jumping to Linux\n");
+		spl_fixup_fdt();
 		spl_board_prepare_for_linux();
 		jump_to_image_linux(&spl_image,
 				    (void *)CONFIG_SYS_SPL_ARGS_ADDR);
Signature · 1 line
1.9.1
#18 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Hi Ravi,

Quoted 75 lines

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
 common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
common/spl/spl.c +36 -0
index f11b370..b9b1331 100644
@@ -17,6 +17,7 @@
 #include <malloc.h>
 #include <dm/root.h>
 #include <linux/compiler.h>
+#include <fdt_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -56,6 +57,14 @@ __weak int spl_start_uboot(void)
 	return 1;
 }
 
+/* weak default platform specific function to initialize
+ * dram banks
+ */
+__weak int dram_init_banksize(void)
+{
+	return 0;
+}
+
 /*
  * Weak default function for arch specific zImage check. Return zero
  * and fill start and end address if image is recognized.
@@ -66,6 +75,33 @@ int __weak bootz_setup(ulong image, ulong *start,
 ulong *end) }
 #endif
 
+void spl_fixup_fdt(void)
+{
+#if defined(CONFIG_SPL_OF_LIBFDT) &&
 defined(CONFIG_SYS_SPL_ARGS_ADDR)
+	void *fdt_blob = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+	int err;
+
+	err = fdt_check_header(fdt_blob);
+	if (err < 0) {
+		printf("fdt_root: %s\n", fdt_strerror(err));
+		return;
+	}
+
+	/* fixup the memory dt node */
+	err = fdt_shrink_to_minimum(fdt_blob, 0);
+	if (err == 0) {
+		printf("spl: fdt_shrink_to_minimum err - %d\n", err);
+		return;
+	}
+
+	err = arch_fixup_fdt(fdt_blob);
+	if (err) {
+		printf("spl: arch_fixup_fdt err - %d\n", err);
+		return;
+	}
+#endif
+}
+
 /*
  * Weak default function for board specific cleanup/preparation

before
* Linux boot. Some boards/platforms might not need it, so just
provide @@ -323,6 +359,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 363

Quoted 4 lines
common/spl/spl.c +2 -0
 	debug(">>spl:board_init_r()\n");
 	gd->bd = &bdata;
+#ifdef CONFIG_SPL_OS_BOOT
+	dram_init_banksize();

What is the purpose of this function? In this point the SDRAM should be already configured.

In patch 2/5 you already configured TI's specific "board_init_f" to add some memory related information to gd struct.

Quoted 12 lines
common/spl/spl.c +2 -0
+#endif
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
 	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
@@ -361,6 +400,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #ifdef CONFIG_SPL_OS_BOOT
 	case IH_OS_LINUX:
 		debug("Jumping to Linux\n");
+		spl_fixup_fdt();
 		spl_board_prepare_for_linux();
 		jump_to_image_linux(&spl_image,
 				    (void
Quoted 1 line

*)CONFIG_SYS_SPL_ARGS_ADDR);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#19 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Hi Lukasz

Quoted 5 lines
Quoted 5 lines

/*
* Weak default function for board specific cleanup/preparation
before
* Linux boot. Some boards/platforms might not need it, so just
provide @@ -323,6 +359,9 @@ void board_init_r(gd_t *dummy1, ulong

Quoted 8 lines

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 363

Quoted 5 lines

dummy2)

common/spl/spl.c +2 -0
 	debug(">>spl:board_init_r()\n");
 	gd->bd = &bdata;
+#ifdef CONFIG_SPL_OS_BOOT
+	dram_init_banksize();

What is the purpose of this function? In this point the SDRAM should be already configured.

Lokesh can comment more on this.

AFAIK, the dram_init_bankszie() is platform specific function to populate the dram banks (start address & size). For dra7xx its defined in board/ti/dra7xx/evm.c.

Quoted 1 line

In patch 2/5 you already configured TI's specific "board_init_f" to add some memory related information to gd struct.

I think board_init_f() is for u-boot right ?

Regards
Ravi

#20 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 76 lines · Lukasz Majewski

Hi Ravi,

Quoted 74 lines

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
 common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
common/spl/spl.c +36 -0
index f11b370..b9b1331 100644
@@ -17,6 +17,7 @@
 #include <malloc.h>
 #include <dm/root.h>
 #include <linux/compiler.h>
+#include <fdt_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -56,6 +57,14 @@ __weak int spl_start_uboot(void)
 	return 1;
 }
 
+/* weak default platform specific function to initialize
+ * dram banks
+ */
+__weak int dram_init_banksize(void)
+{
+	return 0;
+}
+
 /*
  * Weak default function for arch specific zImage check. Return zero
  * and fill start and end address if image is recognized.
@@ -66,6 +75,33 @@ int __weak bootz_setup(ulong image, ulong *start,
 ulong *end) }
 #endif
 
+void spl_fixup_fdt(void)
+{
+#if defined(CONFIG_SPL_OF_LIBFDT) &&
 defined(CONFIG_SYS_SPL_ARGS_ADDR)
+	void *fdt_blob = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
+	int err;
+
+	err = fdt_check_header(fdt_blob);
+	if (err < 0) {
+		printf("fdt_root: %s\n", fdt_strerror(err));
+		return;
+	}
+
+	/* fixup the memory dt node */
+	err = fdt_shrink_to_minimum(fdt_blob, 0);
+	if (err == 0) {
+		printf("spl: fdt_shrink_to_minimum err - %d\n", err);
+		return;
+	}
+
+	err = arch_fixup_fdt(fdt_blob);
+	if (err) {
+		printf("spl: arch_fixup_fdt err - %d\n", err);
+		return;
+	}
+#endif
+}
+
 /*
  * Weak default function for board specific cleanup/preparation

before
* Linux boot. Some boards/platforms might not need it, so just
provide @@ -323,6 +359,9 @@ void board_init_r(gd_t *dummy1, ulong

Quoted 8 lines

common/spl/spl.c void board_init_r(gd_t *dummy1, ulong dummy2) · line 363

Quoted 5 lines

dummy2)

common/spl/spl.c +2 -0
 	debug(">>spl:board_init_r()\n");
 	gd->bd = &bdata;
+#ifdef CONFIG_SPL_OS_BOOT
+	dram_init_banksize();

What is the purpose of this function? In this point the SDRAM should be already configured.

So dram_init_banksize() initializes each base address and size of each bank. Before jumping to kernel, these values will be used to update memory nodes in DT(done by arch_fixup_fdt()). This is how it is being done in U-boot as well.

Thanks and regards,
Lokesh

Quoted 36 lines

In patch 2/5 you already configured TI's specific "board_init_f" to add some memory related information to gd struct.

Quoted 12 lines
common/spl/spl.c +2 -0
+#endif
 
 #if defined(CONFIG_SYS_SPL_MALLOC_START)
 	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
@@ -361,6 +400,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #ifdef CONFIG_SPL_OS_BOOT
 	case IH_OS_LINUX:
 		debug("Jumping to Linux\n");
+		spl_fixup_fdt();
 		spl_board_prepare_for_linux();
 		jump_to_image_linux(&spl_image,
 				    (void
Quoted 1 line

*)CONFIG_SYS_SPL_ARGS_ADDR);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#21 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

In reply to Ravi Babu
Quoted 6 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/24ebe652/attachment.sig>
#22 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

In reply to Ravi Babu
Quoted 9 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
  common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
  1 file changed, 40 insertions(+)

Clearly I am late for this thread. I only notice this change when I try to merge my FIT improvement for falcon boot.

Why do we need to fixup the device tree for falcon boot at all? The device tree is static, saved as argument when exporting it, isn't it? As far as the normal boot fixes up the device tree, the exported device tree is correct.

York

#23 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Quoted 11 lines · York Sun
Quoted 9 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
  common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
  1 file changed, 40 insertions(+)
Quoted 7 lines

Clearly I am late for this thread. I only notice this change when I try to merge my FIT improvement for falcon boot.

Why do we need to fixup the device tree for falcon boot at all? The device tree is static, saved as argument when exporting it, isn't it? As far as the normal boot fixes up the device tree, the exported device tree is correct.

So, the further argument here is that if you have to edit the dts to include a valid amount of memory so that the dtb the kernel spits out is useful in falcon mode, it's not at all useful in development.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170802/850ddcdc/attachment.sig>
#24 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Quoted 15 lines · Tom Rini
Quoted 14 lines · York Sun
Quoted 9 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
  common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
  1 file changed, 40 insertions(+)

Clearly I am late for this thread. I only notice this change when I try to merge my FIT improvement for falcon boot.

Quoted 8 lines
Quoted 4 lines

Why do we need to fixup the device tree for falcon boot at all? The device tree is static, saved as argument when exporting it, isn't it? As far as the normal boot fixes up the device tree, the exported device tree is correct.

So, the further argument here is that if you have to edit the dts to include a valid amount of memory so that the dtb the kernel spits out is useful in falcon mode, it's not at all useful in development.

Anyone noticed! this change is breaking falcon mode (tried in i.MX6 and rk3288) even if we forcibly disable CONFIG_SPL_OF_LIBFDT the SPL need to revert back to use SPL_OF_PLATDATA.

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#25 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Quoted 21 lines · Jagan Teki
Quoted 20 lines · Tom Rini
Quoted 18 lines · York Sun
Quoted 9 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
   common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
   1 file changed, 40 insertions(+)

Clearly I am late for this thread. I only notice this change when I try to merge my FIT improvement for falcon boot.

Why do we need to fixup the device tree for falcon boot at all? The device tree is static, saved as argument when exporting it, isn't it? As far as the normal boot fixes up the device tree, the exported device tree is correct.

Quoted 8 lines
Quoted 3 lines

So, the further argument here is that if you have to edit the dts to include a valid amount of memory so that the dtb the kernel spits out is useful in falcon mode, it's not at all useful in development.

Anyone noticed! this change is breaking falcon mode (tried in i.MX6 and rk3288) even if we forcibly disable CONFIG_SPL_OF_LIBFDT the SPL need to revert back to use SPL_OF_PLATDATA.

It broke falcon boot for ls1043ardb and ls1043ardb (and probably all my ARMv8 platforms) due to the way we reserve secure memory. I have added a patch (not upstreamed yet) to prevent dram_init_banksize() to run twice for my boards.

York

#26 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Quoted 31 lines · York Sun
Quoted 21 lines · Jagan Teki
Quoted 20 lines · Tom Rini
Quoted 18 lines · York Sun
Quoted 9 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
   common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
   1 file changed, 40 insertions(+)

Clearly I am late for this thread. I only notice this change when I try to merge my FIT improvement for falcon boot.

Why do we need to fixup the device tree for falcon boot at all? The device tree is static, saved as argument when exporting it, isn't it? As far as the normal boot fixes up the device tree, the exported device tree is correct.

Quoted 8 lines
Quoted 3 lines

So, the further argument here is that if you have to edit the dts to include a valid amount of memory so that the dtb the kernel spits out is useful in falcon mode, it's not at all useful in development.

Anyone noticed! this change is breaking falcon mode (tried in i.MX6 and rk3288) even if we forcibly disable CONFIG_SPL_OF_LIBFDT the SPL need to revert back to use SPL_OF_PLATDATA.

Quoted 4 lines

It broke falcon boot for ls1043ardb and ls1043ardb (and probably all my ARMv8 platforms) due to the way we reserve secure memory. I have added a patch (not upstreamed yet) to prevent dram_init_banksize() to run twice for my boards.

In-fact I too send patches for dram_init_banksize addition on i.MX6 and rk3288 for fixing falcon, wonder why we need to add explicit function here just to prevent DDR re-config or something similar. I think this spl_fixup_fdt should have board or soc specific routine.?

thanks!

Signature · 4 lines
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
#27 lore raw

PATCH 5/5 boot: fdt: fixup the memory dt nodes falcon boot

Quoted 37 lines · Jagan Teki
Quoted 31 lines · York Sun
Quoted 21 lines · Jagan Teki
Quoted 20 lines · Tom Rini
Quoted 18 lines · York Sun
Quoted 9 lines · Ravi

In single stage bootmode or falcon boot mode,
the SPL shall update the memory dt nodes
spl_fixup_fdt() based on DDR configuration for
specific platform.

---
    common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
    1 file changed, 40 insertions(+)

Clearly I am late for this thread. I only notice this change when I try to merge my FIT improvement for falcon boot.

Why do we need to fixup the device tree for falcon boot at all? The device tree is static, saved as argument when exporting it, isn't it? As far as the normal boot fixes up the device tree, the exported device tree is correct.

Quoted 8 lines
Quoted 3 lines

So, the further argument here is that if you have to edit the dts to include a valid amount of memory so that the dtb the kernel spits out is useful in falcon mode, it's not at all useful in development.

Anyone noticed! this change is breaking falcon mode (tried in i.MX6 and rk3288) even if we forcibly disable CONFIG_SPL_OF_LIBFDT the SPL need to revert back to use SPL_OF_PLATDATA.

Quoted 4 lines

It broke falcon boot for ls1043ardb and ls1043ardb (and probably all my ARMv8 platforms) due to the way we reserve secure memory. I have added a patch (not upstreamed yet) to prevent dram_init_banksize() to run twice for my boards.

Quoted 4 lines

In-fact I too send patches for dram_init_banksize addition on i.MX6 and rk3288 for fixing falcon, wonder why we need to add explicit function here just to prevent DDR re-config or something similar. I think this spl_fixup_fdt should have board or soc specific routine.?

I would prefer to call board/soc routine.

York