From f30043a0dbb61a5b5b61cf73bd588c7f8d966084 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Fri, 2 Mar 2012 16:28:33 +0100 Subject: [PATCH] rk27xx: add rolo_restart() rk27xx specific variant Change-Id: Ib786a9ef6318d259ecef783becdd7c0fa6f52730 --- firmware/SOURCES | 3 +- firmware/target/arm/rk27xx/rolo_restart.S | 69 +++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 firmware/target/arm/rk27xx/rolo_restart.S diff --git a/firmware/SOURCES b/firmware/SOURCES index e8b0df0c31..32fbfbb49b 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -1468,7 +1468,6 @@ target/arm/s5l8702/ipod6g/piezo-ipod6g.c #if CONFIG_CPU == RK27XX target/arm/rk27xx/kernel-rk27xx.c target/arm/rk27xx/system-rk27xx.c -target/arm/rk27xx/timer-rk27xx.c target/arm/rk27xx/backlight-rk27xx.c target/arm/rk27xx/adc-rk27xx.c target/arm/rk27xx/sd-rk27xx.c @@ -1478,6 +1477,8 @@ target/arm/rk27xx/usb-rk27xx.c target/arm/rk27xx/lcdif-rk27xx.c target/arm/rk27xx/rkw-loader.c #ifndef BOOTLOADER +target/arm/rk27xx/timer-rk27xx.c +target/arm/rk27xx/rolo_restart.S target/arm/rk27xx/pcm-rk27xx.c target/arm/rk27xx/debug-rk27xx.c #endif diff --git a/firmware/target/arm/rk27xx/rolo_restart.S b/firmware/target/arm/rk27xx/rolo_restart.S new file mode 100644 index 0000000000..19e4a1c65a --- /dev/null +++ b/firmware/target/arm/rk27xx/rolo_restart.S @@ -0,0 +1,69 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2008 by Michael Sevakis + * Copyright (C) 2012 by Marcin Bukat + * + * RoLo firmware restart code for rk27xx + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" + +/**************************************************************************** + * void rolo_restart(const unsigned char* source, unsigned char* dest, + * int length); + */ + .section .text, "ax", %progbits + .align 2 + .global rolo_restart +rolo_restart: + /* Disable cache */ + ldr r4, =0xefff0000 + ldrh r5, [r4] + strh r5, [r4] + + adr r4, restart_copy_start + adr r5, restart_copy_end + ldr r6, =0x18200000 + mov r7, r6 + + /* Copy stub to IRAM */ +1: + ldr r8, [r4], #4 + str r8, [r7], #4 + cmp r5, r4 + bhi 1b + + /* Branch to stub */ + bx r6 + +restart_copy_start: + /* Trivial copy of firmware to final location + * this version assumes that src and dst are + * word aligned + */ + mov r4, r1 +1: + subs r2, r2, #4 + ldr r7, [r0], #4 + str r7, [r4], #4 + bge 1b + + /* Branch to destination */ + bx r1 +restart_copy_end: + .size rolo_restart,.-rolo_restart