tty: amba-pl011: switch to using relaxed IO accessors

Using relaxed IO accessors allows GCC to better optimise this code
as we eliminate the heavy memory barriers - for example, GCC can now
cache the address of a register across a read-modify-write sequence,
rather than reloading the base address, offset and access size flag.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Russell King 2015-11-16 17:41:02 +00:00 committed by Greg Kroah-Hartman
parent 7ec7587189
commit f5ce6edd22
1 changed files with 3 additions and 3 deletions

View File

@ -262,7 +262,7 @@ static unsigned int pl011_read(const struct uart_amba_port *uap,
{ {
void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg); void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg);
return uap->access_32b ? readl(addr) : readw(addr); return uap->access_32b ? readl_relaxed(addr) : readw_relaxed(addr);
} }
static void pl011_write(unsigned int val, const struct uart_amba_port *uap, static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
@ -271,9 +271,9 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg); void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg);
if (uap->access_32b) if (uap->access_32b)
writel(val, addr); writel_relaxed(val, addr);
else else
writew(val, addr); writew_relaxed(val, addr);
} }
/* /*