• Tony Lindgren's avatar
    serial: 8250: omap: Fix idling of clocks for unused uarts · 13dc04d0
    Tony Lindgren authored
    I noticed that unused UARTs won't necessarily idle properly always
    unless at least one byte tx transfer is done first.
    
    After some debugging I narrowed down the problem to the scr register
    dma configuration bits that need to be set before softreset for the
    clocks to idle. Unless we do this, the module clkctrl idlest bits
    may be set to 1 instead of 3 meaning the clock will never idle and
    is blocking deeper idle states for the whole domain.
    
    This might be related to the configuration done by the bootloader
    or kexec booting where certain configurations cause the 8250 or
    the clkctrl clock to jam in a way where setting of the scr bits
    and reset is needed to clear it. I've tried diffing the 8250
    registers for the various modes, but did not see anything specific.
    So far I've only seen this on omap4 but I'm suspecting this might
    also happen on the other clkctrl using SoCs considering they
    already have a quirk enabled for UART_ERRATA_CLOCK_DISABLE.
    
    Let's fix the issue by configuring scr before reset for basic dma
    even if we don't use it. The scr register will be reset when we do
    softreset few lines after, and we restore scr on resume. We should
    do this for all the SoCs with UART_ERRATA_CLOCK_DISABLE quirk flag
    set since the ones with UART_ERRATA_CLOCK_DISABLE are all based
    using clkctrl similar to omap4.
    
    Looks like both OMAP_UART_SCR_DMAMODE_1 | OMAP_UART_SCR_DMAMODE_CTL
    bits are needed for the clkctrl to idle after a softreset.
    
    And we need to add omap4 to also use the UART_ERRATA_CLOCK_DISABLE
    for the related workaround to be enabled. This same compatible
    value will also be used for omap5.
    
    Fixes: cdb929e4 ("serial: 8250_omap: workaround errata around idling UART after using DMA")
    Cc: Keerthy <j-keerthy@ti.com>
    Cc: Matthijs van Duin <matthijsvanduin@gmail.com>
    Cc: Sekhar Nori <nsekhar@ti.com>
    Cc: Tero Kristo <t-kristo@ti.com>
    Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    13dc04d0
8250_omap.c 39 KB