diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-08-04 18:16:59 +0530 |
---|---|---|
committer | Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> | 2010-10-23 13:29:26 +0200 |
commit | 71a5c16267bdf2740f248b7dde0c11b3e989a3a7 (patch) | |
tree | f2a4a789e5171df38b4935dd86179b2f5341b9a7 /tools | |
parent | 55a5ee89b9ad6949b7c741d1c5c3642371b07d2f (diff) |
ux500: add simple SVP bootloader and remove head.S hacks
Add a simple bootloader for use with SVP, so that the head.S hacks in
the kernel can be removed. See tools/svpboot/README for instructions on
SVP can be booted after this change.
ST-Ericsson ID: AP263729
Change-Id: Ic5aea405f4889c46d959ed9e09d041c29d0d858a
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/3529
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Reviewed-by: Thierry STRUDEL <thierry.strudel@stericsson.com>
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Reviewed-by: Carl-Johan IREKVIST <carl-johan.irekvist@stericsson.com>
Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/svpboot/Makefile | 20 | ||||
-rw-r--r-- | tools/svpboot/README | 18 | ||||
-rw-r--r-- | tools/svpboot/svp5500.S | 36 | ||||
-rw-r--r-- | tools/svpboot/svp8500v1.S | 36 | ||||
-rw-r--r-- | tools/svpboot/svpboot.S | 64 | ||||
-rw-r--r-- | tools/svpboot/svpboot.ld | 11 |
6 files changed, 185 insertions, 0 deletions
diff --git a/tools/svpboot/Makefile b/tools/svpboot/Makefile new file mode 100644 index 00000000000..5555f23915d --- /dev/null +++ b/tools/svpboot/Makefile @@ -0,0 +1,20 @@ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +KERNELDIR ?= ../.. + +SCRIPT = svpboot.ld +ASFLAGS = -D__ASSEMBLY__ -I$(KERNELDIR)/include -I$(KERNELDIR)/arch/arm/include +ASFLAGS += -I$(KERNELDIR)/arch/arm/mach-ux500/include +LDFLAGS = -nostdlib -Wl,-T,$(SCRIPT) + +OBJS = svp5500 svp8500v1 +all: $(OBJS) + +SVP%.o: svpboot.S + $(CC) $(ASFLAGS) -c -o $@ -D$(basename $@) $^ + +svp5500: SVP5500.o $(SCRIPT) +svp8500v1: SVP8500V1.o $(SCRIPT) + +clean: + rm -rf $(OBJS) *.o *.bin diff --git a/tools/svpboot/README b/tools/svpboot/README new file mode 100644 index 00000000000..18218b9b55f --- /dev/null +++ b/tools/svpboot/README @@ -0,0 +1,18 @@ +BUILDING SVPBOOT: + + $ CROSS_COMPILE=<your-arm-cc> make -C tools/svpboot/ + +RUNNING SVP WITH SVPBOOT: + + Use the svpboot ELF binaries appropriate for your SVP as the "-arm_lib" + argument, and use "-dram_img" to load the Image of the kernel to 0x8000. + + For example, on SVP5500: + + $ tlm_run.exe -arm_lib tools/svpboot/svp5500 -dram_img 0x8000 \ + arch/arm/boot/Image 0x800000 initrd -open_mcde -open_telnet + + For example, on SVP8500v1: + + $ tlm_run.exe -arm_lib tools/svpboot/svp8500v1 -dram_img 0x8000 \ + arch/arm/boot/Image 0x3000000 initrd -open_mcde -open_telnet diff --git a/tools/svpboot/svp5500.S b/tools/svpboot/svp5500.S new file mode 100644 index 00000000000..73feb880405 --- /dev/null +++ b/tools/svpboot/svp5500.S @@ -0,0 +1,36 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Rabin Vincent <rabin.vincent@stericsson.com> + * License terms: GNU General Public License (GPL) version 2 + */ + +#include <linux/amba/serial.h> +#include <asm/mach-types.h> +#include <mach/hardware.h> + +#define MACH_TYPE MACH_TYPE_U5500 +#define CMDLINE \ + "root=/dev/ram0 init=init rw " \ + "console=ttyAMA0,115200n8 " \ + "mem=24MB@0 mem=208M@48M " \ + "initrd=0x3000000,60M " \ + "earlyprintk " \ + "memmap=0x01800000$0x01800000 " \ + "mloader_helper.shm_total_size=0x00030000" + +#define CPU1_WAKEMAGIC_ADDR (U5500_BACKUPRAM0_BASE + 0x1ff0) + +#define NMK_GPIO_AFSLA 0x20 + +.macro init_console_uart + /* Enable GPIOs for UART0 (28, 29 -> AltA) */ + ldr r5, =U5500_GPIO0_BASE + ldr r6, =((1 << 28) | (1 << 29)) + str r6, [r5, #NMK_GPIO_AFSLA] + + /* Enable UART0 */ + ldr r5, =U5500_UART0_BASE + ldr r6, =(UART011_CR_TXE | UART01x_CR_UARTEN) + str r6, [r5, #UART011_CR] +.endm diff --git a/tools/svpboot/svp8500v1.S b/tools/svpboot/svp8500v1.S new file mode 100644 index 00000000000..0d11ac6e590 --- /dev/null +++ b/tools/svpboot/svp8500v1.S @@ -0,0 +1,36 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Rabin Vincent <rabin.vincent@stericsson.com> + * License terms: GNU General Public License (GPL) version 2 + */ + +#include <linux/amba/serial.h> +#include <asm/mach-types.h> +#include <mach/hardware.h> + +#define MACH_TYPE MACH_TYPE_U8500 +#define CMDLINE \ + "root=/dev/ram0 init=init rw " \ + "console=ttyAMA2,115200n8 " \ + "mem=256M " \ + "initrd=0x800000,60M " \ + "earlyprintk" \ + +#define CPU1_WAKEMAGIC_ADDR (U8500_BACKUPRAM0_BASE + 0x1ff0) + +#define NMK_GPIO_AFSLA 0x20 +#define NMK_GPIO_AFSLB 0x24 + +.macro init_console_uart + /* Enable GPIOs for UART2 (29, 30 -> AltC) */ + ldr r5, =U8500_GPIO0_BASE + ldr r6, =((1 << 29) | (1 << 30)) + str r6, [r5, #NMK_GPIO_AFSLA] + str r6, [r5, #NMK_GPIO_AFSLB] + + /* Enable UART2 */ + ldr r5, =U8500_UART2_BASE + ldr r6, =(UART011_CR_TXE | UART01x_CR_UARTEN) + str r6, [r5, #UART011_CR] +.endm diff --git a/tools/svpboot/svpboot.S b/tools/svpboot/svpboot.S new file mode 100644 index 00000000000..9024dbf6f0c --- /dev/null +++ b/tools/svpboot/svpboot.S @@ -0,0 +1,64 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Author: Rabin Vincent <rabin.vincent@stericsson.com> + * License terms: GNU General Public License (GPL) version 2 + */ + +#include <linux/linkage.h> +#include <asm/assembler.h> + +#ifdef SVP5500 +#include "svp5500.S" +#elif defined(SVP8500V1) +#include "svp8500v1.S" +#endif + + .text + +ENTRY(_start) + /* Enable SWP */ + mrc p15, 0, r1, c1, c0, 0 + orr r1, r1, #1 << 10 + mcr p15, 0, r1, c1, c0, 0 + + mrc p15, 0, r3, c0, c0, 5 + ands r3, r3, #0xf + bne core2 + + init_console_uart + + mov r0, #0 + ldr r1, =MACH_TYPE + ldr r2, =taglist + + b kernel + +core2: + ldr r0, =CPU1_WAKEMAGIC_ADDR + ldr r2, =0xA1FEED01 + +1: ldr r1, [r0] + cmp r1, r2 + bne 1b + + /* Jump Addr is at WakeMagic + 4 */ + ldr r1, [r0, #4] + bx r1 + + .data +#define ATAG_CORE 0x54410001 +#define ATAG_CMDLINE 0x54410009 +#define ATAG_NONE 0x00000000 + +taglist: + .long 2 + .long ATAG_CORE + .long 2 + (cmdlineend - cmdlinestart) / 4 + .long ATAG_CMDLINE +cmdlinestart: + .ascii CMDLINE + .align 2 +cmdlineend: + .long 0 + .long ATAG_NONE diff --git a/tools/svpboot/svpboot.ld b/tools/svpboot/svpboot.ld new file mode 100644 index 00000000000..e6a5af49d88 --- /dev/null +++ b/tools/svpboot/svpboot.ld @@ -0,0 +1,11 @@ +OUTPUT_ARCH(arm) +ENTRY(_start) + +SECTIONS +{ + . = 0x0; + .text : { *(.text) } + . = 0x100; + .data : { *(.data) } + PROVIDE (kernel = 0x8000); +} |