mirror of https://gitee.com/openkylin/linux.git
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:
parent
7ec7587189
commit
f5ce6edd22
|
@ -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);
|
||||
|
||||
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,
|
||||
|
@ -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);
|
||||
|
||||
if (uap->access_32b)
|
||||
writel(val, addr);
|
||||
writel_relaxed(val, addr);
|
||||
else
|
||||
writew(val, addr);
|
||||
writew_relaxed(val, addr);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue