• Kevin Hilman's avatar
    OMAP3: PM: UART: disable clocks when idle and off-mode support · 4af4016c
    Kevin Hilman authored
    This patch allows the UART clocks to be disabled when the OMAP UARTs
    are inactive, thus permitting the chip to hit retention in idle.
    After the expiration of an activity timer, each UART is allowed to
    disable its clocks so the system can enter retention.  The activity
    timer is (re)activated on any UART interrupt, UART wake event or any
    IO pad wakeup.  The actual disable of the UART clocks is done in the
    'prepare_idle' hook called from the OMAP idle loop.
    
    While the activity timer is active, the smart-idle mode of the UART is
    also disabled.  This is due to a "feature" of the UART module that
    after a UART wakeup, the smart-idle mode may be entered before the
    UART has communicated the interrupt, or upon TX, an idle mode may be
    entered before the TX FIFOs are emptied.
    
    Upon suspend, the 'prepare_suspend' hook cancels any pending activity
    timers and allows the clocks to be disabled immediately.
    
    In addition, upon disabling clocks the UART state is saved in case
    of an off-mode transition while clocks are off.
    
    Special thanks to Tero Kristo for the initial ideas and first versions
    of UART idle support, and to Jouni Hogander for extra testing and
    bugfixes.
    
    Tested on OMAP3 (Beagle, RX51, SDP, EVM) and OMAP2 (n810)
    
    Cc: Tero Kristo <tero.kristo@nokia.com>
    Cc: Jouni Hogander <jouni.hogander@nokia.com>
    Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
    4af4016c
serial.h 1.5 KB