MLK-14938-12 serial_lpuart: Update lpuart driver to support i.MX8

Add i.MX8 compatible string and cpu type support to lpuart driver,
to use little endian 32 bits configurations.

Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 0b1a70b2e3f519d6bf6c34f0df3a81ff1a4852cb)
This commit is contained in:
Ye Li 2017-03-24 16:12:14 +08:00
parent a89a8bf416
commit 9168fd3982
2 changed files with 9 additions and 4 deletions

View File

@ -55,7 +55,8 @@ DECLARE_GLOBAL_DATA_PTR;
enum lpuart_devtype {
DEV_VF610 = 1,
DEV_LS1021A,
DEV_MX7ULP
DEV_MX7ULP,
DEV_IMX8
};
struct lpuart_serial_platdata {
@ -326,7 +327,7 @@ static int _lpuart32_serial_init(struct lpuart_serial_platdata *plat)
lpuart_write32(plat->flags, &base->match, 0);
if (plat->devtype == DEV_MX7ULP) {
if (plat->devtype == DEV_MX7ULP || plat->devtype == DEV_IMX8) {
_lpuart32_serial_setbrg_7ulp(plat, gd->baudrate);
} else {
/* provide data bits, parity, stop bit, etc */
@ -343,7 +344,7 @@ static int lpuart_serial_setbrg(struct udevice *dev, int baudrate)
struct lpuart_serial_platdata *plat = dev->platdata;
if (is_lpuart32(dev)) {
if (plat->devtype == DEV_MX7ULP)
if (plat->devtype == DEV_MX7ULP || plat->devtype == DEV_IMX8)
_lpuart32_serial_setbrg_7ulp(plat, baudrate);
else
_lpuart32_serial_setbrg(plat, baudrate);
@ -428,6 +429,8 @@ static int lpuart_serial_ofdata_to_platdata(struct udevice *dev)
plat->devtype = DEV_MX7ULP;
else if (!fdt_node_check_compatible(blob, node, "fsl,vf610-lpuart"))
plat->devtype = DEV_VF610;
else if (!fdt_node_check_compatible(blob, node, "fsl,imx8qm-lpuart"))
plat->devtype = DEV_IMX8;
return 0;
}
@ -445,6 +448,8 @@ static const struct udevice_id lpuart_serial_ids[] = {
{ .compatible = "fsl,imx7ulp-lpuart",
.data = LPUART_FLAG_REGMAP_32BIT_REG },
{ .compatible = "fsl,vf610-lpuart"},
{ .compatible = "fsl,imx8qm-lpuart",
.data = LPUART_FLAG_REGMAP_32BIT_REG },
{ }
};

View File

@ -5,7 +5,7 @@
*
*/
#ifdef CONFIG_ARCH_MX7ULP
#if defined(CONFIG_ARCH_MX7ULP) || defined(CONFIG_IMX8)
struct lpuart_fsl_reg32 {
u32 verid;
u32 param;