linux-stable/drivers/clk
Ivan T. Ivanov d53d82a9c5 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-24 09:58:29 +02:00
..
actions clk: actions: remove redundant assignment after a mask operation 2022-04-22 19:01:20 -07:00
analogbits Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
at91 clk: at91: generated: consider range when calculating best rate 2022-05-17 12:41:07 -07:00
axis clk: cleanup comments 2022-03-11 18:22:15 -08:00
axs10x
baikal-t1 clk: baikal-t1: Add SATA internal ref clock buffer 2022-10-24 09:58:01 +02:00
bcm clk: bcm2835: Round UART input clock up 2022-10-24 09:58:29 +02:00
berlin clk: berlin: Add of_node_put() for of_get_parent() 2022-10-24 09:57:48 +02:00
davinci
hisilicon Merge branches 'clk-starfive', 'clk-ti', 'clk-terminate' and 'clk-cleanup' into clk-next 2022-03-29 10:19:10 -07:00
imgtec
imx clk: imx: scu: fix memleak on platform_device_add() fails 2022-10-24 09:58:01 +02:00
ingenic clk: ingenic-tcu: Properly enable registers before accessing timers 2022-10-05 10:40:43 +02:00
keystone clk: keystone: syscon-clk: Add support for AM62 epwm-tbclk 2022-04-22 19:04:47 -07:00
loongson1 clk: loongson1: Terminate clk_div_table with sentinel element 2022-03-11 18:13:24 -08:00
mediatek clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*() 2022-10-24 09:58:00 +02:00
meson clk: meson: Hold reference returned by of_get_parent() 2022-10-24 09:57:47 +02:00
microchip clk: microchip: mpfs: make the rtc's ahb clock critical 2022-10-05 10:40:49 +02:00
mmp Merge branches 'clk-starfive', 'clk-ti', 'clk-terminate' and 'clk-cleanup' into clk-next 2022-03-29 10:19:10 -07:00
mstar
mvebu clk: mvebu: use time_is_before_eq_jiffies() instead of open coding it 2022-02-17 14:06:12 -08:00
mxs
nxp clk: nxp: Declare mux table parameter as const u32 * 2022-02-25 16:41:39 -08:00
pistachio clk: pistachio: Declare mux table as const u32[] 2022-02-25 16:41:39 -08:00
pxa ARM: pxa: move clk register definitions to driver 2022-05-07 22:55:49 +02:00
qcom clk: qcom: gcc-sm6115: Override default Alpha PLL regs 2022-10-24 09:57:58 +02:00
ralink clk: ralink: make system controller node a reset provider 2022-02-15 17:06:37 +01:00
renesas clk: renesas: rzg2l: Fix reset status function 2022-08-17 15:15:00 +02:00
rockchip clk: rockchip: Mark hclk_vo as critical on rk3568 2022-05-03 11:16:48 +02:00
samsung clk: samsung: exynosautov9: correct register offsets of peric0/c1 2022-10-24 09:57:49 +02:00
sifive clk: sifive: Move all stuff into SoCs header files from C files 2022-03-15 15:56:28 -07:00
socfpga clk: cleanup comments 2022-03-11 18:22:15 -08:00
spear
sprd clk: sprd: Hold reference returned by of_get_parent() 2022-10-24 09:57:48 +02:00
st clk: st: Hold reference returned by of_get_parent() 2022-10-24 09:57:48 +02:00
starfive clk: starfive: Add JH7100 audio clock driver 2022-03-10 18:17:33 -08:00
stm32 clk: stm32: rcc_reset: Fix missing spin_lock_init() 2022-06-09 15:34:08 -07:00
sunxi clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource() 2022-04-25 19:50:53 +02:00
sunxi-ng clk: sunxi-ng: Fix H6 RTC clock definition 2022-07-27 16:45:58 -07:00
tegra clk: tegra20: Fix refcount leak in tegra20_clock_init 2022-10-24 09:57:48 +02:00
ti clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe 2022-10-24 09:58:01 +02:00
uniphier clk: uniphier: Fix fixed-rate initialization 2022-03-11 19:29:02 -08:00
ux500 clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base() 2022-05-18 13:34:03 -07:00
versatile clk: versatile: clk-icst: use after free on error path 2021-12-07 12:25:29 -08:00
visconti clk: visconti: prevent array overflow in visconti_clk_register_gates() 2022-03-17 12:21:28 -07:00
x86 clk: x86: Fix clk_gate_flags for RV_CLK_GATE 2022-01-06 17:57:53 -08:00
xilinx
zynq clk: zynq: Update the parameters to zynq_clk_register_periph_clk 2022-03-29 10:17:49 -07:00
zynqmp clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate 2022-10-24 09:58:23 +02:00
.kunitconfig clk: Introduce Kunit Tests for the framework 2022-03-11 19:14:38 -08:00
Kconfig Merge branches 'clk-rockchip', 'clk-ingenic', 'clk-bindings', 'clk-samsung' and 'clk-stm' into clk-next 2022-05-25 00:27:09 -07:00
Makefile Mainly driver updates this time around. There's a single patch to the core clk 2022-05-27 15:33:24 -07:00
clk-apple-nco.c clk: clk-apple-nco: Allow and fix module building 2022-03-15 09:56:12 -07:00
clk-asm9260.c
clk-aspeed.c
clk-aspeed.h
clk-ast2600.c clk: ast2600: BCLK comes from EPLL 2022-10-24 09:58:01 +02:00
clk-axi-clkgen.c
clk-axm5516.c
clk-bd718x7.c clk: bd718xx: Drop BD70528 support 2021-06-27 18:42:45 -07:00
clk-bm1880.c clk: bm1880: remove kfrees on static allocations 2022-01-06 17:46:56 -08:00
clk-bulk.c
clk-cdce706.c clk: cdce706: use simple i2c probe function 2022-04-22 19:28:06 -07:00
clk-cdce925.c clk: cdce925: use i2c_match_id and simple i2c probe 2022-04-22 19:28:07 -07:00
clk-clps711x.c clk: clps711x: Terminate clk_div_table with sentinel element 2022-03-11 18:13:24 -08:00
clk-composite.c clk: composite: Fix 'switching' to same clock 2021-11-03 17:49:54 -07:00
clk-conf.c
clk-cs2000-cp.c clk: cs2000-cp: use simple i2c probe function 2022-04-22 19:28:07 -07:00
clk-devres.c clk: fix leak on devm_clk_bulk_get_all() unwind 2021-07-31 00:53:38 -07:00
clk-divider.c clk: divider: Implement and wire up .determine_rate by default 2021-08-05 17:35:58 -07:00
clk-en7523.c clk: en7523: fix wrong pointer check in en7523_clk_probe() 2022-04-26 11:17:47 -07:00
clk-fixed-factor.c clk: fixed-factor: Introduce devm_clk_hw_register_fixed_factor_index() 2022-03-18 14:04:54 -07:00
clk-fixed-mmio.c
clk-fixed-rate.c clk: fixed-rate: Remove redundant if statement 2022-05-16 23:45:53 -07:00
clk-fractional-divider.c clk: cleanup comments 2022-03-11 18:22:15 -08:00
clk-fractional-divider.h clk: fractional-divider: Hide clk_fractional_divider_ops from wide audience 2021-08-12 12:42:00 -07:00
clk-fsl-flexspi.c
clk-fsl-sai.c
clk-gate.c clk: gate: Add devm_clk_hw_register_gate() 2021-12-08 11:19:20 +01:00
clk-gate_test.c clk: gate: Add some kunit test suites 2022-01-24 17:22:53 -08:00
clk-gemini.c clk: Gemini: fix struct name in kernel-doc 2021-12-02 17:27:48 -08:00
clk-gpio.c
clk-hi655x.c
clk-highbank.c
clk-hsdk-pll.c
clk-k210.c clk: k210: Fix k210_clk_set_parent() 2021-06-30 11:34:36 -07:00
clk-lan966x.c clk: lan966x: Fix the lan966x clock gate register address 2022-07-19 00:04:10 -07:00
clk-lmk04832.c spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
clk-lochnagar.c
clk-max9485.c clk: max9485: use simple i2c probe function 2022-04-22 19:28:08 -07:00
clk-max77686.c
clk-milbeaut.c
clk-moxart.c
clk-multiplier.c
clk-mux.c clk: mux: remove redundant initialization of variable width 2022-04-25 15:49:20 -07:00
clk-nomadik.c
clk-npcm7xx.c
clk-nspire.c
clk-oxnas.c clk: oxnas: Hold reference returned by of_get_parent() 2022-10-24 09:57:48 +02:00
clk-palmas.c clk: palmas: Add a missing SPDX license header 2021-08-05 17:34:30 -07:00
clk-plldig.c
clk-pwm.c
clk-qoriq.c clk: qoriq: Hold reference returned by of_get_parent() 2022-10-24 09:57:48 +02:00
clk-renesas-pcie.c clk: renesas-pcie: use simple i2c probe function 2022-04-22 19:28:09 -07:00
clk-rk808.c
clk-s2mps11.c
clk-scmi.c clk: scmi: Support atomic clock enable/disable API 2022-02-21 10:37:00 +00:00
clk-scpi.c
clk-si514.c clk: si514: use simple i2c probe function 2022-04-22 19:28:08 -07:00
clk-si544.c clk: si544: use i2c_match_id and simple i2c probe 2022-04-22 19:28:08 -07:00
clk-si570.c clk: si570: use i2c_match_id and simple i2c probe 2022-04-22 19:28:08 -07:00
clk-si5341.c clk: si5341: use simple i2c probe function 2022-04-22 19:28:08 -07:00
clk-si5351.c clk: si5351: use i2c_match_id and simple i2c probe 2022-04-22 19:28:08 -07:00
clk-si5351.h clk: si5351: Update datasheet references 2021-11-02 14:29:17 -07:00
clk-sparx5.c
clk-stm32f4.c clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after system enter shell 2021-12-15 22:45:48 -08:00
clk-stm32h7.c clk: stm32h7: Switch to clk_divider.determine_rate 2021-08-05 17:36:10 -07:00
clk-stm32mp1.c clk: stm32mp1: Add parent_data to ETHRX clock 2022-01-24 17:17:31 -08:00
clk-tps68470.c clk: Introduce clk-tps68470 driver 2021-12-15 20:12:07 -08:00
clk-twl6040.c
clk-versaclock5.c clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD 2022-10-24 09:58:00 +02:00
clk-vt8500.c
clk-wm831x.c
clk-xgene.c
clk.c clk: core: Fix runtime PM sequence in clk_core_unprepare() 2022-09-08 11:24:03 +02:00
clk.h
clk_test.c Revert "clk: Drop the rate range on clk_put()" 2022-04-02 19:28:53 -07:00
clkdev.c