• Martin Kaiser's avatar
    serial: imx: fix endless loop during suspend · 09df0b34
    Martin Kaiser authored
    Before we go into suspend mode, we enable the imx uart's interrupt for
    the awake bit in the UART Status Register 1. If, for some reason, the
    awake bit is already set before we enter suspend mode, we get an
    interrupt immediately when we enable interrupts for awake. The uart's
    clk_ipg is disabled at this point (unless there's an ongoing transfer).
    We end up in the interrupt handler, which usually tries to clear the
    awake bit. This doesn't work with the clock disabled. Therefore, we
    keep getting interrupts forever, resulting in an endless loop.
    
    Clear the awake bit before setting the awaken bit to signal that we want
    an imx interrupt when the awake bit will be set. This ensures that we're
    not woken up by events that happened before we started going into
    suspend mode.
    
    Change the clock handling so that suspend prepares and enables the clock
    and suspend_noirq disables it. Revert these operations in resume_noirq and
    resume.
    
    With these preparations in place, we can now modify awake and awaken in
    the suspend function when the actual imx interrupt is disabled and the
    required clk_ipg is active.
    
    Update the thaw and freeze functions to use the new clock handling since
    we share the suspend_noirq function between suspend and hibernate.
    Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    09df0b34
imx.c 62.1 KB