WSL2-Linux-Kernel/drivers/clk/bcm
Ivan T. Ivanov e81bf40b28 clk: bcm2835: Round UART input clock up
[ Upstream commit f690a4d7a8 ]

It was reported that RPi3[1] and RPi Zero 2W boards have issues with
the Bluetooth. It turns out that when switching from initial to
operation speed host and device no longer can talk each other because
host uses incorrect UART baud rate.

The UART driver used in this case is amba-pl011. Original fix, see
below Github link[2], was inside pl011 module, but somehow it didn't
look as the right place to fix. Beside that this original rounding
function is not exactly perfect for all possible clock values. So I
deiced to move the hack to the platform which actually need it.

The UART clock is initialised to be as close to the requested
frequency as possible without exceeding it. Now that there is a
clock manager that returns the actual frequencies, an expected
48MHz clock is reported as 47999625. If the requested baud rate
== requested clock/16, there is no headroom and the slight
reduction in actual clock rate results in failure.

If increasing a clock by less than 0.1% changes it from ..999..
to ..000.., round it up.

[1] https://bugzilla.suse.com/show_bug.cgi?id=1188238
[2] ab3f1b3953

Cc: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/20220912081306.24662-1-iivanov@suse.de
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-26 12:35:52 +02:00
..
Kconfig
Makefile
clk-bcm63xx-gate.c
clk-bcm63xx.c
clk-bcm281xx.c
clk-bcm2711-dvp.c
clk-bcm2835-aux.c
clk-bcm2835.c
clk-bcm21664.c
clk-bcm53573-ilp.c
clk-cygnus.c
clk-hr2.c
clk-iproc-armpll.c
clk-iproc-asiu.c
clk-iproc-pll.c
clk-iproc.h
clk-kona-setup.c
clk-kona.c
clk-kona.h
clk-ns2.c
clk-nsp.c
clk-raspberrypi.c
clk-sr.c