RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-16 Thread Robin Gong
On 2020/06/16 18:27 Mark Brown wrote: > On Tue, Jun 16, 2020 at 10:13:08AM +, Robin Gong wrote: > > So rename to SPI_TRANS_DMA_FAIL? I think at least DMA is MUST for > > fallback case... > > This is not purely for DMA, it's just about the failure having occurred > before the > transfer start

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-16 Thread Mark Brown
On Tue, Jun 16, 2020 at 10:13:08AM +, Robin Gong wrote: > On 2020/06/16 Mark Brown wrote: > > I'd just make this a generic flag for failures before we start interacting > > with the > > hardware rather than specifically this one error case. Otherwise this looks > > fine. > So rename to SPI

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-16 Thread Robin Gong
On 2020/06/16 Mark Brown wrote: > On Tue, Jun 16, 2020 at 02:03:40AM +, Robin Gong wrote: > > struct list_head transfer_list; > > + > > +#defineSPI_TRANS_DMA_PREP_FAIL BIT(3) /* prepare dma > failed */ > > + u16 flags; > > I'd just make this a generic flag f

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-16 Thread Mark Brown
On Tue, Jun 16, 2020 at 02:03:40AM +, Robin Gong wrote: > On 2020/06/15 22:56 Mark Brown wrote: > struct list_head transfer_list; > + > +#defineSPI_TRANS_DMA_PREP_FAIL BIT(3) /* prepare dma failed */ > + u16 flags; I'd just make this a generic flag for fai

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Robin Gong
On 2020/06/15 Vinod Koul wrote: > Hi Robin, > > On 15-06-20, 08:59, Robin Gong wrote: > > Hi Vinod, > > Is there any way to let the device driver to know dma controller is > > ready (in sdma case is sdma firmware loaded or not)before prep_call? > > Hence, spi core could map dma buffer or not.

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Robin Gong
On 2020/06/15 22:56 Mark Brown wrote: > On Mon, Jun 15, 2020 at 02:53:29PM +, Robin Gong wrote: > > Do you mean spi-imx.c checking 'ctlr->flags' before return such error code? > > Or just like below done in spi.c. > > No, I mean passing in an additional argument which can provide richer dat

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Mark Brown
On Mon, Jun 15, 2020 at 02:53:29PM +, Robin Gong wrote: > On 2020/06/15 22:36 Mark Brown wrote: > > We could also pass in a flag that could be set separately to the error code > > to > > indicate that nothing had happened to the hardware yet. > Do you mean spi-imx.c checking 'ctlr->flags'

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Robin Gong
On 2020/06/15 22:36 Mark Brown wrote: > On Mon, Jun 15, 2020 at 02:18:54PM +, Robin Gong wrote: > > Seems not easy to find a suitable error value, how about EBADR which > > sounds like no any available dma_async_tx_descriptor got by calling > dmaengine_prep_slave_sg? > > > #define EBADR

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Mark Brown
On Mon, Jun 15, 2020 at 02:18:54PM +, Robin Gong wrote: > On 2020/06/15 21:39 Mark Brown wrote: > > On Mon, Jun 15, 2020 at 01:35:01PM +, Robin Gong wrote: > > > Then how about choosing specific error code for such dma not ready > > > case where nothing went out on the bus neither? > > Y

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Robin Gong
On 2020/06/15 21:39 Mark Brown wrote: > On Mon, Jun 15, 2020 at 01:35:01PM +, Robin Gong wrote: > > Then how about choosing specific error code for such dma not ready > > case where nothing went out on the bus neither? > > Yes, that's what I suggested. Seems not easy to find a suitable error

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Mark Brown
On Mon, Jun 15, 2020 at 01:35:01PM +, Robin Gong wrote: > On 2020/06/15 20:36 Mark Brown wrote: > > If we see an error in transfer_one() it could be from anything, we've no > > idea > > what happened on the bus - the controller may have got part way through the > > transfer before failing.

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Robin Gong
On 2020/06/15 20:36 Mark Brown wrote: > On Sun, Jun 14, 2020 at 01:04:57PM +, Robin Gong wrote: > > Please delete unneeded context from mails when replying. Doing this makes > it much easier to find your reply in the message, helping ensure it won't be > missed by people scrolling through t

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Mark Brown
On Sun, Jun 14, 2020 at 01:04:57PM +, Robin Gong wrote: > On 2020/06/12 22:16 Mark Brown wrote: > > On Fri, Jun 12, 2020 at 01:48:41PM +, Robin Gong wrote: > > > On 2020/06/12 18:14 Mark Brown wrote: Please delete unneeded context from mails when replying. Doing this makes it much easi

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Vinod Koul
Hi Robin, On 15-06-20, 08:59, Robin Gong wrote: > On 2020/06/15 15:20 Vinod Koul wrote: > > > Yes, but both assume spi controller driver could detect such dma > > > failure before dmaengine_prep_*(). Let's wait Vinod's comment for that > > > if dmaengine_slave_config could keep direction. > > >

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Robin Gong
On 2020/06/15 15:20 Vinod Koul wrote: > On 14-06-20, 13:04, Robin Gong wrote: > > On 2020/06/12 22:16 Mark Brown wrote: > > > On Fri, Jun 12, 2020 at 01:48:41PM +, Robin Gong wrote: > > > > On 2020/06/12 18:14 Mark Brown wrote: > > > > > > > > Please look at the formatting of your e-mails -

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-15 Thread Vinod Koul
On 14-06-20, 13:04, Robin Gong wrote: > On 2020/06/12 22:16 Mark Brown wrote: > > On Fri, Jun 12, 2020 at 01:48:41PM +, Robin Gong wrote: > > > On 2020/06/12 18:14 Mark Brown wrote: > > > > > > Please look at the formatting of your e-mails - they're really hard > > > > to read. The line le

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-14 Thread Robin Gong
On 2020/06/12 22:16 Mark Brown wrote: > On Fri, Jun 12, 2020 at 01:48:41PM +, Robin Gong wrote: > > On 2020/06/12 18:14 Mark Brown wrote: > > > > Please look at the formatting of your e-mails - they're really hard > > > to read. The line length is over 80 columns and there's no breaks betw

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-12 Thread Mark Brown
On Fri, Jun 12, 2020 at 01:48:41PM +, Robin Gong wrote: > On 2020/06/12 18:14 Mark Brown wrote: > > Please look at the formatting of your e-mails - they're really hard to > > read. The > > line length is over 80 columns and there's no breaks between paragraphs. > Sorry for that, seems my

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-12 Thread Robin Gong
On 2020/06/12 18:14 Mark Brown wrote: > On Fri, Jun 12, 2020 at 02:18:32AM +, Robin Gong wrote: > > On 2020/06/11 21: 41 Mark Brown wrote: > > Please look at the formatting of your e-mails - they're really hard to read. > The > line length is over 80 columns and there's no breaks between

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-12 Thread Mark Brown
On Fri, Jun 12, 2020 at 02:18:32AM +, Robin Gong wrote: > On 2020/06/11 21: 41 Mark Brown wrote: Please look at the formatting of your e-mails - they're really hard to read. The line length is over 80 columns and there's no breaks between paragraphs. > > If we were going to do this I don't

RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-11 Thread Robin Gong
On 2020/06/11 21: 41 Mark Brown wrote: > On Thu, Jun 11, 2020 at 08:58:29PM +0800, Robin Gong wrote: > > Add SPI_CONTROLLER_FALLBACK to fallback to pio mode in case dma > > transfer failed. > > If spi client driver want to enable this feature please set > > master->flags with SPI_MASTER_FALLBACK a

Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-11 Thread Mark Brown
On Thu, Jun 11, 2020 at 08:58:29PM +0800, Robin Gong wrote: > Add SPI_CONTROLLER_FALLBACK to fallback to pio mode in case dma transfer > failed. > If spi client driver want to enable this feature please set master->flags > with SPI_MASTER_FALLBACK and add master->fallback checking in its can_dma()

[PATCH v1 RFC 1/2] spi: introduce fallback to pio

2020-06-10 Thread Robin Gong
Add SPI_CONTROLLER_FALLBACK to fallback to pio mode in case dma transfer failed. If spi client driver want to enable this feature please set master->flags with SPI_MASTER_FALLBACK and add master->fallback checking in its can_dma() as spi-imx.c Signed-off-by: Robin Gong --- drivers/spi/spi.c