From patchwork Mon Aug 6 14:07:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10557201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FE8714E2 for ; Mon, 6 Aug 2018 14:08:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40884295A7 for ; Mon, 6 Aug 2018 14:08:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 342A2295C8; Mon, 6 Aug 2018 14:08:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8986C295A7 for ; Mon, 6 Aug 2018 14:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729756AbeHFQRV (ORCPT ); Mon, 6 Aug 2018 12:17:21 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:32782 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730180AbeHFQRV (ORCPT ); Mon, 6 Aug 2018 12:17:21 -0400 Received: from ramsan.of.borg ([84.194.111.163]) by albert.telenet-ops.be with bizsmtp id Kq821y0083XaVaC06q82ij; Mon, 06 Aug 2018 16:08:03 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1fmgB0-0000Ng-30; Mon, 06 Aug 2018 16:08:02 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1fmgB0-0006HW-1s; Mon, 06 Aug 2018 16:08:02 +0200 From: Geert Uytterhoeven To: Chris Brandt , Laurent Pinchart , Ulrich Hecht , Yoshinori Sato Cc: Greg Kroah-Hartman , Jiri Slaby , linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org, linux-serial@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC 2/4] sh-sci: Take into account regshift to fix earlycon breakage Date: Mon, 6 Aug 2018 16:07:53 +0200 Message-Id: <20180806140755.24087-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180806140755.24087-1-geert+renesas@glider.be> References: <20180806140755.24087-1-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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);