Skip to content

Commit b7feaa4

Browse files
committed
Merge tag 'spi-fix-v6.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A few more driver specific fixes. The DesignWare fix is for an issue introduced by conversion to the chip select accessor functions and is pretty important but the other two are less severe" * tag 'spi-fix-v6.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: dw: Replace incorrect spi_get_chipselect with set spi: fsl-dspi: avoid SCK glitches with continuous transfers spi: cadence-quadspi: Add missing check for dma_set_mask
2 parents eee71c3 + eee4369 commit b7feaa4

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,8 +1756,11 @@ static int cqspi_probe(struct platform_device *pdev)
17561756
cqspi->slow_sram = true;
17571757

17581758
if (of_device_is_compatible(pdev->dev.of_node,
1759-
"xlnx,versal-ospi-1.0"))
1760-
dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
1759+
"xlnx,versal-ospi-1.0")) {
1760+
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
1761+
if (ret)
1762+
goto probe_reset_failed;
1763+
}
17611764
}
17621765

17631766
ret = devm_request_irq(dev, irq, cqspi_irq_handler, 0,

drivers/spi/spi-dw-mmio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
274274
*/
275275
spi_set_chipselect(spi, 0, 0);
276276
dw_spi_set_cs(spi, enable);
277-
spi_get_chipselect(spi, cs);
277+
spi_set_chipselect(spi, 0, cs);
278278
}
279279

280280
static int dw_spi_elba_init(struct platform_device *pdev,

drivers/spi/spi-fsl-dspi.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,9 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr,
10021002
static int dspi_setup(struct spi_device *spi)
10031003
{
10041004
struct fsl_dspi *dspi = spi_controller_get_devdata(spi->controller);
1005+
u32 period_ns = DIV_ROUND_UP(NSEC_PER_SEC, spi->max_speed_hz);
10051006
unsigned char br = 0, pbr = 0, pcssck = 0, cssck = 0;
1007+
u32 quarter_period_ns = DIV_ROUND_UP(period_ns, 4);
10061008
u32 cs_sck_delay = 0, sck_cs_delay = 0;
10071009
struct fsl_dspi_platform_data *pdata;
10081010
unsigned char pasc = 0, asc = 0;
@@ -1031,6 +1033,19 @@ static int dspi_setup(struct spi_device *spi)
10311033
sck_cs_delay = pdata->sck_cs_delay;
10321034
}
10331035

1036+
/* Since tCSC and tASC apply to continuous transfers too, avoid SCK
1037+
* glitches of half a cycle by never allowing tCSC + tASC to go below
1038+
* half a SCK period.
1039+
*/
1040+
if (cs_sck_delay < quarter_period_ns)
1041+
cs_sck_delay = quarter_period_ns;
1042+
if (sck_cs_delay < quarter_period_ns)
1043+
sck_cs_delay = quarter_period_ns;
1044+
1045+
dev_dbg(&spi->dev,
1046+
"DSPI controller timing params: CS-to-SCK delay %u ns, SCK-to-CS delay %u ns\n",
1047+
cs_sck_delay, sck_cs_delay);
1048+
10341049
clkrate = clk_get_rate(dspi->clk);
10351050
hz_to_spi_baud(&pbr, &br, spi->max_speed_hz, clkrate);
10361051

0 commit comments

Comments
 (0)