Skip to content

Commit de90cc6

Browse files
committed
Merge tag 'spi-fix-v6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A few standard fixes here, plus one more interesting one from Hans which addresses an issue where a move in when we requested GPIOs on ACPI systems caused us to stop doing pinmuxing and leave things floating that we'd really rather not have floating" * tag 'spi-fix-v6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: Add TODO comment about ACPI GPIO setup spi: xilinx: increase number of retries before declaring stall spi: imx: keep dma request disabled before dma transfer setup spi: Try to get ACPI GPIO IRQ earlier
2 parents 809bd27 + 66e9feb commit de90cc6

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

drivers/spi/spi-imx.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,15 @@ static void mx51_ecspi_trigger(struct spi_imx_data *spi_imx)
519519
{
520520
u32 reg;
521521

522-
reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
523-
reg |= MX51_ECSPI_CTRL_XCH;
524-
writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
522+
if (spi_imx->usedma) {
523+
reg = readl(spi_imx->base + MX51_ECSPI_DMA);
524+
reg |= MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN;
525+
writel(reg, spi_imx->base + MX51_ECSPI_DMA);
526+
} else {
527+
reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
528+
reg |= MX51_ECSPI_CTRL_XCH;
529+
writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
530+
}
525531
}
526532

527533
static void mx51_ecspi_disable(struct spi_imx_data *spi_imx)
@@ -759,7 +765,6 @@ static void mx51_setup_wml(struct spi_imx_data *spi_imx)
759765
writel(MX51_ECSPI_DMA_RX_WML(spi_imx->wml - 1) |
760766
MX51_ECSPI_DMA_TX_WML(tx_wml) |
761767
MX51_ECSPI_DMA_RXT_WML(spi_imx->wml) |
762-
MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN |
763768
MX51_ECSPI_DMA_RXTDEN, spi_imx->base + MX51_ECSPI_DMA);
764769
}
765770

@@ -1520,6 +1525,8 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
15201525
reinit_completion(&spi_imx->dma_tx_completion);
15211526
dma_async_issue_pending(controller->dma_tx);
15221527

1528+
spi_imx->devtype_data->trigger(spi_imx);
1529+
15231530
transfer_timeout = spi_imx_calculate_timeout(spi_imx, transfer->len);
15241531

15251532
/* Wait SDMA to finish the data transfer.*/

drivers/spi/spi-xilinx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
300300

301301
/* Read out all the data from the Rx FIFO */
302302
rx_words = n_words;
303-
stalled = 10;
303+
stalled = 32;
304304
while (rx_words) {
305305
if (rx_words == n_words && !(stalled--) &&
306306
!(sr & XSPI_SR_TX_EMPTY_MASK) &&

drivers/spi/spi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,18 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
28512851
acpi_set_modalias(adev, acpi_device_hid(adev), spi->modalias,
28522852
sizeof(spi->modalias));
28532853

2854+
/*
2855+
* This gets re-tried in spi_probe() for -EPROBE_DEFER handling in case
2856+
* the GPIO controller does not have a driver yet. This needs to be done
2857+
* here too, because this call sets the GPIO direction and/or bias.
2858+
* Setting these needs to be done even if there is no driver, in which
2859+
* case spi_probe() will never get called.
2860+
* TODO: ideally the setup of the GPIO should be handled in a generic
2861+
* manner in the ACPI/gpiolib core code.
2862+
*/
2863+
if (spi->irq < 0)
2864+
spi->irq = acpi_dev_gpio_irq_get(adev, 0);
2865+
28542866
acpi_device_set_enumerated(adev);
28552867

28562868
adev->power.flags.ignore_parent = true;

0 commit comments

Comments
 (0)