Skip to content

Commit a4d7d70

Browse files
committed
Merge tag 'spi-fix-v6.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A small collection of driver specific fixes, none of them particularly remarkable or severe" * tag 'spi-fix-v6.4-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: qup: Request DMA before enabling clocks spi: mt65xx: make sure operations completed before unloading spi: lpspi: disable lpspi module irq in DMA mode
2 parents 0bdd0f0 + 0c331fd commit a4d7d70

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,14 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
910910
ret = fsl_lpspi_dma_init(&pdev->dev, fsl_lpspi, controller);
911911
if (ret == -EPROBE_DEFER)
912912
goto out_pm_get;
913-
914913
if (ret < 0)
915914
dev_err(&pdev->dev, "dma setup error %d, use pio\n", ret);
915+
else
916+
/*
917+
* disable LPSPI module IRQ when enable DMA mode successfully,
918+
* to prevent the unexpected LPSPI module IRQ events.
919+
*/
920+
disable_irq(irq);
916921

917922
ret = devm_spi_register_controller(&pdev->dev, controller);
918923
if (ret < 0) {

drivers/spi/spi-mt65xx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,9 @@ static int mtk_spi_remove(struct platform_device *pdev)
12751275
struct mtk_spi *mdata = spi_master_get_devdata(master);
12761276
int ret;
12771277

1278+
if (mdata->use_spimem && !completion_done(&mdata->spimem_done))
1279+
complete(&mdata->spimem_done);
1280+
12781281
ret = pm_runtime_resume_and_get(&pdev->dev);
12791282
if (ret < 0)
12801283
return ret;

drivers/spi/spi-qup.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,23 +1028,8 @@ static int spi_qup_probe(struct platform_device *pdev)
10281028
return -ENXIO;
10291029
}
10301030

1031-
ret = clk_prepare_enable(cclk);
1032-
if (ret) {
1033-
dev_err(dev, "cannot enable core clock\n");
1034-
return ret;
1035-
}
1036-
1037-
ret = clk_prepare_enable(iclk);
1038-
if (ret) {
1039-
clk_disable_unprepare(cclk);
1040-
dev_err(dev, "cannot enable iface clock\n");
1041-
return ret;
1042-
}
1043-
10441031
master = spi_alloc_master(dev, sizeof(struct spi_qup));
10451032
if (!master) {
1046-
clk_disable_unprepare(cclk);
1047-
clk_disable_unprepare(iclk);
10481033
dev_err(dev, "cannot allocate master\n");
10491034
return -ENOMEM;
10501035
}
@@ -1092,6 +1077,19 @@ static int spi_qup_probe(struct platform_device *pdev)
10921077
spin_lock_init(&controller->lock);
10931078
init_completion(&controller->done);
10941079

1080+
ret = clk_prepare_enable(cclk);
1081+
if (ret) {
1082+
dev_err(dev, "cannot enable core clock\n");
1083+
goto error_dma;
1084+
}
1085+
1086+
ret = clk_prepare_enable(iclk);
1087+
if (ret) {
1088+
clk_disable_unprepare(cclk);
1089+
dev_err(dev, "cannot enable iface clock\n");
1090+
goto error_dma;
1091+
}
1092+
10951093
iomode = readl_relaxed(base + QUP_IO_M_MODES);
10961094

10971095
size = QUP_IO_M_OUTPUT_BLOCK_SIZE(iomode);
@@ -1121,7 +1119,7 @@ static int spi_qup_probe(struct platform_device *pdev)
11211119
ret = spi_qup_set_state(controller, QUP_STATE_RESET);
11221120
if (ret) {
11231121
dev_err(dev, "cannot set RESET state\n");
1124-
goto error_dma;
1122+
goto error_clk;
11251123
}
11261124

11271125
writel_relaxed(0, base + QUP_OPERATIONAL);
@@ -1145,7 +1143,7 @@ static int spi_qup_probe(struct platform_device *pdev)
11451143
ret = devm_request_irq(dev, irq, spi_qup_qup_irq,
11461144
IRQF_TRIGGER_HIGH, pdev->name, controller);
11471145
if (ret)
1148-
goto error_dma;
1146+
goto error_clk;
11491147

11501148
pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
11511149
pm_runtime_use_autosuspend(dev);
@@ -1160,11 +1158,12 @@ static int spi_qup_probe(struct platform_device *pdev)
11601158

11611159
disable_pm:
11621160
pm_runtime_disable(&pdev->dev);
1161+
error_clk:
1162+
clk_disable_unprepare(cclk);
1163+
clk_disable_unprepare(iclk);
11631164
error_dma:
11641165
spi_qup_release_dma(master);
11651166
error:
1166-
clk_disable_unprepare(cclk);
1167-
clk_disable_unprepare(iclk);
11681167
spi_master_put(master);
11691168
return ret;
11701169
}

0 commit comments

Comments
 (0)