aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boot/romimage
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boot/romimage')
-rw-r--r--arch/sh/boot/romimage/Makefile13
-rw-r--r--arch/sh/boot/romimage/head.S42
-rw-r--r--arch/sh/boot/romimage/mmcif-sh7724.c72
-rw-r--r--arch/sh/boot/romimage/vmlinux.scr2
4 files changed, 122 insertions, 7 deletions
diff --git a/arch/sh/boot/romimage/Makefile b/arch/sh/boot/romimage/Makefile
index f473a24a2d92..2216ee57f251 100644
--- a/arch/sh/boot/romimage/Makefile
+++ b/arch/sh/boot/romimage/Makefile
@@ -1,16 +1,21 @@
1# 1#
2# linux/arch/sh/boot/romimage/Makefile 2# linux/arch/sh/boot/romimage/Makefile
3# 3#
4# create an image suitable for burning to flash from zImage 4# create an romImage file suitable for burning to flash/mmc from zImage
5# 5#
6 6
7targets := vmlinux head.o zeropage.bin piggy.o 7targets := vmlinux head.o zeropage.bin piggy.o
8load-y := 0
8 9
9OBJECTS = $(obj)/head.o 10mmcif-load-$(CONFIG_CPU_SUBTYPE_SH7724) := 0xe5200000 # ILRAM
10LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext 0 -e romstart \ 11mmcif-obj-$(CONFIG_CPU_SUBTYPE_SH7724) := $(obj)/mmcif-sh7724.o
12load-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-load-y)
13obj-$(CONFIG_ROMIMAGE_MMCIF) := $(mmcif-obj-y)
14
15LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(load-y) -e romstart \
11 -T $(obj)/../../kernel/vmlinux.lds 16 -T $(obj)/../../kernel/vmlinux.lds
12 17
13$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE 18$(obj)/vmlinux: $(obj)/head.o $(obj-y) $(obj)/piggy.o FORCE
14 $(call if_changed,ld) 19 $(call if_changed,ld)
15 @: 20 @:
16 21
diff --git a/arch/sh/boot/romimage/head.S b/arch/sh/boot/romimage/head.S
index 93e779a405ec..4671d1b82150 100644
--- a/arch/sh/boot/romimage/head.S
+++ b/arch/sh/boot/romimage/head.S
@@ -12,8 +12,40 @@ romstart:
12 /* include board specific setup code */ 12 /* include board specific setup code */
13#include <mach/romimage.h> 13#include <mach/romimage.h>
14 14
15#ifdef CONFIG_ROMIMAGE_MMCIF
16 /* load the romImage to above the empty zero page */
17 mov.l empty_zero_page_dst, r4
18 mov.l empty_zero_page_dst_adj, r5
19 add r5, r4
20 mov.l bytes_to_load, r5
21 mov.l loader_function, r7
22 jsr @r7
23 mov r4, r15
24
25 mov.l empty_zero_page_dst, r4
26 mov.l empty_zero_page_dst_adj, r5
27 add r5, r4
28 mov.l loaded_code_offs, r5
29 add r5, r4
30 jmp @r4
31 nop
32
33 .balign 4
34empty_zero_page_dst_adj:
35 .long PAGE_SIZE
36bytes_to_load:
37 .long end_data - romstart
38loader_function:
39 .long mmcif_loader
40loaded_code_offs:
41 .long loaded_code - romstart
42loaded_code:
43#endif /* CONFIG_ROMIMAGE_MMCIF */
44
15 /* copy the empty_zero_page contents to where vmlinux expects it */ 45 /* copy the empty_zero_page contents to where vmlinux expects it */
16 mova empty_zero_page_src, r0 46 mova extra_data_pos, r0
47 mov.l extra_data_size, r1
48 add r1, r0
17 mov.l empty_zero_page_dst, r1 49 mov.l empty_zero_page_dst, r1
18 mov #(PAGE_SHIFT - 4), r4 50 mov #(PAGE_SHIFT - 4), r4
19 mov #1, r3 51 mov #1, r3
@@ -37,7 +69,9 @@ romstart:
37 mov #PAGE_SHIFT, r4 69 mov #PAGE_SHIFT, r4
38 mov #1, r1 70 mov #1, r1
39 shld r4, r1 71 shld r4, r1
40 mova empty_zero_page_src, r0 72 mova extra_data_pos, r0
73 add r1, r0
74 mov.l extra_data_size, r1
41 add r1, r0 75 add r1, r0
42 jmp @r0 76 jmp @r0
43 nop 77 nop
@@ -45,4 +79,6 @@ romstart:
45 .align 2 79 .align 2
46empty_zero_page_dst: 80empty_zero_page_dst:
47 .long _text 81 .long _text
48empty_zero_page_src: 82extra_data_pos:
83extra_data_size:
84 .long zero_page_pos - extra_data_pos
diff --git a/arch/sh/boot/romimage/mmcif-sh7724.c b/arch/sh/boot/romimage/mmcif-sh7724.c
new file mode 100644
index 000000000000..14863d7292cb
--- /dev/null
+++ b/arch/sh/boot/romimage/mmcif-sh7724.c
@@ -0,0 +1,72 @@
1/*
2 * sh7724 MMCIF loader
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/mmc/sh_mmcif.h>
12#include <mach/romimage.h>
13
14#define MMCIF_BASE (void __iomem *)0xa4ca0000
15
16#define MSTPCR2 0xa4150038
17#define PTWCR 0xa4050146
18#define PTXCR 0xa4050148
19#define PSELA 0xa405014e
20#define PSELE 0xa4050156
21#define HIZCRC 0xa405015c
22#define DRVCRA 0xa405018a
23
24enum { MMCIF_PROGRESS_ENTER, MMCIF_PROGRESS_INIT,
25 MMCIF_PROGRESS_LOAD, MMCIF_PROGRESS_DONE };
26
27/* SH7724 specific MMCIF loader
28 *
29 * loads the romImage from an MMC card starting from block 512
30 * use the following line to write the romImage to an MMC card
31 * # dd if=arch/sh/boot/romImage of=/dev/sdx bs=512 seek=512
32 */
33asmlinkage void mmcif_loader(unsigned char *buf, unsigned long no_bytes)
34{
35 mmcif_update_progress(MMCIF_PROGRESS_ENTER);
36
37 /* enable clock to the MMCIF hardware block */
38 __raw_writel(__raw_readl(MSTPCR2) & ~0x20000000, MSTPCR2);
39
40 /* setup pins D7-D0 */
41 __raw_writew(0x0000, PTWCR);
42
43 /* setup pins MMC_CLK, MMC_CMD */
44 __raw_writew(__raw_readw(PTXCR) & ~0x000f, PTXCR);
45
46 /* select D3-D0 pin function */
47 __raw_writew(__raw_readw(PSELA) & ~0x2000, PSELA);
48
49 /* select D7-D4 pin function */
50 __raw_writew(__raw_readw(PSELE) & ~0x3000, PSELE);
51
52 /* disable Hi-Z for the MMC pins */
53 __raw_writew(__raw_readw(HIZCRC) & ~0x0620, HIZCRC);
54
55 /* high drive capability for MMC pins */
56 __raw_writew(__raw_readw(DRVCRA) | 0x3000, DRVCRA);
57
58 mmcif_update_progress(MMCIF_PROGRESS_INIT);
59
60 /* setup MMCIF hardware */
61 sh_mmcif_boot_init(MMCIF_BASE);
62
63 mmcif_update_progress(MMCIF_PROGRESS_LOAD);
64
65 /* load kernel via MMCIF interface */
66 sh_mmcif_boot_slurp(MMCIF_BASE, buf, no_bytes);
67
68 /* disable clock to the MMCIF hardware block */
69 __raw_writel(__raw_readl(MSTPCR2) | 0x20000000, MSTPCR2);
70
71 mmcif_update_progress(MMCIF_PROGRESS_DONE);
72}
diff --git a/arch/sh/boot/romimage/vmlinux.scr b/arch/sh/boot/romimage/vmlinux.scr
index 287c08f8b4bb..590394e2f5f2 100644
--- a/arch/sh/boot/romimage/vmlinux.scr
+++ b/arch/sh/boot/romimage/vmlinux.scr
@@ -1,6 +1,8 @@
1SECTIONS 1SECTIONS
2{ 2{
3 .text : { 3 .text : {
4 zero_page_pos = .;
4 *(.data) 5 *(.data)
6 end_data = .;
5 } 7 }
6} 8}