Skip to content

Commit

Permalink
drivers: serial8250_uart: use 32-bit accesses to the uart registers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
JosephChen2017 committed Jul 7, 2017
1 parent e4c86a0 commit e847d4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/drivers/serial8250_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}

static void serial8250_uart_putc(struct serial_chip *chip, int ch)
Expand All @@ -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 = {
Expand Down

0 comments on commit e847d4f

Please sign in to comment.