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 clk: bcm: dvp: Select the reset framework 2020-09-10 00:53:38 -07:00
Makefile clk: bcm: Add BCM2711 DVP driver 2020-06-19 17:13:53 -07:00
clk-bcm63xx-gate.c clk: bcm63xx-gate: switch to dt-bindings definitions 2020-06-19 17:03:24 -07:00
clk-bcm63xx.c
clk-bcm281xx.c
clk-bcm2711-dvp.c clk: bcm: dvp: Add MODULE_DEVICE_TABLE() 2020-12-19 11:48:29 -08:00
clk-bcm2835-aux.c clk: bcm2835: use devm_platform_ioremap_resource() to simplify code 2019-10-16 16:16:50 -07:00
clk-bcm2835.c clk: bcm2835: Round UART input clock up 2022-10-26 12:35:52 +02:00
clk-bcm21664.c
clk-bcm53573-ilp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
clk-cygnus.c clk: iproc: Allow iproc pll to runtime calculate vco parameters 2017-12-28 14:53:33 -08:00
clk-hr2.c clk: bcm: Add Broadcom Hurricane 2 clock support 2017-10-12 11:31:46 -07:00
clk-iproc-armpll.c clk: bcm: iproc: Migrate to clk_hw based registration and OF APIs 2016-06-30 12:26:45 -07:00
clk-iproc-asiu.c clk: iproc: round clock rate to the closest 2020-07-24 01:54:18 -07:00
clk-iproc-pll.c clk: iproc: Do not rely on node name for correct PLL setup 2022-10-05 10:39:44 +02:00
clk-iproc.h clk: iproc: Allow iproc pll to runtime calculate vco parameters 2017-12-28 14:53:33 -08:00
clk-kona-setup.c clk: Convert to using %pOFn instead of device_node.name 2018-08-30 09:50:20 -07:00
clk-kona.c clk: Remove io.h from clk-provider.h 2019-05-15 13:21:37 -07:00
clk-kona.h clk: bcm: kona: Migrate to clk_hw based registration and OF APIs 2016-08-24 16:06:18 -07:00
clk-ns2.c clk: ns2: Correct SDIO bits 2017-04-19 09:50:39 -07:00
clk-nsp.c
clk-raspberrypi.c clk: bcm: rpi: Add missing newline 2022-09-08 12:28:05 +02:00
clk-sr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 459 2019-06-19 17:09:09 +02:00