From 1e67fb32fbdae7949bb423c9e20b3f77c0a61663 Mon Sep 17 00:00:00 2001 From: Thomas Chou Date: Tue, 16 Mar 2010 12:12:48 -0400 Subject: nios2: use generic unaligned.h Signed-off-by: Scott McNutt --- include/asm-nios2/unaligned.h | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 include/asm-nios2/unaligned.h (limited to 'include') diff --git a/include/asm-nios2/unaligned.h b/include/asm-nios2/unaligned.h new file mode 100644 index 00000000000..779117c4bce --- /dev/null +++ b/include/asm-nios2/unaligned.h @@ -0,0 +1,6 @@ +#ifndef _ASM_NIOS2_UNALIGNED_H +#define _ASM_NIOS2_UNALIGNED_H + +#include + +#endif /* _ASM_NIOS2_UNALIGNED_H */ -- cgit v1.3.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 ++++++++++++++++++++++++++++++++++++++++++++++++++- include/nios2-yanu.h | 115 +++++++++++++++++++++++++++++++++++ 2 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 include/nios2-yanu.h (limited to 'include') diff --git a/cpu/nios2/serial.c b/cpu/nios2/serial.c index 8bbb803a689..6c835af4b1b 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; diff --git a/include/nios2-yanu.h b/include/nios2-yanu.h new file mode 100644 index 00000000000..1c9a967932d --- /dev/null +++ b/include/nios2-yanu.h @@ -0,0 +1,115 @@ +/* + * (C) Copyright 2006, Imagos S.a.s + * Renato Andreola + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License 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 + */ + +/************************************************************************* + * Altera NiosII YANU serial interface by Imagos + * please see http://www.opencores.org/project,yanu for + * information/downloads + ************************************************************************/ + +#ifndef __NIOS2_YANU_H__ +#define __NIOS2_YANU_H__ + +#define YANU_MAX_PRESCALER_N ((1 << 4) - 1) /* 15 */ +#define YANU_MAX_PRESCALER_M ((1 << 11) -1) /* 2047 */ +#define YANU_FIFO_SIZE (16) +#define YANU_RXFIFO_SIZE (YANU_FIFO_SIZE) +#define YANU_TXFIFO_SIZE (YANU_FIFO_SIZE) + +#define YANU_RXFIFO_DLY (10*11) +#define YANU_TXFIFO_THR (10) +#define YANU_DATA_CHAR_MASK (0xFF) + +/* data register */ +#define YANU_DATA_OFFSET (0) /* data register offset */ + +#define YANU_CONTROL_OFFSET (4) /* control register offset */ +/* interrupt enable */ +#define YANU_CONTROL_IE_RRDY (1<<0) /* ie on received character ready */ +#define YANU_CONTROL_IE_OE (1<<1) /* ie on rx overrun */ +#define YANU_CONTROL_IE_BRK (1<<2) /* ie on break detect */ +#define YANU_CONTROL_IE_FE (1<<3) /* ie on framing error */ +#define YANU_CONTROL_IE_PE (1<<4) /* ie on parity error */ +#define YANU_CONTROL_IE_TRDY (1<<5) /* ie interrupt on tranmitter ready */ +/* control bits */ +#define YANU_CONTROL_BITS_POS (6) /* bits number pos */ +#define YANU_CONTROL_BITS (1< 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 --- board/spear/common/spr_lowlevel_init.S | 0 board/spear/common/spr_misc.c | 0 board/spear/spear300/Makefile | 0 board/spear/spear300/config.mk | 0 board/spear/spear300/spear300.c | 0 board/spear/spear310/Makefile | 0 board/spear/spear310/config.mk | 0 board/spear/spear310/spear310.c | 0 board/spear/spear320/Makefile | 0 board/spear/spear320/config.mk | 0 board/spear/spear320/spear320.c | 0 board/spear/spear600/Makefile | 0 board/spear/spear600/config.mk | 0 board/spear/spear600/spear600.c | 0 cpu/arm926ejs/spear/Makefile | 0 cpu/arm926ejs/spear/reset.c | 0 cpu/arm926ejs/spear/timer.c | 0 cpu/arm926ejs/versatile/timer.c | 0 drivers/i2c/Makefile | 0 drivers/i2c/spr_i2c.c | 0 drivers/mtd/Makefile | 0 drivers/mtd/nand/spr_nand.c | 0 drivers/mtd/spr_smi.c | 0 drivers/serial/usbtty.h | 0 drivers/usb/gadget/Makefile | 0 drivers/usb/gadget/spr_udc.c | 0 include/asm-arm/arch-spear/spr_gpt.h | 0 include/asm-arm/arch-spear/spr_i2c.h | 0 include/asm-arm/arch-spear/spr_smi.h | 0 include/asm-arm/arch-spear/spr_xloader_table.h | 0 include/configs/spear3xx.h | 0 include/configs/spear6xx.h | 0 include/usb/spr_udc.h | 0 lib_m68k/bootm.c | 0 34 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 board/spear/common/spr_lowlevel_init.S mode change 100755 => 100644 board/spear/common/spr_misc.c mode change 100755 => 100644 board/spear/spear300/Makefile mode change 100755 => 100644 board/spear/spear300/config.mk mode change 100755 => 100644 board/spear/spear300/spear300.c mode change 100755 => 100644 board/spear/spear310/Makefile mode change 100755 => 100644 board/spear/spear310/config.mk mode change 100755 => 100644 board/spear/spear310/spear310.c mode change 100755 => 100644 board/spear/spear320/Makefile mode change 100755 => 100644 board/spear/spear320/config.mk mode change 100755 => 100644 board/spear/spear320/spear320.c mode change 100755 => 100644 board/spear/spear600/Makefile mode change 100755 => 100644 board/spear/spear600/config.mk mode change 100755 => 100644 board/spear/spear600/spear600.c 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 mode change 100755 => 100644 drivers/i2c/Makefile mode change 100755 => 100644 drivers/i2c/spr_i2c.c mode change 100755 => 100644 drivers/mtd/Makefile mode change 100755 => 100644 drivers/mtd/nand/spr_nand.c mode change 100755 => 100644 drivers/mtd/spr_smi.c mode change 100755 => 100644 drivers/serial/usbtty.h mode change 100755 => 100644 drivers/usb/gadget/Makefile mode change 100755 => 100644 drivers/usb/gadget/spr_udc.c mode change 100755 => 100644 include/asm-arm/arch-spear/spr_gpt.h mode change 100755 => 100644 include/asm-arm/arch-spear/spr_i2c.h mode change 100755 => 100644 include/asm-arm/arch-spear/spr_smi.h mode change 100755 => 100644 include/asm-arm/arch-spear/spr_xloader_table.h mode change 100755 => 100644 include/configs/spear3xx.h mode change 100755 => 100644 include/configs/spear6xx.h mode change 100755 => 100644 include/usb/spr_udc.h mode change 100755 => 100644 lib_m68k/bootm.c (limited to 'include') diff --git a/board/spear/common/spr_lowlevel_init.S b/board/spear/common/spr_lowlevel_init.S old mode 100755 new mode 100644 diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c old mode 100755 new mode 100644 diff --git a/board/spear/spear300/Makefile b/board/spear/spear300/Makefile old mode 100755 new mode 100644 diff --git a/board/spear/spear300/config.mk b/board/spear/spear300/config.mk old mode 100755 new mode 100644 diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c old mode 100755 new mode 100644 diff --git a/board/spear/spear310/Makefile b/board/spear/spear310/Makefile old mode 100755 new mode 100644 diff --git a/board/spear/spear310/config.mk b/board/spear/spear310/config.mk old mode 100755 new mode 100644 diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c old mode 100755 new mode 100644 diff --git a/board/spear/spear320/Makefile b/board/spear/spear320/Makefile old mode 100755 new mode 100644 diff --git a/board/spear/spear320/config.mk b/board/spear/spear320/config.mk old mode 100755 new mode 100644 diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c old mode 100755 new mode 100644 diff --git a/board/spear/spear600/Makefile b/board/spear/spear600/Makefile old mode 100755 new mode 100644 diff --git a/board/spear/spear600/config.mk b/board/spear/spear600/config.mk old mode 100755 new mode 100644 diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c old mode 100755 new mode 100644 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 diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile old mode 100755 new mode 100644 diff --git a/drivers/i2c/spr_i2c.c b/drivers/i2c/spr_i2c.c old mode 100755 new mode 100644 diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile old mode 100755 new mode 100644 diff --git a/drivers/mtd/nand/spr_nand.c b/drivers/mtd/nand/spr_nand.c old mode 100755 new mode 100644 diff --git a/drivers/mtd/spr_smi.c b/drivers/mtd/spr_smi.c old mode 100755 new mode 100644 diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h old mode 100755 new mode 100644 diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile old mode 100755 new mode 100644 diff --git a/drivers/usb/gadget/spr_udc.c b/drivers/usb/gadget/spr_udc.c old mode 100755 new mode 100644 diff --git a/include/asm-arm/arch-spear/spr_gpt.h b/include/asm-arm/arch-spear/spr_gpt.h old mode 100755 new mode 100644 diff --git a/include/asm-arm/arch-spear/spr_i2c.h b/include/asm-arm/arch-spear/spr_i2c.h old mode 100755 new mode 100644 diff --git a/include/asm-arm/arch-spear/spr_smi.h b/include/asm-arm/arch-spear/spr_smi.h old mode 100755 new mode 100644 diff --git a/include/asm-arm/arch-spear/spr_xloader_table.h b/include/asm-arm/arch-spear/spr_xloader_table.h old mode 100755 new mode 100644 diff --git a/include/configs/spear3xx.h b/include/configs/spear3xx.h old mode 100755 new mode 100644 diff --git a/include/configs/spear6xx.h b/include/configs/spear6xx.h old mode 100755 new mode 100644 diff --git a/include/usb/spr_udc.h b/include/usb/spr_udc.h old mode 100755 new mode 100644 diff --git a/lib_m68k/bootm.c b/lib_m68k/bootm.c old mode 100755 new mode 100644 -- cgit v1.3.1 From daa989b47297c9f73426783599c286ef3a1f3f49 Mon Sep 17 00:00:00 2001 From: Asen Dimov Date: Thu, 18 Mar 2010 13:41:47 +0200 Subject: correct a syntax typo in at91_matrix.h Signed-off-by: Asen Dimov --- include/asm-arm/arch-at91/at91_matrix.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-arm/arch-at91/at91_matrix.h b/include/asm-arm/arch-at91/at91_matrix.h index 9b3c110f525..981ec2029ca 100644 --- a/include/asm-arm/arch-at91/at91_matrix.h +++ b/include/asm-arm/arch-at91/at91_matrix.h @@ -80,7 +80,7 @@ typedef struct at91_matrix { u32 mrcr; /* 0x100 Master Remap Control */ u32 reserve4[3]; #if defined(CONFIG_AT91SAM9G45) - u32 ccr[52] /* 0x110 - 0x1E0 Chip Configuration */ + u32 ccr[52]; /* 0x110 - 0x1E0 Chip Configuration */ u32 womr; /* 0x1E4 Write Protect Mode */ u32 wpsr; /* 0x1E8 Write Protect Status */ u32 resg45_1[10]; -- cgit v1.3.1