• Stephan Gerhold's avatar
    dmaengine: qcom: bam_dma: Add "powered remotely" mode · 9502ffcd
    Stephan Gerhold authored
    In some configurations, the BAM DMA controller is set up by a remote
    processor and the local processor can simply start making use of it
    without setting up the BAM. This is already supported using the
    "qcom,controlled-remotely" property.
    
    However, for some reason another possible configuration is that the
    remote processor is responsible for powering up the BAM, but we are
    still responsible for initializing it (e.g. resetting it etc).
    
    This configuration is quite challenging to handle properly because
    the power control is handled through separate channels
    (e.g. device-specific SMSM interrupts / smem-states). Great care
    must be taken to ensure the BAM registers are not accessed while
    the BAM is powered off since this results in a bus stall.
    
    Attempt to support this configuration with minimal device-specific
    code in the bam_dma driver by tracking the number of requested
    channels. Consumers of DMA channels are responsible to only request
    DMA channels when the BAM was powered on by the remote processor,
    and to release them before the BAM is powered off.
    
    When the first channel is requested the BAM is initialized (reset)
    and it is also put into reset when the last channel was released.
    Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
    Reviewed-by: default avatarBhupesh Sharma <bhupesh.sharma@linaro.org>
    Link: https://lore.kernel.org/r/20211018102421.19848-3-stephan@gerhold.netSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    9502ffcd
bam_dma.c 40 KB