[U-Boot] [PATCH v5 0/5] Clean out SPL and enable driver model

This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5: - Rebase to master
Changes in v4: - Squash the gdata revert patch into this one - Allow gdata to survive unless CONFIG_DM is defined, for now - Rebase on top of dm/master - Adjust README to mention that lowlevel_init() should have no stack - Add new patch to make the export interface support CONFIG_SYS_MALLOC_SIMPLE
Changes in v3: - Drop extra blank line
Changes in v2: - Remove gdata definition from ARM spl header file also - Rebase on top of the SPI series - Move docs to top-level README file and expand them to cover U-Boot proper - Add Kconfig settings
Simon Glass (5): arm: Reduce the scope of lowlevel_init() arm: spl: Avoid setting up a duplicate global data structure dm: tegra: Enable driver model in SPL and adjust the GPIO driver arm: spl: Allow board_init_r() to run with a larger stack Make export interface support CONFIG_SYS_MALLOC_SIMPLE
Kconfig | 18 ++++++++++ README | 69 ++++++++++++++++++++++++++++++++++++++ arch/arm/cpu/armv7/lowlevel_init.S | 23 +++++++------ arch/arm/include/asm/spl.h | 2 ++ arch/arm/lib/crt0.S | 13 +++++-- arch/arm/lib/spl.c | 4 +++ arch/arm/mach-tegra/Kconfig | 3 ++ board/nvidia/seaboard/seaboard.c | 4 +-- common/spl/spl.c | 35 +++++++++++++++++++ drivers/gpio/Makefile | 4 +++ drivers/gpio/tegra_gpio.c | 27 ++++++--------- include/_exports.h | 2 ++ include/configs/tegra-common.h | 6 ---- include/exports.h | 2 ++ 14 files changed, 174 insertions(+), 38 deletions(-)

This function has grown into something of a monster. Some boards are setting up a console and DRAM here in SPL. This requires global_data which should be set up in one place (crt0.S).
There is no need for SPL to use s_init() for anything since board_init_f() is called immediately afterwards.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/cpu/armv7/lowlevel_init.S | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/arch/arm/cpu/armv7/lowlevel_init.S b/arch/arm/cpu/armv7/lowlevel_init.S index f1aea05..4803150 100644 --- a/arch/arm/cpu/armv7/lowlevel_init.S +++ b/arch/arm/cpu/armv7/lowlevel_init.S @@ -17,24 +17,27 @@
ENTRY(lowlevel_init) /* - * Setup a temporary stack + * Setup a temporary stack. Global data is not available yet. */ ldr sp, =CONFIG_SYS_INIT_SP_ADDR - bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ -#ifdef CONFIG_SPL_BUILD - ldr r9, =gdata -#else - sub sp, sp, #GD_SIZE - bic sp, sp, #7 - mov r9, sp -#endif + mov r9, #0 /* * Save the old lr(passed in ip) and the current lr to stack */ push {ip, lr}
/* - * go setup pll, mux, memory + * Call the very early init function. This should do only the + * absolute bare minimum to get started. It should not: + * + * - set up DRAM + * - use global_data + * - clear BSS + * - try to start a console + * + * For boards with SPL this should be empty since SPL can do all of + * this init in the SPL board_init_f() function which is called + * immediately after this. */ bl s_init pop {ip, pc}

