@@ -49,11 +49,12 @@ static void of_pmem_register_region(struct platform_device *pdev,
static int of_pmem_region_probe(struct platform_device *pdev)
{
+ struct device_node *mr_np, *np;
struct of_pmem_private *priv;
- struct device_node *np;
struct nvdimm_bus *bus;
+ struct resource res;
bool is_volatile;
- int i;
+ int i, ret;
np = dev_of_node(&pdev->dev);
if (!np)
@@ -83,6 +84,21 @@ static int of_pmem_region_probe(struct platform_device *pdev)
is_volatile);
}
+ i = 0;
+ while ((mr_np = of_parse_phandle(np, "memory-region", i++))) {
+ ret = of_address_to_resource(mr_np, 0, &res);
+ if (ret) {
+ dev_warn(
+ &pdev->dev,
+ "Unable to acquire memory-region from %pOF: %d\n",
+ mr_np, ret);
+ } else {
+ of_pmem_register_region(pdev, bus, np, &res,
+ is_volatile);
+ }
+ of_node_put(mr_np);
+ }
+
return 0;
}