From: Stafford Horne <shorne@gmail.com>
To: Jiri Slaby <jirislaby@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Florent Kermarrec <florent@enjoy-digital.fr>,
Mateusz Holenko <mholenko@antmicro.com>,
Joel Stanley <joel@jms.id.au>,
"Gabriel L . Somlo" <gsomlo@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Karol Gugala <kgugala@antmicro.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Viresh Kumar <viresh.kumar@linaro.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-doc@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial/liteuart; Add support for earlycon
Date: Mon, 17 May 2021 17:53:23 +0900 [thread overview]
Message-ID: <YKIvA+fgbgaoB5sc@antec> (raw)
In-Reply-To: <d17a43ab-facf-8ffb-5147-7492fb85b0b5@kernel.org>
On Mon, May 17, 2021 at 10:25:46AM +0200, Jiri Slaby wrote:
> On 17. 05. 21, 10:23, Stafford Horne wrote:
> > On Mon, May 17, 2021 at 10:16:43AM +0200, Jiri Slaby wrote:
> > > On 15. 05. 21, 10:45, Stafford Horne wrote:
> > > > Most litex boards using RISC-V soft cores us the sbi earlycon, however
> > > > this is not available for non RISC-V litex SoC. This patch enables
> > > > earlycon for liteuart which is available on all Litex SoC's making
> > > > support for earycon debugging more widely available.
> > > >
> > > > Signed-off-by: Stafford Horne <shorne@gmail.com>
> > > > Cc: Florent Kermarrec <florent@enjoy-digital.fr>
> > > > Cc: Mateusz Holenko <mholenko@antmicro.com>
> > > > Cc: Joel Stanley <joel@jms.id.au>
> > > > Cc: Gabriel L. Somlo <gsomlo@gmail.com>
> > > > ---
> > > > .../admin-guide/kernel-parameters.txt | 5 +++
> > > > drivers/tty/serial/Kconfig | 1 +
> > > > drivers/tty/serial/liteuart.c | 31 +++++++++++++++++++
> > > > 3 files changed, 37 insertions(+)
> > > >
> > > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> > > > index 04545725f187..2d4a43af8de2 100644
> > > > --- a/Documentation/admin-guide/kernel-parameters.txt
> > > > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > > > @@ -1084,6 +1084,11 @@
> > > > the driver will use only 32-bit accessors to read/write
> > > > the device registers.
> > > > + liteuart,<addr>
> > > > + Start an early console on a litex serial port at the
> > > > + specified address. The serial port must already be
> > > > + setup and configured. Options are not yet supported.
> > > > +
> > > > meson,<addr>
> > > > Start an early, polled-mode console on a meson serial
> > > > port at the specified address. The serial port must
> > > > diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> > > > index 0c4cd4a348f4..9ceffe6ab6fd 100644
> > > > --- a/drivers/tty/serial/Kconfig
> > > > +++ b/drivers/tty/serial/Kconfig
> > > > @@ -1531,6 +1531,7 @@ config SERIAL_LITEUART
> > > > depends on OF || COMPILE_TEST
> > > > depends on LITEX
> > > > select SERIAL_CORE
> > > > + select SERIAL_EARLYCON
> > > > help
> > > > This driver is for the FPGA-based LiteUART serial controller from LiteX
> > > > SoC builder.
> > > > diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> > > > index 64842f3539e1..38c472487e68 100644
> > > > --- a/drivers/tty/serial/liteuart.c
> > > > +++ b/drivers/tty/serial/liteuart.c
> > > > @@ -372,6 +372,37 @@ static int __init liteuart_console_init(void)
> > > > console_initcall(liteuart_console_init);
> > > > #endif /* CONFIG_SERIAL_LITEUART_CONSOLE */
> > > > +#ifdef CONFIG_SERIAL_EARLYCON
> > > > +static void early_liteuart_putc(struct uart_port *port, int c)
> > > > +{
> > > > + while (litex_read8(port->membase + OFF_TXFULL))
> > > > + cpu_relax();
> > > > +
> > > > + litex_write8(port->membase + OFF_RXTX, c);
> > >
> > > Hi,
> > >
> > > am I missing something or this doesn't differ to liteuart_putchar?
> >
> > Hi, No you are right, I missed that thanks for catching it.
> >
> > I should be able to remove this function and use putchar below.
>
> OK.
>
> I've just noticed you add an ifdef CONFIG_SERIAL_EARLYCON here, but you
> select SERIAL_EARLYCON in Kconfig above. So the ifdef is sort of pointless?
> (Or you shouldn't select SERIAL_EARLYCON.)
Ah yes, this I thought might have been wrong when I wrote it. I think my
problem here is I was just copying how some other patches implemented earlycon.
omap-serial - has ifdefs, doesn't select SERIAL_EARLYCON - looks ok
sifive - has ifdefs + select SERIAL_EARLYCON - maybe needs cleanup too
-Stafford
prev parent reply other threads:[~2021-05-17 8:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 8:45 [PATCH] serial/liteuart; Add support for earlycon Stafford Horne
2021-05-15 8:49 ` Stafford Horne
2021-05-15 12:17 ` Gabriel L. Somlo
2021-05-17 8:16 ` Jiri Slaby
2021-05-17 8:23 ` Stafford Horne
2021-05-17 8:25 ` Jiri Slaby
2021-05-17 8:53 ` Stafford Horne [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YKIvA+fgbgaoB5sc@antec \
--to=shorne@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=florent@enjoy-digital.fr \
--cc=gregkh@linuxfoundation.org \
--cc=gsomlo@gmail.com \
--cc=jirislaby@kernel.org \
--cc=joel@jms.id.au \
--cc=kgugala@antmicro.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mholenko@antmicro.com \
--cc=mike.kravetz@oracle.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).