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
Unified · Split
| @@ -993,11 +993,15 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) · 992 unmodified lines | ||
| 993 | 993 | |
| 994 | 994 | if (ctlr->dma_tx) |
| 995 | 995 | tx_dev = ctlr->dma_tx->device->dev; |
| 996 | + else if (ctlr->dma_map_dev) | |
| 997 | + tx_dev = ctlr->dma_map_dev; | |
| 996 | 998 | else |
| 997 | 999 | tx_dev = ctlr->dev.parent; |
| 998 | 1000 | |
| 999 | 1001 | if (ctlr->dma_rx) |
| 1000 | 1002 | rx_dev = ctlr->dma_rx->device->dev; |
| 1003 | + else if (ctlr->dma_map_dev) | |
| 1004 | + rx_dev = ctlr->dma_map_dev; | |
| 1001 | 1005 | else |
| 1002 | 1006 | rx_dev = ctlr->dev.parent; |
| 1003 | 1007 | |
| @@ -588,6 +588,7 @@ struct spi_controller { · 587 unmodified lines | ||
| 588 | 588 | bool (*can_dma)(struct spi_controller *ctlr, |
| 589 | 589 | struct spi_device *spi, |
| 590 | 590 | struct spi_transfer *xfer); |
| 591 | + struct device *dma_map_dev; | |
| 591 | 592 | |
| 592 | 593 | /* |
| 593 | 594 | * These hooks are for drivers that want to use the generic |