Skip to content

Commit b470e10

Browse files
vinodkoulbroonie
authored andcommitted
spi: core: add dma_map_dev for dma device
Some controllers like qcom geni need the parent device to be used for dma mapping, so add a dma_map_dev field and let drivers fill this to be used as mapping device Signed-off-by: Vinod Koul <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent c58db2a commit b470e10

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/spi/spi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,15 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
993993

994994
if (ctlr->dma_tx)
995995
tx_dev = ctlr->dma_tx->device->dev;
996+
else if (ctlr->dma_map_dev)
997+
tx_dev = ctlr->dma_map_dev;
996998
else
997999
tx_dev = ctlr->dev.parent;
9981000

9991001
if (ctlr->dma_rx)
10001002
rx_dev = ctlr->dma_rx->device->dev;
1003+
else if (ctlr->dma_map_dev)
1004+
rx_dev = ctlr->dma_map_dev;
10011005
else
10021006
rx_dev = ctlr->dev.parent;
10031007

include/linux/spi/spi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ struct spi_controller {
588588
bool (*can_dma)(struct spi_controller *ctlr,
589589
struct spi_device *spi,
590590
struct spi_transfer *xfer);
591+
struct device *dma_map_dev;
591592

592593
/*
593594
* These hooks are for drivers that want to use the generic

0 commit comments

Comments
 (0)