All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/6] spl: add xip booting support
@ 2017-05-18 18:49 Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 1/6] stm32f7: remove duplicate configs Vikas Manocha
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

This patchset adds support for XIP (execute in place) of U-Boot or kernel image
and enables it for stm32f7. 

Vikas Manocha (6):
  stm32f7: remove duplicate configs
  stm32: stm32f7: add spl build support
  SPL: Add XIP booting support
  serial: stm32f7: disable overrun
  spl: stm32f7: add kernel boot support
  spl: stm32f7: configure for xip booting

 arch/arm/include/asm/spl.h                 |  1 +
 arch/arm/mach-stm32/Kconfig                |  1 +
 arch/arm/mach-stm32/stm32f7/Kconfig        | 24 ++++++++++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 36 +++++++++++++++++++++++++++++-
 common/spl/Kconfig                         |  9 ++++++++
 common/spl/Makefile                        |  1 +
 common/spl/spl_xip.c                       | 31 +++++++++++++++++++++++++
 configs/stm32f746-disco_defconfig          |  5 -----
 drivers/serial/serial_stm32x7.c            |  3 +++
 drivers/serial/serial_stm32x7.h            |  2 ++
 include/configs/stm32f746-disco.h          | 31 ++++++++++++++++++++++---
 11 files changed, 135 insertions(+), 9 deletions(-)
 create mode 100644 common/spl/spl_xip.c

-- 
1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 1/6] stm32f7: remove duplicate configs
  2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
@ 2017-05-18 18:49 ` Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 2/6] stm32: stm32f7: add spl build support Vikas Manocha
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 configs/stm32f746-disco_defconfig | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/configs/stm32f746-disco_defconfig b/configs/stm32f746-disco_defconfig
index 4322aad..a334d50 100644
--- a/configs/stm32f746-disco_defconfig
+++ b/configs/stm32f746-disco_defconfig
@@ -44,10 +44,6 @@ CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER is not set
-CONFIG_CLK=y
-CONFIG_PINCTRL=y
-# CONFIG_PINCTRL_FULL is not set
-CONFIG_PINCTRL_STM32=y
 CONFIG_RAM=y
 CONFIG_STM32_SDRAM=y
 CONFIG_DM_GPIO=y
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 2/6] stm32: stm32f7: add spl build support
  2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 1/6] stm32f7: remove duplicate configs Vikas Manocha
@ 2017-05-18 18:49 ` Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 3/6] SPL: Add XIP booting support Vikas Manocha
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

This commit supports booting from stm32 internal nor flash. spl U-Boot
initializes the sdram memory, copies next image (e.g. standard U-Boot)
to sdram & then jumps to entry point.

Here are the flash memory addresses for U-Boot-spl & standard U-Boot:
	- spl U-Boot		: 0x0800_0000
	- standard U-Boot	: 0x0800_8000

To compile u-boot without spl: Remove SUPPORT_SPL configuration
(arch/arm/mach-stm32/Kconfig)

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 arch/arm/mach-stm32/Kconfig                |  1 +
 arch/arm/mach-stm32/stm32f7/Kconfig        | 22 ++++++++++++++++++++++
 board/st/stm32f746-disco/stm32f746-disco.c | 27 ++++++++++++++++++++++++++-
 configs/stm32f746-disco_defconfig          |  1 -
 include/configs/stm32f746-disco.h          | 22 +++++++++++++++++++++-
 5 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-stm32/Kconfig b/arch/arm/mach-stm32/Kconfig
index ec6b3ff..879383f 100644
--- a/arch/arm/mach-stm32/Kconfig
+++ b/arch/arm/mach-stm32/Kconfig
@@ -8,6 +8,7 @@ config STM32F1
 
 config STM32F7
 	bool "stm32f7 family"
+	select SUPPORT_SPL
 
 source "arch/arm/mach-stm32/stm32f4/Kconfig"
 source "arch/arm/mach-stm32/stm32f1/Kconfig"
diff --git a/arch/arm/mach-stm32/stm32f7/Kconfig b/arch/arm/mach-stm32/stm32f7/Kconfig
index 287e5ad..c13fafa 100644
--- a/arch/arm/mach-stm32/stm32f7/Kconfig
+++ b/arch/arm/mach-stm32/stm32f7/Kconfig
@@ -3,6 +3,28 @@ if STM32F7
 config TARGET_STM32F746_DISCO
 	bool "STM32F746 Discovery board"
 
