Skip to contentSkip to conversation

dw_spi: Allow interrupt sharing

PATCH In review Yong Wang 2 participants 3 messages Sep 7, 2010 – Sep 9, 2010 SPI

lore
Share & tools
lore

Yong Wang

author
#0 lore raw

PATCH 1/1 dw_spi: Allow interrupt sharing

Allow interrupt sharing since exclusive interrupt line for DW SPI controller is not provided on every platform.

---
 drivers/spi/dw_spi.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/spi/dw_spi.c +6 -1
index d256cb0..11fbbf6 100644
@@ -396,6 +396,11 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
 static irqreturn_t dw_spi_irq(int irq, void *dev_id)
 {
 	struct dw_spi *dws = dev_id;
+	u16 irq_status, irq_mask = 0x3f;
+
+	irq_status = dw_readw(dws, isr) & irq_mask;
+	if (!irq_status)
+		return IRQ_NONE;
 
 	if (!dws->cur_msg) {
 		spi_mask_intr(dws, SPI_INT_TXEI);
@@ -883,7 +888,7 @@ int __devinit dw_spi_add_host(struct dw_spi *dws)
 	dws->dma_inited = 0;
 	dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60);
 
-	ret = request_irq(dws->irq, dw_spi_irq, 0,
+	ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED,
 			"dw_spi", dws);
 	if (ret < 0) {
 		dev_err(&master->dev, "can not get IRQ\n");
Signature · 1 line
1.5.5.1
#1 lore raw
Quoted 13 lines · Yong Wang

Allow interrupt sharing since exclusive interrupt line for DW SPI controller is not provided on every platform.

---
 drivers/spi/dw_spi.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/spi/dw_spi.c +0 -0
index d256cb0..11fbbf6 100644

drivers/spi/dw_spi.c static irqreturn_t interrupt_transfer(struct dw_spi *dws) · line 403

Quoted 8 lines
drivers/spi/dw_spi.c +5 -0
@@ -396,6 +396,11 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
 static irqreturn_t dw_spi_irq(int irq, void *dev_id)
 {
 	struct dw_spi *dws = dev_id;
+	u16 irq_status, irq_mask = 0x3f;
+
+	irq_status = dw_readw(dws, isr) & irq_mask;
+	if (!irq_status)
+		return IRQ_NONE;

To be more concise, this could have simply been:

if (!dw_readw(dws, isr) & 0x3f)

	return IRQ_NONE;

... but I'm nitpicking here. If I don't get an updated version of this patch from you in the next few days then I'll apply this one.

g.

Quoted 15 lines
drivers/spi/dw_spi.c +1 -1
 	if (!dws->cur_msg) {
 		spi_mask_intr(dws, SPI_INT_TXEI);
@@ -883,7 +888,7 @@ int __devinit dw_spi_add_host(struct dw_spi *dws)
 	dws->dma_inited = 0;
 	dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60);
 
-	ret = request_irq(dws->irq, dw_spi_irq, 0,
+	ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED,
 			"dw_spi", dws);
 	if (ret < 0) {
 		dev_err(&master->dev, "can not get IRQ\n");
Signature · 1 line
1.5.5.1
author
#2 lore raw
Quoted 25 lines · Grant Likely
Quoted 13 lines · Yong Wang

Allow interrupt sharing since exclusive interrupt line for DW SPI controller is not provided on every platform.

---
 drivers/spi/dw_spi.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/spi/dw_spi.c +0 -0
index d256cb0..11fbbf6 100644

drivers/spi/dw_spi.c static irqreturn_t interrupt_transfer(struct dw_spi *dws) · line 403

Quoted 8 lines
drivers/spi/dw_spi.c +5 -0
@@ -396,6 +396,11 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
 static irqreturn_t dw_spi_irq(int irq, void *dev_id)
 {
 	struct dw_spi *dws = dev_id;
+	u16 irq_status, irq_mask = 0x3f;
+
+	irq_status = dw_readw(dws, isr) & irq_mask;
+	if (!irq_status)
+		return IRQ_NONE;

To be more concise, this could have simply been:

Quoted 6 lines

if (!dw_readw(dws, isr) & 0x3f)

	return IRQ_NONE;

... but I'm nitpicking here. If I don't get an updated version of this patch from you in the next few days then I'll apply this one.

Thanks for your comments, Grant. Could you please apply the patch as is? I think it is more readable. In addition, it is consistent with other parts of the driver in terms of how isr register is manipulated.

Thanks
-Yong