]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: ns16550: Add support for reg-offset property
authorMichal Simek <michal.simek@xilinx.com>
Tue, 16 Feb 2016 15:17:49 +0000 (16:17 +0100)
committerSimon Glass <sjg@chromium.org>
Fri, 18 Mar 2016 03:27:39 +0000 (21:27 -0600)
reg-offset is the part of standard 8250 binding in the kernel.
It is shifting start of address space by reg-offset.
On Xilinx platform this offset is typically 0x1000.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Moved the new field to the end of the struct to avoid problems:
Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/serial/ns16550.c
include/ns16550.h

index 93dad338b37597aeea3303c9b395ba1f333a6207..28da9ddfd8592ecff03c98a89a8ec6d6d1dd91a0 100644 (file)
@@ -105,7 +105,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value)
         * As far as we know it doesn't make sense to support selection of
         * these options at run-time, so use the existing CONFIG options.
         */
-       serial_out_shift(addr, plat->reg_shift, value);
+       serial_out_shift(addr + plat->reg_offset, plat->reg_shift, value);
 }
 
 static int ns16550_readb(NS16550_t port, int offset)
@@ -116,7 +116,7 @@ static int ns16550_readb(NS16550_t port, int offset)
        offset *= 1 << plat->reg_shift;
        addr = map_physmem(plat->base, 0, MAP_NOCACHE) + offset;
 
-       return serial_in_shift(addr, plat->reg_shift);
+       return serial_in_shift(addr + plat->reg_offset, plat->reg_shift);
 }
 
 /* We can clean these up once everything is moved to driver model */
@@ -401,6 +401,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->base = addr;
+       plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+                                    "reg-offset", 0);
        plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
                                         "reg-shift", 0);
        plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
index 4e620676c453c6a4e0df04332befc0a1b34da592..1311f4cb919e3dff6917a593fb390671613f5795 100644 (file)
@@ -56,6 +56,7 @@ struct ns16550_platdata {
        unsigned long base;
        int reg_shift;
        int clock;
+       int reg_offset;
 };
 
 struct udevice;