Lines Matching +full:max +full:- +full:channels +full:- +full:clocked

1 /* SPDX-License-Identifier: GPL-2.0-or-later
26 * INTERFACES between SPI master-side drivers and SPI slave protocol handlers,
32 * struct spi_statistics - statistics for spi transfers
35 * @messages: number of spi-messages handled
86 spin_lock_irqsave(&(stats)->lock, flags); \
87 (stats)->field += count; \
88 spin_unlock_irqrestore(&(stats)->lock, flags); \
95 * struct spi_delay - SPI delay information
111 * struct spi_device - Controller side proxy for an SPI slave device
119 * @mode: The spi mode defines how data is clocked out and in.
125 * like eight or 12 bits are common. In-memory wordsizes are
134 * @controller_data: Board-specific definitions for controller, such as
141 * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when
176 #define SPI_LSB_FIRST 0x08 /* per-word bits-on-wire */
196 struct spi_delay word_delay; /* inter-word delay */
207 * - memory packing (12 bit samples into low bits, others zeroed)
208 * - priority
209 * - chipselect delays
210 * - ...
222 return (spi && get_device(&spi->dev)) ? spi : NULL; in spi_dev_get()
228 put_device(&spi->dev); in spi_dev_put()
234 return spi->controller_state; in spi_get_ctldata()
239 spi->controller_state = state; in spi_set_ctldata()
246 dev_set_drvdata(&spi->dev, data); in spi_set_drvdata()
251 return dev_get_drvdata(&spi->dev); in spi_get_drvdata()
258 * struct spi_driver - Host side "protocol" driver
300 * spi_unregister_driver - reverse effect of spi_register_driver
307 driver_unregister(&sdrv->driver); in spi_unregister_driver()
315 * module_spi_driver() - Helper macro for registering a SPI driver
327 * struct spi_controller - interface to SPI master or slave controller
330 * @bus_num: board-specific (and often SOC-specific) identifier for a
348 * @max_transfer_size: function that returns the max transfer size for
350 * @max_message_size: function that returns the max message size for
365 * @cleanup: frees controller-specific state
373 * @cur_msg: the currently in-flight message
375 * in-flight message
406 * - return 0 if the transfer is finished,
407 * - return 1 if the transfer is still in progress. When
427 * CS number. Any individual value may be -ENOENT for CS lines that
446 * @dummy_rx: dummy receive buffer for full-duplex devices
447 * @dummy_tx: dummy transmit buffer for full-duplex devices
452 * time snapshot in @spi_transfer->ptp_sts as close as possible to the
453 * moment in time when @spi_transfer->ptp_sts_word_pre and
454 * @spi_transfer->ptp_sts_word_post were transmitted.
456 * close to the driver hand-over as possible.
478 * board-specific. usually that simplifies to being SOC-specific.
480 * and one board's schematics might show it using SPI-2. software
486 * might use board-specific GPIOs.
503 #define SPI_BPW_MASK(bits) BIT((bits) - 1)
504 #define SPI_BPW_RANGE_MASK(min, max) GENMASK((max) - 1, (min) - 1) argument
563 * + For now there's no remove-from-queue operation, or
640 /* Optimized handlers for SPI memory-like operations. */
665 /* DMA channels for use with core dmaengine helpers */
690 return dev_get_drvdata(&ctlr->dev); in spi_controller_get_devdata()
696 dev_set_drvdata(&ctlr->dev, data); in spi_controller_set_devdata()
701 if (!ctlr || !get_device(&ctlr->dev)) in spi_controller_get()
709 put_device(&ctlr->dev); in spi_controller_put()
714 return IS_ENABLED(CONFIG_SPI_SLAVE) && ctlr->slave; in spi_controller_is_slave()
788 * struct spi_res - spi resource management structure
791 * @data: extra data allocated for the specific use-case
793 * this is based on ideas from devres, but focused on life-cycle
811 /*---------------------------------------------------------------------------*/
831 * struct spi_transfer - a read/write buffer pair
832 * @tx_buf: data to be written (dma-safe memory), or NULL
833 * @rx_buf: data to be read (dma-safe memory), or NULL
856 * @effective_speed_hz: the effective SCK-speed that was used to
873 * purposefully (instead of setting to spi_transfer->len - 1) to denote
874 * that a transfer-level snapshot taken from within the driver may still
901 * In-memory data values are always in native CPU byte order, translated
902 * from the wire byte order (big-endian except with SPI_LSB_FIRST). So
906 * When the word size of the SPI transfer is not a power-of-two multiple
907 * of eight bits, those in-memory words include extra bits. In-memory
908 * words are always seen by protocol drivers as right-justified, so the
922 * stay selected until the next transfer. On multi-device SPI busses
932 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
938 * Zero-initialize every field you don't set up explicitly, to
946 * spi_message.is_dma_mapped reports a pre-existing mapping
988 * struct spi_message - one multi-segment SPI transaction
1013 * Zero-initialize every field you don't set up explicitly, to
1029 * Some controller drivers (message-at-a-time queue processing)
1031 * others (with multi-message pipelines) could need a flag to
1057 INIT_LIST_HEAD(&m->transfers); in spi_message_init_no_memset()
1058 INIT_LIST_HEAD(&m->resources); in spi_message_init_no_memset()
1070 list_add_tail(&t->transfer_list, &m->transfers); in spi_message_add_tail()
1076 list_del(&t->transfer_list); in spi_transfer_del()
1084 if (t->delay_usecs) { in spi_transfer_delay_exec()
1085 d.value = t->delay_usecs; in spi_transfer_delay_exec()
1090 return spi_delay_exec(&t->delay, t); in spi_transfer_delay_exec()
1094 * spi_message_init_with_transfers - Initialize spi_message and append transfers
1154 struct spi_controller *ctlr = spi->controller; in spi_max_message_size()
1156 if (!ctlr->max_message_size) in spi_max_message_size()
1158 return ctlr->max_message_size(spi); in spi_max_message_size()
1164 struct spi_controller *ctlr = spi->controller; in spi_max_transfer_size()
1168 if (ctlr->max_transfer_size) in spi_max_transfer_size()
1169 tr_max = ctlr->max_transfer_size(spi); in spi_max_transfer_size()
1176 * spi_is_bpw_supported - Check if bits per word is supported
1187 u32 bpw_mask = spi->master->bits_per_word_mask; in spi_is_bpw_supported()
1195 /*---------------------------------------------------------------------------*/
1204 * struct spi_replaced_transfers - structure describing the spi_transfer
1213 * are to get re-inserted
1215 * @inserted_transfers: array of spi_transfers of array-size @inserted,
1240 /*---------------------------------------------------------------------------*/
1249 /*---------------------------------------------------------------------------*/
1262 * spi_sync_transfer - synchronous SPI data transfer
1286 * spi_write - SPI synchronous write
1309 * spi_read - SPI synchronous read
1337 * spi_w8r8 - SPI synchronous 8 bit write followed by 8 bit read
1359 * spi_w8r16 - SPI synchronous 8 bit write followed by 16 bit read
1364 * The number is returned in wire-order, which is at least sometimes
1365 * big-endian.
1384 * spi_w8r16be - SPI synchronous 8 bit write followed by 16 bit big-endian read
1390 * convert the read 16 bit data word from big-endian to native endianness.
1410 /*---------------------------------------------------------------------------*/
1423 * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
1427 * struct spi_board_info - board-specific template for a SPI device
1430 * data stored there is driver-specific.
1436 * from the chip datasheet and board-specific signal quality issues.
1451 * be stored in tables of board-specific device descriptors, which are
1496 * - quirks like clock rate mattering when not selected
1538 return list_is_last(&xfer->transfer_list, &ctlr->cur_msg->transfers); in spi_transfer_is_last()