From patchwork Tue Apr 26 01:28:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 8933971 Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0C003BF4C7 for ; Tue, 26 Apr 2016 01:29:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D9D02011D for ; Tue, 26 Apr 2016 01:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8FC4720138 for ; Tue, 26 Apr 2016 01:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751704AbcDZB26 (ORCPT ); Mon, 25 Apr 2016 21:28:58 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:52474 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750874AbcDZB25 (ORCPT ); Mon, 25 Apr 2016 21:28:57 -0400 Received: from penelope.kanocho.kobe.vergenet.net (124-171-1-229.dyn.iinet.net.au [124.171.1.229]) by kirsty.vergenet.net (Postfix) with ESMTPSA id 3E7AC25BE72; Tue, 26 Apr 2016 11:28:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=verge.net.au; s=mail; t=1461634128; bh=J3u6QIPSo5jkdTxLF1j0phs+k24W6UQDOsz3gqj9/t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxVZQtUUJChiKsdoVsTpfdqelILx1rTB1KqiqZFmRmsofHLYoYVu4ftuZwUT8XtTU Oji+o0VfogYcQc2aLzAUvytJJjnHRHUG8TEHWvXuJBi7rQ+wo6cTihEnltwNbAP4N7 2ohv1pYqyyVI4Nm26dLrQwJ/Dh6uSCULie45iXqs= Received: by penelope.kanocho.kobe.vergenet.net (Postfix, from userid 7100) id 4C6C560923; Tue, 26 Apr 2016 11:28:47 +1000 (AEST) From: Simon Horman To: linux-renesas-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Magnus Damm , Stephen Boyd , Michael Turquette , Geert Uytterhoeven , Simon Horman Subject: [PATCH 05/11] soc: renesas: rcar-sysc: Enable Clock Domain for I/O devices Date: Tue, 26 Apr 2016 11:28:40 +1000 Message-Id: <1c8c77f52d1037c61468539e1d68c44f9e710536.1461632180.git.horms+renesas@verge.net.au> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: References: Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Geert Uytterhoeven On R-Car H3, some power areas (e.g. A3VP) contain I/O devices, which are also part of the CPG/MSSR Clock Domain. On all R-Car SoCs, devices in the "always-on" PM Domain are part of the Clock Domain served by the CPG/MSSR or CPG/MSTP driver. Hook up the CPG/MSTP or CPG/MSSR Clock Domain attach/detach callbacks to enable power management using module clocks. Which callback to hook up depends on the presence of device nodes compatible with "renesas,cpg-mstp-clocks". This clears the path for a future migration from the CPG/MSTP to the CPG/MSSR driver on R-Car H1 and Gen2. Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart Reviewed-by: Ulf Hansson Signed-off-by: Simon Horman --- drivers/soc/renesas/rcar-sysc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c index 4e760d63f2ab..0d49a25de740 100644 --- a/drivers/soc/renesas/rcar-sysc.c +++ b/drivers/soc/renesas/rcar-sysc.c @@ -9,6 +9,7 @@ * for more details. */ +#include #include #include #include @@ -217,6 +218,8 @@ static int rcar_sysc_pd_power_on(struct generic_pm_domain *genpd) return rcar_sysc_power_up(&pd->ch); } +static bool has_cpg_mstp; + static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd) { struct generic_pm_domain *genpd = &pd->genpd; @@ -248,6 +251,18 @@ static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd) gov = &pm_domain_always_on_gov; } + if (!(pd->flags & (PD_CPU | PD_SCU))) { + /* Enable Clock Domain for I/O devices */ + genpd->flags = GENPD_FLAG_PM_CLK; + if (has_cpg_mstp) { + genpd->attach_dev = cpg_mstp_attach_dev; + genpd->detach_dev = cpg_mstp_detach_dev; + } else { + genpd->attach_dev = cpg_mssr_attach_dev; + genpd->detach_dev = cpg_mssr_detach_dev; + } + } + genpd->power_off = rcar_sysc_pd_power_off; genpd->power_on = rcar_sysc_pd_power_on; @@ -294,6 +309,9 @@ static int __init rcar_sysc_pd_init(void) info = match->data; + has_cpg_mstp = of_find_compatible_node(NULL, NULL, + "renesas,cpg-mstp-clocks"); + base = of_iomap(np, 0); if (!base) { pr_warn("%s: Cannot map regs\n", np->full_name);