• F
    dmaengine: Add support for BCM2708 · 0e3babe3
    Florian Meier 提交于
    raspberrypi inclusion
    category: feature
    bugzilla: 50432
    
    --------------------------------
    
    Add support for DMA controller of BCM2708 as used in the Raspberry Pi.
    Currently it only supports cyclic DMA.
    Signed-off-by: NFlorian Meier <florian.meier@koalo.de>
    
    dmaengine: expand functionality by supporting scatter/gather transfers sdhci-bcm2708 and dma.c: fix for LITE channels
    
    DMA: fix cyclic LITE length overflow bug
    
    dmaengine: bcm2708: Remove chancnt affectations
    
    Mirror bcm2835-dma.c commit 9eba5536:
    chancnt is already filled by dma_async_device_register, which uses the channel
    list to know how much channels there is.
    
    Since it's already filled, we can safely remove it from the drivers' probe
    function.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: overwrite dreq only if it is not set
    
    dreq is set when the DMA channel is fetched from Device Tree.
    slave_id is set using dmaengine_slave_config().
    Only overwrite dreq with slave_id if it is not set.
    
    dreq/slave_id in the cyclic DMA case is not touched, because I don't
    have hardware to test with.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: do device registration in the board file
    
    Don't register the device in the driver. Do it in the board file.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: don't restrict DT support to ARCH_BCM2835
    
    Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now.
    Add Device Tree support to the non ARCH_BCM2835 case.
    Use the same driver name regardless of architecture.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    BCM270x_DT: add bcm2835-dma entry
    
    Add Device Tree entry for bcm2835-dma.
    The entry doesn't contain any resources since they are handled
    by the arch/arm/mach-bcm270x/dma.c driver.
    In non-DT mode, don't add the device in the board file.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    bcm2708-dmaengine: Add debug options
    
    BCM270x: Add memory and irq resources to dmaengine device and DT
    
    Prepare for merging of the legacy DMA API arch driver dma.c
    with bcm2708-dmaengine by adding memory and irq resources both
    to platform file device and Device Tree node.
    Don't use BCM_DMAMAN_DRIVER_NAME so we don't have to include mach/dma.h
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c
    
    Merge the legacy DMA API driver with bcm2708-dmaengine.
    This is done so we can use bcm2708_fb on ARCH_BCM2835 (mailbox
    driver is also needed).
    
    Changes to the dma.c code:
    - Use BIT() macro.
    - Cutdown some comments to one line.
    - Add mutex to vc_dmaman and use this, since the dev lock is locked
      during probing of the engine part.
    - Add global g_dmaman variable since drvdata is used by the engine part.
    - Restructure for readability:
      vc_dmaman_chan_alloc()
      vc_dmaman_chan_free()
      bcm_dma_chan_free()
    - Restructure bcm_dma_chan_alloc() to simplify error handling.
    - Use device irq resources instead of hardcoded bcm_dma_irqs table.
    - Remove dev_dmaman_register() and code it directly.
    - Remove dev_dmaman_deregister() and code it directly.
    - Simplify bcm_dmaman_probe() using devm_* functions.
    - Get dmachans from DT if available.
    - Keep 'dma.dmachans' module argument name for backwards compatibility.
    
    Make it available on ARCH_BCM2835 as well.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: set residue_granularity field
    
    bcm2708-dmaengine supports residue reporting at burst level
    but didn't report this via the residue_granularity field.
    
    Without this field set properly we get playback issues with I2S cards.
    
    dmaengine: bcm2708-dmaengine: Fix memory leak when stopping a running transfer
    
    bcm2708-dmaengine: Use more DMA channels (but not 12)
    
    1) Only the bcm2708_fb drivers uses the legacy DMA API, and
    it requires a BULK-capable channel, so all other types
    (FAST, NORMAL and LITE) can be made available to the regular
    DMA API.
    
    2) DMA channels 11-14 share an interrupt. The driver can't
    handle this, so don't use channels 12-14 (12 was used, probably
    because it appears to have an interrupt, but in reality that
    interrupt is for activity on ANY channel). This may explain
    a lockup encountered when running out of DMA channels.
    
    The combined effect of this patch is to leave 7 DMA channels
    available + channel 0 for bcm2708_fb via the legacy API.
    
    See: https://github.com/raspberrypi/linux/issues/1110
         https://github.com/raspberrypi/linux/issues/1108
    
    dmaengine: bcm2708: Make legacy API available for bcm2835-dma
    
    bcm2708_fb uses the legacy DMA API, so in order to start using
    bcm2835-dma, bcm2835-dma has to support the legacy API. Make this
    possible by exporting bcm_dmaman_probe() and bcm_dmaman_remove().
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: Change DT compatible string
    
    Both bcm2835-dma and bcm2708-dmaengine have the same compatible string.
    So change compatible to "brcm,bcm2708-dma".
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    dmaengine: bcm2708: Remove driver but keep legacy API
    
    Dropping non-DT support means we don't need this driver,
    but we still need the legacy DMA API.
    Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
    
    bcm2708-dmaengine - Fix arm64 portability/build issues
    
    dma-bcm2708: Fix module compilation of CONFIG_DMA_BCM2708
    
    bcm2708-dmaengine.c defines functions like bcm_dma_start which are
    defined as well in dma-bcm2708.h as inline versions when
    CONFIG_DMA_BCM2708 is not defined. This works fine when
    CONFIG_DMA_BCM2708 is built in, but when it is selected as module build
    fails with redefinition errors because in the build system when
    CONFIG_DMA_BCM2708 is selected as module, the macro becomes
    CONFIG_DMA_BCM2708_MODULE.
    
    This patch makes the header use CONFIG_DMA_BCM2708_MODULE too when
    available.
    
    Fixes https://github.com/raspberrypi/linux/issues/2056Signed-off-by: NAndrei Gherzan <andrei@gherzan.com>
    Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    0e3babe3
bcm2708-dmaengine.c 7.4 KB