diff options
Diffstat (limited to 'cpu')
71 files changed, 701 insertions, 664 deletions
diff --git a/cpu/74xx_7xx/config.mk b/cpu/74xx_7xx/config.mk index 417d99f..324f62b 100644 --- a/cpu/74xx_7xx/config.mk +++ b/cpu/74xx_7xx/config.mk @@ -23,4 +23,4 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -ffixed-r2 -ffixed-r29 -mstring +PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -ffixed-r2 -mstring diff --git a/cpu/arm1136/start.S b/cpu/arm1136/start.S index 17c7a83..8b765f1 100644 --- a/cpu/arm1136/start.S +++ b/cpu/arm1136/start.S @@ -35,6 +35,25 @@ #endif .globl _start _start: b reset +#ifdef CONFIG_ONENAND_IPL + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + +_hang: + .word do_hang + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 /* now 16*4=64 */ +#else ldr pc, _undefined_instruction ldr pc, _software_interrupt ldr pc, _prefetch_abort @@ -51,6 +70,7 @@ _not_used: .word not_used _irq: .word irq _fiq: .word fiq _pad: .word 0x12345678 /* now 16*4=64 */ +#endif /* CONFIG_ONENAND_IPL */ .global _end_vect _end_vect: @@ -139,7 +159,9 @@ relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 <- current position of code */ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ cmp r0, r1 /* don't reloc during debug */ +#ifndef CONFIG_ONENAND_IPL beq stack_setup +#endif /* CONFIG_ONENAND_IPL */ ldr r2, _armboot_start ldr r3, _bss_start @@ -156,26 +178,36 @@ copy_loop: /* Set up the stack */ stack_setup: ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ +#ifdef CONFIG_ONENAND_IPL + sub sp, r0, #128 /* leave 32 words for abort-stack */ +#else sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */ #ifdef CONFIG_USE_IRQ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) #endif sub sp, r0, #12 /* leave 3 words for abort-stack */ +#endif /* CONFIG_ONENAND_IPL */ clear_bss: ldr r0, _bss_start /* find start of bss segment */ ldr r1, _bss_end /* stop here */ mov r2, #0x00000000 /* clear */ +#ifndef CONFIG_ONENAND_IPL clbss_l:str r2, [r0] /* clear loop... */ add r0, r0, #4 cmp r0, r1 bne clbss_l +#endif ldr pc, _start_armboot +#ifdef CONFIG_ONENAND_IPL +_start_armboot: .word start_oneboot +#else _start_armboot: .word start_armboot +#endif /* @@ -214,6 +246,8 @@ cpu_init_crit: bl lowlevel_init /* go setup pll,mux,memory */ mov lr, ip /* restore link */ mov pc, lr /* back to my caller */ + +#ifndef CONFIG_ONENAND_IPL /* ************************************************************************* * @@ -326,10 +360,17 @@ cpu_init_crit: .macro get_fiq_stack @ setup FIQ stack ldr sp, FIQ_STACK_START .endm +#endif /* CONFIG_ONENAND_IPL */ /* * exception handlers */ +#ifdef CONFIG_ONENAND_IPL + .align 5 +do_hang: + ldr sp, _TEXT_BASE /* use 32 words about stack */ + bl hang /* hang and never return */ +#else /* !CONFIG_ONENAND IPL */ .align 5 undefined_instruction: get_bad_stack @@ -415,3 +456,4 @@ rstctl: .word PM_RSTCTRL_WKUP #endif +#endif /* CONFIG_ONENAND_IPL */ diff --git a/cpu/arm920t/interrupts.c b/cpu/arm920t/interrupts.c index a43a3ed..0a6d94f 100644 --- a/cpu/arm920t/interrupts.c +++ b/cpu/arm920t/interrupts.c @@ -161,11 +161,16 @@ void do_fiq (struct pt_regs *pt_regs) void do_irq (struct pt_regs *pt_regs) { -#if defined (CONFIG_USE_IRQ) && defined (CONFIG_ARCH_INTEGRATOR) +#if defined (CONFIG_USE_IRQ) +#if defined (ARM920_IRQ_CALLBACK) + ARM920_IRQ_CALLBACK(); + return; +#elif defined (CONFIG_ARCH_INTEGRATOR) /* ASSUMED to be a timer interrupt */ /* Just clear it - count handled in */ /* integratorap.c */ *(volatile ulong *)(CFG_TIMERBASE + 0x0C) = 0; +#endif /* ARCH_INTEGRATOR */ #else printf ("interrupt request\n"); show_regs (pt_regs); diff --git a/cpu/arm920t/s3c24x0/Makefile b/cpu/arm920t/s3c24x0/Makefile index 1ed9bf3..6764920 100644 --- a/cpu/arm920t/s3c24x0/Makefile +++ b/cpu/arm920t/s3c24x0/Makefile @@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a COBJS = i2c.o interrupts.o serial.o speed.o \ - usb.o usb_ohci.o + usb.o usb_ohci.o nand.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) diff --git a/cpu/arm920t/s3c24x0/interrupts.c b/cpu/arm920t/s3c24x0/interrupts.c index 1b36412..7ad9fcb 100644 --- a/cpu/arm920t/s3c24x0/interrupts.c +++ b/cpu/arm920t/s3c24x0/interrupts.c @@ -216,4 +216,13 @@ void reset_cpu (ulong ignored) /*NOTREACHED*/ } +#ifdef CONFIG_USE_IRQ +void s3c2410_irq(void) +{ + S3C24X0_INTERRUPT * irq = S3C24X0_GetBase_INTERRUPT(); + u_int32_t intpnd = irq->INTPND; + +} +#endif /* USE_IRQ */ + #endif /* defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) */ diff --git a/cpu/arm920t/s3c24x0/nand.c b/cpu/arm920t/s3c24x0/nand.c new file mode 100644 index 0000000..e1bf128 --- /dev/null +++ b/cpu/arm920t/s3c24x0/nand.c @@ -0,0 +1,179 @@ +/* + * (C) Copyright 2006 OpenMoko, Inc. + * Author: Harald Welte <laforge@openmoko.org> + * + * 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 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> + +#if 0 +#define DEBUGN printf +#else +#define DEBUGN(x, args ...) {} +#endif + +#if defined(CONFIG_CMD_NAND) +#if !defined(CFG_NAND_LEGACY) + +#include <nand.h> +#include <s3c2410.h> + +#define __REGb(x) (*(volatile unsigned char *)(x)) +#define __REGi(x) (*(volatile unsigned int *)(x)) + +#define NF_BASE 0x4e000000 +#define NFCONF __REGi(NF_BASE + 0x0) +#define NFCMD __REGb(NF_BASE + 0x4) +#define NFADDR __REGb(NF_BASE + 0x8) +#define NFDATA __REGb(NF_BASE + 0xc) +#define NFSTAT __REGb(NF_BASE + 0x10) +#define NFECC0 __REGb(NF_BASE + 0x14) +#define NFECC1 __REGb(NF_BASE + 0x15) +#define NFECC2 __REGb(NF_BASE + 0x16) + +#define S3C2410_NFCONF_EN (1<<15) +#define S3C2410_NFCONF_512BYTE (1<<14) +#define S3C2410_NFCONF_4STEP (1<<13) +#define S3C2410_NFCONF_INITECC (1<<12) +#define S3C2410_NFCONF_nFCE (1<<11) +#define S3C2410_NFCONF_TACLS(x) ((x)<<8) +#define S3C2410_NFCONF_TWRPH0(x) ((x)<<4) +#define S3C2410_NFCONF_TWRPH1(x) ((x)<<0) + +static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd) +{ + struct nand_chip *chip = mtd->priv; + + DEBUGN("hwcontrol(): 0x%02x: ", cmd); + + switch (cmd) { + case NAND_CTL_SETNCE: + NFCONF &= ~S3C2410_NFCONF_nFCE; + DEBUGN("NFCONF=0x%08x\n", NFCONF); + break; + case NAND_CTL_CLRNCE: + NFCONF |= S3C2410_NFCONF_nFCE; + DEBUGN("NFCONF=0x%08x\n", NFCONF); + break; + case NAND_CTL_SETALE: + chip->IO_ADDR_W = NF_BASE + 0x8; + DEBUGN("SETALE\n"); + break; + case NAND_CTL_SETCLE: + chip->IO_ADDR_W = NF_BASE + 0x4; + DEBUGN("SETCLE\n"); + break; + default: + chip->IO_ADDR_W = NF_BASE + 0xc; + break; + } + return; +} + +static int s3c2410_dev_ready(struct mtd_info *mtd) +{ + DEBUGN("dev_ready\n"); + return (NFSTAT & 0x01); +} + +#ifdef CONFIG_S3C2410_NAND_HWECC +void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode) +{ + DEBUGN("s3c2410_nand_enable_hwecc(%p, %d)\n", mtd ,mode); + NFCONF |= S3C2410_NFCONF_INITECC; +} + +static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, + u_char *ecc_code) +{ + ecc_code[0] = NFECC0; + ecc_code[1] = NFECC1; + ecc_code[2] = NFECC2; + DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n", + mtd , ecc_code[0], ecc_code[1], ecc_code[2]); + + return 0; +} + +static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat, + u_char *read_ecc, u_char *calc_ecc) +{ + if (read_ecc[0] == calc_ecc[0] && + read_ecc[1] == calc_ecc[1] && + read_ecc[2] == calc_ecc[2]) + return 0; + + printf("s3c2410_nand_correct_data: not implemented\n"); + return -1; +} +#endif + +int board_nand_init(struct nand_chip *nand) +{ + u_int32_t cfg; + u_int8_t tacls, twrph0, twrph1; + S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER(); + + DEBUGN("board_nand_init()\n"); + + clk_power->CLKCON |= (1 << 4); + + /* initialize hardware */ + twrph0 = 3; twrph1 = 0; tacls = 0; + + cfg = S3C2410_NFCONF_EN; + cfg |= S3C2410_NFCONF_TACLS(tacls - 1); + cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1); + cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1); + + NFCONF = cfg; + + /* initialize nand_chip data structure */ + nand->IO_ADDR_R = nand->IO_ADDR_W = 0x4e00000c; + + /* read_buf and write_buf are default */ + /* read_byte and write_byte are default */ + + /* hwcontrol always must be implemented */ + nand->hwcontrol = s3c2410_hwcontrol; + + nand->dev_ready = s3c2410_dev_ready; + +#ifdef CONFIG_S3C2410_NAND_HWECC + nand->enable_hwecc = s3c2410_nand_enable_hwecc; + nand->calculate_ecc = s3c2410_nand_calculate_ecc; + nand->correct_data = s3c2410_nand_correct_data; + nand->eccmode = NAND_ECC_HW3_512; +#else + nand->eccmode = NAND_ECC_SOFT; +#endif + +#ifdef CONFIG_S3C2410_NAND_BBT + nand->options = NAND_USE_FLASH_BBT; +#else + nand->options = 0; +#endif + + DEBUGN("end of nand_init\n"); + + return 0; +} + +#else + #error "U-Boot legacy NAND support not available for S3C2410" +#endif +#endif diff --git a/cpu/arm920t/s3c24x0/serial.c b/cpu/arm920t/s3c24x0/serial.c index 36851ad..6e853b8 100644 --- a/cpu/arm920t/s3c24x0/serial.c +++ b/cpu/arm920t/s3c24x0/serial.c @@ -48,18 +48,74 @@ DECLARE_GLOBAL_DATA_PTR; #error "Bad: you didn't configure serial ..." #endif -void serial_setbrg (void) +#if defined(CONFIG_SERIAL_MULTI) +#include <serial.h> + +/* Multi serial device functions */ +#define DECLARE_S3C_SERIAL_FUNCTIONS(port) \ + int s3serial##port##_init (void) {\ + return serial_init_dev(port);}\ + void s3serial##port##_setbrg (void) {\ + serial_setbrg_dev(port);}\ + int s3serial##port##_getc (void) {\ + return serial_getc_dev(port);}\ + int s3serial##port##_tstc (void) {\ + return serial_tstc_dev(port);}\ + void s3serial##port##_putc (const char c) {\ + serial_putc_dev(port, c);}\ + void s3serial##port##_puts (const char *s) {\ + serial_puts_dev(port, s);} + +#define INIT_S3C_SERIAL_STRUCTURE(port,name,bus) {\ + name,\ + bus,\ + s3serial##port##_init,\ + s3serial##port##_setbrg,\ + s3serial##port##_getc,\ + s3serial##port##_tstc,\ + s3serial##port##_putc,\ + s3serial##port##_puts, } + +#endif /* CONFIG_SERIAL_MULTI */ + +void _serial_setbrg(const int dev_index) { - S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR); - int i; + S3C24X0_UART * const uart = S3C24X0_GetBase_UART(dev_index); unsigned int reg = 0; + int i; /* value is calculated so : (int)(PCLK/16./baudrate) -1 */ reg = get_PCLK() / (16 * gd->baudrate) - 1; + uart->UBRDIV = reg; + for (i = 0; i < 100; i++); +} +#if defined(CONFIG_SERIAL_MULTI) +static inline void +serial_setbrg_dev(unsigned int dev_index) +{ + _serial_setbrg(dev_index); +} +#else +void serial_setbrg(void) +{ + _serial_setbrg(UART_NR); +} +#endif + + +/* Initialise the serial port. The settings are always 8 data bits, no parity, + * 1 stop bit, no start bits. + */ +static int serial_init_dev(const int dev_index) +{ + S3C24X0_UART * const uart = S3C24X0_GetBase_UART(dev_index); + int i; + /* FIFO enable, Tx/Rx FIFO clear */ uart->UFCON = 0x07; uart->UMCON = 0x0; + /* Normal,No parity,1 stop,8 bit */ uart->ULCON = 0x3; /* @@ -67,40 +123,57 @@ void serial_setbrg (void) * normal,interrupt or polling */ uart->UCON = 0x245; - uart->UBRDIV = reg; #ifdef CONFIG_HWFLOW uart->UMCON = 0x1; /* RTS up */ #endif - for (i = 0; i < 100; i++); + + /* FIXME: This is sooooooooooooooooooo ugly */ +#if defined(CONFIG_ARCH_GTA02_v1) || defined(CONFIG_ARCH_GTA02_v2) + /* we need auto hw flow control on the gsm and gps port */ + if (dev_index == 0 || dev_index == 1) + uart->UMCON = 0x10; +#endif + _serial_setbrg(dev_index); + + return (0); } -/* - * Initialise the serial port with the given baudrate. The settings - * are always 8 data bits, no parity, 1 stop bit, no start bits. - * +#if !defined(CONFIG_SERIAL_MULTI) +/* Initialise the serial port. The settings are always 8 data bits, no parity, + * 1 stop bit, no start bits. */ int serial_init (void) { - serial_setbrg (); - - return (0); + return serial_init_dev(UART_NR); } +#endif /* * Read a single byte from the serial port. Returns 1 on success, 0 * otherwise. When the function is succesfull, the character read is * written into its argument c. */ -int serial_getc (void) +int _serial_getc (const int dev_index) { - S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR); + S3C24X0_UART * const uart = S3C24X0_GetBase_UART(dev_index); /* wait for character to arrive */ while (!(uart->UTRSTAT & 0x1)); return uart->URXH & 0xff; } +#if defined(CONFIG_SERIAL_MULTI) +static inline int serial_getc_dev(unsigned int dev_index) +{ + return _serial_getc(dev_index); +} +#else +int serial_getc (void) +{ + return _serial_getc(UART_NR); +} +#endif #ifdef CONFIG_HWFLOW static int hwflow = 0; /* turned off by default */ @@ -138,9 +211,9 @@ void enable_putc(void) /* * Output a single byte to the serial port. */ -void serial_putc (const char c) +void _serial_putc (const char c, const int dev_index) { - S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR); + S3C24X0_UART * const uart = S3C24X0_GetBase_UART(dev_index); #ifdef CONFIG_MODEM_SUPPORT if (be_quiet) return; @@ -161,23 +234,72 @@ void serial_putc (const char c) if (c == '\n') serial_putc ('\r'); } +#if defined(CONFIG_SERIAL_MULTI) +static inline void serial_putc_dev(unsigned int dev_index, const char c) +{ + _serial_putc(c, dev_index); +} +#else +void serial_putc(const char c) +{ + _serial_putc(c, UART_NR); +} +#endif + /* * Test whether a character is in the RX buffer */ -int serial_tstc (void) +int _serial_tstc(const int dev_index) { - S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR); + S3C24X0_UART * const uart = S3C24X0_GetBase_UART(dev_index); return uart->UTRSTAT & 0x1; } +#if defined(CONFIG_SERIAL_MULTI) +static inline int +serial_tstc_dev(unsigned int dev_index) +{ + return _serial_tstc(dev_index); +} +#else +int serial_tstc(void) +{ + return _serial_tstc(UART_NR); +} +#endif -void -serial_puts (const char *s) +void _serial_puts(const char *s, const int dev_index) { while (*s) { - serial_putc (*s++); + _serial_putc (*s++, dev_index); } } +#if defined(CONFIG_SERIAL_MULTI) +static inline void +serial_puts_dev(int dev_index, const char *s) +{ + _serial_puts(s, dev_index); +} +#else +void +serial_puts (const char *s) +{ + _serial_puts(s, UART_NR); +} +#endif + +#if defined(CONFIG_SERIAL_MULTI) +DECLARE_S3C_SERIAL_FUNCTIONS(0); +struct serial_device s3c24xx_serial0_device = + INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0", "S3UART1"); +DECLARE_S3C_SERIAL_FUNCTIONS(1); +struct serial_device s3c24xx_serial1_device = + INIT_S3C_SERIAL_STRUCTURE(1, "s3ser1", "S3UART2"); +DECLARE_S3C_SERIAL_FUNCTIONS(2); +struct serial_device s3c24xx_serial2_device = + INIT_S3C_SERIAL_STRUCTURE(2, "s3ser2", "S3UART3"); + +#endif /* CONFIG_SERIAL_MULTI */ #endif /* defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB) */ diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index aefcdd1..ae86002 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -329,12 +329,12 @@ cpu_init_crit: .macro irq_save_user_regs sub sp, sp, #S_FRAME_SIZE stmia sp, {r0 - r12} @ Calling r0-r12 - add r8, sp, #S_PC - stmdb r8, {sp, lr}^ @ Calling SP, LR - str lr, [r8, #0] @ Save calling PC + add r7, sp, #S_PC + stmdb r7, {sp, lr}^ @ Calling SP, LR + str lr, [r7, #0] @ Save calling PC mrs r6, spsr - str r6, [r8, #4] @ Save CPSR - str r0, [r8, #8] @ Save OLD_R0 + str r6, [r7, #4] @ Save CPSR + str r0, [r7, #8] @ Save OLD_R0 mov r0, sp .endm diff --git a/cpu/arm926ejs/cpuinfo.c b/cpu/arm926ejs/cpuinfo.c index 8c98631..35ba7db 100644 --- a/cpu/arm926ejs/cpuinfo.c +++ b/cpu/arm926ejs/cpuinfo.c @@ -18,8 +18,6 @@ #define omap_readw(x) *(volatile unsigned short *)(x) #define omap_readl(x) *(volatile unsigned long *)(x) -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - #define OMAP_DIE_ID_0 0xfffe1800 #define OMAP_DIE_ID_1 0xfffe1804 #define OMAP_PRODUCTION_ID_0 0xfffe2000 diff --git a/cpu/at32ap/hsdramc.c b/cpu/at32ap/hsdramc.c index a936e03..1fcfe75 100644 --- a/cpu/at32ap/hsdramc.c +++ b/cpu/at32ap/hsdramc.c @@ -38,6 +38,10 @@ unsigned long sdram_init(const struct sdram_info *info) unsigned long bus_hz; unsigned int i; + if (!info->refresh_period) + panic("ERROR: SDRAM refresh period == 0. " + "Please update the board code\n"); + tmp = (HSDRAMC1_BF(NC, info->col_bits - 8) | HSDRAMC1_BF(NR, info->row_bits - 11) | HSDRAMC1_BF(NB, info->bank_bits - 1) @@ -113,7 +117,7 @@ unsigned long sdram_init(const struct sdram_info *info) * 15.6 us is a typical value for a burst of length one */ bus_hz = get_sdram_clk_rate(); - hsdramc1_writel(TR, (156 * (bus_hz / 1000)) / 10000); + hsdramc1_writel(TR, info->refresh_period); printf("SDRAM: %u MB at address 0x%08lx\n", sdram_size >> 20, info->phys_addr); diff --git a/cpu/bf533/Makefile b/cpu/bf533/Makefile index dd4f299..ad48f1c 100644 --- a/cpu/bf533/Makefile +++ b/cpu/bf533/Makefile @@ -28,12 +28,12 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a -START = start.o start1.o interrupt.o cache.o flush.o init_sdram.o +SOBJS = start.o start1.o interrupt.o cache.o flush.o init_sdram.o COBJS = cpu.o traps.o ints.o serial.o interrupts.o video.o EXTRA = init_sdram_bootrom_initblock.o -SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) START := $(addprefix $(obj),$(START)) diff --git a/cpu/bf533/bf533_serial.h b/cpu/bf533/bf533_serial.h index 25b96a9..9970b72 100644 --- a/cpu/bf533/bf533_serial.h +++ b/cpu/bf533/bf533_serial.h @@ -49,8 +49,8 @@ #include <asm/blackfin.h> #define SYNC_ALL __asm__ __volatile__ ("ssync;\n") -#define ACCESS_LATCH *pUART_LCR |= UART_LCR_DLAB; -#define ACCESS_PORT_IER *pUART_LCR &= (~UART_LCR_DLAB); +#define ACCESS_LATCH *pUART_LCR |= DLAB; +#define ACCESS_PORT_IER *pUART_LCR &= (~DLAB); void serial_setbrg(void); static void local_put_char(char ch); diff --git a/cpu/bf533/cache.S b/cpu/bf533/cache.S index 03aebe4..d9015c6 100644 --- a/cpu/bf533/cache.S +++ b/cpu/bf533/cache.S @@ -2,6 +2,7 @@ #include <asm/linkage.h> #include <config.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/mpu.h> .text .align 2 @@ -11,7 +12,7 @@ ENTRY(_blackfin_icache_flush_range) P0 = R2; P1 = R1; CSYNC; -1: + 1: IFLUSH[P0++]; CC = P0 < P1(iu); IF CC JUMP 1b(bp); diff --git a/cpu/bf533/config.mk b/cpu/bf533/config.mk index 6a713c3..2caa3cc 100644 --- a/cpu/bf533/config.mk +++ b/cpu/bf533/config.mk @@ -24,4 +24,4 @@ # MA 02110-1301 USA # -PLATFORM_RELFLAGS += -mcpu=bf533 -ffixed-P5 +PLATFORM_RELFLAGS += -mcpu=bf533 diff --git a/cpu/bf533/cpu.c b/cpu/bf533/cpu.c index 8118861..edb771e 100644 --- a/cpu/bf533/cpu.c +++ b/cpu/bf533/cpu.c @@ -40,7 +40,7 @@ extern unsigned int dcplb_table[page_descriptor_table_size][2]; int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { - __asm__ __volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_ISRAM) + __asm__ __volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_INST_SRAM) ); return 0; @@ -100,22 +100,18 @@ void icache_enable(void) } - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL = IMC | ENICPLB; - sync(); - sti(); + SSYNC(); } void icache_disable(void) { - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL &= ~(IMC | ENICPLB); - sync(); - sti(); + SSYNC(); } int icache_status(void) @@ -175,14 +171,12 @@ void dcache_enable(void) } } - cli(); temp = *(unsigned int *)DMEM_CONTROL; - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL = ACACHE_BCACHE | ENDCPLB | PORT_PREF0 | temp; - sync(); - sti(); + SSYNC(); } void dcache_disable(void) @@ -190,13 +184,11 @@ void dcache_disable(void) unsigned int *I0, *I1; int i; - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL &= ~(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); - sync(); - sti(); + SSYNC(); /* after disable dcache, * clear it so we don't confuse the next application diff --git a/cpu/bf533/init_sdram.S b/cpu/bf533/init_sdram.S index e1a8e2f..67a99e4 100644 --- a/cpu/bf533/init_sdram.S +++ b/cpu/bf533/init_sdram.S @@ -4,6 +4,10 @@ #include <config.h> #include <asm/blackfin.h> #include <asm/mem_init.h> +#include <asm/mach-common/bits/bootrom.h> +#include <asm/mach-common/bits/ebiu.h> +#include <asm/mach-common/bits/pll.h> +#include <asm/mach-common/bits/uart.h> .global init_sdram; #if (CONFIG_CCLK_DIV == 1) diff --git a/cpu/bf533/init_sdram_bootrom_initblock.S b/cpu/bf533/init_sdram_bootrom_initblock.S index 99ed920..8694ca2 100644 --- a/cpu/bf533/init_sdram_bootrom_initblock.S +++ b/cpu/bf533/init_sdram_bootrom_initblock.S @@ -4,6 +4,10 @@ #include <config.h> #include <asm/blackfin.h> #include <asm/mem_init.h> +#include <asm/mach-common/bits/bootrom.h> +#include <asm/mach-common/bits/ebiu.h> +#include <asm/mach-common/bits/pll.h> +#include <asm/mach-common/bits/uart.h> .global init_sdram; #if (CONFIG_CCLK_DIV == 1) diff --git a/cpu/bf533/interrupt.S b/cpu/bf533/interrupt.S index c356d53..7556ec9 100644 --- a/cpu/bf533/interrupt.S +++ b/cpu/bf533/interrupt.S @@ -42,9 +42,7 @@ #define ASSEMBLY #include <config.h> #include <asm/blackfin.h> -#include <asm/hw_irq.h> #include <asm/entry.h> -#include <asm/blackfin_defs.h> .global _blackfin_irq_panic; @@ -55,7 +53,7 @@ .global _evt_emulation _evt_emulation: SAVE_CONTEXT - r0 = IRQ_EMU; + r0 = 0; r1 = seqstat; sp += -12; call _blackfin_irq_panic; @@ -66,7 +64,7 @@ _evt_emulation: .global _evt_nmi _evt_nmi: SAVE_CONTEXT - r0 = IRQ_NMI; + r0 = 2; r1 = RETN; sp += -12; call _blackfin_irq_panic; @@ -88,7 +86,7 @@ _trap: .global _evt_rst _evt_rst: SAVE_CONTEXT - r0 = IRQ_RST; + r0 = 1; r1 = RETN; sp += -12; call _do_reset; @@ -98,7 +96,7 @@ _evt_rst_exit: rtn; irq_panic: - r0 = IRQ_EVX; + r0 = 3; r1 = sp; sp += -12; call _blackfin_irq_panic; @@ -115,7 +113,7 @@ _evt_ivhw_exit: .global _evt_timer _evt_timer: SAVE_CONTEXT - r0 = IRQ_CORETMR; + r0 = 6; sp += -12; /* Polling method used now. */ /* call timer_int; */ diff --git a/cpu/bf533/interrupts.c b/cpu/bf533/interrupts.c index 14d06cf..3d1c3bc 100644 --- a/cpu/bf533/interrupts.c +++ b/cpu/bf533/interrupts.c @@ -35,8 +35,6 @@ */ #include <common.h> -#include <asm/machdep.h> -#include <asm/irq.h> #include <config.h> #include <asm/blackfin.h> #include "cpu.h" @@ -72,12 +70,10 @@ ulong get_tbclk(void) void enable_interrupts(void) { - restore_flags(int_flag); } int disable_interrupts(void) { - save_and_cli(int_flag); return 1; } diff --git a/cpu/bf533/ints.c b/cpu/bf533/ints.c index 5586689..05d9a1b 100644 --- a/cpu/bf533/ints.c +++ b/cpu/bf533/ints.c @@ -39,12 +39,9 @@ #include <common.h> #include <linux/stddef.h> #include <asm/system.h> -#include <asm/irq.h> #include <asm/traps.h> #include <asm/io.h> #include <asm/errno.h> -#include <asm/machdep.h> -#include <asm/setup.h> #include <asm/blackfin.h> #include "cpu.h" @@ -61,42 +58,40 @@ void blackfin_irq_panic(int reason, struct pt_regs *regs) void blackfin_init_IRQ(void) { - *(unsigned volatile long *)(SIC_IMASK) = SIC_UNMASK_ALL; - cli(); + *(unsigned volatile long *)(SIC_IMASK) = 0; #ifndef CONFIG_KGDB - *(unsigned volatile long *)(EVT_EMULATION_ADDR) = 0x0; + *(unsigned volatile long *)(EVT1) = 0x0; #endif - *(unsigned volatile long *)(EVT_NMI_ADDR) = + *(unsigned volatile long *)(EVT2) = (unsigned volatile long)evt_nmi; - *(unsigned volatile long *)(EVT_EXCEPTION_ADDR) = + *(unsigned volatile long *)(EVT3) = (unsigned volatile long)trap; - *(unsigned volatile long *)(EVT_HARDWARE_ERROR_ADDR) = + *(unsigned volatile long *)(EVT5) = (unsigned volatile long)evt_ivhw; - *(unsigned volatile long *)(EVT_RESET_ADDR) = + *(unsigned volatile long *)(EVT0) = (unsigned volatile long)evt_rst; - *(unsigned volatile long *)(EVT_TIMER_ADDR) = + *(unsigned volatile long *)(EVT6) = (unsigned volatile long)evt_timer; - *(unsigned volatile long *)(EVT_IVG7_ADDR) = + *(unsigned volatile long *)(EVT7) = (unsigned volatile long)evt_evt7; - *(unsigned volatile long *)(EVT_IVG8_ADDR) = + *(unsigned volatile long *)(EVT8) = (unsigned volatile long)evt_evt8; - *(unsigned volatile long *)(EVT_IVG9_ADDR) = + *(unsigned volatile long *)(EVT9) = (unsigned volatile long)evt_evt9; - *(unsigned volatile long *)(EVT_IVG10_ADDR) = + *(unsigned volatile long *)(EVT10) = (unsigned volatile long)evt_evt10; - *(unsigned volatile long *)(EVT_IVG11_ADDR) = + *(unsigned volatile long *)(EVT11) = (unsigned volatile long)evt_evt11; - *(unsigned volatile long *)(EVT_IVG12_ADDR) = + *(unsigned volatile long *)(EVT12) = (unsigned volatile long)evt_evt12; - *(unsigned volatile long *)(EVT_IVG13_ADDR) = + *(unsigned volatile long *)(EVT13) = (unsigned volatile long)evt_evt13; - *(unsigned volatile long *)(EVT_IVG14_ADDR) = + *(unsigned volatile long *)(EVT14) = (unsigned volatile long)evt_system_call; - *(unsigned volatile long *)(EVT_IVG15_ADDR) = + *(unsigned volatile long *)(EVT15) = (unsigned volatile long)evt_soft_int1; *(volatile unsigned long *)ILAT = 0; asm("csync;"); - sti(); *(volatile unsigned long *)IMASK = 0xffbf; asm("csync;"); } diff --git a/cpu/bf533/serial.c b/cpu/bf533/serial.c index 8ac6e3f..05fcfcc 100644 --- a/cpu/bf533/serial.c +++ b/cpu/bf533/serial.c @@ -43,14 +43,12 @@ */ #include <common.h> -#include <asm/irq.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/delay.h> -#include <asm/uaccess.h> #include <asm/io.h> #include "bf533_serial.h" +#include <asm/mach-common/bits/uart.h> DECLARE_GLOBAL_DATA_PTR; @@ -85,30 +83,30 @@ void serial_setbrg(void) } /* Enable UART */ - *pUART_GCTL |= UART_GCTL_UCEN; - sync(); + *pUART_GCTL |= UCEN; + SSYNC(); /* Set DLAB in LCR to Access DLL and DLH */ ACCESS_LATCH; - sync(); + SSYNC(); *pUART_DLL = hw_baud_table[i].dl_low; - sync(); + SSYNC(); *pUART_DLH = hw_baud_table[i].dl_high; - sync(); + SSYNC(); /* Clear DLAB in LCR to Access THR RBR IER */ ACCESS_PORT_IER; - sync(); + SSYNC(); /* Enable ERBFI and ELSI interrupts * to poll SIC_ISR register*/ - *pUART_IER = UART_IER_ELSI | UART_IER_ERBFI | UART_IER_ETBEI; - sync(); + *pUART_IER = ELSI | ERBFI | ETBEI; + SSYNC(); /* Set LCR to Word Lengh 8-bit word select */ - *pUART_LCR = UART_LCR_WLS8; - sync(); + *pUART_LCR = WLS_8; + SSYNC(); return; } @@ -121,14 +119,14 @@ int serial_init(void) void serial_putc(const char c) { - if ((*pUART_LSR) & UART_LSR_TEMT) { + if ((*pUART_LSR) & TEMT) { if (c == '\n') serial_putc('\r'); local_put_char(c); } - while (!((*pUART_LSR) & UART_LSR_TEMT)) + while (!((*pUART_LSR) & TEMT)) SYNC_ALL; return; @@ -136,7 +134,7 @@ void serial_putc(const char c) int serial_tstc(void) { - if (*pUART_LSR & UART_LSR_DR) + if (*pUART_LSR & DR) return 1; else return 0; @@ -149,14 +147,14 @@ int serial_getc(void) int ret; /* Poll for RX Interrupt */ - while (!((isr_val = - *(volatile unsigned long *)SIC_ISR) & IRQ_UART_RX_BIT)) ; + while (!serial_tstc()) + continue; asm("csync;"); uart_lsr_val = *pUART_LSR; /* Clear status bit */ uart_rbr_val = *pUART_RBR; /* getc() */ - if (isr_val & IRQ_UART_ERROR_BIT) { + if (uart_lsr_val & (OE|PE|FE|BI)) { ret = -1; } else { ret = uart_rbr_val & 0xff; @@ -177,19 +175,12 @@ static void local_put_char(char ch) int flags = 0; unsigned long isr_val; - save_and_cli(flags); - /* Poll for TX Interruput */ - while (!((isr_val = *pSIC_ISR) & IRQ_UART_TX_BIT)) ; + while (!(*pUART_LSR & THRE)) + continue; asm("csync;"); *pUART_THR = ch; /* putc() */ - if (isr_val & IRQ_UART_ERROR_BIT) { - printf("?"); - } - - restore_flags(flags); - return; } diff --git a/cpu/bf533/start.S b/cpu/bf533/start.S index 67a60cf..c32fef6 100644 --- a/cpu/bf533/start.S +++ b/cpu/bf533/start.S @@ -41,19 +41,16 @@ #include <config.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/core.h> +#include <asm/mach-common/bits/dma.h> +#include <asm/mach-common/bits/pll.h> + .global _stext; .global __bss_start; .global start; .global _start; -.global _rambase; -.global _ramstart; -.global _ramend; -.global _bf533_data_dest; -.global _bf533_data_size; .global edata; -.global _initialize; .global _exit; -.global flashdataend; .global init_sdram; #if (CONFIG_CCLK_DIV == 1) @@ -143,8 +140,8 @@ no_soft_reset: nop; /* Clear EVT registers */ - p0.h = (EVT_EMULATION_ADDR >> 16); - p0.l = (EVT_EMULATION_ADDR & 0xFFFF); + p0.h = (EVT0 >> 16); + p0.l = (EVT0 & 0xFFFF); p0 += 8; p1 = 14; r1 = 0; @@ -200,8 +197,8 @@ loop1: */ /* To keep ourselves in the supervisor mode */ - p0.l = (EVT_IVG15_ADDR & 0xFFFF); - p0.h = (EVT_IVG15_ADDR >> 16); + p0.l = (EVT15 & 0xFFFF); + p0.h = (EVT15 >> 16); p1.l = _real_start; p1.h = _real_start; @@ -209,8 +206,8 @@ loop1: p0.l = (IMASK & 0xFFFF); p0.h = (IMASK >> 16); - r0.l = LO(IVG15_POS); - r0.h = HI(IVG15_POS); + r0.l = LO(EVT_IVG15); + r0.h = HI(EVT_IVG15); [p0] = r0; raise 15; p0.l = WAIT_HERE; @@ -236,8 +233,8 @@ copy: R1.H = reset_end; R1.L = reset_end; R2 = R1 - R0; /* Count */ - R1.H = hi(L1_ISRAM); /* Destination Address (high) */ - R1.L = lo(L1_ISRAM); /* Destination Address (low) */ + R1.H = hi(L1_INST_SRAM); /* Destination Address (high) */ + R1.L = lo(L1_INST_SRAM); /* Destination Address (low) */ R3.L = DMAEN; /* Source DMAConfig Value (8-bit words) */ /* Destination DMAConfig Value (8-bit words) */ R4.L = (DI_EN | WNR | DMAEN); diff --git a/cpu/bf533/traps.c b/cpu/bf533/traps.c index 19b1fde..7e156d5 100644 --- a/cpu/bf533/traps.c +++ b/cpu/bf533/traps.c @@ -36,14 +36,13 @@ #include <common.h> #include <linux/types.h> #include <asm/errno.h> -#include <asm/irq.h> #include <asm/system.h> #include <asm/traps.h> -#include <asm/machdep.h> #include "cpu.h" -#include <asm/arch/anomaly.h> #include <asm/cplb.h> #include <asm/io.h> +#include <asm/mach-common/bits/core.h> +#include <asm/mach-common/bits/mpu.h> void init_IRQ(void) { @@ -68,7 +67,7 @@ static unsigned int cplb_sizes[4] = void trap_c(struct pt_regs *regs) { unsigned int addr; - unsigned long trapnr = (regs->seqstat) & SEQSTAT_EXCAUSE; + unsigned long trapnr = (regs->seqstat) & EXCAUSE; unsigned int i, j, size, *I0, *I1; unsigned short data = 0; @@ -76,7 +75,7 @@ void trap_c(struct pt_regs *regs) /* 0x26 - Data CPLB Miss */ case VEC_CPLB_M: -#ifdef ANOMALY_05000261 +#if ANOMALY_05000261 /* * Work around an anomaly: if we see a new DCPLB fault, * return without doing anything. Then, @@ -118,16 +117,16 @@ void trap_c(struct pt_regs *regs) /* Turn the cache off */ if (data) { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL &= ~(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); - sync(); + SSYNC(); } else { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL &= ~(IMC | ENICPLB); - sync(); + SSYNC(); } if (data) { @@ -173,16 +172,16 @@ void trap_c(struct pt_regs *regs) /* Turn the cache back on */ if (data) { j = *(unsigned int *)DMEM_CONTROL; - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL = ACACHE_BCACHE | ENDCPLB | PORT_PREF0 | j; - sync(); + SSYNC(); } else { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL = IMC | ENICPLB; - sync(); + SSYNC(); } break; diff --git a/cpu/bf537/Makefile b/cpu/bf537/Makefile index 8b0f9c0..06d1aae 100644 --- a/cpu/bf537/Makefile +++ b/cpu/bf537/Makefile @@ -28,12 +28,12 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a -START = start.o start1.o interrupt.o cache.o flush.o init_sdram.o +SOBJS = start.o start1.o interrupt.o cache.o flush.o init_sdram.o COBJS = cpu.o traps.o ints.o serial.o interrupts.o video.o i2c.o EXTRA = init_sdram_bootrom_initblock.o -SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) START := $(addprefix $(obj),$(START)) diff --git a/cpu/bf537/cache.S b/cpu/bf537/cache.S index 5bda5bf..d9015c6 100644 --- a/cpu/bf537/cache.S +++ b/cpu/bf537/cache.S @@ -2,6 +2,7 @@ #include <asm/linkage.h> #include <config.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/mpu.h> .text .align 2 diff --git a/cpu/bf537/config.mk b/cpu/bf537/config.mk index 8a35789..fbbe75d 100644 --- a/cpu/bf537/config.mk +++ b/cpu/bf537/config.mk @@ -24,4 +24,4 @@ # MA 02110-1301 USA # -PLATFORM_RELFLAGS += -mcpu=bf537 -ffixed-P5 +PLATFORM_RELFLAGS += -mcpu=bf537 diff --git a/cpu/bf537/cpu.c b/cpu/bf537/cpu.c index 62f603b..7233908 100644 --- a/cpu/bf537/cpu.c +++ b/cpu/bf537/cpu.c @@ -40,7 +40,7 @@ extern unsigned int dcplb_table[page_descriptor_table_size][2]; int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { - __asm__ __volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_ISRAM) + __asm__ __volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_INST_SRAM) ); return 0; @@ -103,24 +103,20 @@ void icache_enable(void) } - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL = IMC | ENICPLB; - sync(); - sti(); + SSYNC(); } void icache_disable(void) { if ((*pCHIPID >> 28) < 2) return; - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL &= ~(IMC | ENICPLB); - sync(); - sti(); + SSYNC(); } int icache_status(void) @@ -180,14 +176,12 @@ void dcache_enable(void) } } - cli(); temp = *(unsigned int *)DMEM_CONTROL; - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL = ACACHE_BCACHE | ENDCPLB | PORT_PREF0 | temp; - sync(); - sti(); + SSYNC(); } void dcache_disable(void) @@ -195,13 +189,11 @@ void dcache_disable(void) unsigned int *I0, *I1; int i; - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL &= ~(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); - sync(); - sti(); + SSYNC(); /* after disable dcache, * clear it so we don't confuse the next application diff --git a/cpu/bf537/i2c.c b/cpu/bf537/i2c.c index 0daba63..ab7dd38 100644 --- a/cpu/bf537/i2c.c +++ b/cpu/bf537/i2c.c @@ -21,53 +21,10 @@ #include <asm/blackfin.h> #include <i2c.h> #include <asm/io.h> +#include <asm/mach-common/bits/twi.h> DECLARE_GLOBAL_DATA_PTR; -#define bfin_read16(addr) ({ unsigned __v; \ - __asm__ __volatile__ (\ - "%0 = w[%1] (z);\n\t"\ - : "=d"(__v) : "a"(addr)); (unsigned short)__v; }) - -#define bfin_write16(addr,val) ({\ - __asm__ __volatile__ (\ - "w[%0] = %1;\n\t"\ - : : "a"(addr) , "d"(val) : "memory");}) - -/* Two-Wire Interface (0xFFC01400 - 0xFFC014FF) */ -#define bfin_read_TWI_CLKDIV() bfin_read16(TWI_CLKDIV) -#define bfin_write_TWI_CLKDIV(val) bfin_write16(TWI_CLKDIV,val) -#define bfin_read_TWI_CONTROL() bfin_read16(TWI_CONTROL) -#define bfin_write_TWI_CONTROL(val) bfin_write16(TWI_CONTROL,val) -#define bfin_read_TWI_SLAVE_CTL() bfin_read16(TWI_SLAVE_CTL) -#define bfin_write_TWI_SLAVE_CTL(val) bfin_write16(TWI_SLAVE_CTL,val) -#define bfin_read_TWI_SLAVE_STAT() bfin_read16(TWI_SLAVE_STAT) -#define bfin_write_TWI_SLAVE_STAT(val) bfin_write16(TWI_SLAVE_STAT,val) -#define bfin_read_TWI_SLAVE_ADDR() bfin_read16(TWI_SLAVE_ADDR) -#define bfin_write_TWI_SLAVE_ADDR(val) bfin_write16(TWI_SLAVE_ADDR,val) -#define bfin_read_TWI_MASTER_CTL() bfin_read16(TWI_MASTER_CTL) -#define bfin_write_TWI_MASTER_CTL(val) bfin_write16(TWI_MASTER_CTL,val) -#define bfin_read_TWI_MASTER_STAT() bfin_read16(TWI_MASTER_STAT) -#define bfin_write_TWI_MASTER_STAT(val) bfin_write16(TWI_MASTER_STAT,val) -#define bfin_read_TWI_MASTER_ADDR() bfin_read16(TWI_MASTER_ADDR) -#define bfin_write_TWI_MASTER_ADDR(val) bfin_write16(TWI_MASTER_ADDR,val) -#define bfin_read_TWI_INT_STAT() bfin_read16(TWI_INT_STAT) -#define bfin_write_TWI_INT_STAT(val) bfin_write16(TWI_INT_STAT,val) -#define bfin_read_TWI_INT_MASK() bfin_read16(TWI_INT_MASK) -#define bfin_write_TWI_INT_MASK(val) bfin_write16(TWI_INT_MASK,val) -#define bfin_read_TWI_FIFO_CTL() bfin_read16(TWI_FIFO_CTL) -#define bfin_write_TWI_FIFO_CTL(val) bfin_write16(TWI_FIFO_CTL,val) -#define bfin_read_TWI_FIFO_STAT() bfin_read16(TWI_FIFO_STAT) -#define bfin_write_TWI_FIFO_STAT(val) bfin_write16(TWI_FIFO_STAT,val) -#define bfin_read_TWI_XMT_DATA8() bfin_read16(TWI_XMT_DATA8) -#define bfin_write_TWI_XMT_DATA8(val) bfin_write16(TWI_XMT_DATA8,val) -#define bfin_read_TWI_XMT_DATA16() bfin_read16(TWI_XMT_DATA16) -#define bfin_write_TWI_XMT_DATA16(val) bfin_write16(TWI_XMT_DATA16,val) -#define bfin_read_TWI_RCV_DATA8() bfin_read16(TWI_RCV_DATA8) -#define bfin_write_TWI_RCV_DATA8(val) bfin_write16(TWI_RCV_DATA8,val) -#define bfin_read_TWI_RCV_DATA16() bfin_read16(TWI_RCV_DATA16) -#define bfin_write_TWI_RCV_DATA16(val) bfin_write16(TWI_RCV_DATA16,val) - #ifdef DEBUG_I2C #define PRINTD(fmt,args...) do { \ if (gd->have_console) \ diff --git a/cpu/bf537/init_sdram.S b/cpu/bf537/init_sdram.S index 897a589..e997500 100644 --- a/cpu/bf537/init_sdram.S +++ b/cpu/bf537/init_sdram.S @@ -4,6 +4,10 @@ #include <config.h> #include <asm/blackfin.h> #include <asm/mem_init.h> +#include <asm/mach-common/bits/bootrom.h> +#include <asm/mach-common/bits/ebiu.h> +#include <asm/mach-common/bits/pll.h> +#include <asm/mach-common/bits/uart.h> .global init_sdram; #if (BFIN_BOOT_MODE != BF537_UART_BOOT) diff --git a/cpu/bf537/init_sdram_bootrom_initblock.S b/cpu/bf537/init_sdram_bootrom_initblock.S index f9adbb9..197b836 100644 --- a/cpu/bf537/init_sdram_bootrom_initblock.S +++ b/cpu/bf537/init_sdram_bootrom_initblock.S @@ -4,6 +4,10 @@ #include <config.h> #include <asm/blackfin.h> #include <asm/mem_init.h> +#include <asm/mach-common/bits/bootrom.h> +#include <asm/mach-common/bits/ebiu.h> +#include <asm/mach-common/bits/pll.h> +#include <asm/mach-common/bits/uart.h> .global init_sdram; #if (BFIN_BOOT_MODE != BF537_UART_BOOT) diff --git a/cpu/bf537/interrupt.S b/cpu/bf537/interrupt.S index a71df55..fe850bf 100644 --- a/cpu/bf537/interrupt.S +++ b/cpu/bf537/interrupt.S @@ -42,9 +42,7 @@ #define ASSEMBLY #include <config.h> #include <asm/blackfin.h> -#include <asm/hw_irq.h> #include <asm/entry.h> -#include <asm/blackfin_defs.h> .global _blackfin_irq_panic; @@ -55,7 +53,7 @@ .global _evt_emulation _evt_emulation: SAVE_CONTEXT - r0 = IRQ_EMU; + r0 = 0; r1 = seqstat; sp += -12; call _blackfin_irq_panic; @@ -66,7 +64,7 @@ _evt_emulation: .global _evt_nmi _evt_nmi: SAVE_CONTEXT - r0 = IRQ_NMI; + r0 = 2; r1 = RETN; sp += -12; call _blackfin_irq_panic; @@ -88,7 +86,7 @@ _trap: .global _evt_rst _evt_rst: SAVE_CONTEXT - r0 = IRQ_RST; + r0 = 1; r1 = RETN; sp += -12; call _do_reset; @@ -98,7 +96,7 @@ _evt_rst_exit: rtn; irq_panic: - r0 = IRQ_EVX; + r0 = 3; r1 = sp; sp += -12; call _blackfin_irq_panic; @@ -115,7 +113,7 @@ _evt_ivhw_exit: .global _evt_timer _evt_timer: SAVE_CONTEXT - r0 = IRQ_CORETMR; + r0 = 6; sp += -12; /* Polling method used now. */ /* call timer_int; */ diff --git a/cpu/bf537/interrupts.c b/cpu/bf537/interrupts.c index d2213b1..853fa49 100644 --- a/cpu/bf537/interrupts.c +++ b/cpu/bf537/interrupts.c @@ -35,8 +35,6 @@ */ #include <common.h> -#include <asm/machdep.h> -#include <asm/irq.h> #include <config.h> #include <asm/blackfin.h> #include "cpu.h" @@ -72,12 +70,10 @@ ulong get_tbclk (void) void enable_interrupts(void) { - restore_flags(int_flag); } int disable_interrupts(void) { - save_and_cli(int_flag); return 1; } diff --git a/cpu/bf537/ints.c b/cpu/bf537/ints.c index 5586689..05d9a1b 100644 --- a/cpu/bf537/ints.c +++ b/cpu/bf537/ints.c @@ -39,12 +39,9 @@ #include <common.h> #include <linux/stddef.h> #include <asm/system.h> -#include <asm/irq.h> #include <asm/traps.h> #include <asm/io.h> #include <asm/errno.h> -#include <asm/machdep.h> -#include <asm/setup.h> #include <asm/blackfin.h> #include "cpu.h" @@ -61,42 +58,40 @@ void blackfin_irq_panic(int reason, struct pt_regs *regs) void blackfin_init_IRQ(void) { - *(unsigned volatile long *)(SIC_IMASK) = SIC_UNMASK_ALL; - cli(); + *(unsigned volatile long *)(SIC_IMASK) = 0; #ifndef CONFIG_KGDB - *(unsigned volatile long *)(EVT_EMULATION_ADDR) = 0x0; + *(unsigned volatile long *)(EVT1) = 0x0; #endif - *(unsigned volatile long *)(EVT_NMI_ADDR) = + *(unsigned volatile long *)(EVT2) = (unsigned volatile long)evt_nmi; - *(unsigned volatile long *)(EVT_EXCEPTION_ADDR) = + *(unsigned volatile long *)(EVT3) = (unsigned volatile long)trap; - *(unsigned volatile long *)(EVT_HARDWARE_ERROR_ADDR) = + *(unsigned volatile long *)(EVT5) = (unsigned volatile long)evt_ivhw; - *(unsigned volatile long *)(EVT_RESET_ADDR) = + *(unsigned volatile long *)(EVT0) = (unsigned volatile long)evt_rst; - *(unsigned volatile long *)(EVT_TIMER_ADDR) = + *(unsigned volatile long *)(EVT6) = (unsigned volatile long)evt_timer; - *(unsigned volatile long *)(EVT_IVG7_ADDR) = + *(unsigned volatile long *)(EVT7) = (unsigned volatile long)evt_evt7; - *(unsigned volatile long *)(EVT_IVG8_ADDR) = + *(unsigned volatile long *)(EVT8) = (unsigned volatile long)evt_evt8; - *(unsigned volatile long *)(EVT_IVG9_ADDR) = + *(unsigned volatile long *)(EVT9) = (unsigned volatile long)evt_evt9; - *(unsigned volatile long *)(EVT_IVG10_ADDR) = + *(unsigned volatile long *)(EVT10) = (unsigned volatile long)evt_evt10; - *(unsigned volatile long *)(EVT_IVG11_ADDR) = + *(unsigned volatile long *)(EVT11) = (unsigned volatile long)evt_evt11; - *(unsigned volatile long *)(EVT_IVG12_ADDR) = + *(unsigned volatile long *)(EVT12) = (unsigned volatile long)evt_evt12; - *(unsigned volatile long *)(EVT_IVG13_ADDR) = + *(unsigned volatile long *)(EVT13) = (unsigned volatile long)evt_evt13; - *(unsigned volatile long *)(EVT_IVG14_ADDR) = + *(unsigned volatile long *)(EVT14) = (unsigned volatile long)evt_system_call; - *(unsigned volatile long *)(EVT_IVG15_ADDR) = + *(unsigned volatile long *)(EVT15) = (unsigned volatile long)evt_soft_int1; *(volatile unsigned long *)ILAT = 0; asm("csync;"); - sti(); *(volatile unsigned long *)IMASK = 0xffbf; asm("csync;"); } diff --git a/cpu/bf537/serial.c b/cpu/bf537/serial.c index f7a2483..3c6a370 100644 --- a/cpu/bf537/serial.c +++ b/cpu/bf537/serial.c @@ -43,14 +43,12 @@ */ #include <common.h> -#include <asm/irq.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/delay.h> -#include <asm/uaccess.h> #include <asm/io.h> #include "serial.h" +#include <asm/mach-common/bits/uart.h> DECLARE_GLOBAL_DATA_PTR; @@ -85,30 +83,30 @@ void serial_setbrg(void) } /* Enable UART */ - *pUART_GCTL |= UART_GCTL_UCEN; - sync(); + *pUART0_GCTL |= UCEN; + SSYNC(); /* Set DLAB in LCR to Access DLL and DLH */ ACCESS_LATCH; - sync(); + SSYNC(); - *pUART_DLL = hw_baud_table[i].dl_low; - sync(); - *pUART_DLH = hw_baud_table[i].dl_high; - sync(); + *pUART0_DLL = hw_baud_table[i].dl_low; + SSYNC(); + *pUART0_DLH = hw_baud_table[i].dl_high; + SSYNC(); /* Clear DLAB in LCR to Access THR RBR IER */ ACCESS_PORT_IER; - sync(); + SSYNC(); /* Enable ERBFI and ELSI interrupts * to poll SIC_ISR register*/ - *pUART_IER = UART_IER_ELSI | UART_IER_ERBFI | UART_IER_ETBEI; - sync(); + *pUART0_IER = ELSI | ERBFI | ETBEI; + SSYNC(); /* Set LCR to Word Lengh 8-bit word select */ - *pUART_LCR = UART_LCR_WLS8; - sync(); + *pUART0_LCR = WLS_8; + SSYNC(); return; } @@ -121,14 +119,14 @@ int serial_init(void) void serial_putc(const char c) { - if ((*pUART_LSR) & UART_LSR_TEMT) { + if ((*pUART0_LSR) & TEMT) { if (c == '\n') serial_putc('\r'); local_put_char(c); } - while (!((*pUART_LSR) & UART_LSR_TEMT)) + while (!((*pUART0_LSR) & TEMT)) SYNC_ALL; return; @@ -136,7 +134,7 @@ void serial_putc(const char c) int serial_tstc(void) { - if (*pUART_LSR & UART_LSR_DR) + if (*pUART0_LSR & DR) return 1; else return 0; @@ -149,14 +147,14 @@ int serial_getc(void) int ret; /* Poll for RX Interrupt */ - while (!((isr_val = - *(volatile unsigned long *)SIC_ISR) & IRQ_UART_RX_BIT)) ; + while (!serial_tstc()) + continue; asm("csync;"); - uart_lsr_val = *pUART_LSR; /* Clear status bit */ - uart_rbr_val = *pUART_RBR; /* getc() */ + uart_lsr_val = *pUART0_LSR; /* Clear status bit */ + uart_rbr_val = *pUART0_RBR; /* getc() */ - if (isr_val & IRQ_UART_ERROR_BIT) { + if (uart_lsr_val & (OE|PE|FE|BI)) { ret = -1; } else { ret = uart_rbr_val & 0xff; @@ -177,19 +175,12 @@ static void local_put_char(char ch) int flags = 0; unsigned long isr_val; - save_and_cli(flags); - /* Poll for TX Interruput */ - while (!((isr_val = *pSIC_ISR) & IRQ_UART_TX_BIT)) ; + while (!(*pUART0_LSR & THRE)) + continue; asm("csync;"); - *pUART_THR = ch; /* putc() */ - - if (isr_val & IRQ_UART_ERROR_BIT) { - printf("?"); - } - - restore_flags(flags); + *pUART0_THR = ch; /* putc() */ return; } diff --git a/cpu/bf537/serial.h b/cpu/bf537/serial.h index 76555c2..e4e0b9a 100644 --- a/cpu/bf537/serial.h +++ b/cpu/bf537/serial.h @@ -49,8 +49,8 @@ #include <asm/blackfin.h> #define SYNC_ALL __asm__ __volatile__ ("ssync;\n") -#define ACCESS_LATCH *pUART_LCR |= UART_LCR_DLAB; -#define ACCESS_PORT_IER *pUART_LCR &= (~UART_LCR_DLAB); +#define ACCESS_LATCH *pUART0_LCR |= DLAB; +#define ACCESS_PORT_IER *pUART0_LCR &= (~DLAB); void serial_setbrg(void); static void local_put_char(char ch); diff --git a/cpu/bf537/start.S b/cpu/bf537/start.S index 4e02bcb..a48f3c6 100644 --- a/cpu/bf537/start.S +++ b/cpu/bf537/start.S @@ -41,19 +41,16 @@ #include <config.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/core.h> +#include <asm/mach-common/bits/dma.h> +#include <asm/mach-common/bits/pll.h> + .global _stext; .global __bss_start; .global start; .global _start; -.global _rambase; -.global _ramstart; -.global _ramend; -.global _bf533_data_dest; -.global _bf533_data_size; .global edata; -.global _initialize; .global _exit; -.global flashdataend; .global init_sdram; .global _icache_enable; .global _dcache_enable; @@ -151,8 +148,8 @@ no_soft_reset: nop; /* Clear EVT registers */ - p0.h = (EVT_EMULATION_ADDR >> 16); - p0.l = (EVT_EMULATION_ADDR & 0xFFFF); + p0.h = (EVT0 >> 16); + p0.l = (EVT0 & 0xFFFF); p0 += 8; p1 = 14; r1 = 0; @@ -291,8 +288,8 @@ postcopy: R1.H = (CFG_FLASH_BASE >> 16); R1.L = (CFG_FLASH_BASE & 0xFFFF); R0 = R0 + R1; /* Source Address */ - R1.H = hi(L1_ISRAM); /* Destination Address (high) */ - R1.L = lo(L1_ISRAM); /* Destination Address (low) */ + R1.H = hi(L1_INST_SRAM); /* Destination Address (high) */ + R1.L = lo(L1_INST_SRAM); /* Destination Address (low) */ R3.L = DMAEN; /* Source DMAConfig Value (8-bit words) */ /* Destination DMAConfig Value (8-bit words) */ R4.L = (DI_EN | WNR | DMAEN); @@ -415,8 +412,8 @@ loop1: */ /* To keep ourselves in the supervisor mode */ - p0.l = (EVT_IVG15_ADDR & 0xFFFF); - p0.h = (EVT_IVG15_ADDR >> 16); + p0.l = (EVT15 & 0xFFFF); + p0.h = (EVT15 >> 16); p1.l = _real_start; p1.h = _real_start; @@ -424,8 +421,8 @@ loop1: p0.l = (IMASK & 0xFFFF); p0.h = (IMASK >> 16); - r0.l = LO(IVG15_POS); - r0.h = HI(IVG15_POS); + r0.l = LO(EVT_IVG15); + r0.h = HI(EVT_IVG15); [p0] = r0; raise 15; p0.l = WAIT_HERE; @@ -495,8 +492,8 @@ copy: R1.H = reset_end; R1.L = reset_end; R2 = R1 - R0; /* Count */ - R1.H = hi(L1_ISRAM); /* Destination Address (high) */ - R1.L = lo(L1_ISRAM); /* Destination Address (low) */ + R1.H = hi(L1_INST_SRAM); /* Destination Address (high) */ + R1.L = lo(L1_INST_SRAM); /* Destination Address (low) */ R3.L = DMAEN; /* Source DMAConfig Value (8-bit words) */ R4.L = (DI_EN | WNR | DMAEN); /* Destination DMAConfig Value (8-bit words) */ diff --git a/cpu/bf537/traps.c b/cpu/bf537/traps.c index 4e18e27..51de322 100644 --- a/cpu/bf537/traps.c +++ b/cpu/bf537/traps.c @@ -36,14 +36,13 @@ #include <common.h> #include <linux/types.h> #include <asm/errno.h> -#include <asm/irq.h> #include <asm/system.h> #include <asm/traps.h> -#include <asm/machdep.h> #include "cpu.h" -#include <asm/arch/anomaly.h> #include <asm/cplb.h> #include <asm/io.h> +#include <asm/mach-common/bits/core.h> +#include <asm/mach-common/bits/mpu.h> void init_IRQ(void) { @@ -68,7 +67,7 @@ static unsigned int cplb_sizes[4] = void trap_c(struct pt_regs *regs) { unsigned int addr; - unsigned long trapnr = (regs->seqstat) & SEQSTAT_EXCAUSE; + unsigned long trapnr = (regs->seqstat) & EXCAUSE; unsigned int i, j, size, *I0, *I1; unsigned short data = 0; @@ -76,7 +75,7 @@ void trap_c(struct pt_regs *regs) /* 0x26 - Data CPLB Miss */ case VEC_CPLB_M: -#ifdef ANOMALY_05000261 +#if ANOMALY_05000261 /* * Work around an anomaly: if we see a new DCPLB fault, * return without doing anything. Then, @@ -118,16 +117,16 @@ void trap_c(struct pt_regs *regs) /* Turn the cache off */ if (data) { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL &= ~(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); - sync(); + SSYNC(); } else { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL &= ~(IMC | ENICPLB); - sync(); + SSYNC(); } if (data) { @@ -173,16 +172,16 @@ void trap_c(struct pt_regs *regs) /* Turn the cache back on */ if (data) { j = *(unsigned int *)DMEM_CONTROL; - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL = ACACHE_BCACHE | ENDCPLB | PORT_PREF0 | j; - sync(); + SSYNC(); } else { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL = IMC | ENICPLB; - sync(); + SSYNC(); } break; diff --git a/cpu/bf561/Makefile b/cpu/bf561/Makefile index 2947169..418a437 100644 --- a/cpu/bf561/Makefile +++ b/cpu/bf561/Makefile @@ -28,12 +28,12 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a -START = start.o start1.o interrupt.o cache.o flush.o init_sdram.o +SOBJS = start.o start1.o interrupt.o cache.o flush.o init_sdram.o COBJS = cpu.o traps.o ints.o serial.o interrupts.o video.o EXTRA = init_sdram_bootrom_initblock.o -SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) START := $(addprefix $(obj),$(START)) diff --git a/cpu/bf561/cache.S b/cpu/bf561/cache.S index 5bda5bf..d9015c6 100644 --- a/cpu/bf561/cache.S +++ b/cpu/bf561/cache.S @@ -2,6 +2,7 @@ #include <asm/linkage.h> #include <config.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/mpu.h> .text .align 2 diff --git a/cpu/bf561/config.mk b/cpu/bf561/config.mk index f4dc04b..3628a02 100644 --- a/cpu/bf561/config.mk +++ b/cpu/bf561/config.mk @@ -24,4 +24,4 @@ # MA 02110-1301 USA # -PLATFORM_RELFLAGS += -mcpu=bf561 -ffixed-P5 +PLATFORM_RELFLAGS += -mcpu=bf561 diff --git a/cpu/bf561/cpu.c b/cpu/bf561/cpu.c index 5b907cd..e0dd2f5 100644 --- a/cpu/bf561/cpu.c +++ b/cpu/bf561/cpu.c @@ -40,7 +40,7 @@ extern unsigned int dcplb_table[page_descriptor_table_size][2]; int do_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { - __asm__ __volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_ISRAM) + __asm__ __volatile__("cli r3;" "P0 = %0;" "JUMP (P0);"::"r"(L1_INST_SRAM) ); return 0; @@ -100,22 +100,18 @@ void icache_enable(void) } - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL = IMC | ENICPLB; - sync(); - sti(); + SSYNC(); } void icache_disable(void) { - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL &= ~(IMC | ENICPLB); - sync(); - sti(); + SSYNC(); } int icache_status(void) @@ -175,14 +171,12 @@ void dcache_enable(void) } } - cli(); temp = *(unsigned int *)DMEM_CONTROL; - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL = ACACHE_BCACHE | ENDCPLB | PORT_PREF0 | temp; - sync(); - sti(); + SSYNC(); } void dcache_disable(void) @@ -191,13 +185,11 @@ void dcache_disable(void) unsigned int *I0, *I1; int i; - cli(); - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL &= ~(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); - sync(); - sti(); + SSYNC(); /* after disable dcache, clear it so we don't confuse the next application */ I0 = (unsigned int *)DCPLB_ADDR0; diff --git a/cpu/bf561/init_sdram.S b/cpu/bf561/init_sdram.S index d763f27..f5ccf30 100644 --- a/cpu/bf561/init_sdram.S +++ b/cpu/bf561/init_sdram.S @@ -4,6 +4,10 @@ #include <config.h> #include <asm/blackfin.h> #include <asm/mem_init.h> +#include <asm/mach-common/bits/bootrom.h> +#include <asm/mach-common/bits/ebiu.h> +#include <asm/mach-common/bits/pll.h> +#include <asm/mach-common/bits/uart.h> .global init_sdram; #if (CONFIG_CCLK_DIV == 1) diff --git a/cpu/bf561/init_sdram_bootrom_initblock.S b/cpu/bf561/init_sdram_bootrom_initblock.S index 5e3c88a..9cc5e78 100644 --- a/cpu/bf561/init_sdram_bootrom_initblock.S +++ b/cpu/bf561/init_sdram_bootrom_initblock.S @@ -4,6 +4,10 @@ #include <config.h> #include <asm/blackfin.h> #include <asm/mem_init.h> +#include <asm/mach-common/bits/bootrom.h> +#include <asm/mach-common/bits/ebiu.h> +#include <asm/mach-common/bits/pll.h> +#include <asm/mach-common/bits/uart.h> .global init_sdram; #if (CONFIG_CCLK_DIV == 1) diff --git a/cpu/bf561/interrupt.S b/cpu/bf561/interrupt.S index 21839ce..a10eaab 100644 --- a/cpu/bf561/interrupt.S +++ b/cpu/bf561/interrupt.S @@ -42,9 +42,7 @@ #define ASSEMBLY #include <config.h> #include <asm/blackfin.h> -#include <asm/hw_irq.h> #include <asm/entry.h> -#include <asm/blackfin_defs.h> .global _blackfin_irq_panic; @@ -55,7 +53,7 @@ .global _evt_emulation _evt_emulation: SAVE_CONTEXT - r0 = IRQ_EMU; + r0 = 0; r1 = seqstat; sp += -12; call _blackfin_irq_panic; @@ -66,7 +64,7 @@ _evt_emulation: .global _evt_nmi _evt_nmi: SAVE_CONTEXT - r0 = IRQ_NMI; + r0 = 2; r1 = RETN; sp += -12; call _blackfin_irq_panic; @@ -88,7 +86,7 @@ _trap: .global _evt_rst _evt_rst: SAVE_CONTEXT - r0 = IRQ_RST; + r0 = 1; r1 = RETN; sp += -12; call _do_reset; @@ -98,7 +96,7 @@ _evt_rst_exit: rtn; irq_panic: - r0 = IRQ_EVX; + r0 = 3; r1 = sp; sp += -12; call _blackfin_irq_panic; @@ -115,7 +113,7 @@ _evt_ivhw_exit: .global _evt_timer _evt_timer: SAVE_CONTEXT - r0 = IRQ_CORETMR; + r0 = 6; sp += -12; /* Polling method used now. */ /* call timer_int; */ diff --git a/cpu/bf561/interrupts.c b/cpu/bf561/interrupts.c index ecbc6ad..7880061 100644 --- a/cpu/bf561/interrupts.c +++ b/cpu/bf561/interrupts.c @@ -35,8 +35,6 @@ */ #include <common.h> -#include <asm/machdep.h> -#include <asm/irq.h> #include <config.h> #include <asm/blackfin.h> #include "cpu.h" @@ -72,12 +70,10 @@ ulong get_tbclk(void) void enable_interrupts(void) { - restore_flags(int_flag); } int disable_interrupts(void) { - save_and_cli(int_flag); return 1; } diff --git a/cpu/bf561/ints.c b/cpu/bf561/ints.c index 27a38a3..d6aa393 100644 --- a/cpu/bf561/ints.c +++ b/cpu/bf561/ints.c @@ -39,12 +39,9 @@ #include <common.h> #include <linux/stddef.h> #include <asm/system.h> -#include <asm/irq.h> #include <asm/traps.h> #include <asm/io.h> #include <asm/errno.h> -#include <asm/machdep.h> -#include <asm/setup.h> #include <asm/blackfin.h> #include "cpu.h" @@ -61,42 +58,40 @@ void blackfin_irq_panic(int reason, struct pt_regs *regs) void blackfin_init_IRQ(void) { - *(unsigned volatile long *)(SIC_IMASK) = SIC_UNMASK_ALL; - cli(); + *(unsigned volatile long *)(SICA_IMASK0) = 0; #ifndef CONFIG_KGDB - *(unsigned volatile long *)(EVT_EMULATION_ADDR) = 0x0; + *(unsigned volatile long *)(EVT1) = 0x0; #endif - *(unsigned volatile long *)(EVT_NMI_ADDR) = + *(unsigned volatile long *)(EVT2) = (unsigned volatile long)evt_nmi; - *(unsigned volatile long *)(EVT_EXCEPTION_ADDR) = + *(unsigned volatile long *)(EVT3) = (unsigned volatile long)trap; - *(unsigned volatile long *)(EVT_HARDWARE_ERROR_ADDR) = + *(unsigned volatile long *)(EVT5) = (unsigned volatile long)evt_ivhw; - *(unsigned volatile long *)(EVT_RESET_ADDR) = + *(unsigned volatile long *)(EVT0) = (unsigned volatile long)evt_rst; - *(unsigned volatile long *)(EVT_TIMER_ADDR) = + *(unsigned volatile long *)(EVT6) = (unsigned volatile long)evt_timer; - *(unsigned volatile long *)(EVT_IVG7_ADDR) = + *(unsigned volatile long *)(EVT7) = (unsigned volatile long)evt_evt7; - *(unsigned volatile long *)(EVT_IVG8_ADDR) = + *(unsigned volatile long *)(EVT8) = (unsigned volatile long)evt_evt8; - *(unsigned volatile long *)(EVT_IVG9_ADDR) = + *(unsigned volatile long *)(EVT9) = (unsigned volatile long)evt_evt9; - *(unsigned volatile long *)(EVT_IVG10_ADDR) = + *(unsigned volatile long *)(EVT10) = (unsigned volatile long)evt_evt10; - *(unsigned volatile long *)(EVT_IVG11_ADDR) = + *(unsigned volatile long *)(EVT11) = (unsigned volatile long)evt_evt11; - *(unsigned volatile long *)(EVT_IVG12_ADDR) = + *(unsigned volatile long *)(EVT12) = (unsigned volatile long)evt_evt12; - *(unsigned volatile long *)(EVT_IVG13_ADDR) = + *(unsigned volatile long *)(EVT13) = (unsigned volatile long)evt_evt13; - *(unsigned volatile long *)(EVT_IVG14_ADDR) = + *(unsigned volatile long *)(EVT14) = (unsigned volatile long)evt_system_call; - *(unsigned volatile long *)(EVT_IVG15_ADDR) = + *(unsigned volatile long *)(EVT15) = (unsigned volatile long)evt_soft_int1; *(volatile unsigned long *)ILAT = 0; asm("csync;"); - sti(); *(volatile unsigned long *)IMASK = 0xffbf; asm("csync;"); } diff --git a/cpu/bf561/serial.c b/cpu/bf561/serial.c index bc5a4f5..a398fd5 100644 --- a/cpu/bf561/serial.c +++ b/cpu/bf561/serial.c @@ -43,14 +43,12 @@ */ #include <common.h> -#include <asm/irq.h> #include <asm/system.h> -#include <asm/segment.h> #include <asm/bitops.h> #include <asm/delay.h> -#include <asm/uaccess.h> #include "serial.h" #include <asm/io.h> +#include <asm/mach-common/bits/uart.h> DECLARE_GLOBAL_DATA_PTR; @@ -85,32 +83,32 @@ void serial_setbrg(void) } /* Enable UART */ - *pUART_GCTL |= UART_GCTL_UCEN; - sync(); + *pUART_GCTL |= UCEN; + SSYNC(); /* Set DLAB in LCR to Access DLL and DLH */ ACCESS_LATCH; - sync(); + SSYNC(); *pUART_DLL = hw_baud_table[i].dl_low; - sync(); + SSYNC(); *pUART_DLH = hw_baud_table[i].dl_high; - sync(); + SSYNC(); /* Clear DLAB in LCR to Access THR RBR IER */ ACCESS_PORT_IER; - sync(); + SSYNC(); /* * Enable ERBFI and ELSI interrupts * to poll SIC_ISR register */ - *pUART_IER = UART_IER_ELSI | UART_IER_ERBFI | UART_IER_ETBEI; - sync(); + *pUART_IER = ELSI | ERBFI | ETBEI; + SSYNC(); /* Set LCR to Word Lengh 8-bit word select */ - *pUART_LCR = UART_LCR_WLS8; - sync(); + *pUART_LCR = WLS_8; + SSYNC(); return; } @@ -123,14 +121,14 @@ int serial_init(void) void serial_putc(const char c) { - if ((*pUART_LSR) & UART_LSR_TEMT) { + if ((*pUART_LSR) & TEMT) { if (c == '\n') serial_putc('\r'); local_put_char(c); } - while (!((*pUART_LSR) & UART_LSR_TEMT)) + while (!((*pUART_LSR) & TEMT)) SYNC_ALL; return; @@ -138,7 +136,7 @@ void serial_putc(const char c) int serial_tstc(void) { - if (*pUART_LSR & UART_LSR_DR) + if (*pUART_LSR & DR) return 1; else return 0; @@ -151,14 +149,14 @@ int serial_getc(void) int ret; /* Poll for RX Interrupt */ - while (!((isr_val = - *(volatile unsigned long *)SIC_ISR) & IRQ_UART_RX_BIT)) ; + while (!serial_tstc()) + continue; asm("csync;"); uart_lsr_val = *pUART_LSR; /* Clear status bit */ uart_rbr_val = *pUART_RBR; /* getc() */ - if (isr_val & IRQ_UART_ERROR_BIT) { + if (uart_lsr_val & (OE|PE|FE|BI)) { ret = -1; } else { ret = uart_rbr_val & 0xff; @@ -179,19 +177,12 @@ static void local_put_char(char ch) int flags = 0; unsigned long isr_val; - save_and_cli(flags); - /* Poll for TX Interruput */ - while (!((isr_val = *pSIC_ISR) & IRQ_UART_TX_BIT)) ; + while (!(*pUART_LSR & THRE)) + continue; asm("csync;"); *pUART_THR = ch; /* putc() */ - if (isr_val & IRQ_UART_ERROR_BIT) { - printf("?"); - } - - restore_flags(flags); - return; } diff --git a/cpu/bf561/serial.h b/cpu/bf561/serial.h index c1cbf36..647560c 100644 --- a/cpu/bf561/serial.h +++ b/cpu/bf561/serial.h @@ -49,8 +49,8 @@ #include <asm/blackfin.h> #define SYNC_ALL __asm__ __volatile__ ("ssync;\n") -#define ACCESS_LATCH *pUART_LCR |= UART_LCR_DLAB; -#define ACCESS_PORT_IER *pUART_LCR &= (~UART_LCR_DLAB); +#define ACCESS_LATCH *pUART_LCR |= DLAB; +#define ACCESS_PORT_IER *pUART_LCR &= (~DLAB); void serial_setbrg(void); static void local_put_char(char ch); diff --git a/cpu/bf561/start.S b/cpu/bf561/start.S index bd26cf3..6565de8 100644 --- a/cpu/bf561/start.S +++ b/cpu/bf561/start.S @@ -41,17 +41,16 @@ #include <config.h> #include <asm/blackfin.h> +#include <asm/mach-common/bits/core.h> +#include <asm/mach-common/bits/dma.h> +#include <asm/mach-common/bits/pll.h> + .global _stext; .global __bss_start; .global start; .global _start; -.global _rambase; -.global _ramstart; -.global _ramend; .global edata; -.global _initialize; .global _exit; -.global flashdataend; .global init_sdram; .text @@ -127,16 +126,16 @@ no_soft_reset: nop; /* Clear EVT registers */ - p0.h = (EVT_EMULATION_ADDR >> 16); - p0.l = (EVT_EMULATION_ADDR & 0xFFFF); + p0.h = (EVT0 >> 16); + p0.l = (EVT0 & 0xFFFF); p0 += 8; p1 = 14; r1 = 0; LSETUP(4,4) lc0 = p1; [ p0 ++ ] = r1; - p0.h = hi(SIC_IWR); - p0.l = lo(SIC_IWR); + p0.h = hi(SICA_IWR0); + p0.l = lo(SICA_IWR0); r0.l = 0x1; w[p0] = r0.l; SSYNC; @@ -193,8 +192,8 @@ loop1: */ /* To keep ourselves in the supervisor mode */ - p0.l = (EVT_IVG15_ADDR & 0xFFFF); - p0.h = (EVT_IVG15_ADDR >> 16); + p0.l = (EVT15 & 0xFFFF); + p0.h = (EVT15 >> 16); p1.l = _real_start; p1.h = _real_start; @@ -202,8 +201,8 @@ loop1: p0.l = (IMASK & 0xFFFF); p0.h = (IMASK >> 16); - r0.l = LO(IVG15_POS); - r0.h = HI(IVG15_POS); + r0.l = LO(EVT_IVG15); + r0.h = HI(EVT_IVG15); [p0] = r0; raise 15; p0.l = WAIT_HERE; @@ -218,13 +217,6 @@ WAIT_HERE: _real_start: [ -- sp ] = reti; -#ifdef CONFIG_EZKIT561 - p0.l = (WDOG_CTL & 0xFFFF); - p0.h = (WDOG_CTL >> 16); - r0 = WATCHDOG_DISABLE(z); - w[p0] = r0; -#endif - /* DMA reset code to Hi of L1 SRAM */ copy: P1.H = hi(SYSMMR_BASE); /* P1 Points to the beginning of SYSTEM MMR Space */ @@ -235,37 +227,37 @@ copy: R1.H = reset_end; R1.L = reset_end; R2 = R1 - R0; /* Count */ - R1.H = hi(L1_ISRAM); /* Destination Address (high) */ - R1.L = lo(L1_ISRAM); /* Destination Address (low) */ + R1.H = hi(L1_INST_SRAM); /* Destination Address (high) */ + R1.L = lo(L1_INST_SRAM); /* Destination Address (low) */ R3.L = DMAEN; /* Source DMAConfig Value (8-bit words) */ R4.L = (DI_EN | WNR | DMAEN); /* Destination DMAConfig Value (8-bit words) */ DMA: R6 = 0x1 (Z); - W[P1+OFFSET_(MDMA_S0_X_MODIFY)] = R6; /* Source Modify = 1 */ - W[P1+OFFSET_(MDMA_D0_X_MODIFY)] = R6; /* Destination Modify = 1 */ + W[P1+OFFSET_(IMDMA_S0_X_MODIFY)] = R6; /* Source Modify = 1 */ + W[P1+OFFSET_(IMDMA_D0_X_MODIFY)] = R6; /* Destination Modify = 1 */ - [P1+OFFSET_(MDMA_S0_START_ADDR)] = R0; /* Set Source Base Address */ - W[P1+OFFSET_(MDMA_S0_X_COUNT)] = R2; /* Set Source Count */ + [P1+OFFSET_(IMDMA_S0_START_ADDR)] = R0; /* Set Source Base Address */ + W[P1+OFFSET_(IMDMA_S0_X_COUNT)] = R2; /* Set Source Count */ /* Set Source DMAConfig = DMA Enable, Memory Read, 8-Bit Transfers, 1-D DMA, Flow - Stop */ - W[P1+OFFSET_(MDMA_S0_CONFIG)] = R3; + W[P1+OFFSET_(IMDMA_S0_CONFIG)] = R3; - [P1+OFFSET_(MDMA_D0_START_ADDR)] = R1; /* Set Destination Base Address */ - W[P1+OFFSET_(MDMA_D0_X_COUNT)] = R2; /* Set Destination Count */ + [P1+OFFSET_(IMDMA_D0_START_ADDR)] = R1; /* Set Destination Base Address */ + W[P1+OFFSET_(IMDMA_D0_X_COUNT)] = R2; /* Set Destination Count */ /* Set Destination DMAConfig = DMA Enable, Memory Write, 8-Bit Transfers, 1-D DMA, Flow - Stop, IOC */ - W[P1+OFFSET_(MDMA_D0_CONFIG)] = R4; + W[P1+OFFSET_(IMDMA_D0_CONFIG)] = R4; WAIT_DMA_DONE: - p0.h = hi(MDMA_D0_IRQ_STATUS); - p0.l = lo(MDMA_D0_IRQ_STATUS); + p0.h = hi(IMDMA_D0_IRQ_STATUS); + p0.l = lo(IMDMA_D0_IRQ_STATUS); R0 = W[P0](Z); CC = BITTST(R0, 0); if ! CC jump WAIT_DMA_DONE R0 = 0x1; - W[P1+OFFSET_(MDMA_D0_IRQ_STATUS)] = R0; /* Write 1 to clear DMA interrupt */ + W[P1+OFFSET_(IMDMA_D0_IRQ_STATUS)] = R0; /* Write 1 to clear DMA interrupt */ /* Initialize BSS Section with 0 s */ p1.l = __bss_start; diff --git a/cpu/bf561/traps.c b/cpu/bf561/traps.c index 7e2dcd1..e35620c 100644 --- a/cpu/bf561/traps.c +++ b/cpu/bf561/traps.c @@ -36,14 +36,13 @@ #include <common.h> #include <linux/types.h> #include <asm/errno.h> -#include <asm/irq.h> #include <asm/system.h> #include <asm/traps.h> -#include <asm/machdep.h> #include "cpu.h" -#include <asm/arch/anomaly.h> #include <asm/cplb.h> #include <asm/io.h> +#include <asm/mach-common/bits/core.h> +#include <asm/mach-common/bits/mpu.h> void init_IRQ(void) { @@ -68,7 +67,7 @@ static unsigned int cplb_sizes[4] = void trap_c(struct pt_regs *regs) { unsigned int addr; - unsigned long trapnr = (regs->seqstat) & SEQSTAT_EXCAUSE; + unsigned long trapnr = (regs->seqstat) & EXCAUSE; unsigned int i, j, size, *I0, *I1; unsigned short data = 0; @@ -76,7 +75,7 @@ void trap_c(struct pt_regs *regs) /* 0x26 - Data CPLB Miss */ case VEC_CPLB_M: -#ifdef ANOMALY_05000261 +#if ANOMALY_05000261 /* * Work around an anomaly: if we see a new DCPLB fault, return * without doing anything. Then, if we get the same fault again, @@ -118,16 +117,16 @@ void trap_c(struct pt_regs *regs) /* Turn the cache off */ if (data) { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL &= ~(ACACHE_BCACHE | ENDCPLB | PORT_PREF0); - sync(); + SSYNC(); } else { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL &= ~(IMC | ENICPLB); - sync(); + SSYNC(); } if (data) { @@ -173,16 +172,16 @@ void trap_c(struct pt_regs *regs) /* Turn the cache back on */ if (data) { j = *(unsigned int *)DMEM_CONTROL; - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)DMEM_CONTROL = ACACHE_BCACHE | ENDCPLB | PORT_PREF0 | j; - sync(); + SSYNC(); } else { - sync(); + SSYNC(); asm(" .align 8; "); *(unsigned int *)IMEM_CONTROL = IMC | ENICPLB; - sync(); + SSYNC(); } break; diff --git a/cpu/mpc512x/config.mk b/cpu/mpc512x/config.mk index 8a07c5a..5b7e1f2 100644 --- a/cpu/mpc512x/config.mk +++ b/cpu/mpc512x/config.mk @@ -22,4 +22,4 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 \ - -ffixed-r2 -ffixed-r29 -msoft-float -mcpu=603e + -ffixed-r2 -msoft-float -mcpu=603e diff --git a/cpu/mpc512x/cpu.c b/cpu/mpc512x/cpu.c index 6421a51..bed77ac 100644 --- a/cpu/mpc512x/cpu.c +++ b/cpu/mpc512x/cpu.c @@ -138,11 +138,11 @@ void ft_cpu_setup(void *blob, bd_t *bd) do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1); do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1); - do_fixup_by_path_u32(blob, cpu_path, "ref-frequency", CFG_MPC512X_CLKIN, 1); do_fixup_by_path_u32(blob, cpu_path, "clock-frequency", bd->bi_intfreq, 1); do_fixup_by_path_u32(blob, "/" OF_SOC, "bus-frequency", bd->bi_ipsfreq, 1); - do_fixup_by_path_u32(blob, "/" OF_SOC, "ref-frequency", CFG_MPC512X_CLKIN, 1); - do_fixup_by_path(blob, eth_path, "address", bd->bi_enetaddr, 6, 0); do_fixup_by_path(blob, eth_path, "local-mac-address", bd->bi_enetaddr, 6, 0); + + /* this is so old kernels with old device trees will boot */ + do_fixup_by_path_u32(blob, "/" OF_SOC_OLD, "bus-frequency", bd->bi_ipsfreq, 0); } #endif diff --git a/cpu/mpc512x/start.S b/cpu/mpc512x/start.S index 244c69b..5a9d868 100644 --- a/cpu/mpc512x/start.S +++ b/cpu/mpc512x/start.S @@ -479,52 +479,6 @@ get_pvr: mfspr r3, PVR blr -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbf */ -/* Description: Data Cache block flush */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbf -ppcDcbf: - dcbf r0,r3 - blr - -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbi */ -/* Description: Data Cache block Invalidate */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbi -ppcDcbi: - dcbi r0,r3 - blr - -/*-------------------------------------------------------------------------- - * Function: ppcDcbz - * Description: Data Cache block zero. - * Input: r3 = effective address - * Output: none. - *-------------------------------------------------------------------------- */ - - .globl ppcDcbz -ppcDcbz: - dcbz r0,r3 - blr - - .globl ppcDWstore -ppcDWstore: - lfd 1, 0(r4) - stfd 1, 0(r3) - blr - - .globl ppcDWload -ppcDWload: - lfd 1, 0(r3) - stfd 1, 0(r4) - blr - /*-------------------------------------------------------------------*/ /* diff --git a/cpu/mpc5xx/config.mk b/cpu/mpc5xx/config.mk index 64cd600..6d66c32 100644 --- a/cpu/mpc5xx/config.mk +++ b/cpu/mpc5xx/config.mk @@ -30,7 +30,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -PLATFORM_CPPFLAGS += -DCONFIG_5xx -ffixed-r2 -ffixed-r29 -mpowerpc -msoft-float +PLATFORM_CPPFLAGS += -DCONFIG_5xx -ffixed-r2 -mpowerpc -msoft-float # Use default linker script. Board port can override in board/*/config.mk LDSCRIPT := $(SRCTREE)/cpu/mpc5xx/u-boot.lds diff --git a/cpu/mpc5xxx/config.mk b/cpu/mpc5xxx/config.mk index 0df51ba..b0ce2ee 100644 --- a/cpu/mpc5xxx/config.mk +++ b/cpu/mpc5xxx/config.mk @@ -23,7 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 -ffixed-r29 \ +PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 \ -mstring -mcpu=603e -mmultiple # Use default linker script. Board port can override in board/*/config.mk diff --git a/cpu/mpc8220/config.mk b/cpu/mpc8220/config.mk index 8e3ba54..5819048 100644 --- a/cpu/mpc8220/config.mk +++ b/cpu/mpc8220/config.mk @@ -23,7 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 -ffixed-r29 \ +PLATFORM_CPPFLAGS += -DCONFIG_MPC8220 -ffixed-r2 \ -mstring -mcpu=603e -mmultiple # Use default linker script. Board port can override in board/*/config.mk diff --git a/cpu/mpc824x/config.mk b/cpu/mpc824x/config.mk index 66207f4..1bb0487 100644 --- a/cpu/mpc824x/config.mk +++ b/cpu/mpc824x/config.mk @@ -23,7 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -ffixed-r29 -mstring -mcpu=603e -msoft-float +PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -mstring -mcpu=603e -msoft-float # Use default linker script. Board port can override in board/*/config.mk LDSCRIPT := $(SRCTREE)/cpu/mpc824x/u-boot.lds diff --git a/cpu/mpc8260/config.mk b/cpu/mpc8260/config.mk index 683b6fb..2cb0270 100644 --- a/cpu/mpc8260/config.mk +++ b/cpu/mpc8260/config.mk @@ -23,7 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 -ffixed-r29 \ +PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 \ -mstring -mcpu=603e -mmultiple # Use default linker script. Board port can override in board/*/config.mk diff --git a/cpu/mpc83xx/config.mk b/cpu/mpc83xx/config.mk index ecf8a60..2f0f1ce 100644 --- a/cpu/mpc83xx/config.mk +++ b/cpu/mpc83xx/config.mk @@ -23,7 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC83XX -DCONFIG_E300 \ - -ffixed-r2 -ffixed-r29 -msoft-float + -ffixed-r2 -msoft-float # Use default linker script. Board port can override in board/*/config.mk LDSCRIPT := $(SRCTREE)/cpu/mpc83xx/u-boot.lds diff --git a/cpu/mpc83xx/fdt.c b/cpu/mpc83xx/fdt.c index 909171f..6f55932 100644 --- a/cpu/mpc83xx/fdt.c +++ b/cpu/mpc83xx/fdt.c @@ -30,6 +30,8 @@ #include <libfdt.h> #include <fdt_support.h> +extern void ft_qe_setup(void *blob); + DECLARE_GLOBAL_DATA_PTR; void ft_cpu_setup(void *blob, bd_t *bd) @@ -48,16 +50,7 @@ void ft_cpu_setup(void *blob, bd_t *bd) do_fixup_by_prop_u32(blob, "device_type", "soc", 4, "bus-frequency", bd->bi_busfreq, 1); #ifdef CONFIG_QE - do_fixup_by_prop_u32(blob, "device_type", "qe", 4, - "bus-frequency", gd->qe_clk, 1); - do_fixup_by_prop_u32(blob, "device_type", "qe", 4, - "brg-frequency", gd->brg_clk, 1); - do_fixup_by_compat_u32(blob, "fsl,qe", - "clock-frequency", gd->qe_clk, 1); - do_fixup_by_compat_u32(blob, "fsl,qe", - "bus-frequency", gd->qe_clk, 1); - do_fixup_by_compat_u32(blob, "fsl,qe", - "brg-frequency", gd->brg_clk, 1); + ft_qe_setup(blob); #endif #ifdef CFG_NS16550 diff --git a/cpu/mpc83xx/start.S b/cpu/mpc83xx/start.S index 1dfbf62..309eb30 100644 --- a/cpu/mpc83xx/start.S +++ b/cpu/mpc83xx/start.S @@ -840,40 +840,6 @@ get_pvr: mfspr r3, PVR blr -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbf */ -/* Description: Data Cache block flush */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbf -ppcDcbf: - dcbf r0,r3 - blr - -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbi */ -/* Description: Data Cache block Invalidate */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbi -ppcDcbi: - dcbi r0,r3 - blr - -/*-------------------------------------------------------------------------- - * Function: ppcDcbz - * Description: Data Cache block zero. - * Input: r3 = effective address - * Output: none. - *-------------------------------------------------------------------------- */ - - .globl ppcDcbz -ppcDcbz: - dcbz r0,r3 - blr - .globl ppcDWstore ppcDWstore: lfd 1, 0(r4) diff --git a/cpu/mpc85xx/config.mk b/cpu/mpc85xx/config.mk index 6121074..f6df702 100644 --- a/cpu/mpc85xx/config.mk +++ b/cpu/mpc85xx/config.mk @@ -23,4 +23,5 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 -ffixed-r29 -Wa,-me500 -msoft-float -mno-string +PLATFORM_CPPFLAGS += -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 \ + -Wa,-me500 -msoft-float -mno-string diff --git a/cpu/mpc85xx/fdt.c b/cpu/mpc85xx/fdt.c index 0ce17e7..a6b014c 100644 --- a/cpu/mpc85xx/fdt.c +++ b/cpu/mpc85xx/fdt.c @@ -27,6 +27,8 @@ #include <libfdt.h> #include <fdt_support.h> +extern void ft_qe_setup(void *blob); + void ft_cpu_setup(void *blob, bd_t *bd) { #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) ||\ @@ -43,11 +45,7 @@ void ft_cpu_setup(void *blob, bd_t *bd) do_fixup_by_prop_u32(blob, "device_type", "soc", 4, "bus-frequency", bd->bi_busfreq, 1); #ifdef CONFIG_QE - do_fixup_by_prop_u32(blob, "device_type", "qe", 4, - "bus-frequency", bd->bi_busfreq, 1); - do_fixup_by_prop_u32(blob, "device_type", "qe", 4, - "brg-frequency", bd->bi_busfreq / 2, 1); - fdt_fixup_qe_firmware(blob); + ft_qe_setup(blob); #endif #ifdef CFG_NS16550 diff --git a/cpu/mpc85xx/speed.c b/cpu/mpc85xx/speed.c index 27de37a..952f30c 100644 --- a/cpu/mpc85xx/speed.c +++ b/cpu/mpc85xx/speed.c @@ -75,6 +75,9 @@ int get_clocks (void) get_sys_info (&sys_info); gd->cpu_clk = sys_info.freqProcessor; gd->bus_clk = sys_info.freqSystemBus; + gd->i2c1_clk = sys_info.freqSystemBus; + gd->i2c2_clk = sys_info.freqSystemBus; + #if defined(CONFIG_CPM2) gd->vco_out = 2*sys_info.freqSystemBus; gd->cpm_clk = gd->vco_out / 2; diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index e8e5eb2..eb24dbc 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -757,51 +757,6 @@ in32r: lwbrx r3,r0,r3 blr -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbf */ -/* Description: Data Cache block flush */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbf -ppcDcbf: - dcbf r0,r3 - blr - -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbi */ -/* Description: Data Cache block Invalidate */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbi -ppcDcbi: - dcbi r0,r3 - blr - -/*-------------------------------------------------------------------------- - * Function: ppcDcbz - * Description: Data Cache block zero. - * Input: r3 = effective address - * Output: none. - *-------------------------------------------------------------------------- */ - - .globl ppcDcbz -ppcDcbz: - dcbz r0,r3 - blr - -/*------------------------------------------------------------------------------- */ -/* Function: ppcSync */ -/* Description: Processor Synchronize */ -/* Input: none. */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcSync -ppcSync: - sync - blr - /*------------------------------------------------------------------------------*/ /* diff --git a/cpu/mpc86xx/config.mk b/cpu/mpc86xx/config.mk index 3c54f4a..d767269 100644 --- a/cpu/mpc86xx/config.mk +++ b/cpu/mpc86xx/config.mk @@ -23,4 +23,4 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -PLATFORM_CPPFLAGS += -DCONFIG_MPC86xx -ffixed-r2 -ffixed-r29 -mstring +PLATFORM_CPPFLAGS += -DCONFIG_MPC86xx -ffixed-r2 -mstring diff --git a/cpu/mpc86xx/speed.c b/cpu/mpc86xx/speed.c index 4f7e8f1..7e884f8 100644 --- a/cpu/mpc86xx/speed.c +++ b/cpu/mpc86xx/speed.c @@ -105,6 +105,8 @@ int get_clocks(void) get_sys_info(&sys_info); gd->cpu_clk = sys_info.freqProcessor; gd->bus_clk = sys_info.freqSystemBus; + gd->i2c1_clk = sys_info.freqSystemBus; + gd->i2c2_clk = sys_info.freqSystemBus; if (gd->cpu_clk != 0) return 0; diff --git a/cpu/mpc86xx/start.S b/cpu/mpc86xx/start.S index c83310a..09f4cee 100644 --- a/cpu/mpc86xx/start.S +++ b/cpu/mpc86xx/start.S @@ -708,50 +708,6 @@ in32r: blr /* - * Function: ppcDcbf - * Description: Data Cache block flush - * Input: r3 = effective address - * Output: none. - */ - .globl ppcDcbf -ppcDcbf: - dcbf r0,r3 - blr - -/* - * Function: ppcDcbi - * Description: Data Cache block Invalidate - * Input: r3 = effective address - * Output: none. - */ - .globl ppcDcbi -ppcDcbi: - dcbi r0,r3 - blr - -/* - * Function: ppcDcbz - * Description: Data Cache block zero. - * Input: r3 = effective address - * Output: none. - */ - .globl ppcDcbz -ppcDcbz: - dcbz r0,r3 - blr - -/* - * Function: ppcSync - * Description: Processor Synchronize - * Input: none. - * Output: none. - */ - .globl ppcSync -ppcSync: - sync - blr - -/* * void relocate_code (addr_sp, gd, addr_moni) * * This "function" does not return, instead it continues in RAM @@ -767,7 +723,7 @@ relocate_code: mr r1, r3 /* Set new stack pointer */ mr r9, r4 /* Save copy of Global Data pointer */ - mr r29, r9 /* Save for DECLARE_GLOBAL_DATA_PTR */ + mr r2, r9 /* Save for DECLARE_GLOBAL_DATA_PTR */ mr r10, r5 /* Save copy of Destination Address */ mr r3, r5 /* Destination Address */ diff --git a/cpu/mpc8xx/config.mk b/cpu/mpc8xx/config.mk index bfa6625..6031e7f 100644 --- a/cpu/mpc8xx/config.mk +++ b/cpu/mpc8xx/config.mk @@ -23,4 +23,4 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -ffixed-r29 -mstring -mcpu=860 -msoft-float +PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -mstring -mcpu=860 -msoft-float diff --git a/cpu/ppc4xx/config.mk b/cpu/ppc4xx/config.mk index 4fd5108..311c97b 100644 --- a/cpu/ppc4xx/config.mk +++ b/cpu/ppc4xx/config.mk @@ -22,7 +22,7 @@ # PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -msoft-float +PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -mstring -msoft-float cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/') is440=$(shell grep CONFIG_440 $(TOPDIR)/include/$(cfg)) diff --git a/cpu/ppc4xx/start.S b/cpu/ppc4xx/start.S index 77c2aa4..c29c87b 100644 --- a/cpu/ppc4xx/start.S +++ b/cpu/ppc4xx/start.S @@ -1306,39 +1306,6 @@ in32r: lwbrx r3,r0,r3 blr -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbf */ -/* Description: Data Cache block flush */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbf -ppcDcbf: - dcbf r0,r3 - blr - -/*------------------------------------------------------------------------------- */ -/* Function: ppcDcbi */ -/* Description: Data Cache block Invalidate */ -/* Input: r3 = effective address */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcDcbi -ppcDcbi: - dcbi r0,r3 - blr - -/*------------------------------------------------------------------------------- */ -/* Function: ppcSync */ -/* Description: Processor Synchronize */ -/* Input: none. */ -/* Output: none. */ -/*------------------------------------------------------------------------------- */ - .globl ppcSync -ppcSync: - sync - blr - /* * void relocate_code (addr_sp, gd, addr_moni) * |