+config SUPPORT_SPL
+	select SPL
+	select SPL_FRAMEWORK
+	select SPL_SERIAL_SUPPORT
+	select SPL_CLK
+	select SPL_OF_CONTROL
+	select SPL_OF_LIBFDT
+	select SPL_GPIO_SUPPORT
+	select SPL_LIBCOMMON_SUPPORT
+	select SPL_LIBGENERIC_SUPPORT
+	select SPL_DRIVERS_MISC_SUPPORT
+	select SPL_SYS_MALLOC_SIMPLE
+	select SPL_MTD_SUPPORT
+	select SPL_DM
+	select SPL_PINCTRL
+	select SPL_RAM
+	select SPL_DM_SEQ_ALIAS
+	select SPL_OF_TRANSLATE
+
+config SPL_PINCTRL_FULL
+	default n if TARGET_STM32F746_DISCO
+
 source "board/st/stm32f746-disco/Kconfig"
 
 endif
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
index dc3a9dc..4f2b677 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <ram.h>
+#include <spl.h>
 #include <asm/io.h>
 #include <asm/armv7m.h>
 #include <asm/arch/stm32.h>
@@ -36,16 +37,18 @@ int get_memory_base_size(fdt_addr_t *mr_base, fdt_addr_t *mr_size)
 }
 int dram_init(void)
 {
-	struct udevice *dev;
 	int rv;
 	fdt_addr_t mr_base, mr_size;
 
+#ifndef CONFIG_SUPPORT_SPL
+	struct udevice *dev;
 	rv = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (rv) {
 		debug("DRAM init failed: %d\n", rv);
 		return rv;
 	}
 
+#endif
 	rv = get_memory_base_size(&mr_base, &mr_size);
 	if (rv)
 		return rv;
@@ -87,6 +90,28 @@ int board_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_SPL_BUILD
+int spl_dram_init(void)
+{
+	struct udevice *dev;
+	int rv;
+	rv = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (rv)
+		debug("DRAM init failed: %d\n", rv);
+	return rv;
+}
+void spl_board_init(void)
+{
+	spl_dram_init();
+	preloader_console_init();
+	arch_cpu_init(); /* to configure mpu for sdram rw permissions */
+}
+u32 spl_boot_device(void)
+{
+	return BOOT_DEVICE_NOR;
+}
+
+#endif
 u32 get_board_rev(void)
 {
 	return 0;
diff --git a/configs/stm32f746-disco_defconfig b/configs/stm32f746-disco_defconfig
index a334d50..766b111 100644
--- a/configs/stm32f746-disco_defconfig
+++ b/configs/stm32f746-disco_defconfig
@@ -39,7 +39,6 @@ CONFIG_ETH_DESIGNWARE=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_FULL is not set
 CONFIG_PINCTRL_STM32=y
-# CONFIG_SPL_SERIAL_PRESENT is not set
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_OF_LIBFDT_OVERLAY=y
diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h
index 1ee5815..055fdf8 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -10,7 +10,12 @@
 
 #define CONFIG_SYS_FLASH_BASE		0x08000000
 #define CONFIG_SYS_INIT_SP_ADDR		0x20050000
-#define CONFIG_SYS_TEXT_BASE		0x08000000
+
+#ifdef CONFIG_SUPPORT_SPL
+#define CONFIG_SYS_TEXT_BASE		0xC0000000
+#else
+#define CONFIG_SYS_TEXT_BASE		CONFIG_SYS_FLASH_BASE
+#endif
 
 /*
  * Configuration of the external SDRAM memory
@@ -69,4 +74,19 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_BOARD_LATE_INIT
 #define CONFIG_DISPLAY_BOARDINFO
+
+/* For SPL */
+#ifdef CONFIG_SUPPORT_SPL
+#define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN		(512 * 1024)
+#define CONFIG_SYS_SPL_LEN		0x00008000
+#define CONFIG_SYS_UBOOT_START		0XC00003FD
+#define CONFIG_SYS_UBOOT_BASE		(CONFIG_SYS_FLASH_BASE + \
+					 CONFIG_SYS_SPL_LEN)
+#endif
+/* For SPL ends */
+
 #endif /* __CONFIG_H */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/6] SPL: Add XIP booting support
  2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 1/6] stm32f7: remove duplicate configs Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 2/6] stm32: stm32f7: add spl build support Vikas Manocha
