All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@bitmer.com>
To: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, tony@atomide.com,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: [PATCH 05/14] omap: mcbsp: Make wakeup control generic
Date: Wed, 31 Aug 2011 18:22:52 +0300	[thread overview]
Message-ID: <1314804181-17260-6-git-send-email-jarkko.nikula@bitmer.com> (raw)
In-Reply-To: <1314804181-17260-1-git-send-email-jarkko.nikula@bitmer.com>

Currently wakeup control code is compiled only when CONFIG_ARCH_OMAP3 is
set even it should be available for CONFIG_ARCH_OMAP4 only builds also.

Fix this by making wakeup control generic so that it is executed whenever
new feature flag has_wakeup in platform data is set. Currently flag is set
for McBSP config types 3 and 4.

Remove also old comments about idle mode settings and HW bug workarounds
that were not updated during hwmod conversion.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
 arch/arm/mach-omap2/mcbsp.c             |    3 ++
 arch/arm/plat-omap/include/plat/mcbsp.h |    3 ++
 arch/arm/plat-omap/mcbsp.c              |   43 ++++++------------------------
 3 files changed, 15 insertions(+), 34 deletions(-)

diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index a157e3e..628497e 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -141,6 +141,9 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 			pdata->buffer_size = 0x80;
 	}
 
+	if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
+		pdata->has_wakeup = true;
+
 	oh_device[0] = oh;
 
 	if (oh->dev_attr) {
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 14bc1cb..ac48d83 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -317,6 +317,9 @@ struct omap_mcbsp_platform_data {
 	u16 buffer_size;
 	u8 reg_size;
 	u8 reg_step;
+
+	/* McBSP platform and instance specific features */
+	bool has_wakeup; /* Wakeup capability */
 };
 
 struct omap_mcbsp_st_data {
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 623f2c1..0338ad0 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -659,35 +659,7 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id)
 }
 EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
 
-static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
-{
-	/*
-	 * Enable wakup behavior, smart idle and all wakeups
-	 * REVISIT: some wakeups may be unnecessary
-	 */
-	if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
-	}
-}
-
-static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
-{
-	/*
-	 * Disable wakup behavior, smart idle and all wakeups
-	 */
-	if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		/*
-		 * HW bug workaround - If no_idle mode is taken, we need to
-		 * go to smart_idle before going to always_idle, or the
-		 * device will not hit retention anymore.
-		 */
-
-		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
-	}
-}
 #else
-static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
-static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
 static inline void omap_st_start(struct omap_mcbsp *mcbsp) {}
 static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {}
 #endif
@@ -726,8 +698,9 @@ int omap_mcbsp_request(unsigned int id)
 
 	pm_runtime_get_sync(mcbsp->dev);
 
-	/* Do procedure specific to omap34xx arch, if applicable */
-	omap34xx_mcbsp_request(mcbsp);
+	/* Enable wakeup behavior */
+	if (mcbsp->pdata->has_wakeup)
+		MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
 
 	/*
 	 * Make sure that transmitter, receiver and sample-rate generator are
@@ -764,8 +737,9 @@ err_clk_disable:
 	if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
 		mcbsp->pdata->ops->free(id);
 
-	/* Do procedure specific to omap34xx arch, if applicable */
-	omap34xx_mcbsp_free(mcbsp);
+	/* Disable wakeup behavior */
+	if (mcbsp->pdata->has_wakeup)
+		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
 	pm_runtime_put_sync(mcbsp->dev);
 
@@ -794,8 +768,9 @@ void omap_mcbsp_free(unsigned int id)
 	if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
 		mcbsp->pdata->ops->free(id);
 
-	/* Do procedure specific to omap34xx arch, if applicable */
-	omap34xx_mcbsp_free(mcbsp);
+	/* Disable wakeup behavior */
+	if (mcbsp->pdata->has_wakeup)
+		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
 	pm_runtime_put_sync(mcbsp->dev);
 
-- 
1.7.5.4


WARNING: multiple messages have this Message-ID (diff)
From: jarkko.nikula@bitmer.com (Jarkko Nikula)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/14] omap: mcbsp: Make wakeup control generic
Date: Wed, 31 Aug 2011 18:22:52 +0300	[thread overview]
Message-ID: <1314804181-17260-6-git-send-email-jarkko.nikula@bitmer.com> (raw)
In-Reply-To: <1314804181-17260-1-git-send-email-jarkko.nikula@bitmer.com>

Currently wakeup control code is compiled only when CONFIG_ARCH_OMAP3 is
set even it should be available for CONFIG_ARCH_OMAP4 only builds also.

Fix this by making wakeup control generic so that it is executed whenever
new feature flag has_wakeup in platform data is set. Currently flag is set
for McBSP config types 3 and 4.

Remove also old comments about idle mode settings and HW bug workarounds
that were not updated during hwmod conversion.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
 arch/arm/mach-omap2/mcbsp.c             |    3 ++
 arch/arm/plat-omap/include/plat/mcbsp.h |    3 ++
 arch/arm/plat-omap/mcbsp.c              |   43 ++++++------------------------
 3 files changed, 15 insertions(+), 34 deletions(-)

diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index a157e3e..628497e 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -141,6 +141,9 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
 			pdata->buffer_size = 0x80;
 	}
 
+	if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
+		pdata->has_wakeup = true;
+
 	oh_device[0] = oh;
 
 	if (oh->dev_attr) {
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 14bc1cb..ac48d83 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -317,6 +317,9 @@ struct omap_mcbsp_platform_data {
 	u16 buffer_size;
 	u8 reg_size;
 	u8 reg_step;
+
+	/* McBSP platform and instance specific features */
+	bool has_wakeup; /* Wakeup capability */
 };
 
 struct omap_mcbsp_st_data {
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 623f2c1..0338ad0 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -659,35 +659,7 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id)
 }
 EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
 
-static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
-{
-	/*
-	 * Enable wakup behavior, smart idle and all wakeups
-	 * REVISIT: some wakeups may be unnecessary
-	 */
-	if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
-	}
-}
-
-static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
-{
-	/*
-	 * Disable wakup behavior, smart idle and all wakeups
-	 */
-	if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
-		/*
-		 * HW bug workaround - If no_idle mode is taken, we need to
-		 * go to smart_idle before going to always_idle, or the
-		 * device will not hit retention anymore.
-		 */
-
-		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
-	}
-}
 #else
-static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
-static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
 static inline void omap_st_start(struct omap_mcbsp *mcbsp) {}
 static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {}
 #endif
@@ -726,8 +698,9 @@ int omap_mcbsp_request(unsigned int id)
 
 	pm_runtime_get_sync(mcbsp->dev);
 
-	/* Do procedure specific to omap34xx arch, if applicable */
-	omap34xx_mcbsp_request(mcbsp);
+	/* Enable wakeup behavior */
+	if (mcbsp->pdata->has_wakeup)
+		MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
 
 	/*
 	 * Make sure that transmitter, receiver and sample-rate generator are
@@ -764,8 +737,9 @@ err_clk_disable:
 	if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
 		mcbsp->pdata->ops->free(id);
 
-	/* Do procedure specific to omap34xx arch, if applicable */
-	omap34xx_mcbsp_free(mcbsp);
+	/* Disable wakeup behavior */
+	if (mcbsp->pdata->has_wakeup)
+		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
 	pm_runtime_put_sync(mcbsp->dev);
 
@@ -794,8 +768,9 @@ void omap_mcbsp_free(unsigned int id)
 	if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
 		mcbsp->pdata->ops->free(id);
 
-	/* Do procedure specific to omap34xx arch, if applicable */
-	omap34xx_mcbsp_free(mcbsp);
+	/* Disable wakeup behavior */
+	if (mcbsp->pdata->has_wakeup)
+		MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
 
 	pm_runtime_put_sync(mcbsp->dev);
 
-- 
1.7.5.4

  parent reply	other threads:[~2011-08-31 15:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 15:22 [PATCH 00/14] McBSP cleanup and generalization Jarkko Nikula
2011-08-31 15:22 ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 01/14] omap: mcbsp: Remove omap device API Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 02/14] omap: mcbsp: Remove unused variables from platform data Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 03/14] omap: mcbsp: Move out omap_mcbsp_register_board_cfg from plat-omap/devices.c Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 04/14] omap: mcbsp: Implement generic register access Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` Jarkko Nikula [this message]
2011-08-31 15:22   ` [PATCH 05/14] omap: mcbsp: Make wakeup control generic Jarkko Nikula
2011-08-31 15:22 ` [PATCH 06/14] omap: mcbsp: Make tranceiver configuration control register access generic Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 07/14] omap: mcbsp: Make threshold based transfer code generic Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 08/14] omap: mcbsp: Use per instance register cache size Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 09/14] omap: mcbsp: Move sidetone clock management to mach-omap2/mcbsp.c Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 10/14] omap: mcbsp: Cleanup sidetone control initialization and make it generic Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 11/14] omap: mcbsp: Update mcbsp.h include dependencies Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:22 ` [PATCH 12/14] omap: mcbsp: Move address definitions to arch/arm/mach-omap1/mcbsp.c Jarkko Nikula
2011-08-31 15:22   ` Jarkko Nikula
2011-08-31 15:23 ` [PATCH 13/14] omap: mcbsp: Start generalize omap2_mcbsp_set_clks_src Jarkko Nikula
2011-08-31 15:23   ` Jarkko Nikula
2011-08-31 15:23 ` [PATCH 14/14] omap: mcbsp: Start generalize signal muxing functions Jarkko Nikula
2011-08-31 15:23   ` Jarkko Nikula
2011-09-02 22:47 ` [PATCH 00/14] McBSP cleanup and generalization Kevin Hilman
2011-09-02 22:47   ` Kevin Hilman
2011-09-07  6:46 ` Péter Ujfalusi
2011-09-07  6:46   ` Péter Ujfalusi
2011-09-07 22:53 ` Janusz Krzysztofik
2011-09-07 22:53   ` Janusz Krzysztofik

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=1314804181-17260-6-git-send-email-jarkko.nikula@bitmer.com \
    --to=jarkko.nikula@bitmer.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.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.