Skip to content

Commit 791412d

Browse files
paulburtonamalon
authored andcommitted
MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base()
Reading mips_cpc_base value from the DT allows each platform to define it according to its needs. This is especially convenient for MIPS_GENERIC kernel where this kind of information should be determined in runtime. Use mti,mips-cpc compatible string with just a reg property to specify the register location for your platform. Signed-off-by: Paul Burton <[email protected]> Signed-off-by: Miodrag Dinic <[email protected]> Signed-off-by: Aleksandar Markovic <[email protected]> Cc: [email protected] Cc: Ralf Baechle <[email protected]> Patchwork: https://patchwork.linux-mips.org/patch/18513/ Signed-off-by: James Hogan <[email protected]>
1 parent aece34c commit 791412d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

arch/mips/kernel/mips-cpc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include <linux/errno.h>
1212
#include <linux/percpu.h>
13+
#include <linux/of.h>
14+
#include <linux/of_address.h>
1315
#include <linux/spinlock.h>
1416

1517
#include <asm/mips-cps.h>
@@ -22,6 +24,17 @@ static DEFINE_PER_CPU_ALIGNED(unsigned long, cpc_core_lock_flags);
2224

2325
phys_addr_t __weak mips_cpc_default_phys_base(void)
2426
{
27+
struct device_node *cpc_node;
28+
struct resource res;
29+
int err;
30+
31+
cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
32+
if (cpc_node) {
33+
err = of_address_to_resource(cpc_node, 0, &res);
34+
if (!err)
35+
return res.start;
36+
}
37+
2538
return 0;
2639
}
2740

0 commit comments

Comments
 (0)