serial: zynq: Fix address reading from DM
authorMichal Simek <michal.simek@xilinx.com>
Tue, 12 Jan 2016 13:45:49 +0000 (14:45 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 27 Jan 2016 14:55:54 +0000 (15:55 +0100)
Use dev_get_addr() instead of reading reg base directly in the driver.
Core function is also more robust.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/serial/serial_zynq.c

index 112a7a27b875a47b2bdd5b2b9ff65deb8dde9ea6..e79d997cbab722580f2c8c2876a7f518577a1f41 100644 (file)
@@ -156,13 +156,8 @@ static int zynq_serial_pending(struct udevice *dev, bool input)
 static int zynq_serial_ofdata_to_platdata(struct udevice *dev)
 {
        struct zynq_uart_priv *priv = dev_get_priv(dev);
-       fdt_addr_t addr;
 
-       addr = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
-       if (addr == FDT_ADDR_T_NONE)
-               return -EINVAL;
-
-       priv->regs = (struct uart_zynq *)addr;
+       priv->regs = (struct uart_zynq *)dev_get_addr(dev);
 
        return 0;
 }