From patchwork Sun Feb 22 09:32:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 8305 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1M9WbAI024910 for ; Sun, 22 Feb 2009 09:32:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751270AbZBVJcg (ORCPT ); Sun, 22 Feb 2009 04:32:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752655AbZBVJcf (ORCPT ); Sun, 22 Feb 2009 04:32:35 -0500 Received: from mail-bw0-f161.google.com ([209.85.218.161]:62287 "EHLO mail-bw0-f161.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbZBVJce (ORCPT ); Sun, 22 Feb 2009 04:32:34 -0500 Received: by bwz5 with SMTP id 5so3877974bwz.13 for ; Sun, 22 Feb 2009 01:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=ieEBvpVGjxKRF1oISfFzYF4st+svPw6KxCSEOvyVGIk=; b=UkKLH3R91Pq67aO0+86eAUSKCYDyVLJ/XSDiPwL1Ebob1l13kDHdlogukJTdC2acaP +o2QP/aSifhNudCsdHFM9oqYWMRQdTvnpIjXfqAOYVfRIhOgwNHpctVJ+97eMqdOr/KB YcrWRXpzkWYrVlfyxC5fnck3sOBecT6m+co9E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=c9ym4xtlwwq9rcznbHtwWFRj7OdF8/VGl/6zPp9ZTVLVbdQHdKH9lvg5b+BHQB8/2V PtNJE10ot5nzl7egJH5lYTcWctaKl50bxkTJrE6cltLlMAlhaZTrr2TEvXUF/CIswhYL MdB9+iyJUbo1So+ugBVBCEVpfDdwz6aeDwdIw= Received: by 10.181.228.9 with SMTP id f9mr1047848bkr.103.1235295152202; Sun, 22 Feb 2009 01:32:32 -0800 (PST) Received: from localhost (a91-153-251-222.elisa-laajakaista.fi [91.153.251.222]) by mx.google.com with ESMTPS id 35sm7575074fkt.23.2009.02.22.01.32.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 22 Feb 2009 01:32:31 -0800 (PST) From: Felipe Contreras To: linux-omap@vger.kernel.org Cc: Hiroshi DOYU , h-kanigeri2@ti.com, ameya.palande@nokia.com, Felipe Contreras Subject: [PATCH v2 3/4] dsp-bridge: cleanup and remove HW_MBOX_IsFull Date: Sun, 22 Feb 2009 11:32:23 +0200 Message-Id: <1235295144-22097-3-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.6.1.3 In-Reply-To: <1235295144-22097-2-git-send-email-felipe.contreras@gmail.com> References: <94a0d4530902212246h4160ae83pf435b5c6faf88237@mail.gmail.com> <1235295144-22097-1-git-send-email-felipe.contreras@gmail.com> <1235295144-22097-2-git-send-email-felipe.contreras@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org HW_MBOX_IsFull has many convoluted macros and is used only once. Clean it up so it's easier to see what it's actually doing. Signed-off-by: Felipe Contreras --- drivers/dsp/bridge/hw/hw_mbox.c | 25 ------------------------- drivers/dsp/bridge/hw/hw_mbox.h | 35 ----------------------------------- drivers/dsp/bridge/wmd/tiomap_sm.c | 15 +++++++++------ 3 files changed, 9 insertions(+), 66 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 2f381c8..4ad893b 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,7 +178,6 @@ 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; u32 temp; @@ -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) - mdelay(1); - else + if (!fifo_full((void __iomem *) resources.dwMboxBase, 0)) break; + mdelay(1); } if (!cnt) { DBG_Trace(DBG_LEVEL7, "Timed out waiting for DSP mailbox \n");