Skip to content

Commit 1da17d7

Browse files
ndreysgregkh
authored andcommitted
tty: serial: fsl_lpuart: Use appropriate lpuart32_* I/O funcs
When dealing with 32-bit variant of LPUART IP block appropriate I/O helpers have to be used to properly deal with endianness differences. Change all of the offending code to do that. Fixes: a5fa266 ("tty/serial/fsl_lpuart: Add CONSOLE_POLL support for lpuart32.") Signed-off-by: Andrey Smirnov <[email protected]> Cc: Stefan Agner <[email protected]> Cc: Bhuvanchandra DV <[email protected]> Cc: Chris Healy <[email protected]> Cc: Cory Tusar <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 76e3f2a commit 1da17d7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/tty/serial/fsl_lpuart.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -617,45 +617,45 @@ static int lpuart32_poll_init(struct uart_port *port)
617617
spin_lock_irqsave(&sport->port.lock, flags);
618618

619619
/* Disable Rx & Tx */
620-
writel(0, sport->port.membase + UARTCTRL);
620+
lpuart32_write(&sport->port, UARTCTRL, 0);
621621

622-
temp = readl(sport->port.membase + UARTFIFO);
622+
temp = lpuart32_read(&sport->port, UARTFIFO);
623623

624624
/* Enable Rx and Tx FIFO */
625-
writel(temp | UARTFIFO_RXFE | UARTFIFO_TXFE,
626-
sport->port.membase + UARTFIFO);
625+
lpuart32_write(&sport->port, UARTFIFO,
626+
temp | UARTFIFO_RXFE | UARTFIFO_TXFE);
627627

628628
/* flush Tx and Rx FIFO */
629-
writel(UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH,
630-
sport->port.membase + UARTFIFO);
629+
lpuart32_write(&sport->port, UARTFIFO,
630+
UARTFIFO_TXFLUSH | UARTFIFO_RXFLUSH);
631631

632632
/* explicitly clear RDRF */
633-
if (readl(sport->port.membase + UARTSTAT) & UARTSTAT_RDRF) {
634-
readl(sport->port.membase + UARTDATA);
635-
writel(UARTFIFO_RXUF, sport->port.membase + UARTFIFO);
633+
if (lpuart32_read(&sport->port, UARTSTAT) & UARTSTAT_RDRF) {
634+
lpuart32_read(&sport->port, UARTDATA);
635+
lpuart32_write(&sport->port, UARTFIFO, UARTFIFO_RXUF);
636636
}
637637

638638
/* Enable Rx and Tx */
639-
writel(UARTCTRL_RE | UARTCTRL_TE, sport->port.membase + UARTCTRL);
639+
lpuart32_write(&sport->port, UARTCTRL, UARTCTRL_RE | UARTCTRL_TE);
640640
spin_unlock_irqrestore(&sport->port.lock, flags);
641641

642642
return 0;
643643
}
644644

645645
static void lpuart32_poll_put_char(struct uart_port *port, unsigned char c)
646646
{
647-
while (!(readl(port->membase + UARTSTAT) & UARTSTAT_TDRE))
647+
while (!(lpuart32_read(port, UARTSTAT) & UARTSTAT_TDRE))
648648
barrier();
649649

650-
writel(c, port->membase + UARTDATA);
650+
lpuart32_write(port, UARTDATA, c);
651651
}
652652

653653
static int lpuart32_poll_get_char(struct uart_port *port)
654654
{
655-
if (!(readl(port->membase + UARTSTAT) & UARTSTAT_RDRF))
655+
if (!(lpuart32_read(port, UARTSTAT) & UARTSTAT_RDRF))
656656
return NO_POLL_CHAR;
657657

658-
return readl(port->membase + UARTDATA);
658+
return lpuart32_read(port, UARTDATA);
659659
}
660660
#endif
661661

0 commit comments

Comments
 (0)