Merge remote-tracking branches 'spi/topic/fsl-dspi', 'spi/topic/imx', 'spi/topic...
authorMark Brown <broonie@kernel.org>
Fri, 26 Jan 2018 17:57:27 +0000 (17:57 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 26 Jan 2018 17:57:27 +0000 (17:57 +0000)
Documentation/devicetree/bindings/spi/spi-meson.txt
Documentation/devicetree/bindings/spi/spi-orion.txt
drivers/spi/spi-fsl-dspi.c
drivers/spi/spi-imx.c
drivers/spi/spi-jcore.c
drivers/spi/spi-meson-spicc.c
drivers/spi/spi-orion.c

index 825c39cae74a1522645729f3b77b47c18dba72ae..b7f5e86fed225b30a337b330e532804d4830ca51 100644 (file)
@@ -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"
index df8ec31f2f076ae4dafe29950797bd5f2fe68526..8434a65fc12a65959fe0b56801bd458d96175d2e 100644 (file)
@@ -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 {
index f652f70cb8db1652d5075e16f5b12fc5452362cc..0630962ce442ee09d82921f3f0130f60a541e37b 100644 (file)
@@ -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);
@@ -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);
 
index 40390d31a93b3aa4a4da8a7828dee2b0e7a16b4e..6f57592a7f95ad0980362dd69840d72846cbad77 100644 (file)
@@ -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) {
@@ -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);
index cebfea5faa4be247e2b8e145d96c3925c6a32ec7..dafed6280df3285055306df409070a73ba8283cb 100644 (file)
@@ -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;
 
index 7f84296355025d9f95d660c14587609fd6921975..5c82910e3480d06a506e728f4ddb9a2128bdd6d6 100644 (file)
@@ -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);
index 8974bb340b3abe40a438df71545396aa5c095f2d..deca63e82ff6884a52b405fabc208379ea107009 100644 (file)
@@ -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];
@@ -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);
 
        /*
@@ -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 */
@@ -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;
 
@@ -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:
@@ -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);
@@ -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;
 }
@@ -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