LKML Archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] Correct the interrupt handler in sh4 serial device.
@ 2008-10-28 18:12 Michael Trimarchi
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Trimarchi @ 2008-10-28 18:12 UTC (permalink / raw
  To: lethal; +Cc: linux-sh, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: correct-interrupt-handler-sh4-serial.patch --]
[-- Type: text/x-patch, Size: 2580 bytes --]

Correct the interrupt handler in sh4 serial device,
return the correct value and check for what is anabled
 in the SCSCR register. The sh7722 is broken just sending
a break using minicom. I'm not sure for the value of
SCI_CTRL_FLAGS_REIE in all architecture.

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>

---
 drivers/serial/sh-sci.c |   23 ++++++++++++-----------
 drivers/serial/sh-sci.h |    1 +
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index f0658d2..b67f219 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -810,26 +810,27 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr)
 
 static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
 {
-        unsigned short ssr_status, scr_status;
-        struct uart_port *port = ptr;
+	unsigned short ssr_status, scr_status;
+	struct uart_port *port = ptr;
+	irqreturn_t ret = IRQ_NONE;
 
         ssr_status = sci_in(port,SCxSR);
         scr_status = sci_in(port,SCSCR);
 
 	/* Tx Interrupt */
-        if ((ssr_status & 0x0020) && (scr_status & 0x0080))
-                sci_tx_interrupt(irq, ptr);
+	if ((ssr_status & 0x0020) && (scr_status & SCI_CTRL_FLAGS_TIE))
+		ret = sci_tx_interrupt(irq, ptr);
 	/* Rx Interrupt */
-        if ((ssr_status & 0x0002) && (scr_status & 0x0040))
-                sci_rx_interrupt(irq, ptr);
+	if ((ssr_status & 0x0002) && (scr_status & SCI_CTRL_FLAGS_RIE))
+		ret = sci_rx_interrupt(irq, ptr);
 	/* Error Interrupt */
-        if ((ssr_status & 0x0080) && (scr_status & 0x0400))
-                sci_er_interrupt(irq, ptr);
+	if ((ssr_status & 0x0080) && (scr_status & SCI_CTRL_FLAGS_REIE))
+		ret = sci_er_interrupt(irq, ptr);
 	/* Break Interrupt */
-        if ((ssr_status & 0x0010) && (scr_status & 0x0200))
-                sci_br_interrupt(irq, ptr);
+	if ((ssr_status & 0x0010) && (scr_status & SCI_CTRL_FLAGS_REIE))
+		ret = sci_br_interrupt(irq, ptr);
 
-	return IRQ_HANDLED;
+	return ret;
 }
 
 #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK)
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index 7cd28b2..bce713f 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -186,6 +186,7 @@
 #if defined(CONFIG_CPU_SUBTYPE_SH7750)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7091)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7722)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
     defined(CONFIG_CPU_SUBTYPE_SH7751)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [RFC PATCH] Correct the interrupt handler in sh4 serial device.
@ 2008-10-28 18:15 michael
  2008-10-31  7:05 ` Paul Mundt
  0 siblings, 1 reply; 3+ messages in thread
From: michael @ 2008-10-28 18:15 UTC (permalink / raw
  To: lethal; +Cc: linux-sh, linux-kernel, Michael Trimarchi

[-- Attachment #1: Type: text/plain, Size: 2 bytes --]




[-- Attachment #2: correct-interrupt-handler-sh4-serial.patch --]
[-- Type: text/x-patch, Size: 2581 bytes --]

Correct the interrupt handler in sh4 serial device,
return the correct value and check for what is anabled
 in the SCSCR register. The sh7722 is broken just sending
a break using minicom. I'm not sure for the value of
SCI_CTRL_FLAGS_REIE in all architecture.

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>

---
 drivers/serial/sh-sci.c |   23 ++++++++++++-----------
 drivers/serial/sh-sci.h |    1 +
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index f0658d2..b67f219 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -810,26 +810,27 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr)
 
 static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
 {
-        unsigned short ssr_status, scr_status;
-        struct uart_port *port = ptr;
+	unsigned short ssr_status, scr_status;
+	struct uart_port *port = ptr;
+	irqreturn_t ret = IRQ_NONE;
 
         ssr_status = sci_in(port,SCxSR);
         scr_status = sci_in(port,SCSCR);
 
 	/* Tx Interrupt */
-        if ((ssr_status & 0x0020) && (scr_status & 0x0080))
-                sci_tx_interrupt(irq, ptr);
+	if ((ssr_status & 0x0020) && (scr_status & SCI_CTRL_FLAGS_TIE))
+		ret = sci_tx_interrupt(irq, ptr);
 	/* Rx Interrupt */
-        if ((ssr_status & 0x0002) && (scr_status & 0x0040))
-                sci_rx_interrupt(irq, ptr);
+	if ((ssr_status & 0x0002) && (scr_status & SCI_CTRL_FLAGS_RIE))
+		ret = sci_rx_interrupt(irq, ptr);
 	/* Error Interrupt */
-        if ((ssr_status & 0x0080) && (scr_status & 0x0400))
-                sci_er_interrupt(irq, ptr);
+	if ((ssr_status & 0x0080) && (scr_status & SCI_CTRL_FLAGS_REIE))
+		ret = sci_er_interrupt(irq, ptr);
 	/* Break Interrupt */
-        if ((ssr_status & 0x0010) && (scr_status & 0x0200))
-                sci_br_interrupt(irq, ptr);
+	if ((ssr_status & 0x0010) && (scr_status & SCI_CTRL_FLAGS_REIE))
+		ret = sci_br_interrupt(irq, ptr);
 
-	return IRQ_HANDLED;
+	return ret;
 }
 
 #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_HAVE_CLK)
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index 7cd28b2..bce713f 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -186,6 +186,7 @@
 #if defined(CONFIG_CPU_SUBTYPE_SH7750)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7091)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7722)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
     defined(CONFIG_CPU_SUBTYPE_SH7751)  || \
     defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
-- 
1.5.6.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] Correct the interrupt handler in sh4 serial device.
  2008-10-28 18:15 michael
@ 2008-10-31  7:05 ` Paul Mundt
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2008-10-31  7:05 UTC (permalink / raw
  To: michael; +Cc: linux-sh, linux-kernel, Michael Trimarchi

On Tue, Oct 28, 2008 at 07:15:21PM +0100, michael wrote:
> Correct the interrupt handler in sh4 serial device,
> return the correct value and check for what is anabled
>  in the SCSCR register. The sh7722 is broken just sending
> a break using minicom. I'm not sure for the value of
> SCI_CTRL_FLAGS_REIE in all architecture.
> 
> Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
> 
Yes, this looks like a good change. It's a good indicator that the
original implementation of sci_mpxed_interrupt() was written with a
particular sub-type in mind ;-)

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-31  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-28 18:12 [RFC PATCH] Correct the interrupt handler in sh4 serial device Michael Trimarchi
  -- strict thread matches above, loose matches on Subject: below --
2008-10-28 18:15 michael
2008-10-31  7:05 ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).