2012-08-07 07:47:46

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH] spi: omap2-mcspi: In case of dma errors fall back to pio

* Shubhrajyoti D <[email protected]> [120724 23:26]:
> In case there are dma errors currently the driver exits.
> Make the spi driver fall back to pio mode in case of dma errors.
>
> If the DMA engine is not selected the driver
> exits.This patch makes the spi fall back to pio in that case.
>
> Also adds a field dma_unusable to struct omap2_mcspi.
>
> Signed-off-by: Shubhrajyoti D <[email protected]>
> ---
> drivers/spi/spi-omap2-mcspi.c | 21 +++++++++++++--------
> 1 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index bc47781..f243a39 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -129,6 +129,7 @@ struct omap2_mcspi {
> struct omap2_mcspi_dma *dma_channels;
> struct device *dev;
> struct omap2_mcspi_regs ctx;
> + int dma_unusable;
> };

Don't you need to check separately for rx and tx dma? There's a slight
chance that you get a channel for one but not for the other..

Tony


2012-08-07 11:21:26

by Shubhrajyoti D

[permalink] [raw]
Subject: Re: [PATCH] spi: omap2-mcspi: In case of dma errors fall back to pio

On Tuesday 07 August 2012 01:17 PM, Tony Lindgren wrote:
>> };
> Don't you need to check separately for rx and tx dma? There's a slight
> chance that you get a channel for one but not for the other..
In that case I treat it as non usable and fall back to pio.

Are you suggesting that let one channel be dma and only the failed one pio?

2012-08-07 12:02:33

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH] spi: omap2-mcspi: In case of dma errors fall back to pio

* Shubhrajyoti <[email protected]> [120807 04:21]:
> On Tuesday 07 August 2012 01:17 PM, Tony Lindgren wrote:
> >> };
> > Don't you need to check separately for rx and tx dma? There's a slight
> > chance that you get a channel for one but not for the other..
> In that case I treat it as non usable and fall back to pio.

OK that should work too.

> Are you suggesting that let one channel be dma and only the failed one pio?

I guess both are doable. For reduced CPU load using DMA where possible
of course is the best way to go.

Tony

2012-08-07 12:25:12

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH] spi: omap2-mcspi: In case of dma errors fall back to pio

Hi,

On Tue, Aug 07, 2012 at 05:02:27AM -0700, Tony Lindgren wrote:
> * Shubhrajyoti <[email protected]> [120807 04:21]:
> > On Tuesday 07 August 2012 01:17 PM, Tony Lindgren wrote:
> > >> };
> > > Don't you need to check separately for rx and tx dma? There's a slight
> > > chance that you get a channel for one but not for the other..
> > In that case I treat it as non usable and fall back to pio.
>
> OK that should work too.
>
> > Are you suggesting that let one channel be dma and only the failed one pio?
>
> I guess both are doable. For reduced CPU load using DMA where possible
> of course is the best way to go.

indeed. if you can get DMA for TX but not for RX, then at least TX can
go via DMA ;-)

--
balbi


Attachments:
(No filename) (727.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments