From: Rob Rice <rob.rice@broadcom.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org,
Steve Lin <steven.lin1@broadcom.com>,
Rob Rice <rob.rice@broadcom.com>
Subject: [PATCH 10/11] mailbox: bcm-pdc: Simplify interrupt handler logic
Date: Mon, 14 Nov 2016 13:26:04 -0500 [thread overview]
Message-ID: <1479147965-29662-11-git-send-email-rob.rice@broadcom.com> (raw)
In-Reply-To: <1479147965-29662-1-git-send-email-rob.rice@broadcom.com>
Earlier versions of the PDC driver registered for both
transmit and receive interrupts. The hard IRQ handler had to
communicate to the soft handler which interrupt(s) had occurred.
The PDC driver no longer registers for tx interrupts. So there is
no reason to save the intstatus. So remove the intstatus member
of the PDC state.
Signed-off-by: Rob Rice <rob.rice@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
---
drivers/mailbox/bcm-pdc-mailbox.c | 38 +++++++++++++-------------------------
1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c
index 8c2aa7c..c1ec17c 100644
--- a/drivers/mailbox/bcm-pdc-mailbox.c
+++ b/drivers/mailbox/bcm-pdc-mailbox.c
@@ -298,14 +298,6 @@ struct pdc_state {
unsigned int pdc_irq;
- /*
- * Last interrupt status read from PDC device. Saved in interrupt
- * handler so the handler can clear the interrupt in the device,
- * and the interrupt thread called later can know which interrupt
- * bits are active.
- */
- unsigned long intstatus;
-
/* tasklet for deferred processing after DMA rx interrupt */
struct tasklet_struct rx_tasklet;
@@ -955,32 +947,30 @@ static irqreturn_t pdc_irq_handler(int irq, void *data)
struct pdc_state *pdcs = dev_get_drvdata(dev);
u32 intstatus = ioread32(pdcs->pdc_reg_vbase + PDC_INTSTATUS_OFFSET);
- if (likely(intstatus & PDC_RCVINTEN_0))
- set_bit(PDC_RCVINT_0, &pdcs->intstatus);
-
- /* Clear interrupt flags in device */
- iowrite32(intstatus, pdcs->pdc_reg_vbase + PDC_INTSTATUS_OFFSET);
+ if (unlikely(intstatus == 0))
+ return IRQ_NONE;
/* Disable interrupts until soft handler runs */
iowrite32(0, pdcs->pdc_reg_vbase + PDC_INTMASK_OFFSET);
+ /* Clear interrupt flags in device */
+ iowrite32(intstatus, pdcs->pdc_reg_vbase + PDC_INTSTATUS_OFFSET);
+
/* Wakeup IRQ thread */
- if (likely(pdcs && (irq == pdcs->pdc_irq) &&
- (intstatus & PDC_INTMASK))) {
- tasklet_schedule(&pdcs->rx_tasklet);
- return IRQ_HANDLED;
- }
- return IRQ_NONE;
+ tasklet_schedule(&pdcs->rx_tasklet);
+ return IRQ_HANDLED;
}
+/**
+ * pdc_tasklet_cb() - Tasklet callback that runs the deferred processing after
+ * a DMA receive interrupt. Reenables the receive interrupt.
+ * @data: PDC state structure
+ */
static void pdc_tasklet_cb(unsigned long data)
{
struct pdc_state *pdcs = (struct pdc_state *)data;
- bool rx_int;
- rx_int = test_and_clear_bit(PDC_RCVINT_0, &pdcs->intstatus);
- if (likely(pdcs && rx_int))
- pdc_receive(pdcs);
+ pdc_receive(pdcs);
/* reenable interrupts */
iowrite32(PDC_INTMASK, pdcs->pdc_reg_vbase + PDC_INTMASK_OFFSET);
@@ -1405,8 +1395,6 @@ static int pdc_interrupts_init(struct pdc_state *pdcs)
struct device_node *dn = pdev->dev.of_node;
int err;
- pdcs->intstatus = 0;
-
/* interrupt configuration */
iowrite32(PDC_INTMASK, pdcs->pdc_reg_vbase + PDC_INTMASK_OFFSET);
iowrite32(PDC_LAZY_INT, pdcs->pdc_reg_vbase + PDC_RCVLAZY0_OFFSET);
--
2.1.0
next prev parent reply other threads:[~2016-11-14 18:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-14 18:25 [PATCH 00/11] Update Broadcom PDC Mailbox Driver Rob Rice
2016-11-14 18:25 ` [PATCH 01/11] mailbox: bcm-pdc: Use octal permissions rather than symbolic Rob Rice
2016-11-14 18:25 ` [PATCH 02/11] mailbox: bcm-pdc: Changes so mbox client can be removed / re-inserted Rob Rice
2016-11-14 18:25 ` [PATCH 03/11] mailbox: bcm-pdc: PDC driver leaves debugfs files after removal Rob Rice
2016-11-14 18:25 ` [PATCH 04/11] mailbox: bcm-pdc: Convert from interrupts to poll for tx done Rob Rice
2016-11-14 18:25 ` [PATCH 05/11] mailbox: bcm-pdc: streamline rx code Rob Rice
2016-11-14 18:26 ` [PATCH 06/11] mailbox: bcm-pdc: Try to improve branch prediction Rob Rice
2016-11-14 18:26 ` [PATCH 07/11] mailbox: bcm-pdc: Convert from threaded IRQ to tasklet Rob Rice
2016-11-14 18:26 ` [PATCH 08/11] mailbox: bcm-pdc: Don't use iowrite32 to write DMA descriptors Rob Rice
2016-11-14 18:26 ` [PATCH 09/11] mailbox: bcm-pdc: Performance improvements Rob Rice
2016-11-14 18:26 ` Rob Rice [this message]
2016-11-14 18:26 ` [PATCH 11/11] mailbox: bcm-pdc: Remove unnecessary void* casts Rob Rice
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=1479147965-29662-11-git-send-email-rob.rice@broadcom.com \
--to=rob.rice@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steven.lin1@broadcom.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.