linux-stable/drivers/clk/meson
Dmitry Rokosov 6e2acbfe59 clk: meson: change usleep_range() to udelay() for atomic context
The function meson_clk_pll_enable() can be invoked under the enable_lock
spinlock from the clk core logic, which risks a kernel panic during the
usleep_range() call:

   BUG: scheduling while atomic: kworker/u4:2/36/0x00000002
   Modules linked in: g_ffs usb_f_fs libcomposite
   CPU: 1 PID: 36 Comm: kworker/u4:2 Not tainted 6.4.0-rc5 #273
   Workqueue: events_unbound async_run_entry_fn
   Call trace:
    dump_backtrace+0x9c/0x128
    show_stack+0x20/0x38
    dump_stack_lvl+0x48/0x60
    dump_stack+0x18/0x28
    __schedule_bug+0x58/0x78
    __schedule+0x828/0xa88
    schedule+0x64/0xd8
    schedule_hrtimeout_range_clock+0xd0/0x208
    schedule_hrtimeout_range+0x1c/0x30
    usleep_range_state+0x6c/0xa8
    meson_clk_pll_enable+0x1f4/0x310
    clk_core_enable+0x78/0x200
    clk_core_enable+0x58/0x200
    clk_core_enable+0x58/0x200
    clk_core_enable+0x58/0x200
    clk_enable+0x34/0x60

So it is required to use the udelay() function instead of usleep_range()
for the atomic context safety.

Fixes: b6ec400aa1 ("clk: meson: introduce new pll power-on sequence for A1 SoC family")
Reported-by: Jan Dakinevich <yvdakinevich@sberdevices.ru>
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Link: https://lore.kernel.org/r/20230704215404.11533-1-ddrokosov@sberdevices.ru
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
2023-07-11 11:35:42 +02:00
..
a1-peripherals.c clk: meson: a1: Staticize rtc clk 2023-06-12 14:29:24 -07:00
a1-peripherals.h clk: meson: a1: add Amlogic A1 Peripherals clock controller driver 2023-05-30 17:53:09 +02:00
a1-pll.c clk: meson: a1: add Amlogic A1 PLL clock controller driver 2023-05-30 17:53:05 +02:00
a1-pll.h clk: meson: a1: add Amlogic A1 PLL clock controller driver 2023-05-30 17:53:05 +02:00
axg-aoclk.c clk: meson: enable building as modules 2020-11-23 09:08:23 +01:00
axg-aoclk.h clk: meson: axg-ao: add 32k generation subtree 2019-01-07 15:21:43 +01:00
axg-audio.c clk: meson: axg-audio: Don't duplicate devm_clk_get_enabled() 2022-06-15 19:22:29 -07:00
axg-audio.h clk: meson: axg_audio: add sm1 support 2019-10-08 09:29:23 +02:00
axg.c clk: meson: axg: Remove MIPI enable clock gate 2021-02-09 13:32:59 +01:00
axg.h clk: meson: axg: Remove MIPI enable clock gate 2021-02-09 13:32:59 +01:00
clk-cpu-dyndiv.c clk: meson: clk-cpu-dyndiv: switch from .round_rate to .determine_rate 2023-01-13 15:14:12 +01:00
clk-cpu-dyndiv.h clk: meson: add g12a cpu dynamic divider driver 2019-08-09 12:10:03 +02:00
clk-dualdiv.c clk: meson: dualdiv: switch from .round_rate to .determine_rate 2023-01-13 15:14:12 +01:00
clk-dualdiv.h clk: meson: rework and clean drivers dependencies 2019-02-02 17:43:32 +01:00
clk-mpll.c clk: meson: mpll: Switch from .round_rate to .determine_rate 2023-01-13 15:14:12 +01:00
clk-mpll.h clk: meson: mpll: add init callback and regs 2019-05-20 12:19:29 +02:00
clk-phase.c clk: meson: add sclk-ws driver 2020-08-17 15:58:02 +02:00
clk-phase.h clk: meson: add sclk-ws driver 2020-08-17 15:58:02 +02:00
clk-pll.c clk: meson: change usleep_range() to udelay() for atomic context 2023-07-11 11:35:42 +02:00
clk-pll.h clk: meson: introduce new pll power-on sequence for A1 SoC family 2023-05-30 17:53:00 +02:00
clk-regmap.c clk: meson: regmap: switch to determine_rate for the dividers 2021-06-30 11:37:02 -07:00
clk-regmap.h clk: define to_clk_regmap() as inline function 2020-10-28 16:34:44 -07:00
g12a-aoclk.c clk: meson: enable building as modules 2020-11-23 09:08:23 +01:00
g12a-aoclk.h dt-bindings: clock: g12a-aoclk: expose CLKID_AO_CTS_OSCIN 2019-04-01 10:45:11 +02:00
g12a.c clk: meson: g12a: Add missing NNA source clocks for g12b 2021-06-09 21:39:50 +02:00
g12a.h clk: meson: g12a: add MIPI DSI Host Pixel Clock 2020-11-26 15:25:20 +01:00
gxbb-aoclk.c clk: meson: enable building as modules 2020-11-23 09:08:23 +01:00
gxbb-aoclk.h clk: meson: gxbb-ao: replace cec-32k with the dual divider 2019-01-07 15:21:22 +01:00
gxbb.c clk: meson: gxbb: Fix the SDM_EN bit for MPLL0 on GXBB 2021-11-30 10:28:52 +01:00
gxbb.h clk: meson: gxbb: add the gxl internal dac gate 2020-02-13 17:26:04 +01:00
Kconfig clk: meson: a1: add Amlogic A1 Peripherals clock controller driver 2023-05-30 17:53:09 +02:00
Makefile clk: meson: a1: add Amlogic A1 Peripherals clock controller driver 2023-05-30 17:53:09 +02:00
meson8-ddr.c clk: meson: add a driver for the Meson8/8b/8m2 DDR clock controller 2019-12-11 14:06:29 +01:00
meson8b.c clk: meson: Hold reference returned by of_get_parent() 2022-08-19 14:29:00 -07:00
meson8b.h clk: meson: meson8b: Initialize the HDMI PLL registers 2021-09-23 11:46:37 +02:00
meson-aoclk.c clk: meson: Hold reference returned by of_get_parent() 2022-08-19 14:29:00 -07:00
meson-aoclk.h clk: meson: remove ao input bypass clocks 2019-07-29 12:42:48 +02:00
meson-eeclk.c clk: meson: Hold reference returned by of_get_parent() 2022-08-19 14:29:00 -07:00
meson-eeclk.h clk: meson: remove ee input bypass clocks 2019-07-29 12:42:49 +02:00
parm.h clk: meson: rework and clean drivers dependencies 2019-02-02 17:43:32 +01:00
sclk-div.c clk: meson: sclk-div: switch from .round_rate to .determine_rate 2023-01-13 15:14:12 +01:00
sclk-div.h clk: meson: rework and clean drivers dependencies 2019-02-02 17:43:32 +01:00
vid-pll-div.c clk: meson: vid-pll-div: remove warning and return 0 on invalid config 2019-03-29 09:41:30 +01:00
vid-pll-div.h clk: meson: rework and clean drivers dependencies 2019-02-02 17:43:32 +01:00