Merge tag 'spi-fix-v6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
"A disappointingly large set of device specific fixes that have built
up since I've been a bit tardy with sending a pull requests as people
kept sending me new new fixes.

The bcm63xx and lpspi issues could lead to corruption so the fixes are
fairly important for the affected parts, the other issues should all
be relatively minor"

* tag 'spi-fix-v6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: nxp-fspi: Propagate fwnode in ACPI case as well
spi: tegra114: remove Kconfig dependency on TEGRA20_APB_DMA
spi: amlogic-spifc-a1: Handle devm_pm_runtime_enable() errors
spi: spi-fsl-lpspi: fix watermark truncation caused by type cast
spi: cadence-quadspi: Fix cqspi_probe() error handling for runtime pm
spi: bcm63xx: fix premature CS deassertion on RX-only transactions
spi: spi-cadence-quadspi: Remove duplicate pm_runtime_put_autosuspend() call
spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance

+2 -2
drivers/spi/Kconfig
··· 1181 1181 1182 1182 config SPI_TEGRA114 1183 1183 tristate "NVIDIA Tegra114 SPI Controller" 1184 - depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST 1184 + depends on ARCH_TEGRA || COMPILE_TEST 1185 1185 depends on RESET_CONTROLLER 1186 1186 help 1187 - SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller 1187 + SPI controller driver for NVIDIA Tegra114 and later SoCs. This controller 1188 1188 is different than the older SoCs SPI controller and also register interface 1189 1189 get changed with this controller. 1190 1190
+3 -1
drivers/spi/spi-amlogic-spifc-a1.c
··· 353 353 354 354 pm_runtime_set_autosuspend_delay(spifc->dev, 500); 355 355 pm_runtime_use_autosuspend(spifc->dev); 356 - devm_pm_runtime_enable(spifc->dev); 356 + ret = devm_pm_runtime_enable(spifc->dev); 357 + if (ret) 358 + return ret; 357 359 358 360 ctrl->num_chipselect = 1; 359 361 ctrl->dev.of_node = pdev->dev.of_node;
+14
drivers/spi/spi-bcm63xx.c
··· 247 247 248 248 if (t->rx_buf) { 249 249 do_rx = true; 250 + 251 + /* 252 + * In certain hardware implementations, there appears to be a 253 + * hidden accumulator that tracks the number of bytes written into 254 + * the hardware FIFO, and this accumulator overrides the length in 255 + * the SPI_MSG_CTL register. 256 + * 257 + * Therefore, for read-only transfers, we need to write some dummy 258 + * value into the FIFO to keep the accumulator tracking the correct 259 + * length. 260 + */ 261 + if (!t->tx_buf) 262 + memset_io(bs->tx_io + len, 0xFF, t->len); 263 + 250 264 /* prepend is half-duplex write only */ 251 265 if (t == first) 252 266 prepend_len = 0;
+8 -10
drivers/spi/spi-cadence-quadspi.c
··· 1981 1981 cqspi->current_cs = -1; 1982 1982 cqspi->sclk = 0; 1983 1983 1984 + if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 1985 + pm_runtime_enable(dev); 1986 + pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); 1987 + pm_runtime_use_autosuspend(dev); 1988 + pm_runtime_get_noresume(dev); 1989 + } 1990 + 1984 1991 ret = cqspi_setup_flash(cqspi); 1985 1992 if (ret) { 1986 1993 dev_err(dev, "failed to setup flash parameters %d\n", ret); ··· 2002 1995 if (cqspi->use_direct_mode) { 2003 1996 ret = cqspi_request_mmap_dma(cqspi); 2004 1997 if (ret == -EPROBE_DEFER) 2005 - goto probe_dma_failed; 2006 - } 2007 - 2008 - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 2009 - pm_runtime_enable(dev); 2010 - pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); 2011 - pm_runtime_use_autosuspend(dev); 2012 - pm_runtime_get_noresume(dev); 1998 + goto probe_setup_failed; 2013 1999 } 2014 2000 2015 2001 ret = spi_register_controller(host); ··· 2012 2012 } 2013 2013 2014 2014 if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 2015 - pm_runtime_put_autosuspend(dev); 2016 2015 pm_runtime_mark_last_busy(dev); 2017 2016 pm_runtime_put_autosuspend(dev); 2018 2017 } ··· 2020 2021 probe_setup_failed: 2021 2022 if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) 2022 2023 pm_runtime_disable(dev); 2023 - probe_dma_failed: 2024 2024 cqspi_controller_enable(cqspi, 0); 2025 2025 probe_reset_failed: 2026 2026 if (cqspi->is_jh7110)
+7 -1
drivers/spi/spi-fsl-lpspi.c
··· 486 486 fsl_lpspi->tx = fsl_lpspi_buf_tx_u32; 487 487 } 488 488 489 - fsl_lpspi->watermark = min_t(typeof(fsl_lpspi->watermark), 489 + /* 490 + * t->len is 'unsigned' and txfifosize and watermrk is 'u8', force 491 + * type cast is inevitable. When len > 255, len will be truncated in min_t(), 492 + * it caused wrong watermark set. 'unsigned int' is as the designated type 493 + * for min_t() to avoid truncation. 494 + */ 495 + fsl_lpspi->watermark = min_t(unsigned int, 490 496 fsl_lpspi->txfifosize, 491 497 t->len); 492 498
+5 -5
drivers/spi/spi-nxp-fspi.c
··· 1287 1287 { 1288 1288 struct spi_controller *ctlr; 1289 1289 struct device *dev = &pdev->dev; 1290 - struct device_node *np = dev->of_node; 1290 + struct fwnode_handle *fwnode = dev_fwnode(dev); 1291 1291 struct resource *res; 1292 1292 struct nxp_fspi *f; 1293 1293 int ret, irq; ··· 1309 1309 platform_set_drvdata(pdev, f); 1310 1310 1311 1311 /* find the resources - configuration register address space */ 1312 - if (is_acpi_node(dev_fwnode(f->dev))) 1312 + if (is_acpi_node(fwnode)) 1313 1313 f->iobase = devm_platform_ioremap_resource(pdev, 0); 1314 1314 else 1315 1315 f->iobase = devm_platform_ioremap_resource_byname(pdev, "fspi_base"); ··· 1317 1317 return PTR_ERR(f->iobase); 1318 1318 1319 1319 /* find the resources - controller memory mapped space */ 1320 - if (is_acpi_node(dev_fwnode(f->dev))) 1320 + if (is_acpi_node(fwnode)) 1321 1321 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1322 1322 else 1323 1323 res = platform_get_resource_byname(pdev, ··· 1330 1330 f->memmap_phy_size = resource_size(res); 1331 1331 1332 1332 /* find the clocks */ 1333 - if (dev_of_node(&pdev->dev)) { 1333 + if (is_of_node(fwnode)) { 1334 1334 f->clk_en = devm_clk_get(dev, "fspi_en"); 1335 1335 if (IS_ERR(f->clk_en)) 1336 1336 return PTR_ERR(f->clk_en); ··· 1383 1383 else 1384 1384 ctlr->mem_caps = &nxp_fspi_mem_caps; 1385 1385 1386 - ctlr->dev.of_node = np; 1386 + device_set_node(&ctlr->dev, fwnode); 1387 1387 1388 1388 ret = devm_add_action_or_reset(dev, nxp_fspi_cleanup, f); 1389 1389 if (ret)