From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Schwierzeck Date: Mon, 16 May 2016 20:58:59 +0200 Subject: [U-Boot] [PATCH v2 3/5] dm: ns16550: Don't map_physmem for I/O ports In-Reply-To: <1463420679-5042-4-git-send-email-paul.burton@imgtec.com> References: <1463420679-5042-1-git-send-email-paul.burton@imgtec.com> <1463420679-5042-4-git-send-email-paul.burton@imgtec.com> Message-ID: <573A1873.4010706@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 16.05.2016 um 19:44 schrieb Paul Burton: > If the UART is to be accessed using I/O port accessors (inb & outb) then > using map_physmem doesn't make sense, since it operates in a different > memory space. Remove the call to map_physmem when > CONFIG_SYS_NS16550_PORT_MAPPED is defined, allowing I/O port addresses > to not be mangled by the incorrect mapping. > > Signed-off-by: Paul Burton Reviewed-by: Daniel Schwierzeck Tested-by: Daniel Schwierzeck > --- > > Changes in v2: > - New patch, part of a simplified approach tackling only a single Malta UART. > > drivers/serial/ns16550.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c > index 28da9dd..e58e6aa 100644 > --- a/drivers/serial/ns16550.c > +++ b/drivers/serial/ns16550.c > @@ -100,7 +100,11 @@ static void ns16550_writeb(NS16550_t port, int offset, int value) > unsigned char *addr; > > offset *= 1 << plat->reg_shift; > +#ifdef CONFIG_SYS_NS16550_PORT_MAPPED > + addr = (unsigned char *)plat->base + offset; > +#else > addr = map_physmem(plat->base, 0, MAP_NOCACHE) + offset; > +#endif > /* > * 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. > @@ -114,7 +118,11 @@ static int ns16550_readb(NS16550_t port, int offset) > unsigned char *addr; > > offset *= 1 << plat->reg_shift; > +#ifdef CONFIG_SYS_NS16550_PORT_MAPPED > + addr = (unsigned char *)plat->base + offset; > +#else > addr = map_physmem(plat->base, 0, MAP_NOCACHE) + offset; > +#endif > > return serial_in_shift(addr + plat->reg_offset, plat->reg_shift); > } > -- - Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: OpenPGP digital signature URL: