SPL: Port SPL framework to powerpc
v4 cover SPL: Port SPL framework to powerpc
This patchset ports the SPL framework to powerpc. Its based on the SPL generalization lately done by Tom Rini. The patches is based on the current "next" branch.
Additionally, a new MPC5200 board port is included, the a3m071 board port. This board port uses this SPL framework mainly to speed up booting into the OS (Linux of course). Detection of Linux vs. U-Boot booting is done here by checking the environment variable "boot_os". If "boot_os" is set to "yes", then the OS (Linux) is booted. Otherwise the "real" U-Boot is booted. For this env checking in the SPL, a small restructuring of the env code has been done.
Comments welcome!
Thanks,
Stefan
Changes in v4:
- Build spl.o only for SPL image
- getenv_f not extracted into separate file. Only Makefile additions for SPL_BUILD needed.
- Add remark to call "fdt chosen" to board/a3m071/README
- Configure PCS2 as CODEC2 (SPI)
- Drop patch fdt: cmd_fdt: Call fdt_chosen() from "fdt boardsetup"
Changes in v3:
- Rebased on current master plus SPL framework v7
- Don't use special MPC5xxx memcpy in SPL
- Move linker symbols to header spl.h (checkpatch)
Changes in v2:
- Rebased on Tom's SPL framework patches v4
- Add option to skip copying of the mkimage header
- Rebased on Tom's SPL framework patches v4
- Rebased on Tom's SPL framework patches v4
- a3m071 build: Concat SPL binary and u-boot.img directly (no padding)
Stefan Roese (7):
powerpc: Extract EPAPR_MAGIC constants into processor.h
SPL: Port SPL framework to powerpc
env: Enable getenv_f() for SPL_BUILD
mpc5200: Add SPL support
mpc5200: Add a3m071 board support
Makefile: Add possibility to set entry-point for u-boot.img
Makefile: Add target for combined spl/u-boot.bin & u-boot.img
MAINTAINERS | 2 + Makefile | 14 +- arch/powerpc/cpu/mpc5xxx/Makefile | 4 + arch/powerpc/cpu/mpc5xxx/spl_boot.c | 79 +++++++ arch/powerpc/cpu/mpc5xxx/start.S | 22 ++ arch/powerpc/cpu/mpc5xxx/u-boot-spl.lds | 57 +++++ arch/powerpc/include/asm/processor.h | 6 + arch/powerpc/include/asm/spl.h | 31 +++ arch/powerpc/lib/Makefile | 14 ++ arch/powerpc/lib/bootm.c | 6 - arch/powerpc/lib/spl.c | 42 ++++ board/a3m071/Makefile | 36 +++ board/a3m071/README | 80 +++++++ board/a3m071/a3m071.c | 335 +++++++++++++++++++++++++++ board/a3m071/mt46v16m16-75.h | 32 +++ boards.cfg | 1 + common/Makefile | 3 + common/spl/spl.c | 10 + include/configs/a3m071.h | 385 ++++++++++++++++++++++++++++++++ 19 files changed, 1152 insertions(+), 7 deletions(-) create mode 100644 arch/powerpc/cpu/mpc5xxx/spl_boot.c create mode 100644 arch/powerpc/cpu/mpc5xxx/u-boot-spl.lds create mode 100644 arch/powerpc/include/asm/spl.h create mode 100644 arch/powerpc/lib/spl.c create mode 100644 board/a3m071/Makefile create mode 100644 board/a3m071/README create mode 100644 board/a3m071/a3m071.c create mode 100644 board/a3m071/mt46v16m16-75.h create mode 100644 include/configs/a3m071.h
Signature · 1 line
1.7.12.2
PATCH v4 1/7 powerpc: Extract EPAPR_MAGIC constants into processor.h
By extracting these defines into a header, they can be re-used by other C sources as well. This will be done by the SPL framework OS boot support.
---
arch/powerpc/include/asm/processor.h | 6 ++++++ arch/powerpc/lib/bootm.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/processor.h +6 -0
@@ -1331,4 +1331,10 @@ void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);#endif #endif /* CONFIG_MACH_SPECIFIC */ +#if defined(CONFIG_MPC85xx) || defined(CONFIG_440 ) +#define EPAPR_MAGIC (0x45504150) +#else +#define EPAPR_MAGIC (0x65504150) +#endif +#endif /* __ASM_PPC_PROCESSOR_H */
arch/powerpc/lib/bootm.c +0 -6
@@ -87,12 +87,6 @@ static void boot_jump_linux(bootm_headers_t *images)* r8: 0 * r9: 0 */ -#if defined(CONFIG_MPC85xx) || defined(CONFIG_440 ) -#define EPAPR_MAGIC (0x45504150) -#else -#define EPAPR_MAGIC (0x65504150) -#endif -debug (" Booting using OF flat tree...\n" );WATCHDOG_RESET (); (*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
Signature · 1 line
1.7.12.2
PATCH v4 2/7 SPL: Port SPL framework to powerpc
In reply to Stefan RoeseThis patch enables the SPL framework to be used on powerpc platforms and not only ARM.
---
Changes in v4:
- Build spl.o only for SPL image
Changes in v2:
- Rebased on Tom's SPL framework patches v4
- Add option to skip copying of the mkimage header
arch/powerpc/lib/Makefile | 4 ++++ arch/powerpc/lib/spl.c | 42 ++++++++++++++++++++++++++++++++++++++++++ common/spl/spl.c | 10 ++++++++++ 3 files changed, 56 insertions(+) create mode 100644 arch/powerpc/lib/spl.c
arch/powerpc/lib/Makefile +4 -0
@@ -63,6 +63,10 @@ $(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy COBJS-y += memcpy_mpc5200.o endif +ifdef CONFIG_SPL_BUILD +COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o +endif + COBJS += $(sort $(COBJS-y)) SRCS := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
arch/powerpc/lib/spl.c new file +42 -0
42 lines not on this page · raw message
common/spl/spl.c +10 -0
@@ -74,6 +74,16 @@ __weak int spl_start_uboot(void) }#endif +/* +* Weak default function for board specific cleanup/preparation before +* Linux boot. Some boards/platforms might now need it, so just provide +* an empty stub here. +*/ +__weak void spl_board_prepare_for_linux (void ) +{ +/* Nothing to do! */ +} +void spl_parse_image_header (const struct image_header *header) {u32 header_size =sizeof (struct image_header );
Signature · 1 line
1.7.12.2
PATCH v4 3/7 env: Enable getenv_f() for SPL_BUILD
In reply to Stefan RoeseWith this patch, getenv_f() can be included easily into the SPL binary. With this, SPL boards can now use getenv_f() to read environment variables (e.g. to detect if the OS or U-Boot shall be executed).
In the approach this is done for env stored in NOR flash, as this will be used by an upcoming MPC5200 board port.
---
Changes in v4:
- getenv_f not extracted into separate file. Only Makefile additions for SPL_BUILD needed.
Changes in v3:
- Rebased on current master plus SPL framework v7
common/Makefile | 3 +++ 1 file changed, 3 insertions(+)
common/Makefile +3 -0
@@ -197,6 +197,9 @@ COBJS-$(CONFIG_CMD_DFU) += cmd_dfu.o endif ifdef CONFIG_SPL_BUILD +COBJS-y += cmd_nvedit.o +COBJS-y += env_common.o +COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += cmd_nvedit.o COBJS-$(CONFIG_SPL_NET_SUPPORT) += env_common.o
Signature · 1 line
1.7.12.2
PATCH v4 4/7 mpc5200: Add SPL support
In reply to Stefan RoeseThis patch adds SPL booting support (NOR flash) for the MPC5200 platforms.
---
Changes in v3:
- Don't use special MPC5xxx memcpy in SPL
- Move linker symbols to header spl.h (checkpatch)
Changes in v2:
- Rebased on Tom's SPL framework patches v4
arch/powerpc/cpu/mpc5xxx/Makefile | 4 ++ arch/powerpc/cpu/mpc5xxx/spl_boot.c | 79 +++++++++++++++++++++++++++++++++ arch/powerpc/cpu/mpc5xxx/start.S | 22 +++++++++ arch/powerpc/cpu/mpc5xxx/u-boot-spl.lds | 57 ++++++++++++++++++++++++ arch/powerpc/include/asm/spl.h | 31 +++++++++++++ arch/powerpc/lib/Makefile | 10 +++++ 6 files changed, 203 insertions(+) create mode 100644 arch/powerpc/cpu/mpc5xxx/spl_boot.c create mode 100644 arch/powerpc/cpu/mpc5xxx/u-boot-spl.lds create mode 100644 arch/powerpc/include/asm/spl.h
arch/powerpc/cpu/mpc5xxx/Makefile +4 -0
@@ -41,6 +41,10 @@ COBJS-y += speed.o COBJS-$(CONFIG_CMD_USB) += usb_ohci.o COBJS-$(CONFIG_CMD_USB) += usb.o +ifdef CONFIG_SPL_BUILD +COBJS-y += spl_boot.o +endif + SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) START := $(addprefix $(obj),$(SSTART) $(CSTART))
arch/powerpc/cpu/mpc5xxx/spl_boot.c new file +79 -0
79 lines not on this page · raw message
arch/powerpc/cpu/mpc5xxx/start.S +22 -0
@@ -50,6 +50,7 @@ #define MSR_KERNEL (MSR_FP|MSR_ME|MSR_RI) #endif +#ifndef CONFIG_SPL_BUILD /* * Set up GOT: Global Offset Table *
@@ -68,6 +69,7 @@ GOT_ENTRY(__bss_end__) GOT_ENTRY(__bss_start) END_GOT +#endif /* * Version string
@@ -84,6 +86,18 @@ version_string: . = EXC_OFF_SYS_RESET .globl _start _start: + +#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD) + /* + * This is the entry of the real U-Boot from a board port + * that supports SPL booting on the MPC5200. We only need + * to call board_init_f() here. Everything else has already + * been done in the SPL u-boot version. + */ + GET_GOT /* initialize GOT access */ + bl board_init_f /* run 1st part of board init code (in Flash)*/ + /* NOTREACHED - board_init_f() does not return */ +#else mfmsr r5 /* save msr contents */ /* Move CSBoot and adjust instruction pointer */
@@ -152,7 +166,9 @@ lowboot_reentry: /* Be careful to keep code relocatable ! */ /*--------------------------------------------------------------*/ +#ifndef CONFIG_SPL_BUILD GET_GOT /* initialize GOT access */ +#endif /* r3: IMMR */ bl cpu_init_f /* run low-level CPU init code (in Flash)*/
@@ -160,7 +176,9 @@ lowboot_reentry: bl board_init_f /* run 1st part of board init code (in Flash)*/ /* NOTREACHED - board_init_f() does not return */ +#endif +#ifndef CONFIG_SPL_BUILD /* * Vector Table */
@@ -333,6 +351,7 @@ int_return: lwz r1,GPR1(r1) SYNC rfi +#endif /* CONFIG_SPL_BUILD */ /* * This code initialises the MPC5xxx processor core
@@ -522,6 +541,7 @@ get_pvr: mfspr r3, PVR blr +#ifndef CONFIG_SPL_BUILD /*------------------------------------------------------------------------------*/ /*
@@ -759,3 +779,5 @@ trap_init: mtlr r4 /* restore link register */ blr + +#endif /* CONFIG_SPL_BUILD */
arch/powerpc/cpu/mpc5xxx/u-boot-spl.lds new file +57 -0
57 lines not on this page · raw message
arch/powerpc/include/asm/spl.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* (C) Copyright 2012 +* Texas Instruments, <www.ti.com> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +#ifndef _ASM_SPL_H_ +#define _ASM_SPL_H_ + +#define BOOT_DEVICE_NOR 1 + +/* Linker symbols */ +extern char __bss_start[], __bss_end__[]; + +#endif
arch/powerpc/lib/Makefile +10 -0
@@ -44,7 +44,9 @@ SOBJS-y += ticks.o SOBJS-y += reloc.o COBJS-$(CONFIG_BAT_RW) += bat_rw.o +ifndef CONFIG_SPL_BUILD COBJS-y += board.o +endif COBJS-y += bootm.o COBJS-y += cache.o COBJS-y += extable.o
@@ -52,6 +54,11 @@ COBJS-y += interrupts.o COBJS-$(CONFIG_CMD_KGDB) += kgdb.o COBJS-y += time.o +# Don't include the MPC5xxx special memcpy into the +# SPL U-Boot image. memcpy is used in the SPL NOR +# flash driver. And we need the real, fast memcpy +# here. We have no problems with unaligned access. +ifndef CONFIG_SPL_BUILD # Workaround for local bus unaligned access problems # on MPC512x and MPC5200 ifdef CONFIG_MPC512X
@@ -62,6 +69,7 @@ ifdef CONFIG_MPC5200 $(obj)ppcstring.o: AFLAGS += -Dmemcpy=__memcpy COBJS-y += memcpy_mpc5200.o endif +endif ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
@@ -78,12 +86,14 @@ TARGETS += $(LIB) all: $(TARGETS) $(LIB): $(obj).depend $(OBJS) +ifndef CONFIG_SPL_BUILD @if ! $(CROSS_COMPILE)readelf -S $(OBJS) | grep -q '\.fixup.*PROGBITS';\ then \ echo "ERROR: Your compiler doesn't generate .fixup sections!";\ echo " Upgrade to a recent toolchain."; \ exit 1; \ fi; +endif $(call cmd_link_o_target, $(OBJS)) $(LIBGCC): $(obj).depend $(LGOBJS)
Signature · 1 line
1.7.12.2
PATCH v4 5/7 mpc5200: Add a3m071 board support
In reply to Stefan RoeseThis patch adds support for the a3m071 board based on the MPC5200.
---
Changes in v4:
- Add remark to call "fdt chosen" to board/a3m071/README
- Configure PCS2 as CODEC2 (SPI)
Changes in v2:
- Rebased on Tom's SPL framework patches v4
- a3m071 build: Concat SPL binary and u-boot.img directly (no padding)
MAINTAINERS | 2 + board/a3m071/Makefile | 36 ++++ board/a3m071/README | 80 +++++++++ board/a3m071/a3m071.c | 335 +++++++++++++++++++++++++++++++++++++ board/a3m071/mt46v16m16-75.h | 32 ++++ boards.cfg | 1 + include/configs/a3m071.h | 385 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 871 insertions(+) create mode 100644 board/a3m071/Makefile create mode 100644 board/a3m071/README create mode 100644 board/a3m071/a3m071.c create mode 100644 board/a3m071/mt46v16m16-75.h create mode 100644 include/configs/a3m071.h
MAINTAINERS +2 -0
@@ -395,6 +395,8 @@ Ricardo Ribalda <[email protected]> Stefan Roese <[email protected]> + a3m071 MPC5200 + P3M7448 MPC7448 uc100 MPC857
board/a3m071/Makefile new file +36 -0
@@ -0,0 +1,36 @@ +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := $(BOARD).o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/a3m071/README new file +80 -0
80 lines not on this page · raw message
board/a3m071/a3m071.c new file +335 -0
335 lines not on this page · raw message
board/a3m071/mt46v16m16-75.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* (C) Copyright 2004 +* Mark Jonas, Freescale Semiconductor, mark.jonas at motorola.com. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#define SDRAM_DDR /* is DDR */ + +#if defined(CONFIG_MPC5200 ) +/* Settings for XLB = 132 MHz */ +#define SDRAM_MODE 0x018D0000 +#define SDRAM_EMODE 0x40090000 +#define SDRAM_CONTROL 0x704f0f00 +#define SDRAM_CONFIG1 0x73722930 +#define SDRAM_CONFIG2 0x47770000 +#define SDRAM_TAPDELAY 0x10000000 + +#else +#error CONFIG_MPC5200 not defined +#endif
boards.cfg +1 -0
@@ -453,6 +453,7 @@ mpc5121ads powerpc mpc512x mpc5121ads freesca mpc5121ads_rev2 powerpc mpc512x mpc5121ads freescale - mpc5121ads:MPC5121ADS_REV2 cmi_mpc5xx powerpc mpc5xx cmi PATI powerpc mpc5xx pati mpl +a3m071 powerpc mpc5xxx a3m071 a4m072 powerpc mpc5xxx a4m072 BC3450 powerpc mpc5xxx bc3450 canmb powerpc mpc5xxx
include/configs/a3m071.h new file +385 -0
385 lines not on this page · raw message
Signature · 1 line
1.7.12.2
PATCH v4 6/7 Makefile: Add possibility to set entry-point for u-boot.img
In reply to Stefan RoeseThis patch enabled boards using the SPL framework to set an entry point in the U-Boot mkimage image "u-boot.img". Until now the entry point in the header has been set to 0. By setting CONFIG_SYS_UBOOT_START in the board header, boards can override this default location.
This will be used by the upcoming a3m071 MPC5200 board port.
---
Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Makefile +10 -1
@@ -423,9 +423,18 @@ $(obj)u-boot.ldr.hex: $(obj)u-boot.ldr $(obj)u-boot.ldr.srec: $(obj)u-boot.ldr $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary +# +# U-Boot entry point, needed for booting of full-blown U-Boot +# from the SPL U-Boot version. +# +ifndef CONFIG_SYS_UBOOT_START +CONFIG_SYS_UBOOT_START := 0 +endif + $(obj)u-boot.img: $(obj)u-boot.bin $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ - -O u-boot -a $(CONFIG_SYS_TEXT_BASE) -e 0 \ + -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \ + -e $(CONFIG_SYS_UBOOT_START) \ -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ -d $< $@
Signature · 1 line
1.7.12.2
PATCH v4 7/7 Makefile: Add target for combined spl/u-boot.bin & u-boot.img
In reply to Stefan RoeseThis new make target "u-boot-img.bin" consists of the U-Boot SPL image with the real, full-blown U-Boot image directly attached to it. The full-blown U-Boot image has the mkimage header included, with its load-address and entry-point.
This will be used by the upcoming a3m071 MPC5200 board port.
---
Changes in v4:
- Drop patch fdt: cmd_fdt: Call fdt_chosen() from "fdt boardsetup"
Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -515,6 +515,9 @@ $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin endif endif +$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img + cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@ + ifeq ($(CONFIG_SANDBOX),y) GEN_UBOOT = \ cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
Signature · 1 line
1.7.12.2