All of lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
	Ameya Palande <ameya.palande@nokia.com>,
	Felipe Contreras <felipe.contreras@nokia.com>,
	Fernando Guzman <x0095840@ti.com>, Ernesto Ramos <ernesto@ti.com>,
	Omar Ramirez Luna <omar.ramirez@ti.com>
Subject: [PATCHv2 05/18] DSPBRIDGE: Enable/Disable MCBSP_CLOCKS for MCBSP2
Date: Wed, 16 Dec 2009 20:15:50 -0600	[thread overview]
Message-ID: <1261016163-11091-6-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1261016163-11091-5-git-send-email-omar.ramirez@ti.com>

From: Fernando Guzman Lugo <x0095840@ti.com>

Bridge should enable McBSP_CLKS (using T2 clock) so that DPLL4
can be gated. Once McBSP2 clock is released, it should disable
McBSP_CLKS as it prevents PER and CORE domain transitions when
OFF is set to target power state.

Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
 drivers/dsp/bridge/wmd/tiomap3430_pwr.c |   73 ++++++++++++++++++++++++++++++-
 1 files changed, 72 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
index 619ed1a..f30da74 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c
@@ -361,6 +361,8 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT *pDevContext,
 	u32 dspPerClksBefore;
 	DSP_STATUS status = DSP_SOK;
 	DSP_STATUS status1 = DSP_SOK;
+	struct CFG_HOSTRES resources;
+	u32 value;
 
 	DBG_Trace(DBG_ENTER, "Entering DSPPeripheralClkCtrl \n");
 	dspPerClksBefore = pDevContext->uDspPerClks;
@@ -369,6 +371,13 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT *pDevContext,
 
 	extClk = (u32)*((u32 *)pArgs);
 
+	status = CFG_GetHostResources(
+			(struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
+			&resources);
+
+	if (DSP_FAILED(status))
+		return DSP_EFAIL;
+
 	DBG_Trace(DBG_LEVEL3, "DSPPeripheralClkCtrl : extClk+Cmd = 0x%x \n",
 		 extClk);
 
@@ -399,6 +408,17 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT *pDevContext,
 			 "DSPPeripheralClkCtrl : Disable CLK for \n");
 		status1 = CLK_Disable(BPWR_Clks[clkIdIndex].intClk);
 		status = CLK_Disable(BPWR_Clks[clkIdIndex].funClk);