This is already set up in crt0.S. We don't need a new structure and don't really want one in the 'data' section of the image, since it will be empty and crt0.S's changes will be ignored.
As an interim measure, remove it only if CONFIG_DM is not defined. This allows us to press ahead with driver model in SPL and allow the stragglers to catch up.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v5: None Changes in v4: - Squash the gdata revert patch into this one - Allow gdata to survive unless CONFIG_DM is defined, for now
Changes in v3: None Changes in v2: - Remove gdata definition from ARM spl header file also
arch/arm/include/asm/spl.h | 2 ++ arch/arm/lib/spl.c | 4 ++++ 2 files changed, 6 insertions(+)
diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h index 17b6f54..6db405d 100644 --- a/arch/arm/include/asm/spl.h +++ b/arch/arm/include/asm/spl.h @@ -37,6 +37,8 @@ void spl_board_load_image(void); /* Linker symbols. */ extern char __bss_start[], __bss_end[];
+#ifndef CONFIG_DM extern gd_t gdata; +#endif
#endif diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c index c41850a..bd8c7d2 100644 --- a/arch/arm/lib/spl.c +++ b/arch/arm/lib/spl.c @@ -13,6 +13,7 @@ #include <image.h> #include <linux/compiler.h>
+#ifndef CONFIG_DM /* Pointer to as well as the global data structure for SPL */ DECLARE_GLOBAL_DATA_PTR;
@@ -21,6 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; * pafches that rely on it. The global_data area is set up in crt0.S. */ gd_t gdata __attribute__ ((section(".data"))); +#endif
/* * In the context of SPL, board_init_f must ensure that any clocks/etc for @@ -33,8 +35,10 @@ void __weak board_init_f(ulong dummy) /* Clear the BSS. */ memset(__bss_start, 0, __bss_end - __bss_start);
+#ifndef CONFIG_DM /* TODO: Remove settings of the global data pointer here */ gd = &gdata; +#endif
board_init_r(NULL, 0); }

