Commit 33c58c12 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'spi/topic/fsl-dspi', 'spi/topic/imx',...

Merge remote-tracking branches 'spi/topic/fsl-dspi', 'spi/topic/imx', 'spi/topic/jcore', 'spi/topic/meson' and 'spi/topic/orion' into spi-next
...@@ -27,7 +27,9 @@ The Meson SPICC is generic SPI controller for general purpose Full-Duplex ...@@ -27,7 +27,9 @@ The Meson SPICC is generic SPI controller for general purpose Full-Duplex
communications with dedicated 16 words RX/TX PIO FIFOs. communications with dedicated 16 words RX/TX PIO FIFOs.
Required properties: Required properties:
- compatible: should be "amlogic,meson-gx-spicc" on Amlogic GX SoCs. - compatible: should be:
"amlogic,meson-gx-spicc" on Amlogic GX and compatible SoCs.
"amlogic,meson-axg-spicc" on Amlogic AXG and compatible SoCs
- reg: physical base address and length of the controller registers - reg: physical base address and length of the controller registers
- interrupts: The interrupt specifier - interrupts: The interrupt specifier
- clock-names: Must contain "core" - clock-names: Must contain "core"
......
...@@ -18,8 +18,17 @@ Required properties: ...@@ -18,8 +18,17 @@ Required properties:
The eight register sets following the control registers refer to The eight register sets following the control registers refer to
chip-select lines 0 through 7 respectively. chip-select lines 0 through 7 respectively.
- cell-index : Which of multiple SPI controllers is this. - cell-index : Which of multiple SPI controllers is this.
- clocks : pointers to the reference clocks for this device, the first
one is the one used for the clock on the spi bus, the
second one is optional and is the clock used for the
functional part of the controller
Optional properties: Optional properties:
- interrupts : Is currently not used. - interrupts : Is currently not used.
- clock-names : names of used clocks, mandatory if the second clock is
used, the name must be "core", and "axi" (the latter
is only for Armada 7K/8K).
Example: Example:
spi@10600 { spi@10600 {
......
...@@ -903,10 +903,9 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) ...@@ -903,10 +903,9 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id)
} }
static const struct of_device_id fsl_dspi_dt_ids[] = { static const struct of_device_id fsl_dspi_dt_ids[] = {
{ .compatible = "fsl,vf610-dspi", .data = (void *)&vf610_data, }, { .compatible = "fsl,vf610-dspi", .data = &vf610_data, },
{ .compatible = "fsl,ls1021a-v1.0-dspi", { .compatible = "fsl,ls1021a-v1.0-dspi", .data = &ls1021a_v1_data, },
.data = (void *)&ls1021a_v1_data, }, { .compatible = "fsl,ls2085a-dspi", .data = &ls2085a_data, },
{ .compatible = "fsl,ls2085a-dspi", .data = (void *)&ls2085a_data, },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids); MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
...@@ -980,7 +979,7 @@ static int dspi_probe(struct platform_device *pdev) ...@@ -980,7 +979,7 @@ static int dspi_probe(struct platform_device *pdev)
master->dev.of_node = pdev->dev.of_node; master->dev.of_node = pdev->dev.of_node;
master->cleanup = dspi_cleanup; master->cleanup = dspi_cleanup;
master->mode_bits = SPI_CPOL | SPI_CPHA; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
master->bits_per_word_mask = SPI_BPW_MASK(4) | SPI_BPW_MASK(8) | master->bits_per_word_mask = SPI_BPW_MASK(4) | SPI_BPW_MASK(8) |
SPI_BPW_MASK(16); SPI_BPW_MASK(16);
......
...@@ -1622,6 +1622,11 @@ static int spi_imx_probe(struct platform_device *pdev) ...@@ -1622,6 +1622,11 @@ static int spi_imx_probe(struct platform_device *pdev)
spi_imx->devtype_data->intctrl(spi_imx, 0); spi_imx->devtype_data->intctrl(spi_imx, 0);
master->dev.of_node = pdev->dev.of_node; master->dev.of_node = pdev->dev.of_node;
ret = spi_bitbang_start(&spi_imx->bitbang);
if (ret) {
dev_err(&pdev->dev, "bitbang start failed with %d\n", ret);
goto out_clk_put;
}
/* Request GPIO CS lines, if any */ /* Request GPIO CS lines, if any */
if (!spi_imx->slave_mode && master->cs_gpios) { if (!spi_imx->slave_mode && master->cs_gpios) {
...@@ -1640,12 +1645,6 @@ static int spi_imx_probe(struct platform_device *pdev) ...@@ -1640,12 +1645,6 @@ static int spi_imx_probe(struct platform_device *pdev)
} }
} }
ret = spi_bitbang_start(&spi_imx->bitbang);
if (ret) {
dev_err(&pdev->dev, "bitbang start failed with %d\n", ret);
goto out_clk_put;
}
dev_info(&pdev->dev, "probed\n"); dev_info(&pdev->dev, "probed\n");
clk_disable(spi_imx->clk_ipg); clk_disable(spi_imx->clk_ipg);
......
...@@ -198,8 +198,10 @@ static int jcore_spi_probe(struct platform_device *pdev) ...@@ -198,8 +198,10 @@ static int jcore_spi_probe(struct platform_device *pdev)
/* Register our spi controller */ /* Register our spi controller */
err = devm_spi_register_master(&pdev->dev, master); err = devm_spi_register_master(&pdev->dev, master);
if (err) if (err) {
clk_disable(clk);
goto exit; goto exit;
}
return 0; return 0;
......
...@@ -599,6 +599,7 @@ static int meson_spicc_remove(struct platform_device *pdev) ...@@ -599,6 +599,7 @@ static int meson_spicc_remove(struct platform_device *pdev)
static const struct of_device_id meson_spicc_of_match[] = { static const struct of_device_id meson_spicc_of_match[] = {
{ .compatible = "amlogic,meson-gx-spicc", }, { .compatible = "amlogic,meson-gx-spicc", },
{ .compatible = "amlogic,meson-axg-spicc", },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, meson_spicc_of_match); MODULE_DEVICE_TABLE(of, meson_spicc_of_match);
......
...@@ -94,6 +94,7 @@ struct orion_spi { ...@@ -94,6 +94,7 @@ struct orion_spi {
struct spi_master *master; struct spi_master *master;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
struct clk *axi_clk;
const struct orion_spi_dev *devdata; const struct orion_spi_dev *devdata;
struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS]; struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS];
...@@ -634,6 +635,16 @@ static int orion_spi_probe(struct platform_device *pdev) ...@@ -634,6 +635,16 @@ static int orion_spi_probe(struct platform_device *pdev)
if (status) if (status)
goto out; goto out;
/* The following clock is only used by some SoCs */
spi->axi_clk = devm_clk_get(&pdev->dev, "axi");
if (IS_ERR(spi->axi_clk) &&
PTR_ERR(spi->axi_clk) == -EPROBE_DEFER) {
status = -EPROBE_DEFER;
goto out_rel_clk;
}
if (!IS_ERR(spi->axi_clk))
clk_prepare_enable(spi->axi_clk);
tclk_hz = clk_get_rate(spi->clk); tclk_hz = clk_get_rate(spi->clk);
/* /*
...@@ -658,7 +669,7 @@ static int orion_spi_probe(struct platform_device *pdev) ...@@ -658,7 +669,7 @@ static int orion_spi_probe(struct platform_device *pdev)
spi->base = devm_ioremap_resource(&pdev->dev, r); spi->base = devm_ioremap_resource(&pdev->dev, r);
if (IS_ERR(spi->base)) { if (IS_ERR(spi->base)) {
status = PTR_ERR(spi->base); status = PTR_ERR(spi->base);
goto out_rel_clk; goto out_rel_axi_clk;
} }
/* Scan all SPI devices of this controller for direct mapped devices */ /* Scan all SPI devices of this controller for direct mapped devices */
...@@ -696,7 +707,7 @@ static int orion_spi_probe(struct platform_device *pdev) ...@@ -696,7 +707,7 @@ static int orion_spi_probe(struct platform_device *pdev)
PAGE_SIZE); PAGE_SIZE);
if (!spi->direct_access[cs].vaddr) { if (!spi->direct_access[cs].vaddr) {
status = -ENOMEM; status = -ENOMEM;
goto out_rel_clk; goto out_rel_axi_clk;
} }
spi->direct_access[cs].size = PAGE_SIZE; spi->direct_access[cs].size = PAGE_SIZE;
...@@ -724,6 +735,8 @@ static int orion_spi_probe(struct platform_device *pdev) ...@@ -724,6 +735,8 @@ static int orion_spi_probe(struct platform_device *pdev)
out_rel_pm: out_rel_pm:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
out_rel_axi_clk:
clk_disable_unprepare(spi->axi_clk);
out_rel_clk: out_rel_clk:
clk_disable_unprepare(spi->clk); clk_disable_unprepare(spi->clk);
out: out:
...@@ -738,6 +751,7 @@ static int orion_spi_remove(struct platform_device *pdev) ...@@ -738,6 +751,7 @@ static int orion_spi_remove(struct platform_device *pdev)
struct orion_spi *spi = spi_master_get_devdata(master); struct orion_spi *spi = spi_master_get_devdata(master);
pm_runtime_get_sync(&pdev->dev); pm_runtime_get_sync(&pdev->dev);
clk_disable_unprepare(spi->axi_clk);
clk_disable_unprepare(spi->clk); clk_disable_unprepare(spi->clk);
spi_unregister_master(master); spi_unregister_master(master);
...@@ -754,6 +768,7 @@ static int orion_spi_runtime_suspend(struct device *dev) ...@@ -754,6 +768,7 @@ static int orion_spi_runtime_suspend(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct orion_spi *spi = spi_master_get_devdata(master); struct orion_spi *spi = spi_master_get_devdata(master);
clk_disable_unprepare(spi->axi_clk);
clk_disable_unprepare(spi->clk); clk_disable_unprepare(spi->clk);
return 0; return 0;
} }
...@@ -763,6 +778,8 @@ static int orion_spi_runtime_resume(struct device *dev) ...@@ -763,6 +778,8 @@ static int orion_spi_runtime_resume(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev); struct spi_master *master = dev_get_drvdata(dev);
struct orion_spi *spi = spi_master_get_devdata(master); struct orion_spi *spi = spi_master_get_devdata(master);
if (!IS_ERR(spi->axi_clk))
clk_prepare_enable(spi->axi_clk);
return clk_prepare_enable(spi->clk); return clk_prepare_enable(spi->clk);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment