Lines Matching +full:spi +full:- +full:slave

8  * SPDX-License-Identifier:	GPL-2.0+
12 #include <spi.h>
16 /*-----------------------------------------------------------------------
27 struct spi_slave slave; member
31 static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave) in to_soft_spi() argument
33 return container_of(slave, struct soft_spi_slave, slave); in to_soft_spi()
40 /*-----------------------------------------------------------------------
59 ss->mode = mode; in spi_setup_slave()
63 return &ss->slave; in spi_setup_slave()
66 void spi_free_slave(struct spi_slave *slave) in spi_free_slave() argument
68 struct soft_spi_slave *ss = to_soft_spi(slave); in spi_free_slave()
73 int spi_claim_bus(struct spi_slave *slave) in spi_claim_bus() argument
78 struct soft_spi_slave *ss = to_soft_spi(slave); in spi_claim_bus()
81 * Make sure the SPI clock is in idle state as defined for in spi_claim_bus()
82 * this slave. in spi_claim_bus()
84 if (ss->mode & SPI_CPOL) in spi_claim_bus()
92 void spi_release_bus(struct spi_slave *slave) in spi_release_bus() argument
97 /*-----------------------------------------------------------------------
98 * SPI transfer
100 * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
101 * "bitlen" bits in the SPI MISO port. That's just the way SPI works.
109 int spi_xfer(struct spi_slave *slave, unsigned int bitlen, in spi_xfer() argument
115 struct soft_spi_slave *ss = to_soft_spi(slave); in spi_xfer()
120 int cpol = ss->mode & SPI_CPOL; in spi_xfer()
121 int cpha = ss->mode & SPI_CPHA; in spi_xfer()
124 PRINTD("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n", in spi_xfer()
125 slave->bus, slave->cs, *(uint *)txd, *(uint *)rxd, bitlen); in spi_xfer()
128 spi_cs_activate(slave); in spi_xfer()
163 * bits over to left-justify them. Then store the last byte in spi_xfer()
168 tmpdin <<= 8 - (bitlen % 8); in spi_xfer()
173 spi_cs_deactivate(slave); in spi_xfer()