@ 2017-05-18 18:49 ` Vikas Manocha
  2017-05-18 19:51   ` Alexandru Gagniuc
  2017-05-18 18:49 ` [U-Boot] [PATCH 4/6] serial: stm32f7: disable overrun Vikas Manocha
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

Enable support for XIP (execute in place) of U-Boot or kernel image. There is
no need to copy image from flash to ram if flash supports execute in place.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 arch/arm/include/asm/spl.h                 |  1 +
 board/st/stm32f746-disco/stm32f746-disco.c |  1 +
 common/spl/Kconfig                         |  9 +++++++++
 common/spl/Makefile                        |  1 +
 common/spl/spl_xip.c                       | 31 ++++++++++++++++++++++++++++++
 5 files changed, 43 insertions(+)
 create mode 100644 common/spl/spl_xip.c

diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h
index a0bda28..0a3536b 100644
--- a/arch/arm/include/asm/spl.h
+++ b/arch/arm/include/asm/spl.h
@@ -29,6 +29,7 @@ enum {
 	BOOT_DEVICE_I2C,
 	BOOT_DEVICE_BOARD,
 	BOOT_DEVICE_DFU,
+	BOOT_DEVICE_XIP,
 	BOOT_DEVICE_NONE
 };
 #endif
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
index 4f2b677..e330b1f 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -91,6 +91,7 @@ int board_early_init_f(void)
 #endif
 
 #ifdef CONFIG_SPL_BUILD
+
 int spl_dram_init(void)
 {
 	struct udevice *dev;
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index f51ae2c..52a5271 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -459,6 +459,15 @@ config SPL_NOR_SUPPORT
 	  a memory-mapped device makes it very easy to access. Loading from
 	  NOR is typically achieved with just a memcpy().
 
+config SPL_XIP_SUPPORT
+	bool "Support XIP"
+	depends on SPL
+	help
+	  Enable support for execute in place of U-Boot or kernel image. There
+	  is no need to copy image from flash to ram if flash supports execute
+	  in place. Its very useful in systems having enough flash but not
+	  enough ram to load the image.
+
 config SPL_ONENAND_SUPPORT
 	bool "Support OneNAND flash"
 	depends on SPL
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 1933cbd..88deeaf 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -12,6 +12,7 @@ ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 obj-$(CONFIG_SPL_LOAD_FIT) += spl_fit.o
 obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
+obj-$(CONFIG_SPL_XIP_SUPPORT) += spl_xip.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
 ifndef CONFIG_SPL_UBI
 obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
new file mode 100644
index 0000000..50e2f34
--- /dev/null
+++ b/common/spl/spl_xip.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017 Vikas Manocha <vikas.manocha@st.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <spl.h>
+
+static int spl_xip(struct spl_image_info *spl_image,
+		   struct spl_boot_device *bootdev)
+{
+#ifdef CONFIG_SPL_OS_BOOT
+	if (!spl_start_uboot()) {
+		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
+		spl_image->name = "Linux";
+		spl_image->os = IH_OS_LINUX;
+		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
+		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
+#ifdef CONFIG_CPU_V7M
+		spl_image->entry_point |= 0x1;
+#endif
+		debug("spl: payload xipImage, load addr: 0x%lx\n",
+		      spl_image->load_addr);
+		return 0;
+	}
+#endif
+	return(spl_parse_image_header(spl_image, (const struct image_header *)
+	       CONFIG_SYS_UBOOT_BASE));
+}
+SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 4/6] serial: stm32f7: disable overrun
  2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
                   ` (2 preceding siblings ...)
  2017-05-18 18:49 ` [U-Boot] [PATCH 3/6] SPL: Add XIP booting support Vikas Manocha
@ 2017-05-18 18:49 ` Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 5/6] spl: stm32f7: add kernel boot support Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 6/6] spl: stm32f7: configure for xip booting Vikas Manocha
  5 siblings, 0 replies; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

With overrun enabled, serial port console freezes & stops receiving data with
overun error if we keep sending data.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 drivers/serial/serial_stm32x7.c | 3 +++
 drivers/serial/serial_stm32x7.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/serial/serial_stm32x7.c b/drivers/serial/serial_stm32x7.c
