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

1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Common SPI Interface: Controller-specific definitions
21 #define SPI_CS_HIGH BIT(2) /* CS active high */
22 #define SPI_LSB_FIRST BIT(3) /* per-word bits-on-wire */
46 * struct dm_spi_platdata - platform data for all SPI slaves
50 * dev_get_parent_platdata(slave->dev).
55 * @cs: Chip select number (0..n-1)
60 unsigned int cs; member
68 * struct spi_slave - Representation of a SPI slave
70 * For driver model this is the per-child data used by the SPI bus. It can
78 * controller-specific data.
86 * bus (bus->seq) so does not need to be stored
87 * @cs: ID of the chip select connected to the slave.
90 * @max_read_size: If non-zero, the maximum number of bytes which can
92 * @max_write_size: If non-zero, the maximum number of bytes which can
94 * @memory_map: Address of read-only SPI flash access.
99 struct udevice *dev; /* struct spi_slave is dev->parentdata */
104 unsigned int cs;
113 #define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */
114 #define SPI_XFER_END BIT(1) /* Deassert CS after transfer */
121 * spi_do_alloc_slave - Allocate a new SPI slave (internal)
129 * @cs: Chip select ID of the slave chip on the specified bus.
132 unsigned int cs);
135 * spi_alloc_slave - Allocate a new SPI slave
143 * @cs: Chip select ID of the slave chip on the specified bus.
145 #define spi_alloc_slave(_struct, bus, cs) \ argument
147 sizeof(_struct), bus, cs)
150 * spi_alloc_slave_base - Allocate a new SPI slave with no private data
156 * @cs: Chip select ID of the slave chip on the specified bus.
158 #define spi_alloc_slave_base(bus, cs) \ argument
159 spi_do_alloc_slave(0, sizeof(struct spi_slave), bus, cs)
170 * @cs: Chip select ID of the slave chip on the specified bus.
177 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
222 * Returns: 0 on success, -1 on failure.
229 * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
241 * @dout: Pointer to a string of bits to send out. The bits are
256 * This function is provided by the board if the low-level SPI driver
259 * Returns: 1 if bus:cs identifies a valid chip on this board, 0
262 int spi_cs_is_valid(unsigned int bus, unsigned int cs);
317 * struct spi_cs_info - Information about a bus chip select
326 * struct struct dm_spi_ops - Driver model SPI operations
370 * Returns: 0 on success, -ve on failure.
377 * This writes "bitlen" bits out the SPI MOSI port and simultaneously
390 * @dout: Pointer to a string of bits to send out. The bits are
395 * Returns: 0 on success, not -1 on failure
401 * Optimized handlers for SPI memory-like operations.
414 * @return 0 if OK, -ve on error
426 * @return 0 if OK, -ve on error
438 * @cs: The chip select (0..n-1)
440 * On entry info->dev is NULL
441 * @return 0 if OK (and @info is set up), -ENODEV if the chip select
442 * is invalid, other -ve value on error
444 int (*cs_info)(struct udevice *bus, uint cs, struct spi_cs_info *info);
454 * This writes "bitlen" bits out the SPI MOSI port and simultaneously
473 * Returns: 0 on success, not -1 on failure
480 * spi_find_bus_and_cs() - Find bus and slave devices by number
487 * @cs: Chip select to look for
490 * @return 0 if found, -ENODEV on error
492 int spi_find_bus_and_cs(int busnum, int cs, struct udevice **busp,
496 * spi_get_bus_and_cs() - Find and activate bus and slave devices by number
507 * @cs: Chip select to look for
514 * @return 0 if found, -ve on error
516 int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
521 * spi_chip_select() - Get the chip select for a slave
528 * spi_find_chip_select() - Find the slave attached to chip select
531 * @cs: Chip select to look for
533 * @return 0 if found, -ENODEV on error
535 int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp);
538 * spi_slave_ofdata_to_platdata() - decode standard SPI platform data
550 * spi_cs_info() - Check information on a chip select
556 * @cs: The chip select (0..n-1)
558 * @return 0 if OK (and @info is set up), -ENODEV if the chip select
559 * is invalid, other -ve value on error
561 int spi_cs_info(struct udevice *bus, uint cs, struct spi_cs_info *info);
566 * sandbox_spi_get_emul() - get an emulator for a SPI slave
577 * @return 0 if OK, -ve on error
613 * This writes "bitlen" bits out the SPI MOSI port and simultaneously clocks
625 * @dout: Pointer to a string of bits to send out. The bits are
636 #define spi_get_ops(dev) ((struct dm_spi_ops *)(dev)->driver->ops)
637 #define spi_emul_get_ops(dev) ((struct dm_spi_emul_ops *)(dev)->driver->ops)