diff options
author | Tom Rini <trini@konsulko.com> | 2016-10-07 22:02:10 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-10-08 09:33:37 -0400 |
commit | f5fd45ff64e28a73499548358e3d1ceda0de7daf (patch) | |
tree | ec595a705a2ec1f256c5c83b4e4ee7427aec58f4 /drivers/serial/serial_mxc.c | |
parent | 1f957708072e153637718497f7a1a6e364220337 (diff) | |
parent | 3dddc793e0114eb7dfc68b98a4316644d4031fcb (diff) | |
download | u-boot-imx-f5fd45ff64e28a73499548358e3d1ceda0de7daf.zip u-boot-imx-f5fd45ff64e28a73499548358e3d1ceda0de7daf.tar.gz u-boot-imx-f5fd45ff64e28a73499548358e3d1ceda0de7daf.tar.bz2 |
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
Diffstat (limited to 'drivers/serial/serial_mxc.c')
-rw-r--r-- | drivers/serial/serial_mxc.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 8545714..4fd2b1d 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -108,6 +108,8 @@ #define UTS_RXFULL (1<<3) /* RxFIFO full */ #define UTS_SOFTRST (1<<0) /* Software reset */ +DECLARE_GLOBAL_DATA_PTR; + #ifndef CONFIG_DM_SERIAL #ifndef CONFIG_MXC_UART_BASE @@ -135,8 +137,6 @@ #define UBRC 0xac /* Baud Rate Count Register */ #define UTS 0xb4 /* UART Test Register (mx31) */ -DECLARE_GLOBAL_DATA_PTR; - #define TXTL 2 /* reset default */ #define RXTL 1 /* reset default */ #define RFDIV 4 /* divide input clock by 2 */ @@ -347,9 +347,37 @@ static const struct dm_serial_ops mxc_serial_ops = { .setbrg = mxc_serial_setbrg, }; +#if CONFIG_IS_ENABLED(OF_CONTROL) +static int mxc_serial_ofdata_to_platdata(struct udevice *dev) +{ + struct mxc_serial_platdata *plat = dev->platdata; + fdt_addr_t addr; + + addr = dev_get_addr(dev); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + + plat->reg = (struct mxc_uart *)addr; + + plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev->of_offset, + "fsl,dte-mode"); + return 0; +} + +static const struct udevice_id mxc_serial_ids[] = { + { .compatible = "fsl,imx7d-uart" }, + { } +}; +#endif + U_BOOT_DRIVER(serial_mxc) = { .name = "serial_mxc", .id = UCLASS_SERIAL, +#if CONFIG_IS_ENABLED(OF_CONTROL) + .of_match = mxc_serial_ids, + .ofdata_to_platdata = mxc_serial_ofdata_to_platdata, + .platdata_auto_alloc_size = sizeof(struct mxc_serial_platdata), +#endif .probe = mxc_serial_probe, .ops = &mxc_serial_ops, .flags = DM_FLAG_PRE_RELOC, |