index 1907cef..2b305cd 100644
--- a/drivers/serial/serial_stm32x7.c
+++ b/drivers/serial/serial_stm32x7.c
@@ -93,6 +93,9 @@ static int stm32_serial_probe(struct udevice *dev)
 	}
 #endif
 
+	/* Disable usart-> disable overrun-> enable usart */
+	clrbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
+	setbits_le32(&usart->cr3, USART_CR3_OVRDIS);
 	setbits_le32(&usart->cr1, USART_CR1_RE | USART_CR1_TE | USART_CR1_UE);
 
 	return 0;
diff --git a/drivers/serial/serial_stm32x7.h b/drivers/serial/serial_stm32x7.h
index 6190d67..8c02548 100644
--- a/drivers/serial/serial_stm32x7.h
+++ b/drivers/serial/serial_stm32x7.h
@@ -27,6 +27,8 @@ struct stm32_usart {
 #define USART_CR1_TE			(1 << 3)
 #define USART_CR1_UE			(1 << 0)
 
+#define USART_CR3_OVRDIS		(1 << 12)
+
 #define USART_SR_FLAG_RXNE		(1 << 5)
 #define USART_SR_FLAG_TXE		(1 << 7)
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 5/6] spl: stm32f7: add kernel boot support
  2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
                   ` (3 preceding siblings ...)
  2017-05-18 18:49 ` [U-Boot] [PATCH 4/6] serial: stm32f7: disable overrun Vikas Manocha
@ 2017-05-18 18:49 ` Vikas Manocha
  2017-05-18 18:49 ` [U-Boot] [PATCH 6/6] spl: stm32f7: configure for xip booting Vikas Manocha
  5 siblings, 0 replies; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 arch/arm/mach-stm32/stm32f7/Kconfig        | 1 +
 board/st/stm32f746-disco/stm32f746-disco.c | 8 ++++++++
 include/configs/stm32f746-disco.h          | 7 +++++++
 3 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-stm32/stm32f7/Kconfig b/arch/arm/mach-stm32/stm32f7/Kconfig
index c13fafa..3f6455e 100644
--- a/arch/arm/mach-stm32/stm32f7/Kconfig
+++ b/arch/arm/mach-stm32/stm32f7/Kconfig
@@ -21,6 +21,7 @@ config SUPPORT_SPL
 	select SPL_RAM
 	select SPL_DM_SEQ_ALIAS
 	select SPL_OF_TRANSLATE
+	select SPL_OS_BOOT
 
 config SPL_PINCTRL_FULL
 	default n if TARGET_STM32F746_DISCO
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
index e330b1f..335dcb9 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -91,6 +91,14 @@ int board_early_init_f(void)
 #endif
 
 #ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_start_uboot(void)
+{
+	debug("SPL: booting kernel\n");
+	/* break into full u-boot on 'c' */
+	return serial_tstc() && serial_getc() == 'c';
+}
+#endif
 
 int spl_dram_init(void)
 {
diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h
index 055fdf8..9052025 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -86,6 +86,13 @@
 #define CONFIG_SYS_UBOOT_START		0XC00003FD
 #define CONFIG_SYS_UBOOT_BASE		(CONFIG_SYS_FLASH_BASE + \
 					 CONFIG_SYS_SPL_LEN)
+
+#define CONFIG_SYS_OS_BASE		0x08040000
+/* DT blob (fdt) address */
+#define CONFIG_SYS_SPL_ARGS_ADDR        0xC0000100
+#define CONFIG_SYS_FDT_BASE		(CONFIG_SYS_FLASH_BASE + \
+					0x1C0000)
+#define CONFIG_SYS_FDT_SIZE		(20*1024)
 #endif
 /* For SPL ends */
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 6/6] spl: stm32f7: configure for xip booting
  2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
                   ` (4 preceding siblings ...)
  2017-05-18 18:49 ` [U-Boot] [PATCH 5/6] spl: stm32f7: add kernel boot support Vikas Manocha
@ 2017-05-18 18:49 ` Vikas Manocha
  5 siblings, 0 replies; 11+ messages in thread
From: Vikas Manocha @ 2017-05-18 18:49 UTC (permalink / raw)
  To: u-boot

With xip booting configuration, we don't need to copy the next image
(U-Boot or linux xipimage) from flash to sdram area.

Flash memory organization is like this:
	spl-U-Boot:	u-boot-spl.bin 	: 0x0800_0000
	U-Boot :	u-boot-dtb.bin	: 0x0800_8000
	linux :		xipImage	: 0x0800_8000

It is also possible to have U-Boot binary & linux binaries configured at
different addresses of flash memory like U-Boot at 0x0800_8000 & linux
xipImage at 0x0800_4000. But in any case, spl-U-Boot needs to be compiled for
U-Boot as next binary with SPL_OS_BOOT option disabled.
By default, spl is configured to boot linux xipImage.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
---
 arch/arm/mach-stm32/stm32f7/Kconfig        |  1 +
 board/st/stm32f746-disco/stm32f746-disco.c |  2 +-
 include/configs/stm32f746-disco.h          | 12 +++++-------
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-stm32/stm32f7/Kconfig b/arch/arm/mach-stm32/stm32f7/Kconfig
index 3f6455e..6acf9cf 100644
--- a/arch/arm/mach-stm32/stm32f7/Kconfig
+++ b/arch/arm/mach-stm32/stm32f7/Kconfig
@@ -22,6 +22,7 @@ config SUPPORT_SPL
 	select SPL_DM_SEQ_ALIAS
 	select SPL_OF_TRANSLATE
 	select SPL_OS_BOOT
+	select SPL_XIP_SUPPORT
 
 config SPL_PINCTRL_FULL
 	default n if TARGET_STM32F746_DISCO
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
index 335dcb9..11957e0 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -117,7 +117,7 @@ void spl_board_init(void)
 }
 u32 spl_boot_device(void)
 {
-	return BOOT_DEVICE_NOR;
+	return BOOT_DEVICE_XIP;
 }
 
 #endif
diff --git a/include/configs/stm32f746-disco.h b/include/configs/stm32f746-disco.h
index 9052025..4e0edcb 100644
--- a/include/configs/stm32f746-disco.h
+++ b/include/configs/stm32f746-disco.h
@@ -12,17 +12,18 @@
 #define CONFIG_SYS_INIT_SP_ADDR		0x20050000
 
 #ifdef CONFIG_SUPPORT_SPL
-#define CONFIG_SYS_TEXT_BASE		0xC0000000
+#define CONFIG_SYS_TEXT_BASE		0x08008000
+#define CONFIG_SYS_LOAD_ADDR		0x08008000
 #else
 #define CONFIG_SYS_TEXT_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_LOAD_ADDR		0xC0400000
+#define CONFIG_LOADADDR			0xC0400000
 #endif
 
 /*
  * Configuration of the external SDRAM memory
  */
 #define CONFIG_NR_DRAM_BANKS		1
-#define CONFIG_SYS_LOAD_ADDR		0xC0400000
-#define CONFIG_LOADADDR			0xC0400000
 
 #define CONFIG_SYS_MAX_FLASH_SECT	8
 #define CONFIG_SYS_MAX_FLASH_BANKS	1
@@ -83,16 +84,13 @@
 #define CONFIG_SPL_TEXT_BASE		CONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_MONITOR_LEN		(512 * 1024)
 #define CONFIG_SYS_SPL_LEN		0x00008000
-#define CONFIG_SYS_UBOOT_START		0XC00003FD
+#define CONFIG_SYS_UBOOT_START		0x080083FD
 #define CONFIG_SYS_UBOOT_BASE		(CONFIG_SYS_FLASH_BASE + \
 					 CONFIG_SYS_SPL_LEN)
 
-#define CONFIG_SYS_OS_BASE		0x08040000
 /* DT blob (fdt) address */
-#define CONFIG_SYS_SPL_ARGS_ADDR        0xC0000100
 #define CONFIG_SYS_FDT_BASE		(CONFIG_SYS_FLASH_BASE + \
 					0x1C0000)
-#define CONFIG_SYS_FDT_SIZE		(20*1024)
 #endif
 /* For SPL ends */
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/6] SPL: Add XIP booting support
  2017-05-18 18:49 ` [U-Boot] [PATCH 3/6] SPL: Add XIP booting support Vikas Manocha
@ 2017-05-18 19:51   ` Alexandru Gagniuc
  2017-05-22 16:55     ` Vikas MANOCHA
  0 siblings, 1 reply; 11+ messages in thread
