mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
spi: tegra210-qspi: Remove cache operations
The DMA memory for this driver is allocated using dma_alloc_coherent(),
which ends up mapping the allocated memory as uncached. Performing the
various dma_sync_*() operations on this memory causes issues during SPI
flashing:
[ 7.818017] pc : dcache_inval_poc+0x40/0x58
[ 7.822128] lr : arch_sync_dma_for_cpu+0x2c/0x4c
[ 7.826854] sp : ffff80008193bcf0
[ 7.830267] x29: ffff80008193bcf0 x28: ffffa3fe5ff1e908 x27: ffffa3fe627bb130
[ 7.837528] x26: ffff000086952180 x25: ffff00008015c8ac x24: ffff000086c9b480
[ 7.844878] x23: ffff00008015c800 x22: 0000000000000002 x21: 0000000000010000
[ 7.852229] x20: 0000000106dae000 x19: ffff000080112410 x18: 0000000000000001
[ 7.859580] x17: ffff000080159400 x16: ffffa3fe607a9bd8 x15: ffff0000eac1b180
[ 7.866753] x14: 000000000000000c x13: 0000000000000001 x12: 000000000000025a
[ 7.874104] x11: 0000000000000000 x10: 7f73e96357f6a07f x9 : db1fc8072a7f5e3a
[ 7.881365] x8 : ffff000086c9c588 x7 : ffffa3fe607a9bd8 x6 : ffff80008193bc28
[ 7.888630] x5 : 000000000000ffff x4 : 0000000000000009 x3 : 000000000000003f
[ 7.895892] x2 : 0000000000000040 x1 : ffff000086dbe000 x0 : ffff000086db0000
[ 7.903155] Call trace:
[ 7.905606] dcache_inval_poc+0x40/0x58 (P)
[ 7.909804] iommu_dma_sync_single_for_cpu+0xb4/0xb8
[ 7.914617] __dma_sync_single_for_cpu+0x158/0x194
[ 7.919428] __this_module+0x5b020/0x5baf8 [spi_tegra210_quad]
[ 7.925291] irq_thread_fn+0x2c/0xc0
[ 7.928966] irq_thread+0x16c/0x318
[ 7.932467] kthread+0x12c/0x214
Fix this by removing all calls to the dma_sync_*() functions. This isn't
ideal because DMA is used only for relatively large (> 64 words or 256
bytes) and using uncached memory for this might be slow. Reworking this
to use cached memory for faster access and reintroducing the cache
maintenance calls is probably worth a follow-up patch.
Reported-by: Brad Griffis <bgriffis@nvidia.com>
Fixes: 017f1b0bae
("spi: tegra210-quad: Add support for internal DMA")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20250613123037.2082788-1-thierry.reding@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
9f0ad43b15
commit
d57e92dd66
|
@ -407,9 +407,6 @@ tegra_qspi_read_rx_fifo_to_client_rxbuf(struct tegra_qspi *tqspi, struct spi_tra
|
|||
static void
|
||||
tegra_qspi_copy_client_txbuf_to_qspi_txbuf(struct tegra_qspi *tqspi, struct spi_transfer *t)
|
||||
{
|
||||
dma_sync_single_for_cpu(tqspi->dev, tqspi->tx_dma_phys,
|
||||
tqspi->dma_buf_size, DMA_TO_DEVICE);
|
||||
|
||||
/*
|
||||
* In packed mode, each word in FIFO may contain multiple packets
|
||||
* based on bits per word. So all bytes in each FIFO word are valid.
|
||||
|
@ -442,17 +439,11 @@ tegra_qspi_copy_client_txbuf_to_qspi_txbuf(struct tegra_qspi *tqspi, struct spi_
|
|||
|
||||
tqspi->cur_tx_pos += write_bytes;
|
||||
}
|
||||
|
||||
dma_sync_single_for_device(tqspi->dev, tqspi->tx_dma_phys,
|
||||
tqspi->dma_buf_size, DMA_TO_DEVICE);
|
||||
}
|
||||
|
||||
static void
|
||||
tegra_qspi_copy_qspi_rxbuf_to_client_rxbuf(struct tegra_qspi *tqspi, struct spi_transfer *t)
|
||||
{
|
||||
dma_sync_single_for_cpu(tqspi->dev, tqspi->rx_dma_phys,
|
||||
tqspi->dma_buf_size, DMA_FROM_DEVICE);
|
||||
|
||||
if (tqspi->is_packed) {
|
||||
tqspi->cur_rx_pos += tqspi->curr_dma_words * tqspi->bytes_per_word;
|
||||
} else {
|
||||
|
@ -478,9 +469,6 @@ tegra_qspi_copy_qspi_rxbuf_to_client_rxbuf(struct tegra_qspi *tqspi, struct spi_
|
|||
|
||||
tqspi->cur_rx_pos += read_bytes;
|
||||
}
|
||||
|
||||
dma_sync_single_for_device(tqspi->dev, tqspi->rx_dma_phys,
|
||||
tqspi->dma_buf_size, DMA_FROM_DEVICE);
|
||||
}
|
||||
|
||||
static void tegra_qspi_dma_complete(void *args)
|
||||
|
@ -701,8 +689,6 @@ static int tegra_qspi_start_dma_based_transfer(struct tegra_qspi *tqspi, struct
|
|||
return ret;
|
||||
}
|
||||
|
||||
dma_sync_single_for_device(tqspi->dev, tqspi->rx_dma_phys,
|
||||
tqspi->dma_buf_size, DMA_FROM_DEVICE);
|
||||
ret = tegra_qspi_start_rx_dma(tqspi, t, len);
|
||||
if (ret < 0) {
|
||||
dev_err(tqspi->dev, "failed to start RX DMA: %d\n", ret);
|
||||
|
|
Loading…
Reference in New Issue
Block a user