From patchwork Mon Sep 19 14:22:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9339555 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 650986077A for ; Mon, 19 Sep 2016 14:23:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568712928D for ; Mon, 19 Sep 2016 14:23:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B739292E7; Mon, 19 Sep 2016 14:23:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 553E42928D for ; Mon, 19 Sep 2016 14:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750701AbcISOXA (ORCPT ); Mon, 19 Sep 2016 10:23:00 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:44693 "EHLO xavier.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750717AbcISOWt (ORCPT ); Mon, 19 Sep 2016 10:22:49 -0400 Received: from ayla.of.borg ([84.193.137.253]) by xavier.telenet-ops.be with bizsmtp id lSNn1t00u5UCtCs01SNnp0; Mon, 19 Sep 2016 16:22:47 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1blzT5-0003QI-Nf; Mon, 19 Sep 2016 16:22:47 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1blzTA-0006Rh-Gb; Mon, 19 Sep 2016 16:22:52 +0200 From: Geert Uytterhoeven To: Sergei Shtylyov Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC] ARM: shmobile: rcar-gen2: Add support for RZ/G CPG/MSSR bindings Date: Mon, 19 Sep 2016 16:22:50 +0200 Message-Id: <1474294970-24744-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;