[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160826153725.11629-15-paul.burton@imgtec.com>
Date: Fri, 26 Aug 2016 16:37:13 +0100
From: Paul Burton <paul.burton@...tec.com>
To: <linux-mips@...ux-mips.org>, Ralf Baechle <ralf@...ux-mips.org>
CC: Paul Burton <paul.burton@...tec.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
<linux-kernel@...r.kernel.org>,
James Hogan <james.hogan@...tec.com>,
Anna-Maria Gleixner <anna-maria@...utronix.de>
Subject: [PATCH 14/26] MIPS: CDMM: Allow CDMM base address to be specified via DT
Allow systems to specify the base address for the CDMM using device
tree. This removes the need for it to be specified by platform specific
code, preparing for generic kernels which can run without any.
Signed-off-by: Paul Burton <paul.burton@...tec.com>
---
drivers/bus/mips_cdmm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c
index cad49bc..311ce54 100644
--- a/drivers/bus/mips_cdmm.c
+++ b/drivers/bus/mips_cdmm.c
@@ -13,6 +13,8 @@
#include <linux/cpu.h>
#include <linux/cpumask.h>
#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/smp.h>
@@ -340,6 +342,17 @@ static phys_addr_t mips_cdmm_cur_base(void)
*/
phys_addr_t __weak mips_cdmm_phys_base(void)
{
+ struct device_node *cdmm_node;
+ struct resource res;
+ int err;
+
+ cdmm_node = of_find_compatible_node(of_root, NULL, "mti,mips-cdmm");
+ if (cdmm_node) {
+ err = of_address_to_resource(cdmm_node, 0, &res);
+ if (!err)
+ return res.start;
+ }
+
return 0;
}
--
2.9.3
Powered by blists - more mailing lists