• Sergio Paracuellos's avatar
    staging: mt7621-pci: avoid to re-disable clock for those pcies not in use · c7b65650
    Sergio Paracuellos authored
    Clock driver for this SoC is using some gates to properly enabling
    and disabling the access to peripherals. Those gates that are not
    in use are properly being automatically disabled by the kernel.
    Pcie driver is explicitly doing a 'clk_disable_unprepare' call for
    gates of those pcies that are not used. Since kernel has already
    disabled them, the following warnings appear:
    
    WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:952 clk_core_disable+0xe4/0x100
    pcie2 already disabled
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0 #0
    Stack : 81661680 80082d00 807c0000 00000004 00000000
            80a20000 80860000 80792380
            814503d4 80862e83 00000000 1431b70 81454360
            00000000 00000000 80792380
            81431a08 ffffefff fffffea 00000000 81431a14
            0000007b 80868820 ffffffff
            80792380 1431c70 803d7a24 00000009 807f3a74
            00000001 815df810 00000018 0000000 80a20000
    ...
    Call Trace:
    [<80007ed8>] show_stack+0x28/0xf0
    [<80381e40>] dump_stack_lvl+0x60/0x80
    [<8002cf90>] __warn+0xcc/0x140
    [<8002d090>] warn_slowpath_fmt+0x8c/0xac
    [<803d7a24>] clk_core_disable+0xe4/0x100
    [<803da468>] clk_disable+0x38/0x58
    [<804cb730>] mt7621_pci_probe+0x980/0xa50
    [<8041e624>] platform_probe+0x50/0xbc
    [<8041bfe4>] really_probe.part.0+0xa8/0x340
    [<8041c3dc>] driver_probe_device+0x4c/0x154
    [<8041cb88>] __driver_attach+0xb4/0x1b4
    [<80419a38>] bus_for_each_dev+0x68/0xa4
    [<8041b1e8>] bus_add_driver+0x134/0x214
    [<8041d3bc>] driver_register+0x98/0x154
    [<80001648>] do_one_initcall+0x50/0x1a8
    [<808ea1fc>] kernel_init_freeable+0x270/0x30c
    [<806dd9dc>] kernel_init+0x20/0x110
    [<80002d98>] ret_from_kernel_thread+0x14/0x1c
    
    WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:810 clk_core_unprepare+0xf4/0x194
    pcie2 already unprepared
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W 5.14.0 #0
    Stack : 81661680 80082d00 807c0000 00000004 00000000
            00000000 81431bc4 80a20000
            80860000 80792380 814503d4 80862e83 00000000
            00000001 81431b70 81454360
            00000000 00000000 80792380 81431a08 ffffefff
            00000000 ffffffea 00000000
            81431a14 0000009b 80868820 ffffffff 80792380
            00000001 81431c70 803d7764
            00000009 807f3a74 00000001 815df810 00000018
            8040b36c 00000000 80a20000
    ...
    Call Trace:
    [<80007ed8>] show_stack+0x28/0xf0
    [<80381e40>] dump_stack_lvl+0x60/0x80
    [<8002cf90>] __warn+0xcc/0x140
    [<8002d090>] warn_slowpath_fmt+0x8c/0xac
    [<803d7764>] clk_core_unprepare+0xf4/0x194
    [<803d97c4>] clk_unprepare+0x30/0x48
    [<804cb738>] mt7621_pci_probe+0x988/0xa50
    [<8041e624>] platform_probe+0x50/0xbc
    [<8041bfe4>] really_probe.part.0+0xa8/0x340
    [<8041c3dc>] driver_probe_device+0x4c/0x154
    [<8041cb88>] __driver_attach+0xb4/0x1b4
    [<80419a38>] bus_for_each_dev+0x68/0xa4
    [<8041b1e8>] bus_add_driver+0x134/0x214
    [<8041d3bc>] driver_register+0x98/0x154
    [<80001648>] do_one_initcall+0x50/0x1a8
    [<808ea1fc>] kernel_init_freeable+0x270/0x30c
    [<806dd9dc>] kernel_init+0x20/0x110
    [<80002d98>] ret_from_kernel_thread+0x14/0x1c
    
    Avoid to explicitly disable already disabled pcie gates
    fixes the problem.
    
    Fixes: cc4e864a ("staging: mt7621-pci: make use of kernel clock apis")
    Reported-by: default avatarDENG Qingfang <dqfext@gmail.com>
    Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
    Link: https://lore.kernel.org/r/20210727054058.10612-1-sergio.paracuellos@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c7b65650
pci-mt7621.c 13.9 KB