From: Alexandru Gagniuc @ 2017-05-18 19:51 UTC (permalink / raw)
  To: u-boot

On 05/18/2017 11:49 AM, Vikas Manocha wrote:
> Enable support for XIP (execute in place) of U-Boot or kernel image. There is
> no need to copy image from flash to ram if flash supports execute in place.

Awesome. I've had to hack u-boot before to achieve exactly this. It's 
nice to have a proper implementation.


[snip]

> diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
> index 4f2b677..e330b1f 100644
> --- a/board/st/stm32f746-disco/stm32f746-disco.c
> +++ b/board/st/stm32f746-disco/stm32f746-disco.c
> @@ -91,6 +91,7 @@ int board_early_init_f(void)
>  #endif
>
>  #ifdef CONFIG_SPL_BUILD
> +
Unrelated change.

[snip]

> diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
> new file mode 100644
> index 0000000..50e2f34
> --- /dev/null
> +++ b/common/spl/spl_xip.c
> @@ -0,0 +1,31 @@
> +/*
> + * Copyright (C) 2017 Vikas Manocha <vikas.manocha@st.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <spl.h>
> +
> +static int spl_xip(struct spl_image_info *spl_image,
> +		   struct spl_boot_device *bootdev)
> +{
> +#ifdef CONFIG_SPL_OS_BOOT
> +	if (!spl_start_uboot()) {
> +		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
> +		spl_image->name = "Linux";
> +		spl_image->os = IH_OS_LINUX;
> +		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
> +		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
> +#ifdef CONFIG_CPU_V7M

This looks like it should be handled by spl_set_header_raw_uboot(). I 
don't see other SPL loaders do this.

> +		spl_image->entry_point |= 0x1;
> +#endif
> +		debug("spl: payload xipImage, load addr: 0x%lx\n",
> +		      spl_image->load_addr);
> +		return 0;
> +	}
> +#endif
> +	return(spl_parse_image_header(spl_image, (const struct image_header *)
> +	       CONFIG_SYS_UBOOT_BASE));
> +}
> +SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
>

Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/6] SPL: Add XIP booting support
  2017-05-18 19:51   ` Alexandru Gagniuc
@ 2017-05-22 16:55     ` Vikas MANOCHA
  2017-05-22 17:36       ` Alexandru Gagniuc
  0 siblings, 1 reply; 11+ messages in thread
From: Vikas MANOCHA @ 2017-05-22 16:55 UTC (permalink / raw)
  To: u-boot

Hi Alex,

> -----Original Message-----
> From: Alexandru Gagniuc [mailto:alex.g at adaptrum.com]
> Sent: Thursday, May 18, 2017 12:51 PM
> To: Vikas MANOCHA <vikas.manocha@st.com>; u-boot at lists.denx.de
> Cc: Patrick DELAUNAY <patrick.delaunay@st.com>; Patrice CHOTARD <patrice.chotard@st.com>; Christophe KERELLO
> <christophe.kerello@st.com>; Christophe PRIOUZEAU <christophe.priouzeau@st.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; Albert Aribaud <albert.u.boot@aribaud.net>; Andrew F. Davis <afd@ti.com>; Bin Meng
> <bmeng.cn@gmail.com>; B, Ravi <ravibabu@ti.com>; Heiko Schocher <hs@denx.de>; Ladislav Michl <ladis@linux-mips.org>;
> Masahiro Yamada <yamada.masahiro@socionext.com>; Michal Simek <michal.simek@xilinx.com>; Simon Glass
> <sjg@chromium.org>; Stefan Agner <stefan.agner@toradex.com>
> Subject: Re: [PATCH 3/6] SPL: Add XIP booting support
> 
> On 05/18/2017 11:49 AM, Vikas Manocha wrote:
> > Enable support for XIP (execute in place) of U-Boot or kernel image.
> > There is no need to copy image from flash to ram if flash supports execute in place.
> 
> Awesome. I've had to hack u-boot before to achieve exactly this. It's nice to have a proper implementation.
> 
> 
> [snip]
> 
> > diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
> > index 4f2b677..e330b1f 100644
> > --- a/board/st/stm32f746-disco/stm32f746-disco.c
> > +++ b/board/st/stm32f746-disco/stm32f746-disco.c
> > @@ -91,6 +91,7 @@ int board_early_init_f(void)
> >  #endif
> >
> >  #ifdef CONFIG_SPL_BUILD
> > +
> Unrelated change.

Oops! I will remove this blank line & so the file from this patch in v2.

> 
> [snip]
> 
> > diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
> > new file mode 100644
> > index 0000000..50e2f34
> > --- /dev/null
> > +++ b/common/spl/spl_xip.c
> > @@ -0,0 +1,31 @@
> > +/*
> > + * Copyright (C) 2017 Vikas Manocha <vikas.manocha@st.com>
> > + *
> > + * SPDX-License-Identifier:	GPL-2.0+
> > + */
> > +
> > +#include <common.h>
> > +#include <spl.h>
> > +
> > +static int spl_xip(struct spl_image_info *spl_image,
> > +		   struct spl_boot_device *bootdev)
> > +{
> > +#ifdef CONFIG_SPL_OS_BOOT
> > +	if (!spl_start_uboot()) {
> > +		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
> > +		spl_image->name = "Linux";
> > +		spl_image->os = IH_OS_LINUX;
> > +		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
> > +		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
> > +#ifdef CONFIG_CPU_V7M
> 
> This looks like it should be handled by spl_set_header_raw_uboot(). I
> don't see other SPL loaders do this.

We might not want to boot kernel if header is not present in every situation. With spl_xip config option, we enable if we need it.

Cheers,
Vikas

> 
> > +		spl_image->entry_point |= 0x1;
> > +#endif
> > +		debug("spl: payload xipImage, load addr: 0x%lx\n",
> > +		      spl_image->load_addr);
> > +		return 0;
> > +	}
> > +#endif
> > +	return(spl_parse_image_header(spl_image, (const struct image_header *)
> > +	       CONFIG_SYS_UBOOT_BASE));
> > +}
> > +SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
> >
> 
> Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/6] SPL: Add XIP booting support
  2017-05-22 16:55     ` Vikas MANOCHA
@ 2017-05-22 17:36       ` Alexandru Gagniuc
  2017-05-22 18:06         ` Vikas MANOCHA
  0 siblings, 1 reply; 11+ messages in thread
From: Alexandru Gagniuc @ 2017-05-22 17:36 UTC (permalink / raw)
  To: u-boot


On 05/22/2017 09:55 AM, Vikas MANOCHA wrote:
> Hi Alex,
Hi

[snip]

>>
>>> diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
>>> new file mode 100644
>>> index 0000000..50e2f34
>>> --- /dev/null
>>> +++ b/common/spl/spl_xip.c
>>> @@ -0,0 +1,31 @@
>>> +/*
>>> + * Copyright (C) 2017 Vikas Manocha <vikas.manocha@st.com>
>>> + *
>>> + * SPDX-License-Identifier:	GPL-2.0+
>>> + */
>>> +
>>> +#include <common.h>
>>> +#include <spl.h>
>>> +
>>> +static int spl_xip(struct spl_image_info *spl_image,
>>> +		   struct spl_boot_device *bootdev)
>>> +{
>>> +#ifdef CONFIG_SPL_OS_BOOT
>>> +	if (!spl_start_uboot()) {
>>> +		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
>>> +		spl_image->name = "Linux";
>>> +		spl_image->os = IH_OS_LINUX;
>>> +		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
>>> +		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
>>> +#ifdef CONFIG_CPU_V7M
>>
>> This looks like it should be handled by spl_set_header_raw_uboot(). I
>> don't see other SPL loaders do this.
>
> We might not want to boot kernel if header is not present in every situation. With spl_xip config option, we enable if we need it.

I'm talkVing about the '#ifdef CONFIG_CPU_7M' part. A lot of the spl 
loaders are mostly boilerplate, but it should be consistent boilerplate. 
If there is a good reason to have a different boilerplate, then at the 
very least a comment should explain "why" it is done different.

Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/6] SPL: Add XIP booting support
  2017-05-22 17:36       ` Alexandru Gagniuc
