Re: [PATCH v2 3/4] RISC-V: board-dt-2nd: add PBL console support for virt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
> ---
> 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux