serial: sh-sci: Consolidate RXD pin handling.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 8 Jun 2011 09:51:32 +0000 (18:51 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 8 Jun 2011 09:51:32 +0000 (18:51 +0900)
Non-SCI parts do not have the special port reg necessary for cases where
the RX and SCI pins are muxed and need to be manually polled, so these
like always fall back on the normal FIFO processing paths. SH7760 is in a
class in and of itself with regards to mapping its SIM card interface via
the SCI port class despite not having any of the RXD lines wired up and
so implicitly behaving more like a SCIF in this regard. Out of the other
CPUs, some support the port check via the same block while others do it
through an external SuperI/O, so it's not even possible to perform the
check relative to the ioremapped cookie offset, so the separate read
semantics are preserved here, too.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/cpu/sh3/setup-sh770x.c
arch/sh/kernel/cpu/sh4/setup-sh7750.c
drivers/tty/serial/sh-sci.c
drivers/tty/serial/sh-sci.h
include/linux/serial_sci.h

index 4551ad647c2ccd8c9ea465caf58a4b6194663f52..6d549792f791d24a49af54b896904665a3482f61 100644 (file)
@@ -108,6 +108,7 @@ static struct platform_device rtc_device = {
 
 static struct plat_sci_port scif0_platform_data = {
        .mapbase        = 0xfffffe80,
+       .port_reg       = 0xa4000136,
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE,
        .scbrr_algo_id  = SCBRR_ALGO_2,
index e53b4b38bd11f954fd3d23b9e72e74d1540ea78e..8ea26e791187b63701ddb44c6cbcac20540dcd66 100644 (file)
@@ -38,6 +38,7 @@ static struct platform_device rtc_device = {
 
 static struct plat_sci_port sci_platform_data = {
        .mapbase        = 0xffe00000,
+       .port_reg       = 0xffe0001C
        .flags          = UPF_BOOT_AUTOCONF,
        .scscr          = SCSCR_TE | SCSCR_RE,
        .scbrr_algo_id  = SCBRR_ALGO_2,
index bb27885ea2e520135d44b389437d501e4c679987..3248ddaa889df448ee5cc6820f80d1cf2187a1e6 100644 (file)
@@ -363,6 +363,19 @@ static int sci_rxfill(struct uart_port *port)
        return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0;
 }
 
+/*
+ * SCI helper for checking the state of the muxed port/RXD pins.
+ */
+static inline int sci_rxd_in(struct uart_port *port)
+{
+       struct sci_port *s = to_sci_port(port);
+
+       if (s->cfg->port_reg <= 0)
+               return 1;
+
+       return !!__raw_readb(s->cfg->port_reg);
+}
+
 /* ********************************************************************** *
  *                   the interrupt related routines                       *
  * ********************************************************************** */
index caab353a98b5d160174d5f37bb931a6080aa2dd8..1c20f7f9ba4fea1ec1fcae79728450079644180e 100644 (file)
@@ -287,32 +287,3 @@ SCIF_FNS(SCLSR,                         0,  0, 0x24, 16)
 #endif
 #define sci_in(port, reg) sci_##reg##_in(port)
 #define sci_out(port, reg, value) sci_##reg##_out(port, value)
-
-#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7707) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7708) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7709)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xfffffe80)
-               return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7750)  || \
-      defined(CONFIG_CPU_SUBTYPE_SH7751)  || \
-      defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7091)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xffe00000)
-               return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
-       return 1;
-}
-#else /* default case for non-SCI processors */
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       return 1;
-}
-#endif
index 5fac3bccfd87cfb7828f2eab73104b6706894168..ecefec7c0b670c4abd3055b4ddecc5eb23b23bbf 100644 (file)
@@ -86,6 +86,8 @@ struct plat_sci_port {
        int             overrun_bit;
        unsigned int    error_mask;
 
+       int             port_reg;
+
        struct device   *dma_dev;
 
        unsigned int    dma_slave_tx;