All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Chris Brandt <chris.brandt@renesas.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Ulrich Hecht <uli@fpond.eu>,
	Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org,
	linux-serial@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH/RFC 2/4] sh-sci: Take into account regshift to fix earlycon breakage
Date: Mon, 06 Aug 2018 14:07:53 +0000	[thread overview]
Message-ID: <20180806140755.24087-3-geert+renesas@glider.be> (raw)
In-Reply-To: <20180806140755.24087-1-geert+renesas@glider.be>

With the compressed SCIF address range, the SCIF ports on most Renesas
SoCs now use regshift 1.

However, the earlycon setup code always assumes regshift zero, breaking
earlycon on R-Car, RZ/A1, and RZ/G SoCs.

Fix this by initializing regshift to 1 for the generic SCIF case, and
adding a special entry for RZ/A2 SoCs that do need regshift 0.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: 2d4dd0da45401c7a ("serial: sh-sci: Allow for compressed SCIF address")
---
Tested on R-Car Gen2 and Gen3.

This depends on the previous patch.  Else the kernel hangs when
initializing SCIF0 (why??).
---
 drivers/tty/serial/sh-sci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index cf3195bed0246a3d..caf4422d9e2e59e4 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3390,9 +3390,17 @@ static int __init sci_early_console_setup(struct earlycon_device *device,
 {
 	return early_console_setup(device, PORT_SCI);
 }
+static int __init rza2_early_console_setup(struct earlycon_device *device,
+					  const char *opt)
+{
+	/* RZ/A2 uses the default regshift zero */
+	return early_console_setup(device, PORT_SCIF);
+}
 static int __init scif_early_console_setup(struct earlycon_device *device,
 					  const char *opt)
 {
+	/* Other plain SCIF variants */
+	device->port.regshift = 1;
 	return early_console_setup(device, PORT_SCIF);
 }
 static int __init scifa_early_console_setup(struct earlycon_device *device,
@@ -3412,6 +3420,7 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,
 }
 
 OF_EARLYCON_DECLARE(sci, "renesas,sci", sci_early_console_setup);
+OF_EARLYCON_DECLARE(scif, "renesas,scif-r7s9210", rza2_early_console_setup);
 OF_EARLYCON_DECLARE(scif, "renesas,scif", scif_early_console_setup);
 OF_EARLYCON_DECLARE(scifa, "renesas,scifa", scifa_early_console_setup);
 OF_EARLYCON_DECLARE(scifb, "renesas,scifb", scifb_early_console_setup);
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Chris Brandt <chris.brandt@renesas.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Ulrich Hecht <uli@fpond.eu>,
	Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org,
	linux-serial@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH/RFC 2/4] sh-sci: Take into account regshift to fix earlycon breakage
Date: Mon,  6 Aug 2018 16:07:53 +0200	[thread overview]
Message-ID: <20180806140755.24087-3-geert+renesas@glider.be> (raw)
In-Reply-To: <20180806140755.24087-1-geert+renesas@glider.be>

With the compressed SCIF address range, the SCIF ports on most Renesas
SoCs now use regshift 1.

However, the earlycon setup code always assumes regshift zero, breaking
earlycon on R-Car, RZ/A1, and RZ/G SoCs.

Fix this by initializing regshift to 1 for the generic SCIF case, and
adding a special entry for RZ/A2 SoCs that do need regshift 0.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Fixes: 2d4dd0da45401c7a ("serial: sh-sci: Allow for compressed SCIF address")
---
Tested on R-Car Gen2 and Gen3.

