linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] OMAP: hwmod & prcm fixes
@ 2010-08-04 21:38 Benoit Cousson
  2010-08-04 21:38 ` [PATCH 1/4] OMAP: hwmod: Rename dma_ch to dma_req Benoit Cousson
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Benoit Cousson @ 2010-08-04 21:38 UTC (permalink / raw)
  To: linux-omap, khilman, paul; +Cc: rnayak, santosh.shilimkar, Benoit Cousson

Hi Paul & Kevin,

Here are a couples of fixes related to hwmod and prcm.

Tested on PAB board using OMAP4 ES1.0 GP device

Patches are based on lo/for-next and are available here:
git://dev.omapzoom.org/pub/scm/swarch/linux-omap-adv.git for-next-fixes

Regards,
Benoit


Benoit Cousson (2):
  OMAP: hwmod: Rename dma_ch to dma_req
  OMAP: hwmod: Do not disable clocks if hwmod already in idle

Liam Girdwood (1):
  OMAP: hwmod: Fix omap_hwmod_reset wrong state test

Rajeev Kulkarni (1):
  OMAP4: prcm: Fix global warm reset bit position

 arch/arm/mach-omap2/omap_hwmod.c             |   26 ++++++++++++++------------
 arch/arm/mach-omap2/prcm.c                   |    5 +++--
 arch/arm/plat-omap/include/plat/omap_hwmod.h |   12 ++++++------
 3 files changed, 23 insertions(+), 20 deletions(-)


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

* [PATCH 1/4] OMAP: hwmod: Rename dma_ch to dma_req
  2010-08-04 21:38 [PATCH 0/4] OMAP: hwmod & prcm fixes Benoit Cousson
@ 2010-08-04 21:38 ` Benoit Cousson
  2010-08-04 21:38 ` [PATCH 2/4] OMAP: hwmod: Do not disable clocks if hwmod already in idle Benoit Cousson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Benoit Cousson @ 2010-08-04 21:38 UTC (permalink / raw)
  To: linux-omap, khilman, paul; +Cc: rnayak, santosh.shilimkar, Benoit Cousson

The dma request line attribute was named dma channel, which leads
to confusion with the real dma channel definition.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/omap_hwmod.c             |   10 +++++-----
 arch/arm/plat-omap/include/plat/omap_hwmod.h |   12 ++++++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cb911d7..8bf19a7 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1468,7 +1468,7 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh)
 {
 	int ret, i;
 
-	ret = oh->mpu_irqs_cnt + oh->sdma_chs_cnt;
+	ret = oh->mpu_irqs_cnt + oh->sdma_reqs_cnt;
 
 	for (i = 0; i < oh->slaves_cnt; i++)
 		ret += oh->slaves[i]->addr_cnt;
@@ -1501,10 +1501,10 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
 		r++;
 	}
 
-	for (i = 0; i < oh->sdma_chs_cnt; i++) {
-		(res + r)->name = (oh->sdma_chs + i)->name;
-		(res + r)->start = (oh->sdma_chs + i)->dma_ch;
-		(res + r)->end = (oh->sdma_chs + i)->dma_ch;
+	for (i = 0; i < oh->sdma_reqs_cnt; i++) {
+		(res + r)->name = (oh->sdma_reqs + i)->name;
+		(res + r)->start = (oh->sdma_reqs + i)->dma_req;
+		(res + r)->end = (oh->sdma_reqs + i)->dma_req;
 		(res + r)->flags = IORESOURCE_DMA;
 		r++;
 	}
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index a4e508d..5506d80 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -96,7 +96,7 @@ struct omap_hwmod_irq_info {
 /**
  * struct omap_hwmod_dma_info - DMA channels used by the hwmod
  * @name: name of the DMA channel (module local name)
- * @dma_ch: DMA channel ID
+ * @dma_req: DMA request ID
  *
  * @name should be something short, e.g., "tx" or "rx".  It is for use
  * by platform_get_resource_byname().  It is defined locally to the
@@ -104,7 +104,7 @@ struct omap_hwmod_irq_info {
  */
 struct omap_hwmod_dma_info {
 	const char	*name;
-	u16		dma_ch;
+	u16		dma_req;
 };
 
 /**
@@ -410,7 +410,7 @@ struct omap_hwmod_class {
  * @class: struct omap_hwmod_class * to the class of this hwmod
  * @od: struct omap_device currently associated with this hwmod (internal use)
  * @mpu_irqs: ptr to an array of MPU IRQs (see also mpu_irqs_cnt)
- * @sdma_chs: ptr to an array of SDMA channel IDs (see also sdma_chs_cnt)
+ * @sdma_reqs: ptr to an array of System DMA request IDs (see sdma_reqs_cnt)
  * @prcm: PRCM data pertaining to this hwmod
  * @main_clk: main clock: OMAP clock name
  * @_clk: pointer to the main struct clk (filled in at runtime)
@@ -424,7 +424,7 @@ struct omap_hwmod_class {
  * @msuspendmux_reg_id: CONTROL_MSUSPENDMUX register ID (1-6)
  * @msuspendmux_shift: CONTROL_MSUSPENDMUX register bit shift
  * @mpu_irqs_cnt: number of @mpu_irqs
- * @sdma_chs_cnt: number of @sdma_chs
+ * @sdma_reqs_cnt: number of @sdma_reqs
  * @opt_clks_cnt: number of @opt_clks
  * @master_cnt: number of @master entries
  * @slaves_cnt: number of @slave entries
@@ -448,7 +448,7 @@ struct omap_hwmod {
 	struct omap_hwmod_class		*class;
 	struct omap_device		*od;
 	struct omap_hwmod_irq_info	*mpu_irqs;
-	struct omap_hwmod_dma_info	*sdma_chs;
+	struct omap_hwmod_dma_info	*sdma_reqs;
 	union {
 		struct omap_hwmod_omap2_prcm omap2;
 		struct omap_hwmod_omap4_prcm omap4;
@@ -468,7 +468,7 @@ struct omap_hwmod {
 	u8				msuspendmux_shift;
 	u8				response_lat;
 	u8				mpu_irqs_cnt;
-	u8				sdma_chs_cnt;
+	u8				sdma_reqs_cnt;
 	u8				opt_clks_cnt;
 	u8				masters_cnt;
 	u8				slaves_cnt;
-- 
1.6.1.3


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

* [PATCH 2/4] OMAP: hwmod: Do not disable clocks if hwmod already in idle
  2010-08-04 21:38 [PATCH 0/4] OMAP: hwmod & prcm fixes Benoit Cousson
  2010-08-04 21:38 ` [PATCH 1/4] OMAP: hwmod: Rename dma_ch to dma_req Benoit Cousson
