From 1bb1809558e11eb089fba32caed9fc99d21477c1 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Fri, 12 Mar 2010 22:10:31 +0100 Subject: Update .gitignore's: add some generated files Signed-off-by: Wolfgang Denk --- cpu/mpc824x/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 cpu/mpc824x/.gitignore (limited to 'cpu') diff --git a/cpu/mpc824x/.gitignore b/cpu/mpc824x/.gitignore new file mode 100644 index 0000000..2d79931 --- /dev/null +++ b/cpu/mpc824x/.gitignore @@ -0,0 +1 @@ +/bedbug_603e.c -- cgit v1.1 From 93910edb595a88d394da3eb2cf5148096155dfe9 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Fri, 12 Mar 2010 23:06:04 +0100 Subject: Prepare v2010.03-rc1 Coding style cleanup, update CHANGELOG. Signed-off-by: Wolfgang Denk --- cpu/arm920t/ep93xx/Makefile | 1 - cpu/arm_cortexa8/mx51/lowlevel_init.S | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'cpu') diff --git a/cpu/arm920t/ep93xx/Makefile b/cpu/arm920t/ep93xx/Makefile index 30e12af..01a2f55 100644 --- a/cpu/arm920t/ep93xx/Makefile +++ b/cpu/arm920t/ep93xx/Makefile @@ -53,4 +53,3 @@ include $(SRCTREE)/rules.mk sinclude $(obj).depend ######################################################################### - diff --git a/cpu/arm_cortexa8/mx51/lowlevel_init.S b/cpu/arm_cortexa8/mx51/lowlevel_init.S index 700506e..31af9e2 100644 --- a/cpu/arm_cortexa8/mx51/lowlevel_init.S +++ b/cpu/arm_cortexa8/mx51/lowlevel_init.S @@ -33,11 +33,11 @@ mcr 15, 0, r0, c1, c0, 1 /* reconfigure L2 cache aux control reg */ - mov r0, #0xC0 /* tag RAM */ - add r0, r0, #0x4 /* data RAM */ - orr r0, r0, #(1 << 24) /* disable write allocate delay */ - orr r0, r0, #(1 << 23) /* disable write allocate combine */ - orr r0, r0, #(1 << 22) /* disable write allocate */ + mov r0, #0xC0 /* tag RAM */ + add r0, r0, #0x4 /* data RAM */ + orr r0, r0, #(1 << 24) /* disable write allocate delay */ + orr r0, r0, #(1 << 23) /* disable write allocate combine */ + orr r0, r0, #(1 << 22) /* disable write allocate */ cmp r3, #0x10 /* r3 contains the silicon rev */ @@ -157,7 +157,7 @@ /* Switch peripheral to PLL 3 */ ldr r0, =CCM_BASE_ADDR - ldr r1, =0x000010C0 + ldr r1, =0x000010C0 str r1, [r0, #CLKCTL_CBCMR] ldr r1, =0x13239145 str r1, [r0, #CLKCTL_CBCDR] @@ -255,17 +255,17 @@ lowlevel_init: str r1, [r0, #0x4] #ifdef ENABLE_IMPRECISE_ABORT - mrs r1, spsr /* save old spsr */ - mrs r0, cpsr /* read out the cpsr */ - bic r0, r0, #0x100 /* clear the A bit */ - msr spsr, r0 /* update spsr */ - add lr, pc, #0x8 /* update lr */ - movs pc, lr /* update cpsr */ + mrs r1, spsr /* save old spsr */ + mrs r0, cpsr /* read out the cpsr */ + bic r0, r0, #0x100 /* clear the A bit */ + msr spsr, r0 /* update spsr */ + add lr, pc, #0x8 /* update lr */ + movs pc, lr /* update cpsr */ nop nop nop nop - msr spsr, r1 /* restore old spsr */ + msr spsr, r1 /* restore old spsr */ #endif init_l2cc -- cgit v1.1 From 67c7189dd35cb368ef665126fd17816581bd2e92 Mon Sep 17 00:00:00 2001 From: Renato Andreola Date: Tue, 16 Mar 2010 16:01:29 -0400 Subject: nios2: Added support to YANU UART Signed-off-by: Scott McNutt --- cpu/nios2/serial.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 167 insertions(+), 1 deletion(-) (limited to 'cpu') diff --git a/cpu/nios2/serial.c b/cpu/nios2/serial.c index 8bbb803..6c835af 100644 --- a/cpu/nios2/serial.c +++ b/cpu/nios2/serial.c @@ -2,6 +2,9 @@ * (C) Copyright 2004, Psyent Corporation * Scott McNutt * + * YANU Support: + * Copyright 2010, Renato Andreola + * * See file CREDITS for list of people who contributed to this * project. * @@ -26,6 +29,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -74,10 +78,172 @@ int serial_getc (void) return (c); } +#elif defined(CONFIG_CONSOLE_YANU) +/*-----------------------------------------------------------------*/ +/* YANU Imagos serial port */ +/*-----------------------------------------------------------------*/ + +static yanu_uart_t *uart = (yanu_uart_t *)CONFIG_SYS_NIOS_CONSOLE; + +#if defined(CONFIG_SYS_NIOS_FIXEDBAUD) + +/* Everything's already setup for fixed-baud PTF assignment*/ + +void serial_setbrg (void) +{ + int n, k; + const unsigned max_uns = 0xFFFFFFFF; + unsigned best_n, best_m, baud; + + /* compute best N and M couple */ + best_n = YANU_MAX_PRESCALER_N; + for (n = YANU_MAX_PRESCALER_N; n >= 0; n--) { + if ((unsigned)CONFIG_SYS_CLK_FREQ / (1 << (n + 4)) >= + (unsigned)CONFIG_BAUDRATE) { + best_n = n; + break; + } + } + for (k = 0;; k++) { + if ((unsigned)CONFIG_BAUDRATE <= (max_uns >> (15+n-k))) + break; + } + best_m = + ((unsigned)CONFIG_BAUDRATE * (1 << (15 + n - k))) / + ((unsigned)CONFIG_SYS_CLK_FREQ >> k); + + baud = best_m + best_n * YANU_BAUDE; + writel(&uart->baud, baud); + + return; +} + +#else + +void serial_setbrg (void) +{ + int n, k; + const unsigned max_uns = 0xFFFFFFFF; + unsigned best_n, best_m, baud; + + /* compute best N and M couple */ + best_n = YANU_MAX_PRESCALER_N; + for (n = YANU_MAX_PRESCALER_N; n >= 0; n--) { + if ((unsigned)CONFIG_SYS_CLK_FREQ / (1 << (n + 4)) >= + gd->baudrate) { + best_n = n; + break; + } + } + for (k = 0;; k++) { + if (gd->baudrate <= (max_uns >> (15+n-k))) + break; + } + best_m = + (gd->baudrate * (1 << (15 + n - k))) / + ((unsigned)CONFIG_SYS_CLK_FREQ >> k); + + baud = best_m + best_n * YANU_BAUDE; + writel(&uart->baud, baud); + + return; +} + + +#endif /* CONFIG_SYS_NIOS_FIXEDBAUD */ + +int serial_init (void) +{ + unsigned action,control; + + /* status register cleanup */ + action = YANU_ACTION_RRRDY | + YANU_ACTION_RTRDY | + YANU_ACTION_ROE | + YANU_ACTION_RBRK | + YANU_ACTION_RFE | + YANU_ACTION_RPE | + YANU_ACTION_RFE | YANU_ACTION_RFIFO_CLEAR | YANU_ACTION_TFIFO_CLEAR; + + writel(&uart->action, action); + + /* control register cleanup */ + /* no interrupts enabled */ + /* one stop bit */ + /* hardware flow control disabled */ + /* 8 bits */ + control = (0x7 << YANU_CONTROL_BITS_POS); + /* enven parity just to be clean */ + control |= YANU_CONTROL_PAREVEN; + /* we set threshold for fifo */ + control |= YANU_CONTROL_RDYDLY * YANU_RXFIFO_DLY; + control |= YANU_CONTROL_TXTHR * YANU_TXFIFO_THR; + + writel(&uart->control, control); + + /* to set baud rate */ + serial_setbrg(); + + return (0); +} + + +/*----------------------------------------------------------------------- + * YANU CONSOLE + *---------------------------------------------------------------------*/ +void serial_putc (char c) +{ + int tx_chars; + unsigned status; + + if (c == '\n') + serial_putc ('\r'); + + while (1) { + status = readl(&uart->status); + tx_chars = (status>>YANU_TFIFO_CHARS_POS) + & ((1<data, (unsigned char)c); +} + +void serial_puts (const char *s) +{ + while (*s != 0) { + serial_putc (*s++); + } +} + + +int serial_tstc(void) +{ + unsigned status ; + + status = readl(&uart->status); + return (((status >> YANU_RFIFO_CHARS_POS) & + ((1 << YANU_RFIFO_CHARS_N) - 1)) > 0); +} + +int serial_getc (void) +{ + while (serial_tstc() == 0) + WATCHDOG_RESET (); + + /* first we pull the char */ + writel(&uart->action, YANU_ACTION_RFIFO_PULL); + + return(readl(&uart->data) & YANU_DATA_CHAR_MASK); +} + +#else /*CONFIG_CONSOLE_YANU*/ + /*------------------------------------------------------------------ * UART the serial port *-----------------------------------------------------------------*/ -#else static nios_uart_t *uart = (nios_uart_t *) CONFIG_SYS_NIOS_CONSOLE; -- cgit v1.1 From 5647f78d04174b0b99857d2a7cbf25141bd14a45 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sat, 13 Mar 2010 23:14:45 +0100 Subject: mod change 755 => 644 for multiple files I executed 'find . -name "*.[chS]" -perm 755 -exec chmod 644 {} \;' Signed-off-by: Thomas Weber Add some more: neither Makefile nor config.mk need execute permissions. Signed-off-by: Wolfgang Denk --- cpu/arm926ejs/spear/Makefile | 0 cpu/arm926ejs/spear/reset.c | 0 cpu/arm926ejs/spear/timer.c | 0 cpu/arm926ejs/versatile/timer.c | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 cpu/arm926ejs/spear/Makefile mode change 100755 => 100644 cpu/arm926ejs/spear/reset.c mode change 100755 => 100644 cpu/arm926ejs/spear/timer.c mode change 100755 => 100644 cpu/arm926ejs/versatile/timer.c (limited to 'cpu') diff --git a/cpu/arm926ejs/spear/Makefile b/cpu/arm926ejs/spear/Makefile old mode 100755 new mode 100644 diff --git a/cpu/arm926ejs/spear/reset.c b/cpu/arm926ejs/spear/reset.c old mode 100755 new mode 100644 diff --git a/cpu/arm926ejs/spear/timer.c b/cpu/arm926ejs/spear/timer.c old mode 100755 new mode 100644 diff --git a/cpu/arm926ejs/versatile/timer.c b/cpu/arm926ejs/versatile/timer.c old mode 100755 new mode 100644 -- cgit v1.1 From 51c2ac9bb574c1420b993615268392b0c1f829f6 Mon Sep 17 00:00:00 2001 From: Anatolij Gustschin Date: Tue, 16 Mar 2010 17:10:08 +0100 Subject: mpc5121: cpu/mpc512x/diu.c: fix warnings Fix warnings while compiling with CONFIG_VIDEO enabled: diu.c: In function 'video_hw_init': diu.c:158: warning: 'return' with no value, in function returning non-void diu.c:162: warning: format '%ld' expects type 'long int', but argument 6 has type 'int' diu.c:162: warning: format '%ld' expects type 'long int', but argument 7 has type 'int' Signed-off-by: Anatolij Gustschin --- cpu/mpc512x/diu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cpu') diff --git a/cpu/mpc512x/diu.c b/cpu/mpc512x/diu.c index a24f395..ca459a1 100644 --- a/cpu/mpc512x/diu.c +++ b/cpu/mpc512x/diu.c @@ -145,10 +145,10 @@ void *video_hw_init(void) struct fb_info *info; if (mpc5121_diu_init() < 0) - return; + return NULL; /* fill in Graphic device struct */ - sprintf(pGD->modeIdent, "%dx%dx%d %ldkHz %ldHz", + sprintf(pGD->modeIdent, "%dx%dx%d %dkHz %dHz", xres, yres, 32, 64, 60); pGD->frameAdrs = (unsigned int)fsl_fb_open(&info); -- cgit v1.1 From 7e67fb5bf27a07d3b8d6b97c76f7195f7d68af58 Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Tue, 9 Mar 2010 22:13:20 +0100 Subject: ep93xx timer: Fix possible overflow in usecs_to_ticks() ep93xx timer: Use 64-bit values in usecs_to_ticks() in order to avoid overflows in intermediate values Signed-off-by: Matthias Kaehlcke --- cpu/arm920t/ep93xx/timer.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'cpu') diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c index b1a01a0..bc4ec8f 100644 --- a/cpu/arm920t/ep93xx/timer.c +++ b/cpu/arm920t/ep93xx/timer.c @@ -36,7 +36,7 @@ #define TIMER_CLKSEL (1 << 3) #define TIMER_ENABLE (1 << 7) -#define TIMER_FREQ 508469 +#define TIMER_FREQ 508469 /* ticks / second */ #define TIMER_MAX_VAL 0xFFFFFFFF static struct ep93xx_timer @@ -53,18 +53,10 @@ static inline unsigned long clk_to_systicks(unsigned long long clk_ticks) return (unsigned long)sys_ticks; } -static inline unsigned long usecs_to_ticks(unsigned long usecs) +static inline unsigned long long usecs_to_ticks(unsigned long usecs) { - unsigned long ticks; - - if (usecs >= 1000) { - ticks = usecs / 1000; - ticks *= TIMER_FREQ; - ticks /= 1000; - } else { - ticks = usecs * TIMER_FREQ; - ticks /= (1000 * 1000); - } + unsigned long long ticks = (unsigned long long)usecs * TIMER_FREQ; + do_div(ticks, 1000 * 1000); return ticks; } -- cgit v1.1 From d650da2dd4af99967aabc43cccbd8f160eb4cea6 Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Tue, 9 Mar 2010 22:13:33 +0100 Subject: ep93xx timer: Fix resolution of get_ticks() ep93xx timer: Make get_ticks() return a value in CONFIG_SYS_HZ resolution, as announced by get_tbclk() Signed-off-by: Matthias Kaehlcke --- cpu/arm920t/ep93xx/timer.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cpu') diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c index bc4ec8f..31304b7 100644 --- a/cpu/arm920t/ep93xx/timer.c +++ b/cpu/arm920t/ep93xx/timer.c @@ -69,7 +69,7 @@ static inline unsigned long read_timer(void) } /* - * timer without interrupts + * Get the number of ticks (in CONFIG_SYS_HZ resolution) */ unsigned long long get_ticks(void) { @@ -83,12 +83,12 @@ unsigned long long get_ticks(void) timer.last_update = now; - return timer.ticks; + return clk_to_systicks(timer.ticks); } unsigned long get_timer_masked(void) { - return clk_to_systicks(get_ticks()); + return get_ticks(); } unsigned long get_timer(unsigned long base) @@ -109,10 +109,13 @@ void reset_timer(void) void __udelay(unsigned long usec) { - const unsigned long target = get_ticks() + usecs_to_ticks(usec); + /* read the timer and update timer.ticks */ + get_ticks(); - while (get_ticks() < target) - /* noop */; + const unsigned long long target = timer.ticks + usecs_to_ticks(usec); + + while (timer.ticks < target) + get_ticks(); } int timer_init(void) -- cgit v1.1