Skip to content

Commit

Permalink
serial: altera: ensure port->regshift is honored consistently
Browse files Browse the repository at this point in the history
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 4d9d7d8 ("serial: altera_uart:
add earlycon support").

Fixes: 2780ad4 ("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>
  • Loading branch information
Uwe Kleine-König authored and Greg Kroah-Hartman committed Feb 28, 2018
1 parent f54450a commit 0e25496
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/tty/serial/altera_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0e25496

Please sign in to comment.