@ 2010-08-04 21:38 ` Benoit Cousson
  2010-08-04 21:38 ` [PATCH 3/4] OMAP: hwmod: Fix omap_hwmod_reset wrong state test Benoit Cousson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Benoit Cousson @ 2010-08-04 21:38 UTC (permalink / raw)
  To: linux-omap, khilman, paul; +Cc: rnayak, santosh.shilimkar, Benoit Cousson

The disable function was disabling clocks and dependencies
from both enable and idle state. Since idle function is already
disabling both, an enable -> idle -> disable sequence will
try to disable twice the clocks and thus generate a
"Trying disable clock XXX with 0 usecount" warning.

Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 8bf19a7..5bb25e3 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -982,9 +982,13 @@ static int _shutdown(struct omap_hwmod *oh)
 
 	if (oh->class->sysc)
 		_sysc_shutdown(oh);
-	_del_initiator_dep(oh, mpu_oh);
-	/* XXX what about the other system initiators here? DMA, tesla, d2d */
-	_disable_clocks(oh);
+
+	/* clocks and deps are already disabled in idle */
+	if (oh->_state == _HWMOD_STATE_ENABLED) {
+		_del_initiator_dep(oh, mpu_oh);
+		/* XXX what about the other system initiators here? dma, dsp */
+		_disable_clocks(oh);
+	}
 	/* XXX Should this code also force-disable the optional clocks? */
 
 	/* XXX mux any associated balls to safe mode */
-- 
1.6.1.3


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

* [PATCH 3/4] OMAP: hwmod: Fix omap_hwmod_reset wrong state test
  2010-08-04 21:38 [PATCH 0/4] OMAP: hwmod & prcm fixes Benoit Cousson
  2010-08-04 21:38 ` [PATCH 1/4] OMAP: hwmod: Rename dma_ch to dma_req Benoit Cousson
  2010-08-04 21:38 ` [PATCH 2/4] OMAP: hwmod: Do not disable clocks if hwmod already in idle Benoit Cousson
