linux-stable/drivers/clk/bcm
Ivan T. Ivanov 83b011da26 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-21 12:39:26 +02:00
..
Kconfig clk: bcm: bcmbca: Replace ARCH_BCM_63XX with ARCH_BCMBCA 2022-07-10 19:11:16 -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 treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-bcm281xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
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-21 12:39:26 +02:00
clk-bcm21664.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-bcm53573-ilp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
clk-cygnus.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-hr2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-iproc-armpll.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-iproc-asiu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-iproc-pll.c clk: iproc: Do not rely on node name for correct PLL setup 2022-09-28 18:33:08 -07:00
clk-iproc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-kona-setup.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-kona.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-kona.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-ns2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-nsp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
clk-raspberrypi.c clk: bcm: rpi: Show clock id limit in error case 2022-08-23 15:51:18 -07:00
clk-sr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 459 2019-06-19 17:09:09 +02:00