From: Fernando Guzman Lugo <x0095840@ti.com>
To: <gregkh@suse.de>
Cc: <felipe.contreras@nokia.com>, <Hiroshi.DOYU@nokia.com>,
<linux-kernel@vger.kernel.org>, <andy.shevchenko@gmail.com>,
<linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Fernando Guzman Lugo <x0095840@ti.com>
Subject: [PATCH 4/8] staging: tidspbridge - fix timeout in dsp_gpt_wait_overflow
Date: Mon, 25 Oct 2010 19:51:42 -0500 [thread overview]
Message-ID: <1288054306-4361-5-git-send-email-x0095840@ti.com> (raw)
In-Reply-To: <1288054306-4361-4-git-send-email-x0095840@ti.com>
Timeout was not being initialized correctly and should
use time_is-before_jiffies, also make it a parameter
Signed-off-by: Fernando Guzman Lugo <x0095840@ti.com>
---
drivers/staging/tidspbridge/core/dsp-clock.c | 13 +++++++------
drivers/staging/tidspbridge/core/dsp-mmu.c | 5 ++++-
.../staging/tidspbridge/include/dspbridge/clk.h | 4 +++-
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c
index 46d17c7..8106d1e 100644
--- a/drivers/staging/tidspbridge/core/dsp-clock.c
+++ b/drivers/staging/tidspbridge/core/dsp-clock.c
@@ -202,13 +202,13 @@ static void mcbsp_clk_prepare(bool flag, u8 id)
* Sets an overflow interrupt for the desired GPT waiting for a timeout
* of 5 msecs for the interrupt to occur.
*/
-void dsp_gpt_wait_overflow(short int clk_id, unsigned int load)
+int dsp_gpt_wait_overflow(short int clk_id, unsigned int load,
+ unsigned long timeout)
{
struct omap_dm_timer *gpt = timer[clk_id - 1];
- unsigned long timeout;
if (!gpt)
- return;
+ return -EINVAL;
/* Enable overflow interrupt */
omap_dm_timer_set_int_enable(gpt, OMAP_TIMER_INT_OVERFLOW);
@@ -222,14 +222,15 @@ void dsp_gpt_wait_overflow(short int clk_id, unsigned int load)
/* Wait 80us for timer to overflow */
udelay(80);
- timeout = msecs_to_jiffies(5);
+ timeout = jiffies + msecs_to_jiffies(timeout);
/* Check interrupt status and wait for interrupt */
while (!(omap_dm_timer_read_status(gpt) & OMAP_TIMER_INT_OVERFLOW)) {
- if (time_is_after_jiffies(timeout)) {
+ if (time_is_before_jiffies(timeout)) {
pr_err("%s: GPTimer interrupt failed\n", __func__);
- break;
+ return -ETIME;
}
}
+ return 0;
}
/*
diff --git a/drivers/staging/tidspbridge/core/dsp-mmu.c b/drivers/staging/tidspbridge/core/dsp-mmu.c
index 6d7501a..2d4e897 100644
--- a/drivers/staging/tidspbridge/core/dsp-mmu.c
+++ b/drivers/staging/tidspbridge/core/dsp-mmu.c
@@ -65,7 +65,10 @@ static void mmu_fault_print_stack(struct bridge_dev_context *dev_context)
dsp_clk_enable(DSP_CLK_GPT8);
- dsp_gpt_wait_overflow(DSP_CLK_GPT8, 0xfffffffe);
+ if (dsp_gpt_wait_overflow(DSP_CLK_GPT8, 0xfffffffe, 10)) {
+ pr_err("%s: error sending interrupt to DSP\n", __func__);
+ return;
+ }
/* Clear MMU interrupt */
tmp = iommu_read_reg(mmu, MMU_IRQSTATUS);
diff --git a/drivers/staging/tidspbridge/include/dspbridge/clk.h b/drivers/staging/tidspbridge/include/dspbridge/clk.h
index b239503..6fe1ff2 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/clk.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/clk.h
@@ -62,7 +62,9 @@ extern void dsp_clk_exit(void);
*/
extern void dsp_clk_init(void);
-void dsp_gpt_wait_overflow(short int clk_id, unsigned int load);
+int dsp_gpt_wait_overflow(short int clk_id, unsigned int load,
+ unsigned long timeout);
+
/*
* ======== dsp_clk_enable ========
--
1.6.3.3
next prev parent reply other threads:[~2010-10-26 0:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 0:51 [PATCH 0/8] staging: tidspbridge - misc fixes Fernando Guzman Lugo
2010-10-26 0:51 ` [PATCH 1/8] staging: tidspbridge - remove req_addr from proc_map Fernando Guzman Lugo
2010-10-26 0:51 ` [PATCH 2/8] staging: tidspbridge - add kconfig parameter for DMM size Fernando Guzman Lugo
2010-10-26 0:51 ` [PATCH 3/8] staging: tidspbridge - change mmufault tasklet to a workqueue Fernando Guzman Lugo
2010-10-26 0:51 ` Fernando Guzman Lugo [this message]
2010-10-26 0:51 ` [PATCH 5/8] staging: tidspbridge - use GTP7 for DSP stack dump Fernando Guzman Lugo
2010-10-26 0:51 ` [PATCH 6/8] staging: tidspbridge - remove disabling twl when printing DSP stack Fernando Guzman Lugo
2010-10-26 0:51 ` [PATCH 7/8] staging: tidspbridge - fix some issues after iommu patches Fernando Guzman Lugo
2010-10-26 0:51 ` [PATCH 8/8] staging: tidspbridge - make sync_wait_on_event interruptible Fernando Guzman Lugo
2010-10-26 0:58 ` Felipe Contreras
2010-10-26 15:50 ` Guzman Lugo, Fernando
2010-10-26 17:03 ` Felipe Contreras
2010-10-26 17:58 ` Guzman Lugo, Fernando
2010-10-26 19:27 ` Felipe Contreras
2010-10-26 20:01 ` Guzman Lugo, Fernando
2010-12-06 8:51 ` Ramirez Luna, Omar
2010-10-26 11:46 ` [PATCH 1/8] staging: tidspbridge - remove req_addr from proc_map Felipe Contreras
2010-10-26 15:52 ` Guzman Lugo, Fernando
2010-10-26 17:07 ` Felipe Contreras
2010-10-26 18:08 ` Guzman Lugo, Fernando
2010-10-26 19:37 ` Felipe Contreras
2010-10-26 20:39 ` Guzman Lugo, Fernando
2010-10-27 8:19 ` Felipe Contreras
2010-10-28 15:38 ` Guzman Lugo, Fernando
2010-10-28 15:56 ` Russell King - ARM Linux
2010-10-26 4:06 ` [PATCH 0/8] staging: tidspbridge - misc fixes Greg KH
2010-10-26 14:43 ` Felipe Contreras
2010-10-26 14:55 ` Omar Ramirez Luna
2010-10-26 15:46 ` Guzman Lugo, Fernando
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=1288054306-4361-5-git-send-email-x0095840@ti.com \
--to=x0095840@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=andy.shevchenko@gmail.com \
--cc=felipe.contreras@nokia.com \
--cc=gregkh@suse.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®