Skip to content
  • This contributor prefers not to receive mails's avatar
    arm: a37xx: pci: Fix a3700_fdt_fix_pcie_regions() function · 4a82fca8
    This contributor prefers not to receive mails authored and Stefan Roese's avatar Stefan Roese committed
    Current version of this function uses a lot of incorrect assumptions about
    the `ranges` DT property:
    
     * parent(#address-cells) == 2
     * #size-cells == 2
     * number of entries == 2
     * address size of first entry == 0x1000000
     * second child address entry == base + 0x1000000
    
    Trying to increase PCIe MEM space to more than 16 MiB leads to an overlap
    with PCIe IO space, and trying to define additional MEM space (as a third
    entry in the `ranges` DT property) causes U-Boot to crash when booting the
    kernel.
    
      ## Flattened Device Tree blob at 04f00000
         Booting using the fdt blob at 0x4f00000
         Loading Device Tree to 000000001fb01000, end 000000001fb08f12 ... OK
      ERROR: board-specific fdt fixup failed: <unknown error>
       - must RESET the board to recover.
    
    Fix a3700_fdt_fix_pcie_regions() to properly parse and update all addresses
    in the `ranges` property according to
    https://elinux.org/Device_Tree_Usage#PCI_Address_Translation
    
    
    
    Now it is possible to increase PCIe MEM space from 16 MiB to maximal value
    of 127 MiB.
    
    Signed-off-by: default avatarPali Rohár <pali@kernel.org>
    Reviewed-by: default avatarMarek Behún <marek.behun@nic.cz>
    Fixes: cb2ddb29
    
     ("arm64: mvebu: a37xx: add device-tree fixer for PCIe regions")
    Reviewed-by: default avatarStefan Roese <sr@denx.de>
    4a82fca8