summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/imx.c
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2014-10-28 08:28:07 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 22:57:23 (GMT)
commitf968ef34945f8e606c5d98ff330a5903785ea76a (patch)
treea2feca9ae84c3143c074c9a32fd05c13f88a3e0d /drivers/tty/serial/imx.c
parent97f754710304382607417c700476007443cd96a4 (diff)
downloadlinux-f968ef34945f8e606c5d98ff330a5903785ea76a.tar.xz
serial: imx: clean up imx_poll_put_char()
imx_put_poll_char() has been simplified to remove the code to disable interrupts. The present code can corrupt register state when re-entered from FIQ handler. Switch to _relaxed() MMIO functions (which are safe for polled I/O and needed to avoid taking spin locks). Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Huang Shijie <b32955@freescale.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r--drivers/tty/serial/imx.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index d2e6cf5..8d61aa9 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1457,42 +1457,28 @@ imx_verify_port(struct uart_port *port, struct serial_struct *ser)
#if defined(CONFIG_CONSOLE_POLL)
static int imx_poll_get_char(struct uart_port *port)
{
- if (!(readl(port->membase + USR2) & USR2_RDR))
+ if (!(readl_relaxed(port->membase + USR2) & USR2_RDR))
return NO_POLL_CHAR;
- return readl(port->membase + URXD0) & URXD_RX_DATA;
+ return readl_relaxed(port->membase + URXD0) & URXD_RX_DATA;
}
static void imx_poll_put_char(struct uart_port *port, unsigned char c)
{
- struct imx_port_ucrs old_ucr;
unsigned int status;
- /* save control registers */
- imx_port_ucrs_save(port, &old_ucr);
-
- /* disable interrupts */
- writel(UCR1_UARTEN, port->membase + UCR1);
- writel(old_ucr.ucr2 & ~(UCR2_ATEN | UCR2_RTSEN | UCR2_ESCI),
- port->membase + UCR2);
- writel(old_ucr.ucr3 & ~(UCR3_DCD | UCR3_RI | UCR3_DTREN),
- port->membase + UCR3);
-
/* drain */
do {
- status = readl(port->membase + USR1);
+ status = readl_relaxed(port->membase + USR1);
} while (~status & USR1_TRDY);
/* write */
- writel(c, port->membase + URTX0);
+ writel_relaxed(c, port->membase + URTX0);
/* flush */
do {
- status = readl(port->membase + USR2);
+ status = readl_relaxed(port->membase + USR2);
} while (~status & USR2_TXDC);
-
- /* restore control registers */
- imx_port_ucrs_restore(port, &old_ucr);
}
#endif