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

Andrew Ruder andy at aeruder.net
Thu Apr 10 20:57:59 CEST 2014


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.

Cheers,
Andy


More information about the U-Boot mailing list