Use the full driver model GPIO and serial drivers in SPL now that these are supported. Since device tree is not available they will use platform data.
Remove the special SPL GPIO function as it is no longer needed.
This is all in one commit to maintain bisectability.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v5: None Changes in v4: - Rebase on top of dm/master
Changes in v3: - Drop extra blank line
Changes in v2: - Rebase on top of the SPI series
arch/arm/mach-tegra/Kconfig | 3 +++ board/nvidia/seaboard/seaboard.c | 4 +--- drivers/gpio/Makefile | 4 ++++ drivers/gpio/tegra_gpio.c | 27 +++++++++++---------------- include/configs/tegra-common.h | 6 ------ 5 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 8615248..fccfd79 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig @@ -29,6 +29,9 @@ config USE_PRIVATE_LIBGCC config DM default y
+config SPL_DM + default y + config DM_SERIAL default y
diff --git a/board/nvidia/seaboard/seaboard.c b/board/nvidia/seaboard/seaboard.c index 11472eb..25480e4 100644 --- a/board/nvidia/seaboard/seaboard.c +++ b/board/nvidia/seaboard/seaboard.c @@ -20,10 +20,8 @@ void gpio_early_init_uart(void) { /* Enable UART via GPIO_PI3 (port 8, bit 3) so serial console works */ -#ifndef CONFIG_SPL_BUILD gpio_request(GPIO_PI3, NULL); -#endif - tegra_spl_gpio_direction_output(GPIO_PI3, 0); + gpio_direction_output(GPIO_PI3, 0); } #endif
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index aa11f15..fe9a3b2 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -8,6 +8,10 @@ ifndef CONFIG_SPL_BUILD obj-$(CONFIG_DM_GPIO) += gpio-uclass.o endif +/* TODO(sjg@chromium.org): Only tegra supports driver model in SPL */ +ifdef CONFIG_TEGRA_GPIO +obj-$(CONFIG_DM_GPIO) += gpio-uclass.o +endif
obj-$(CONFIG_AT91_GPIO) += at91_gpio.o obj-$(CONFIG_INTEL_ICH6_GPIO) += intel_ich6_gpio.o diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c index 43928b8..f870cdb 100644 --- a/drivers/gpio/tegra_gpio.c +++ b/drivers/gpio/tegra_gpio.c @@ -132,21 +132,6 @@ static void set_level(unsigned gpio, int high) writel(u, &bank->gpio_out[GPIO_PORT(gpio)]); }
-/* set GPIO pin 'gpio' as an output, with polarity 'value' */ -int tegra_spl_gpio_direction_output(int gpio, int value) -{ - /* Configure as a GPIO */ - set_config(gpio, 1); - - /* Configure GPIO output value. */ - set_level(gpio, value); - - /* Configure GPIO direction as output. */ - set_direction(gpio, 1); - - return 0; -} - /* * Generic_GPIO primitives. */ @@ -338,12 +323,19 @@ static int gpio_tegra_bind(struct udevice *parent) int bank_count; int bank; int ret; - int len;
/* If this is a child device, there is nothing to do here */ if (plat) return 0;
+ /* TODO(sjg@chromium.org): Remove once SPL supports device tree */ +#ifdef CONFIG_SPL_BUILD + ctlr = (struct gpio_ctlr *)NV_PA_GPIO_BASE; + bank_count = TEGRA_GPIO_BANKS; +#else + { + int len; + /* * This driver does not make use of interrupts, other than to figure * out the number of GPIO banks @@ -353,6 +345,8 @@ static int gpio_tegra_bind(struct udevice *parent) bank_count = len / 3 / sizeof(u32); ctlr = (struct gpio_ctlr *)fdtdec_get_addr(gd->fdt_blob, parent->of_offset, "reg"); + } +#endif for (bank = 0; bank < bank_count; bank++) { int port;
@@ -388,4 +382,5 @@ U_BOOT_DRIVER(gpio_tegra) = { .probe = gpio_tegra_probe, .priv_auto_alloc_size = sizeof(struct tegra_port_info), .ops = &gpio_tegra_ops, + .flags = DM_FLAG_PRE_RELOC, }; diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h index 005fc6a..fa6ccc1 100644 --- a/include/configs/tegra-common.h +++ b/include/configs/tegra-common.h @@ -43,13 +43,7 @@ /* * NS16550 Configuration */ -#ifdef CONFIG_SPL_BUILD -#define CONFIG_SYS_NS16550_SERIAL -#define CONFIG_SYS_NS16550_REG_SIZE (-4) -#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK -#else #define CONFIG_TEGRA_SERIAL -#endif #define CONFIG_SYS_NS16550
/*

At present SPL uses a single stack, either CONFIG_SPL_STACK or CONFIG_SYS_INIT_SP_ADDR. Since some SPL features (such as MMC and environment) require a lot of stack, some boards set CONFIG_SPL_STACK to point into SDRAM. They then set up SDRAM very early, before board_init_f(), so that the larger stack can be used.
This is an abuse of lowlevel_init(). That function should only be used for essential start-up code which cannot be delayed. An example of a valid use is when only part of the SPL code is visible/executable, and the SoC must be set up so that board_init_f() can be reached. It should not be used for SDRAM init, console init, etc.
Add a CONFIG_SPL_STACK_R option, which allows the stack to be moved to a new address before board_init_r() is called in SPL.
The expected SPL flow (for CONFIG_SPL_FRAMEWORK) is documented in the README.
Signed-off-by: Simon Glass sjg@chromium.org For version 1: Acked-by: Albert ARIBAUD albert.u.boot@aribaud.net Reviewed-by: Stefan Roese sr@denx.de Tested-by: Bo Shen voice.shen@atmel.com Acked-by: Bo Shen voice.shen@atmel.com Acked-by: Heiko Schocher hs@denx.de Tested-by: Heiko Schocher hs@denx.de ---
Changes in v5: - Rebase to master
Changes in v4: - Adjust README to mention that lowlevel_init() should have no stack
Changes in v3: None Changes in v2: - Move docs to top-level README file and expand them to cover U-Boot proper - Add Kconfig settings
Kconfig | 18 ++++++++++++++ README | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/lib/crt0.S | 13 +++++++--- common/spl/spl.c | 35 +++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 3 deletions(-)
diff --git a/Kconfig b/Kconfig index 91a0618..8de731d 100644 --- a/Kconfig +++ b/Kconfig @@ -96,6 +96,24 @@ config SPL help If you want to build SPL as well as the normal image, say Y.
+config CONFIG_SPL_STACK_R + depends on SPL + bool "Enable SDRAM location for SPL stack" + help + SPL starts off execution in SRAM and thus typically has only a small + stack available. Since SPL sets up DRAM while in its board_init_f() + function, it is possible for the stack to move there before + board_init_r() is reached. This option enables a special SDRAM + location for the SPL stack. U-Boot SPL switches to this after + board_init_f() completes, and before board_init_r() starts. + +config CONFIG_SPL_STACK_R_ADDR + depends on CONFIG_SPL_STACK_R + hex "SDRAM location for SPL stack" + help + Specify the address in SDRAM for the SPL stack. This will be set up + before board_init_r() is called. + config TPL bool depends on SPL && SUPPORT_TPL diff --git a/README b/README index febefb5..3547ead 100644 --- a/README +++ b/README @@ -273,6 +273,75 @@ run some of U-Boot's tests. See board/sandbox/README.sandbox for more details.
+Board Initialisation Flow: +-------------------------- + +This is the intended start-up flow for boards. This should apply for both +SPL and U-Boot proper (i.e. they both follow the same rules). At present SPL +mostly uses a separate code path, but the funtion names and roles of each +function are the same. Some boards or architectures may not conform to this. +At least most ARM boards which use CONFIG_SPL_FRAMEWORK conform to this. + +Execution starts with start.S with three functions called during init after +that. The purpose and limitations of each is described below. + +lowlevel_init(): + - purpose: essential init to permit execution to reach board_init_f() + - no global_data or BSS + - there is no stack (ARMv7 may have one but it will soon be removed) + - must not set up SDRAM or use console + - must only do the bare minimum to allow execution to continue to + board_init_f() + - this is almost never needed + - return normally from this function + +board_init_f(): + - purpose: set up the machine ready for running board_init_r(): + i.e. SDRAM and serial UART + - global_data is available + - stack is in SRAM + - BSS is not available, so you cannot use global/static variables, + only stack variables and global_data + + Non-SPL-specific notes: + - dram_init() is called to set up DRAM. If already done in SPL this + can do nothing + + SPL-specific notes: + - you can override the entire board_init_f() function with your own + version as needed. + - preloader_console_init() can be called here in extremis + - should set up SDRAM, and anything needed to make the UART work + - these is no need to clear BSS, it will be done by crt0.S + - must return normally from this function (don't call board_init_r() + directly) + +Here the BSS is cleared. For SPL, if CONFIG_SPL_STACK_R is defined, then at +this point the stack and global_data are relocated to below +CONFIG_SPL_STACK_R_ADDR. For non-SPL, U-Boot is relocated to run at the top of +memory. + +board_init_r(): + - purpose: main execution, common code + - global_data is available + - SDRAM is available + - BSS is available, all static/global variables can be used + - execution eventually continues to main_loop() + + Non-SPL-specific notes: + - U-Boot is relocated to the top of memory and is now running from + there. + + SPL-specific notes: + - stack is optionally in SDRAM, if CONFIG_SPL_STACK_R is defined and + CONFIG_SPL_STACK_R_ADDR points into SDRAM + - preloader_console_init() can be called here - typically this is + done by defining CONFIG_SPL_BOARD_INIT and then supplying a + spl_board_init() function containing this call + - loads U-Boot or (in falcon mode) Linux + + + Configuration Options: ----------------------
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 22df3e5..7939ced 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -113,7 +113,14 @@ here: /* Set up final (full) environment */
bl c_runtime_cpu_setup /* we still call old routine here */ - +#endif +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_FRAMEWORK) +# ifdef CONFIG_SPL_BUILD + /* Use a DRAM stack for the rest of SPL, if requested */ + bl spl_relocate_stack_gd + cmp r0, #0 + movne sp, r0 +# endif ldr r0, =__bss_start /* this is auto-relocated! */ ldr r1, =__bss_end /* this is auto-relocated! */
@@ -124,9 +131,10 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ addlo r0, r0, #4 /* move to next */ blo clbss_l
+#if ! defined(CONFIG_SPL_BUILD) bl coloured_LED_init bl red_led_on - +#endif /* call board_init_r(gd_t *id, ulong dest_addr) */ mov r0, r9 /* gd_t */ ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */ @@ -134,7 +142,6 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ ldr pc, =board_init_r /* this is auto-relocated! */
/* we should not return here. */ - #endif
ENDPROC(_main) diff --git a/common/spl/spl.c b/common/spl/spl.c index ded0f30..cd75bbc 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -281,3 +281,38 @@ void preloader_console_init(void) spl_display_print(); #endif } + +/** + * spl_relocate_stack_gd() - Relocate stack ready for board_init_r() execution + * + * Sometimes board_init_f() runs with a stack in SRAM but we want to use SDRAM + * for the main board_init_r() execution. This is typically because we need + * more stack space for things like the MMC sub-system. + * + * This function calculates the stack position, copies the global_data into + * place and returns the new stack position. The caller is responsible for + * setting up the sp register. + * + * @return new stack location, or 0 to use the same stack + */ +ulong spl_relocate_stack_gd(void) +{ +#ifdef CONFIG_SPL_STACK_R + gd_t *new_gd; + ulong ptr; + + /* Get stack position: use 8-byte alignment for ABI compliance */ + ptr = CONFIG_SPL_STACK_R - sizeof(gd_t); + ptr &= ~7; + new_gd = (gd_t *)ptr; + memcpy(new_gd, (void *)gd, sizeof(gd_t)); + gd = new_gd; + + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + + return ptr; +#else + return 0; +#endif +}

