Hi Wolfram, On Wed, May 13, 2020 at 7:31 PM Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote: > The SDHI driver en-/disabled clocks on its own during probe() and > remove(). This basically killed all potential RPM power savings. Now, we > just enable the clocks for a short time when we access registers in > probe(). We otherwise leave all handling to RPM. That means, we need to > shift the RPM enabling code in the TMIO core a bit up, so we can access > registers there, too. > > clk_summary before: > sd0 1 1 0 12480000 0 0 50000 > sdif0 2 2 0 12480000 0 0 50000 > > clk_summary after: > sd0 1 1 0 12480000 0 0 50000 > sdif0 1 1 0 12480000 0 0 50000 > > Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> > --- > > Tested on a Salvator-XS board with R-Car M3-N. While this seems to have no ill effects on R-Car Gen3, RZ/A1, and RZ/A2, it does on R-Car Gen2, which prints before probing: sh_mobile_sdhi ee100000.sd: Unbalanced pm_runtime_enable! And on SH-Mobile AG5, R-Mobile A1, and R-Mobile APE6: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 5 at drivers/clk/clk.c:954 clk_core_disable+0x6c/0x2b0 sdhi1 already disabled CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.7.0-rc5-ape6evm-00536-ga65e619d428aff9a-dirty #186 Hardware name: Generic R8A73A4 (Flattened Device Tree) Workqueue: pm pm_runtime_work [<c00169e8>] (unwind_backtrace) from [<c001345c>] (show_stack+0x10/0x14) [<c001345c>] (show_stack) from [<c04b6e34>] (dump_stack+0x88/0xa8) [<c04b6e34>] (dump_stack) from [<c00270b8>] (__warn+0xd0/0xec) [<c00270b8>] (__warn) from [<c0027144>] (warn_slowpath_fmt+0x70/0x9c) [<c0027144>] (warn_slowpath_fmt) from [<c029d53c>] (clk_core_disable+0x6c/0x2b0) [<c029d53c>] (clk_core_disable) from [<c029d798>] (clk_core_disable_lock+0x18/0x24) [<c029d798>] (clk_core_disable_lock) from [<c02fa670>] (pm_clk_suspend+0x64/0x78) [<c02fa670>] (pm_clk_suspend) from [<c02f8918>] (genpd_runtime_suspend+0x110/0x1bc) [<c02f8918>] (genpd_runtime_suspend) from [<c02f01b4>] (__rpm_callback+0x30/0xe0) [<c02f01b4>] (__rpm_callback) from [<c02f02d4>] (rpm_callback+0x70/0x80) [<c02f02d4>] (rpm_callback) from [<c02f0e28>] (rpm_suspend+0x330/0x4a0) [<c02f0e28>] (rpm_suspend) from [<c02f1240>] (pm_runtime_work+0x74/0x8c) [<c02f1240>] (pm_runtime_work) from [<c00402f4>] (process_one_work+0x2cc/0x4ac) [<c00402f4>] (process_one_work) from [<c0040730>] (worker_thread+0x230/0x2f0) [<c0040730>] (worker_thread) from [<c0045b9c>] (kthread+0x12c/0x13c) [<c0045b9c>] (kthread) from [<c0009148>] (ret_from_fork+0x14/0x2c) Exception stack(0xef0cdfb0 to 0xef0cdff8) dfa0: 00000000 00000000 00000000 00000000 dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace c1cca51c99a6297a ]--- and later: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 12 at drivers/clk/clk.c:1014 clk_core_enable+0x6c/0x2bc Enabling unprepared sdhi1 CPU: 0 PID: 12 Comm: kworker/0:1 Tainted: G W 5.7.0-rc5-ape6evm-00536-ga65e619d428aff9a-dirty #186 Hardware name: Generic R8A73A4 (Flattened Device Tree) Workqueue: events_freezable mmc_rescan [<c00169e8>] (unwind_backtrace) from [<c001345c>] (show_stack+0x10/0x14) [<c001345c>] (show_stack) from [<c04b6e34>] (dump_stack+0x88/0xa8) [<c04b6e34>] (dump_stack) from [<c00270b8>] (__warn+0xd0/0xec) [<c00270b8>] (__warn) from [<c0027144>] (warn_slowpath_fmt+0x70/0x9c) [<c0027144>] (warn_slowpath_fmt) from [<c029d810>] (clk_core_enable+0x6c/0x2bc) [<c029d810>] (clk_core_enable) from [<c029da78>] (clk_core_enable_lock+0x18/0x2c) [<c029da78>] (clk_core_enable_lock) from [<c02fa6ec>] (pm_clk_resume+0x68/0xa0) [<c02fa6ec>] (pm_clk_resume) from [<c02f8dd0>] (genpd_runtime_resume+0xc8/0x170) [<c02f8dd0>] (genpd_runtime_resume) from [<c02f01b4>] (__rpm_callback+0x30/0xe0) [<c02f01b4>] (__rpm_callback) from [<c02f02d4>] (rpm_callback+0x70/0x80) [<c02f02d4>] (rpm_callback) from [<c02f0a50>] (rpm_resume+0x44c/0x4f4) [<c02f0a50>] (rpm_resume) from [<c02f00f0>] (__pm_runtime_resume+0x64/0x80) [<c02f00f0>] (__pm_runtime_resume) from [<c0342480>] (__mmc_claim_host+0x1c8/0x218) [<c0342480>] (__mmc_claim_host) from [<c03437f0>] (mmc_rescan+0xfc/0x260) [<c03437f0>] (mmc_rescan) from [<c00402f4>] (process_one_work+0x2cc/0x4ac) [<c00402f4>] (process_one_work) from [<c0040730>] (worker_thread+0x230/0x2f0) [<c0040730>] (worker_thread) from [<c0045b9c>] (kthread+0x12c/0x13c) [<c0045b9c>] (kthread) from [<c0009148>] (ret_from_fork+0x14/0x2c) Exception stack(0xef0f1fb0 to 0xef0f1ff8) 1fa0: 00000000 00000000 00000000 00000000 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace c1cca51c99a6297b ]--- sh_mobile_sdhi ee120000.sd: __pm_clk_enable: failed to enable clk (ptrval), error -108 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds