]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/serial/serial_mxc.c
MX: serial_mxc: cleanup removing nasty #ifdef
[people/ms/u-boot.git] / drivers / serial / serial_mxc.c
index b21c9c3e9d95e6355fb122dbe5147b8233238d19..af00b9c0ec426856eaf716466d087f9cf270cc72 100644 (file)
  */
 
 #include <common.h>
-#ifdef CONFIG_MX31
-#include <asm/arch/mx31.h>
-#else
+#include <watchdog.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
-#endif
 
 #define __REG(x)     (*((volatile u32 *)(x)))
 
-#ifdef CONFIG_SYS_MX31_UART1
-#define UART_PHYS 0x43f90000
-#elif defined(CONFIG_SYS_MX31_UART2)
-#define UART_PHYS 0x43f94000
-#elif defined(CONFIG_SYS_MX31_UART3)
-#define UART_PHYS 0x5000c000
-#elif defined(CONFIG_SYS_MX31_UART4)
-#define UART_PHYS 0x43fb0000
-#elif defined(CONFIG_SYS_MX31_UART5)
-#define UART_PHYS 0x43fb4000
-#elif defined(CONFIG_SYS_MX27_UART1)
-#define UART_PHYS 0x1000a000
-#elif defined(CONFIG_SYS_MX27_UART2)
-#define UART_PHYS 0x1000b000
-#elif defined(CONFIG_SYS_MX27_UART3)
-#define UART_PHYS 0x1000c000
-#elif defined(CONFIG_SYS_MX27_UART4)
-#define UART_PHYS 0x1000d000
-#elif defined(CONFIG_SYS_MX27_UART5)
-#define UART_PHYS 0x1001b000
-#elif defined(CONFIG_SYS_MX27_UART6)
-#define UART_PHYS 0x1001c000
-#elif defined(CONFIG_SYS_MX51_UART1)
-#define UART_PHYS UART1_BASE_ADDR
-#elif defined(CONFIG_SYS_MX51_UART2)
-#define UART_PHYS UART2_BASE_ADDR
-#elif defined(CONFIG_SYS_MX51_UART3)
-#define UART_PHYS UART3_BASE_ADDR
-#else
-#error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver"
+#ifndef CONFIG_MXC_UART_BASE
+#error "define CONFIG_MXC_UART_BASE to use the MXC UART driver"
 #endif
 
+#define UART_PHYS      CONFIG_MXC_UART_BASE
+
 #ifdef CONFIG_SERIAL_MULTI
 #warning "MXC driver does not support MULTI serials."
 #endif
@@ -189,7 +160,8 @@ void serial_setbrg (void)
 
 int serial_getc (void)
 {
-       while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY);
+       while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
+               WATCHDOG_RESET();
        return (__REG(UART_PHYS + URXD) & URXD_RX_DATA); /* mask out status from upper word */
 }
 
@@ -198,7 +170,8 @@ void serial_putc (const char c)
        __REG(UART_PHYS + UTXD) = c;
 
        /* wait for transmitter to be ready */
-       while(!(__REG(UART_PHYS + UTS) & UTS_TXEMPTY));
+       while (!(__REG(UART_PHYS + UTS) & UTS_TXEMPTY))
+               WATCHDOG_RESET();
 
        /* If \n, also do \r */
        if (c == '\n')