• Geert Uytterhoeven's avatar
    clk: renesas: cpg-mssr: Restore module clocks during resume · 56086910
    Geert Uytterhoeven authored
    During PSCI system suspend, R-Car Gen3 SoCs are powered down, and their
    clock register state is lost.  Note that as the boot loader skips most
    initialization after system resume, clock register state differs from
    the state encountered during normal system boot, too.
    
    Hence after s2ram, some operations may fail because module clocks are
    disabled, while drivers expect them to be still enabled.  E.g. EtherAVB
    fails when Wake-on-LAN has been enabled using "ethtool -s eth0 wol g":
    
        ravb e6800000.ethernet eth0: failed to switch device to config mode
        ravb e6800000.ethernet eth0: device will be stopped after h/w processes are done.
        ravb e6800000.ethernet eth0: failed to switch device to config
        PM: Device e6800000.ethernet failed to resume: error -110
    
    In addition, some module clocks that were disabled by
    clk_disable_unused() may have been re-enabled, wasting power.
    
    To fix this, restore all bits of the SMSTPCR registers that represent
    clocks under control of Linux.
    
    Notes:
      - While this fixes EtherAVB operation after resume from s2ram,
        EtherAVB cannot be used as an actual wake-up source from s2ram, only
        from s2idle, due to PSCI limitations,
      - To avoid overhead on platforms not needing it, the suspend/resume
        code has a build time dependency on sleep and PSCI support, and a
        runtime dependency on PSCI.
    Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Tested-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
    56086910
renesas-cpg-mssr.c 21.1 KB