From patchwork Sun Aug 9 00:59:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 6977931 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 9EA84C05AC for ; Sun, 9 Aug 2015 01:01:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C751A2077E for ; Sun, 9 Aug 2015 01:01:22 +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 DB2F12077D for ; Sun, 9 Aug 2015 01:01:20 +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 1ZOExS-0007PZ-Qm; Sun, 09 Aug 2015 00:59:26 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZOExQ-0007NA-67 for linux-arm-kernel@lists.infradead.org; Sun, 09 Aug 2015 00:59:24 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 2FCC813FB62; Sun, 9 Aug 2015 00:59:03 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id E41DB13FADE; Sun, 9 Aug 2015 00:59:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from mail-ig0-f172.google.com (mail-ig0-f172.google.com [209.85.213.172]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: timur@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8090313FADE for ; Sun, 9 Aug 2015 00:59:01 +0000 (UTC) Received: by igr7 with SMTP id 7so51115598igr.0 for ; Sat, 08 Aug 2015 17:59:00 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.61.197 with SMTP id s5mr4711103igr.51.1439081940797; Sat, 08 Aug 2015 17:59:00 -0700 (PDT) Received: by 10.107.168.204 with HTTP; Sat, 8 Aug 2015 17:59:00 -0700 (PDT) In-Reply-To: <1432225584-4655-6-git-send-email-andre.przywara@arm.com> References: <1432225584-4655-1-git-send-email-andre.przywara@arm.com> <1432225584-4655-6-git-send-email-andre.przywara@arm.com> Date: Sat, 8 Aug 2015 17:59:00 -0700 Message-ID: Subject: Re: [PATCH v5 05/11] drivers: PL011: refactor pl011_probe() From: Timur Tabi To: Andre Przywara X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150808_175924_314869_4527F364 X-CRM114-Status: GOOD ( 18.60 ) X-Spam-Score: -2.3 (--) 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: Lorenzo Pieralisi , G Gregory , Arnd Bergmann , Jakub Kicinski , GregKH , nareshgbhat@gmail.com, mlangsdo@redhat.com, linux-serial@vger.kernel.org, rmk+kernel@arm.linux.org.uk, Jiri Slaby , dave.martin@arm.com, "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-Virus-Scanned: ClamAV using ClamSMTP On Thu, May 21, 2015 at 9:26 AM, Andre Przywara wrote: > +static int pl011_probe(struct amba_device *dev, const struct amba_id *id) > +{ > + struct uart_amba_port *uap; > + struct vendor_data *vendor = id->data; > + int portnr, ret; > + > + portnr = pl011_find_free_port(); > + if (portnr < 0) > + return portnr; > + > + uap = devm_kzalloc(&dev->dev, sizeof(struct uart_amba_port), > + GFP_KERNEL); > + if (!uap) > + return -ENOMEM; > + > + uap->clk = devm_clk_get(&dev->dev, NULL); > + if (IS_ERR(uap->clk)) > + return PTR_ERR(uap->clk); > + > + = vendor; I'm having trouble with this. Specifically, I can't get SBSA early console to work, because uap->vendor is uninitialized when pl011_early_write() is called. I don't have a non-SBSA system to test, but looking at the code, I'm not sure how early console is supposed to work any more. In both SBSA and non-SBSA cases, uap->vendor is not initialized until the probe function is called. Isn't that too late? I thought early console was supposed to be running before the driver is probed. If I make this change, then early console works on SBSA systems (with earlycon=pl011,
). But of course, this only works for SBSA and breaks regular PL011. --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2326,9 +2326,15 @@ static void pl011_early_write(struct console *con, const static int __init pl011_early_console_setup(struct earlycon_device *device, const char *opt) { + struct uart_amba_port *uap = + container_of(&device->port, struct uart_amba_port, port); + if (!device->port.membase) return -ENODEV; + if (!uap->vendor) + uap->vendor = &vendor_sbsa; + device->con->write = pl011_early_write; return 0; }