Skip to content

Commit b33e28d

Browse files
kartbendkalowsk
authored andcommitted
drivers: serial: bouffalolab: UART_INT_CLEAR is write-only
Fix incorrect read being made to "write 1 to clear" register UART_INT_CLEAR Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
1 parent 34f9cd9 commit b33e28d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/serial/uart_bflb.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,30 @@ static int uart_bflb_err_check(const struct device *dev)
9090
{
9191
const struct bflb_config *const cfg = dev->config;
9292
uint32_t status = BL_RD_REG(cfg->reg, UART_INT_STS);
93-
uint32_t tmp = BL_RD_REG(cfg->reg, UART_INT_CLEAR);
93+
uint32_t clear_mask = 0;
9494
int errors = 0;
9595

9696
if (status & BIT(UART_INT_RX_FER)) {
97-
tmp |= BIT(UART_INT_RX_FER);
97+
clear_mask |= BIT(UART_INT_RX_FER);
9898

9999
errors |= UART_ERROR_OVERRUN;
100100
}
101101

102102
if (status & BIT(UART_INT_TX_FER)) {
103-
tmp |= BIT(UART_INT_TX_FER);
103+
clear_mask |= BIT(UART_INT_TX_FER);
104104

105105
errors |= UART_ERROR_OVERRUN;
106106
}
107107

108108
if (status & BIT(UART_INT_PCE)) {
109-
tmp |= BIT(UART_INT_PCE);
109+
clear_mask |= BIT(UART_INT_PCE);
110110

111111
errors |= UART_ERROR_PARITY;
112112
}
113113

114-
BL_WR_REG(cfg->reg, UART_INT_CLEAR, tmp);
114+
if (clear_mask != 0) {
115+
BL_WR_REG(cfg->reg, UART_INT_CLEAR, clear_mask);
116+
}
115117

116118
return errors;
117119
}

0 commit comments

Comments
 (0)