Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1390818pxj; Wed, 19 May 2021 05:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzweCn6IU4sVIzFDYor5X4sbHeM6jMWnVrofVq/5XzGC8eZY8lKKNzkKro1uwro8qKbHwS X-Received: by 2002:a6b:d615:: with SMTP id w21mr6370766ioa.74.1621426290032; Wed, 19 May 2021 05:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621426290; cv=none; d=google.com; s=arc-20160816; b=ht9HjsZNr3lcDhXzX8cMeRpTuuy4dSw6waM/YGNCCkGHF17xHzBxT20Nt7h1wnz9y+ 3m3nkGDZnJrDCG+AyXnbVYwVzG8TlUKns3uBI25zL9tChGyOKrp+k5Y4qZS6Ht/PCsg5 zH9FC6Jh0N4GBiP6OFPMN66JwaKwRfdusmtUv0JRf+Hl3JygfnvKNNE0RObAPeHeIbXx n/sqL/HCgIPd1z7nEivhXqgKdo85IQhGL+tWCxrfP6ZPUc+faqO5TaBin0OY2fKC02+N iiL89QHIdyGxGMIV5dxl2QjqjexDoIDVb9ExdJYH6nNaFi1NINfkPDq6lUyvPVveUKyt y6zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=8YPdF903pID1kt0ZCEYpZxpjPh8BR3iWLNlHhdqJx4Y=; b=o9UIae9DhYhJQbAm6DpmUMB86BgPNWJZYuvkXcILplTDgRavU9T07vfA+Pj3ZOEDI1 PWNh5ur9G9FoPcJisrO8qGNalpH2v71LCSNkrfGTPulZzubhC+952ad4YSRp1pjnDPwj Ipdxx4Dh68Hs7svupW4gsWt4R/pQnEM/Y7DLHj8F3RlgLZrYNBE5J4Dr3AgE2J9fmf5S npVlVnKmQGSVwtXrvA2UVYp2iECMKNFFEZMvbhN0HWux9Cqv17x4cqqYUOh7YmmodgPQ B32sZUIYZJsvLIPEhfEQ+BE+rSdG3PFoq9Hq7O6XWz03/jBXS/5VrLpz6zb1TT+SPKEA BWWQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si23636653ilh.46.2021.05.19.05.11.17; Wed, 19 May 2021 05:11:30 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242941AbhERE64 (ORCPT + 99 others); Tue, 18 May 2021 00:58:56 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:37589 "EHLO mail-wm1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237133AbhERE6z (ORCPT ); Tue, 18 May 2021 00:58:55 -0400 Received: by mail-wm1-f54.google.com with SMTP id f19-20020a05600c1553b02901794fafcfefso57005wmg.2; Mon, 17 May 2021 21:57:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8YPdF903pID1kt0ZCEYpZxpjPh8BR3iWLNlHhdqJx4Y=; b=W3y0CyO0hTJ9kFu7SfmIHSLhu9g3mrYtUacYmiKk9aS86WQwv3U94tEg8TYsvzr3NB 3iUMUUy4lGetnU17y/AhlXgjP/htupMx4egtFlqLdzaSyt84SQMlHBy5v43+cOBOpjBt 1oEYHWkvZLlBFLU+jY2GdO96Fb/VHLZvMYhJOqs+KeKkSmejFavm2ZuPILxCxlF6Zcgt gaGjdyzKfMuzFVUEgrRSauedwqiaVe6ToNmHflUpG0OUnp+3z4hXHuYPkeBMl4H4rjUY 8O3RSM22/eWZxG/yAeS0eXTZevq1Miv0KsxVtzPdZQBQaMYJQ5mu3glojyOLB88u4wNa J1IA== X-Gm-Message-State: AOAM530tCFUr3mF9nyDloo/slFflivzirzVl4SD31bnZyJGDnYDEZv2S NLwx6SiWVXKpsJ2TeUZyAaRYudXgwuEPaQ== X-Received: by 2002:a1c:e90d:: with SMTP id q13mr3214017wmc.163.1621313855807; Mon, 17 May 2021 21:57:35 -0700 (PDT) Received: from ?IPv6:2a0b:e7c0:0:107::49? ([2a0b:e7c0:0:107::49]) by smtp.gmail.com with ESMTPSA id c14sm19727784wrt.77.2021.05.17.21.57.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 May 2021 21:57:35 -0700 (PDT) Subject: Re: [PATCH v2] serial: liteuart: Add support for earlycon To: Stafford Horne , LKML Cc: 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 , Vlastimil Babka , Viresh Kumar , Mike Kravetz , Peter Zijlstra , linux-doc@vger.kernel.org, linux-serial@vger.kernel.org References: <20210517115453.24365-1-shorne@gmail.com> From: Jiri Slaby Message-ID: <3810b979-e94e-24dc-9a6f-e9989800f7e7@kernel.org> Date: Tue, 18 May 2021 06:57:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210517115453.24365-1-shorne@gmail.com> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17. 05. 21, 13:54, 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's. 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 > Reviewed-and-tested-by: Gabriel Somlo Reviewed-by: Jiri Slaby > --- > Changes since v1: > - Fixed subject > - Fixed ifdef and config issues pointed out by Jiri > - Use liteuart_putchar instead of early_liteuart_putc > > .../admin-guide/kernel-parameters.txt | 5 +++++ > drivers/tty/serial/Kconfig | 1 + > drivers/tty/serial/liteuart.c | 21 +++++++++++++++++++ > 3 files changed, 27 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..af41e534483c 100644 > --- a/drivers/tty/serial/Kconfig > +++ b/drivers/tty/serial/Kconfig > @@ -1550,6 +1550,7 @@ config SERIAL_LITEUART_CONSOLE > bool "LiteUART serial port console support" > depends on SERIAL_LITEUART=y > select SERIAL_CORE_CONSOLE > + select SERIAL_EARLYCON > help > Say 'Y' or 'M' here if you wish to use the FPGA-based LiteUART serial > controller from LiteX SoC builder as the system console > diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c > index 64842f3539e1..1b75a4bf7c56 100644 > --- a/drivers/tty/serial/liteuart.c > +++ b/drivers/tty/serial/liteuart.c > @@ -370,6 +370,27 @@ static int __init liteuart_console_init(void) > return 0; > } > console_initcall(liteuart_console_init); > + > +static void early_liteuart_write(struct console *console, const char *s, > + unsigned int count) > +{ > + struct earlycon_device *device = console->data; > + struct uart_port *port = &device->port; > + > + uart_console_write(port, s, count, liteuart_putchar); > +} > + > +static int __init early_liteuart_setup(struct earlycon_device *device, > + const char *options) > +{ > + if (!device->port.membase) > + return -ENODEV; > + > + device->con->write = early_liteuart_write; > + return 0; > +} > + > +OF_EARLYCON_DECLARE(liteuart, "litex,liteuart", early_liteuart_setup); > #endif /* CONFIG_SERIAL_LITEUART_CONSOLE */ > > static int __init liteuart_init(void) > thanks, -- js suse labs