linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] OMAP: hwmod/device/CM: bug fixes for 2.6.37
@ 2010-09-24 16:40 Paul Walmsley
  2010-09-24 16:40 ` [PATCH 1/3] OMAP: omap_device: Fix to support multiple hwmods for a single device Paul Walmsley
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Paul Walmsley @ 2010-09-24 16:40 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel

Hello,

Here are a few bugfix patches for the omap_hwmod, omap_device,
and CM code, intended to be merged in 2.6.37 via Tony's tree.
 
This series applies on top of the 2.6.37 hwmod patches sent earlier;
unfortunately the third patch touches the same code as a patch in that
series, so this series can't be based on v2.6.36-rc5.


- Paul

---

   text	   data	    bss	    dec	    hex	filename
3361500	 176832	  99336	3637668	 3781a4	vmlinux.omap_4430sdp_defconfig.orig
3361468	 176832	  99336	3637636	 378184	vmlinux.omap_4430sdp_defconfig.patched

Hema HK (1):
      OMAP: hwmod: Set autoidle after smartidle during _sysc_enable

Kishon Vijay Abraham I (1):
      OMAP: omap_device: Fix to support multiple hwmods for a single device

Rajendra Nayak (1):
      OMAP4: PM: Declare idle modules as functional too


 arch/arm/mach-omap2/cm4xxx.c     |    9 +++++----
 arch/arm/mach-omap2/omap_hwmod.c |   17 +++++++++++------
 arch/arm/plat-omap/omap_device.c |   35 ++++++++++++++---------------------
 3 files changed, 30 insertions(+), 31 deletions(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] OMAP: omap_device: Fix to support multiple hwmods for a single device
  2010-09-24 16:40 [PATCH 0/3] OMAP: hwmod/device/CM: bug fixes for 2.6.37 Paul Walmsley
@ 2010-09-24 16:40 ` Paul Walmsley
  2010-09-24 16:40 ` [PATCH 2/3] OMAP4: PM: Declare idle modules as functional too Paul Walmsley
  2010-09-24 16:40 ` [PATCH 3/3] OMAP: hwmod: Set autoidle after smartidle during _sysc_enable Paul Walmsley
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Walmsley @ 2010-09-24 16:40 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel
  Cc: Kevin Hilman, Shubhrajyoti D, Charulatha V, Benoit Cousson,
	Kishon Vijay Abraham I

From: Kishon Vijay Abraham I <kishon@ti.com>

Currently there is a bug in the existing omap_device core code when
extracting the hwmod structures passed to omap_device_build_ss(). This bug
gets exposed only when passing multiple hwmod structures to
omap_device_build_ss() resulting in incorrect extraction from second hwmod
structure.

This fix uses the pointer to pointer to omap_hwmod structure (array of
pointers to omap_hwmod structure) passed to omap_device_build_ss() to
correctly extract the appropriate omap_hwmod structure.

This patch has been created and tested on lo/master and mainline.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Charulatha V <charu@ti.com>
Cc: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 arch/arm/plat-omap/omap_device.c |   35 ++++++++++++++---------------------
 1 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index ceba58a..533ad13 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -296,12 +296,11 @@ static void _add_optional_clock_alias(struct omap_device *od,
  */
 int omap_device_count_resources(struct omap_device *od)
 {
-	struct omap_hwmod *oh;
 	int c = 0;
 	int i;
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
-		c += omap_hwmod_count_resources(oh);
+	for (i = 0; i < od->hwmods_cnt; i++)
+		c += omap_hwmod_count_resources(od->hwmods[i]);
 
 	pr_debug("omap_device: %s: counted %d total resources across %d "
 		 "hwmods\n", od->pdev.name, c, od->hwmods_cnt);
@@ -328,12 +327,11 @@ int omap_device_count_resources(struct omap_device *od)
  */
 int omap_device_fill_resources(struct omap_device *od, struct resource *res)
 {
-	struct omap_hwmod *oh;
 	int c = 0;
 	int i, r;
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++) {
-		r = omap_hwmod_fill_resources(oh, res);
+	for (i = 0; i < od->hwmods_cnt; i++) {
+		r = omap_hwmod_fill_resources(od->hwmods[i], res);
 		res += r;
 		c += r;
 	}
@@ -607,7 +605,6 @@ int omap_device_shutdown(struct platform_device *pdev)
 {
 	int ret, i;
 	struct omap_device *od;
-	struct omap_hwmod *oh;
 
 	od = _find_by_pdev(pdev);
 
@@ -620,8 +617,8 @@ int omap_device_shutdown(struct platform_device *pdev)
 
 	ret = _omap_device_deactivate(od, IGNORE_WAKEUP_LAT);
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
-		omap_hwmod_shutdown(oh);
+	for (i = 0; i < od->hwmods_cnt; i++)
+		omap_hwmod_shutdown(od->hwmods[i]);
 
 	od->_state = OMAP_DEVICE_STATE_SHUTDOWN;
 
@@ -733,11 +730,10 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
  */
 int omap_device_enable_hwmods(struct omap_device *od)
 {
-	struct omap_hwmod *oh;
 	int i;
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
-		omap_hwmod_enable(oh);
+	for (i = 0; i < od->hwmods_cnt; i++)
+		omap_hwmod_enable(od->hwmods[i]);
 
 	/* XXX pass along return value here? */
 	return 0;
@@ -751,11 +747,10 @@ int omap_device_enable_hwmods(struct omap_device *od)
  */
 int omap_device_idle_hwmods(struct omap_device *od)
 {
-	struct omap_hwmod *oh;
 	int i;
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
-		omap_hwmod_idle(oh);
+	for (i = 0; i < od->hwmods_cnt; i++)
+		omap_hwmod_idle(od->hwmods[i]);
 
 	/* XXX pass along return value here? */
 	return 0;
@@ -770,11 +765,10 @@ int omap_device_idle_hwmods(struct omap_device *od)
  */
 int omap_device_disable_clocks(struct omap_device *od)
 {
-	struct omap_hwmod *oh;
 	int i;
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
-		omap_hwmod_disable_clocks(oh);
+	for (i = 0; i < od->hwmods_cnt; i++)
+		omap_hwmod_disable_clocks(od->hwmods[i]);
 
 	/* XXX pass along return value here? */
 	return 0;
@@ -789,11 +783,10 @@ int omap_device_disable_clocks(struct omap_device *od)
  */
 int omap_device_enable_clocks(struct omap_device *od)
 {
-	struct omap_hwmod *oh;
 	int i;
 
-	for (i = 0, oh = *od->hwmods; i < od->hwmods_cnt; i++, oh++)
-		omap_hwmod_enable_clocks(oh);
+	for (i = 0; i < od->hwmods_cnt; i++)
+		omap_hwmod_enable_clocks(od->hwmods[i]);
 
 	/* XXX pass along return value here? */
 	return 0;



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] OMAP4: PM: Declare idle modules as functional too
  2010-09-24 16:40 [PATCH 0/3] OMAP: hwmod/device/CM: bug fixes for 2.6.37 Paul Walmsley
  2010-09-24 16:40 ` [PATCH 1/3] OMAP: omap_device: Fix to support multiple hwmods for a single device Paul Walmsley
@ 2010-09-24 16:40 ` Paul Walmsley
  2010-09-24 16:40 ` [PATCH 3/3] OMAP: hwmod: Set autoidle after smartidle during _sysc_enable Paul Walmsley
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Walmsley @ 2010-09-24 16:40 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel; +Cc: Partha Basak, Rajendra Nayak, Benoit Cousson

From: Rajendra Nayak <rnayak@ti.com>

The omap4_cm_wait_module_ready function would only check for
the modules to be completely functional before declaring them
ready to be accessed.
There might also be instances where in the module is actually
in idle (under h/w control) but should still be declared
accessible, as the h/w control would make it functional when
needed.

Hence make omap4_cm_wait_module_ready return true in case
the module is fully functional *or* in idle state.
Fail only if the module is fully disabled or stuck intransition.

The explaination from the TRM for the idlest bits on OMAP4 is as
below for quick reference

Module idle state:
0x0 func:     Module is fully functional, including OCP
0x1 trans:    Module is performing transition: wakeup, or sleep, or sleep
              abortion
0x2 idle:     Module is in Idle mode (only OCP part). It is functional if
              using separate functional clock
0x3 disabled: Module is disabled and cannot be accessed

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Partha Basak <p-basak2@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/cm4xxx.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/cm4xxx.c b/arch/arm/mach-omap2/cm4xxx.c
index b101091..f8a660a 100644
--- a/arch/arm/mach-omap2/cm4xxx.c
+++ b/arch/arm/mach-omap2/cm4xxx.c
@@ -43,7 +43,6 @@
  *                 using separate functional clock
  *   0x3 disabled: Module is disabled and cannot be accessed
  *
- * TODO: Need to handle module accessible in idle state
  */
 int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
 {
@@ -52,9 +51,11 @@ int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg)
 	if (!clkctrl_reg)
 		return 0;
 
-	omap_test_timeout(((__raw_readl(clkctrl_reg) &
-			    OMAP4430_IDLEST_MASK) == 0),
-			  MAX_MODULE_READY_TIME, i);
+	omap_test_timeout((
+		((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) == 0) ||
+		 (((__raw_readl(clkctrl_reg) & OMAP4430_IDLEST_MASK) >>
+		  OMAP4430_IDLEST_SHIFT) == 0x2)),
+		MAX_MODULE_READY_TIME, i);
 
 	return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
 }



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] OMAP: hwmod: Set autoidle after smartidle during _sysc_enable
  2010-09-24 16:40 [PATCH 0/3] OMAP: hwmod/device/CM: bug fixes for 2.6.37 Paul Walmsley
  2010-09-24 16:40 ` [PATCH 1/3] OMAP: omap_device: Fix to support multiple hwmods for a single device Paul Walmsley
  2010-09-24 16:40 ` [PATCH 2/3] OMAP4: PM: Declare idle modules as functional too Paul Walmsley
@ 2010-09-24 16:40 ` Paul Walmsley
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Walmsley @ 2010-09-24 16:40 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel
  Cc: Hema HK, Benoit Cousson, Tony Lindgren, Felipe Balbi,
	Partha Basak, Kevin Hilman

From: Hema HK <hemahk@ti.com>

OMAP USBOTG module has a requirement to set the autoidle bit only after
setting smartidle bit. Modified the _sys_enable api to set the smartidle
first and then the autoidle bit. Setting this will not have any impact on the
other modules.

Signed-off-by: Hema HK <hemahk@ti.com>
Signed-off-by: Partha Basak <p-basak2@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index c3a5889..955861a 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -777,12 +777,6 @@ static void _enable_sysc(struct omap_hwmod *oh)
 		_set_master_standbymode(oh, idlemode, &v);
 	}
 
-	if (sf & SYSC_HAS_AUTOIDLE) {
-		idlemode = (oh->flags & HWMOD_NO_OCP_AUTOIDLE) ?
-			0 : 1;
-		_set_module_autoidle(oh, idlemode, &v);
-	}
-
 	/*
 	 * XXX The clock framework should handle this, by
 	 * calling into this code.  But this must wait until the
@@ -797,6 +791,17 @@ static void _enable_sysc(struct omap_hwmod *oh)
 	/* If slave is in SMARTIDLE, also enable wakeup */
 	if ((sf & SYSC_HAS_SIDLEMODE) && !(oh->flags & HWMOD_SWSUP_SIDLE))
 		_enable_wakeup(oh);
+
+	/*
+	 * Set the autoidle bit only after setting the smartidle bit
+	 * Setting this will not have any impact on the other modules.
+	 */
+	if (sf & SYSC_HAS_AUTOIDLE) {
+		idlemode = (oh->flags & HWMOD_NO_OCP_AUTOIDLE) ?
+			0 : 1;
+		_set_module_autoidle(oh, idlemode, &v);
+		_write_sysconfig(v, oh);
+	}
 }
 
 /**



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-24 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-24 16:40 [PATCH 0/3] OMAP: hwmod/device/CM: bug fixes for 2.6.37 Paul Walmsley
2010-09-24 16:40 ` [PATCH 1/3] OMAP: omap_device: Fix to support multiple hwmods for a single device Paul Walmsley
2010-09-24 16:40 ` [PATCH 2/3] OMAP4: PM: Declare idle modules as functional too Paul Walmsley
2010-09-24 16:40 ` [PATCH 3/3] OMAP: hwmod: Set autoidle after smartidle during _sysc_enable Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).