• Thomas Petazzoni's avatar
    bus: mvebu-mbus: make sure SDRAM CS for DMA don't overlap the MBus bridge window · 1737cac6
    Thomas Petazzoni authored
    The mvebu-mbus driver reads the SDRAM window registers, and make the
    information about the DRAM CS configuration available to device
    drivers using the mv_mbus_dram_info() API. This information is used by
    the DMA-capable device drivers to program their address decoding
    windows.
    
    Until now, we were basically providing the SDRAM window register
    details as is. However, it turns out that the DMA capability of the
    CESA cryptographic engine consists in doing DMA being the DRAM and the
    crypto SRAM mapped as a MBus window. For this case, it is very
    important that the SDRAM CS information does not overlap with the MBus
    bridge window.
    
    Therefore, this commit improves the mvebu-mbus driver to make sure we
    adjust the SDRAM CS information so that it doesn't overlap with the
    MBus bridge window. This problem was reported by Boris Brezillon,
    while working on the mv_cesa driver for Armada 37x/38x/XP. We use the
    memblock memory information to know where the usable RAM is located,
    as this information is guaranteed to be correct on all SoC variants.
    
    We could have used the MBus bridge window registers on Armada 370/XP,
    but they are not really used on Armada 375/38x (Cortex-A9 based),
    since the PL310 L2 filtering is used instead to discriminate between
    RAM accesses and I/O accesses. Therefore, using the memblock
    information is more generic and works accross the different platforms.
    Reported-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
    Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
    [Andrew Lunn <andrew@lunn.ch>: Fixed merge conflict]
    Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
    1737cac6
mvebu-mbus.c 33.6 KB