Lines Matching +full:number +full:- +full:of +full:- +full:wires
2 * Common SPI Interface: Controller-specific definitions
7 * SPDX-License-Identifier: GPL-2.0+
23 #define SPI_LSB_FIRST BIT(3) /* per-word bits-on-wire */
29 #define SPI_TX_DUAL BIT(9) /* transmit with 2 wires */
30 #define SPI_TX_QUAD BIT(10) /* transmit with 4 wires */
32 #define SPI_RX_DUAL BIT(12) /* receive with 2 wires */
33 #define SPI_RX_QUAD BIT(13) /* receive with 4 wires */
34 #define SPI_TX_OCTAL BIT(14) /* transmit with 8 wires */
35 #define SPI_RX_OCTAL BIT(15) /* receive with 8 wires */
38 /* Header byte that marks the start of the message */
44 * struct dm_spi_bus - SPI bus info
62 * struct dm_spi_platdata - platform data for all SPI slaves
64 * This describes a SPI slave, a child device of the SPI bus. To obtain this
66 * dev_get_parent_platdata(slave->dev).
71 * @cs: Chip select number (0..n-1)
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.
96 * @bus: ID of the bus that the slave is attached to. For
97 * driver model this is the sequence number of the SPI
98 * bus (bus->seq) so does not need to be stored
99 * @cs: ID of the chip select connected to the slave.
101 * @wordlen: Size of SPI word in number of bits
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.
107 * @flags: Indication of SPI flags.
111 struct udevice *dev; /* struct spi_slave is dev->parentdata */
141 * spi_do_alloc_slave - Allocate a new SPI slave (internal)
146 * @offset: Offset of struct spi_slave within slave structure.
147 * @size: Size of slave structure.
148 * @bus: Bus ID of the slave chip.
149 * @cs: Chip select ID of the slave chip on the specified bus.
155 * spi_alloc_slave - Allocate a new SPI slave
160 * @_struct: Name of structure to allocate (e.g. struct tegra_spi).
162 * @bus: Bus ID of the slave chip.
163 * @cs: Chip select ID of the slave chip on the specified bus.
170 * spi_alloc_slave_base - Allocate a new SPI slave with no private data
175 * @bus: Bus ID of the slave chip.
176 * @cs: Chip select ID of the slave chip on the specified bus.
186 * contents of spi_slave so that the hardware can be easily
189 * @bus: Bus ID of the slave chip.
190 * @cs: Chip select ID of the slave chip on the specified bus.
195 * calls, or NULL if one or more of the parameters are not supported.
237 * Set the word length (number of bits per word) for SPI transactions.
240 * @wordlen: The number of bits in a word
242 * Returns: 0 on success, -1 on failure.
252 * The source of the outgoing bits is the "dout" parameter and the
253 * destination of the input bits is the "din" parameter. Note that "dout"
261 * @dout: Pointer to a string of bits to send out. The bits are
263 * @din: Pointer to a string of bits that will be filled in.
264 * @flags: A bitwise combination of SPI_XFER_* flags.
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
280 * @n_opcode: size of opcode, in bytes
283 * @n_buf: size of buf (whether it's [tx|rx]buf), in bytes
296 * This function is provided by the board if the low-level SPI driver
357 * struct spi_cs_info - Information about a bus chip select
366 * struct struct dm_spi_ops - Driver model SPI operations
405 * Set the word length (number of bits per word) for SPI transactions.
408 * @wordlen: The number of bits in a word
410 * Returns: 0 on success, -ve on failure.
421 * The source of the outgoing bits is the "dout" parameter and the
422 * destination of the input bits is the "din" parameter. Note that
430 * @dout: Pointer to a string of bits to send out. The bits are
432 * @din: Pointer to a string of bits that will be filled in.
433 * @flags: A bitwise combination of SPI_XFER_* flags.
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
462 * of separately.
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
487 * get_mmap() - Get memory-mapped SPI
491 * @map_sizep: Returns size of mapped SPI
492 * @offsetp: Returns start offset of SPI flash where the map works
494 * @return 0 if OK, -EFAULT if memory mapping is not available
508 * The source of the outgoing bits is the "dout" parameter and the
509 * destination of the input bits is the "din" parameter. Note that
517 * @dout: Pointer to a string of bits sent to the device. The
519 * @din: Pointer to a string of bits that will be sent back to
521 * @flags: A bitwise combination of SPI_XFER_* flags.
523 * Returns: 0 on success, not -1 on failure
530 * spi_find_bus_and_cs() - Find bus and slave devices by number
532 * Given a bus number and chip select, this finds the corresponding bus
536 * @busnum: SPI bus number
540 * @return 0 if found, -ENODEV on error
546 * spi_get_bus_and_cs() - Find and activate bus and slave devices by number
548 * Given a bus number and chip select, this finds the corresponding bus
557 * @busnum: SPI bus number
561 * @drv_name: Name of driver to attach to this chip select
562 * @dev_name: Name of the new device thus created
565 * @return 0 if found, -ve on error
572 * spi_chip_select() - Get the chip select for a slave
579 * spi_find_chip_select() - Find the slave attached to chip select
584 * @return 0 if found, -EINVAL if cs is invalid, -ENODEV if no device attached,
585 * other -ve value on error
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
618 * sandbox_spi_get_emul() - get an emulator for a SPI slave
629 * @return 0 if OK, -ve on error
668 * The source of the outgoing bits is the "dout" parameter and the
669 * destination of the input bits is the "din" parameter. Note that "dout"
677 * @dout: Pointer to a string of bits to send out. The bits are
679 * @din: Pointer to a string of bits that will be filled in.
680 * @flags: A bitwise combination of SPI_XFER_* flags.
688 * spi_get_mmap() - Get memory-mapped SPI
692 * @map_sizep: Returns size of mapped SPI
693 * @offsetp: Returns start offset of SPI flash where the map works
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)