Skip to content

Commit

Permalink
MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
paulburton authored and amalon committed Feb 8, 2018
1 parent aece34c commit 791412d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/mips/kernel/mips-cpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <linux/errno.h>
#include <linux/percpu.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/spinlock.h>

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

phys_addr_t __weak mips_cpc_default_phys_base(void)
{
struct device_node *cpc_node;
struct resource res;
int err;

cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
if (cpc_node) {
err = of_address_to_resource(cpc_node, 0, &res);
if (!err)
return res.start;
}

return 0;
}

Expand Down

0 comments on commit 791412d

Please sign in to comment.