Skip to content

Commit

Permalink
Merge remote-tracking branches 'spi/topic/fsl-dspi', 'spi/topic/imx',…
Browse files Browse the repository at this point in the history
… 'spi/topic/jcore', 'spi/topic/meson' and 'spi/topic/orion' into spi-next
  • Loading branch information
broonie committed Jan 26, 2018
6 parents ae324b2 + 230c08b + 8197f48 + 16eab16 + a5db27c + 479c03a commit 33c58c1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/spi/spi-meson.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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
- interrupts: The interrupt specifier
- clock-names: Must contain "core"
Expand Down
9 changes: 9 additions & 0 deletions Documentation/devicetree/bindings/spi/spi-orion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,17 @@ Required properties:
The eight register sets following the control registers refer to
chip-select lines 0 through 7 respectively.
- 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:
- 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:
spi@10600 {
Expand Down
9 changes: 4 additions & 5 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,10 +903,9 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id)
}

static const struct of_device_id fsl_dspi_dt_ids[] = {
{ .compatible = "fsl,vf610-dspi", .data = (void *)&vf610_data, },
{ .compatible = "fsl,ls1021a-v1.0-dspi",
.data = (void *)&ls1021a_v1_data, },
{ .compatible = "fsl,ls2085a-dspi", .data = (void *)&ls2085a_data, },
{ .compatible = "fsl,vf610-dspi", .data = &vf610_data, },
{ .compatible = "fsl,ls1021a-v1.0-dspi", .data = &ls1021a_v1_data, },
{ .compatible = "fsl,ls2085a-dspi", .data = &ls2085a_data, },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
Expand Down Expand Up @@ -980,7 +979,7 @@ static int dspi_probe(struct platform_device *pdev)
master->dev.of_node = pdev->dev.of_node;

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) |
SPI_BPW_MASK(16);

Expand Down
11 changes: 5 additions & 6 deletions drivers/spi/spi-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,11 @@ static int spi_imx_probe(struct platform_device *pdev)
spi_imx->devtype_data->intctrl(spi_imx, 0);

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 */
if (!spi_imx->slave_mode && master->cs_gpios) {
Expand All @@ -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");

clk_disable(spi_imx->clk_ipg);
Expand Down
4 changes: 3 additions & 1 deletion drivers/spi/spi-jcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ static int jcore_spi_probe(struct platform_device *pdev)

/* Register our spi controller */
err = devm_spi_register_master(&pdev->dev, master);
if (err)
if (err) {
clk_disable(clk);
goto exit;
}

return 0;

Expand Down
1 change: 1 addition & 0 deletions drivers/spi/spi-meson-spicc.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ static int meson_spicc_remove(struct platform_device *pdev)

static const struct of_device_id meson_spicc_of_match[] = {
{ .compatible = "amlogic,meson-gx-spicc", },
{ .compatible = "amlogic,meson-axg-spicc", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, meson_spicc_of_match);
Expand Down
21 changes: 19 additions & 2 deletions drivers/spi/spi-orion.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct orion_spi {
struct spi_master *master;
void __iomem *base;
struct clk *clk;
struct clk *axi_clk;
const struct orion_spi_dev *devdata;

struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS];
Expand Down Expand Up @@ -634,6 +635,16 @@ static int orion_spi_probe(struct platform_device *pdev)
if (status)
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);

/*
Expand All @@ -658,7 +669,7 @@ static int orion_spi_probe(struct platform_device *pdev)
spi->base = devm_ioremap_resource(&pdev->dev, r);
if (IS_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 */
Expand Down Expand Up @@ -696,7 +707,7 @@ static int orion_spi_probe(struct platform_device *pdev)
PAGE_SIZE);
if (!spi->direct_access[cs].vaddr) {
status = -ENOMEM;
goto out_rel_clk;
goto out_rel_axi_clk;
}
spi->direct_access[cs].size = PAGE_SIZE;

Expand Down Expand Up @@ -724,6 +735,8 @@ static int orion_spi_probe(struct platform_device *pdev)

out_rel_pm:
pm_runtime_disable(&pdev->dev);
out_rel_axi_clk:
clk_disable_unprepare(spi->axi_clk);
out_rel_clk:
clk_disable_unprepare(spi->clk);
out:
Expand All @@ -738,6 +751,7 @@ static int orion_spi_remove(struct platform_device *pdev)
struct orion_spi *spi = spi_master_get_devdata(master);

pm_runtime_get_sync(&pdev->dev);
clk_disable_unprepare(spi->axi_clk);
clk_disable_unprepare(spi->clk);

spi_unregister_master(master);
Expand All @@ -754,6 +768,7 @@ static int orion_spi_runtime_suspend(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev);
struct orion_spi *spi = spi_master_get_devdata(master);

clk_disable_unprepare(spi->axi_clk);
clk_disable_unprepare(spi->clk);
return 0;
}
Expand All @@ -763,6 +778,8 @@ static int orion_spi_runtime_resume(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev);
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);
}
#endif
Expand Down

0 comments on commit 33c58c1

Please sign in to comment.