mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
dm: ns16550: Use an address instead of a pointer for the uart base
It is inconvenient to have to use casts when specifying platform data. Also it is not strictly correct, since we should use map_sysmem() to convert an address to a pointer. Adjust the platform data to use an address. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@ti.com>
This commit is contained in:
parent
aea2be2012
commit
167efe01bc
2 changed files with 4 additions and 4 deletions
|
@ -61,7 +61,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value)
|
||||||
unsigned char *addr;
|
unsigned char *addr;
|
||||||
|
|
||||||
offset *= 1 << plat->reg_shift;
|
offset *= 1 << plat->reg_shift;
|
||||||
addr = plat->base + offset;
|
addr = map_sysmem(plat->base, 0) + offset;
|
||||||
/*
|
/*
|
||||||
* As far as we know it doesn't make sense to support selection of
|
* 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.
|
* these options at run-time, so use the existing CONFIG options.
|
||||||
|
@ -85,7 +85,7 @@ static int ns16550_readb(NS16550_t port, int offset)
|
||||||
unsigned char *addr;
|
unsigned char *addr;
|
||||||
|
|
||||||
offset *= 1 << plat->reg_shift;
|
offset *= 1 << plat->reg_shift;
|
||||||
addr = plat->base + offset;
|
addr = map_sysmem(plat->base, 0) + offset;
|
||||||
#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
|
#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
|
||||||
return inb(addr);
|
return inb(addr);
|
||||||
#elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_SYS_BIG_ENDIAN)
|
#elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_SYS_BIG_ENDIAN)
|
||||||
|
@ -291,7 +291,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
|
||||||
if (addr == FDT_ADDR_T_NONE)
|
if (addr == FDT_ADDR_T_NONE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
plat->base = (unsigned char *)addr;
|
plat->base = addr;
|
||||||
plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
|
plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
|
||||||
"reg-shift", 1);
|
"reg-shift", 1);
|
||||||
com_port->plat = plat;
|
com_port->plat = plat;
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
* @clock: UART base clock speed in Hz
|
* @clock: UART base clock speed in Hz
|
||||||
*/
|
*/
|
||||||
struct ns16550_platdata {
|
struct ns16550_platdata {
|
||||||
unsigned char *base;
|
unsigned long base;
|
||||||
int reg_shift;
|
int reg_shift;
|
||||||
int clock;
|
int clock;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue