From patchwork Thu Nov 8 01:12:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 12720 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 7BC1E23E3D for ; Thu, 8 Nov 2012 01:13:30 +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 1466DA18BFE for ; Thu, 8 Nov 2012 01:13:29 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3284280iej.11 for ; Wed, 07 Nov 2012 17:13:29 -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:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:x-gm-message-state; bh=Rq0beNqoZ3DYD5lCWXmlHWMfGxl+CSDSPWkM4Wyh/Z4=; b=cPyGHjSZQORJsLWbI8HiSWoDO2OD5A1R/bzJ105GCe5Wn8Xx8CRegQ6AI/9sC6j84+ JAHF3S3G0LEOMtxLZWm4KEZn3PpNJzIlSFCWt44L9hTsCYshjqbU+pImaV+nudhSvKwS /u500wP4G4GwoGPbZXm+YG69ssE4s0Ne0aCjlgKxceEdDHFq6ZF001cQ74bAsQY2mque cj7ivbuO4nkQP7Z8RgffNIWgiIlN5WR/+jUkMzUVH0Mh7Q4dF/0bgLZCN6jak4dJGrnH SQBgd6QSekk1P3S+1PCbQwU5HmCuw/Zxg/lH3m3DNSW09wyDojFXWoBlLT5qioU/2Xxa VIUg== Received: by 10.50.161.169 with SMTP id xt9mr18189452igb.62.1352337209518; Wed, 07 Nov 2012 17:13:29 -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 n20csp304299igt; Wed, 7 Nov 2012 17:13:29 -0800 (PST) Received: by 10.60.171.10 with SMTP id aq10mr3558251oec.131.1352337208860; Wed, 07 Nov 2012 17:13:28 -0800 (PST) Received: from bear.ext.ti.com (bear.ext.ti.com. [192.94.94.41]) by mx.google.com with ESMTPS id g3si22942896obb.48.2012.11.07.17.13.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 07 Nov 2012 17:13:28 -0800 (PST) Received-SPF: pass (google.com: domain of mturquette@ti.com designates 192.94.94.41 as permitted sender) client-ip=192.94.94.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mturquette@ti.com designates 192.94.94.41 as permitted sender) smtp.mail=mturquette@ti.com Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id qA81DS2d023975; Wed, 7 Nov 2012 19:13:28 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA81DR4i003694; Wed, 7 Nov 2012 19:13:28 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Wed, 7 Nov 2012 19:13:27 -0600 Received: from nucleus.nsc.com (nucleus.nsc.com [10.188.36.112]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id qA81DPLS015450; Wed, 7 Nov 2012 19:13:27 -0600 From: Mike Turquette To: CC: , , , , Mike Turquette Subject: [PATCH 02/26] ARM: OMAP: hwmod: Fix up hwmod based clkdm accesses Date: Wed, 7 Nov 2012 17:12:37 -0800 Message-ID: <1352337181-29427-3-git-send-email-mturquette@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352337181-29427-1-git-send-email-mturquette@ti.com> References: <1352337181-29427-1-git-send-email-mturquette@ti.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmRDcGVKwIYpIAxCFRyYIVMoXitoZ/3W1D9nqsgE0n46lYTW5HD/2V23WO/Okq/DSXRGWMz 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 --- 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 37eeb45..1754d7e 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 @@ -617,6 +621,23 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) return 0; } +struct clockdomain *_get_clkdm(struct omap_hwmod *oh) +{ + struct clk_hw_omap *clk; + + if (oh->clkdm) { + return oh->clkdm; + } else if (oh->_clk) { +#ifdef CONFIG_COMMON_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 * @@ -632,13 +653,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); } /** @@ -656,13 +682,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); } /** @@ -696,7 +727,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); @@ -1279,6 +1310,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; @@ -1286,11 +1318,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; @@ -3558,10 +3588,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 { @@ -3571,11 +3608,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; } /**