* [PATCH v3] serial: sh-sci: modify sci_break_ctl()
@ 2012-04-12 2:24 Shimoda, Yoshihiro
2012-04-12 10:22 ` Paul Mundt
0 siblings, 1 reply; 2+ messages in thread
From: Shimoda, Yoshihiro @ 2012-04-12 2:24 UTC (permalink / raw)
To: linux-sh
SCIF modules which have SCSPTR can output the break signal.
This patch supports it.
This patch tested on sh7757lcr.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
about v3:
- modify a method which detects SCSPTR
drivers/tty/serial/sh-sci.c | 30 ++++++++++++++++++++++++++----
include/linux/serial_sci.h | 2 ++
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 3158e17..be31d85 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1564,10 +1564,32 @@ static void sci_enable_ms(struct uart_port *port)
static void sci_break_ctl(struct uart_port *port, int break_state)
{
- /*
- * Not supported by hardware. Most parts couple break and rx
- * interrupts together, with break detection always enabled.
- */
+ struct sci_port *s = to_sci_port(port);
+ struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR;
+ unsigned short scscr, scsptr;
+
+ /* check wheter the port has SCSPTR */
+ if (!reg->size) {
+ /*
+ * Not supported by hardware. Most parts couple break and rx
+ * interrupts together, with break detection always enabled.
+ */
+ return;
+ }
+
+ scsptr = serial_port_in(port, SCSPTR);
+ scscr = serial_port_in(port, SCSCR);
+
+ if (break_state = -1) {
+ scsptr = (scsptr | SCSPTR_SPB2IO) & ~SCSPTR_SPB2DT;
+ scscr &= ~SCSCR_TE;
+ } else {
+ scsptr = (scsptr | SCSPTR_SPB2DT) & ~SCSPTR_SPB2IO;
+ scscr |= SCSCR_TE;
+ }
+
+ serial_port_out(port, SCSPTR, scsptr);
+ serial_port_out(port, SCSCR, scscr);
}
#ifdef CONFIG_SERIAL_SH_SCI_DMA
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 7877907..eb763ad 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -52,6 +52,8 @@ enum {
/* SCSPTR, optional */
#define SCSPTR_RTSIO (1 << 7)
#define SCSPTR_CTSIO (1 << 5)
+#define SCSPTR_SPB2IO (1 << 1)
+#define SCSPTR_SPB2DT (1 << 0)
/* Offsets into the sci_port->irqs array */
enum {
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] serial: sh-sci: modify sci_break_ctl()
2012-04-12 2:24 [PATCH v3] serial: sh-sci: modify sci_break_ctl() Shimoda, Yoshihiro
@ 2012-04-12 10:22 ` Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2012-04-12 10:22 UTC (permalink / raw)
To: linux-sh
On Thu, Apr 12, 2012 at 11:24:54AM +0900, Shimoda, Yoshihiro wrote:
> SCIF modules which have SCSPTR can output the break signal.
> This patch supports it.
>
> This patch tested on sh7757lcr.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
> about v3:
> - modify a method which detects SCSPTR
>
Looks good, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-12 10:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-12 2:24 [PATCH v3] serial: sh-sci: modify sci_break_ctl() Shimoda, Yoshihiro
2012-04-12 10:22 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).