diff options
author | wdenk <wdenk> | 2003-03-26 06:55:25 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-03-26 06:55:25 +0000 |
commit | dc7c9a1a52403093b9e4aef14ac4c5c014386e57 (patch) | |
tree | 4ca643323e3e7c96efd12190ec9bf10142acb375 /cpu/at91rm9200/serial.c | |
parent | 10f670178cce29d7f078ca622f0eeafd6903748a (diff) | |
download | u-boot-imx-dc7c9a1a52403093b9e4aef14ac4c5c014386e57.zip u-boot-imx-dc7c9a1a52403093b9e4aef14ac4c5c014386e57.tar.gz u-boot-imx-dc7c9a1a52403093b9e4aef14ac4c5c014386e57.tar.bz2 |
* Patch by Rick Bronson, 16 Mar 2003:
Add support for Atmel AT91RM9200DK w/NAND
* Patches by Robert Schwebel, 19 Mar 2003:
- use arm-linux-gcc as default compiler for ARM
- fix i2c fixup code
- fix missing baudrate setting
- added $loadaddr / CFG_LOAD_ADDR support to loadb
- moved "ignoring trailing characters" _before_ u-boot wants to
print out diagnostics messages; removes bogus characters at the
end of transmission
* Patch by John Zhan, 18 Mar 2003:
Add support for SinoVee Microsystems SC8xx boards
* Patch by Rolf Offermanns, 21 Mar 2003:
ported the dnp1110 related changes from the current armboot cvs to
current u-boot cvs. smc91111 does not work. problem marked in
smc91111.c, grep for "FIXME".
* Patch by Brian Auld, 25 Mar 2003:
Add support for STM flash chips on ebony board
* Add PCI support for MPC8250 Boards (PM825 module)
* Patch by Stefan Roese, 25 Mar 2003:
Diffstat (limited to 'cpu/at91rm9200/serial.c')
-rw-r--r-- | cpu/at91rm9200/serial.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/cpu/at91rm9200/serial.c b/cpu/at91rm9200/serial.c new file mode 100644 index 0000000..565cd3d --- /dev/null +++ b/cpu/at91rm9200/serial.c @@ -0,0 +1,89 @@ +/* + * (C) Copyright 2002 + * Lineo, Inc <www.lineo.com> + * Bernhard Kuhn <bkuhn@lineo.com> + * + * (C) Copyright 2002 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com> + * Marius Groeger <mgroeger@sysgo.de> + * + * (C) Copyright 2002 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com> + * Alex Zuepke <azu@sysgo.de> + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) + * + * 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> +#include <AT91RM9200.h> + +/* ggi thunder */ +AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU; + +void serial_setbrg(void) + { + DECLARE_GLOBAL_DATA_PTR; + int baudrate; + + if ((baudrate = gd->bd->bi_baudrate) <= 0) + baudrate = CONFIG_BAUDRATE; + us->US_BRGR = 33 /* AT91C_MASTER_CLOCK / baudrate / 16 */; /* hardcode so no __divsi3 */ + } + +int serial_init(void) + { + /* make any port initializations specific to this port */ + *AT91C_PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; /* PA 31 & 30 */ + *AT91C_PMC_PCER = 1 << AT91C_ID_SYS; /* enable clock */ + serial_setbrg(); + + us->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX; + us->US_CR = AT91C_US_RXEN | AT91C_US_TXEN; + us->US_MR = ( AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT ); + us->US_IMR = ~0ul; + return (0); + } + +void serial_putc(const char c) + { + if (c == '\n') + serial_putc('\r'); + while( (us->US_CSR & AT91C_US_TXRDY) == 0 ) + ; + us->US_THR=c; + } + +void +serial_puts (const char *s) + { + while (*s) + { + serial_putc (*s++); + } + } + +int serial_getc(void) + { + while( (us->US_CSR & AT91C_US_RXRDY) == 0 ); + return us->US_RHR; + } + +int serial_tstc(void) + { + return ((us->US_CSR & AT91C_US_RXRDY) == AT91C_US_RXRDY); + } |