mmc, ARM: Add zboot from MMC support for SuperH Mobile ARM
Subsystems (6)
PATCH v5 1/1 mmc, ARM: Add zboot from MMC support for SuperH Mobile ARM
This allows a ROM-able zImage to be written to MMC and for SuperH Mobile ARM to boot directly from the MMCIF hardware block.
This is achieved by the MaskROM loading the first portion of the image into MERAM and then jumping to it. This portion contains loader code which copies the entire image to SDRAM and jumps to it. From there the zImage boot code proceeds as normal, uncompressing the image into its final location and then jumping to it.
This patch depends on:
* "ARM: 6514/1: mach-shmobile: Add zboot support for SuperH Mobile ARM" which has been merged into the devel branch of Russell King's linux-2.6-arm tree.
* "mmc, sh: Move MMCIF_PROGRESS_* into sh_mmcif.h"
which has been merged into the common/mmcif branch of
Paul Mundt's sh-2.6 tree
* "mmc, sh: Remove sh_mmcif_boot_slurp()"
which has been merged into the common/mmcif branch of
Paul Mundt's sh-2.6 tree
v2:
Addressed comments by Magnus Damm
* Fix copyright in vrl4.c
* Fix use of #define CONFIG_ZBOOT_ROM_MMCIF in mmcif-sh7372.c
* Initialise LED GPIO lines in head-ap4evb.txt instead of mmcif-sh7372.c as this is considered board-specific.
v3:
Addressed comments made in person by Magnus Damm
* Move mmcif_loader to be earlier in the image and
reduce the number of blocks of boot program loaded by the MaskRom from 40 to 8 accordingly.
* Move LED GPIO initialisation into mmcif_progress_init
- This leaves the partner jet script unbloated
Other
* inline mmcif_update_progress so it is a static inline in a header file
v4:
* Use htole16() and htole32() in v4rl.c to ensure
that the output is little endian
v5:
Addressed comments by Russell King
* Simplify assembly code
* Jump to code rather than an address <- bug fix
* Use (void __iomem *) as appropriate
Roll in mackerel support
* This was previously a separate patch, only because of the order in which this code was developed
--- Documentation/arm/SH-Mobile/Makefile | 8 + Documentation/arm/SH-Mobile/vrl4.c | 169 ++++++++++++++++++++ Documentation/arm/SH-Mobile/zboot-rom-mmcif.txt | 29 ++++ arch/arm/Kconfig | 12 ++ arch/arm/boot/compressed/Makefile | 13 ++- arch/arm/boot/compressed/head-shmobile.S | 30 ++++ arch/arm/boot/compressed/mmcif-sh7372.c | 87 ++++++++++ arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h | 29 ++++ .../mach-shmobile/include/mach/mmcif-mackerel.h | 39 +++++ arch/arm/mach-shmobile/include/mach/mmcif.h | 18 ++ 10 files changed, 433 insertions(+), 1 deletions(-) create mode 100644 Documentation/arm/SH-Mobile/Makefile create mode 100644 Documentation/arm/SH-Mobile/vrl4.c create mode 100644 Documentation/arm/SH-Mobile/zboot-rom-mmcif.txt create mode 100644 arch/arm/boot/compressed/mmcif-sh7372.c create mode 100644 arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h create mode 100644 arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h create mode 100644 arch/arm/mach-shmobile/include/mach/mmcif.h
Documentation/arm/SH-Mobile/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +BIN := vrl4 + +.PHONY: all +all: $(BIN) + +.PHONY: clean +clean: + rm -f *.o $(BIN)
Documentation/arm/SH-Mobile/vrl4.c new file +169 -0
169 lines not on this page · raw message
Documentation/arm/SH-Mobile/zboot-rom-mmcif.txt new file +29 -0
@@ -0,0 +1,29 @@ +ROM-able zImage boot from MMC +----------------------------- + +An ROM-able zImage compiled with ZBOOT_ROM_MMCIF may be written to MMC and +SuperH Mobile ARM will to boot directly from the MMCIF hardware block. + +This is achieved by the mask ROM loading the first portion of the image into +MERAM and then jumping to it. This portion contains loader code which +copies the entire image to SDRAM and jumps to it. From there the zImage +boot code proceeds as normal, uncompressing the image into its final +location and then jumping to it. + +This code has been tested on an AP4EB board using the developer 1A eMMC +boot mode which is configured using the following jumper settings. +The board used for testing required a patched mask ROM in order for +this mode to function. + + 8 7 6 5 4 3 2 1 + x|x|x|x|x| |x| +S4 -+-+-+-+-+-+-+- + | | | | |x| |x on + +The zImage must be written to the MMC card@sector 1 (512 bytes) in +vrl4 format. A utility vrl4 is supplied to accomplish this. + +e.g. + vrl4 < zImage | dd of=/dev/sdX bs=512 seek=1 + +A dual-voltage MMC 4.0 card was used for testing.
arch/arm/Kconfig +12 -0
@@ -1582,6 +1582,18 @@ config ZBOOT_ROM Say Y here if you intend to execute your compressed kernel image (zImage) directly from ROM or flash. If unsure, say N. +config ZBOOT_ROM_MMCIF + bool "Include MMCIF loader in zImage (EXPERIMENTAL)" + depends on ZBOOT_ROM && ARCH_SH7372 && EXPERIMENTAL + help + Say Y here to include experimental MMCIF loading code in the + ROM-able zImage. With this enabled it is possible to write the + the ROM-able zImage kernel image to an MMC card and boot the + kernel straight from the reset vector. At reset the processor + Mask ROM will load the first part of the the ROM-able zImage + which in turn loads the rest the kernel image to RAM using the + MMCIF hardware block. + config CMDLINE string "Default kernel command string" default ""
arch/arm/boot/compressed/Makefile +12 -1
@@ -4,9 +4,20 @@ # create a compressed vmlinuz image from the original vmlinux # +OBJS = + +# Ensure that mmcif loader code appears early in the image +# to minimise that number of bocks that have to be read in +# order to load it. +ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y) +ifeq ($(CONFIG_ARCH_SH7372),y) +OBJS += mmcif-sh7372.o +endif +endif + AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) HEAD = head.o -OBJS = misc.o decompress.o +OBJS += misc.o decompress.o FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c #
arch/arm/boot/compressed/head-shmobile.S +30 -0
@@ -25,6 +25,36 @@ /* load board-specific initialization code */ #include <mach/zboot.h> +#ifdef CONFIG_ZBOOT_ROM_MMCIF + /* Load image from MMC */ + adr sp, __tmp_stack + 128 + ldr r0, __image_start + ldr r1, __image_end + subs r1, r1, r0 + ldr r0, __load_base + bl mmcif_loader + + /* Jump to loaded code */ + ldr r0, __loaded + ldr r1, __image_start + sub r0, r0, r1 + ldr r1, __load_base + add pc, r0, r1 + +__image_start: + .long _start +__image_end: + .long _got_end +__load_base: + .long CONFIG_MEMORY_START + 0x02000000 @ Load at 32Mb into SDRAM +__loaded: + .long __continue + .align +__tmp_stack: + .space 128 +__continue: +#endif /* CONFIG_ZBOOT_ROM_MMCIF */ + b 1f __atags:@ tag #1 .long 12 @ tag->hdr.size = tag_size(tag_core);
arch/arm/boot/compressed/mmcif-sh7372.c new file +87 -0
87 lines not on this page · raw message
arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef MMCIF_AP4EB_H +#define MMCIF_AP4EB_H + +#define PORT185CR (void __iomem *)0xe60520b9 +#define PORT186CR (void __iomem *)0xe60520ba +#define PORT187CR (void __iomem *)0xe60520bb +#define PORT188CR (void __iomem *)0xe60520bc + +#define PORTR191_160DR (void __iomem *)0xe6056014 + +static inline void mmcif_init_progress (void ) +{ +/* Initialise LEDS1-4 +* registers: PORT185CR-PORT188CR (LED1-LED4 Control) +* value: 0x10 - enable output +*/ +__raw_writeb (0x10 ,PORT185CR ); +__raw_writeb (0x10 ,PORT186CR ); +__raw_writeb (0x10 ,PORT187CR ); +__raw_writeb (0x10 ,PORT188CR ); +} + +static inline void mmcif_update_progress (int n) +{ +__raw_writel ((__raw_readl (PORTR191_160DR ) & ~(0xf <<25 )) | + (1 << (25 + n)),PORTR191_160DR ); +} + +#endif /* MMCIF_AP4EB_H */
arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h new file +39 -0
@@ -0,0 +1,39 @@ +#ifndef MMCIF_MACKEREL_H +#define MMCIF_MACKEREL_H + +#define PORT0CR (void __iomem *)0xe6051000 +#define PORT1CR (void __iomem *)0xe6051001 +#define PORT2CR (void __iomem *)0xe6051002 +#define PORT159CR (void __iomem *)0xe605009f + +#define PORTR031_000DR (void __iomem *)0xe6055000 +#define PORTL159_128DR (void __iomem *)0xe6054010 + +static inline void mmcif_init_progress (void ) +{ +/* Initialise LEDS0-3 +* registers: PORT0CR-PORT2CR,PORT159CR (LED0-LED3 Control) +* value: 0x10 - enable output +*/ +__raw_writeb (0x10 ,PORT0CR ); +__raw_writeb (0x10 ,PORT1CR ); +__raw_writeb (0x10 ,PORT2CR ); +__raw_writeb (0x10 ,PORT159CR ); +} + +static inline void mmcif_update_progress (int n) +{ +unsigned a =0 , b =0 ; + +if (n <3 ) + a =1 << n; +else + b =1 <<31 ; + +__raw_writel ((__raw_readl (PORTR031_000DR ) & ~0x7 ) | a, +PORTR031_000DR ); +__raw_writel ((__raw_readl (PORTL159_128DR ) & ~(1 <<31 )) | b, +PORTL159_128DR ); +} + +#endif /* MMCIF_MACKEREL_H */
arch/arm/mach-shmobile/include/mach/mmcif.h new file +18 -0
@@ -0,0 +1,18 @@ +#ifndef MMCIF_H +#define MMCIF_H + +/************************************************** +* +* board specific settings +* +**************************************************/ + +#ifdef CONFIG_MACH_AP4EVB +#include "mach/mmcif-ap4eb.h" +#elif CONFIG_MACH_MACKEREL +#include "mach/mmcif-mackerel.h" +#else +#error "unsupported board." +#endif + +#endif /* MMCIF_H */
Signature · 1 line
1.7.2.3