Skip to content

Commit 9636452

Browse files
committed
Merge tag 'spi-fix-v6.15-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A small collection of fixes that came in during the merge window, everything is driver specific with nothing standing out particularly" * tag 'spi-fix-v6.15-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: bcm2835: Restore native CS probing when pinctrl-bcm2835 is absent spi: bcm2835: Do not call gpiod_put() on invalid descriptor spi: cadence-qspi: revert "Improve spi memory performance" spi: cadence: Fix out-of-bounds array access in cdns_mrvl_xspi_setup_clock() spi: fsl-qspi: use devm function instead of driver remove spi: SPI_QPIC_SNAND should be tristate and depend on MTD spi-rockchip: Fix register out of bounds access
2 parents a05c6e6 + e19c127 commit 9636452

File tree

7 files changed

+39
-22
lines changed

7 files changed

+39
-22
lines changed

drivers/spi/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,9 @@ config SPI_QCOM_QSPI
937937
QSPI(Quad SPI) driver for Qualcomm QSPI controller.
938938

939939
config SPI_QPIC_SNAND
940-
bool "QPIC SNAND controller"
940+
tristate "QPIC SNAND controller"
941941
depends on ARCH_QCOM || COMPILE_TEST
942-
select MTD
942+
depends on MTD
943943
help
944944
QPIC_SNAND (QPIC SPI NAND) driver for Qualcomm QPIC controller.
945945
QPIC controller supports both parallel nand and serial nand.

drivers/spi/spi-bcm2835.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,8 @@ static void bcm2835_spi_cleanup(struct spi_device *spi)
11621162
sizeof(u32),
11631163
DMA_TO_DEVICE);
11641164

1165-
gpiod_put(bs->cs_gpio);
1165+
if (!IS_ERR(bs->cs_gpio))
1166+
gpiod_put(bs->cs_gpio);
11661167
spi_set_csgpiod(spi, 0, NULL);
11671168

11681169
kfree(target);
@@ -1225,7 +1226,12 @@ static int bcm2835_spi_setup(struct spi_device *spi)
12251226
struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
12261227
struct bcm2835_spidev *target = spi_get_ctldata(spi);
12271228
struct gpiod_lookup_table *lookup __free(kfree) = NULL;
1228-
int ret;
1229+
const char *pinctrl_compats[] = {
1230+
"brcm,bcm2835-gpio",
1231+
"brcm,bcm2711-gpio",
1232+
"brcm,bcm7211-gpio",
1233+
};
1234+
int ret, i;
12291235
u32 cs;
12301236

12311237
if (!target) {
@@ -1290,6 +1296,14 @@ static int bcm2835_spi_setup(struct spi_device *spi)
12901296
goto err_cleanup;
12911297
}
12921298

