summaryrefslogtreecommitdiff
path: root/cpu/at91rm9200/serial.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-09-21 23:33:32 +0000
committerwdenk <wdenk>2004-09-21 23:33:32 +0000
commit4734cb78d8e57dbac4e9f23d91edd624484b0092 (patch)
treea7b622ef272424ba73dadc36119f331764b099ab /cpu/at91rm9200/serial.c
parenta9c37d561d79fc9b11980853db1e1d4b15c76ba5 (diff)
downloadu-boot-imx-4734cb78d8e57dbac4e9f23d91edd624484b0092.zip
u-boot-imx-4734cb78d8e57dbac4e9f23d91edd624484b0092.tar.gz
u-boot-imx-4734cb78d8e57dbac4e9f23d91edd624484b0092.tar.bz2
Patch by Gary Jennejohn, 09 Sep 2004:
allow to use USART1 as console port on at91rm9200dk boards
Diffstat (limited to 'cpu/at91rm9200/serial.c')
-rw-r--r--cpu/at91rm9200/serial.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/cpu/at91rm9200/serial.c b/cpu/at91rm9200/serial.c
index 43e1553..c16c9d4 100644
--- a/cpu/at91rm9200/serial.c
+++ b/cpu/at91rm9200/serial.c
@@ -33,8 +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
+#endif
+
/* ggi thunder */
+#ifdef CONFIG_DBGU
AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU;
+#endif
+#ifdef CONFIG_USART1
+AT91PS_USART us = (AT91PS_USART) AT91C_BASE_US1;
+#endif
void serial_setbrg (void)
{
@@ -49,8 +58,14 @@ void serial_setbrg (void)
int serial_init (void)
{
/* make any port initializations specific to this port */
+#ifdef CONFIG_DBGU
*AT91C_PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; /* PA 31 & 30 */
*AT91C_PMC_PCER = 1 << AT91C_ID_SYS; /* enable clock */
+#endif
+#ifdef CONFIG_USART1
+ *AT91C_PIOB_PDR = AT91C_PB21_TXD1 | AT91C_PB20_RXD1;
+ *AT91C_PMC_PCER |= 1 << AT91C_ID_USART1; /* enable clock */
+#endif
serial_setbrg ();
us->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX;