summaryrefslogtreecommitdiff
path: root/cpu/blackfin/serial.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-01-17 23:08:42 +0100
committerWolfgang Denk <wd@denx.de>2010-01-17 23:08:42 +0100
commit3e3989619f5ed3ee28002d985f3da28540586ab9 (patch)
treed4434455cafdc0c750aa26e642949232ffd0b2d3 /cpu/blackfin/serial.c
parent64917ca38933d10b3763f61df7a1e58e1e127b52 (diff)
parent846a6391e4bc9fdd721753a1021953ff0ca17c27 (diff)
downloadu-boot-imx-3e3989619f5ed3ee28002d985f3da28540586ab9.zip
u-boot-imx-3e3989619f5ed3ee28002d985f3da28540586ab9.tar.gz
u-boot-imx-3e3989619f5ed3ee28002d985f3da28540586ab9.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-blackfin
Diffstat (limited to 'cpu/blackfin/serial.c')
-rw-r--r--cpu/blackfin/serial.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/cpu/blackfin/serial.c b/cpu/blackfin/serial.c
index 2abda18..901cb97 100644
--- a/cpu/blackfin/serial.c
+++ b/cpu/blackfin/serial.c
@@ -44,10 +44,6 @@
#ifdef CONFIG_UART_CONSOLE
-#if defined(UART_LSR) && (CONFIG_UART_CONSOLE != 0)
-# error CONFIG_UART_CONSOLE must be 0 on parts with only one UART
-#endif
-
#include "serial.h"
#ifdef CONFIG_DEBUG_SERIAL
@@ -63,7 +59,7 @@ size_t cache_count;
static uint16_t uart_lsr_save;
static uint16_t uart_lsr_read(void)
{
- uint16_t lsr = *pUART_LSR;
+ uint16_t lsr = bfin_read16(&pUART->lsr);
uart_lsr_save |= (lsr & (OE|PE|FE|BI));
return lsr | uart_lsr_save;
}
@@ -71,15 +67,21 @@ static uint16_t uart_lsr_read(void)
static void uart_lsr_clear(void)
{
uart_lsr_save = 0;
- *pUART_LSR |= -1;
+ bfin_write16(&pUART->lsr, bfin_read16(&pUART->lsr) | -1);
}
#else
/* When debugging is disabled, we only care about the DR bit, so if other
* bits get set/cleared, we don't really care since we don't read them
* anyways (and thus anomaly 05000099 is irrelevant).
*/
-static inline uint16_t uart_lsr_read(void) { return *pUART_LSR; }
-static inline void uart_lsr_clear(void) { *pUART_LSR = -1; }
+static uint16_t uart_lsr_read(void)
+{
+ return bfin_read16(&pUART->lsr);
+}
+static void uart_lsr_clear(void)
+{
+ bfin_write16(&pUART->lsr, bfin_read16(&pUART->lsr) | -1);
+}
#endif
/* Symbol for our assembly to call. */
@@ -130,7 +132,7 @@ void serial_putc(const char c)
continue;
/* queue the character for transmission */
- *pUART_THR = c;
+ bfin_write16(&pUART->thr, c);
SSYNC();
WATCHDOG_RESET();
@@ -151,7 +153,7 @@ int serial_getc(void)
continue;
/* grab the new byte */
- uart_rbr_val = *pUART_RBR;
+ uart_rbr_val = bfin_read16(&pUART->rbr);
#ifdef CONFIG_DEBUG_SERIAL
/* grab & clear the LSR */
@@ -165,8 +167,8 @@ int serial_getc(void)
uint16_t dll, dlh;
printf("\n[SERIAL ERROR]\n");
ACCESS_LATCH();
- dll = *pUART_DLL;
- dlh = *pUART_DLH;
+ dll = bfin_read16(&pUART->dll);
+ dlh = bfin_read16(&pUART->dlh);
ACCESS_PORT_IER();
printf("\tDLL=0x%x DLH=0x%x\n", dll, dlh);
do {