All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dw_spi: Allow interrupt sharing
@ 2010-09-07  7:27 ` Yong Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Yong Wang @ 2010-09-07  7:27 UTC (permalink / raw)
  To: David Brownell, Grant Likely, Feng Tang, George Shore,
	Andrew Morton, Jean-Hugues Deschenes
  Cc: spi-devel-general, linux-kernel

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

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
---
 drivers/spi/dw_spi.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
index d256cb0..11fbbf6 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/dw_spi.c
@@ -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");
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] dw_spi: Allow interrupt sharing
@ 2010-09-07  7:27 ` Yong Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Yong Wang @ 2010-09-07  7:27 UTC (permalink / raw)
  To: David Brownell, Grant Likely, Feng Tang, George Shore, Andrew Morton
  Cc: spi-devel-general, linux-kernel

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

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
---
 drivers/spi/dw_spi.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
index d256cb0..11fbbf6 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/dw_spi.c
@@ -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");
-- 
1.5.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dw_spi: Allow interrupt sharing
  2010-09-07  7:27 ` Yong Wang
  (?)
@ 2010-09-08 16:53 ` Grant Likely
  2010-09-09  5:08   ` Yong Wang
  -1 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2010-09-08 16:53 UTC (permalink / raw)
  To: Yong Wang
  Cc: David Brownell, Feng Tang, George Shore, Andrew Morton,
	Jean-Hugues Deschenes, spi-devel-general, linux-kernel

On Tue, Sep 07, 2010 at 03:27:27PM +0800, Yong Wang wrote:
> Allow interrupt sharing since exclusive interrupt line for
> DW SPI controller is not provided on every platform.
> 
> Signed-off-by: Yong Wang <yong.y.wang@intel.com>
> ---
>  drivers/spi/dw_spi.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
> index d256cb0..11fbbf6 100644
> --- a/drivers/spi/dw_spi.c
> +++ b/drivers/spi/dw_spi.c
> @@ -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.

>  
>  	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");
> -- 
> 1.5.5.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dw_spi: Allow interrupt sharing
  2010-09-08 16:53 ` Grant Likely
@ 2010-09-09  5:08   ` Yong Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Yong Wang @ 2010-09-09  5:08 UTC (permalink / raw)
  To: Grant Likely
  Cc: David Brownell, Feng Tang, George Shore, Andrew Morton,
	Jean-Hugues Deschenes, spi-devel-general, linux-kernel

On Wed, Sep 08, 2010 at 10:53:41AM -0600, Grant Likely wrote:
> On Tue, Sep 07, 2010 at 03:27:27PM +0800, Yong Wang wrote:
> > Allow interrupt sharing since exclusive interrupt line for
> > DW SPI controller is not provided on every platform.
> > 
> > Signed-off-by: Yong Wang <yong.y.wang@intel.com>
> > ---
> >  drivers/spi/dw_spi.c |    7 ++++++-
> >  1 files changed, 6 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
> > index d256cb0..11fbbf6 100644
> > --- a/drivers/spi/dw_spi.c
> > +++ b/drivers/spi/dw_spi.c
> > @@ -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.
> 

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-09  5:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-07  7:27 [PATCH] dw_spi: Allow interrupt sharing Yong Wang
2010-09-07  7:27 ` Yong Wang
2010-09-08 16:53 ` Grant Likely
2010-09-09  5:08   ` Yong Wang

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.