diff options
author | Simon Glass <sjg@chromium.org> | 2011-05-10 09:12:51 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 10:01:32 -0700 |
commit | 932e9e7c0b67ef62e7a16092c44f12857d6e193e (patch) | |
tree | ffd6ee89e4fb7270398d183ebb5a0efdb7ba2e19 /drivers/serial | |
parent | 92a4f823f8f81864caf36e7fabd030a8fec73114 (diff) |
arm: tegra2: separate out SPI/UART switch code into its own file
BUG=chromium-os:11623
TEST=build and boot U-Boot
Change-Id: I1ac2ce58630b483a6d7a2388744e3bc983555bd1
Reviewed-on: http://gerrit.chromium.org/gerrit/617
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/ns16550.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 71c523dfeba..aed3c294fde 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -11,6 +11,7 @@ #include <watchdog.h> #include <linux/types.h> #include <asm/io.h> +#include "uart-spi-fix.h" DECLARE_GLOBAL_DATA_PTR; @@ -32,16 +33,6 @@ DECLARE_GLOBAL_DATA_PTR; #define CONFIG_SYS_NS16550_IER 0x00 #endif /* CONFIG_SYS_NS16550_IER */ -/* - * Signal that we are about to use the UART. This unfortunate hack is - * required by Seaboard, which cannot use its console and SPI at the same - * time. If the board file provides this, the board config will declare it. - * Let this be a lesson for others. - */ -#ifndef CONFIG_SPI_CORRUPTS_UART -inline void uart_enable(void) {} -#endif - void NS16550_init (NS16550_t com_port, int baud_divisor) { serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); @@ -85,11 +76,11 @@ void NS16550_reinit (NS16550_t com_port, int baud_divisor) #endif /* CONFIG_NS16550_MIN_FUNCTIONS */ -void NS16550_putc (NS16550_t com_port, char c) +void NS16550_putc(NS16550_t regs, char c) { - uart_enable(); - while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0); - serial_out(c, &com_port->thr); + uart_enable(regs); + while ((serial_in(®s->lsr) & UART_LSR_THRE) == 0); + serial_out(c, ®s->thr); /* * Call watchdog_reset() upon newline. This is done here in putc @@ -105,7 +96,7 @@ void NS16550_putc (NS16550_t com_port, char c) static char NS16550_raw_getc(NS16550_t regs) { - uart_enable(); + uart_enable(regs); while ((serial_in(®s->lsr) & UART_LSR_DR) == 0) { #ifdef CONFIG_USB_TTY extern void usbtty_poll(void); @@ -118,6 +109,7 @@ static char NS16550_raw_getc(NS16550_t regs) static int NS16550_raw_tstc(NS16550_t regs) { + uart_enable(regs); return ((serial_in(®s->lsr) & UART_LSR_DR) != 0); } @@ -156,6 +148,7 @@ static int dequeue(unsigned int port, char *ch) static void fill_rx_buf(NS16550_t regs, unsigned int port) { + uart_enable(regs); while ((serial_in(®s->lsr) & UART_LSR_DR) != 0) enqueue(port, serial_in(®s->rbr)); } @@ -198,7 +191,6 @@ char NS16550_getc(NS16550_t regs, unsigned int port) int NS16550_tstc(NS16550_t regs, unsigned int port) { - uart_enable(); return NS16550_raw_tstc(regs); } |