All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: linux-omap@vger.kernel.org
Cc: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
	Felipe Contreras <felipe.contrers@nokia.com>,
	Felipe Contreras <felipe.contreras@nokia.com>
Subject: [PATCH] dspbridge: wait less and check the mailbox more
Date: Sat, 21 Feb 2009 01:04:17 +0200	[thread overview]
Message-ID: <1235171057-7859-1-git-send-email-felipe.contreras@gmail.com> (raw)

From: Felipe Contreras <felipe.contrers@nokia.com>

Profiling showed the __delay function is called a lot; checking the mbox
more often seems to decrease the usage by 2/3 according to OProfile.

The changes are based on 'arch/arm/plat-omap/mailbox.c'. Tested on OMAP3430.

Also, remove HW_MBOX_IsFull since it's not used by anybody.

Signed-off-by: Felipe Contreras <felipe.contreras@nokia.com>
---
 drivers/dsp/bridge/hw/hw_mbox.c    |   25 -------------------------
 drivers/dsp/bridge/hw/hw_mbox.h    |   35 -----------------------------------
 drivers/dsp/bridge/wmd/tiomap_sm.c |   17 ++++++++++-------
 3 files changed, 10 insertions(+), 67 deletions(-)

diff --git a/drivers/dsp/bridge/hw/hw_mbox.c b/drivers/dsp/bridge/hw/hw_mbox.c
index 2c14ade..31b890a 100644
--- a/drivers/dsp/bridge/hw/hw_mbox.c
+++ b/drivers/dsp/bridge/hw/hw_mbox.c
@@ -104,31 +104,6 @@ HW_STATUS HW_MBOX_MsgWrite(const u32 baseAddress, const HW_MBOX_Id_t mailBoxId,
 	return status;
 }
 
-/* Reads the full status register for mailbox. */
-HW_STATUS HW_MBOX_IsFull(const u32 baseAddress, const HW_MBOX_Id_t mailBoxId,
-			u32 *const pIsFull)
-{
-	HW_STATUS status = RET_OK;
-	u32 fullStatus;
-
-	/* Check input parameters */
-	CHECK_INPUT_PARAM(baseAddress, 0, RET_BAD_NULL_PARAM, RES_MBOX_BASE +
-			RES_INVALID_INPUT_PARAM);
-	CHECK_INPUT_PARAM(pIsFull,  NULL, RET_BAD_NULL_PARAM, RES_MBOX_BASE +
-			RES_INVALID_INPUT_PARAM);
-	CHECK_INPUT_RANGE_MIN0(mailBoxId, HW_MBOX_ID_MAX, RET_INVALID_ID,
-			RES_MBOX_BASE + RES_INVALID_INPUT_PARAM);
-
-	/* read the is full status parameter for Mailbox */
-	fullStatus = MLBMAILBOX_FIFOSTATUS___0_15FifoFullMBmRead32(baseAddress,
-							(u32)mailBoxId);
-
-	/* fill in return parameter */
-	*pIsFull = (fullStatus & 0xFF);
-
-	return status;
-}
-
 /* Gets number of messages in a specified mailbox. */
 HW_STATUS HW_MBOX_NumMsgGet(const u32 baseAddress, const HW_MBOX_Id_t mailBoxId,
 				u32 *const pNumMsg)
