linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs
@ 2011-04-11  6:53 Voss, Nikolaus
  2011-04-11  8:50 ` Nicolas Ferre
  2011-04-18  8:29 ` Nicolas Ferre
  0 siblings, 2 replies; 5+ messages in thread
From: Voss, Nikolaus @ 2011-04-11  6:53 UTC (permalink / raw)
  To: 'Linux Kernel'; +Cc: 'Nicolas Ferre'

When restarting a kernel using kexec, filled rx buffers on SPI master
interface reliably crash the kernel. This patch disables rx interrupts
on startup to avoid this. Interrupts will be regulary enabled at start
of a new SPI master transfer.

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
---
 drivers/spi/atmel_spi.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 1a478bf..d17f14c 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -811,6 +811,9 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
 	as->irq = irq;
 	as->clk = clk;
 
+	/* disable rx interrupts to avoid premature irq triggering */
+	spi_writel(as, IDR, SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES));
+
 	ret = request_irq(irq, atmel_spi_interrupt, 0,
 			dev_name(&pdev->dev), master);
 	if (ret)
-- 
1.5.4.3


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

* Re: [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs
  2011-04-11  6:53 [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs Voss, Nikolaus
@ 2011-04-11  8:50 ` Nicolas Ferre
  2011-04-11  9:38   ` Voss, Nikolaus
  2011-04-18  8:29 ` Nicolas Ferre
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2011-04-11  8:50 UTC (permalink / raw)
  To: Voss, Nikolaus; +Cc: 'Linux Kernel'

Le 11/04/2011 08:53, Voss, Nikolaus :
> When restarting a kernel using kexec, filled rx buffers on SPI master
> interface reliably crash the kernel. This patch disables rx interrupts
> on startup to avoid this. Interrupts will be regulary enabled at start
> of a new SPI master transfer.
> 
> Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
> ---
>  drivers/spi/atmel_spi.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
> index 1a478bf..d17f14c 100644
> --- a/drivers/spi/atmel_spi.c
> +++ b/drivers/spi/atmel_spi.c
> @@ -811,6 +811,9 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
>  	as->irq = irq;
>  	as->clk = clk;
>  
> +	/* disable rx interrupts to avoid premature irq triggering */
> +	spi_writel(as, IDR, SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES));
> +

What about something like this?

/* disable all interrupts to avoid premature irq triggering */
spi_writel(as, IDR, 0xffffffff);


>  	ret = request_irq(irq, atmel_spi_interrupt, 0,
>  			dev_name(&pdev->dev), master);
>  	if (ret)

Best regards,
-- 
Nicolas Ferre


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

* RE: [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs
  2011-04-11  8:50 ` Nicolas Ferre
@ 2011-04-11  9:38   ` Voss, Nikolaus
  2011-04-18  8:29     ` Nicolas Ferre
  0 siblings, 1 reply; 5+ messages in thread
From: Voss, Nikolaus @ 2011-04-11  9:38 UTC (permalink / raw)
  To: 'Nicolas Ferre'; +Cc: 'Linux Kernel'

Hi,

> What about something like this?
> 
> /* disable all interrupts to avoid premature irq triggering */
> spi_writel(as, IDR, 0xffffffff);

I implemented it this way the first time, but on a second approach I used
the more specific variant.

That way it is kept symmetric to the irq enable part in the transfer method
which enables no more than the irqs disabled in my patch. And I generally
feel better when not writing live values to don't care bits ;-).

It's a matter of taste after all.

Best regards,
Nikolaus Voss


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

* Re: [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs
  2011-04-11  9:38   ` Voss, Nikolaus
@ 2011-04-18  8:29     ` Nicolas Ferre
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2011-04-18  8:29 UTC (permalink / raw)
  To: Voss, Nikolaus; +Cc: 'Linux Kernel'

Le 11/04/2011 11:38, Voss, Nikolaus :
> Hi,
> 
>> What about something like this?
>>
>> /* disable all interrupts to avoid premature irq triggering */
>> spi_writel(as, IDR, 0xffffffff);
> 
> I implemented it this way the first time, but on a second approach I used
> the more specific variant.
> 
> That way it is kept symmetric to the irq enable part in the transfer method
> which enables no more than the irqs disabled in my patch. And I generally
> feel better when not writing live values to don't care bits ;-).

That makes sense. I add my ACK.

Bye,
-- 
Nicolas Ferre


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

* Re: [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs
  2011-04-11  6:53 [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs Voss, Nikolaus
  2011-04-11  8:50 ` Nicolas Ferre
@ 2011-04-18  8:29 ` Nicolas Ferre
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2011-04-18  8:29 UTC (permalink / raw)
  To: Voss, Nikolaus; +Cc: 'Linux Kernel'

Le 11/04/2011 08:53, Voss, Nikolaus :
> When restarting a kernel using kexec, filled rx buffers on SPI master
> interface reliably crash the kernel. This patch disables rx interrupts
> on startup to avoid this. Interrupts will be regulary enabled at start
> of a new SPI master transfer.
> 
> Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/spi/atmel_spi.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
> index 1a478bf..d17f14c 100644
> --- a/drivers/spi/atmel_spi.c
> +++ b/drivers/spi/atmel_spi.c
> @@ -811,6 +811,9 @@ static int __init atmel_spi_probe(struct platform_device *pdev)
>  	as->irq = irq;
>  	as->clk = clk;
>  
> +	/* disable rx interrupts to avoid premature irq triggering */
> +	spi_writel(as, IDR, SPI_BIT(RXBUFF) | SPI_BIT(ENDRX) | SPI_BIT(OVRES));
> +
>  	ret = request_irq(irq, atmel_spi_interrupt, 0,
>  			dev_name(&pdev->dev), master);
>  	if (ret)


-- 
Nicolas Ferre


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

end of thread, other threads:[~2011-04-18  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-11  6:53 [PATCH] drivers/spi/atmel_spi.c: prevent premature irqs Voss, Nikolaus
2011-04-11  8:50 ` Nicolas Ferre
2011-04-11  9:38   ` Voss, Nikolaus
2011-04-18  8:29     ` Nicolas Ferre
2011-04-18  8:29 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).