1299+
for (i = 0; i < ARRAY_SIZE(pinctrl_compats); i++) {
1300+
if (of_find_compatible_node(NULL, NULL, pinctrl_compats[i]))
1301+
break;
1302+
}
1303+
1304+
if (i == ARRAY_SIZE(pinctrl_compats))
1305+
return 0;
1306+
12931307
/*
12941308
* TODO: The code below is a slightly better alternative to the utter
12951309
* abuse of the GPIO API that I found here before. It creates a

drivers/spi/spi-cadence-quadspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ static const struct cqspi_driver_platdata k2g_qspi = {
20732073

20742074
static const struct cqspi_driver_platdata am654_ospi = {
20752075
.hwcaps_mask = CQSPI_SUPPORTS_OCTAL | CQSPI_SUPPORTS_QUAD,
2076-
.quirks = CQSPI_DISABLE_DAC_MODE | CQSPI_NEEDS_WR_DELAY,
2076+
.quirks = CQSPI_NEEDS_WR_DELAY,
20772077
};
20782078

20792079
static const struct cqspi_driver_platdata intel_lgm_qspi = {

drivers/spi/spi-cadence-xspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static bool cdns_mrvl_xspi_setup_clock(struct cdns_xspi_dev *cdns_xspi,
432432
u32 clk_reg;
433433
bool update_clk = false;
434434

435-
while (i < ARRAY_SIZE(cdns_mrvl_xspi_clk_div_list)) {
435+
while (i < (ARRAY_SIZE(cdns_mrvl_xspi_clk_div_list) - 1)) {
436436
clk_val = MRVL_XSPI_CLOCK_DIVIDED(
437437
cdns_mrvl_xspi_clk_div_list[i]);
438438
if (clk_val <= requested_clk)

drivers/spi/spi-fsl-qspi.c

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,19 @@ static const struct spi_controller_mem_caps fsl_qspi_mem_caps = {
844844
.per_op_freq = true,
845845
};
846846

847+
static void fsl_qspi_cleanup(void *data)
848+
{
849+
struct fsl_qspi *q = data;
850+
851+
/* disable the hardware */
852+
qspi_writel(q, QUADSPI_MCR_MDIS_MASK, q->iobase + QUADSPI_MCR);
853+
qspi_writel(q, 0x0, q->iobase + QUADSPI_RSER);
854+
855+
fsl_qspi_clk_disable_unprep(q);
856+
857+
mutex_destroy(&q->lock);
858+
}
859+
847860
static int fsl_qspi_probe(struct platform_device *pdev)
848861
{
849862
struct spi_controller *ctlr;
@@ -934,6 +947,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
934947

935948
ctlr->dev.of_node = np;
936949

950+
ret = devm_add_action_or_reset(dev, fsl_qspi_cleanup, q);
951+
if (ret)
952+
goto err_destroy_mutex;
953+
937954
ret = devm_spi_register_controller(dev, ctlr);
938955
if (ret)
939956
goto err_destroy_mutex;
@@ -953,19 +970,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
953970
return ret;
954971
}
955972

956-
static void fsl_qspi_remove(struct platform_device *pdev)
957-
{
958-
struct fsl_qspi *q = platform_get_drvdata(pdev);
959-
960-
/* disable the hardware */
961-
qspi_writel(q, QUADSPI_MCR_MDIS_MASK, q->iobase + QUADSPI_MCR);
962-
qspi_writel(q, 0x0, q->iobase + QUADSPI_RSER);
963-
964-
fsl_qspi_clk_disable_unprep(q);
965-
966-
mutex_destroy(&q->lock);
967-
}
968-
969973
static int fsl_qspi_suspend(struct device *dev)
970974
{
971975
return 0;
@@ -1003,7 +1007,6 @@ static struct platform_driver fsl_qspi_driver = {
10031007
.pm = &fsl_qspi_pm_ops,
10041008
},
10051009
.probe = fsl_qspi_probe,
1006-
.remove = fsl_qspi_remove,
10071010
};
10081011
module_platform_driver(fsl_qspi_driver);
10091012

drivers/spi/spi-qpic-snand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ static const struct of_device_id qcom_snandc_of_match[] = {
16141614
.data = &ipq9574_snandc_props,
16151615
},
16161616
{}
1617-
}
1617+
};
16181618
MODULE_DEVICE_TABLE(of, qcom_snandc_of_match);
16191619

16201620
static struct platform_driver qcom_spi_driver = {

drivers/spi/spi-rockchip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ static int rockchip_spi_config(struct rockchip_spi *rs,
547547
cr0 |= (spi->mode & 0x3U) << CR0_SCPH_OFFSET;
548548
if (spi->mode & SPI_LSB_FIRST)
549549
cr0 |= CR0_FBM_LSB << CR0_FBM_OFFSET;
550-
if (spi->mode & SPI_CS_HIGH)
550+
if ((spi->mode & SPI_CS_HIGH) && !(spi_get_csgpiod(spi, 0)))
551551
cr0 |= BIT(spi_get_chipselect(spi, 0)) << CR0_SOI_OFFSET;
552552

553553
if (xfer->rx_buf && xfer->tx_buf)

0 commit comments

Comments
 (0)