Skip to content

Commit c1f9dfd

Browse files
RtkFPcaiyi_zhong
authored andcommitted
drivers: serial: add support for NS16550 RTS5817 variant
For Realtek RTS5817, RCVR fifo trigger needs to be set to 1 Signed-off-by: Darcy Lu <darcy_lu@realsil.com.cn>
1 parent 010d3fa commit c1f9dfd

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

drivers/serial/Kconfig.ns16550

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ config UART_NS16550_TI_K3
7676
Texas Instruments K3 SoCs by enabling a vendor specific extended register
7777
set.
7878

79+
config UART_NS16550_REALTEK_RTS5817
80+
bool "Add support for NS16550 variant specific to Realtek RTS5817 SoC"
81+
select PINCTRL
82+
help
83+
Enabling this configuration to fix rx fifo bug of UART port in
84+
Realtek RTS5817 SoC by setting the rcvr trigger to 1.
85+
7986
config UART_NS16550_DW8250_DW_APB
8087
bool "Synopsys DesignWare 8250"
8188
help

drivers/serial/uart_ns16550.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,11 @@ static int uart_ns16550_configure(const struct device *dev,
696696

697697
ns16550_outbyte(dev_cfg, MDC(dev), mdc);
698698

699+
#ifdef CONFIG_UART_NS16550_REALTEK_RTS5817
700+
/* For RTS5817 SOC, rcvr fifo trigger needs to be set to 1 */
701+
ns16550_outbyte(dev_cfg, FCR(dev),
702+
FCR_FIFO | FCR_MODE0 | FCR_FIFO_1 | FCR_RCVRCLR | FCR_XMITCLR);
703+
#else
699704
/*
700705
* Program FIFO: enabled, mode 0 (set for compatibility with quark),
701706
* generate the interrupt at 8th byte
@@ -707,6 +712,7 @@ static int uart_ns16550_configure(const struct device *dev,
707712
| FCR_FIFO_64
708713
#endif
709714
);
715+
#endif
710716

711717
if ((ns16550_inbyte(dev_cfg, IIR(dev)) & IIR_FE) == IIR_FE) {
712718
#ifdef CONFIG_UART_NS16550_VARIANT_NS16750

soc/realtek/fingerprint/rts5817/Kconfig.defconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,14 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
99
config NUM_IRQS
1010
default 32
1111

12+
if SERIAL
13+
14+
config UART_NS16550
15+
default y
16+
17+
config UART_NS16550_REALTEK_RTS5817
18+
default y
19+
20+
endif # SERIAL
21+
1222
endif # SOC_SERIES_RTS5817

0 commit comments

Comments
 (0)