From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753953AbbAENBB (ORCPT ); Mon, 5 Jan 2015 08:01:01 -0500 Received: from mail-qa0-f52.google.com ([209.85.216.52]:35604 "EHLO mail-qa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753292AbbAENA7 (ORCPT ); Mon, 5 Jan 2015 08:00:59 -0500 Message-ID: <54AA8AFC.9020706@hurleysoftware.com> Date: Mon, 05 Jan 2015 08:00:44 -0500 From: Peter Hurley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Vineet Gupta , gregkh@linuxfoundation.org CC: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, robh@kernel.org, jslaby@suse.cz, Arnd Bergmann Subject: Re: [PATCH v2 2/3] serial: 8250_early: prepare for dynamic BASE_BAUD References: <1420457437-17636-1-git-send-email-vgupta@synopsys.com> <1420457437-17636-3-git-send-email-vgupta@synopsys.com> In-Reply-To: <1420457437-17636-3-git-send-email-vgupta@synopsys.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 Vineet, On 01/05/2015 06:30 AM, Vineet Gupta wrote: > BASE_BAUD is pain in neck for multi-platform support as it hard codes at > build time the clk value for early uart. > > Mitigate this by allowing arches/platforms to provide their own version > which can do dynamic setup based on DT values etc (see next patch for > usage) > > This was needed for ARC SDP platforms based on 2 different FPGA flows, each > with a different UART clk value. > > Signed-off-by: Vineet Gupta > Cc: Greg Kroah-Hartman > Cc: Jiri Slaby > Cc: linux-serial@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Cc: Rob Herring > Cc: Arnd Bergmann > --- > drivers/tty/serial/earlycon.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c > index 64fe25a4285c..bfd3537739e0 100644 > --- a/drivers/tty/serial/earlycon.c > +++ b/drivers/tty/serial/earlycon.c > @@ -54,6 +54,15 @@ static void __iomem * __init earlycon_map(unsigned long paddr, size_t size) > return base; > } > > +unsigned int __weak __init earlycon_base_baud(char *options) > +{ > +#ifdef BASE_BAUD > + return BASE_BAUD; > +#else > + return 1843200/16; /* x86 early console */ > +#endif > +} > + > static int __init parse_options(struct earlycon_device *device, > char *options) > { > @@ -87,7 +96,7 @@ static int __init parse_options(struct earlycon_device *device, > return -EINVAL; > } > > - port->uartclk = BASE_BAUD * 16; > + port->uartclk = earlycon_base_baud(options) * 16; I don't understand why BASE_BAUD can't be defined by arc as arc_earlycon_base_baud(). Why is the weak binding necessary? I'm pushing back on this because port initialization (and especially 8250) is already a ridiculous spiderweb. Regards, Peter Hurley > options = strchr(options, ','); > if (options) { > @@ -156,7 +165,7 @@ int __init of_setup_earlycon(unsigned long addr, > > port->iotype = UPIO_MEM; > port->mapbase = addr; > - port->uartclk = BASE_BAUD * 16; > + port->uartclk = earlycon_base_baud(NULL) * 16; > port->membase = earlycon_map(addr, SZ_4K); > > early_console_dev.con->data = &early_console_dev; >