mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 17:23:55 +08:00
spi: support spi without dma channel to use can_dma()
For spi without dma channel and use can_dma(), it can use master->dev for struct device. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
bc0195aad0
commit
c37f45b5f1
@ -539,8 +539,15 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg)
|
|||||||
if (!master->can_dma)
|
if (!master->can_dma)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tx_dev = master->dma_tx->device->dev;
|
if (master->dma_tx)
|
||||||
rx_dev = master->dma_rx->device->dev;
|
tx_dev = master->dma_tx->device->dev;
|
||||||
|
else
|
||||||
|
tx_dev = &master->dev;
|
||||||
|
|
||||||
|
if (master->dma_rx)
|
||||||
|
rx_dev = master->dma_rx->device->dev;
|
||||||
|
else
|
||||||
|
rx_dev = &master->dev;
|
||||||
|
|
||||||
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
||||||
if (!master->can_dma(master, msg->spi, xfer))
|
if (!master->can_dma(master, msg->spi, xfer))
|
||||||
@ -579,8 +586,15 @@ static int __spi_unmap_msg(struct spi_master *master, struct spi_message *msg)
|
|||||||
if (!master->cur_msg_mapped || !master->can_dma)
|
if (!master->cur_msg_mapped || !master->can_dma)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tx_dev = master->dma_tx->device->dev;
|
if (master->dma_tx)
|
||||||
rx_dev = master->dma_rx->device->dev;
|
tx_dev = master->dma_tx->device->dev;
|
||||||
|
else
|
||||||
|
tx_dev = &master->dev;
|
||||||
|
|
||||||
|
if (master->dma_rx)
|
||||||
|
rx_dev = master->dma_rx->device->dev;
|
||||||
|
else
|
||||||
|
rx_dev = &master->dev;
|
||||||
|
|
||||||
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
|
||||||
if (!master->can_dma(master, msg->spi, xfer))
|
if (!master->can_dma(master, msg->spi, xfer))
|
||||||
|
Loading…
Reference in New Issue
Block a user