Lines Matching +full:spi +full:- +full:slave
1 /* SPDX-License-Identifier: GPL-2.0 */
4 * simple SPI master driver. Two do polled word-at-a-time I/O:
6 * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](),
7 * expanding the per-word routines from the inline templates below.
9 * - Drivers for controllers resembling bare shift registers. Provide
15 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
36 * A non-inlined routine would call bitbang_txrx_*() routines. The
49 bitbang_txrx_be_cpha0(struct spi_device *spi, in bitbang_txrx_be_cpha0() argument
55 u32 oldbit = (!(word & (1<<(bits-1)))) << 31; in bitbang_txrx_be_cpha0()
57 for (word <<= (32 - bits); likely(bits); bits--) { in bitbang_txrx_be_cpha0()
59 /* setup MSB (to slave) on trailing edge */ in bitbang_txrx_be_cpha0()
62 setmosi(spi, word & (1 << 31)); in bitbang_txrx_be_cpha0()
68 setsck(spi, !cpol); in bitbang_txrx_be_cpha0()
71 /* sample MSB (from slave) on leading edge */ in bitbang_txrx_be_cpha0()
74 word |= getmiso(spi); in bitbang_txrx_be_cpha0()
75 setsck(spi, cpol); in bitbang_txrx_be_cpha0()
81 bitbang_txrx_be_cpha1(struct spi_device *spi, in bitbang_txrx_be_cpha1() argument
87 u32 oldbit = (!(word & (1<<(bits-1)))) << 31; in bitbang_txrx_be_cpha1()
89 for (word <<= (32 - bits); likely(bits); bits--) { in bitbang_txrx_be_cpha1()
91 /* setup MSB (to slave) on leading edge */ in bitbang_txrx_be_cpha1()
92 setsck(spi, !cpol); in bitbang_txrx_be_cpha1()
95 setmosi(spi, word & (1 << 31)); in bitbang_txrx_be_cpha1()
101 setsck(spi, cpol); in bitbang_txrx_be_cpha1()
104 /* sample MSB (from slave) on trailing edge */ in bitbang_txrx_be_cpha1()
107 word |= getmiso(spi); in bitbang_txrx_be_cpha1()
113 bitbang_txrx_le_cpha0(struct spi_device *spi, in bitbang_txrx_le_cpha0() argument
119 u8 rxbit = bits - 1; in bitbang_txrx_le_cpha0()
122 for (; likely(bits); bits--) { in bitbang_txrx_le_cpha0()
124 /* setup LSB (to slave) on trailing edge */ in bitbang_txrx_le_cpha0()
127 setmosi(spi, word & 1); in bitbang_txrx_le_cpha0()
133 setsck(spi, !cpol); in bitbang_txrx_le_cpha0()
136 /* sample LSB (from slave) on leading edge */ in bitbang_txrx_le_cpha0()
139 word |= getmiso(spi) << rxbit; in bitbang_txrx_le_cpha0()
140 setsck(spi, cpol); in bitbang_txrx_le_cpha0()
146 bitbang_txrx_le_cpha1(struct spi_device *spi, in bitbang_txrx_le_cpha1() argument
152 u8 rxbit = bits - 1; in bitbang_txrx_le_cpha1()
155 for (; likely(bits); bits--) { in bitbang_txrx_le_cpha1()
157 /* setup LSB (to slave) on leading edge */ in bitbang_txrx_le_cpha1()
158 setsck(spi, !cpol); in bitbang_txrx_le_cpha1()
161 setmosi(spi, word & 1); in bitbang_txrx_le_cpha1()
167 setsck(spi, cpol); in bitbang_txrx_le_cpha1()
170 /* sample LSB (from slave) on trailing edge */ in bitbang_txrx_le_cpha1()
173 word |= getmiso(spi) << rxbit; in bitbang_txrx_le_cpha1()