diff options
author | wdenk <wdenk> | 2004-10-10 17:05:18 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2004-10-10 17:05:18 +0000 |
commit | 2cbe571a5676a41aa32ff98e9b1a2934e3922574 (patch) | |
tree | 5868352e056b89c43cebc14378821ff08534dd92 /cpu/at91rm9200/serial.c | |
parent | 659883c2982db64e9950434cba2a72a3dae84a7e (diff) | |
download | u-boot-imx-2cbe571a5676a41aa32ff98e9b1a2934e3922574.zip u-boot-imx-2cbe571a5676a41aa32ff98e9b1a2934e3922574.tar.gz u-boot-imx-2cbe571a5676a41aa32ff98e9b1a2934e3922574.tar.bz2 |
* Patch by Gary Jennejohn, 01 Oct 2004:
- add support for CMC PU2 board
- add support for I2C on at91rm9200
* Patch by Gary Jennejohn, 28 Sep 2004:
fix baudrate handling on at91rm9200
Diffstat (limited to 'cpu/at91rm9200/serial.c')
-rw-r--r-- | cpu/at91rm9200/serial.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/cpu/at91rm9200/serial.c b/cpu/at91rm9200/serial.c index c16c9d4..fb03851 100644 --- a/cpu/at91rm9200/serial.c +++ b/cpu/at91rm9200/serial.c @@ -33,14 +33,17 @@ #include <asm/io.h> #include <asm/arch/hardware.h> -#if !defined(CONFIG_DBGU) && !defined(CONFIG_USART1) -#error must define one of CONFIG_DBGU or CONFIG_USART1 +#if !defined(CONFIG_DBGU) && !defined(CONFIG_USART0) && !defined(CONFIG_USART1) +#error must define one of CONFIG_DBGU or CONFIG_USART0 or CONFIG_USART1 #endif /* ggi thunder */ #ifdef CONFIG_DBGU AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU; #endif +#ifdef CONFIG_USART0 +AT91PS_USART us = (AT91PS_USART) AT91C_BASE_US0; +#endif #ifdef CONFIG_USART1 AT91PS_USART us = (AT91PS_USART) AT91C_BASE_US1; #endif @@ -50,9 +53,19 @@ void serial_setbrg (void) DECLARE_GLOBAL_DATA_PTR; int baudrate; - if ((baudrate = gd->bd->bi_baudrate) <= 0) + if ((baudrate = gd->baudrate) <= 0) baudrate = CONFIG_BAUDRATE; - us->US_BRGR = CFG_AT91C_BRGR_DIVISOR; /* hardcode so no __divsi3 */ + if (baudrate == CONFIG_BAUDRATE) { + us->US_BRGR = CFG_AT91C_BRGR_DIVISOR; /* hardcode so no __divsi3 */ + } else { +#if 0 + /* 33 -> 115200 */ + us->US_BRGR = 33 * (115200/baudrate); +#else + /* MASTER_CLOCK/(16 * baudrate) */ + us->US_BRGR = (AT91C_MASTER_CLOCK >> 4)/baudrate; +#endif + } } int serial_init (void) @@ -62,6 +75,10 @@ int serial_init (void) *AT91C_PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; /* PA 31 & 30 */ *AT91C_PMC_PCER = 1 << AT91C_ID_SYS; /* enable clock */ #endif +#ifdef CONFIG_USART0 + *AT91C_PIOA_PDR = AT91C_PA17_TXD0 | AT91C_PA18_RXD0; + *AT91C_PMC_PCER |= 1 << AT91C_ID_USART0; /* enable clock */ +#endif #ifdef CONFIG_USART1 *AT91C_PIOB_PDR = AT91C_PB21_TXD1 | AT91C_PB20_RXD1; *AT91C_PMC_PCER |= 1 << AT91C_ID_USART1; /* enable clock */ |