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: 70622 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2476120qgy; Wed, 22 Jun 2016 03:36:35 -0700 (PDT) X-Received: by 10.98.134.196 with SMTP id x187mr33959812pfd.21.1466591795230; Wed, 22 Jun 2016 03:36:35 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a17si46395096pfc.220.2016.06.22.03.36.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 03:36:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFfVS-0000Hv-3n; Wed, 22 Jun 2016 10:35:38 +0000 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFfVO-0000Am-7v for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2016 10:35:35 +0000 Received: by mail-lf0-x22e.google.com with SMTP id l188so70004874lfe.2 for ; Wed, 22 Jun 2016 03:35:13 -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=EVXK90mGbS8BmtrUUyow1HIIZLBHoU6+QONolG9sUYPuhzrnArzY+cKIpbcjE2P9sJ gbo/EirrreA65EJC+4KJKNjYDp5j/uhDd3E1mGP/6L91w6KT/h2WgiJRdWTMrF7f4/Nc Lnt4Yw+rAchj1kIsoVvi3u2Bkc4xt3Gue29mKRyupUrfJ0gB54pwq8eJ+UKXCxEnu5UD RbrZmqzW4LwaeJAn6OnRfD6PjX74Uqo8hDB4DtHKK+rFJBfM+S1qsDxUsOudVHk0Dl86 f3am5T8nAz7XTmPzosacbM14P6h46a9l0kTQRPXlFKO9XRwwTBp3vtkWvEwT+4oQOlEf /hUA== X-Gm-Message-State: ALyK8tK4Y8sufw6EsKLtFRa5skSVFClFGsdcu+VHX9i+NRZD/7uLkkhYphoakQl9rS/2HDr4 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> 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160622_033534_650383_0C26B168 X-CRM114-Status: GOOD ( 23.94 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:22e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 , Russell King , Peter Hurley , Graeme Gregory , Jiri Slaby , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, Leif Lindholm , Russell King , linux-acpi@vger.kernel.org, Andy Shevchenko , Yury Norov , Christopher Covington , linux-serial@vger.kernel.org, Mark Salter , Al Stone , linux-arm-kernel@lists.infradead.org, Len Brown Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org 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, > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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;