public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v2 16/21] serial_lpuart: add support for i.MXRT
Date: Tue, 28 Jan 2020 09:40:22 +0100	[thread overview]
Message-ID: <20200128094022.2f4ca70c@jawa> (raw)
In-Reply-To: <20200110145148.82233-1-giulio.benetti@benettiengineering.com>

On Fri, 10 Jan 2020 15:51:43 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> Add i.MXRT compatible string and cpu type support to lpuart driver,
> to use little endian 32 bits configurations.
> 
> Also according to RM, the Receive RX FIFO Enable (RXFE) field in
> LPUART FIFO register is bit 3, so this definition should change to
> 0x08 as done for i.MX8. It needs also to set baudrate the same way as
> i.MX8 does.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>  drivers/serial/serial_lpuart.c | 15 +++++++++++----
>  include/fsl_lpuart.h           |  3 ++-
>  2 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/serial/serial_lpuart.c
> b/drivers/serial/serial_lpuart.c index b2ec56172e..ccb3ce6701 100644
> --- a/drivers/serial/serial_lpuart.c
> +++ b/drivers/serial/serial_lpuart.c
> @@ -49,7 +49,7 @@
>  #define FIFO_RXSIZE_MASK	0x7
>  #define FIFO_RXSIZE_OFF	0
>  #define FIFO_TXFE		0x80
> -#ifdef CONFIG_ARCH_IMX8
> +#if defined(CONFIG_ARCH_IMX8) || defined(CONFIG_ARCH_IMXRT)
>  #define FIFO_RXFE		0x08
>  #else
>  #define FIFO_RXFE		0x40
> @@ -67,7 +67,8 @@ enum lpuart_devtype {
>  	DEV_VF610 = 1,
>  	DEV_LS1021A,
>  	DEV_MX7ULP,
> -	DEV_IMX8
> +	DEV_IMX8,
> +	DEV_IMXRT,
>  };
>  
>  struct lpuart_serial_platdata {
> @@ -409,7 +410,8 @@ static int _lpuart32_serial_init(struct udevice
> *dev) 
>  	lpuart_write32(plat->flags, &base->match, 0);
>  
> -	if (plat->devtype == DEV_MX7ULP || plat->devtype ==
> DEV_IMX8) {
> +	if (plat->devtype == DEV_MX7ULP || plat->devtype == DEV_IMX8
> ||
> +	    plat->devtype == DEV_IMXRT) {
>  		_lpuart32_serial_setbrg_7ulp(dev, gd->baudrate);
>  	} else {
>  		/* provide data bits, parity, stop bit, etc */
> @@ -426,7 +428,8 @@ static int lpuart_serial_setbrg(struct udevice
> *dev, int baudrate) struct lpuart_serial_platdata *plat =
> dev_get_platdata(dev); 
>  	if (is_lpuart32(dev)) {
> -		if (plat->devtype == DEV_MX7ULP || plat->devtype ==
> DEV_IMX8)
> +		if (plat->devtype == DEV_MX7ULP || plat->devtype ==
> DEV_IMX8 ||
> +		    plat->devtype == DEV_IMXRT)
>  			_lpuart32_serial_setbrg_7ulp(dev, baudrate);
>  		else
>  			_lpuart32_serial_setbrg(dev, baudrate);
> @@ -530,6 +533,8 @@ static int
> lpuart_serial_ofdata_to_platdata(struct udevice *dev) plat->devtype =
> DEV_VF610; else if (!fdt_node_check_compatible(blob, node,
> "fsl,imx8qm-lpuart")) plat->devtype = DEV_IMX8;
> +	else if (!fdt_node_check_compatible(blob, node,
> "fsl,imxrt-lpuart"))
> +		plat->devtype = DEV_IMXRT;
>  
>  	return 0;
>  }
> @@ -549,6 +554,8 @@ static const struct udevice_id
> lpuart_serial_ids[] = { { .compatible = "fsl,vf610-lpuart"},
>  	{ .compatible = "fsl,imx8qm-lpuart",
>  		.data = LPUART_FLAG_REGMAP_32BIT_REG },
> +	{ .compatible = "fsl,imxrt-lpuart",
> +		.data = LPUART_FLAG_REGMAP_32BIT_REG },
>  	{ }
>  };
>  
> diff --git a/include/fsl_lpuart.h b/include/fsl_lpuart.h
> index fc517d4b7f..511fb84367 100644
> --- a/include/fsl_lpuart.h
> +++ b/include/fsl_lpuart.h
> @@ -4,7 +4,8 @@
>   *
>   */
>  
> -#if defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8)
> +#if defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_ARCH_IMX8) || \
> +	defined(CONFIG_ARCH_IMXRT)
>  struct lpuart_fsl_reg32 {
>  	u32 verid;
>  	u32 param;

Reviewed-by: Lukasz Majewski <lukma@denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200128/95fc9078/attachment.sig>

      parent reply	other threads:[~2020-01-28  8:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 14:51 [PATCH v2 16/21] serial_lpuart: add support for i.MXRT Giulio Benetti
2020-01-10 14:51 ` [PATCH v2 17/21] ram: add SDRAM driver for i.MXRT SoCs Giulio Benetti
2020-01-15 12:47   ` sbabic at denx.de
2020-01-28  8:46   ` Lukasz Majewski
2020-01-10 14:51 ` [PATCH v2 18/21] mmc: fsl_esdhc: make if(CONFIG_IS_ENABLED(CLK)) an #if statement Giulio Benetti
2020-01-15 12:47   ` sbabic at denx.de
2020-01-28  8:47   ` Lukasz Majewski
2020-01-10 14:51 ` [PATCH v2 19/21] mmc: fsl_esdhc: add compatible for fsl, imxrt-usdhc Giulio Benetti
2020-01-15 12:47   ` sbabic at denx.de
2020-01-28  8:49   ` Lukasz Majewski
2020-01-10 14:51 ` [PATCH v2 20/21] imx: Add basic support for the NXP IMXRT10xx SoC family Giulio Benetti
2020-01-15 12:46   ` sbabic at denx.de
2020-01-28  8:52   ` Lukasz Majewski
2020-01-10 14:51 ` [PATCH v2 21/21] imx: imxrt1050-evk: Add support for the NXP i.MXRT1050-EVK Giulio Benetti
2020-01-15 12:48   ` sbabic at denx.de
2020-01-28  9:02   ` Lukasz Majewski
2020-01-28 18:54     ` Giulio Benetti
2020-01-15 12:46 ` [PATCH v2 16/21] serial_lpuart: add support for i.MXRT sbabic at denx.de
2020-01-28  8:40 ` Lukasz Majewski [this message]

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=20200128094022.2f4ca70c@jawa \
    --to=lukma@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox