diff mbox

spi/amba-pl022: work in polling or interrupt mode if pl022_dma_probe fails

Message ID a105605733caadfea25034ce0b8af73eb907fd33.1305287569.git.viresh.kumar@st.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Viresh KUMAR May 13, 2011, 11:54 a.m. UTC
If pl022_dma_probe fails, we can try to transfer data in polling or interrupt
mode. Also, set platform_info->enable_dma to 0, so that no other code tries to
use dma.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
 drivers/spi/amba-pl022.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

Comments

viresh kumar May 13, 2011, 1:19 p.m. UTC | #1
On 5/13/11, Viresh Kumar <viresh.kumar@st.com> wrote:
> diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
> index 08de58e..82b98b8 100644
> --- a/drivers/spi/amba-pl022.c
> +++ b/drivers/spi/amba-pl022.c
> @@ -1063,7 +1063,7 @@ static int __init pl022_dma_probe(struct pl022 *pl022)
>  					    pl022->master_info->dma_filter,
>  					    pl022->master_info->dma_rx_param);
>  	if (!pl022->dma_rx_channel) {
> -		dev_err(&pl022->adev->dev, "no RX DMA channel!\n");
> +		dev_warn(&pl022->adev->dev, "no RX DMA channel!\n");

Sorry, this must be dev_dbg

>  		goto err_no_rxchan;
>  	}
>
> @@ -1071,13 +1071,13 @@ static int __init pl022_dma_probe(struct pl022
> *pl022)
>  					    pl022->master_info->dma_filter,
>  					    pl022->master_info->dma_tx_param);
>  	if (!pl022->dma_tx_channel) {
> -		dev_err(&pl022->adev->dev, "no TX DMA channel!\n");
> +		dev_warn(&pl022->adev->dev, "no TX DMA channel!\n");

                dev_dbg

>  		goto err_no_txchan;
>  	}
>
>  	pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL);
>  	if (!pl022->dummypage) {
> -		dev_err(&pl022->adev->dev, "no DMA dummypage!\n");
> +		dev_warn(&pl022->adev->dev, "no DMA dummypage!\n");

                dev_dbg

>  		goto err_no_dummypage;
>  	}
>
> @@ -1093,6 +1093,8 @@ err_no_txchan:
>  	dma_release_channel(pl022->dma_rx_channel);
>  	pl022->dma_rx_channel = NULL;
>  err_no_rxchan:
> +	dev_warn(&pl022->adev->dev,

        dev_err

> +			"Failed to work in dma mode, work without dma!\n");
>  	return -ENODEV;
>  }
>

Will resend patch on Monday. Till that time, please see if this patch
with mentioned changes is acceptable or not.

--
viresh

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
Linus Walleij May 13, 2011, 2:22 p.m. UTC | #2
2011/5/13 Viresh Kumar <viresh.kumar@st.com>:

> If pl022_dma_probe fails, we can try to transfer data in polling or interrupt
> mode. Also, set platform_info->enable_dma to 0, so that no other code tries to
> use dma.

Sure why not!
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
Grant Likely May 19, 2011, 7:20 p.m. UTC | #3
On Fri, May 13, 2011 at 06:49:39PM +0530, viresh kumar wrote:
> On 5/13/11, Viresh Kumar <viresh.kumar@st.com> wrote:
> > diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
> > index 08de58e..82b98b8 100644
> > --- a/drivers/spi/amba-pl022.c
> > +++ b/drivers/spi/amba-pl022.c
> > @@ -1063,7 +1063,7 @@ static int __init pl022_dma_probe(struct pl022 *pl022)
> >  					    pl022->master_info->dma_filter,
> >  					    pl022->master_info->dma_rx_param);
> >  	if (!pl022->dma_rx_channel) {
> > -		dev_err(&pl022->adev->dev, "no RX DMA channel!\n");
> > +		dev_warn(&pl022->adev->dev, "no RX DMA channel!\n");
> 
> Sorry, this must be dev_dbg

Please fixup and repost.  Add Linus' ack while you're at it.  :-)

Thanks,
g.

> 
> >  		goto err_no_rxchan;
> >  	}
> >
> > @@ -1071,13 +1071,13 @@ static int __init pl022_dma_probe(struct pl022
> > *pl022)
> >  					    pl022->master_info->dma_filter,
> >  					    pl022->master_info->dma_tx_param);
> >  	if (!pl022->dma_tx_channel) {
> > -		dev_err(&pl022->adev->dev, "no TX DMA channel!\n");
> > +		dev_warn(&pl022->adev->dev, "no TX DMA channel!\n");
> 
>                 dev_dbg
> 
> >  		goto err_no_txchan;
> >  	}
> >
> >  	pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL);
> >  	if (!pl022->dummypage) {
> > -		dev_err(&pl022->adev->dev, "no DMA dummypage!\n");
> > +		dev_warn(&pl022->adev->dev, "no DMA dummypage!\n");
> 
>                 dev_dbg
> 
> >  		goto err_no_dummypage;
> >  	}
> >
> > @@ -1093,6 +1093,8 @@ err_no_txchan:
> >  	dma_release_channel(pl022->dma_rx_channel);
> >  	pl022->dma_rx_channel = NULL;
> >  err_no_rxchan:
> > +	dev_warn(&pl022->adev->dev,
> 
>         dev_err
> 
> > +			"Failed to work in dma mode, work without dma!\n");
> >  	return -ENODEV;
> >  }
> >
> 
> Will resend patch on Monday. Till that time, please see if this patch
> with mentioned changes is acceptable or not.
> 
> --
> viresh
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
diff mbox

Patch

diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 08de58e..82b98b8 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -1063,7 +1063,7 @@  static int __init pl022_dma_probe(struct pl022 *pl022)
 					    pl022->master_info->dma_filter,
 					    pl022->master_info->dma_rx_param);
 	if (!pl022->dma_rx_channel) {
-		dev_err(&pl022->adev->dev, "no RX DMA channel!\n");
+		dev_warn(&pl022->adev->dev, "no RX DMA channel!\n");
 		goto err_no_rxchan;
 	}
 
@@ -1071,13 +1071,13 @@  static int __init pl022_dma_probe(struct pl022 *pl022)
 					    pl022->master_info->dma_filter,
 					    pl022->master_info->dma_tx_param);
 	if (!pl022->dma_tx_channel) {
-		dev_err(&pl022->adev->dev, "no TX DMA channel!\n");
+		dev_warn(&pl022->adev->dev, "no TX DMA channel!\n");
 		goto err_no_txchan;
 	}
 
 	pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!pl022->dummypage) {
-		dev_err(&pl022->adev->dev, "no DMA dummypage!\n");
+		dev_warn(&pl022->adev->dev, "no DMA dummypage!\n");
 		goto err_no_dummypage;
 	}
 
@@ -1093,6 +1093,8 @@  err_no_txchan:
 	dma_release_channel(pl022->dma_rx_channel);
 	pl022->dma_rx_channel = NULL;
 err_no_rxchan:
+	dev_warn(&pl022->adev->dev,
+			"Failed to work in dma mode, work without dma!\n");
 	return -ENODEV;
 }
 
@@ -2107,7 +2109,7 @@  pl022_probe(struct amba_device *adev, const struct amba_id *id)
 	if (platform_info->enable_dma) {
 		status = pl022_dma_probe(pl022);
 		if (status != 0)
-			goto err_no_dma;
+			platform_info->enable_dma = 0;
 	}
 
 	/* Initialize and start queue */
@@ -2143,7 +2145,6 @@  pl022_probe(struct amba_device *adev, const struct amba_id *id)
  err_init_queue:
 	destroy_queue(pl022);
 	pl022_dma_remove(pl022);
- err_no_dma:
 	free_irq(adev->irq[0], pl022);
  err_no_irq:
 	clk_put(pl022->clk);