summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorJun Nie <jun.nie@linaro.org>2015-07-31 15:49:18 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-04 22:07:26 -0700
commit09dcc7dfc05b31bf0bbcd1511cd1a2644908d5c8 (patch)
treeb790e6be89e52393a598995c69d3620d0324dc9f /drivers/tty
parent2c096a9eedc6841d3610545f4e6c3d72bd0962be (diff)
downloadblackbird-op-linux-09dcc7dfc05b31bf0bbcd1511cd1a2644908d5c8.tar.gz
blackbird-op-linux-09dcc7dfc05b31bf0bbcd1511cd1a2644908d5c8.zip
uart: pl011: Improve LCRH register access decision
Improve LCRH register access decision as ARM PL011 lcrh register serve as both TX and RX, while other SOC may implement TX and RX function with separated register. Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/amba-pl011.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index e1f3bd5afad6..017443d092c1 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -249,6 +249,11 @@ struct uart_amba_port {
#endif
};
+static bool is_implemented(struct uart_amba_port *uap, unsigned int reg)
+{
+ return uap->reg_lut[reg] != (u16)~0;
+}
+
static unsigned int pl011_readw(struct uart_amba_port *uap, int index)
{
WARN_ON(index > REG_NR);
@@ -1649,7 +1654,7 @@ static int pl011_hwinit(struct uart_port *port)
static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h)
{
pl011_writew(uap, lcr_h, uap->lcrh_rx);
- if (uap->lcrh_rx != uap->lcrh_tx) {
+ if (is_implemented(uap, REG_ST_LCRH_RX)) {
int i;
/*
* Wait 10 PCLKs before writing LCRH_TX register,
@@ -1784,7 +1789,7 @@ static void pl011_disable_uart(struct uart_amba_port *uap)
* disable break condition and fifos
*/
pl011_shutdown_channel(uap, uap->lcrh_rx);
- if (uap->lcrh_rx != uap->lcrh_tx)
+ if (is_implemented(uap, REG_ST_LCRH_RX))
pl011_shutdown_channel(uap, uap->lcrh_tx);
}
OpenPOWER on IntegriCloud