+		if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP1) {
+			/* clear MCBSP1_CLKS, on McBSP1 OFF */
+			value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+			value &= ~(1 << 2);
+			__raw_writel(value, resources.dwSysCtrlBase + 0x274);
+		} else if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP2) {
+			/* clear MCBSP2_CLKS, on McBSP2 OFF */
+			value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+			value &= ~(1 << 6);
+			__raw_writel(value, resources.dwSysCtrlBase + 0x274);
+		}
 		DSPClkWakeupEventCtrl(BPWR_Clks[clkIdIndex].clkId, false);
 		if ((DSP_SUCCEEDED(status)) && (DSP_SUCCEEDED(status1))) {
 			(pDevContext->uDspPerClks) &=
@@ -413,6 +433,17 @@ DSP_STATUS DSPPeripheralClkCtrl(struct WMD_DEV_CONTEXT *pDevContext,
 			 "DSPPeripheralClkCtrl : Enable CLK for \n");
 		status1 = CLK_Enable(BPWR_Clks[clkIdIndex].intClk);
 		status = CLK_Enable(BPWR_Clks[clkIdIndex].funClk);
+		if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP1) {
+			/* set MCBSP1_CLKS, on McBSP1 ON */
+			value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+			value |= 1 << 2;
+			__raw_writel(value, resources.dwSysCtrlBase + 0x274);
+		} else if (BPWR_CLKID[clkIdIndex] == BPWR_MCBSP2) {
+			/* set MCBSP2_CLKS, on McBSP2 ON */
+			value = __raw_readl(resources.dwSysCtrlBase + 0x274);
+			value |= 1 << 6;
+			__raw_writel(value, resources.dwSysCtrlBase + 0x274);
+		}
 		DSPClkWakeupEventCtrl(BPWR_Clks[clkIdIndex].clkId, true);
 		if ((DSP_SUCCEEDED(status)) && (DSP_SUCCEEDED(status1))) {
 			(pDevContext->uDspPerClks) |= (1 << clkIdIndex);
@@ -522,14 +553,34 @@ DSP_STATUS PostScale_DSP(struct WMD_DEV_CONTEXT *pDevContext, IN void *pArgs)
 DSP_STATUS DSP_PeripheralClocks_Disable(struct WMD_DEV_CONTEXT *pDevContext,
 					IN void *pArgs)
 {
-
 	u32 clkIdx;
 	DSP_STATUS status = DSP_SOK;
+	struct CFG_HOSTRES resources;
+	u32 value;
+
+	status = CFG_GetHostResources(
+			(struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
+			&resources);
 
 	for (clkIdx = 0; clkIdx < MBX_PM_MAX_RESOURCES; clkIdx++) {
 		if (((pDevContext->uDspPerClks) >> clkIdx) & 0x01) {
 			/* Disables the interface clock of the peripheral */
 			status = CLK_Disable(BPWR_Clks[clkIdx].intClk);
+			if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
+				/* clear MCBSP1_CLKS, on McBSP1 OFF */
+				value = __raw_readl(resources.dwSysCtrlBase
+								+ 0x274);
+				value &= ~(1 << 2);
+				__raw_writel(value, resources.dwSysCtrlBase
+								+ 0x274);
+			} else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
+				/* clear MCBSP2_CLKS, on McBSP2 OFF */
+				value = __raw_readl(resources.dwSysCtrlBase
+								+ 0x274);
+				value &= ~(1 << 6);
+				__raw_writel(value, resources.dwSysCtrlBase
+								+ 0x274);
+			}
 			if (DSP_FAILED(status)) {
 				DBG_Trace(DBG_LEVEL7,
 					 "Failed to Enable the DSP Peripheral"
@@ -556,11 +607,31 @@ DSP_STATUS DSP_PeripheralClocks_Enable(struct WMD_DEV_CONTEXT *pDevContext,
 {
 	u32 clkIdx;
 	DSP_STATUS int_clk_status = DSP_EFAIL, fun_clk_status = DSP_EFAIL;
+	struct CFG_HOSTRES resources;
+	u32 value;
+
+	CFG_GetHostResources((struct CFG_DEVNODE *)DRV_GetFirstDevExtension(),
+			&resources);
 
 	for (clkIdx = 0; clkIdx < MBX_PM_MAX_RESOURCES; clkIdx++) {
 		if (((pDevContext->uDspPerClks) >> clkIdx) & 0x01) {
 			/* Enable the interface clock of the peripheral */
 			int_clk_status = CLK_Enable(BPWR_Clks[clkIdx].intClk);
+			if (BPWR_CLKID[clkIdx] == BPWR_MCBSP1) {
+				/* set MCBSP1_CLKS, on McBSP1 ON */
+				value = __raw_readl(resources.dwSysCtrlBase
+								+ 0x274);
+				value |= 1 << 2;
+				__raw_writel(value, resources.dwSysCtrlBase
+								+ 0x274);
+			} else if (BPWR_CLKID[clkIdx] == BPWR_MCBSP2) {
+				/* set MCBSP2_CLKS, on McBSP2 ON */
+				value = __raw_readl(resources.dwSysCtrlBase
+								+ 0x274);
+				value |= 1 << 6;
+				__raw_writel(value, resources.dwSysCtrlBase
+								+ 0x274);
+			}
 			/* Enable the functional clock of the periphearl */
 			fun_clk_status = CLK_Enable(BPWR_Clks[clkIdx].funClk);
 		}
-- 
1.6.2.4


  reply	other threads:[~2009-12-17  2:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17  2:15 [PATCHv2 00/18] First set of unreviewed patches Omar Ramirez Luna
2009-12-17  2:15 ` [PATCHv2 01/18] DSPBRIDGE: Fix compile break for WCD debug mask Omar Ramirez Luna
2009-12-17  2:15   ` [PATCHv2 02/18] DSPBRIDGE: enable smart/autoidle for mailbox sysconfig Omar Ramirez Luna
2009-12-17  2:15     ` [PATCHv2 03/18] DSPBRIDGE: Remove preproessor condition that could never work Omar Ramirez Luna
2009-12-17  2:15       ` [PATCHv2 04/18] DSPBRIDGE: Implemented Trampoline support for dynamic loader Omar Ramirez Luna
2009-12-17  2:15         ` Omar Ramirez Luna [this message]
2009-12-17  2:15           ` [PATCHv2 06/18] DSPBRIDGE: set PWRERROR notifications as an option Omar Ramirez Luna
2009-12-17  2:15             ` [PATCHv2 07/18] DSPBRIDGE: Enable peripheral clocks on wake up Omar Ramirez Luna
2009-12-17  2:15               ` [PATCHv2 08/18] DSPBRIDGE: Remove long busy-wait loops on PWRST transitions Omar Ramirez Luna
2009-12-17  2:15                 ` [PATCHv2 09/18] DSPBRIDGE: Rename usCount to timeout Omar Ramirez Luna
2009-12-17  2:15                   ` [PATCHv2 10/18] DSPBRIDGE: Trivial cleanup on DBDCD Omar Ramirez Luna
2009-12-17  2:15                     ` [PATCHv2 11/18] DSPBRIDGE: Do not panic on bad page count Omar Ramirez Luna
2009-12-17  2:15                       ` [PATCHv2 12/18] DSPBRIDGE: support loading 4 dependent DLL Omar Ramirez Luna
2009-12-17  2:15                         ` [PATCHv2 13/18] DSPBRIDGE: Memory leak in Node Register Notify Omar Ramirez Luna
2009-12-17  2:15                           ` [PATCHv2 14/18] DSPBRIDGE: check pointer before calling Proc_Detach Omar Ramirez Luna
2009-12-17  2:16                             ` [PATCHv2 15/18] DSPBRIDGE: check the status of DMM_GetHandle Omar Ramirez Luna
2009-12-17  2:16                               ` [PATCHv2 16/18] DSPBRIDGE: KFILE_Seek & KFILE_Tell, u32 replaced with loff_t Omar Ramirez Luna
2009-12-17  2:16                                 ` [PATCHv2 17/18] DSPBRIDGE: Delete unused files Omar Ramirez Luna
2009-12-17  2:16                                   ` [PATCHv2 18/18] DSPBRIDGE: Compilation fixes 2.6.31 Omar Ramirez Luna
2009-12-18 17:44                                     ` [PATCH 0/2] dsp-bridge: PM cleanups Felipe Contreras
2009-12-18 17:44                                     ` [PATCH 1/2] dsp-bridge: improve PM conditional code Felipe Contreras
2009-12-18 17:44                                     ` [PATCH 2/2] dsp-bridge: remove unused includes Felipe Contreras
2009-12-18 17:48                                     ` [PATCHv2 18/18] DSPBRIDGE: Compilation fixes 2.6.31 Felipe Contreras
2009-12-18 21:50                                       ` Ramirez Luna, Omar
2009-12-22 13:13 ` [PATCHv2 00/18] First set of unreviewed patches Felipe Contreras

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=1261016163-11091-6-git-send-email-omar.ramirez@ti.com \
    --to=omar.ramirez@ti.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=ameya.palande@nokia.com \
    --cc=ernesto@ti.com \
    --cc=felipe.contreras@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=x0095840@ti.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.