@ 2017-05-22 18:06         ` Vikas MANOCHA
  0 siblings, 0 replies; 11+ messages in thread
From: Vikas MANOCHA @ 2017-05-22 18:06 UTC (permalink / raw)
  To: u-boot

Hi Alex,

> -----Original Message-----
> From: Alexandru Gagniuc [mailto:alex.g at adaptrum.com]
> Sent: Monday, May 22, 2017 10:37 AM
> To: Vikas MANOCHA <vikas.manocha@st.com>; u-boot at lists.denx.de
> Cc: Patrick DELAUNAY <patrick.delaunay@st.com>; Patrice CHOTARD <patrice.chotard@st.com>; Christophe KERELLO
> <christophe.kerello@st.com>; Christophe PRIOUZEAU <christophe.priouzeau@st.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; Albert Aribaud <albert.u.boot@aribaud.net>; Andrew F. Davis <afd@ti.com>; Bin Meng
> <bmeng.cn@gmail.com>; B, Ravi <ravibabu@ti.com>; Heiko Schocher <hs@denx.de>; Ladislav Michl <ladis@linux-mips.org>;
> Masahiro Yamada <yamada.masahiro@socionext.com>; Michal Simek <michal.simek@xilinx.com>; Simon Glass
> <sjg@chromium.org>; Stefan Agner <stefan.agner@toradex.com>
> Subject: Re: [PATCH 3/6] SPL: Add XIP booting support
> 
> 
> On 05/22/2017 09:55 AM, Vikas MANOCHA wrote:
> > Hi Alex,
> Hi
> 
> [snip]
> 
> >>
> >>> diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c new file
> >>> mode 100644 index 0000000..50e2f34
> >>> --- /dev/null
> >>> +++ b/common/spl/spl_xip.c
> >>> @@ -0,0 +1,31 @@
> >>> +/*
> >>> + * Copyright (C) 2017 Vikas Manocha <vikas.manocha@st.com>
> >>> + *
> >>> + * SPDX-License-Identifier:	GPL-2.0+
> >>> + */
> >>> +
> >>> +#include <common.h>
> >>> +#include <spl.h>
> >>> +
> >>> +static int spl_xip(struct spl_image_info *spl_image,
> >>> +		   struct spl_boot_device *bootdev) { #ifdef CONFIG_SPL_OS_BOOT
> >>> +	if (!spl_start_uboot()) {
> >>> +		spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
> >>> +		spl_image->name = "Linux";
> >>> +		spl_image->os = IH_OS_LINUX;
> >>> +		spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
> >>> +		spl_image->entry_point = CONFIG_SYS_LOAD_ADDR; #ifdef
> >>> +CONFIG_CPU_V7M
> >>
> >> This looks like it should be handled by spl_set_header_raw_uboot(). I
> >> don't see other SPL loaders do this.
> >
> > We might not want to boot kernel if header is not present in every situation. With spl_xip config option, we enable if we need it.
> 
> I'm talkVing about the '#ifdef CONFIG_CPU_7M' part. A lot of the spl loaders are mostly boilerplate, but it should be consistent
> boilerplate.
> If there is a good reason to have a different boilerplate, then at the very least a comment should explain "why" it is done different.

#ifdef CONFIG_CPU_V7M part is to keep v7m cpu in thumb mode as it does not support arm mode. The same is the reason for it to
be in spl_set_header_raw_uboot().

On a second thought, I think it will be good to move this part just before booting next image. In that case it would be required just once.
I will send a separate patch for it.

Cheers,
Vikas

> 
> Alex

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-05-22 18:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 18:49 [U-Boot] [PATCH 0/6] spl: add xip booting support Vikas Manocha
2017-05-18 18:49 ` [U-Boot] [PATCH 1/6] stm32f7: remove duplicate configs Vikas Manocha
2017-05-18 18:49 ` [U-Boot] [PATCH 2/6] stm32: stm32f7: add spl build support Vikas Manocha
2017-05-18 18:49 ` [U-Boot] [PATCH 3/6] SPL: Add XIP booting support Vikas Manocha
2017-05-18 19:51   ` Alexandru Gagniuc
2017-05-22 16:55     ` Vikas MANOCHA
2017-05-22 17:36       ` Alexandru Gagniuc
2017-05-22 18:06         ` Vikas MANOCHA
2017-05-18 18:49 ` [U-Boot] [PATCH 4/6] serial: stm32f7: disable overrun Vikas Manocha
2017-05-18 18:49 ` [U-Boot] [PATCH 5/6] spl: stm32f7: add kernel boot support Vikas Manocha
2017-05-18 18:49 ` [U-Boot] [PATCH 6/6] spl: stm32f7: configure for xip booting Vikas Manocha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.