Skip to content

Commit 4fb8bf6

Browse files
Wayne Renioannisg
authored andcommitted
drivers: ns16550: add WORD only access support
In some hardware,e.g. ARC HS Development kit,the peripheral space of ns16550 only allowes WORD access, byte acess will raise bus error. This commit adds support for this case Signed-off-by: Wayne Ren <[email protected]>
1 parent 5a0acd5 commit 4fb8bf6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/serial/Kconfig.ns16550

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ config UART_NS16750
3232
help
3333
This enables support for 64-bytes FIFO if UART controller is 16750.
3434

35+
config UART_NS16550_ACCESS_WORD_ONLY
36+
bool "NS16550 only allows word access"
37+
default n
38+
depends on UART_NS16550
39+
help
40+
In some case, e.g. ARC HS Development kit, the peripheral space of ns
41+
16550 (DesignWare UART) only allows word access, byte access will raise
42+
exception.
43+
3544
# ---------- Port 0 ----------
3645

3746
menuconfig UART_NS16550_PORT_0

drivers/serial/uart_ns16550.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ BUILD_ASSERT_MSG(IS_ENABLED(CONFIG_PCIE), "NS16550(s) in DT need CONFIG_PCIE");
241241
#endif
242242
#endif /* UART_NS16550_ACCESS_IOPORT */
243243

244+
#ifdef CONFIG_UART_NS16550_ACCESS_WORD_ONLY
245+
#undef INBYTE
246+
#define INBYTE(x) INWORD(x)
247+
#undef OUTBYTE
248+
#define OUTBYTE(x, d) OUTWORD(x, d)
249+
#endif
250+
244251

245252
struct uart_ns16550_device_config {
246253
u32_t sys_clk_freq;

0 commit comments

Comments
 (0)