@ 2010-08-04 21:38 ` Benoit Cousson
  2010-08-04 21:38 ` [PATCH 4/4] OMAP4: prcm: Fix global warm reset bit position Benoit Cousson
  2010-08-14 17:03 ` [PATCH 0/4] OMAP: hwmod & prcm fixes Paul Walmsley
  4 siblings, 0 replies; 6+ messages in thread
From: Benoit Cousson @ 2010-08-04 21:38 UTC (permalink / raw)
  To: linux-omap, khilman, paul
  Cc: rnayak, santosh.shilimkar, Liam Girdwood, Benoit Cousson

From: Liam Girdwood <lrg@slimlogic.co.uk>

The reset function wrongly used the state flag as a bit mask and was trying
to re-enable after a reset.

hwmod is still enabled for the PRCM point of view after a softreset
so there is no need to re-enable.

Remove the state check from omap_hwmod_reset since the _reset
function is checking that as well and in addition can generate
a warning

Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
[b-cousson@ti.com: remove the wrong test, remove the re-enable]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 5bb25e3..100115f 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1434,19 +1434,17 @@ void omap_hwmod_ocp_barrier(struct omap_hwmod *oh)
  *
  * Under some conditions, a driver may wish to reset the entire device.
  * Called from omap_device code.  Returns -EINVAL on error or passes along
- * the return value from _reset()/_enable().
+ * the return value from _reset().
  */
 int omap_hwmod_reset(struct omap_hwmod *oh)
 {
 	int r;
 
-	if (!oh || !(oh->_state & _HWMOD_STATE_ENABLED))
+	if (!oh)
 		return -EINVAL;
 
 	mutex_lock(&omap_hwmod_mutex);
 	r = _reset(oh);
-	if (!r)
-		r = _omap_hwmod_enable(oh);
 	mutex_unlock(&omap_hwmod_mutex);
 
 	return r;
-- 
1.6.1.3


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

* [PATCH 4/4] OMAP4: prcm: Fix global warm reset bit position
  2010-08-04 21:38 [PATCH 0/4] OMAP: hwmod & prcm fixes Benoit Cousson
                   ` (2 preceding siblings ...)
  2010-08-04 21:38 ` [PATCH 3/4] OMAP: hwmod: Fix omap_hwmod_reset wrong state test Benoit Cousson
@ 2010-08-04 21:38 ` Benoit Cousson
  2010-08-14 17:03 ` [PATCH 0/4] OMAP: hwmod & prcm fixes Paul Walmsley
  4 siblings, 0 replies; 6+ messages in thread
From: Benoit Cousson @ 2010-08-04 21:38 UTC (permalink / raw)
  To: linux-omap, khilman, paul
  Cc: rnayak, santosh.shilimkar, Rajeev Kulkarni, Leed Aguilar,
	Benoit Cousson

From: Rajeev Kulkarni <rajeevk@ti.com>

OMAP4 platform has different register bits for Warm and Cold Resets.
Write one into appropriate bits.

Signed-off-by: Rajeev Kulkarni <rajeevk@ti.com>
Cc: Leed Aguilar <leed.aguilar@ti.com>
[b-cousson@ti.com: Change the define with the proper one from omap4 headers]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
 arch/arm/mach-omap2/prcm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index c201374..96f4616 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -33,6 +33,7 @@
 #include "cm.h"
 #include "prm.h"
 #include "prm-regbits-24xx.h"
+#include "prm-regbits-44xx.h"
 
 static void __iomem *prm_base;
 static void __iomem *cm_base;
@@ -161,8 +162,8 @@ void omap_prcm_arch_reset(char mode, const char *cmd)
 		prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
 						 OMAP2_RM_RSTCTRL);
 	if (cpu_is_omap44xx())
-		prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
-						 OMAP4_RM_RSTCTRL);
+		prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_WARM_SW_MASK,
+				     prcm_offs, OMAP4_RM_RSTCTRL);
 }
 
 static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg)
-- 
1.6.1.3


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

* Re: [PATCH 0/4] OMAP: hwmod & prcm fixes
  2010-08-04 21:38 [PATCH 0/4] OMAP: hwmod & prcm fixes Benoit Cousson
                   ` (3 preceding siblings ...)
  2010-08-04 21:38 ` [PATCH 4/4] OMAP4: prcm: Fix global warm reset bit position Benoit Cousson
@ 2010-08-14 17:03 ` Paul Walmsley
  4 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2010-08-14 17:03 UTC (permalink / raw)
  To: Benoit Cousson; +Cc: linux-omap, khilman, rnayak, santosh.shilimkar

[-- Attachment #1: Type: TEXT/PLAIN, Size: 443 bytes --]

Hi Benoît,

On Wed, 4 Aug 2010, Benoit Cousson wrote:

> Here are a couples of fixes related to hwmod and prcm.
> 
> Tested on PAB board using OMAP4 ES1.0 GP device
> 
> Patches are based on lo/for-next and are available here:
> git://dev.omapzoom.org/pub/scm/swarch/linux-omap-adv.git for-next-fixes

Thanks, these all look good and are queued for 2.6.36 in the 
'hwmod_2.6.36' branch of git://git.pwsan.com/linux-2.6.


- Paul

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

end of thread, other threads:[~2010-08-14 17:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04 21:38 [PATCH 0/4] OMAP: hwmod & prcm fixes Benoit Cousson
2010-08-04 21:38 ` [PATCH 1/4] OMAP: hwmod: Rename dma_ch to dma_req Benoit Cousson
2010-08-04 21:38 ` [PATCH 2/4] OMAP: hwmod: Do not disable clocks if hwmod already in idle Benoit Cousson
2010-08-04 21:38 ` [PATCH 3/4] OMAP: hwmod: Fix omap_hwmod_reset wrong state test Benoit Cousson
2010-08-04 21:38 ` [PATCH 4/4] OMAP4: prcm: Fix global warm reset bit position Benoit Cousson
2010-08-14 17:03 ` [PATCH 0/4] OMAP: hwmod & prcm fixes 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).