]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
dm: ns16550: Support non-byte register spacing with driver model
authorSimon Glass <sjg@chromium.org>
Sat, 28 Feb 2015 05:06:26 +0000 (22:06 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:30:12 +0000 (22:30 +0200)
Allow this driver to support boards where the register shift is not 0.
This fixes some compiler warnings which appear in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/serial/ns16550.c

index 362f2ee8796199f7f4472408afa530efc28df9a4..61312995fb86e6c93b259c4803c8658b48b16c4a 100644 (file)
@@ -57,7 +57,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_DM_SERIAL
 
-static inline void serial_out_shift(unsigned char *addr, int shift, int value)
+static inline void serial_out_shift(void *addr, int shift, int value)
 {
 #ifdef CONFIG_SYS_NS16550_PORT_MAPPED
        outb(value, (ulong)addr);
@@ -72,7 +72,7 @@ static inline void serial_out_shift(unsigned char *addr, int shift, int value)
 #endif
 }
 
-static inline int serial_in_shift(unsigned char *addr, int shift)
+static inline int serial_in_shift(void *addr, int shift)
 {
 #ifdef CONFIG_SYS_NS16550_PORT_MAPPED
        return inb((ulong)addr);
@@ -114,9 +114,11 @@ static int ns16550_readb(NS16550_t port, int offset)
 
 /* We can clean these up once everything is moved to driver model */
 #define serial_out(value, addr)        \
-       ns16550_writeb(com_port, addr - (unsigned char *)com_port, value)
+       ns16550_writeb(com_port, \
+               (unsigned char *)addr - (unsigned char *)com_port, value)
 #define serial_in(addr) \
-       ns16550_readb(com_port, addr - (unsigned char *)com_port)
+       ns16550_readb(com_port, \
+               (unsigned char *)addr - (unsigned char *)com_port)
 #endif
 
 static inline int calc_divisor(NS16550_t port, int clock, int baudrate)