aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-12-08 10:57:27 +0000
committerAlan Cox <alan@linux.intel.com>2010-12-08 10:57:27 +0000
commitee9f7a3b942dceaaaafbca38e574661d62865737 (patch)
treecd5619439d6314541a3a2e0c8ac2f1a527aa41e9
parent70c82f1dafc4494ec39b3149620bd63ab9550d3b (diff)
downloadmrst-s0i3-test-ee9f7a3b942dceaaaafbca38e574661d62865737.tar.gz
mrst-s0i3-test-ee9f7a3b942dceaaaafbca38e574661d62865737.tar.xz
mrst-s0i3-test-ee9f7a3b942dceaaaafbca38e574661d62865737.zip
Signed-off-by: Mark A. Allyn <mark.a.allyn@intel.com>
-rw-r--r--drivers/staging/sep/sep_driver.c110
1 files changed, 38 insertions, 72 deletions
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index d9db3cc9684..85d02c92aa7 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -3782,99 +3782,65 @@ end_function:
}
#if !SEP_DRIVER_POLLING_MODE
-
/*
- interrupt handler function
+ * Inerrupt Handler
+ * @irq: interrupt
+ * @dev_id: device id
*/
+
static irqreturn_t sep_inthandler(int irq, void *dev_id)
{
- irqreturn_t int_error;
- unsigned long reg_val;
- unsigned long flow_id;
- struct sep_flow_context_t *flow_context_ptr;
+ irqreturn_t int_error = IRQ_HANDLED;
+ u32 reg_val, reg_val2 = 0;
struct sep_device *sep = dev_id;
- int_error = IRQ_HANDLED;
-
/* read the IRR register to check if this is SEP interrupt */
reg_val = sep_read_reg(sep, HW_HOST_IRR_REG_ADDR);
- edbg("SEP Interrupt - reg is %08lx\n", reg_val);
-
- /* check if this is the flow interrupt */
- if (0 /*reg_val & (0x1 << 11) */ ) {
- /* read GPRO to find out the which flow is done */
- flow_id = sep_read_reg(sep, HW_HOST_IRR_REG_ADDR);
-
- /* find the contex of the flow */
- flow_context_ptr = sep_find_flow_context(sep, flow_id >> 28);
- if (flow_context_ptr == NULL)
- goto end_function_with_error;
-
- /* queue the work */
- INIT_WORK(&flow_context_ptr->flow_wq, sep_flow_done_handler);
- queue_work(sep->flow_wq, &flow_context_ptr->flow_wq);
-
- } else {
- /* check if this is reply interrupt from SEP */
- if (reg_val & (0x1 << 13)) {
- /* update the counter of reply messages */
- sep->reply_ct++;
- /* wake up the waiting process */
- wake_up(&sep_event);
- } else {
- int_error = IRQ_NONE;
- goto end_function;
- }
- }
-end_function_with_error:
- /* clear the interrupt */
- sep_write_reg(sep, HW_HOST_ICR_REG_ADDR, reg_val);
-end_function:
- return int_error;
-}
-
-#endif
-
+ dev_dbg(&sep->pdev->dev,
+ "SEP Interrupt - reg is %08x\n", reg_val);
+ if (reg_val & (0x1 << 13)) {
-#if 0
+ /* update the counter of reply messages */
+ /* must be locked */
+ spin_lock_irqsave(&snd_rply_lck, snd_rply_lck_flag);
+ sep->reply_ct++;
+ spin_unlock_irqrestore(&snd_rply_lck, snd_rply_lck_flag);
-static void sep_wait_busy(struct sep_device *sep)
-{
- u32 reg;
-
- do {
- reg = sep_read_reg(sep, HW_HOST_SEP_BUSY_REG_ADDR);
- } while (reg);
-}
+ dev_dbg(&sep->pdev->dev, "sep int: send_ct %lx reply_ct %lx\n",
+ sep->send_ct, sep->reply_ct);
-/*
- PATCH for configuring the DMA to single burst instead of multi-burst
-*/
-static void sep_configure_dma_burst(struct sep_device *sep)
-{
-#define HW_AHB_RD_WR_BURSTS_REG_ADDR 0x0E10UL
+ /* is this printf or daemon request? */
+ reg_val2 = sep_read_reg(sep, HW_HOST_SEP_HOST_GPR2_REG_ADDR);
+ dev_dbg(&sep->pdev->dev,
+ "SEP Interrupt - reg2 is %08x\n", reg_val2);
- dbg("SEP Driver:<-------- sep_configure_dma_burst start \n");
+ if ((reg_val2 >> 30) & 0x1) {
- /* request access to registers from SEP */
- sep_write_reg(sep, HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x2);
+ dev_dbg(&sep->pdev->dev, "int: printf request\n");
+ wake_up(&sep->event_request_daemon);
+ }
- dbg("SEP Driver:<-------- sep_configure_dma_burst finished request access to registers from SEP (write reg) \n");
+ else if (reg_val2 >> 31) {
- sep_wait_busy(sep);
+ dev_dbg(&sep->pdev->dev, "int: daemon request\n");
+ wake_up(&sep->event_request_daemon);
+ } else {
- dbg("SEP Driver:<-------- sep_configure_dma_burst finished request access to registers from SEP (while(revVal) wait loop) \n");
+ dev_dbg(&sep->pdev->dev, "int: sep reply\n");
+ wake_up(&sep->event);
+ }
- /* set the DMA burst register to single burst */
- sep_write_reg(sep, HW_AHB_RD_WR_BURSTS_REG_ADDR, 0x0UL);
+ } else {
- /* release the sep busy */
- sep_write_reg(sep, HW_HOST_HOST_SEP_GPR0_REG_ADDR, 0x0UL);
- sep_wait_busy(sep);
+ dev_dbg(&sep->pdev->dev, "int: not sep interrupt\n");
+ int_error = IRQ_NONE;
+ }
- dbg("SEP Driver:<-------- sep_configure_dma_burst done \n");
+ if (int_error == IRQ_HANDLED)
+ sep_write_reg(sep, HW_HOST_ICR_REG_ADDR, reg_val);
+ return int_error;
}
#endif