[U-Boot] [PATCH 4/4] armv8/ls1043aqds: Initizlize NS16550 if enalbed LPUART
Wenbin Song
wenbin.song at nxp.com
Tue Jan 19 11:21:26 CET 2016
Hi: Bin,
Because we use the ns16550 as the early console when booting kernel , and the earlycon driver on kernel cannot initialize port->uartclk rightly, So if we want to use it, we must initialize ns16550 on uboot, and use the bootargs as follow :
"console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,0x21c0500 "
int __init early_serial8250_setup(struct earlycon_device *device,
const char *options)
{
if (!(device->port.membase || device->port.iobase))
return -ENODEV;
if (!device->baud) {
struct uart_port *port = &device->port;
unsigned int ier;
/* assume the device was initialized, only mask interrupts */
ier = serial8250_early_in(port, UART_IER);
serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
} else
init_port(device);
device->con->write = early_serial8250_write;
return 0;
}
Regards
Wenbin Song
-----Original Message-----
From: Bin Meng [mailto:bmeng.cn at gmail.com]
Sent: Tuesday, January 19, 2016 4:08 PM
To: Wenbin Song <wenbin.song at nxp.com>
Cc: York Sun <yorksun at freescale.com>; Mingkai Hu <mingkai.hu at nxp.com>; Qianyu Gong <qianyu.gong at nxp.com>; Shaohui Xie <shaohui.xie at nxp.com>; U-Boot Mailing List <u-boot at lists.denx.de>; Wenbin Song <Wenbin.Song at freescale.com>
Subject: Re: [U-Boot] [PATCH 4/4] armv8/ls1043aqds: Initizlize NS16550 if enalbed LPUART
Hi Wenbin,
On Tue, Jan 19, 2016 at 2:48 PM, Wenbin Song <wenbin.song at nxp.com> wrote:
> From: Wenbin Song <Wenbin.Song at freescale.com>
>
> Need to initialize ns16550 to support earlycon on kernel.
>
> Signed-off-by: Wenbin Song <Wenbin.Song at freescale.com>
> Signed-off-by: Mingkai Hu <Mingkai.Hu at freescale.com>
> ---
> board/freescale/ls1043aqds/ls1043aqds.c | 12 ++++++++++++
> configs/ls1043aqds_lpuart_defconfig | 1 +
> include/configs/ls1043aqds.h | 3 ++-
> 3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/board/freescale/ls1043aqds/ls1043aqds.c
> b/board/freescale/ls1043aqds/ls1043aqds.c
> index 1da3fe1..fcbd95c 100644
> --- a/board/freescale/ls1043aqds/ls1043aqds.c
> +++ b/board/freescale/ls1043aqds/ls1043aqds.c
> @@ -21,6 +21,7 @@
> #include <fsl_esdhc.h>
> #include <fsl_ifc.h>
> #include <spl.h>
> +#include <ns16550.h>
>
> #include "../common/qixis.h"
> #include "ls1043aqds_qixis.h"
> @@ -219,6 +220,17 @@ void board_retimer_init(void)
> i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1); }
>
> +int board_early_init_r(void)
> +{
> +#ifdef CONFIG_LPUART
> + /* Initialize ns16500 for earlycon on kernel.*/
> + NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
> + DIV_ROUND_CLOSEST(CONFIG_SYS_NS16550_CLK,
> + 16 * CONFIG_BAUDRATE)); #endif
This change does not make a lot sense to me. Since U-Boot is using LPUART as its system console, why do you want to load a kernel that uses the NS16550 as the system console? IMHO we should ask kernel to use LPUART as well, IOW keep in sync with the underlying bootloader.
> + return 0;
> +}
> +
> int board_early_init_f(void)
> {
> #ifdef CONFIG_LPUART
> diff --git a/configs/ls1043aqds_lpuart_defconfig
> b/configs/ls1043aqds_lpuart_defconfig
> index ca06abe..26f7b36 100644
> --- a/configs/ls1043aqds_lpuart_defconfig
> +++ b/configs/ls1043aqds_lpuart_defconfig
> @@ -1,6 +1,7 @@
> CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4,LPUART"
> CONFIG_ARM=y
> CONFIG_TARGET_LS1043AQDS=y
> +CONFIG_SYS_NS16550=y
> CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1043a-qds"
> CONFIG_OF_CONTROL=y
> CONFIG_DM=y
> diff --git a/include/configs/ls1043aqds.h
> b/include/configs/ls1043aqds.h index 88f4bc0..d66d8f9 100644
> --- a/include/configs/ls1043aqds.h
> +++ b/include/configs/ls1043aqds.h
> @@ -30,6 +30,8 @@ unsigned long get_board_ddr_clk(void);
>
> #define CONFIG_LAYERSCAPE_NS_ACCESS
>
> +#define CONFIG_BOARD_EARLY_INIT_R
> +
> #define CONFIG_DIMM_SLOTS_PER_CTLR 1
> /* Physical Memory Map */
> #define CONFIG_CHIP_SELECTS_PER_CTRL 4
> @@ -96,7 +98,6 @@ unsigned long get_board_ddr_clk(void); #define
> CONFIG_LPUART_32B_REG #undef CONFIG_CONS_INDEX #undef
> CONFIG_SYS_NS16550_SERIAL -#undef CONFIG_SYS_NS16550_CLK #endif
>
> /* SATA */
> --
Regards,
Bin
More information about the U-Boot
mailing list