From patchwork Thu Jun 2 18:02:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 9151073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3512760467 for ; Thu, 2 Jun 2016 18:06:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B5E626E39 for ; Thu, 2 Jun 2016 18:06:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EAFD28319; Thu, 2 Jun 2016 18:06:51 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 961DE26E39 for ; Thu, 2 Jun 2016 18:06:50 +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 1b8Wze-00063v-OK; Thu, 02 Jun 2016 18:05:18 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8Wza-0004ZN-VQ for linux-arm-kernel@lists.infradead.org; Thu, 02 Jun 2016 18:05:16 +0000 Received: by mail-lf0-x242.google.com with SMTP id h68so5848701lfh.3 for ; Thu, 02 Jun 2016 11:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=pEQ8ZmoXEKaZmIj8NGeG+H6AHbxGUFwFdHdQAlYh6/Y=; b=q/JCEu27H9yi0X/3CUbKKisixhqpmn6iWV09netVtYvz7Sb2NoBIIR7xrLs9MbLIFB YFKnr4bZPSn0/5F42u8sGgJh04nagipjTdZf7WYNd0rCwg0kmFQfX6M40akMcRZMDGwA Gksra8PpGnhQAXFBRpeIKmCmRHc5ECVoFgwVY0+EaVSsWcrEpfiGEXkLE7hkBmeoDAPI z6pPV7vmIEQx1vTaBJsqPQXMZ56a/3iQGlY5Bs5c7T6Rm+kk8/VMpd0kPzHhtNpHVI++ AcScx1lIkBjd1LVJ4vzJF3d42XFLpySRE4g8WgjI2Lwf7o1NHTdLKGe97mkKxBqPR7/E sxVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=pEQ8ZmoXEKaZmIj8NGeG+H6AHbxGUFwFdHdQAlYh6/Y=; b=R0pZcOfdNVlgPZ2snSzBswX4K2fjRKXmaHHM4/NK2GNzRvzzQA6huXuu+Ot0a807h/ m3C+dbCrWh17kVn2Jk8TUCEkSaT58J76H1+ZuzO78mWVVagCMnMgGOZVmey5c7oyauFx wIAvney9miccWTAM8fu7zo7yDJ5I0qRAuVLBFWy+Zm+FIxNy5+isoaW/Bhtd8DVKzAj3 Bu56zBmhKi9VkHpzZOiYgysCuSE21EH27MX+cLOMLudML3gD+AzDNCqCiDfg88l+lwMf nFIQrVFkl88q2wCmxD5NfkM3MubSdeqWg132voQQpwVC6xGj4phiwBcbj/+aASurfU6B x2QQ== X-Gm-Message-State: ALyK8tIk4f3ZhU2VH72jY2/OWGkI2cNh+NlJiGSNx8olKxT7eni2AznjRq3ut6jwA8szIA== X-Received: by 10.25.42.4 with SMTP id q4mr4652236lfq.102.1464890692693; Thu, 02 Jun 2016 11:04:52 -0700 (PDT) Received: from [80.240.102.213] (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id d1sm160260lbm.3.2016.06.02.11.04.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jun 2016 11:04:52 -0700 (PDT) Subject: Re: [PATCH v8 4/4] serial: pl011: add console matching function To: Greg Kroah-Hartman , Russell King References: <1463749405-11640-1-git-send-email-aleksey.makarov@linaro.org> <1463749405-11640-5-git-send-email-aleksey.makarov@linaro.org> From: Aleksey Makarov Message-ID: Date: Thu, 2 Jun 2016 21:02:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1463749405-11640-5-git-send-email-aleksey.makarov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160602_110515_389247_1E951925 X-CRM114-Status: GOOD ( 23.70 ) 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: "Zheng, Lv" , Kefeng Wang , Peter Hurley , Graeme Gregory , Andy Shevchenko , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Leif Lindholm , Russell King , linux-acpi@vger.kernel.org, Aleksey Makarov , Yury Norov , Christopher Covington , linux-serial@vger.kernel.org, Mark Salter , Jiri Slaby , Al Stone , linux-arm-kernel@lists.infradead.org, Len Brown 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 05/20/2016 04:03 PM, Aleksey Makarov wrote: > This patch adds function pl011_console_match() that implements > method match of struct console. It allows to match consoles against > data specified in a string, for example taken from command line or > compiled by ACPI SPCR table handler. > > Signed-off-by: Aleksey Makarov > Reviewed-by: Peter Hurley Hi Greg, Russell, Can you review this patch and consider ACKing it please? It had an ACK from Greg in v7 but since then I changed it a bit. The patch by Christopher Covington [1] specifies that SBSA uart does 32-bit access to registers and this breaks the match function. In this series the function was changed to match when SPCR specifies both mmio32 and mmio access. I removed Acked-by: Greg from this patch because of these changes. The difference between v7 and v8: [1] https://lkml.kernel.org/g/1457415800-8799-1-git-send-email-cov@codeaurora.org Thank you Aleksey Makarov > --- > drivers/tty/serial/amba-pl011.c | 56 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index a2aa655..388edc8 100644 > --- a/drivers/tty/serial/amba-pl011.c > +++ b/drivers/tty/serial/amba-pl011.c > @@ -2288,12 +2288,68 @@ static int __init pl011_console_setup(struct console *co, char *options) > return uart_set_options(&uap->port, co, baud, parity, bits, flow); > } > > +/** > + * pl011_console_match - non-standard console matching > + * @co: registering console > + * @name: name from console command line > + * @idx: index from console command line > + * @options: ptr to option string from console command line > + * > + * Only attempts to match console command lines of the form: > + * console=pl011,mmio|mmio32,[,] > + * console=pl011,0x[,] > + * This form is used to register an initial earlycon boot console and > + * replace it with the amba_console at pl011 driver init. > + * > + * Performs console setup for a match (as required by interface) > + * If no are specified, then assume the h/w is already setup. > + * > + * Returns 0 if console matches; otherwise non-zero to use default matching > + */ > +static int __init pl011_console_match(struct console *co, char *name, int idx, > + char *options) > +{ > + char match[] = "pl011"; /* pl011-specific earlycon name */ > + unsigned char iotype; > + unsigned long addr; > + int i; > + > + if (strncmp(name, match, 5) != 0) > + return -ENODEV; > + > + if (uart_parse_earlycon(options, &iotype, &addr, &options)) > + return -ENODEV; > + > + /* try to match the port specified on the command line */ > + for (i = 0; i < ARRAY_SIZE(amba_ports); i++) { > + struct uart_port *port; > + > + if (!amba_ports[i]) > + continue; > + > + port = &amba_ports[i]->port; > + > + if (iotype != UPIO_MEM && iotype != UPIO_MEM32) > + continue; > + > + if (port->mapbase != addr) > + continue; > + > + co->index = i; > + port->cons = co; > + return pl011_console_setup(co, options); > + } > + > + return -ENODEV; > +} > + > static struct uart_driver amba_reg; > static struct console amba_console = { > .name = "ttyAMA", > .write = pl011_console_write, > .device = uart_console_device, > .setup = pl011_console_setup, > + .match = pl011_console_match, > .flags = CON_PRINTBUFFER, > .index = -1, > .data = &amba_reg, > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 4139b64..388edc8 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -2328,10 +2329,10 @@ static int __init pl011_console_match(struct console *co, char *name, int idx, port = &amba_ports[i]->port; - if (port->iotype != iotype) + if (iotype != UPIO_MEM && iotype != UPIO_MEM32) continue; - if ((iotype == UPIO_MEM || iotype == UPIO_MEM32) && - (port->mapbase != addr)) + + if (port->mapbase != addr) continue; co->index = i;