avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
11
u-boot/arch/arm/cpu/sa1100/Makefile
Normal file
11
u-boot/arch/arm/cpu/sa1100/Makefile
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# (C) Copyright 2000-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
extra-y = start.o
|
||||
|
||||
obj-y += cpu.o
|
||||
obj-y += timer.o
|
||||
68
u-boot/arch/arm/cpu/sa1100/cpu.c
Normal file
68
u-boot/arch/arm/cpu/sa1100/cpu.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Alex Zuepke <azu@sysgo.de>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/*
|
||||
* CPU specific code
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#ifdef CONFIG_USE_IRQ
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
#endif
|
||||
|
||||
static void cache_flush(void);
|
||||
|
||||
int cleanup_before_linux (void)
|
||||
{
|
||||
/*
|
||||
* this function is called just before we call linux
|
||||
* it prepares the processor for linux
|
||||
*
|
||||
* just disable everything that can disturb booting linux
|
||||
*/
|
||||
|
||||
disable_interrupts ();
|
||||
|
||||
/* turn off I-cache */
|
||||
icache_disable();
|
||||
dcache_disable();
|
||||
|
||||
/* flush I-cache */
|
||||
cache_flush();
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* flush I/D-cache */
|
||||
static void cache_flush (void)
|
||||
{
|
||||
unsigned long i = 0;
|
||||
|
||||
asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
|
||||
}
|
||||
|
||||
#define RST_BASE 0x90030000
|
||||
#define RSRR 0x00
|
||||
#define RCSR 0x04
|
||||
|
||||
__attribute__((noreturn)) void reset_cpu(ulong addr __attribute__((unused)))
|
||||
{
|
||||
/* repeat endlessly */
|
||||
while (1) {
|
||||
writel(0, RST_BASE + RCSR);
|
||||
writel(1, RST_BASE + RSRR);
|
||||
}
|
||||
}
|
||||
127
u-boot/arch/arm/cpu/sa1100/start.S
Normal file
127
u-boot/arch/arm/cpu/sa1100/start.S
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* armboot - Startup Code for SA1100 CPU
|
||||
*
|
||||
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
|
||||
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
|
||||
* Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
|
||||
* Copyright (c) 2001 Alex Züpke <azu@sysgo.de>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm-offsets.h>
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
*
|
||||
* Startup Code (reset vector)
|
||||
*
|
||||
* do important init only if we don't start from memory!
|
||||
* relocate armboot to ram
|
||||
* setup stack
|
||||
* jump to second stage
|
||||
*
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
.globl reset
|
||||
|
||||
reset:
|
||||
/*
|
||||
* set the cpu to SVC32 mode
|
||||
*/
|
||||
mrs r0,cpsr
|
||||
bic r0,r0,#0x1f
|
||||
orr r0,r0,#0xd3
|
||||
msr cpsr,r0
|
||||
|
||||
/*
|
||||
* we do sys-critical inits only at reboot,
|
||||
* not when booting from ram!
|
||||
*/
|
||||
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
|
||||
bl cpu_init_crit
|
||||
#endif
|
||||
|
||||
bl _main
|
||||
|
||||
/*------------------------------------------------------------------------------*/
|
||||
|
||||
.globl c_runtime_cpu_setup
|
||||
c_runtime_cpu_setup:
|
||||
|
||||
mov pc, lr
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
*
|
||||
* CPU_init_critical registers
|
||||
*
|
||||
* setup important registers
|
||||
* setup memory timing
|
||||
*
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Interrupt-Controller base address */
|
||||
IC_BASE: .word 0x90050000
|
||||
#define ICMR 0x04
|
||||
|
||||
|
||||
/* Reset-Controller */
|
||||
RST_BASE: .word 0x90030000
|
||||
#define RSRR 0x00
|
||||
#define RCSR 0x04
|
||||
|
||||
|
||||
/* PWR */
|
||||
PWR_BASE: .word 0x90020000
|
||||
#define PSPR 0x08
|
||||
#define PPCR 0x14
|
||||
cpuspeed: .word CONFIG_SYS_CPUSPEED
|
||||
|
||||
|
||||
cpu_init_crit:
|
||||
/*
|
||||
* mask all IRQs
|
||||
*/
|
||||
ldr r0, IC_BASE
|
||||
mov r1, #0x00
|
||||
str r1, [r0, #ICMR]
|
||||
|
||||
/* set clock speed */
|
||||
ldr r0, PWR_BASE
|
||||
ldr r1, cpuspeed
|
||||
str r1, [r0, #PPCR]
|
||||
|
||||
#ifndef CONFIG_SKIP_LOWLEVEL_INIT_ONLY
|
||||
/*
|
||||
* before relocating, we have to setup RAM timing
|
||||
* because memory timing is board-dependend, you will
|
||||
* find a lowlevel_init.S in your board directory.
|
||||
*/
|
||||
mov ip, lr
|
||||
bl lowlevel_init
|
||||
mov lr, ip
|
||||
#endif
|
||||
|
||||
/*
|
||||
* disable MMU stuff and enable I-cache
|
||||
*/
|
||||
mrc p15,0,r0,c1,c0
|
||||
bic r0, r0, #0x00002000 @ clear bit 13 (X)
|
||||
bic r0, r0, #0x0000000f @ clear bits 3-0 (WCAM)
|
||||
orr r0, r0, #0x00001000 @ set bit 12 (I) Icache
|
||||
orr r0, r0, #0x00000002 @ set bit 1 (A) Align
|
||||
mcr p15,0,r0,c1,c0
|
||||
|
||||
/*
|
||||
* flush v4 I/D caches
|
||||
*/
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
|
||||
mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
|
||||
|
||||
mov pc, lr
|
||||
73
u-boot/arch/arm/cpu/sa1100/timer.c
Normal file
73
u-boot/arch/arm/cpu/sa1100/timer.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Marius Groeger <mgroeger@sysgo.de>
|
||||
*
|
||||
* (C) Copyright 2002
|
||||
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
|
||||
* Alex Zuepke <azu@sysgo.de>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <SA-1100.h>
|
||||
|
||||
ulong get_timer (ulong base)
|
||||
{
|
||||
return get_timer_masked ();
|
||||
}
|
||||
|
||||
void __udelay (unsigned long usec)
|
||||
{
|
||||
udelay_masked (usec);
|
||||
}
|
||||
|
||||
ulong get_timer_masked (void)
|
||||
{
|
||||
return OSCR;
|
||||
}
|
||||
|
||||
void udelay_masked (unsigned long usec)
|
||||
{
|
||||
ulong tmo;
|
||||
ulong endtime;
|
||||
signed long diff;
|
||||
|
||||
if (usec >= 1000) {
|
||||
tmo = usec / 1000;
|
||||
tmo *= CONFIG_SYS_HZ;
|
||||
tmo /= 1000;
|
||||
} else {
|
||||
tmo = usec * CONFIG_SYS_HZ;
|
||||
tmo /= (1000*1000);
|
||||
}
|
||||
|
||||
endtime = get_timer_masked () + tmo;
|
||||
|
||||
do {
|
||||
ulong now = get_timer_masked ();
|
||||
diff = endtime - now;
|
||||
} while (diff >= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is derived from PowerPC code (read timebase as long long).
|
||||
* On ARM it just returns the timer value.
|
||||
*/
|
||||
unsigned long long get_ticks(void)
|
||||
{
|
||||
return get_timer(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is derived from PowerPC code (timebase clock frequency).
|
||||
* On ARM it returns the number of timer ticks per second.
|
||||
*/
|
||||
ulong get_tbclk (void)
|
||||
{
|
||||
ulong tbclk;
|
||||
|
||||
tbclk = CONFIG_SYS_HZ;
|
||||
return tbclk;
|
||||
}
|
||||
Reference in New Issue
Block a user