When CONFIG_SYS_MALLOC_SIMPLE is defined, free() is a static inline. Make sure that the export interface still builds in this case.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v5: None Changes in v4: - Add new patch to make the export interface support CONFIG_SYS_MALLOC_SIMPLE
Changes in v3: None Changes in v2: None
include/_exports.h | 2 ++ include/exports.h | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/include/_exports.h b/include/_exports.h index 5944703..279017e 100644 --- a/include/_exports.h +++ b/include/_exports.h @@ -23,7 +23,9 @@ EXPORT_FUNC(dummy, void, free_hdlr, void) #endif EXPORT_FUNC(malloc, void *, malloc, size_t) +#ifndef CONFIG_SYS_MALLOC_SIMPLE EXPORT_FUNC(free, void, free, void *) +#endif EXPORT_FUNC(udelay, void, udelay, unsigned long) EXPORT_FUNC(get_timer, unsigned long, get_timer, unsigned long) EXPORT_FUNC(vprintf, int, vprintf, const char *, va_list) diff --git a/include/exports.h b/include/exports.h index 205affe..1a01e43 100644 --- a/include/exports.h +++ b/include/exports.h @@ -15,7 +15,9 @@ int printf(const char* fmt, ...); void install_hdlr(int, interrupt_handler_t, void*); void free_hdlr(int); void *malloc(size_t); +#ifndef CONFIG_SYS_MALLOC_SIMPLE void free(void*); +#endif void __udelay(unsigned long); unsigned long get_timer(unsigned long); int vprintf(const char *, va_list);

