Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / arch / arm / mach-omap2 / serial.c
index 19805a7..e10a02d 100644 (file)
 #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV    0x52
 #define UART_OMAP_WER          0x17    /* Wake-up enable register */
 
-#define DEFAULT_TIMEOUT (5 * HZ)
+/*
+ * NOTE: By default the serial timeout is disabled as it causes lost characters
+ * over the serial ports. This means that the UART clocks will stay on until
+ * disabled via sysfs. This also causes that any deeper omap sleep states are
+ * blocked. 
+ */
+#define DEFAULT_TIMEOUT 0
 
 struct omap_uart_state {
        int num;
@@ -125,6 +131,13 @@ static struct plat_serial8250_port serial_platform_data3[] = {
        }
 };
 #endif
+static inline unsigned int __serial_read_reg(struct uart_port *up,
+                                          int offset)
+{
+       offset <<= up->regshift;
+       return (unsigned int)__raw_readb(up->membase + offset);
+}
+
 static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
                                           int offset)
 {
@@ -415,7 +428,8 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
        uart->timeout = DEFAULT_TIMEOUT;
        setup_timer(&uart->timer, omap_uart_idle_timer,
                    (unsigned long) uart);
-       mod_timer(&uart->timer, jiffies + uart->timeout);
+       if (uart->timeout)
+               mod_timer(&uart->timer, jiffies + uart->timeout);
        omap_uart_smart_idle_enable(uart, 0);
 
        if (cpu_is_omap34xx()) {
@@ -583,11 +597,12 @@ static unsigned int serial_in_override(struct uart_port *up, int offset)
 {
        if (UART_RX == offset) {
                unsigned int lsr;
-               lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR);
+               lsr = __serial_read_reg(up, UART_LSR);
                if (!(lsr & UART_LSR_DR))
                        return -EPERM;
        }
-       return serial_read_reg(omap_uart[up->line].p, offset);
+
+       return __serial_read_reg(up, offset);
 }
 
 void __init omap_serial_early_init(void)