PCI: cadence: Do not error if "cdns,max-outbound-regions" is not found
authorKishon Vijay Abraham I <kishon@ti.com>
Fri, 6 Nov 2020 15:11:07 +0000 (20:41 +0530)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fri, 20 Nov 2020 17:23:31 +0000 (17:23 +0000)
Now that "cdns,max-outbound-regions" is made an optional property, do
not error out if "cdns,max-outbound-regions" device tree property is
not found.

Link: http://lore.kernel.org/r/20201105165331.GA55814@bogus
Link: https://lore.kernel.org/r/20201106151107.3987-3-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
drivers/pci/controller/cadence/pcie-cadence-ep.c
drivers/pci/controller/cadence/pcie-cadence.h

index 84cc58d..9e2b024 100644 (file)
@@ -530,12 +530,9 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
        }
        pcie->mem_res = res;
 
-       ret = of_property_read_u32(np, "cdns,max-outbound-regions",
-                                  &ep->max_regions);
-       if (ret < 0) {
-               dev_err(dev, "missing \"cdns,max-outbound-regions\"\n");
-               return ret;
-       }
+       ep->max_regions = CDNS_PCIE_MAX_OB;
+       of_property_read_u32(np, "cdns,max-outbound-regions", &ep->max_regions);
+
        ep->ob_addr = devm_kcalloc(dev,
                                   ep->max_regions, sizeof(*ep->ob_addr),
                                   GFP_KERNEL);
index feed1e3..30eba6c 100644 (file)
@@ -197,6 +197,7 @@ enum cdns_pcie_rp_bar {
 };
 
 #define CDNS_PCIE_RP_MAX_IB    0x3
+#define CDNS_PCIE_MAX_OB       32
 
 struct cdns_pcie_rp_ib_bar {
        u64 size;