[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200224021029.142701-2-adelva@google.com>
Date: Sun, 23 Feb 2020 18:10:28 -0800
From: Alistair Delva <adelva@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: Kenny Root <kroot@...gle.com>,
"Oliver O'Halloran" <oohall@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Ira Weiny <ira.weiny@...el.com>, devicetree@...r.kernel.org,
linux-nvdimm@...ts.01.org, kernel-team@...roid.com
Subject: [PATCH v3 2/3] libnvdimm/of_pmem: handle memory-region in DT
From: Kenny Root <kroot@...gle.com>
Add support for parsing the 'memory-region' DT property in addition to
the 'reg' DT property. This enables use cases where the pmem region is
not in I/O address space or dedicated memory (e.g. a bootloader
carveout).
Signed-off-by: Kenny Root <kroot@...gle.com>
Signed-off-by: Alistair Delva <adelva@...gle.com>
Reviewed-by: "Oliver O'Halloran" <oohall@...il.com>
Cc: Rob Herring <robh+dt@...nel.org>
Cc: Dan Williams <dan.j.williams@...el.com>
Cc: Vishal Verma <vishal.l.verma@...el.com>
Cc: Dave Jiang <dave.jiang@...el.com>
Cc: Ira Weiny <ira.weiny@...el.com>
Cc: devicetree@...r.kernel.org
Cc: linux-nvdimm@...ts.01.org
Cc: kernel-team@...roid.com
---
[v3: adelva: remove duplicate "From:"]
drivers/nvdimm/of_pmem.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
index fdf54494e8c9..cff47cc5fc4a 100644
--- a/drivers/nvdimm/of_pmem.c
+++ b/drivers/nvdimm/of_pmem.c
@@ -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;
}
--
2.25.0.265.gbab2e86ba0-goog
Powered by blists - more mailing lists