diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/Kconfig | 12 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/Makefile | 13 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/head-shmobile.S | 30 | ||||
| -rw-r--r-- | arch/arm/boot/compressed/mmcif-sh7372.c | 87 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h | 29 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h | 39 | ||||
| -rw-r--r-- | arch/arm/mach-shmobile/include/mach/mmcif.h | 18 |
7 files changed, 227 insertions, 1 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5cff165b7eb0..2d0a1dc15994 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -1619,6 +1619,18 @@ config ZBOOT_ROM | |||
| 1619 | Say Y here if you intend to execute your compressed kernel image | 1619 | Say Y here if you intend to execute your compressed kernel image |
| 1620 | (zImage) directly from ROM or flash. If unsure, say N. | 1620 | (zImage) directly from ROM or flash. If unsure, say N. |
| 1621 | 1621 | ||
| 1622 | config ZBOOT_ROM_MMCIF | ||
| 1623 | bool "Include MMCIF loader in zImage (EXPERIMENTAL)" | ||
| 1624 | depends on ZBOOT_ROM && ARCH_SH7372 && EXPERIMENTAL | ||
| 1625 | help | ||
| 1626 | Say Y here to include experimental MMCIF loading code in the | ||
| 1627 | ROM-able zImage. With this enabled it is possible to write the | ||
| 1628 | the ROM-able zImage kernel image to an MMC card and boot the | ||
| 1629 | kernel straight from the reset vector. At reset the processor | ||
| 1630 | Mask ROM will load the first part of the the ROM-able zImage | ||
| 1631 | which in turn loads the rest the kernel image to RAM using the | ||
| 1632 | MMCIF hardware block. | ||
| 1633 | |||
| 1622 | config CMDLINE | 1634 | config CMDLINE |
| 1623 | string "Default kernel command string" | 1635 | string "Default kernel command string" |
| 1624 | default "" | 1636 | default "" |
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 0a8f748e506a..198007d0a7ed 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile | |||
| @@ -4,9 +4,20 @@ | |||
| 4 | # create a compressed vmlinuz image from the original vmlinux | 4 | # create a compressed vmlinuz image from the original vmlinux |
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | OBJS = | ||
| 8 | |||
| 9 | # Ensure that mmcif loader code appears early in the image | ||
| 10 | # to minimise that number of bocks that have to be read in | ||
| 11 | # order to load it. | ||
| 12 | ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y) | ||
| 13 | ifeq ($(CONFIG_ARCH_SH7372),y) | ||
| 14 | OBJS += mmcif-sh7372.o | ||
| 15 | endif | ||
| 16 | endif | ||
| 17 | |||
| 7 | AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) | 18 | AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) |
| 8 | HEAD = head.o | 19 | HEAD = head.o |
| 9 | OBJS = misc.o decompress.o | 20 | OBJS += misc.o decompress.o |
| 10 | FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c | 21 | FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c |
| 11 | 22 | ||
| 12 | # | 23 | # |
diff --git a/arch/arm/boot/compressed/head-shmobile.S b/arch/arm/boot/compressed/head-shmobile.S index 30973b76e6ae..c943d2e7da9d 100644 --- a/arch/arm/boot/compressed/head-shmobile.S +++ b/arch/arm/boot/compressed/head-shmobile.S | |||
| @@ -25,6 +25,36 @@ | |||
| 25 | /* load board-specific initialization code */ | 25 | /* load board-specific initialization code */ |
| 26 | #include <mach/zboot.h> | 26 | #include <mach/zboot.h> |
| 27 | 27 | ||
| 28 | #ifdef CONFIG_ZBOOT_ROM_MMCIF | ||
| 29 | /* Load image from MMC */ | ||
| 30 | adr sp, __tmp_stack + 128 | ||
| 31 | ldr r0, __image_start | ||
| 32 | ldr r1, __image_end | ||
| 33 | subs r1, r1, r0 | ||
| 34 | ldr r0, __load_base | ||
| 35 | bl mmcif_loader | ||
| 36 | |||
| 37 | /* Jump to loaded code */ | ||
| 38 | ldr r0, __loaded | ||
| 39 | ldr r1, __image_start | ||
| 40 | sub r0, r0, r1 | ||
| 41 | ldr r1, __load_base | ||
| 42 | add pc, r0, r1 | ||
| 43 | |||
| 44 | __image_start: | ||
| 45 | .long _start | ||
| 46 | __image_end: | ||
| 47 | .long _got_end | ||
| 48 | __load_base: | ||
| 49 | .long CONFIG_MEMORY_START + 0x02000000 @ Load at 32Mb into SDRAM | ||
| 50 | __loaded: | ||
| 51 | .long __continue | ||
| 52 | .align | ||
| 53 | __tmp_stack: | ||
| 54 | .space 128 | ||
| 55 | __continue: | ||
| 56 | #endif /* CONFIG_ZBOOT_ROM_MMCIF */ | ||
| 57 | |||
| 28 | b 1f | 58 | b 1f |
| 29 | __atags:@ tag #1 | 59 | __atags:@ tag #1 |
| 30 | .long 12 @ tag->hdr.size = tag_size(tag_core); | 60 | .long 12 @ tag->hdr.size = tag_size(tag_core); |
diff --git a/arch/arm/boot/compressed/mmcif-sh7372.c b/arch/arm/boot/compressed/mmcif-sh7372.c new file mode 100644 index 000000000000..e6180af241f6 --- /dev/null +++ b/arch/arm/boot/compressed/mmcif-sh7372.c | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* | ||
| 2 | * sh7372 MMCIF loader | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Magnus Damm | ||
| 5 | * Copyright (C) 2010 Simon Horman | ||
| 6 | * | ||
| 7 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 8 | * License. See the file "COPYING" in the main directory of this archive | ||
| 9 | * for more details. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/mmc/sh_mmcif.h> | ||
| 13 | #include <mach/mmcif.h> | ||
| 14 | |||
| 15 | #define MMCIF_BASE (void __iomem *)0xe6bd0000 | ||
| 16 | |||
| 17 | #define PORT84CR (void __iomem *)0xe6050054 | ||
| 18 | #define PORT85CR (void __iomem *)0xe6050055 | ||
| 19 | #define PORT86CR (void __iomem *)0xe6050056 | ||
| 20 | #define PORT87CR (void __iomem *)0xe6050057 | ||
| 21 | #define PORT88CR (void __iomem *)0xe6050058 | ||
| 22 | #define PORT89CR (void __iomem *)0xe6050059 | ||
| 23 | #define PORT90CR (void __iomem *)0xe605005a | ||
| 24 | #define PORT91CR (void __iomem *)0xe605005b | ||
| 25 | #define PORT92CR (void __iomem *)0xe605005c | ||
| 26 | #define PORT99CR (void __iomem *)0xe6050063 | ||
| 27 | |||
| 28 | #define SMSTPCR3 (void __iomem *)0xe615013c | ||
| 29 | |||
| 30 | /* SH7372 specific MMCIF loader | ||
| 31 | * | ||
| 32 | * loads the zImage from an MMC card starting from block 1. | ||
| 33 | * | ||
| 34 | * The image must be start with a vrl4 header and | ||
| 35 | * the zImage must start at offset 512 of the image. That is, | ||
| 36 | * at block 2 (=byte 1024) on the media | ||
| 37 | * | ||
| 38 | * Use the following line to write the vrl4 formated zImage | ||
| 39 | * to an MMC card | ||
| 40 | * # dd if=vrl4.out of=/dev/sdx bs=512 seek=1 | ||
| 41 | */ | ||
| 42 | asmlinkage void mmcif_loader(unsigned char *buf, unsigned long len) | ||
| 43 | { | ||
| 44 | mmcif_init_progress(); | ||
| 45 | mmcif_update_progress(MMCIF_PROGRESS_ENTER); | ||
| 46 | |||
| 47 | /* Initialise MMC | ||
| 48 | * registers: PORT84CR-PORT92CR | ||
| 49 | * (MMCD0_0-MMCD0_7,MMCCMD0 Control) | ||
| 50 | * value: 0x04 - select function 4 | ||
| 51 | */ | ||
| 52 | __raw_writeb(0x04, PORT84CR); | ||
| 53 | __raw_writeb(0x04, PORT85CR); | ||
| 54 | __raw_writeb(0x04, PORT86CR); | ||
| 55 | __raw_writeb(0x04, PORT87CR); | ||
| 56 | __raw_writeb(0x04, PORT88CR); | ||
| 57 | __raw_writeb(0x04, PORT89CR); | ||
| 58 | __raw_writeb(0x04, PORT90CR); | ||
| 59 | __raw_writeb(0x04, PORT91CR); | ||
| 60 | __raw_writeb(0x04, PORT92CR); | ||
| 61 | |||
| 62 | /* Initialise MMC | ||
| 63 | * registers: PORT99CR (MMCCLK0 Control) | ||
| 64 | * value: 0x10 | 0x04 - enable output | select function 4 | ||
| 65 | */ | ||
| 66 | __raw_writeb(0x14, PORT99CR); | ||
| 67 | |||
| 68 | /* Enable clock to MMC hardware block */ | ||
| 69 | __raw_writel(__raw_readl(SMSTPCR3) & ~(1 << 12), SMSTPCR3); | ||
| 70 | |||
| 71 | mmcif_update_progress(MMCIF_PROGRESS_INIT); | ||
| 72 | |||
| 73 | /* setup MMCIF hardware */ | ||
| 74 | sh_mmcif_boot_init(MMCIF_BASE); | ||
| 75 | |||
| 76 | mmcif_update_progress(MMCIF_PROGRESS_LOAD); | ||
| 77 | |||
| 78 | /* load kernel via MMCIF interface */ | ||
| 79 | sh_mmcif_boot_do_read(MMCIF_BASE, 2, /* Kernel is at block 2 */ | ||
| 80 | (len + SH_MMCIF_BBS - 1) / SH_MMCIF_BBS, buf); | ||
| 81 | |||
| 82 | |||
| 83 | /* Disable clock to MMC hardware block */ | ||
| 84 | __raw_writel(__raw_readl(SMSTPCR3) & (1 << 12), SMSTPCR3); | ||
| 85 | |||
| 86 | mmcif_update_progress(MMCIF_PROGRESS_DONE); | ||
| 87 | } | ||
diff --git a/arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h b/arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h new file mode 100644 index 000000000000..a8d02be8d2b6 --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | #ifndef MMCIF_AP4EB_H | ||
| 2 | #define MMCIF_AP4EB_H | ||
| 3 | |||
| 4 | #define PORT185CR (void __iomem *)0xe60520b9 | ||
| 5 | #define PORT186CR (void __iomem *)0xe60520ba | ||
| 6 | #define PORT187CR (void __iomem *)0xe60520bb | ||
| 7 | #define PORT188CR (void __iomem *)0xe60520bc | ||
| 8 | |||
| 9 | #define PORTR191_160DR (void __iomem *)0xe6056014 | ||
| 10 | |||
| 11 | static inline void mmcif_init_progress(void) | ||
| 12 | { | ||
| 13 | /* Initialise LEDS1-4 | ||
| 14 | * registers: PORT185CR-PORT188CR (LED1-LED4 Control) | ||
| 15 | * value: 0x10 - enable output | ||
| 16 | */ | ||
| 17 | __raw_writeb(0x10, PORT185CR); | ||
| 18 | __raw_writeb(0x10, PORT186CR); | ||
| 19 | __raw_writeb(0x10, PORT187CR); | ||
| 20 | __raw_writeb(0x10, PORT188CR); | ||
| 21 | } | ||
| 22 | |||
| 23 | static inline void mmcif_update_progress(int n) | ||
| 24 | { | ||
| 25 | __raw_writel((__raw_readl(PORTR191_160DR) & ~(0xf << 25)) | | ||
| 26 | (1 << (25 + n)), PORTR191_160DR); | ||
| 27 | } | ||
| 28 | |||
| 29 | #endif /* MMCIF_AP4EB_H */ | ||
diff --git a/arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h b/arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h new file mode 100644 index 000000000000..4b4f6949a868 --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #ifndef MMCIF_MACKEREL_H | ||
| 2 | #define MMCIF_MACKEREL_H | ||
| 3 | |||
| 4 | #define PORT0CR (void __iomem *)0xe6051000 | ||
| 5 | #define PORT1CR (void __iomem *)0xe6051001 | ||
| 6 | #define PORT2CR (void __iomem *)0xe6051002 | ||
| 7 | #define PORT159CR (void __iomem *)0xe605009f | ||
| 8 | |||
| 9 | #define PORTR031_000DR (void __iomem *)0xe6055000 | ||
| 10 | #define PORTL159_128DR (void __iomem *)0xe6054010 | ||
| 11 | |||
| 12 | static inline void mmcif_init_progress(void) | ||
| 13 | { | ||
| 14 | /* Initialise LEDS0-3 | ||
| 15 | * registers: PORT0CR-PORT2CR,PORT159CR (LED0-LED3 Control) | ||
| 16 | * value: 0x10 - enable output | ||
| 17 | */ | ||
| 18 | __raw_writeb(0x10, PORT0CR); | ||
| 19 | __raw_writeb(0x10, PORT1CR); | ||
| 20 | __raw_writeb(0x10, PORT2CR); | ||
| 21 | __raw_writeb(0x10, PORT159CR); | ||
| 22 | } | ||
| 23 | |||
| 24 | static inline void mmcif_update_progress(int n) | ||
| 25 | { | ||
| 26 | unsigned a = 0, b = 0; | ||
| 27 | |||
| 28 | if (n < 3) | ||
| 29 | a = 1 << n; | ||
| 30 | else | ||
| 31 | b = 1 << 31; | ||
| 32 | |||
| 33 | __raw_writel((__raw_readl(PORTR031_000DR) & ~0x7) | a, | ||
| 34 | PORTR031_000DR); | ||
| 35 | __raw_writel((__raw_readl(PORTL159_128DR) & ~(1 << 31)) | b, | ||
| 36 | PORTL159_128DR); | ||
| 37 | } | ||
| 38 | |||
| 39 | #endif /* MMCIF_MACKEREL_H */ | ||
diff --git a/arch/arm/mach-shmobile/include/mach/mmcif.h b/arch/arm/mach-shmobile/include/mach/mmcif.h new file mode 100644 index 000000000000..f4dc3279cf03 --- /dev/null +++ b/arch/arm/mach-shmobile/include/mach/mmcif.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef MMCIF_H | ||
| 2 | #define MMCIF_H | ||
| 3 | |||
| 4 | /************************************************** | ||
| 5 | * | ||
| 6 | * board specific settings | ||
| 7 | * | ||
| 8 | **************************************************/ | ||
| 9 | |||
| 10 | #ifdef CONFIG_MACH_AP4EVB | ||
| 11 | #include "mach/mmcif-ap4eb.h" | ||
| 12 | #elif CONFIG_MACH_MACKEREL | ||
| 13 | #include "mach/mmcif-mackerel.h" | ||
| 14 | #else | ||
| 15 | #error "unsupported board." | ||
| 16 | #endif | ||
| 17 | |||
| 18 | #endif /* MMCIF_H */ | ||
