Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2655381pxj; Mon, 17 May 2021 06:51:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytqLgoirJq88KXkzQzcqVmT/ekPmN4Tc9hDmhqQ0qYD9zg2nMwwFFn8ZckJQFMuif+zfTT X-Received: by 2002:a05:6402:1c07:: with SMTP id ck7mr114992edb.149.1621259507793; Mon, 17 May 2021 06:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621259507; cv=none; d=google.com; s=arc-20160816; b=oQCGs0dIzmdAWbv2tZ4bHxZJpwOC3cQPLYha6Q0qrwL+Bm8gcUQGOM2N/H9TRH4cUT 0rUHH/YuoKWva0J7bvVoWy6zOS4IM5tt6sMZRuoZs3x2aalB+lj8QrUxD9XWooTzrweX mEH9Aj6fzH3Wy83tMqcrXIZqEcO6FSfTIi0IWxbNa3tGX5n14c4M3lt+EJQdOuXbweYR gYeJ/RHpI0NOitlquASXKJ0VkO9z9viYQHEwfZuWz3twdNg/71xv/lKAnscjapb0GSiM R0TisruOHP9A9xW31J53fRWABda6yCVN1jSmIKZPix4D/0MWcO5DTJbIJjQ/SRFE9gEP FWSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nJVJSykwKfy3n47FOydKmpx61QhCYnnGnyws86EkojY=; b=ZUbN7T5W4tGxj3Difu1zr52VaptVmyvSvmN8VpVNHZ7bQjda8I8XsS6eQWBLRigI0X lJi2j4Q1VwKej+IhSFjXaWzke/oJ6Fde2IcaQONojXJhwg7C/7t6oF3GiPimaS/TaIRI 05refNdv9/hvvFtySZs6DyXEmElrwMf1jKa0WXtHRm4/R4qzr9y2ApahIKzd/+nouwmF qgwVcMPjSxwnAvA5wDj7pupdTmu6pvmFBv7w/BVGUfQzebbbqICqP9bb1VaFNDsBnYLa +5Qo1jWoFH3YM392CKw5V9d5Qr4h/3sre1B2mX/bKrRUrPCTE/NT3lqWDWKj6yxu0VHu 26lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pp0JhHNF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q11si219880ejz.231.2021.05.17.06.51.23; Mon, 17 May 2021 06:51:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pp0JhHNF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235776AbhEQIyo (ORCPT + 99 others); Mon, 17 May 2021 04:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235731AbhEQIyn (ORCPT ); Mon, 17 May 2021 04:54:43 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F798C061573; Mon, 17 May 2021 01:53:26 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id m190so4193084pga.2; Mon, 17 May 2021 01:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nJVJSykwKfy3n47FOydKmpx61QhCYnnGnyws86EkojY=; b=Pp0JhHNFdCdWiXk8ejDs2Cnk2Bfb+hGWEiTqMM+RlKNRzRwS3Cdnhdp9f8mOHJ74co SJyUCBVElX+y5M8qvmkcpvMLEVWM2lBH7KbCOpv9MB3BBScvptqYTMW4WP8DaTYOP7VP IHvlTfckZd83ecQoMi67xIQSzgZ1tJsT6yyd1r0gwadndNJy7Z6MRidGd/8TL+Ez7Ao8 hdH74JM05BrkehF97QUtaSqmvPip1ugkRw2JfNj53Y/I3obln/LHoaQn3rgW5IizFXly zHw8/0YmQvPMJVmBzZw2MltzsMFxmbYwaVei1XegJ9fc52z2jPS9tuO0/EKTU/FZVjUG XonQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nJVJSykwKfy3n47FOydKmpx61QhCYnnGnyws86EkojY=; b=Z23QPd8pXao511NKmapEORAkfhWHI+oe6yM4Oe6ylVVO+/3OjSg623T2tBTZfHc7/Y mbA0WCLRG6F5663DZGY+OP0SWYSJ0Yu5EbhtxIaJozVh9UwMaKwvTMRDmBgKyVRV9l7E uanRw6LCEEZf/wxcnn6Siqs+BC30mblMVpzPamhXTVGkAbJr67hNEj5+LXbatMx943fT zUBJHvPW8h8XInmajSuoA9HxS75E6HBQ52Cq49PeK5gwhHx2N853OgxKzLwEw8+BzY+i jNIupaQwbuvGSQ+gNOg1C88xZqsB5X2P3+E8ccFPQWkaTrMKQV1VhKi7rc30k1i7i+QO LJ9A== X-Gm-Message-State: AOAM531wEmmqYwa024GbVKQZjpp1K+NSmwPGHG45J/wSzaZxriZCIAFL nUSc+KJjZxCgXTYF23s1Dm4= X-Received: by 2002:a05:6a00:706:b029:217:9e8d:f9cc with SMTP id 6-20020a056a000706b02902179e8df9ccmr59333025pfl.1.1621241605810; Mon, 17 May 2021 01:53:25 -0700 (PDT) Received: from localhost (g1.222-224-229.ppp.wakwak.ne.jp. [222.224.229.1]) by smtp.gmail.com with ESMTPSA id v18sm9859441pff.90.2021.05.17.01.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 01:53:25 -0700 (PDT) Date: Mon, 17 May 2021 17:53:23 +0900 From: Stafford Horne To: Jiri Slaby Cc: LKML , Florent Kermarrec , Mateusz Holenko , Joel Stanley , "Gabriel L . Somlo" , Jonathan Corbet , Greg Kroah-Hartman , Karol Gugala , "Paul E. McKenney" , Randy Dunlap , Andrew Morton , Thomas Gleixner , Viresh Kumar , Mike Kravetz , Peter Zijlstra , linux-doc@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] serial/liteuart; Add support for earlycon Message-ID: References: <20210515084519.167343-1-shorne@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 > > > > Cc: Florent Kermarrec > > > > Cc: Mateusz Holenko > > > > Cc: Joel Stanley > > > > Cc: Gabriel L. Somlo > > > > --- > > > > .../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, > > > > + 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, > > > > 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