From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756090AbbJ1PVI (ORCPT ); Wed, 28 Oct 2015 11:21:08 -0400 Received: from mail-qg0-f52.google.com ([209.85.192.52]:34353 "EHLO mail-qg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751631AbbJ1PVF (ORCPT ); Wed, 28 Oct 2015 11:21:05 -0400 Subject: Re: [PATCH] serial: 8250_uniphier: add earlycon support To: Masahiro Yamada , linux-serial@vger.kernel.org References: <1445503154-14340-1-git-send-email-yamada.masahiro@socionext.com> Cc: Jiri Slaby , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org From: Peter Hurley Message-ID: <5630E7DC.3050506@hurleysoftware.com> Date: Wed, 28 Oct 2015 11:21:00 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1445503154-14340-1-git-send-email-yamada.masahiro@socionext.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Masahiro, On 10/22/2015 04:39 AM, Masahiro Yamada wrote: > This reuses the code of drivers/tty/serial/8250/8250_early.c except > > - Overwrite device->port.iotype and device->port.regshift for > UPIO_MEM32 because of_setup_earlycon() has set them for UPIO_MEM. > > - Set device->baud to zero to prevent early8250_setup() from > initializing the divisor register because port->uartclk does not > match the frequency expected by this hardware. > > Signed-off-by: Masahiro Yamada > --- > > drivers/tty/serial/8250/8250_uniphier.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c > index 245edbb..c1075c5 100644 > --- a/drivers/tty/serial/8250/8250_uniphier.c > +++ b/drivers/tty/serial/8250/8250_uniphier.c > @@ -13,6 +13,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -34,6 +35,29 @@ struct uniphier8250_priv { > spinlock_t atomic_write_lock; > }; > > +#if IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE) #ifdef CONFIG_SERIAL_8250_CONSOLE Customarily, IS_ENABLED() is only used in-function with control flow statements; eg., if (IS_ENABLED() && .... ) .... > +static int __init uniphier_early_console_setup(struct earlycon_device *device, > + const char *options) > +{ > + if (!device->port.membase) > + return -ENODEV; > + > + /* This hardware always expects MMIO32 register interface. */ > + device->port.iotype = UPIO_MEM32; > + device->port.regshift = 2; > + > + /* > + * Do not touch the divisor register in early_serial8250_setup(); > + * we assume it has been initialized by a boot loader. > + */ > + device->baud = 0; > + > + return early_serial8250_setup(device, options); > +} > +OF_EARLYCON_DECLARE(uniphier_uart, "socionext,uniphier-uart", > + uniphier_early_console_setup); Please change the earlycon name to just "uniphier" or "uniphier8250"; eg., OF_EARLYCON_DECLARE(uniphier, "socionext,uniphier-uart", uniphier_early_console_setup); My earlycon series merges OF_EARLYCON_DECLARE() => EARLYCON_DECLARE() and "uniphier" is simpler on the command line. Regards, Peter Hurley > +#endif > + > /* > * The register map is slightly different from that of 8250. > * IO callbacks must be overridden for correct access to FCR, LCR, and MCR. >