Hi,
On 26 February 2015 at 10:26, Simon Glass sjg@chromium.org wrote:
This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5:
- Rebase to master
Are there any more comments on this? I know Albert was looking at applying it, but I am tempted to bring it through the u-boot-dm tree and get it in. RC3 is soon!
Regards, Simon

On Mon, Mar 02, 2015 at 03:19:05PM -0700, Simon Glass wrote:
Hi,
On 26 February 2015 at 10:26, Simon Glass sjg@chromium.org wrote:
This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5:
- Rebase to master
Are there any more comments on this? I know Albert was looking at applying it, but I am tempted to bring it through the u-boot-dm tree and get it in. RC3 is soon!
Did you have something that switched beaglebone black over to this? Thanks!

Hi Tom,
On 2 March 2015 at 17:51, Tom Rini trini@konsulko.com wrote:
On Mon, Mar 02, 2015 at 03:19:05PM -0700, Simon Glass wrote:
Hi,
On 26 February 2015 at 10:26, Simon Glass sjg@chromium.org wrote:
This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5:
- Rebase to master
Are there any more comments on this? I know Albert was looking at applying it, but I am tempted to bring it through the u-boot-dm tree and get it in. RC3 is soon!
Did you have something that switched beaglebone black over to this? Thanks!
I think I sent patches at the time but they were too radical. I'm even nervous about the current set which is why I want time for people to test this.
I'll dig this up and send a v6.
Regards, Simon

