All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wenbin Song <wenbin.song@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] armv8/ls1043aqds: Initizlize NS16550 if enalbed LPUART
Date: Tue, 19 Jan 2016 10:21:26 +0000	[thread overview]
Message-ID: <DB5PR04MB131900576C03E8046F8CB1BFF1C10@DB5PR04MB1319.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAEUhbmXP5VMrRkXTi1Jowy3u_SU2KZ21VUbuVNbkNDN=6gwCmw@mail.gmail.com>

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@nxp.com>
Cc: York Sun <yorksun@freescale.com>; Mingkai Hu <mingkai.hu@nxp.com>; Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie <shaohui.xie@nxp.com>; U-Boot Mailing List <u-boot@lists.denx.de>; Wenbin Song <Wenbin.Song@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@nxp.com> wrote:
> From: Wenbin Song <Wenbin.Song@freescale.com>
>
> Need to initialize ns16550 to support earlycon on kernel.
>
> Signed-off-by: Wenbin Song <Wenbin.Song@freescale.com>
> Signed-off-by: Mingkai Hu <Mingkai.Hu@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, &reg, 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

  reply	other threads:[~2016-01-19 10:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19  6:48 [U-Boot] [PATCH 1/4] armv8/ls1043aqds: added lpuart support Wenbin Song
2016-01-19  6:48 ` [U-Boot] [PATCH 2/4] armv8/ls1043aqds: Add lpuart defconfig Wenbin Song
2016-01-19  8:02   ` Bin Meng
2016-01-20  4:29     ` Wenbin Song
2016-01-20  5:32       ` Bin Meng
2016-01-22  2:50         ` Simon Glass
2016-01-19  6:48 ` [U-Boot] [PATCH 3/4] armv8/ls1043aqds: Fix CONFIG_LPUART Wenbin Song
2016-01-19  7:06   ` Mingkai Hu
2016-01-19  8:04   ` Bin Meng
2016-01-19  6:48 ` [U-Boot] [PATCH 4/4] armv8/ls1043aqds: Initizlize NS16550 if enalbed LPUART Wenbin Song
2016-01-19  8:07   ` Bin Meng
2016-01-19 10:21     ` Wenbin Song [this message]
2016-01-19 10:42       ` Bin Meng
2016-01-19 12:12         ` Wenbin Song
2016-01-19  7:03 ` [U-Boot] [PATCH 1/4] armv8/ls1043aqds: added lpuart support Mingkai Hu
2016-01-19  8:00 ` Bin Meng

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=DB5PR04MB131900576C03E8046F8CB1BFF1C10@DB5PR04MB1319.eurprd04.prod.outlook.com \
    --to=wenbin.song@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.