mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
PXA: Separate PXA2xx CPU init
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
This commit is contained in:
parent
abc20aba18
commit
d10237d275
2 changed files with 32 additions and 74 deletions
|
@ -27,7 +27,10 @@ LIB = $(obj)lib$(CPU).o
|
||||||
|
|
||||||
START = start.o
|
START = start.o
|
||||||
|
|
||||||
COBJS += cpu.o
|
COBJS-$(CONFIG_CPU_PXA25X) = pxa2xx.o
|
||||||
|
COBJS-$(CONFIG_CPU_PXA27X) = pxa2xx.o
|
||||||
|
|
||||||
|
COBJS = $(COBJS-y)
|
||||||
COBJS += pxafb.o
|
COBJS += pxafb.o
|
||||||
COBJS += timer.o
|
COBJS += timer.o
|
||||||
COBJS += usb.o
|
COBJS += usb.o
|
||||||
|
|
|
@ -26,40 +26,13 @@
|
||||||
* MA 02111-1307 USA
|
* MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* CPU specific code
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <asm/arch/pxa-regs.h>
|
#include <asm/arch/pxa-regs.h>
|
||||||
|
|
||||||
static void cache_flush(void);
|
/* Flush I/D-cache */
|
||||||
|
|
||||||
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)
|
static void cache_flush(void)
|
||||||
{
|
{
|
||||||
unsigned long i = 0;
|
unsigned long i = 0;
|
||||||
|
@ -67,30 +40,21 @@ static void cache_flush (void)
|
||||||
asm ("mcr p15, 0, %0, c7, c5, 0" : : "r" (i));
|
asm ("mcr p15, 0, %0, c7, c5, 0" : : "r" (i));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_CPU_MONAHANS
|
int cleanup_before_linux(void)
|
||||||
void set_GPIO_mode(int gpio_mode)
|
|
||||||
{
|
{
|
||||||
int gpio = gpio_mode & GPIO_MD_MASK_NR;
|
/*
|
||||||
int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
|
* This function is called just before we call Linux. It prepares
|
||||||
int val;
|
* the processor for Linux by just disabling everything that can
|
||||||
|
* disturb booting Linux.
|
||||||
|
*/
|
||||||
|
|
||||||
/* This below changes direction setting of GPIO "gpio" */
|
disable_interrupts();
|
||||||
val = readl(GPDR(gpio));
|
icache_disable();
|
||||||
|
dcache_disable();
|
||||||
|
cache_flush();
|
||||||
|
|
||||||
if (gpio_mode & GPIO_MD_MASK_DIR)
|
return 0;
|
||||||
val |= GPIO_bit(gpio);
|
|
||||||
else
|
|
||||||
val &= ~GPIO_bit(gpio);
|
|
||||||
|
|
||||||
writel(val, GPDR(gpio));
|
|
||||||
|
|
||||||
/* This below updates only AF of GPIO "gpio" */
|
|
||||||
val = readl(GAFR(gpio));
|
|
||||||
val &= ~(0x3 << (((gpio) & 0xf) * 2));
|
|
||||||
val |= fn << (((gpio) & 0xf) * 2);
|
|
||||||
writel(val, GAFR(gpio));
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_CPU_MONAHANS */
|
|
||||||
|
|
||||||
void pxa_wait_ticks(int ticks)
|
void pxa_wait_ticks(int ticks)
|
||||||
{
|
{
|
||||||
|
@ -234,21 +198,21 @@ void pxa_gpio_setup(void)
|
||||||
writel(CONFIG_SYS_GPSR0_VAL, GPSR0);
|
writel(CONFIG_SYS_GPSR0_VAL, GPSR0);
|
||||||
writel(CONFIG_SYS_GPSR1_VAL, GPSR1);
|
writel(CONFIG_SYS_GPSR1_VAL, GPSR1);
|
||||||
writel(CONFIG_SYS_GPSR2_VAL, GPSR2);
|
writel(CONFIG_SYS_GPSR2_VAL, GPSR2);
|
||||||
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
|
#if defined(CONFIG_CPU_PXA27X)
|
||||||
writel(CONFIG_SYS_GPSR3_VAL, GPSR3);
|
writel(CONFIG_SYS_GPSR3_VAL, GPSR3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writel(CONFIG_SYS_GPCR0_VAL, GPCR0);
|
writel(CONFIG_SYS_GPCR0_VAL, GPCR0);
|
||||||
writel(CONFIG_SYS_GPCR1_VAL, GPCR1);
|
writel(CONFIG_SYS_GPCR1_VAL, GPCR1);
|
||||||
writel(CONFIG_SYS_GPCR2_VAL, GPCR2);
|
writel(CONFIG_SYS_GPCR2_VAL, GPCR2);
|
||||||
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
|
#if defined(CONFIG_CPU_PXA27X)
|
||||||
writel(CONFIG_SYS_GPCR3_VAL, GPCR3);
|
writel(CONFIG_SYS_GPCR3_VAL, GPCR3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writel(CONFIG_SYS_GPDR0_VAL, GPDR0);
|
writel(CONFIG_SYS_GPDR0_VAL, GPDR0);
|
||||||
writel(CONFIG_SYS_GPDR1_VAL, GPDR1);
|
writel(CONFIG_SYS_GPDR1_VAL, GPDR1);
|
||||||
writel(CONFIG_SYS_GPDR2_VAL, GPDR2);
|
writel(CONFIG_SYS_GPDR2_VAL, GPDR2);
|
||||||
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
|
#if defined(CONFIG_CPU_PXA27X)
|
||||||
writel(CONFIG_SYS_GPDR3_VAL, GPDR3);
|
writel(CONFIG_SYS_GPDR3_VAL, GPDR3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -258,7 +222,7 @@ void pxa_gpio_setup(void)
|
||||||
writel(CONFIG_SYS_GAFR1_U_VAL, GAFR1_U);
|
writel(CONFIG_SYS_GAFR1_U_VAL, GAFR1_U);
|
||||||
writel(CONFIG_SYS_GAFR2_L_VAL, GAFR2_L);
|
writel(CONFIG_SYS_GAFR2_L_VAL, GAFR2_L);
|
||||||
writel(CONFIG_SYS_GAFR2_U_VAL, GAFR2_U);
|
writel(CONFIG_SYS_GAFR2_U_VAL, GAFR2_U);
|
||||||
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
|
#if defined(CONFIG_CPU_PXA27X)
|
||||||
writel(CONFIG_SYS_GAFR3_L_VAL, GAFR3_L);
|
writel(CONFIG_SYS_GAFR3_L_VAL, GAFR3_L);
|
||||||
writel(CONFIG_SYS_GAFR3_U_VAL, GAFR3_U);
|
writel(CONFIG_SYS_GAFR3_U_VAL, GAFR3_U);
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,7 +234,7 @@ void pxa_interrupt_setup(void)
|
||||||
{
|
{
|
||||||
writel(0, ICLR);
|
writel(0, ICLR);
|
||||||
writel(0, ICMR);
|
writel(0, ICMR);
|
||||||
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
|
#if defined(CONFIG_CPU_PXA27X)
|
||||||
writel(0, ICLR2);
|
writel(0, ICLR2);
|
||||||
writel(0, ICMR2);
|
writel(0, ICMR2);
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,13 +242,9 @@ void pxa_interrupt_setup(void)
|
||||||
|
|
||||||
void pxa_clock_setup(void)
|
void pxa_clock_setup(void)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_CPU_MONAHANS
|
|
||||||
writel(CONFIG_SYS_CKEN, CKEN);
|
writel(CONFIG_SYS_CKEN, CKEN);
|
||||||
writel(CONFIG_SYS_CCCR, CCCR);
|
writel(CONFIG_SYS_CCCR, CCCR);
|
||||||
asm volatile("mcr p14, 0, %0, c6, c0, 0" : : "r"(2));
|
asm volatile("mcr p14, 0, %0, c6, c0, 0" : : "r"(2));
|
||||||
#else
|
|
||||||
/* Set CKENA/CKENB/ACCR for MH */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* enable the 32Khz oscillator for RTC and PowerManager */
|
/* enable the 32Khz oscillator for RTC and PowerManager */
|
||||||
writel(OSCC_OON, OSCC);
|
writel(OSCC_OON, OSCC);
|
||||||
|
@ -312,7 +272,6 @@ void pxa_wakeup(void)
|
||||||
int arch_cpu_init(void)
|
int arch_cpu_init(void)
|
||||||
{
|
{
|
||||||
pxa_gpio_setup();
|
pxa_gpio_setup();
|
||||||
/* pxa_wait_ticks(0x8000); */
|
|
||||||
pxa_wakeup();
|
pxa_wakeup();
|
||||||
pxa_interrupt_setup();
|
pxa_interrupt_setup();
|
||||||
pxa_clock_setup();
|
pxa_clock_setup();
|
||||||
|
@ -321,12 +280,8 @@ int arch_cpu_init(void)
|
||||||
|
|
||||||
void i2c_clk_enable(void)
|
void i2c_clk_enable(void)
|
||||||
{
|
{
|
||||||
/* set the global I2C clock on */
|
/* Set the global I2C clock on */
|
||||||
#ifdef CONFIG_CPU_MONAHANS
|
|
||||||
writel(readl(CKENB) | (CKENB_4_I2C), CKENB);
|
|
||||||
#else
|
|
||||||
writel(readl(CKEN) | CKEN14_I2C, CKEN);
|
writel(readl(CKEN) | CKEN14_I2C, CKEN);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_cpu(ulong ignored) __attribute__((noreturn));
|
void reset_cpu(ulong ignored) __attribute__((noreturn));
|
Loading…
Add table
Reference in a new issue