On Mon, Mar 02, 2015 at 09:39:37PM -0700, Simon Glass wrote:
Hi Tom,
On 2 March 2015 at 17:51, Tom Rini trini@konsulko.com wrote:
On Mon, Mar 02, 2015 at 03:19:05PM -0700, Simon Glass wrote:
Hi,
On 26 February 2015 at 10:26, Simon Glass sjg@chromium.org wrote:
This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5:
- Rebase to master
Are there any more comments on this? I know Albert was looking at applying it, but I am tempted to bring it through the u-boot-dm tree and get it in. RC3 is soon!
Did you have something that switched beaglebone black over to this? Thanks!
I think I sent patches at the time but they were too radical. I'm even nervous about the current set which is why I want time for people to test this.
I'll dig this up and send a v6.
I recall you had something radical before but I solved those problems (I thought!) differently and that brought us back to the need to add CONFIG_SPL_STACK_R which shouldn't be a big deal. I'm kicking at the problem again differently this morning (aside, conmux + XMODEM is broken in conmux it seem which breaks my workflow on some boards pretty bad).

On Tue, Mar 03, 2015 at 09:06:15AM -0500, Tom Rini wrote:
On Mon, Mar 02, 2015 at 09:39:37PM -0700, Simon Glass wrote:
Hi Tom,
On 2 March 2015 at 17:51, Tom Rini trini@konsulko.com wrote:
On Mon, Mar 02, 2015 at 03:19:05PM -0700, Simon Glass wrote:
Hi,
On 26 February 2015 at 10:26, Simon Glass sjg@chromium.org wrote:
This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5:
- Rebase to master
Are there any more comments on this? I know Albert was looking at applying it, but I am tempted to bring it through the u-boot-dm tree and get it in. RC3 is soon!
Did you have something that switched beaglebone black over to this? Thanks!
I think I sent patches at the time but they were too radical. I'm even nervous about the current set which is why I want time for people to test this.
I'll dig this up and send a v6.
I recall you had something radical before but I solved those problems (I thought!) differently and that brought us back to the need to add CONFIG_SPL_STACK_R which shouldn't be a big deal. I'm kicking at the problem again differently this morning (aside, conmux + XMODEM is broken in conmux it seem which breaks my workflow on some boards pretty bad).
OK, yeah, it's not _that_ bad:
diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 81477aa..4436413 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -204,18 +204,20 @@ int arch_misc_init(void) }
#ifndef CONFIG_SKIP_LOWLEVEL_INIT +#ifdef CONFIG_SPL_BUILD /* * In the case of non-SPL based booting we'll want to call these * functions a tiny bit later as it will require gd to be set and cleared * and that's not true in s_init in this case so we cannot do it there. */ -int board_early_init_f(void) +void board_init_f(ulong dummy) { prcm_init(); set_mux_conf_regs();
- return 0; + sdram_init(); } +#endif
/* * This function is the place to do per-board things such as ramp up the @@ -298,9 +300,5 @@ void s_init(void) /* Enable RTC32K clock */ rtc32k_enable(); #endif -#ifdef CONFIG_SPL_BUILD - board_early_init_f(); - sdram_init(); -#endif } #endif diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index 2e5aeaa..deecf95 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -1,4 +1,6 @@ CONFIG_SPL=y +CONFIG_CONFIG_SPL_STACK_R=y +CONFIG_CONFIG_SPL_STACK_R_ADDR=0x82000000 CONFIG_SYS_EXTRA_OPTIONS="NAND" CONFIG_CONS_INDEX=1 +S:CONFIG_ARM=y diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index 2bd1164..1882073 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -216,7 +216,6 @@ * end of the BSS area. We place our stack at 32MiB after the start of * DRAM to allow room for all of the above. */ -#define CONFIG_SPL_STACK (CONFIG_SYS_SDRAM_BASE + (32 << 20)) #ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0x80800000 #endif
I might even go so far as to say that's a clean-up. I do need to put this through it's paces tho on am335x and then work on converting the rest of the families.
But, Albert, shall we put this in right after -rc3?

