drivers/apbuart: correct the baud formula

The formula of set_baud first function was not consistent with the get_baud
one.

Signed-off-by: Romain Mahoux <romain@mahoux.fr>
This commit is contained in:
Romain Mahoux 2022-11-01 09:09:22 +01:00 committed by Fabio Baltieri
parent e0082eded7
commit b096e092fa

View file

@ -225,7 +225,7 @@ static void set_baud(volatile struct apbuart_regs *const regs, uint32_t baud)
core_clk_hz = sys_clock_hw_cycles_per_sec();
/* Calculate Baud rate generator "scaler" number */
scaler = (((core_clk_hz * 10) / (baud * 8)) - 5) / 10;
scaler = (core_clk_hz / (baud * 8)) - 1;
/* Set new baud rate by setting scaler */
regs->scaler = scaler;