aboutsummaryrefslogtreecommitdiff
path: root/core/drivers/serial8250_uart.c
diff options
context:
space:
mode:
authorJoseph Chen <chenjh@rock-chips.com>2017-07-06 15:29:24 +0800
committerJérôme Forissier <jerome.forissier@linaro.org>2017-07-25 14:46:40 +0200
commit65d34b1fc22a1fb769639cb933f1339592c91d8f (patch)
treea62616c81d585b8ddca421a9f6e5a58c38591f61 /core/drivers/serial8250_uart.c
parent6dc18b3025fbd9d5d36fd0fefcbbeb3cb5fa3ac4 (diff)
drivers: serial8250_uart: use 32-bit accesses to the uart registers
Due to hardware design, some platforms can't access the peripheral IO registers once a byte(8-bit) but once a word(32-bit). Obviously, using 32-bit accesses to the registers is more flexible for other plaforms to use serial8250 uart. Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org> (serial8250_uart, TI-AM57xx)
Diffstat (limited to 'core/drivers/serial8250_uart.c')
-rw-r--r--core/drivers/serial8250_uart.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/drivers/serial8250_uart.c b/core/drivers/serial8250_uart.c
index 5e861581..f8054abb 100644
--- a/core/drivers/serial8250_uart.c
+++ b/core/drivers/serial8250_uart.c
@@ -63,7 +63,7 @@ static void serial8250_uart_flush(struct serial_chip *chip)
vaddr_t base = chip_to_base(chip);
while (1) {
- uint8_t state = read8(base + UART_LSR);
+ uint32_t state = read32(base + UART_LSR);
/* Wait until transmit FIFO is empty */
if ((state & LSR_EMPTY) == LSR_EMPTY)
@@ -86,7 +86,7 @@ static int serial8250_uart_getchar(struct serial_chip *chip)
/* Transmit FIFO is empty, waiting again */
;
}
- return read8(base + UART_RHR);
+ return read32(base + UART_RHR) & 0xff;
}
static void serial8250_uart_putc(struct serial_chip *chip, int ch)
@@ -96,7 +96,7 @@ static void serial8250_uart_putc(struct serial_chip *chip, int ch)
serial8250_uart_flush(chip);
/* Write out character to transmit FIFO */
- write8(ch, base + UART_THR);
+ write32(ch, base + UART_THR);
}
static const struct serial_ops serial8250_uart_ops = {