Hi Tom,
On 3 March 2015 at 07:48, Tom Rini trini@konsulko.com wrote:
On Tue, Mar 03, 2015 at 09:06:15AM -0500, Tom Rini wrote:
On Mon, Mar 02, 2015 at 09:39:37PM -0700, Simon Glass wrote:
Hi Tom,
On 2 March 2015 at 17:51, Tom Rini trini@konsulko.com wrote:
On Mon, Mar 02, 2015 at 03:19:05PM -0700, Simon Glass wrote:
Hi,
On 26 February 2015 at 10:26, Simon Glass sjg@chromium.org wrote:
This series includes a few more patches aimed at getting rid of gdata, the parallel global_data structure introduced on some ARM boards.
It also collects together the other patches which have been sent previously, so that everything is in one place.
I would like get this agreed and applied to u-boot-dm this week if possible so that we will at last have driver model available in SPL.
This series is available at u-boot-dm/spl-working.
Changes in v5:
- Rebase to master
Are there any more comments on this? I know Albert was looking at applying it, but I am tempted to bring it through the u-boot-dm tree and get it in. RC3 is soon!
Did you have something that switched beaglebone black over to this? Thanks!
I think I sent patches at the time but they were too radical. I'm even nervous about the current set which is why I want time for people to test this.
I'll dig this up and send a v6.
I recall you had something radical before but I solved those problems (I thought!) differently and that brought us back to the need to add CONFIG_SPL_STACK_R which shouldn't be a big deal. I'm kicking at the problem again differently this morning (aside, conmux + XMODEM is broken in conmux it seem which breaks my workflow on some boards pretty bad).
OK, yeah, it's not _that_ bad:
diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 81477aa..4436413 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -204,18 +204,20 @@ int arch_misc_init(void) }
#ifndef CONFIG_SKIP_LOWLEVEL_INIT +#ifdef CONFIG_SPL_BUILD /*
- In the case of non-SPL based booting we'll want to call these
- functions a tiny bit later as it will require gd to be set and cleared
- and that's not true in s_init in this case so we cannot do it there.
*/ -int board_early_init_f(void) +void board_init_f(ulong dummy) { prcm_init(); set_mux_conf_regs();
return 0;
sdram_init();
} +#endif
/*
- This function is the place to do per-board things such as ramp up the
@@ -298,9 +300,5 @@ void s_init(void) /* Enable RTC32K clock */ rtc32k_enable(); #endif -#ifdef CONFIG_SPL_BUILD
board_early_init_f();
sdram_init();
-#endif } #endif diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index 2e5aeaa..deecf95 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -1,4 +1,6 @@ CONFIG_SPL=y +CONFIG_CONFIG_SPL_STACK_R=y +CONFIG_CONFIG_SPL_STACK_R_ADDR=0x82000000 CONFIG_SYS_EXTRA_OPTIONS="NAND" CONFIG_CONS_INDEX=1 +S:CONFIG_ARM=y diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h index 2bd1164..1882073 100644 --- a/include/configs/ti_armv7_common.h +++ b/include/configs/ti_armv7_common.h @@ -216,7 +216,6 @@
- end of the BSS area. We place our stack at 32MiB after the start of
- DRAM to allow room for all of the above.
*/ -#define CONFIG_SPL_STACK (CONFIG_SYS_SDRAM_BASE + (32 << 20)) #ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0x80800000 #endif
I might even go so far as to say that's a clean-up. I do need to put this through it's paces tho on am335x and then work on converting the rest of the families.
Yes this looks similar to what I was fiddling with this morning. It's at u-boot-dm/spl-working. It's just finished a run through buildman so I'll resend v6. I made a change to the first patch to keep gdata around for non-DM boards (seems prudent just in case).
But, Albert, shall we put this in right after -rc3?
Regards, Simon
participants (2)
-
Simon Glass
-
Tom Rini