• Stephan Gerhold's avatar
    spi: qup: Request DMA before enabling clocks · 0c331fd1
    Stephan Gerhold authored
    It is usually better to request all necessary resources (clocks,
    regulators, ...) before starting to make use of them. That way they do
    not change state in case one of the resources is not available yet and
    probe deferral (-EPROBE_DEFER) is necessary. This is particularly
    important for DMA channels and IOMMUs which are not enforced by
    fw_devlink yet (unless you use fw_devlink.strict=1).
    
    spi-qup does this in the wrong order, the clocks are enabled and
    disabled again when the DMA channels are not available yet.
    
    This causes issues in some cases: On most SoCs one of the SPI QUP
    clocks is shared with the UART controller. When using earlycon UART is
    actively used during boot but might not have probed yet, usually for
    the same reason (waiting for the DMA controller). In this case, the
    brief enable/disable cycle ends up gating the clock and further UART
    console output will halt the system completely.
    
    Avoid this by requesting the DMA channels before changing the clock
    state.
    
    Fixes: 612762e8 ("spi: qup: Add DMA capabilities")
    Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
    Link: https://lore.kernel.org/r/20230518-spi-qup-clk-defer-v1-1-f49fc9ca4e02@gerhold.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    0c331fd1
spi-qup.c 33.7 KB