Commit a4d7d701 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 0bdd0f0b 0c331fd1
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -910,9 +910,14 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
	ret = fsl_lpspi_dma_init(&pdev->dev, fsl_lpspi, controller);
	if (ret == -EPROBE_DEFER)
		goto out_pm_get;

	if (ret < 0)
		dev_err(&pdev->dev, "dma setup error %d, use pio\n", ret);
	else
		/*
		 * disable LPSPI module IRQ when enable DMA mode successfully,
		 * to prevent the unexpected LPSPI module IRQ events.
		 */
		disable_irq(irq);

	ret = devm_spi_register_controller(&pdev->dev, controller);
	if (ret < 0) {
+3 −0
Original line number Diff line number Diff line
@@ -1275,6 +1275,9 @@ static int mtk_spi_remove(struct platform_device *pdev)
	struct mtk_spi *mdata = spi_master_get_devdata(master);
	int ret;

	if (mdata->use_spimem && !completion_done(&mdata->spimem_done))
		complete(&mdata->spimem_done);

	ret = pm_runtime_resume_and_get(&pdev->dev);
	if (ret < 0)
		return ret;
+18 −19
Original line number Diff line number Diff line
@@ -1028,23 +1028,8 @@ static int spi_qup_probe(struct platform_device *pdev)
		return -ENXIO;
	}

	ret = clk_prepare_enable(cclk);
	if (ret) {
		dev_err(dev, "cannot enable core clock\n");
		return ret;
	}

	ret = clk_prepare_enable(iclk);
	if (ret) {
		clk_disable_unprepare(cclk);
		dev_err(dev, "cannot enable iface clock\n");
		return ret;
	}

	master = spi_alloc_master(dev, sizeof(struct spi_qup));
	if (!master) {
		clk_disable_unprepare(cclk);
		clk_disable_unprepare(iclk);
		dev_err(dev, "cannot allocate master\n");
		return -ENOMEM;
	}
@@ -1092,6 +1077,19 @@ static int spi_qup_probe(struct platform_device *pdev)
	spin_lock_init(&controller->lock);
	init_completion(&controller->done);

	ret = clk_prepare_enable(cclk);
	if (ret) {
		dev_err(dev, "cannot enable core clock\n");
		goto error_dma;
	}

	ret = clk_prepare_enable(iclk);
	if (ret) {
		clk_disable_unprepare(cclk);
		dev_err(dev, "cannot enable iface clock\n");
		goto error_dma;
	}

	iomode = readl_relaxed(base + QUP_IO_M_MODES);

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

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

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

disable_pm:
	pm_runtime_disable(&pdev->dev);
error_clk:
	clk_disable_unprepare(cclk);
	clk_disable_unprepare(iclk);
error_dma:
	spi_qup_release_dma(master);
error:
	clk_disable_unprepare(cclk);
	clk_disable_unprepare(iclk);
	spi_master_put(master);
	return ret;
}