summaryrefslogtreecommitdiff
path: root/drivers/serial/ns16550.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-10-22 21:37:05 -0600
committerSimon Glass <sjg@chromium.org>2014-10-23 19:29:07 -0600
commit11c1a87893a1005180e9609925b35cee241ec88c (patch)
treeec09f81c2279604c7b1655f7f352f16ce3ab0d24 /drivers/serial/ns16550.c
parent167efe01bc5a9de2aa4f7ce2663dbe398f9d43f6 (diff)
downloadu-boot-imx-11c1a87893a1005180e9609925b35cee241ec88c.zip
u-boot-imx-11c1a87893a1005180e9609925b35cee241ec88c.tar.gz
u-boot-imx-11c1a87893a1005180e9609925b35cee241ec88c.tar.bz2
dm: ns16550: Correct the probe logic for platform data
The probe logic sets up the pointer to the platform data in the device tree decode method. It should be done in the probe() method, and anyway the device tree decode method can't be used when CONFIG_OF_CONTROL is not enabled. Fix these two problems. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/serial/ns16550.c')
-rw-r--r--drivers/serial/ns16550.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 2301f0a..0799aa4 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -276,14 +276,15 @@ int ns16550_serial_probe(struct udevice *dev)
{
struct NS16550 *const com_port = dev_get_priv(dev);
+ com_port->plat = dev_get_platdata(dev);
NS16550_init(com_port, -1);
return 0;
}
+#ifdef CONFIG_OF_CONTROL
int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
{
- struct NS16550 *const com_port = dev_get_priv(dev);
struct ns16550_platdata *plat = dev->platdata;
fdt_addr_t addr;
@@ -294,10 +295,10 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
plat->base = addr;
plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
"reg-shift", 1);
- com_port->plat = plat;
return 0;
}
+#endif
const struct dm_serial_ops ns16550_serial_ops = {
.putc = ns16550_serial_putc,