From patchwork Thu Jan 7 16:53:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Hunter X-Patchwork-Id: 7978441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 06D6FBEEE5 for ; Thu, 7 Jan 2016 16:55:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11AFD200E9 for ; Thu, 7 Jan 2016 16:55:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E9A9E200E0 for ; Thu, 7 Jan 2016 16:55:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHDoy-0001Np-Eu; Thu, 07 Jan 2016 16:53:56 +0000 Received: from hqemgate16.nvidia.com ([216.228.121.65]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHDov-0001Ft-2A for linux-arm-kernel@lists.infradead.org; Thu, 07 Jan 2016 16:53:53 +0000 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Thu, 07 Jan 2016 08:53:42 -0800 Received: from HQMAIL104.nvidia.com ([172.18.146.11]) by hqnvupgp07.nvidia.com (PGP Universal service); Thu, 07 Jan 2016 08:36:50 -0800 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Thu, 07 Jan 2016 08:36:50 -0800 Received: from UKMAIL101.nvidia.com (10.26.138.13) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Thu, 7 Jan 2016 16:53:30 +0000 Received: from [10.21.132.159] (10.21.132.159) by UKMAIL101.nvidia.com (10.26.138.13) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Thu, 7 Jan 2016 16:53:26 +0000 Subject: Re: [PATCH] ARM64: tegra: Add support for Google Pixel C To: Arnd Bergmann References: <1452073222-2956-1-git-send-email-jonathanh@nvidia.com> <568D0D70.4020309@nvidia.com> <568E65F0.2070201@nvidia.com> <4442990.rM1mk43t6M@wuerfel> From: Jon Hunter Message-ID: <568E9804.5020503@nvidia.com> Date: Thu, 7 Jan 2016 16:53:24 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <4442990.rM1mk43t6M@wuerfel> X-Originating-IP: [10.21.132.159] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160107_085353_269165_DA0C225A X-CRM114-Status: GOOD ( 20.41 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Alexandre Courbot , Pawel Moll , Stephen Warren , Ian Campbell , devicetree@vger.kernel.org, Rob Herring , Thierry Reding , Kumar Gala , linux-tegra@vger.kernel.org, Olof Johansson , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 07/01/16 14:11, Arnd Bergmann wrote: > On Thursday 07 January 2016 13:19:44 Jon Hunter wrote: >> >> Adding Arnd. >> >> Hmmm ... well apparently stdout-path does not work for tegra and in >> order to make this work I had to do the following ... >> >> >> [PATCH] serial: 8250: of: Add earlycon support for Tegra >> >> Currently, early console support only works for Tegra when the serial >> port information is passed via the earlycon boot parameter. If the >> serial port information is specified via device-tree using the >> "stdout-path" then the early console does not work because: >> >> 1. The tegra serial ports compatibility parameter does not match any >> of the supported serial drivers for early console. >> 2. The of_setup_earlycon() function assumes that serial port registers >> are byte aligned and for tegra they are 32-bit aligned. >> >> Add an early console setup function for tegra so that the early console >> can be specified via the device-tree "stdout-path" variable. >> >> Signed-off-by: Jon Hunter >> --- >> drivers/tty/serial/8250/8250_of.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c >> index 33021c1f7d55..98adf83e83c2 100644 >> --- a/drivers/tty/serial/8250/8250_of.c >> +++ b/drivers/tty/serial/8250/8250_of.c >> @@ -44,6 +44,16 @@ void tegra_serial_handle_break(struct uart_port *p) >> udelay(1); >> } while (1); >> } >> + >> +int __init tegra_earlycon_setup(struct earlycon_device *device, >> + const char *options) >> +{ >> + device->port.iotype = UPIO_MEM32; >> + device->port.regshift = 2; >> + >> + return early_serial8250_setup(device, options); >> +} >> +OF_EARLYCON_DECLARE(tegra20_uart, "nvidia,tegra20-uart", tegra_earlycon_setup); >> #else >> static inline void tegra_serial_handle_break(struct uart_port *port) >> { >> >> >> Arnd, does the above look ok, or should there be a generic >> early_serial8250x32_setup() somewhere? > > I think it would be better to put it into 8250_early.c rather than > 8250_of.c, as there are already some other definitions in there, > and the #ifdef CONFIG_TEGRA in 8250_of.c is for some other workaround. Ok so something like this ... + early_serial8250_mem32_setup); > Would it be possible to handle the "reg-io-width" parsing in > early_serial8250_setup instead of keying it off the string? Good point. I spent a bit of time looking at this, but I cannot see an easy way to do this unless we check for "reg-io-width" and "reg-shift" in early_init_dt_scan_chosen_serial() and pass to of_setup_earlycon(), however, I am guessing that this would not be ideal as this would happen for non-8250 devices. May be that would be ok, but I am not sure. Cheers Jon diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index af62131af21e..4ce6e2b57534 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c @@ -141,7 +141,18 @@ int __init early_serial8250_setup(struct earlycon_device *device, device->con->write = early_serial8250_write; return 0; } + +int __init early_serial8250_mem32_setup(struct earlycon_device *device, + const char *options) +{ + device->port.iotype = UPIO_MEM32; + device->port.regshift = 2; + + return early_serial8250_setup(device, options); +} EARLYCON_DECLARE(uart8250, early_serial8250_setup); EARLYCON_DECLARE(uart, early_serial8250_setup); OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup); OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup); +OF_EARLYCON_DECLARE(tegra20_uart, "nvidia,tegra20-uart",