2010-04-16 13:50:30 +00:00
|
|
|
/*
|
|
|
|
* start-arm.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <asm/barebox-arm.h>
|
2011-12-10 14:33:41 +00:00
|
|
|
#include <asm/barebox-arm-head.h>
|
2010-04-16 13:50:30 +00:00
|
|
|
#include <asm-generic/memory_layout.h>
|
2011-01-17 09:42:34 +00:00
|
|
|
#include <asm/sections.h>
|
2012-08-12 12:31:16 +00:00
|
|
|
#include <asm/cache.h>
|
2010-04-16 13:50:30 +00:00
|
|
|
|
2012-07-27 17:25:56 +00:00
|
|
|
#ifdef CONFIG_PBL_IMAGE
|
2010-04-16 13:50:30 +00:00
|
|
|
/*
|
2012-09-06 18:58:40 +00:00
|
|
|
* First function in the uncompressed image. We get here from
|
2012-07-27 17:25:56 +00:00
|
|
|
* the pbl.
|
2010-04-16 13:50:30 +00:00
|
|
|
*/
|
2012-07-27 17:25:56 +00:00
|
|
|
void __naked __section(.text_entry) start(void)
|
2010-04-16 13:50:30 +00:00
|
|
|
{
|
2012-07-27 17:25:56 +00:00
|
|
|
u32 r;
|
2010-04-16 13:50:30 +00:00
|
|
|
|
2012-07-27 17:25:56 +00:00
|
|
|
/* Setup the stack */
|
|
|
|
r = STACK_BASE + STACK_SIZE - 16;
|
|
|
|
__asm__ __volatile__("mov sp, %0" : : "r"(r));
|
2012-10-03 12:27:52 +00:00
|
|
|
|
|
|
|
setup_c();
|
2012-01-02 10:49:17 +00:00
|
|
|
|
2012-07-27 17:25:56 +00:00
|
|
|
start_barebox();
|
|
|
|
}
|
2012-07-08 21:27:18 +00:00
|
|
|
#else
|
2010-04-16 13:50:30 +00:00
|
|
|
|
2012-09-06 18:58:40 +00:00
|
|
|
/*
|
|
|
|
* First function in the image without pbl support
|
|
|
|
*/
|
2012-07-27 17:25:56 +00:00
|
|
|
void __naked __section(.text_entry) start(void)
|
|
|
|
{
|
|
|
|
barebox_arm_head();
|
2010-04-16 13:50:30 +00:00
|
|
|
}
|
|
|
|
|
2012-09-24 08:18:34 +00:00
|
|
|
/*
|
|
|
|
* The actual reset vector. This code is position independent and usually
|
|
|
|
* does not run at the address it's linked at.
|
|
|
|
*/
|
|
|
|
#ifndef CONFIG_MACH_DO_LOWLEVEL_INIT
|
|
|
|
void __naked __bare_init reset(void)
|
|
|
|
{
|
|
|
|
common_reset();
|
|
|
|
board_init_lowlevel_return();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-04-16 13:50:30 +00:00
|
|
|
/*
|
|
|
|
* Board code can jump here by either returning from board_init_lowlevel
|
2012-05-13 16:36:50 +00:00
|
|
|
* or by calling this function directly.
|
2010-04-16 13:50:30 +00:00
|
|
|
*/
|
2012-09-06 20:32:10 +00:00
|
|
|
void __naked board_init_lowlevel_return(void)
|
2010-04-16 13:50:30 +00:00
|
|
|
{
|
2012-10-03 12:27:52 +00:00
|
|
|
uint32_t r;
|
2010-04-16 13:50:30 +00:00
|
|
|
|
|
|
|
/* Setup the stack */
|
|
|
|
r = STACK_BASE + STACK_SIZE - 16;
|
|
|
|
__asm__ __volatile__("mov sp, %0" : : "r"(r));
|
|
|
|
|
2012-10-03 12:27:52 +00:00
|
|
|
setup_c();
|
2010-04-16 13:50:30 +00:00
|
|
|
|
2012-10-03 12:27:52 +00:00
|
|
|
start_barebox();
|
2010-04-16 13:50:30 +00:00
|
|
|
}
|
2012-07-27 17:25:56 +00:00
|
|
|
#endif
|