public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP: Fix possible un-initialized waitqueue in McBSP
@ 2008-09-19 13:36 Jarkko Nikula
  2008-09-22 13:30 ` Jarkko Nikula
  2008-09-22 13:47 ` [PATCH] ARM: OMAP: Fixes to omap_mcbsp_request function Jarkko Nikula
  0 siblings, 2 replies; 4+ messages in thread
From: Jarkko Nikula @ 2008-09-19 13:36 UTC (permalink / raw)
  To: linux-omap; +Cc: Jarkko Nikula

TX or RX irq waitqueues are un-initialized if interrupt would occur
immediately after requesting it. I don't know is it HW failure, but one
Beagle board is showing spurious TX interrupt from McBSP2 (and only from it)
just after requesting it.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
 arch/arm/plat-omap/mcbsp.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 7d32437..1b5d709 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -236,6 +236,7 @@ int omap_mcbsp_request(unsigned int id)
 
 	if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
 		/* We need to get IRQs here */
+		init_completion(&mcbsp->tx_irq_completion);
 		err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler,
 					0, "McBSP", (void *)mcbsp);
 		if (err != 0) {
@@ -245,8 +246,7 @@ int omap_mcbsp_request(unsigned int id)
 			return err;
 		}
 
-		init_completion(&mcbsp->tx_irq_completion);
-
+		init_completion(&mcbsp->rx_irq_completion);
 		err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler,
 					0, "McBSP", (void *)mcbsp);
 		if (err != 0) {
@@ -256,8 +256,6 @@ int omap_mcbsp_request(unsigned int id)
 			free_irq(mcbsp->tx_irq, (void *)mcbsp);
 			return err;
 		}
-
-		init_completion(&mcbsp->rx_irq_completion);
 	}
 
 	return 0;
-- 
1.5.6.5


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

* Re: [PATCH] ARM: OMAP: Fix possible un-initialized waitqueue in McBSP
  2008-09-19 13:36 [PATCH] ARM: OMAP: Fix possible un-initialized waitqueue in McBSP Jarkko Nikula
@ 2008-09-22 13:30 ` Jarkko Nikula
  2008-09-22 13:47 ` [PATCH] ARM: OMAP: Fixes to omap_mcbsp_request function Jarkko Nikula
  1 sibling, 0 replies; 4+ messages in thread
From: Jarkko Nikula @ 2008-09-22 13:30 UTC (permalink / raw)
  To: linux-omap

On Fri, 19 Sep 2008 16:36:38 +0300
Jarkko Nikula <jarkko.nikula@nokia.com> wrote:

> TX or RX irq waitqueues are un-initialized if interrupt would occur
> immediately after requesting it. I don't know is it HW failure, but one
> Beagle board is showing spurious TX interrupt from McBSP2 (and only from it)
> just after requesting it.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
> ---
>  arch/arm/plat-omap/mcbsp.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
Dismiss this. I'll send a better version fixing this and the actual reason why this TX interrupt is occurring immediately from Beagle McBSP2 (bootloader let it running).


Jarkko

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

* [PATCH] ARM: OMAP: Fixes to omap_mcbsp_request function
  2008-09-19 13:36 [PATCH] ARM: OMAP: Fix possible un-initialized waitqueue in McBSP Jarkko Nikula
  2008-09-22 13:30 ` Jarkko Nikula
@ 2008-09-22 13:47 ` Jarkko Nikula
  2008-09-24  9:11   ` Tony Lindgren
  1 sibling, 1 reply; 4+ messages in thread
From: Jarkko Nikula @ 2008-09-22 13:47 UTC (permalink / raw)
  To: linux-omap; +Cc: Jarkko Nikula

Bootloader may let McBSP logic running so make sure that block is idle
before requesting IRQs. Also make sure that TX and RX waitqueues are
initialized before request_irq.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
---
 arch/arm/plat-omap/mcbsp.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 7d32437..798c91e 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -234,8 +234,16 @@ int omap_mcbsp_request(unsigned int id)
 	mcbsp->free = 0;
 	spin_unlock(&mcbsp->lock);
 
+	/*
+	 * Make sure that transmitter, receiver and sample-rate generator are
+	 * not running before activating IRQs.
+	 */
+	OMAP_MCBSP_WRITE(mcbsp->io_base, SPCR1, 0);
+	OMAP_MCBSP_WRITE(mcbsp->io_base, SPCR2, 0);
+
 	if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
 		/* We need to get IRQs here */
+		init_completion(&mcbsp->tx_irq_completion);
 		err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler,
 					0, "McBSP", (void *)mcbsp);
 		if (err != 0) {
@@ -245,8 +253,7 @@ int omap_mcbsp_request(unsigned int id)
 			return err;
 		}
 
-		init_completion(&mcbsp->tx_irq_completion);
-
+		init_completion(&mcbsp->rx_irq_completion);
 		err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler,
 					0, "McBSP", (void *)mcbsp);
 		if (err != 0) {
@@ -256,8 +263,6 @@ int omap_mcbsp_request(unsigned int id)
 			free_irq(mcbsp->tx_irq, (void *)mcbsp);
 			return err;
 		}
-
-		init_completion(&mcbsp->rx_irq_completion);
 	}
 
 	return 0;
-- 
1.5.6.5


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

* Re: [PATCH] ARM: OMAP: Fixes to omap_mcbsp_request function
  2008-09-22 13:47 ` [PATCH] ARM: OMAP: Fixes to omap_mcbsp_request function Jarkko Nikula
@ 2008-09-24  9:11   ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2008-09-24  9:11 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-omap

* Jarkko Nikula <jarkko.nikula@nokia.com> [080922 16:48]:
> Bootloader may let McBSP logic running so make sure that block is idle
> before requesting IRQs. Also make sure that TX and RX waitqueues are
> initialized before request_irq.

Pushing today and adding to upstream queue for RMK.

Tony

> Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
> ---
>  arch/arm/plat-omap/mcbsp.c |   13 +++++++++----
>  1 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
> index 7d32437..798c91e 100644
> --- a/arch/arm/plat-omap/mcbsp.c
> +++ b/arch/arm/plat-omap/mcbsp.c
> @@ -234,8 +234,16 @@ int omap_mcbsp_request(unsigned int id)
>  	mcbsp->free = 0;
>  	spin_unlock(&mcbsp->lock);
>  
> +	/*
> +	 * Make sure that transmitter, receiver and sample-rate generator are
> +	 * not running before activating IRQs.
> +	 */
> +	OMAP_MCBSP_WRITE(mcbsp->io_base, SPCR1, 0);
> +	OMAP_MCBSP_WRITE(mcbsp->io_base, SPCR2, 0);
> +
>  	if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
>  		/* We need to get IRQs here */
> +		init_completion(&mcbsp->tx_irq_completion);
>  		err = request_irq(mcbsp->tx_irq, omap_mcbsp_tx_irq_handler,
>  					0, "McBSP", (void *)mcbsp);
>  		if (err != 0) {
> @@ -245,8 +253,7 @@ int omap_mcbsp_request(unsigned int id)
>  			return err;
>  		}
>  
> -		init_completion(&mcbsp->tx_irq_completion);
> -
> +		init_completion(&mcbsp->rx_irq_completion);
>  		err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler,
>  					0, "McBSP", (void *)mcbsp);
>  		if (err != 0) {
> @@ -256,8 +263,6 @@ int omap_mcbsp_request(unsigned int id)
>  			free_irq(mcbsp->tx_irq, (void *)mcbsp);
>  			return err;
>  		}
> -
> -		init_completion(&mcbsp->rx_irq_completion);
>  	}
>  
>  	return 0;
> -- 
> 1.5.6.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2008-09-24  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-19 13:36 [PATCH] ARM: OMAP: Fix possible un-initialized waitqueue in McBSP Jarkko Nikula
2008-09-22 13:30 ` Jarkko Nikula
2008-09-22 13:47 ` [PATCH] ARM: OMAP: Fixes to omap_mcbsp_request function Jarkko Nikula
2008-09-24  9:11   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox