diff options
Diffstat (limited to 'drivers/spi/spi_bitbang_txrx.h')
-rw-r--r-- | drivers/spi/spi_bitbang_txrx.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/spi/spi_bitbang_txrx.h b/drivers/spi/spi_bitbang_txrx.h index fc033bbf9180..c16bf853c3eb 100644 --- a/drivers/spi/spi_bitbang_txrx.h +++ b/drivers/spi/spi_bitbang_txrx.h | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | static inline u32 | 45 | static inline u32 |
46 | bitbang_txrx_be_cpha0(struct spi_device *spi, | 46 | bitbang_txrx_be_cpha0(struct spi_device *spi, |
47 | unsigned nsecs, unsigned cpol, | 47 | unsigned nsecs, unsigned cpol, unsigned flags, |
48 | u32 word, u8 bits) | 48 | u32 word, u8 bits) |
49 | { | 49 | { |
50 | /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */ | 50 | /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */ |
@@ -53,7 +53,8 @@ bitbang_txrx_be_cpha0(struct spi_device *spi, | |||
53 | for (word <<= (32 - bits); likely(bits); bits--) { | 53 | for (word <<= (32 - bits); likely(bits); bits--) { |
54 | 54 | ||
55 | /* setup MSB (to slave) on trailing edge */ | 55 | /* setup MSB (to slave) on trailing edge */ |
56 | setmosi(spi, word & (1 << 31)); | 56 | if ((flags & SPI_MASTER_NO_TX) == 0) |
57 | setmosi(spi, word & (1 << 31)); | ||
57 | spidelay(nsecs); /* T(setup) */ | 58 | spidelay(nsecs); /* T(setup) */ |
58 | 59 | ||
59 | setsck(spi, !cpol); | 60 | setsck(spi, !cpol); |
@@ -61,7 +62,8 @@ bitbang_txrx_be_cpha0(struct spi_device *spi, | |||
61 | 62 | ||
62 | /* sample MSB (from slave) on leading edge */ | 63 | /* sample MSB (from slave) on leading edge */ |
63 | word <<= 1; | 64 | word <<= 1; |
64 | word |= getmiso(spi); | 65 | if ((flags & SPI_MASTER_NO_RX) == 0) |
66 | word |= getmiso(spi); | ||
65 | setsck(spi, cpol); | 67 | setsck(spi, cpol); |
66 | } | 68 | } |
67 | return word; | 69 | return word; |
@@ -69,7 +71,7 @@ bitbang_txrx_be_cpha0(struct spi_device *spi, | |||
69 | 71 | ||
70 | static inline u32 | 72 | static inline u32 |
71 | bitbang_txrx_be_cpha1(struct spi_device *spi, | 73 | bitbang_txrx_be_cpha1(struct spi_device *spi, |
72 | unsigned nsecs, unsigned cpol, | 74 | unsigned nsecs, unsigned cpol, unsigned flags, |
73 | u32 word, u8 bits) | 75 | u32 word, u8 bits) |
74 | { | 76 | { |
75 | /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */ | 77 | /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */ |
@@ -79,7 +81,8 @@ bitbang_txrx_be_cpha1(struct spi_device *spi, | |||
79 | 81 | ||
80 | /* setup MSB (to slave) on leading edge */ | 82 | /* setup MSB (to slave) on leading edge */ |
81 | setsck(spi, !cpol); | 83 | setsck(spi, !cpol); |
82 | setmosi(spi, word & (1 << 31)); | 84 | if ((flags & SPI_MASTER_NO_TX) == 0) |
85 | setmosi(spi, word & (1 << 31)); | ||
83 | spidelay(nsecs); /* T(setup) */ | 86 | spidelay(nsecs); /* T(setup) */ |
84 | 87 | ||
85 | setsck(spi, cpol); | 88 | setsck(spi, cpol); |
@@ -87,7 +90,8 @@ bitbang_txrx_be_cpha1(struct spi_device *spi, | |||
87 | 90 | ||
88 | /* sample MSB (from slave) on trailing edge */ | 91 | /* sample MSB (from slave) on trailing edge */ |
89 | word <<= 1; | 92 | word <<= 1; |
90 | word |= getmiso(spi); | 93 | if ((flags & SPI_MASTER_NO_RX) == 0) |
94 | word |= getmiso(spi); | ||
91 | } | 95 | } |
92 | return word; | 96 | return word; |
93 | } | 97 | } |