diff --git a/drivers/dsp/bridge/hw/hw_mbox.h b/drivers/dsp/bridge/hw/hw_mbox.h
index 225fb40..d2981d3 100644
--- a/drivers/dsp/bridge/hw/hw_mbox.h
+++ b/drivers/dsp/bridge/hw/hw_mbox.h
@@ -130,41 +130,6 @@ extern HW_STATUS HW_MBOX_MsgWrite(
 		  );
 
 /*
-* FUNCTION      : HW_MBOX_IsFull
-*
-* INPUTS:
-*
-*   Identifier  : baseAddress
-*   Type	: const u32
-*   Description : Base Address of instance of Mailbox module
-*
-*   Identifier  : mailBoxId
-*   Type	: const HW_MBOX_Id_t
-*   Description : Mail Box Sub module Id to check
-*
-* OUTPUTS:
-*
-*   Identifier  : pIsFull
-*   Type	: u32 *const
-*   Description : false means mail box not Full
-*		 true means mailbox full.
-*
-* RETURNS:
-*
-*   Type	: ReturnCode_t
-*   Description : RET_OK	      No errors occured
-*		 RET_BAD_NULL_PARAM  Address/pointer Paramater was set to 0/NULL
-*		 RET_INVALID_ID      Invalid Id used
-*
-* PURPOSE:      : this function reads the full status register for mailbox.
-*/
-extern HW_STATUS HW_MBOX_IsFull(
-		      const u32	 baseAddress,
-		      const HW_MBOX_Id_t   mailBoxId,
-		      u32 *const	pIsFull
-		  );
-
-/*
 * FUNCTION      : HW_MBOX_NumMsgGet
 *
 * INPUTS:
diff --git a/drivers/dsp/bridge/wmd/tiomap_sm.c b/drivers/dsp/bridge/wmd/tiomap_sm.c
index 9bc5b54..0653f40 100644
--- a/drivers/dsp/bridge/wmd/tiomap_sm.c
+++ b/drivers/dsp/bridge/wmd/tiomap_sm.c
@@ -156,6 +156,13 @@ DSP_STATUS CHNLSM_DisableInterrupt(struct WMD_DEV_CONTEXT *hDevContext)
 	return status;
 }
 
+#define MAILBOX_FIFOSTATUS(m) (0x80 + 4 * (m))
+
+static inline unsigned int fifo_full(void __iomem *mbox_base, int mbox_id)
+{
+	return __raw_readl(mbox_base + MAILBOX_FIFOSTATUS(mbox_id)) & 0x1;
+}
+
 /*
  *  ======== CHNLSM_InterruptDSP ========
  *      Send an interrupt to the DSP processor(s).
@@ -171,9 +178,8 @@ DSP_STATUS CHNLSM_InterruptDSP(struct WMD_DEV_CONTEXT *hDevContext)
 	u32 opplevel = 0;
 #endif
 	HW_STATUS hwStatus;
-	u32 mbxFull;
 	struct CFG_HOSTRES resources;
-	u16 cnt = 10;
+	u16 cnt = 1000;
 	u32 temp;
 	/* We are waiting indefinitely here. This needs to be fixed in the
 	 * second phase */
@@ -214,12 +220,9 @@ DSP_STATUS CHNLSM_InterruptDSP(struct WMD_DEV_CONTEXT *hDevContext)
 		pDevContext->dwBrdState = BRD_RUNNING;
 	}
 	while (--cnt) {
-		hwStatus = HW_MBOX_IsFull(resources.dwMboxBase,
-					   MBOX_ARM2DSP, &mbxFull);
-		if (mbxFull)
-			UTIL_Wait(1000);	/* wait for 1 ms)      */
-		else
+		if (!fifo_full((void __iomem *) resources.dwMboxBase, 0))
 			break;
+		udelay(1);
 	}
 	if (!cnt) {
 		DBG_Trace(DBG_LEVEL7, "Timed out waiting for DSP mailbox \n");
-- 
1.6.1.3


             reply	other threads:[~2009-02-20 23:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 23:04 Felipe Contreras [this message]
2009-02-22  5:21 ` [PATCH] dspbridge: wait less and check the mailbox more Hiroshi DOYU
2009-02-22  6:46   ` Felipe Contreras
2009-02-22  9:32     ` [PATCH v2 1/4] dsp-bridge: remove unnecessary comments in util.h Felipe Contreras
2009-02-22  9:32       ` [PATCH v2 2/4] dsp-bridge: remove UTIL_Wait wrapper Felipe Contreras
2009-02-22  9:32         ` [PATCH v2 3/4] dsp-bridge: cleanup and remove HW_MBOX_IsFull Felipe Contreras
2009-02-22  9:32           ` [PATCH v2 4/4] dsp-bridge: wait less and check the mailbox more Felipe Contreras
2009-02-23 22:06           ` [PATCH v2 3/4] dsp-bridge: cleanup and remove HW_MBOX_IsFull Kanigeri, Hari
2009-02-23 22:22             ` Felipe Contreras
2009-02-23 22:22         ` [PATCH v2 2/4] dsp-bridge: remove UTIL_Wait wrapper Kanigeri, Hari
2009-02-22 11:35       ` [PATCH v2 1/4] dsp-bridge: remove unnecessary comments in util.h Hiroshi DOYU
2009-03-04 18:11 [PATCH] DSPBRIDGE: Remove SEEK_* redefinitions Fernando Guzman Lugo
2009-03-04 18:11 ` [PATCH] DSPBRIDGE: Removes wrappers funtions of readl and writel Fernando Guzman Lugo
2009-03-04 18:11   ` [PATCH] DSPBRIDGE: Change address resources to void __iomem * Fernando Guzman Lugo
2009-03-04 18:11     ` [PATCH] DSPBRIDGE: Remove variables not used in cfgdefs.h Fernando Guzman Lugo
2009-03-04 18:11       ` [PATCH] DSPBRIDGE: cleanup of HW_MBOX_IsFull function Fernando Guzman Lugo
2009-03-04 18:11         ` [PATCH] DSPBRIDGE: wait less and check the mailbox more Fernando Guzman Lugo

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=1235171057-7859-1-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=felipe.contreras@nokia.com \
    --cc=felipe.contrers@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    /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.