Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 090ab3ff authored by Simon Horman's avatar Simon Horman Committed by Russell King
Browse files

ARM: 6886/1: mmc, Add zboot from eSD support for SuperH Mobile ARM



This allows a ROM-able zImage to be written to eSD and for SuperH Mobile
ARM to boot directly from the SDHI 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.

Cc: Paul Mundt <lethal@linux-sh.org>
Acked-by: default avatarMagnus Damm <magnus.damm@gmail.com>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 74facffe
Loading
Loading
Loading
Loading
+42 −0
Original line number Original line Diff line number Diff line
ROM-able zImage boot from eSD
-----------------------------

An ROM-able zImage compiled with ZBOOT_ROM_SDHI may be written to eSD and
SuperH Mobile ARM will to boot directly from the SDHI 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 mackerel board using the developer 1A eSD
boot mode which is configured using the following jumper settings.

   8 7 6 5 4 3 2 1
   x|x|x|x| |x|x|
S4 -+-+-+-+-+-+-+-
    | | | |x| | |x on

The eSD card needs to be present in SDHI slot 1 (CN7).
As such S1 and S33 also need to be configured as per
the notes in arch/arm/mach-shmobile/board-mackerel.c.

A partial zImage must be written to physical partition #1 (boot)
of the eSD at sector 0 in vrl4 format. A utility vrl4 is supplied to
accomplish this.

e.g.
	vrl4 < zImage | dd of=/dev/sdX bs=512 count=17

A full copy of _the same_ zImage should be written to physical partition #1
(boot) of the eSD at sector 0. This should _not_ be in vrl4 format.

	vrl4 < zImage | dd of=/dev/sdX bs=512

Note: The commands above assume that the physical partition has been
switched. No such facility currently exists in the Linux Kernel.

Physical partitions are described in the eSD specification.  At the time of
writing they are not the same as partitions that are typically configured
using fdisk and visible through /proc/partitions
+25 −8
Original line number Original line Diff line number Diff line
@@ -1718,17 +1718,34 @@ config ZBOOT_ROM
	  Say Y here if you intend to execute your compressed kernel image
	  Say Y here if you intend to execute your compressed kernel image
	  (zImage) directly from ROM or flash.  If unsure, say N.
	  (zImage) directly from ROM or flash.  If unsure, say N.


choice
	prompt "Include SD/MMC loader in zImage (EXPERIMENTAL)"
	depends on ZBOOT_ROM && ARCH_SH7372 && EXPERIMENTAL
	default ZBOOT_ROM_NONE
	help
	  Include experimental SD/MMC 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 or SD 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.

config ZBOOT_ROM_NONE
	bool "No SD/MMC loader in zImage (EXPERIMENTAL)"
	help
	  Do not load image from SD or MMC

config ZBOOT_ROM_MMCIF
config ZBOOT_ROM_MMCIF
	bool "Include MMCIF loader in zImage (EXPERIMENTAL)"
	bool "Include MMCIF loader in zImage (EXPERIMENTAL)"
	depends on ZBOOT_ROM && ARCH_SH7372 && EXPERIMENTAL
	help
	help
	  Say Y here to include experimental MMCIF loading code in the
	  Load image from MMCIF hardware block.
	  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
config ZBOOT_ROM_SH_MOBILE_SDHI
	  kernel straight from the reset vector. At reset the processor
	bool "Include SuperH Mobile SDHI loader in zImage (EXPERIMENTAL)"
	  Mask ROM will load the first part of the the ROM-able zImage
	help
	  which in turn loads the rest the kernel image to RAM using the
	  Load image from SDHI hardware block
	  MMCIF hardware block.

endchoice


config CMDLINE
config CMDLINE
	string "Default kernel command string"
	string "Default kernel command string"
+8 −2
Original line number Original line Diff line number Diff line
@@ -6,13 +6,19 @@


OBJS		=
OBJS		=


# Ensure that mmcif loader code appears early in the image
# Ensure that MMCIF loader code appears early in the image
# to minimise that number of bocks that have to be read in
# to minimise that number of bocks that have to be read in
# order to load it.
# order to load it.
ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y)
ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y)
ifeq ($(CONFIG_ARCH_SH7372),y)
OBJS		+= mmcif-sh7372.o
OBJS		+= mmcif-sh7372.o
endif
endif

# Ensure that SDHI 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_SH_MOBILE_SDHI),y)
OBJS		+= sdhi-shmobile.o
OBJS		+= sdhi-sh7372.o
endif
endif


AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
+6 −6
Original line number Original line Diff line number Diff line
@@ -25,14 +25,14 @@
	/* load board-specific initialization code */
	/* load board-specific initialization code */
#include <mach/zboot.h>
#include <mach/zboot.h>


#ifdef CONFIG_ZBOOT_ROM_MMCIF
#if defined(CONFIG_ZBOOT_ROM_MMCIF) || defined(CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI)
	/* Load image from MMC */
	/* Load image from MMC/SD */
	adr	sp, __tmp_stack + 128
	adr	sp, __tmp_stack + 256
	ldr	r0, __image_start
	ldr	r0, __image_start
	ldr	r1, __image_end
	ldr	r1, __image_end
	subs	r1, r1, r0
	subs	r1, r1, r0
	ldr	r0, __load_base
	ldr	r0, __load_base
	bl	mmcif_loader
	bl	mmc_loader


	/* Jump to loaded code */
	/* Jump to loaded code */
	ldr	r0, __loaded
	ldr	r0, __loaded
@@ -51,9 +51,9 @@ __loaded:
	.long	__continue
	.long	__continue
	.align
	.align
__tmp_stack:
__tmp_stack:
	.space	128
	.space	256
__continue:
__continue:
#endif /* CONFIG_ZBOOT_ROM_MMCIF */
#endif /* CONFIG_ZBOOT_ROM_MMC || CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI */


	b	1f
	b	1f
__atags:@ tag #1
__atags:@ tag #1
+1 −1
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@
 * to an MMC card
 * to an MMC card
 * # dd if=vrl4.out of=/dev/sdx bs=512 seek=1
 * # dd if=vrl4.out of=/dev/sdx bs=512 seek=1
 */
 */
asmlinkage void mmcif_loader(unsigned char *buf, unsigned long len)
asmlinkage void mmc_loader(unsigned char *buf, unsigned long len)
{
{
	mmc_init_progress();
	mmc_init_progress();
	mmc_update_progress(MMC_PROGRESS_ENTER);
	mmc_update_progress(MMC_PROGRESS_ENTER);
Loading