linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: Fix serial for SH7203
@ 2011-10-03 14:16 Phil Edworthy
  2011-11-04 11:42 ` phil.edworthy
  2011-11-04 13:10 ` Paul Mundt
  0 siblings, 2 replies; 3+ messages in thread
From: Phil Edworthy @ 2011-10-03 14:16 UTC (permalink / raw)
  To: linux-sh


Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
Note: Not tested on SH2703 as I don't have a board. However I have tested
this on an SH7264 board which uses the same serial hardware.

 arch/sh/kernel/cpu/sh2a/setup-sh7203.c |   16 ++++++++++++----
 drivers/tty/serial/sh-sci.c            |   19 +++++++++++++++++++
 include/linux/serial_sci.h             |    1 +
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
index a43124e..0bd744f 100644
--- a/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
+++ b/arch/sh/kernel/cpu/sh2a/setup-sh7203.c
@@ -176,10 +176,12 @@ static DECLARE_INTC_DESC(intc_desc, "sh7203", vectors, groups,
 static struct plat_sci_port scif0_platform_data = {
 	.mapbase	= 0xfffe8000,
 	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE | SCSCR_REIE,
+	.scscr		= SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
+			  SCSCR_REIE,
 	.scbrr_algo_id	= SCBRR_ALGO_2,
 	.type		= PORT_SCIF,
 	.irqs		=  { 192, 192, 192, 192 },
+	.regtype	= SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
 static struct platform_device scif0_device = {
@@ -193,10 +195,12 @@ static struct platform_device scif0_device = {
 static struct plat_sci_port scif1_platform_data = {
 	.mapbase	= 0xfffe8800,
 	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE | SCSCR_REIE,
+	.scscr		= SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
+			  SCSCR_REIE,
 	.scbrr_algo_id	= SCBRR_ALGO_2,
 	.type		= PORT_SCIF,
 	.irqs		=  { 196, 196, 196, 196 },
+	.regtype	= SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
 static struct platform_device scif1_device = {
@@ -210,10 +214,12 @@ static struct platform_device scif1_device = {
 static struct plat_sci_port scif2_platform_data = {
 	.mapbase	= 0xfffe9000,
 	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE | SCSCR_REIE,
+	.scscr		= SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
+			  SCSCR_REIE,
 	.scbrr_algo_id	= SCBRR_ALGO_2,
 	.type		= PORT_SCIF,
 	.irqs		=  { 200, 200, 200, 200 },
+	.regtype	= SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
 static struct platform_device scif2_device = {
@@ -227,10 +233,12 @@ static struct platform_device scif2_device = {
 static struct plat_sci_port scif3_platform_data = {
 	.mapbase	= 0xfffe9800,
 	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE | SCSCR_REIE,
+	.scscr		= SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE |
+			  SCSCR_REIE,
 	.scbrr_algo_id	= SCBRR_ALGO_2,
 	.type		= PORT_SCIF,
 	.irqs		=  { 204, 204, 204, 204 },
+	.regtype	= SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 };
 
 static struct platform_device scif3_device = {
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 18e6342..ca21052 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -207,6 +207,25 @@ static struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
 	},
 
 	/*
+	 * Common SH-2(A) SCIF definitions for ports with FIFO data
+	 * count registers.
+	 */
+	[SCIx_SH2_SCIF_FIFODATA_REGTYPE] = {
+		[SCSMR]		= { 0x00, 16 },
+		[SCBRR]		= { 0x04,  8 },
+		[SCSCR]		= { 0x08, 16 },
+		[SCxTDR]	= { 0x0c,  8 },
+		[SCxSR]		= { 0x10, 16 },
+		[SCxRDR]	= { 0x14,  8 },
+		[SCFCR]		= { 0x18, 16 },
+		[SCFDR]		= { 0x1c, 16 },
+		[SCTFDR]	= sci_reg_invalid,
+		[SCRFDR]	= sci_reg_invalid,
+		[SCSPTR]	= { 0x20, 16 },
+		[SCLSR]		= { 0x24, 16 },
+	},
+
+	/*
 	 * Common SH-3 SCIF definitions.
 	 */
 	[SCIx_SH3_SCIF_REGTYPE] = {
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 8bffe9a..5f3939c 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -67,6 +67,7 @@ enum {
 	SCIx_IRDA_REGTYPE,
 	SCIx_SCIFA_REGTYPE,
 	SCIx_SCIFB_REGTYPE,
+	SCIx_SH2_SCIF_FIFODATA_REGTYPE,
 	SCIx_SH3_SCIF_REGTYPE,
 	SCIx_SH4_SCIF_REGTYPE,
 	SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
-- 
1.7.0.4


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

* Re: [PATCH] sh: Fix serial for SH7203
  2011-10-03 14:16 [PATCH] sh: Fix serial for SH7203 Phil Edworthy
@ 2011-11-04 11:42 ` phil.edworthy
  2011-11-04 13:10 ` Paul Mundt
  1 sibling, 0 replies; 3+ messages in thread
From: phil.edworthy @ 2011-11-04 11:42 UTC (permalink / raw)
  To: linux-sh

Hi Paul,

From: Federico Fuga <ml@studiofuga.com>
Date: 10/10/2011 14:22

> Il giorno 03/ott/2011, alle ore 16.16, Phil Edworthy ha scritto:
> 
> > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> 
> Works correctly on sh7203, fix several crashes when FIFO buffers 
overflows .
> Thanks
> 
> Tested-by: Federico Fuga <fuga@studiofuga.com>

I haven't heard anything on this... Is this patch ok?

Thanks
Phil

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

* Re: [PATCH] sh: Fix serial for SH7203
  2011-10-03 14:16 [PATCH] sh: Fix serial for SH7203 Phil Edworthy
  2011-11-04 11:42 ` phil.edworthy
@ 2011-11-04 13:10 ` Paul Mundt
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2011-11-04 13:10 UTC (permalink / raw)
  To: linux-sh

On Fri, Nov 04, 2011 at 11:42:27AM +0000, phil.edworthy@renesas.com wrote:
> Hi Paul,
> 
> From: Federico Fuga <ml@studiofuga.com>
> Date: 10/10/2011 14:22
> 
> > Il giorno 03/ott/2011, alle ore 16.16, Phil Edworthy ha scritto:
> > 
> > > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> > 
> > Works correctly on sh7203, fix several crashes when FIFO buffers 
> overflows .
> > Thanks
> > 
> > Tested-by: Federico Fuga <fuga@studiofuga.com>
> 
> I haven't heard anything on this... Is this patch ok?
> 
Sorry about that, this is one of the ones that went out when I was
somehow unsubbed from the list and so didn't make it in to my inbox. I
dug the patch up from alternate archives, and will queue it up. Thanks
for reminding me!

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

end of thread, other threads:[~2011-11-04 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 14:16 [PATCH] sh: Fix serial for SH7203 Phil Edworthy
2011-11-04 11:42 ` phil.edworthy
2011-11-04 13:10 ` 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).