From patchwork Wed Jun 22 10:35:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Makarov X-Patchwork-Id: 9192383 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 EF1CE60756 for ; Wed, 22 Jun 2016 10:42:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC99F26E69 for ; Wed, 22 Jun 2016 10:42:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1387283E9; Wed, 22 Jun 2016 10:42: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 4078F26E69 for ; Wed, 22 Jun 2016 10:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbcFVKmF (ORCPT ); Wed, 22 Jun 2016 06:42:05 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:35119 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcFVKmD (ORCPT ); Wed, 22 Jun 2016 06:42:03 -0400 Received: by mail-lf0-f51.google.com with SMTP id l188so70274982lfe.2 for ; Wed, 22 Jun 2016 03:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Ik1J5LJq+RCqSMR3QCPzF3v+8R4SMFee+lQWqSfOWTY=; b=hVBtyKIw2VM6MS7IsdFV1CJMNlamt7Kk+Gw0pC7psIklbPtrQpSYEs5Nv5rF/KMLgx tT+PcYiKbR4Ez+rnRp1RHxXREzqlPH0ZPMEU1z0MaroFOpTKe579nwgpIY8irvoTIxz0 J/DBCYl/cUTweoFyc64M5EeKk/GSUYSDfNAN4= 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=Ik1J5LJq+RCqSMR3QCPzF3v+8R4SMFee+lQWqSfOWTY=; b=PV7wnFYNPmMtj+A5vDGRn5VR0VDc00pVehoGuX8BRpnICJmcHfk7vmphUly4f14Ynw eudt2iJPZvK69wDvXH5YBVciGwbj3w1xMTW17W6wLH8IBOfNwcqtsiUulbiv+kmatKNC bRFxp1xENqq/kB2Hi8SalIysWvm5c+xXI3J7mw1wW0NIpEKRCnV7nif9omzFrpfi37VR rZhb1eFhvT3KR6I0jBFwn/cYWqGESr7adFsPTHq+AGUXQhQbPsdNAIzPxDtYVTVXDQVv FZSZPo+AfB32Js+D1qKecR7lnf4Uj2RrVpzB6+DEDqqheMMItFT99Dczvxg4z/ge6pD5 t6ZQ== X-Gm-Message-State: ALyK8tLf03XENybiSTF5BUhAbJBftoAkK9+2dWEeWZoxCB+NdrY7wCkm7ODvZKEKZ4nyyb1M X-Received: by 10.25.216.231 with SMTP id r100mr5061953lfi.122.1466591711825; Wed, 22 Jun 2016 03:35:11 -0700 (PDT) Received: from [80.240.102.213] (nivc-213.auriga.ru. [80.240.102.213]) by smtp.gmail.com with ESMTPSA id f65sm7255670lji.10.2016.06.22.03.35.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 03:35:11 -0700 (PDT) Subject: Re: [PATCH v8 4/4] serial: pl011: add console matching function To: Greg Kroah-Hartman References: <1463749405-11640-1-git-send-email-aleksey.makarov@linaro.org> <1463749405-11640-5-git-send-email-aleksey.makarov@linaro.org> Cc: "Rafael J . Wysocki" , linux-serial@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Russell King , Len Brown , Leif Lindholm , Graeme Gregory , Al Stone , Christopher Covington , Yury Norov , Peter Hurley , Andy Shevchenko , "Zheng, Lv" , Mark Salter , Kefeng Wang , Russell King , Jiri Slaby From: Aleksey Makarov Message-ID: <8e74d0d1-7550-acf3-c359-e0916a091fc2@linaro.org> Date: Wed, 22 Jun 2016 13:35:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1463749405-11640-5-git-send-email-aleksey.makarov@linaro.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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. Hi Greg, Can you review this new version of the patch and consider ACKing it please? It had your ACK before but I had to make some changes: 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 with both mmio32 and mmio access. I removed Acked-by: Greg from this patch because of these changes. The difference between v7 and v8: co->index = i; [1] https://lkml.kernel.org/g/1457415800-8799-1-git-send-email-cov@codeaurora.org Thank you Aleksey Makarov > > Signed-off-by: Aleksey Makarov > Reviewed-by: Peter Hurley > --- > 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, > --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;