All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@ti.com>
To: paul@pwsan.com, mturquette@ti.com
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Rajendra Nayak <rnayak@ti.com>
Subject: [PATCH 11/29] ARM: omap: hwmod: Fix up hwmod based clkdm accesses
Date: Thu, 14 Jun 2012 18:17:00 +0530	[thread overview]
Message-ID: <1339678038-23082-12-git-send-email-rnayak@ti.com> (raw)
In-Reply-To: <1339678038-23082-1-git-send-email-rnayak@ti.com>

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 <rnayak@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   63 ++++++++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2ebcacf..014280b 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -130,7 +130,11 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/io.h>
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk-provider.h>
+#else
 #include <linux/clk.h>
+#endif
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/list.h>
@@ -539,6 +543,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 *
@@ -554,13 +575,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);
 }
 
 /**
@@ -578,13 +604,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);
 }
 
 /**
@@ -609,7 +640,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
 		return -EINVAL;
 	}
 
-	if (!oh->_clk->clkdm)
+	if (!_get_clkdm(oh))
 		pr_warning("omap_hwmod: %s: missing clockdomain for %s.\n",
 			   oh->name, oh->main_clk);
 
@@ -2982,10 +3013,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 {
@@ -2995,11 +3033,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;
 }
 
 /**
-- 
1.7.1


WARNING: multiple messages have this Message-ID (diff)
From: rnayak@ti.com (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/29] ARM: omap: hwmod: Fix up hwmod based clkdm accesses
Date: Thu, 14 Jun 2012 18:17:00 +0530	[thread overview]
Message-ID: <1339678038-23082-12-git-send-email-rnayak@ti.com> (raw)
In-Reply-To: <1339678038-23082-1-git-send-email-rnayak@ti.com>

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 <rnayak@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   63 ++++++++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2ebcacf..014280b 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -130,7 +130,11 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/io.h>
+#ifdef CONFIG_COMMON_CLK
+#include <linux/clk-provider.h>
+#else
 #include <linux/clk.h>
+#endif
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/list.h>
@@ -539,6 +543,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 *
@@ -554,13 +575,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);
 }
 
 /**
@@ -578,13 +604,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);
 }
 
 /**
@@ -609,7 +640,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
 		return -EINVAL;
 	}
 
-	if (!oh->_clk->clkdm)
+	if (!_get_clkdm(oh))
 		pr_warning("omap_hwmod: %s: missing clockdomain for %s.\n",
 			   oh->name, oh->main_clk);
 
@@ -2982,10 +3013,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 {
@@ -2995,11 +3033,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;
 }
 
 /**
-- 
1.7.1

  parent reply	other threads:[~2012-06-14 12:47 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 12:46 [PATCH 00/29] Move OMAP2+ over to use COMMON clock Rajendra Nayak
2012-06-14 12:46 ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 01/29] clk: Add support for rate table based dividers Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-18 20:04   ` Mike Turquette
2012-06-18 20:04     ` Mike Turquette
2012-06-19  5:22     ` Rajendra Nayak
2012-06-19  5:22       ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 02/29] clk: Add CLK_IS_BASIC flag to identify basic clocks Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-07-03 12:34   ` Rajendra Nayak
2012-07-03 12:34     ` Rajendra Nayak
2012-07-04  6:18     ` Turquette, Mike
2012-07-04  6:18       ` Turquette, Mike
2012-07-04  6:39       ` Rajendra Nayak
2012-07-04  6:39         ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 03/29] ARM: omap4: cm: add bitfield width values Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 04/29] ARM: omap: clk: use clk_prepare_enable and clk_disable_unprepare Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 19:11   ` Mike Turquette
2012-06-14 19:11     ` Mike Turquette
2012-06-15  4:56     ` Rajendra Nayak
2012-06-15  4:56       ` Rajendra Nayak
2012-06-20 11:41       ` Tony Lindgren
2012-06-20 11:41         ` Tony Lindgren
2012-06-21  5:36         ` Rajendra Nayak
2012-06-21  5:36           ` Rajendra Nayak
2012-06-21  5:43           ` Paul Walmsley
2012-06-21  5:43             ` Paul Walmsley
2012-06-21  5:49             ` Rajendra Nayak
2012-06-21  5:49               ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 05/29] mmc: omap_hsmmc: " Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 06/29] hwrng: omap: " Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 07/29] mfd: omap-usb: " Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-07-02 11:18   ` Samuel Ortiz
2012-07-02 11:18     ` Samuel Ortiz
2012-07-02 11:16     ` Rajendra Nayak
2012-07-02 11:16       ` Rajendra Nayak
2012-07-02 15:23       ` Samuel Ortiz
2012-07-02 15:23         ` Samuel Ortiz
2012-06-14 12:46 ` [PATCH 08/29] ARM: omap: hwmod: get rid of all omap_clk_get_by_name usage Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:46 ` [PATCH 09/29] ARM: omap: clk: Nuke plat/clock.c & reuse struct clk as clk_hw_omap Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-19  1:38   ` Mike Turquette
2012-06-19  1:38     ` Mike Turquette
2012-06-14 12:46 ` [PATCH 10/29] ARM: omap: clk: Remove all direct dereferncing of struct clk Rajendra Nayak
2012-06-14 12:46   ` Rajendra Nayak
2012-06-14 12:47 ` Rajendra Nayak [this message]
2012-06-14 12:47   ` [PATCH 11/29] ARM: omap: hwmod: Fix up hwmod based clkdm accesses Rajendra Nayak
2012-06-14 12:47 ` [PATCH 12/29] ARM: omap4: clk: Convert to common clk Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 13/29] ARM: omap3: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 14/29] ARM: omap2: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 15/29] ARM: omap: clk: list all clk_hw_omap clks to enable/disable autoidle Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 16/29] ARM: omap: clk: Define a function to enable clocks at init Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 17/29] ARM: omap: clock: Get rid of unwanted clkdm assocations within clks Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 18/29] ARM: omap4: clk: Add 44xx data using common struct clk Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 19/29] ARM: omap3: clk: Add 3xxx " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 20/29] ARM: omap2: clk: Add 24xx " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 21/29] ARM: omap: clk: Switch to COMMON clk Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 22/29] ARM: omap: clk: Use plat/clock.c only for OMAP1 Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 23/29] ARM: omap: hwmod: Cleanup !CONFIG_COMMON_CLK parts Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 24/29] ARM: omap4: clk: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 25/29] ARM: omap3: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 26/29] ARM: omap2: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 27/29] ARM: omap4: clk: Delete old OMAP clock data Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 28/29] ARM: omap3: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-14 12:47 ` [PATCH 29/29] ARM: omap2: " Rajendra Nayak
2012-06-14 12:47   ` Rajendra Nayak
2012-06-18  4:27 ` [PATCH 00/29] Move OMAP2+ over to use COMMON clock Paul Walmsley
2012-06-18  4:27   ` Paul Walmsley
2012-06-18 11:03   ` Rajendra Nayak
2012-06-18 11:03     ` Rajendra Nayak
2012-09-11  6:35 ` Paul Walmsley
2012-09-11  6:35   ` Paul Walmsley
2012-09-11  9:46   ` Vaibhav Hiremath
2012-09-11  9:46     ` Vaibhav Hiremath
2012-09-11 23:10     ` Paul Walmsley
2012-09-11 23:10       ` Paul Walmsley
2012-09-12  3:53       ` Hiremath, Vaibhav
2012-09-12  3:53         ` Hiremath, Vaibhav
2012-09-11 20:09   ` Paul Walmsley
2012-09-11 20:09     ` Paul Walmsley
2012-09-15  5:32   ` Paul Walmsley
2012-09-15  5:32     ` Paul Walmsley
2012-09-15  5:49     ` Paul Walmsley
2012-09-15  5:49       ` Paul Walmsley
2012-09-16 20:36   ` Paul Walmsley
2012-09-16 20:36     ` Paul Walmsley
2012-09-17 21:26     ` Tony Lindgren
2012-09-17 21:26       ` Tony Lindgren
2012-09-17 22:12       ` Paul Walmsley
2012-09-17 22:12         ` Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339678038-23082-12-git-send-email-rnayak@ti.com \
    --to=rnayak@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@ti.com \
    --cc=paul@pwsan.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.