From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org, Jules Maselbas <jmaselbas@kalray.eu>
Subject: Re: [PATCH v2 3/4] RISC-V: board-dt-2nd: add PBL console support for virt
Date: Thu, 15 Apr 2021 09:15:23 +0200 [thread overview]
Message-ID: <20210415071523.GZ19819@pengutronix.de> (raw)
In-Reply-To: <20210410110638.2106658-3-ahmad@a3f.at>
On Sat, Apr 10, 2021 at 01:06:37PM +0200, Ahmad Fatoum wrote:
> The Virt machine has a ns16550a UART at address 0x10000000. As we reuse
> the generic DT image for this platform, we can't use either DEBUG_LL or
> pbl_console as we would need to hardcode information on what UART is
> available where, which wouldn't be correct for other boards.
>
> However, if we parse the board compatible, we could match it with the
> appropriate PBL console implementation without sacrificing portability.
> Do so.
>
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> v1 -> v2:
> - No change
> ---
> arch/riscv/boot/board-dt-2nd.c | 27 ++++++++++++++++++++++++++-
> 1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/boot/board-dt-2nd.c b/arch/riscv/boot/board-dt-2nd.c
> index be28ea23cd6d..e9810f8add97 100644
> --- a/arch/riscv/boot/board-dt-2nd.c
> +++ b/arch/riscv/boot/board-dt-2nd.c
> @@ -3,7 +3,7 @@
> #include <common.h>
> #include <asm/sections.h>
> #include <linux/sizes.h>
> -#include <debug_ll.h>
> +#include <asm/ns16550.h>
> #include <pbl.h>
> #include <fdt.h>
>
> @@ -22,10 +22,29 @@
>
> #include <asm/barebox-riscv.h>
>
> +static void virt_ns16550_putc(void *base, int ch)
> +{
> + early_ns16550_putc(ch, base, 0, readb, writeb);
> +}
> +
> +static void virt_ns16550_init(void)
> +{
> + void __iomem *base = IOMEM(0x10000000);
> +
> + early_ns16550_init(base, 3686400 / CONFIG_BAUDRATE, 0, writeb);
> + pbl_set_putc(virt_ns16550_putc, base);
> +}
> +
> +static const struct fdt_device_id console_ids[] = {
> + { .compatible = "riscv-virtio", .data = virt_ns16550_init },
> + { /* sentinel */ }
This is only board specific. If we go that path of parsing fdt for early
output can't we just do like Linux and establish earlycon?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-04-15 7:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-10 11:06 [PATCH v2 1/4] PBL: fdt: implement fdt_device_get_match_data Ahmad Fatoum
2021-04-10 11:06 ` [PATCH v2 2/4] RISC-V: debug_ll: ns16550: split off debug_ll from generic parts Ahmad Fatoum
2021-04-10 11:06 ` [PATCH v2 3/4] RISC-V: board-dt-2nd: add PBL console support for virt Ahmad Fatoum
2021-04-15 7:15 ` Sascha Hauer [this message]
2021-04-15 7:53 ` Ahmad Fatoum
2021-04-10 11:06 ` [PATCH v2 4/4] RISC-V: delete unused mach-virt subdirectory Ahmad Fatoum
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=20210415071523.GZ19819@pengutronix.de \
--to=sha@pengutronix.de \
--cc=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
--cc=jmaselbas@kalray.eu \
/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