All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] ARM: shmobile: rcar-gen2: Add support for RZ/G CPG/MSSR bindings
@ 2016-09-19 14:22 Geert Uytterhoeven
  0 siblings, 0 replies; only message in thread
From: Geert Uytterhoeven @ 2016-09-19 14:22 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-renesas-soc, Geert Uytterhoeven

When using the new CPG/MSSR bindings, there's no longer a
"renesas,rcar-gen2-cpg-clocks" node.  Add support for finding the
external clock crystal oscillator on RZ/G1M and RZ/G1E through a
"renesas,r8a774x-cpg-mssr" node.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
	Hi Sergei,

As I had this patch more or less ready (using r8a779[0-5] instead of
r8a774[35] though), and you're gonna need it as a prerequisite for the
r8a7743 CPG/MSSR driver, I'm sending it now.

 arch/arm/mach-shmobile/setup-rcar-gen2.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index b527258e0a62e806..e216f3f83d26ecbb 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -46,17 +46,27 @@ u32 rcar_gen2_read_mode_pins(void)
 	return mode;
 }
 
+static const struct of_device_id cpg_matches[] __initconst = {
+	{ .compatible = "renesas,rcar-gen2-cpg-clocks", },
+	{ .compatible = "renesas,r8a7743-cpg-mssr", .data = "extal" },
+	{ .compatible = "renesas,r8a7745-cpg-mssr", .data = "extal" },
+	{ /* sentinel */ }
+};
+
 static unsigned int __init get_extal_freq(void)
 {
+	const struct of_device_id *match;
 	struct device_node *cpg, *extal;
 	u32 freq = 20000000;
+	int idx = 0;
 
-	cpg = of_find_compatible_node(NULL, NULL,
-				      "renesas,rcar-gen2-cpg-clocks");
+	cpg = of_find_matching_node_and_match(NULL, cpg_matches, &match);
 	if (!cpg)
 		return freq;
 
-	extal = of_parse_phandle(cpg, "clocks", 0);
+	if (match->data)
+		idx = of_property_match_string(cpg, "clock-names", match->data);
+	extal = of_parse_phandle(cpg, "clocks", idx);
 	of_node_put(cpg);
 	if (!extal)
 		return freq;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-19 14:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 14:22 [PATCH/RFC] ARM: shmobile: rcar-gen2: Add support for RZ/G CPG/MSSR bindings Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.