]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
serial: altera: ensure port->regshift is honored consistently
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 25 Jan 2018 13:30:43 +0000 (14:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Feb 2018 12:30:09 +0000 (13:30 +0100)
Most register accesses in the altera driver honor port->regshift by
using altera_uart_writel(). There are a few accesses however that were
missed when the driver was converted to use port->regshift and some
others were added later in commit 4d9d7d896d77 ("serial: altera_uart:
add earlycon support").

Fixes: 2780ad42f5fe ("tty: serial: altera_uart: Use port->regshift to store bus shift")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/altera_uart.c

index b88b05f8e81e25c15cc9507697ff602cb1272630..ae30398fcf5659ae5d2509506fa125e16473e935 100644 (file)
@@ -327,7 +327,7 @@ static int altera_uart_startup(struct uart_port *port)
 
        /* Enable RX interrupts now */
        pp->imr = ALTERA_UART_CONTROL_RRDY_MSK;
-       writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+       altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 
        spin_unlock_irqrestore(&port->lock, flags);
 
@@ -343,7 +343,7 @@ static void altera_uart_shutdown(struct uart_port *port)
 
        /* Disable all interrupts now */
        pp->imr = 0;
-       writel(pp->imr, port->membase + ALTERA_UART_CONTROL_REG);
+       altera_uart_writel(port, pp->imr, ALTERA_UART_CONTROL_REG);
 
        spin_unlock_irqrestore(&port->lock, flags);
 
@@ -432,7 +432,7 @@ static void altera_uart_console_putc(struct uart_port *port, int c)
                 ALTERA_UART_STATUS_TRDY_MSK))
                cpu_relax();
 
-       writel(c, port->membase + ALTERA_UART_TXDATA_REG);
+       altera_uart_writel(port, c, ALTERA_UART_TXDATA_REG);
 }
 
 static void altera_uart_console_write(struct console *co, const char *s,
@@ -502,13 +502,13 @@ static int __init altera_uart_earlycon_setup(struct earlycon_device *dev,
                return -ENODEV;
 
        /* Enable RX interrupts now */
-       writel(ALTERA_UART_CONTROL_RRDY_MSK,
-              port->membase + ALTERA_UART_CONTROL_REG);
+       altera_uart_writel(port, ALTERA_UART_CONTROL_RRDY_MSK,
+                          ALTERA_UART_CONTROL_REG);
 
        if (dev->baud) {
                unsigned int baudclk = port->uartclk / dev->baud;
 
-               writel(baudclk, port->membase + ALTERA_UART_DIVISOR_REG);
+               altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG);
        }
 
        dev->con->write = altera_uart_earlycon_write;