drivers/uart/sifive.c: Fix divisor calculation
The divisor is calculated using the following formula: div = (frequency / baudrate) - 1; The current implementation however essentially calculates: div = (frequency / baudrate); Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: I8a0898ce9016a70c0f91dc8a99fc1cf9e46d20c4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79951 Reviewed-by: ron minnich <rminnich@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
parent
2d26e9bdce
commit
a2eca49d83
@ -47,9 +47,16 @@ static void sifive_uart_init(struct sifive_uart_registers *regs, int div)
|
|||||||
|
|
||||||
void uart_init(unsigned int idx)
|
void uart_init(unsigned int idx)
|
||||||
{
|
{
|
||||||
unsigned int div;
|
/*
|
||||||
div = uart_baudrate_divisor(get_uart_baudrate(),
|
* according to FU540/FU740 manual:
|
||||||
uart_platform_refclk(), uart_input_clock_divider());
|
* f_baud = f_in / (div + 1)
|
||||||
|
* <=>
|
||||||
|
* div = (f_in / f_baud) - 1
|
||||||
|
*/
|
||||||
|
unsigned int div = uart_baudrate_divisor(get_uart_baudrate(), uart_platform_refclk(),
|
||||||
|
uart_input_clock_divider());
|
||||||
|
div -= 1;
|
||||||
|
|
||||||
sifive_uart_init(uart_platform_baseptr(idx), div);
|
sifive_uart_init(uart_platform_baseptr(idx), div);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user