This depends on the previous patch.  Else the kernel hangs when
initializing SCIF0 (why??).
---
 drivers/tty/serial/sh-sci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index cf3195bed0246a3d..caf4422d9e2e59e4 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3390,9 +3390,17 @@ static int __init sci_early_console_setup(struct earlycon_device *device,
 {
 	return early_console_setup(device, PORT_SCI);
 }
+static int __init rza2_early_console_setup(struct earlycon_device *device,
+					  const char *opt)
+{
+	/* RZ/A2 uses the default regshift zero */
+	return early_console_setup(device, PORT_SCIF);
+}
 static int __init scif_early_console_setup(struct earlycon_device *device,
 					  const char *opt)
 {
+	/* Other plain SCIF variants */
+	device->port.regshift = 1;
 	return early_console_setup(device, PORT_SCIF);
 }
 static int __init scifa_early_console_setup(struct earlycon_device *device,
@@ -3412,6 +3420,7 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,
 }
 
 OF_EARLYCON_DECLARE(sci, "renesas,sci", sci_early_console_setup);
+OF_EARLYCON_DECLARE(scif, "renesas,scif-r7s9210", rza2_early_console_setup);
 OF_EARLYCON_DECLARE(scif, "renesas,scif", scif_early_console_setup);
 OF_EARLYCON_DECLARE(scifa, "renesas,scifa", scifa_early_console_setup);
 OF_EARLYCON_DECLARE(scifb, "renesas,scifb", scifb_early_console_setup);
-- 
2.17.1

  parent reply	other threads:[~2018-08-06 14:07 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 14:07 [PATCH/RFC 0/4] sh-sci : Do not derive regshift from regsize Geert Uytterhoeven
2018-08-06 14:07 ` Geert Uytterhoeven
2018-08-06 14:07 ` [PATCH/RFC 1/4] sh-sci: Use a separate sci_port for earlycon Geert Uytterhoeven
2018-08-06 14:07   ` Geert Uytterhoeven
2018-08-06 14:07 ` Geert Uytterhoeven [this message]
2018-08-06 14:07   ` [PATCH/RFC 2/4] sh-sci: Take into account regshift to fix earlycon breakage Geert Uytterhoeven
2018-08-06 14:07 ` [PATCH/RFC 3/4] Revert "serial: sh-sci: Compute the regshift value for SCI ports" Geert Uytterhoeven
2018-08-06 14:07   ` Geert Uytterhoeven
2018-08-06 14:16   ` Laurent Pinchart
2018-08-06 14:16     ` Laurent Pinchart
2018-08-06 14:34     ` Geert Uytterhoeven
2018-08-06 14:34       ` Geert Uytterhoeven
2018-08-06 14:41       ` Laurent Pinchart
2018-08-06 14:41         ` Laurent Pinchart
2018-08-06 14:52         ` Geert Uytterhoeven
2018-08-06 14:52           ` Geert Uytterhoeven
2018-08-06 14:07 ` [PATCH/RFC 4/4] sh-sci: Derive regshift value from DT compatible value Geert Uytterhoeven
2018-08-06 14:07   ` Geert Uytterhoeven
2018-08-06 14:18   ` Chris Brandt
2018-08-06 14:18     ` Chris Brandt
2018-08-06 14:38     ` Geert Uytterhoeven
2018-08-06 14:38       ` Geert Uytterhoeven
2018-08-06 16:10       ` Chris Brandt
2018-08-06 16:10         ` Chris Brandt
2018-08-07 19:24       ` Chris Brandt
2018-08-07 19:24         ` Chris Brandt
2018-08-07 19:37         ` Geert Uytterhoeven
2018-08-07 19:37           ` Geert Uytterhoeven
2018-08-07 21:10           ` Chris Brandt
2018-08-07 21:10             ` Chris Brandt
2018-08-08  0:16           ` Chris Brandt
2018-08-08  0:16             ` Chris Brandt
2018-08-08 10:11             ` Geert Uytterhoeven
2018-08-08 10:11               ` Geert Uytterhoeven
2018-08-08 10:39               ` Chris Brandt
2018-08-08 10:39                 ` Chris Brandt
2018-08-08 11:05                 ` Geert Uytterhoeven
2018-08-08 11:05                   ` Geert Uytterhoeven
2018-08-06 14:37 ` [PATCH/RFC 0/4] sh-sci : Do not derive regshift from regsize Laurent Pinchart
2018-08-06 14:37   ` Laurent Pinchart
2018-08-06 14:41   ` Laurent Pinchart
2018-08-06 14:41     ` Laurent Pinchart
2018-08-06 14:41   ` Geert Uytterhoeven
2018-08-06 14:41     ` Geert Uytterhoeven
2018-08-08 11:02 ` Geert Uytterhoeven
2018-08-08 11:02   ` Geert Uytterhoeven
2018-08-08 11:32   ` Chris Brandt
2018-08-08 11:32     ` Chris Brandt
2018-08-08 20:46   ` Chris Brandt
2018-08-08 20:46     ` Chris Brandt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180806140755.24087-3-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=chris.brandt@renesas.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=uli@fpond.eu \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.