提交 77d7b5cd 编写于 作者: T Thomas Chou 提交者: Tom Rini

ns16550: change map_sysmem to map_physmem

Change map_sysmem() to map_physmem(,,MAP_NOCACHE). Though map_sysmem()
can be used to map system memory, it might be wrong to use it for I/O
ports.  The map_physmem() serves the same purpose to translate physical
address to virtual address with the additional flag to take care of cache
property. Most drivers use map_physmem() since I/O ports access should be
uncached. As ns16550 is a driver, it should use map_physmem() rather
than map_sysmem().
Signed-off-by: NThomas Chou <thomas@wytron.com.tw>
Acked-by: NSimon Glass <sjg@chromium.org>
上级 b1e361b6
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <mapmem.h>
#include <ns16550.h> #include <ns16550.h>
#include <serial.h> #include <serial.h>
#include <watchdog.h> #include <watchdog.h>
...@@ -97,7 +96,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value) ...@@ -97,7 +96,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 = map_sysmem(plat->base, 0) + offset; addr = map_physmem(plat->base, 0, MAP_NOCACHE) + 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.
...@@ -111,7 +110,7 @@ static int ns16550_readb(NS16550_t port, int offset) ...@@ -111,7 +110,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 = map_sysmem(plat->base, 0) + offset; addr = map_physmem(plat->base, 0, MAP_NOCACHE) + offset;
return serial_in_shift(addr, plat->reg_shift); return serial_in_shift(addr, plat->reg_shift);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册