[U-Boot] [PATCH RESEND-WITH-JUSTIFICATION] spi: soft_spi: Support NULL din/dout buffers

Jagan Teki jagannadh.teki at gmail.com
Thu Apr 10 21:03:45 CEST 2014


On Fri, Apr 11, 2014 at 12:27 AM, Andrew Ruder <andy at aeruder.net> wrote:
> On Fri, Apr 11, 2014 at 12:24:20AM +0530, Jagan Teki wrote:
>> At-least from zynq_spi.c case - I wouldn't find that obscure case as you pointed
>> and even with dout NULL which is status poll from (sf_ops.c).
>
> zynq_spi is correct, soft_spi is not.
>
> zynq_spi.c:
> int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
>                 void *din, unsigned long flags)
> {
>         const u8 *tx_buf = dout;
>         u8 *rx_buf = din, buf;
>                         [...]
>                         if (tx_buf)
>                                 buf = *tx_buf++;
>                         else
>                                 buf = 0;
>                         [...]
>                         if (rx_buf)
>                                 *rx_buf++ = buf;
>                         [...]
>
>> It would be great if you mentioned issue scenario for status poll case
>> drivers/mtd/spi/sf_ops.c:               ret = spi_xfer(spi, 8, NULL,
>> &status, 0);
>
> That breaks on soft_spi, hence the patch.

OK - means issue only with soft_spi.c is it?
Can you share the issue log or typical use case scenario w.r.t soft_spi.c,
I need to understand how this got resolved with your change.

I understand you assigned '0' when dout is NULL and you took the buf
only when din is !NULL.

thanks!
-- 
Jagan.


More information about the U-Boot mailing list