@@ -401,7 +401,6 @@ static void dw_pcie_writel_atu(struct dw_pcie *pci, u32 dir, u32 index,
int ret;
base = dw_pcie_select_atu(pci, dir, index);
-
if (pci->ops && pci->ops->write_dbi) {
pci->ops->write_dbi(pci, base, reg, 4, val);
return;
@@ -735,10 +734,13 @@ static void dw_pcie_link_set_max_speed(struct dw_pcie *pci, u32 link_gen)
void dw_pcie_iatu_detect(struct dw_pcie *pci)
{
int max_region, ob, ib;
- u32 val, min, dir;
+ u32 val, min, dir, ret, num_region_maskbits;
u64 max;
+ struct device *dev = pci->dev;
+ struct device_node *np = dev->of_node;
val = dw_pcie_readl_dbi(pci, PCIE_ATU_VIEWPORT);
+
if (val == 0xFFFFFFFF) {
dw_pcie_cap_set(pci, IATU_UNROLL);
@@ -781,7 +783,12 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci)
dw_pcie_writel_atu(pci, dir, 0, PCIE_ATU_UPPER_LIMIT, 0xFFFFFFFF);
max = dw_pcie_readl_atu(pci, dir, 0, PCIE_ATU_UPPER_LIMIT);
} else {
- max = 0;
+ /* Allow dts override of region limit for older IP with above 32-bit support: */
+ ret = of_property_read_u32(np, "num-regionmask", &num_region_maskbits);
+ if (!ret && num_region_maskbits > 32)
+ max = GENMASK(num_region_maskbits - 33, 0);
+ else
+ max = 0;
}
pci->num_ob_windows = ob;