From patchwork Mon Nov 12 22:15:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 12816 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id EA52D4C1772 for ; Mon, 12 Nov 2012 22:15:41 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 91654A187A5 for ; Mon, 12 Nov 2012 22:15:41 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so9440485iej.11 for ; Mon, 12 Nov 2012 14:15:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:in-reply-to:message-id:references:user-agent :mime-version:content-type:x-gm-message-state; bh=EcSH6SRUP3FBEo2hQ6c5qgjG+fPM1WfAuDG/dgl4r6Q=; b=IgRL9aeiaxiZ4nCNLYPJKU1tFdw+BDVIQuHTz6kz3UrHFI+muTG1oWY6GxDsWZp8i0 W44SLjw+SSWch390b8sn7xHPbJUjng2wR8GI0oQdQcMcrdCJKMpSJnwX2eilVMCgQ1ou defhPgbkdfpC3hjoqn91HtBU+HXjTa8ItCseGveMAQjX7XJkonlnjknP0gkExchiuzvP FZSUuo4JLifazy5TP9wcBtDMZ67yOZt5Y3B2SJ9hXsv+aFMmCQchXvVtQkwDOhIVOeq3 DlliEcNVPtZ/lhzIDapcfMs4wUD594EY2v7Gq62sbvSBYuDU7GjdD5yAglL+fA+Bh0th sg6g== Received: by 10.50.173.34 with SMTP id bh2mr9215240igc.70.1352758541341; Mon, 12 Nov 2012 14:15:41 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp430897igt; Mon, 12 Nov 2012 14:15:41 -0800 (PST) Received: by 10.50.6.169 with SMTP id c9mr9387736iga.24.1352758540997; Mon, 12 Nov 2012 14:15:40 -0800 (PST) Received: from utopia.booyaka.com (utopia.booyaka.com. [74.50.51.50]) by mx.google.com with ESMTPS id gf2si7618838igb.49.2012.11.12.14.15.40 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Nov 2012 14:15:40 -0800 (PST) Received-SPF: neutral (google.com: 74.50.51.50 is neither permitted nor denied by best guess record for domain of paul@pwsan.com) client-ip=74.50.51.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.50.51.50 is neither permitted nor denied by best guess record for domain of paul@pwsan.com) smtp.mail=paul@pwsan.com Received: (qmail 1158 invoked by uid 1019); 12 Nov 2012 22:15:39 -0000 Date: Mon, 12 Nov 2012 22:15:39 +0000 (UTC) From: Paul Walmsley To: Mike Turquette cc: rnayak@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org Subject: Re: [PATCH 02/26] ARM: OMAP: hwmod: Fix up hwmod based clkdm accesses In-Reply-To: <1352337181-29427-3-git-send-email-mturquette@ti.com> Message-ID: References: <1352337181-29427-1-git-send-email-mturquette@ti.com> <1352337181-29427-3-git-send-email-mturquette@ti.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmt2mHb9DpAiPolHJKDiCI65uG9XNH3MkgdBxNic7SqnlXTa8IDw0REwFn//c+Isju7/n8C This patch needed to be modified to avoid some sparse warnings; updated patch follows. - Paul ARM: OMAP: hwmod: Fix up hwmod based clkdm accesses From: Rajendra Nayak hwmod uses deferencing the clk pointer to acccess the clkdm. With COMMON clk hwoever this will need to be deferenced through the clk_hw_omap pointer, so do the necessary changes. Signed-off-by: Rajendra Nayak Signed-off-by: Mike Turquette Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/omap_hwmod.c | 70 ++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 139adca..f38e4ce 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -130,7 +130,11 @@ #include #include #include +#ifdef CONFIG_COMMON_CLK +#include +#else #include +#endif #include #include #include @@ -614,6 +618,23 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) return 0; } +static struct clockdomain *_get_clkdm(struct omap_hwmod *oh) +{ + if (oh->clkdm) { + return oh->clkdm; + } else if (oh->_clk) { +#ifdef CONFIG_COMMON_CLK + struct clk_hw_omap *clk; + + clk = to_clk_hw_omap(__clk_get_hw(oh->_clk)); + return clk->clkdm; +#else + return oh->_clk->clkdm; +#endif + } + return NULL; +} + /** * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active * @oh: struct omap_hwmod * @@ -629,13 +650,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) */ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) { - if (!oh->_clk) + struct clockdomain *clkdm, *init_clkdm; + + clkdm = _get_clkdm(oh); + init_clkdm = _get_clkdm(init_oh); + + if (!clkdm || !init_clkdm) return -EINVAL; - if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) + if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) return 0; - return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); + return clkdm_add_sleepdep(clkdm, init_clkdm); } /** @@ -653,13 +679,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) */ static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) { - if (!oh->_clk) + struct clockdomain *clkdm, *init_clkdm; + + clkdm = _get_clkdm(oh); + init_clkdm = _get_clkdm(init_oh); + + if (!clkdm || !init_clkdm) return -EINVAL; - if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) + if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS) return 0; - return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); + return clkdm_del_sleepdep(clkdm, init_clkdm); } /** @@ -693,7 +724,7 @@ static int _init_main_clk(struct omap_hwmod *oh) */ clk_prepare(oh->_clk); - if (!oh->_clk->clkdm) + if (!_get_clkdm(oh)) pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", oh->name, oh->main_clk); @@ -1276,6 +1307,7 @@ static void _enable_sysc(struct omap_hwmod *oh) u8 idlemode, sf; u32 v; bool clkdm_act; + struct clockdomain *clkdm; if (!oh->class->sysc) return; @@ -1283,11 +1315,9 @@ static void _enable_sysc(struct omap_hwmod *oh) v = oh->_sysc_cache; sf = oh->class->sysc->sysc_flags; + clkdm = _get_clkdm(oh); if (sf & SYSC_HAS_SIDLEMODE) { - clkdm_act = ((oh->clkdm && - oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) || - (oh->_clk && oh->_clk->clkdm && - oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU)); + clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU); if (clkdm_act && !(oh->class->sysc->idlemodes & (SIDLE_SMART | SIDLE_SMART_WKUP))) idlemode = HWMOD_IDLEMODE_FORCE; @@ -3556,10 +3586,17 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) { struct clk *c; struct omap_hwmod_ocp_if *oi; + struct clockdomain *clkdm; +#ifdef CONFIG_COMMON_CLK + struct clk_hw_omap *clk; +#endif if (!oh) return NULL; + if (oh->clkdm) + return oh->clkdm->pwrdm.ptr; + if (oh->_clk) { c = oh->_clk; } else { @@ -3569,11 +3606,16 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) c = oi->_clk; } - if (!c->clkdm) +#ifdef CONFIG_COMMON_CLK + clk = to_clk_hw_omap(__clk_get_hw(c)); + clkdm = clk->clkdm; +#else + clkdm = c->clkdm; +#endif + if (!clkdm) return NULL; - return c->clkdm->pwrdm.ptr; - + return clkdm->pwrdm.ptr; } /**