IMX: MX31: Cleanup include files and drop nasty #ifdef in drivers
[platform/kernel/u-boot.git] / drivers / serial / serial_mxc.c
index 4b93e7b..dcb4bd1 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)))
 
 #define UART_PHYS 0x1001b000
 #elif defined(CONFIG_SYS_MX27_UART6)
 #define UART_PHYS 0x1001c000
-#elif defined(CONFIG_SYS_MX51_UART1)
+#elif defined(CONFIG_SYS_MX35_UART1) || defined(CONFIG_SYS_MX51_UART1) || \
+       defined(CONFIG_SYS_MX53_UART1)
 #define UART_PHYS UART1_BASE_ADDR
-#elif defined(CONFIG_SYS_MX51_UART2)
+#elif defined(CONFIG_SYS_MX35_UART2) || defined(CONFIG_SYS_MX51_UART2) || \
+       defined(CONFIG_SYS_MX53_UART2)
 #define UART_PHYS UART2_BASE_ADDR
-#elif defined(CONFIG_SYS_MX51_UART3)
+#elif defined(CONFIG_SYS_MX35_UART3) || defined(CONFIG_SYS_MX51_UART3) || \
+       defined(CONFIG_SYS_MX53_UART3)
 #define UART_PHYS UART3_BASE_ADDR
 #else
 #error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver"
@@ -189,7 +189,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 +199,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')