diff mbox

[v1.1,08/19] serial: sh-sci: Fix register offsets for the IRDA serial port

Message ID 20170106115235.3919-1-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Jan. 6, 2017, 11:52 a.m. UTC
Even though most of its registers are 8-bit wide, the IRDA has two
16-bit registers that make it a 16-bit peripheral and not a 8-bit
peripheral with addresses shifted by one. Fix the registers offset in
the driver and the platform data regshift value.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 arch/sh/kernel/cpu/sh3/setup-sh770x.c |  1 -
 drivers/tty/serial/sh-sci.c           | 17 ++++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

Comments

Geert Uytterhoeven Jan. 11, 2017, 12:31 p.m. UTC | #1
Hi Laurent,

On Fri, Jan 6, 2017 at 12:52 PM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> Even though most of its registers are 8-bit wide, the IRDA has two
> 16-bit registers that make it a 16-bit peripheral and not a 8-bit
> peripheral with addresses shifted by one. Fix the registers offset in
> the driver and the platform data regshift value.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -193,18 +193,17 @@ static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
>         },
>
>         /*
> -        * Common definitions for legacy IrDA ports, dependent on
> -        * regshift value.
> +        * Common definitions for legacy IrDA ports.
>          */
>         [SCIx_IRDA_REGTYPE] = {
>                 [SCSMR]         = { 0x00,  8 },
> -               [SCBRR]         = { 0x01,  8 },
> -               [SCSCR]         = { 0x02,  8 },
> -               [SCxTDR]        = { 0x03,  8 },
> -               [SCxSR]         = { 0x04,  8 },
> -               [SCxRDR]        = { 0x05,  8 },
> -               [SCFCR]         = { 0x06,  8 },
> -               [SCFDR]         = { 0x07, 16 },
> +               [SCBRR]         = { 0x02,  8 },
> +               [SCSCR]         = { 0x04,  8 },
> +               [SCxTDR]        = { 0x06,  8 },
> +               [SCxSR]         = { 0x08,  8 },

SCSCR is a 16-bit register. You did have that correct in v1 of patch 19.

If you fix that:

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> +               [SCxRDR]        = { 0x0a,  8 },
> +               [SCFCR]         = { 0x0c,  8 },
> +               [SCFDR]         = { 0x0e, 16 },

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
index e1e54258b822..592cd9ab30c4 100644
--- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c
+++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c
@@ -157,7 +157,6 @@  static struct platform_device scif1_device = {
 static struct plat_sci_port scif2_platform_data = {
 	.type		= PORT_IRDA,
 	.ops		= &sh770x_sci_port_ops,
-	.regshift	= 1,
 };
 
 static struct resource scif2_resources[] = {
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 8c58c43fc85d..1eb91ba43b2e 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -193,18 +193,17 @@  static const struct plat_sci_reg sci_regmap[SCIx_NR_REGTYPES][SCIx_NR_REGS] = {
 	},
 
 	/*
-	 * Common definitions for legacy IrDA ports, dependent on
-	 * regshift value.
+	 * Common definitions for legacy IrDA ports.
 	 */
 	[SCIx_IRDA_REGTYPE] = {
 		[SCSMR]		= { 0x00,  8 },
-		[SCBRR]		= { 0x01,  8 },
-		[SCSCR]		= { 0x02,  8 },
-		[SCxTDR]	= { 0x03,  8 },
-		[SCxSR]		= { 0x04,  8 },
-		[SCxRDR]	= { 0x05,  8 },
-		[SCFCR]		= { 0x06,  8 },
-		[SCFDR]		= { 0x07, 16 },
+		[SCBRR]		= { 0x02,  8 },
+		[SCSCR]		= { 0x04,  8 },
+		[SCxTDR]	= { 0x06,  8 },
+		[SCxSR]		= { 0x08,  8 },
+		[SCxRDR]	= { 0x0a,  8 },
+		[SCFCR]		= { 0x0c,  8 },
+		[SCFDR]		= { 0x0e, 16 },
 		[SCTFDR]	= sci_reg_invalid,
 		[SCRFDR]	= sci_reg_invalid,
 		[SCSPTR]	= sci_reg_invalid,