diff options
author | Tom Rini <trini@ti.com> | 2014-06-11 11:40:11 -0400 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-06-11 11:40:11 -0400 |
commit | 28b62f0de361ae640eb286969536a236cc8febda (patch) | |
tree | 6c36f500b3d8ed64e0b79a0f043c819a2aad66b5 /drivers/spi | |
parent | 61e76f53708cf082ef9061a140b57df3513b8ba1 (diff) | |
parent | 1f436a6ddf7eb7f2da1c8df6c13100429baf844a (diff) | |
download | u-boot-imx-28b62f0de361ae640eb286969536a236cc8febda.zip u-boot-imx-28b62f0de361ae640eb286969536a236cc8febda.tar.gz u-boot-imx-28b62f0de361ae640eb286969536a236cc8febda.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-spi
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/soft_spi.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c index 5d22351..c969be3 100644 --- a/drivers/spi/soft_spi.c +++ b/drivers/spi/soft_spi.c @@ -136,10 +136,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, /* * Check if it is time to work on a new byte. */ - if((j % 8) == 0) { - tmpdout = *txd++; + if ((j % 8) == 0) { + if (txd) + tmpdout = *txd++; + else + tmpdout = 0; if(j != 0) { - *rxd++ = tmpdin; + if (rxd) + *rxd++ = tmpdin; } tmpdin = 0; } @@ -164,9 +168,11 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, * bits over to left-justify them. Then store the last byte * read in. */ - if((bitlen % 8) != 0) - tmpdin <<= 8 - (bitlen % 8); - *rxd++ = tmpdin; + if (rxd) { + if ((bitlen % 8) != 0) + tmpdin <<= 8 - (bitlen % 8); + *rxd++ = tmpdin; + } if (flags & SPI_XFER_END) spi_cs_deactivate(slave); |