aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-06-08 05:51:32 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-06-08 05:51:32 -0400
commit514820eb982eb85677ed2ecef9710e90e24fbdab (patch)
tree656eb4a0d96ec3e6ac843109cccec862bfcc988e /drivers/tty
parentdebf9507166eede1e676d27d3298cdfb27399cb4 (diff)
serial: sh-sci: Consolidate RXD pin handling.
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/sh-sci.c13
-rw-r--r--drivers/tty/serial/sh-sci.h29
2 files changed, 13 insertions, 29 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index bb27885ea2e5..3248ddaa889d 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -363,6 +363,19 @@ static int sci_rxfill(struct uart_port *port)
363 return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0; 363 return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0;
364} 364}
365 365
366/*
367 * SCI helper for checking the state of the muxed port/RXD pins.
368 */
369static inline int sci_rxd_in(struct uart_port *port)
370{
371 struct sci_port *s = to_sci_port(port);
372
373 if (s->cfg->port_reg <= 0)
374 return 1;
375
376 return !!__raw_readb(s->cfg->port_reg);
377}
378
366/* ********************************************************************** * 379/* ********************************************************************** *
367 * the interrupt related routines * 380 * the interrupt related routines *
368 * ********************************************************************** */ 381 * ********************************************************************** */
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index caab353a98b5..1c20f7f9ba4f 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -287,32 +287,3 @@ SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
287#endif 287#endif
288#define sci_in(port, reg) sci_##reg##_in(port) 288#define sci_in(port, reg) sci_##reg##_in(port)
289#define sci_out(port, reg, value) sci_##reg##_out(port, value) 289#define sci_out(port, reg, value) sci_##reg##_out(port, value)
290
291#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
292 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
293 defined(CONFIG_CPU_SUBTYPE_SH7708) || \
294 defined(CONFIG_CPU_SUBTYPE_SH7709)
295static inline int sci_rxd_in(struct uart_port *port)
296{
297 if (port->mapbase == 0xfffffe80)
298 return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
299 return 1;
300}
301#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
302 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
303 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
304 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
305 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
306 defined(CONFIG_CPU_SUBTYPE_SH7091)
307static inline int sci_rxd_in(struct uart_port *port)
308{
309 if (port->mapbase == 0xffe00000)
310 return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
311 return 1;
312}
313#else /* default case for non-SCI processors */
314static inline int sci_rxd_in(struct uart_port *port)
315{
316 return 1;
317}
318#endif