summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-06-11 13:38:25 +0300
committerMark Brown <broonie@kernel.org>2024-06-11 13:38:25 +0300
commit412a05d6a91c6e3bb69741ddbde01c16c3ff94c5 (patch)
tree28d1604703331033b29d508c2be02ea95d5fa4e6 /include
parent8a71710bb4797174733a16df2bcb8683fbe7caea (diff)
parente289df82344fecc104ad8326b9ab6da612b9c899 (diff)
downloadlinux-412a05d6a91c6e3bb69741ddbde01c16c3ff94c5.tar.xz
spi: Rework DMA mapped flag
Merge series from Andy Shevchenko <andriy.shevchenko@linux.intel.com>: The first part of the series (patches 1 to 7) is an introduction of a new helper followed by the user conversion. This consolidates the same code and also makes patch 8 (last one) be localised to the SPI core part. The last patch is the main rework to get rid of a recently introduced hack with a dummy SG list and move to the transfer-based DMA mapped flag. That said, the patches 1 to 7 may be applied right away since they have no functional change intended, while the last one needs more testing and reviewing.
Diffstat (limited to 'include')
-rw-r--r--include/linux/spi/spi.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e8e1e798924f..b4a89db4c855 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -447,7 +447,6 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch
* @cur_msg_need_completion: Flag used internally to opportunistically skip
* the @cur_msg_completion. This flag is used to signal the context that
* is running spi_finalize_current_message() that it needs to complete()
- * @cur_msg_mapped: message has been mapped for DMA
* @fallback: fallback to PIO if DMA transfer return failure with
* SPI_TRANS_FAIL_NO_START.
* @last_cs_mode_high: was (mode & SPI_CS_HIGH) true on the last call to set_cs.
@@ -708,7 +707,6 @@ struct spi_controller {
bool running;
bool rt;
bool auto_runtime_pm;
- bool cur_msg_mapped;
bool fallback;
bool last_cs_mode_high;
s8 last_cs[SPI_CS_CNT_MAX];
@@ -981,6 +979,8 @@ struct spi_res {
* transfer this transfer. Set to 0 if the SPI bus driver does
* not support it.
* @transfer_list: transfers are sequenced through @spi_message.transfers
+ * @tx_sg_mapped: If true, the @tx_sg is mapped for DMA
+ * @rx_sg_mapped: If true, the @rx_sg is mapped for DMA
* @tx_sg: Scatterlist for transmit, currently not for client use
* @rx_sg: Scatterlist for receive, currently not for client use
* @ptp_sts_word_pre: The word (subject to bits_per_word semantics) offset
@@ -1077,10 +1077,13 @@ struct spi_transfer {
#define SPI_TRANS_FAIL_IO BIT(1)
u16 error;
- dma_addr_t tx_dma;
- dma_addr_t rx_dma;
+ bool tx_sg_mapped;
+ bool rx_sg_mapped;
+
struct sg_table tx_sg;
struct sg_table rx_sg;
+ dma_addr_t tx_dma;
+ dma_addr_t rx_dma;
unsigned dummy_data:1;
unsigned cs_off:1;