Lines Matching +full:cs +full:- +full:out

2  * Common SPI Interface: Controller-specific definitions
7 * SPDX-License-Identifier: GPL-2.0+
22 #define SPI_CS_HIGH BIT(2) /* CS active high */
23 #define SPI_LSB_FIRST BIT(3) /* per-word bits-on-wire */
44 * struct dm_spi_bus - SPI bus info
62 * struct dm_spi_platdata - platform data for all SPI slaves
66 * dev_get_parent_platdata(slave->dev).
71 * @cs: Chip select number (0..n-1)
76 unsigned int cs; member
82 * struct spi_slave - Representation of a SPI slave
84 * For driver model this is the per-child data used by the SPI bus. It can
92 * controller-specific data.
98 * bus (bus->seq) so does not need to be stored
99 * @cs: ID of the chip select connected to the slave.
102 * @max_read_size: If non-zero, the maximum number of bytes which can
104 * @max_write_size: If non-zero, the maximum number of bytes which can
106 * @memory_map: Address of read-only SPI flash access.
111 struct udevice *dev; /* struct spi_slave is dev->parentdata */
115 unsigned int cs;
125 #define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */
126 #define SPI_XFER_END BIT(1) /* Deassert CS after transfer */
141 * spi_do_alloc_slave - Allocate a new SPI slave (internal)
149 * @cs: Chip select ID of the slave chip on the specified bus.
152 unsigned int cs);
155 * spi_alloc_slave - Allocate a new SPI slave
163 * @cs: Chip select ID of the slave chip on the specified bus.
165 #define spi_alloc_slave(_struct, bus, cs) \ argument
167 sizeof(_struct), bus, cs)
170 * spi_alloc_slave_base - Allocate a new SPI slave with no private data
176 * @cs: Chip select ID of the slave chip on the specified bus.
178 #define spi_alloc_slave_base(bus, cs) \ argument
179 spi_do_alloc_slave(0, sizeof(struct spi_slave), bus, cs)
190 * @cs: Chip select ID of the slave chip on the specified bus.
197 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
242 * Returns: 0 on success, -1 on failure.
249 * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
261 * @dout: Pointer to a string of bits to send out. The bits are
272 * spi_write_then_read - SPI synchronous write followed by read
275 * is to send the opcode and if the length of buf is non-zero then it start
296 * This function is provided by the board if the low-level SPI driver
299 * Returns: 1 if bus:cs identifies a valid chip on this board, 0
302 int spi_cs_is_valid(unsigned int bus, unsigned int cs);
357 * struct spi_cs_info - Information about a bus chip select
366 * struct struct dm_spi_ops - Driver model SPI operations
410 * Returns: 0 on success, -ve on failure.
417 * This writes "bitlen" bits out the SPI MOSI port and simultaneously
430 * @dout: Pointer to a string of bits to send out. The bits are
435 * Returns: 0 on success, not -1 on failure
441 * Optimized handlers for SPI memory-like operations.
454 * @return 0 if OK, -ve on error
466 * @return 0 if OK, -ve on error
478 * @cs: The chip select (0..n-1)
480 * On entry info->dev is NULL
481 * @return 0 if OK (and @info is set up), -ENODEV if the chip select
482 * is invalid, other -ve value on error
484 int (*cs_info)(struct udevice *bus, uint cs, struct spi_cs_info *info);
487 * get_mmap() - Get memory-mapped SPI
494 * @return 0 if OK, -EFAULT if memory mapping is not available
504 * This writes "bitlen" bits out the SPI MOSI port and simultaneously
523 * Returns: 0 on success, not -1 on failure
530 * spi_find_bus_and_cs() - Find bus and slave devices by number
537 * @cs: Chip select to look for
540 * @return 0 if found, -ENODEV on error
542 int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
546 * spi_get_bus_and_cs() - Find and activate bus and slave devices by number
558 * @cs: Chip select to look for
565 * @return 0 if found, -ve on error
567 int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
572 * spi_chip_select() - Get the chip select for a slave
579 * spi_find_chip_select() - Find the slave attached to chip select
582 * @cs: Chip select to look for
584 * @return 0 if found, -EINVAL if cs is invalid, -ENODEV if no device attached,
585 * other -ve value on error
587 int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp);
590 * spi_slave_ofdata_to_platdata() - decode standard SPI platform data
602 * spi_cs_info() - Check information on a chip select
608 * @cs: The chip select (0..n-1)
610 * @return 0 if OK (and @info is set up), -ENODEV if the chip select
611 * is invalid, other -ve value on error
613 int spi_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info);
618 * sandbox_spi_get_emul() - get an emulator for a SPI slave
629 * @return 0 if OK, -ve on error
665 * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
677 * @dout: Pointer to a string of bits to send out. The bits are
688 * spi_get_mmap() - Get memory-mapped SPI
695 * @return 0 if OK, -ENOSYS if no operation, -EFAULT if memory mapping is not
702 #define spi_get_ops(dev) ((struct dm_spi_ops *)(dev)->driver->ops)
703 #define spi_emul_get_ops(dev) ((struct dm_spi_emul_ops *)(dev)->driver->ops)