tty/serial/8250: Make omap hardware workarounds local to 8250.h
authorTony Lindgren <tony@atomide.com>
Wed, 3 Oct 2012 22:31:58 +0000 (15:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Oct 2012 18:30:57 +0000 (11:30 -0700)
This allows us to get rid of the ifdefs in 8250.c.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/plat-omap/include/plat/serial.h
drivers/tty/serial/8250/8250.c
drivers/tty/serial/8250/8250.h

index 65fce44dce342b3650637b53beaeb0e8f1d2c3d8..b780470d03ea2f80804bdd9cfdbcda389e78a655 100644 (file)
 #define OMAP5UART4             OMAP4UART4
 #define ZOOM_UART              95              /* Only on zoom2/3 */
 
-/* This is only used by 8250.c for omap1510 */
-#define is_omap_port(pt)       ({int __ret = 0;                        \
-                       if ((pt)->port.mapbase == OMAP1_UART1_BASE ||   \
-                           (pt)->port.mapbase == OMAP1_UART2_BASE ||   \
-                           (pt)->port.mapbase == OMAP1_UART3_BASE)     \
-                               __ret = 1;                              \
-                       __ret;                                          \
-                       })
-
 #ifndef __ASSEMBLER__
 
 struct omap_board_data;
index 3ba4234592bc8a7285b2d488ce9b0db010e2e018..5ccbd90540cfdf4bef3be26c15d2202393ced213 100644 (file)
@@ -2349,16 +2349,14 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
                        serial_port_out(port, UART_EFR, efr);
        }
 
-#ifdef CONFIG_ARCH_OMAP1
        /* Workaround to enable 115200 baud on OMAP1510 internal ports */
-       if (cpu_is_omap1510() && is_omap_port(up)) {
+       if (is_omap1510_8250(up)) {
                if (baud == 115200) {
                        quot = 1;
                        serial_port_out(port, UART_OMAP_OSC_12M_SEL, 1);
                } else
                        serial_port_out(port, UART_OMAP_OSC_12M_SEL, 0);
        }
-#endif
 
        /*
         * For NatSemi, switch to bank 2 not bank 1, to avoid resetting EXCR2,
@@ -2439,10 +2437,9 @@ static unsigned int serial8250_port_size(struct uart_8250_port *pt)
 {
        if (pt->port.iotype == UPIO_AU)
                return 0x1000;
-#ifdef CONFIG_ARCH_OMAP1
-       if (is_omap_port(pt))
+       if (is_omap1_8250(pt))
                return 0x16 << pt->port.regshift;
-#endif
+
        return 8 << pt->port.regshift;
 }
 
index 5a76f9c8d36b98d943ef574de25c4400579c0551..3b4ea84898c2e719dc233ecddde63dc3c421bd0d 100644 (file)
@@ -106,3 +106,39 @@ static inline int serial8250_pnp_init(void) { return 0; }
 static inline void serial8250_pnp_exit(void) { }
 #endif
 
+#ifdef CONFIG_ARCH_OMAP1
+static inline int is_omap1_8250(struct uart_8250_port *pt)
+{
+       int res;
+
+       switch (pt->port.mapbase) {
+       case OMAP1_UART1_BASE:
+       case OMAP1_UART2_BASE:
+       case OMAP1_UART3_BASE:
+               res = 1;
+               break;
+       default:
+               res = 0;
+               break;
+       }
+
+       return res;
+}
+
+static inline int is_omap1510_8250(struct uart_8250_port *pt)
+{
+       if (!cpu_is_omap1510())
+               return 0;
+
+       return is_omap1_8250(pt);
+}
+#else
+static inline int is_omap1_8250(struct uart_8250_port *pt)
+{
+       return 0;
+}
+static inline int is_omap1510_8250(struct uart_8250_port *pt)
+{
+       return 0;
+}
+#endif