diff --git a/drivers/serial/Kconfig.ns16550 b/drivers/serial/Kconfig.ns16550 index 9cd88d08a1..a46c52b62f 100644 --- a/drivers/serial/Kconfig.ns16550 +++ b/drivers/serial/Kconfig.ns16550 @@ -32,6 +32,15 @@ config UART_NS16750 help This enables support for 64-bytes FIFO if UART controller is 16750. +config UART_NS16550_ACCESS_WORD_ONLY + bool "NS16550 only allows word access" + default n + depends on UART_NS16550 + help + In some case, e.g. ARC HS Development kit, the peripheral space of ns + 16550 (DesignWare UART) only allows word access, byte access will raise + exception. + # ---------- Port 0 ---------- menuconfig UART_NS16550_PORT_0 diff --git a/drivers/serial/uart_ns16550.c b/drivers/serial/uart_ns16550.c index 575c3399fd..2cc1114640 100644 --- a/drivers/serial/uart_ns16550.c +++ b/drivers/serial/uart_ns16550.c @@ -241,6 +241,13 @@ BUILD_ASSERT_MSG(IS_ENABLED(CONFIG_PCIE), "NS16550(s) in DT need CONFIG_PCIE"); #endif #endif /* UART_NS16550_ACCESS_IOPORT */ +#ifdef CONFIG_UART_NS16550_ACCESS_WORD_ONLY +#undef INBYTE +#define INBYTE(x) INWORD(x) +#undef OUTBYTE +#define OUTBYTE(x, d) OUTWORD(x, d) +#endif + struct uart_ns16550_device_config { u32_t sys_clk_freq;