linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] spi s3c64xx ioclk handling
@ 2016-07-08 14:46 Andi Shyti
  2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
                   ` (7 more replies)
  0 siblings, 8 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Hi,

this patchset improves the compatibility between the s3c64xx
driver and the exynos5433. One point of incompatibility, indeed,
was that the SPI controller in exynos5433 is fed by three clocks
which need to be handled by the driver. The third clock is the
ioclk which support is the main purpose of this patchset.
  
Patch 6 is a bit unrelated with the rest, it restores a
comment that has been removed earlier by mistake.

The last patch was first sent on its own and it was its 5th
version, it has been queued to this patchset as there is a
dependency with it.

Changelog V1 -> V2:

 - patch 1: the exynos5433-spi compatible is placed in
   alphabetical order compared to exynos7-spi

 - patch 1: deprecates exynos7-spi

 - patch 2: [new] added the clocks and clock-name documentation
   in the bindings

 - patch 3: fixed some typos, renamed the goto label from
   err_power_off to err_pm_put add the reviewd-by Krzysztof

 - patch 4: new patch

 - patch 5: fixed typos in commit message and use low letters for
   hex numbers

 - patch 6: removed one line of comment

 - patch 7: added to ensure sequentiality.

Thanks,
Andi


Andi Shyti (7):
  bindings: spi-samsung: add exynos5433 spi compatible
  bindings: spi-samsung: document the clocks and the clock-name property
  spi: s3c64xx: rename goto labels to meaningful names
  spi: s3c64xx: use error code from clk_prepare_enable()
  spi: s3c64xx: add exynos5433 compatible for ioclk handling
  spi: s3c64xx: restore removed comments
  clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks

 .../devicetree/bindings/spi/spi-samsung.txt        | 11 ++-
 drivers/clk/samsung/clk-exynos5433.c               |  5 +-
 drivers/spi/spi-s3c64xx.c                          | 90 +++++++++++++++++-----
 3 files changed, 81 insertions(+), 25 deletions(-)

-- 
2.8.1

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-08 20:23   ` Krzysztof Kozlowski
                     ` (2 more replies)
  2016-07-08 14:46 ` [PATCH v2 2/7] bindings: spi-samsung: document the clocks and the clock-name property Andi Shyti
                   ` (6 subsequent siblings)
  7 siblings, 3 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

The samsung,exynos5433-spi has some peculiarities that bring the
need of creating a new compatible in the binding.

One of those is the 3-clocks controller management where the spi
is fed with three clocks: "spi", "busclkN" and "ioclk".

By adding the exynos5433-spi, we deprecate the exynos7 compatible
and discourage its use.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 Documentation/devicetree/bindings/spi/spi-samsung.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index 6dbdeb3..57d5539 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -9,7 +9,8 @@ Required SoC Specific Properties:
     - samsung,s3c2443-spi: for s3c2443, s3c2416 and s3c2450 platforms
     - samsung,s3c6410-spi: for s3c6410 platforms
     - samsung,s5pv210-spi: for s5pv210 and s5pc110 platforms
-    - samsung,exynos7-spi: for exynos7 platforms
+    - samsung,exynos5433-spi: for exynos5433 compatible controllers
+    - samsung,exynos7-spi: for exynos7 platforms <DEPRECATED>
 
 - reg: physical base address of the controller and length of memory mapped
   region.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v2 2/7] bindings: spi-samsung: document the clocks and the clock-name property
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
  2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-08 20:32   ` Krzysztof Kozlowski
  2016-07-08 14:46 ` [PATCH v2 3/7] spi: s3c64xx: rename goto labels to meaningful names Andi Shyti
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

These two properties were not documented but used in the spi
dts. Add the related documentation.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 Documentation/devicetree/bindings/spi/spi-samsung.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index 57d5539..2b7167e 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -24,6 +24,14 @@ Required SoC Specific Properties:
 - dma-names: Names for the dma channels. There must be at least one channel
   named "tx" for transmit and named "rx" for receive.
 
+- clocks: specifies the clock IDs provided to the SPI controller; they are
+  required for interacting with the controller itself, for synchronizing the bus
+  and as I/O clock (the latter is required by exynos5433 and exynos7).
+
+- clock-names: string names of the clocks in the 'clocks' property; the names
+  mut be "spi", "spi_busclkN" and "spi_ioclk", where N is determined by
+  "samsung,spi-src-clk".
+
 Required Board Specific Properties:
 
 - #address-cells: should be 1.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v2 3/7] spi: s3c64xx: rename goto labels to meaningful names
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
  2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
  2016-07-08 14:46 ` [PATCH v2 2/7] bindings: spi-samsung: document the clocks and the clock-name property Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-14 16:32   ` Applied "spi: s3c64xx: rename goto labels to meaningful names" to the spi tree Mark Brown
  2016-07-08 14:46 ` [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable() Andi Shyti
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

The goto labels of the style of

  err4:
  err3:
  err2:
  err1:

are complex to insert in between new errors without renaming all
the goto statements. Replace the errX naming style to meaningful
names in order to make it easier to insert new goto exit points.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/spi/spi-s3c64xx.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 6f2e91a..0784a4d 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1071,7 +1071,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		if (ret < 0) {
 			dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
 				ret);
-			goto err0;
+			goto err_deref_master;
 		}
 		sdd->port_id = ret;
 	} else {
@@ -1109,13 +1109,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res);
 	if (IS_ERR(sdd->regs)) {
 		ret = PTR_ERR(sdd->regs);
-		goto err0;
+		goto err_deref_master;
 	}
 
 	if (sci->cfg_gpio && sci->cfg_gpio()) {
 		dev_err(&pdev->dev, "Unable to config gpio\n");
 		ret = -EBUSY;
-		goto err0;
+		goto err_deref_master;
 	}
 
 	/* Setup clocks */
@@ -1123,13 +1123,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	if (IS_ERR(sdd->clk)) {
 		dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n");
 		ret = PTR_ERR(sdd->clk);
-		goto err0;
+		goto err_deref_master;
 	}
 
 	if (clk_prepare_enable(sdd->clk)) {
 		dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
 		ret = -EBUSY;
-		goto err0;
+		goto err_deref_master;
 	}
 
 	sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr);
@@ -1138,13 +1138,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev,
 			"Unable to acquire clock '%s'\n", clk_name);
 		ret = PTR_ERR(sdd->src_clk);
-		goto err2;
+		goto err_disable_clk;
 	}
 
 	if (clk_prepare_enable(sdd->src_clk)) {
 		dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
 		ret = -EBUSY;
-		goto err2;
+		goto err_disable_clk;
 	}
 
 	pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
@@ -1164,7 +1164,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	if (ret != 0) {
 		dev_err(&pdev->dev, "Failed to request IRQ %d: %d\n",
 			irq, ret);
-		goto err3;
+		goto err_pm_put;
 	}
 
 	writel(S3C64XX_SPI_INT_RX_OVERRUN_EN | S3C64XX_SPI_INT_RX_UNDERRUN_EN |
@@ -1174,7 +1174,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "cannot register SPI master: %d\n", ret);
-		goto err3;
+		goto err_pm_put;
 	}
 
 	dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n",
@@ -1188,15 +1188,15 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 
 	return 0;
 
-err3:
+err_pm_put:
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
 	clk_disable_unprepare(sdd->src_clk);
-err2:
+err_disable_clk:
 	clk_disable_unprepare(sdd->clk);
-err0:
+err_deref_master:
 	spi_master_put(master);
 
 	return ret;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable()
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
                   ` (2 preceding siblings ...)
  2016-07-08 14:46 ` [PATCH v2 3/7] spi: s3c64xx: rename goto labels to meaningful names Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-08 20:33   ` Krzysztof Kozlowski
  2016-07-14 16:32   ` Applied "spi: s3c64xx: use error code from clk_prepare_enable()" to the spi tree Mark Brown
  2016-07-08 14:46 ` [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling Andi Shyti
                   ` (3 subsequent siblings)
  7 siblings, 2 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

If clk_prepare_enable() fails do not return -EBUSY but use the
value provided by the function itself.

Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/spi/spi-s3c64xx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 0784a4d..3a65adf 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1126,9 +1126,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		goto err_deref_master;
 	}
 
-	if (clk_prepare_enable(sdd->clk)) {
+	ret = clk_prepare_enable(sdd->clk);
+	if (ret) {
 		dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
-		ret = -EBUSY;
 		goto err_deref_master;
 	}
 
@@ -1141,9 +1141,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		goto err_disable_clk;
 	}
 
-	if (clk_prepare_enable(sdd->src_clk)) {
+	ret = clk_prepare_enable(sdd->src_clk);
+	if (ret) {
 		dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
-		ret = -EBUSY;
 		goto err_disable_clk;
 	}
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
                   ` (3 preceding siblings ...)
  2016-07-08 14:46 ` [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable() Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-08 16:13   ` Michael Turquette
                     ` (2 more replies)
  2016-07-08 14:46 ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Andi Shyti
                   ` (2 subsequent siblings)
  7 siblings, 3 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

The new compatible is related to the Samsung Exynos5433 SoC. The
difference between the previous is that in the exynos5433 the SPI
controller is driven by three clocks instead of only one.

The new clock (ioclk) is controlling the input/output clock
whenever the controller is slave or master.

The presence of the clock line is detected from the compatibility
structure (exynos5433_spi_port_config) as a boolean value.

The probe function checks whether the ioclk is present and if so,
it acquires.

The runtime suspend and resume functions will handle the clock
enabling and disabling as well.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/spi/spi-s3c64xx.c | 57 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 3a65adf..6da663f 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -156,12 +156,14 @@ struct s3c64xx_spi_port_config {
 	int	quirks;
 	bool	high_speed;
 	bool	clk_from_cmu;
+	bool	clk_ioclk;
 };
 
 /**
  * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver.
  * @clk: Pointer to the spi clock.
  * @src_clk: Pointer to the clock used to generate SPI signals.
+ * @ioclk: Pointer to the i/o clock between master and slave
  * @master: Pointer to the SPI Protocol master.
  * @cntrlr_info: Platform specific data for the controller this driver manages.
  * @tgl_spi: Pointer to the last CS left untoggled by the cs_change hint.
@@ -181,6 +183,7 @@ struct s3c64xx_spi_driver_data {
 	void __iomem                    *regs;
 	struct clk                      *clk;
 	struct clk                      *src_clk;
+	struct clk                      *ioclk;
 	struct platform_device          *pdev;
 	struct spi_master               *master;
 	struct s3c64xx_spi_info  *cntrlr_info;
@@ -1147,6 +1150,21 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		goto err_disable_clk;
 	}
 
+	if (sdd->port_conf->clk_ioclk) {
+		sdd->ioclk = devm_clk_get(&pdev->dev, "spi_ioclk");
+		if (IS_ERR(sdd->ioclk)) {
+			dev_err(&pdev->dev, "Unable to acquire 'ioclk'\n");
+			ret = PTR_ERR(sdd->ioclk);
+			goto err_disable_src_clk;
+		}
+
+		ret = clk_prepare_enable(sdd->ioclk);
+		if (ret) {
+			dev_err(&pdev->dev, "Couldn't enable clock 'ioclk'\n");
+			goto err_disable_src_clk;
+		}
+	}
+
 	pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_active(&pdev->dev);
@@ -1193,6 +1211,8 @@ err_pm_put:
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
+	clk_disable_unprepare(sdd->ioclk);
+err_disable_src_clk:
 	clk_disable_unprepare(sdd->src_clk);
 err_disable_clk:
 	clk_disable_unprepare(sdd->clk);
@@ -1211,6 +1231,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 
 	writel(0, sdd->regs + S3C64XX_SPI_INT_EN);
 
+	clk_disable_unprepare(sdd->ioclk);
+
 	clk_disable_unprepare(sdd->src_clk);
 
 	clk_disable_unprepare(sdd->clk);
@@ -1269,6 +1291,7 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev)
 
 	clk_disable_unprepare(sdd->clk);
 	clk_disable_unprepare(sdd->src_clk);
+	clk_disable_unprepare(sdd->ioclk);
 
 	return 0;
 }
@@ -1279,17 +1302,28 @@ static int s3c64xx_spi_runtime_resume(struct device *dev)
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
 	int ret;
 
+	if (sdd->port_conf->clk_ioclk) {
+		ret = clk_prepare_enable(sdd->ioclk);
+		if (ret != 0)
+			return ret;
+	}
+
 	ret = clk_prepare_enable(sdd->src_clk);
 	if (ret != 0)
-		return ret;
+		goto err_disable_ioclk;
 
 	ret = clk_prepare_enable(sdd->clk);
-	if (ret != 0) {
-		clk_disable_unprepare(sdd->src_clk);
-		return ret;
-	}
+	if (ret != 0)
+		goto err_disable_src_clk;
 
 	return 0;
+
+err_disable_src_clk:
+	clk_disable_unprepare(sdd->src_clk);
+err_disable_ioclk:
+	clk_disable_unprepare(sdd->ioclk);
+
+	return ret;
 }
 #endif /* CONFIG_PM */
 
@@ -1345,6 +1379,16 @@ static struct s3c64xx_spi_port_config exynos7_spi_port_config = {
 	.quirks		= S3C64XX_SPI_QUIRK_CS_AUTO,
 };
 
+static struct s3c64xx_spi_port_config exynos5433_spi_port_config = {
+	.fifo_lvl_mask	= { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff},
+	.rx_lvl_offset	= 15,
+	.tx_st_done	= 25,
+	.high_speed	= true,
+	.clk_from_cmu	= true,
+	.clk_ioclk	= true,
+	.quirks		= S3C64XX_SPI_QUIRK_CS_AUTO,
+};
+
 static const struct platform_device_id s3c64xx_spi_driver_ids[] = {
 	{
 		.name		= "s3c2443-spi",
@@ -1375,6 +1419,9 @@ static const struct of_device_id s3c64xx_spi_dt_match[] = {
 	{ .compatible = "samsung,exynos7-spi",
 			.data = (void *)&exynos7_spi_port_config,
 	},
+	{ .compatible = "samsung,exynos5433-spi",
+			.data = (void *)&exynos5433_spi_port_config,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, s3c64xx_spi_dt_match);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
                   ` (4 preceding siblings ...)
  2016-07-08 14:46 ` [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-08 16:17   ` Michael Turquette
  2016-07-08 20:35   ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Krzysztof Kozlowski
  2016-07-08 14:46 ` [PATCH v2 7/7] clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks Andi Shyti
  2016-07-08 16:21 ` [PATCH v2 0/7] spi s3c64xx ioclk handling Michael Turquette
  7 siblings, 2 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Patch a9e93e8 has erroneously removed some comments which are
important to understand why the bus frequency is multiplied by
two during the spi transfer.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/spi/spi-s3c64xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 6da663f..32b66f0 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_MODE_CFG);
 
 	if (sdd->port_conf->clk_from_cmu) {
+		/* There is half-multiplier before the SPI */
 		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
 	} else {
 		/* Configure Clock */
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v2 7/7] clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
                   ` (5 preceding siblings ...)
  2016-07-08 14:46 ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Andi Shyti
@ 2016-07-08 14:46 ` Andi Shyti
  2016-07-11 10:58   ` Sylwester Nawrocki
  2016-07-08 16:21 ` [PATCH v2 0/7] spi s3c64xx ioclk handling Michael Turquette
  7 siblings, 1 reply; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 14:46 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Because the Exynos5433 SPI driver supports the ioclk handling and
the following patch:

  http://marc.info/?l=linux-kernel&m=146787645626318&w=2

fixes a synchronus abort issue, none of the SPI clocks require
any critical handling: remove, then, the CLK_IGNORE_UNUSED flag
for the SPI related clocks.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/clk/samsung/clk-exynos5433.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
index c3a5318..fb19525 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -1661,8 +1661,7 @@ static struct samsung_gate_clock peric_gate_clks[] __initdata = {
 	GATE(CLK_SCLK_IOCLK_SPI2, "sclk_ioclk_spi2", "ioclk_spi2_clk_in",
 			ENABLE_SCLK_PERIC, 13, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_IOCLK_SPI1, "sclk_ioclk_spi1", "ioclk_spi1_clk_in",
-			ENABLE_SCLK_PERIC, 12,
-			CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0),
+			ENABLE_SCLK_PERIC, 12, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_IOCLK_SPI0, "sclk_ioclk_spi0", "ioclk_spi0_clk_in",
 			ENABLE_SCLK_PERIC, 11, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_IOCLK_I2S1_BCLK, "sclk_ioclk_i2s1_bclk",
@@ -1677,7 +1676,7 @@ static struct samsung_gate_clock peric_gate_clks[] __initdata = {
 	GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC,
 			5, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC,
-			4, CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0),
+			4, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_SPI0, "sclk_spi0", "sclk_spi0_peric", ENABLE_SCLK_PERIC,
 			3, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_UART2, "sclk_uart2", "sclk_uart2_peric",
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling
  2016-07-08 14:46 ` [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling Andi Shyti
@ 2016-07-08 16:13   ` Michael Turquette
  2016-07-08 16:31     ` Andi Shyti
  2016-07-08 20:39   ` Krzysztof Kozlowski
  2016-07-14 16:32   ` Applied "spi: s3c64xx: add Exynos5433 compatible for ioclk handling" to the spi tree Mark Brown
  2 siblings, 1 reply; 36+ messages in thread
From: Michael Turquette @ 2016-07-08 16:13 UTC (permalink / raw)
  To: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Quoting Andi Shyti (2016-07-08 07:46:39)
> @@ -1147,6 +1150,21 @@ static int s3c64xx_spi_probe(struct platform_devic=
e *pdev)
>                 goto err_disable_clk;
>         }
>  =

> +       if (sdd->port_conf->clk_ioclk) {
> +               sdd->ioclk =3D devm_clk_get(&pdev->dev, "spi_ioclk");
> +               if (IS_ERR(sdd->ioclk)) {
> +                       dev_err(&pdev->dev, "Unable to acquire 'ioclk'\n"=
);
> +                       ret =3D PTR_ERR(sdd->ioclk);
> +                       goto err_disable_src_clk;
> +               }
> +
> +               ret =3D clk_prepare_enable(sdd->ioclk);
> +               if (ret) {
> +                       dev_err(&pdev->dev, "Couldn't enable clock 'ioclk=
'\n");
> +                       goto err_disable_src_clk;
> +               }
> +       }
> +
>         pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
>         pm_runtime_use_autosuspend(&pdev->dev);
>         pm_runtime_set_active(&pdev->dev);
> @@ -1193,6 +1211,8 @@ err_pm_put:
>         pm_runtime_disable(&pdev->dev);
>         pm_runtime_set_suspended(&pdev->dev);
>  =

> +       clk_disable_unprepare(sdd->ioclk);
> +err_disable_src_clk:
>         clk_disable_unprepare(sdd->src_clk);
>  err_disable_clk:
>         clk_disable_unprepare(sdd->clk);

Why aren't these clocks enabled/disabled by calls to pm_runtime_get/put?

Regards,
Mike

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-08 14:46 ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Andi Shyti
@ 2016-07-08 16:17   ` Michael Turquette
  2016-07-08 16:35     ` Andi Shyti
  2016-07-11 10:33     ` Sylwester Nawrocki
  2016-07-08 20:35   ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Krzysztof Kozlowski
  1 sibling, 2 replies; 36+ messages in thread
From: Michael Turquette @ 2016-07-08 16:17 UTC (permalink / raw)
  To: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Quoting Andi Shyti (2016-07-08 07:46:40)
> Patch a9e93e8 has erroneously removed some comments which are
> important to understand why the bus frequency is multiplied by
> two during the spi transfer.
> =

> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c | 1 +
>  1 file changed, 1 insertion(+)
> =

> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 6da663f..32b66f0 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_dri=
ver_data *sdd)
>         writel(val, regs + S3C64XX_SPI_MODE_CFG);
>  =

>         if (sdd->port_conf->clk_from_cmu) {
> +               /* There is half-multiplier before the SPI */
>                 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);

Just a small comment, but if the fixed-factor divide-by-two clock was
modeled in Linux, then this driver could call clk_set_rate on that clock
with the "correct" rate.

I guess that this driver would be the provider of that clock?

Regards,
Mike

>         } else {
>                 /* Configure Clock */
> -- =

> 2.8.1
>=20

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 0/7] spi s3c64xx ioclk handling
  2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
                   ` (6 preceding siblings ...)
  2016-07-08 14:46 ` [PATCH v2 7/7] clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks Andi Shyti
@ 2016-07-08 16:21 ` Michael Turquette
  7 siblings, 0 replies; 36+ messages in thread
From: Michael Turquette @ 2016-07-08 16:21 UTC (permalink / raw)
  To: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Quoting Andi Shyti (2016-07-08 07:46:34)
> Hi,
> =

> this patchset improves the compatibility between the s3c64xx
> driver and the exynos5433. One point of incompatibility, indeed,
> was that the SPI controller in exynos5433 is fed by three clocks
> which need to be handled by the driver. The third clock is the
> ioclk which support is the main purpose of this patchset.
>   =

> Patch 6 is a bit unrelated with the rest, it restores a
> comment that has been removed earlier by mistake.
> =

> The last patch was first sent on its own and it was its 5th
> version, it has been queued to this patchset as there is a
> dependency with it.

Feel free to add the following to all of the patches:

Reviewed-by: Michael Turquette <mturquette@baylibre.com>

Regards,
Mike

> =

> Changelog V1 -> V2:
> =

>  - patch 1: the exynos5433-spi compatible is placed in
>    alphabetical order compared to exynos7-spi
> =

>  - patch 1: deprecates exynos7-spi
> =

>  - patch 2: [new] added the clocks and clock-name documentation
>    in the bindings
> =

>  - patch 3: fixed some typos, renamed the goto label from
>    err_power_off to err_pm_put add the reviewd-by Krzysztof
> =

>  - patch 4: new patch
> =

>  - patch 5: fixed typos in commit message and use low letters for
>    hex numbers
> =

>  - patch 6: removed one line of comment
> =

>  - patch 7: added to ensure sequentiality.
> =

> Thanks,
> Andi
> =

> =

> Andi Shyti (7):
>   bindings: spi-samsung: add exynos5433 spi compatible
>   bindings: spi-samsung: document the clocks and the clock-name property
>   spi: s3c64xx: rename goto labels to meaningful names
>   spi: s3c64xx: use error code from clk_prepare_enable()
>   spi: s3c64xx: add exynos5433 compatible for ioclk handling
>   spi: s3c64xx: restore removed comments
>   clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks
> =

>  .../devicetree/bindings/spi/spi-samsung.txt        | 11 ++-
>  drivers/clk/samsung/clk-exynos5433.c               |  5 +-
>  drivers/spi/spi-s3c64xx.c                          | 90 ++++++++++++++++=
+-----
>  3 files changed, 81 insertions(+), 25 deletions(-)
> =

> -- =

> 2.8.1
>=20

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling
  2016-07-08 16:13   ` Michael Turquette
@ 2016-07-08 16:31     ` Andi Shyti
  0 siblings, 0 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 16:31 UTC (permalink / raw)
  To: Michael Turquette
  Cc: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

Hi Mike,

> >         pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
> >         pm_runtime_use_autosuspend(&pdev->dev);
> >         pm_runtime_set_active(&pdev->dev);
> > @@ -1193,6 +1211,8 @@ err_pm_put:
> >         pm_runtime_disable(&pdev->dev);
> >         pm_runtime_set_suspended(&pdev->dev);
> >  
> > +       clk_disable_unprepare(sdd->ioclk);
> > +err_disable_src_clk:
> >         clk_disable_unprepare(sdd->src_clk);
> >  err_disable_clk:
> >         clk_disable_unprepare(sdd->clk);
> 
> Why aren't these clocks enabled/disabled by calls to pm_runtime_get/put?

yes, they are, but this should be fixed in a different patch.

I will send a follow-up, thanks for pointing this out.

Andi

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-08 16:17   ` Michael Turquette
@ 2016-07-08 16:35     ` Andi Shyti
  2016-07-11 10:33     ` Sylwester Nawrocki
  1 sibling, 0 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-08 16:35 UTC (permalink / raw)
  To: Michael Turquette
  Cc: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

Hi Mike,

> >         if (sdd->port_conf->clk_from_cmu) {
> > +               /* There is half-multiplier before the SPI */
> >                 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
> 
> Just a small comment, but if the fixed-factor divide-by-two clock was
> modeled in Linux, then this driver could call clk_set_rate on that clock
> with the "correct" rate.
> 
> I guess that this driver would be the provider of that clock?

Makes sense, I will check it.

Thanks again,
Andi

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible
  2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
@ 2016-07-08 20:23   ` Krzysztof Kozlowski
  2016-07-11 10:49   ` Sylwester Nawrocki
  2016-07-14 16:33   ` Applied "spi: s3c64xx: add exynos5433 spi compatible" to the spi tree Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-08 20:23 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti, krzk

On Fri, Jul 08, 2016 at 11:46:35PM +0900, Andi Shyti wrote:
> The samsung,exynos5433-spi has some peculiarities that bring the
> need of creating a new compatible in the binding.
> 
> One of those is the 3-clocks controller management where the spi
> is fed with three clocks: "spi", "busclkN" and "ioclk".
> 
> By adding the exynos5433-spi, we deprecate the exynos7 compatible
> and discourage its use.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-samsung.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 2/7] bindings: spi-samsung: document the clocks and the clock-name property
  2016-07-08 14:46 ` [PATCH v2 2/7] bindings: spi-samsung: document the clocks and the clock-name property Andi Shyti
@ 2016-07-08 20:32   ` Krzysztof Kozlowski
  2016-07-11  2:36     ` [PATCH v3] " Andi Shyti
  0 siblings, 1 reply; 36+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-08 20:32 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

On Fri, Jul 08, 2016 at 11:46:36PM +0900, Andi Shyti wrote:
> These two properties were not documented but used in the spi
> dts. Add the related documentation.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-samsung.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
> index 57d5539..2b7167e 100644
> --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
> @@ -24,6 +24,14 @@ Required SoC Specific Properties:
>  - dma-names: Names for the dma channels. There must be at least one channel
>    named "tx" for transmit and named "rx" for receive.
>  
> +- clocks: specifies the clock IDs provided to the SPI controller; they are
> +  required for interacting with the controller itself, for synchronizing the bus
> +  and as I/O clock (the latter is required by exynos5433 and exynos7).
> +
> +- clock-names: string names of the clocks in the 'clocks' property; the names
> +  mut be "spi", "spi_busclkN" and "spi_ioclk", where N is determined by

s/mut/must/

> +  "samsung,spi-src-clk".

Thanks for taking care of this! Older SoCs (like s3c-s5p) even though
they do not set clk_from_cmu, it seems they required them as well...
this is a little bit strange but at least now the documentation matches
the driver.

I would only describe the difference in number of clocks in more
specific way, e.g.:

 - clock-names: string names of the clocks in the 'clocks' property; for all
   devices the names must be "spi", "spi_busclkN" (where N is determined by
   "samsung,spi-src-clk"); for Exynos5433 it must contain third clock
   named "spi_ioclk"

... or something similar.

Anyway in general:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable()
  2016-07-08 14:46 ` [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable() Andi Shyti
@ 2016-07-08 20:33   ` Krzysztof Kozlowski
  2016-07-14 16:32   ` Applied "spi: s3c64xx: use error code from clk_prepare_enable()" to the spi tree Mark Brown
  1 sibling, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-08 20:33 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

On Fri, Jul 08, 2016 at 11:46:38PM +0900, Andi Shyti wrote:
> If clk_prepare_enable() fails do not return -EBUSY but use the
> value provided by the function itself.
> 
> Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Cool, thanks for fixing existing pattern:
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-08 14:46 ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Andi Shyti
  2016-07-08 16:17   ` Michael Turquette
@ 2016-07-08 20:35   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-08 20:35 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

On Fri, Jul 08, 2016 at 11:46:40PM +0900, Andi Shyti wrote:
> Patch a9e93e8 has erroneously removed some comments which are
> important to understand why the bus frequency is multiplied by
> two during the spi transfer.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 6da663f..32b66f0 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
>  	writel(val, regs + S3C64XX_SPI_MODE_CFG);
>  
>  	if (sdd->port_conf->clk_from_cmu) {
> +		/* There is half-multiplier before the SPI */
>  		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
>  	} else {
>  		/* Configure Clock */

Regardless of possible followup after Michael's comments:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling
  2016-07-08 14:46 ` [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling Andi Shyti
  2016-07-08 16:13   ` Michael Turquette
@ 2016-07-08 20:39   ` Krzysztof Kozlowski
  2016-07-14 16:32   ` Applied "spi: s3c64xx: add Exynos5433 compatible for ioclk handling" to the spi tree Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-08 20:39 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd, Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

On Fri, Jul 08, 2016 at 11:46:39PM +0900, Andi Shyti wrote:
> The new compatible is related to the Samsung Exynos5433 SoC. The
> difference between the previous is that in the exynos5433 the SPI
> controller is driven by three clocks instead of only one.
> 
> The new clock (ioclk) is controlling the input/output clock
> whenever the controller is slave or master.
> 
> The presence of the clock line is detected from the compatibility
> structure (exynos5433_spi_port_config) as a boolean value.
> 
> The probe function checks whether the ioclk is present and if so,
> it acquires.
> 
> The runtime suspend and resume functions will handle the clock
> enabling and disabling as well.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c | 57 ++++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 52 insertions(+), 5 deletions(-)
>

Looks fine to me, thanks for updates.

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v3] bindings: spi-samsung: document the clocks and the clock-name property
  2016-07-08 20:32   ` Krzysztof Kozlowski
@ 2016-07-11  2:36     ` Andi Shyti
  2016-07-14 16:32       ` Applied "spi: s3c64xx: document the clocks and the clock-name property" to the spi tree Mark Brown
  0 siblings, 1 reply; 36+ messages in thread
From: Andi Shyti @ 2016-07-11  2:36 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

These two properties were not documented but used in the spi
dts. Add the related documentation.

Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
Hi,

Changelog related only to this patch:

V1 -> V2: [new] added the clocks and clock-name documentation
   in the bindings

V2 -> V3: reworded the 'clock-names' as suggested by Krzysztof,
   added Mike's and Krzysztof's review and Krzysztof's
   suggested-by.

Thanks,
Andi

 Documentation/devicetree/bindings/spi/spi-samsung.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index 57d5539..f45c6eb 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -24,6 +24,15 @@ Required SoC Specific Properties:
 - dma-names: Names for the dma channels. There must be at least one channel
   named "tx" for transmit and named "rx" for receive.
 
+- clocks: specifies the clock IDs provided to the SPI controller; they are
+  required for interacting with the controller itself, for synchronizing the bus
+  and as I/O clock (the latter is required by exynos5433 and exynos7).
+
+- clock-names: string names of the clocks in the 'clocks' property; for all the
+  the devices the names must be "spi", "spi_busclkN" (where N is determined by
+  "samsung,spi-src-clk"), while Exynos5433 should specify a third clock
+  "spi_ioclk" for the I/O clock.
+
 Required Board Specific Properties:
 
 - #address-cells: should be 1.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-08 16:17   ` Michael Turquette
  2016-07-08 16:35     ` Andi Shyti
@ 2016-07-11 10:33     ` Sylwester Nawrocki
  2016-07-11 22:17       ` Michael Turquette
  2016-07-12  6:54       ` [PATCH v3 " Andi Shyti
  1 sibling, 2 replies; 36+ messages in thread
From: Sylwester Nawrocki @ 2016-07-11 10:33 UTC (permalink / raw)
  To: Michael Turquette, Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Tomasz Figa, Stephen Boyd, Chanwoo Choi,
	Jaehoon Chung, linux-clk, devicetree, linux-arm-kernel,
	linux-samsung-soc, linux-spi, Andi Shyti

On 07/08/2016 06:17 PM, Michael Turquette wrote:
> Quoting Andi Shyti (2016-07-08 07:46:40)

>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>> index 6da663f..32b66f0 100644
>> --- a/drivers/spi/spi-s3c64xx.c
>> +++ b/drivers/spi/spi-s3c64xx.c
>> @@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
>>         writel(val, regs + S3C64XX_SPI_MODE_CFG);
>>  
>>         if (sdd->port_conf->clk_from_cmu) {
>> +               /* There is half-multiplier before the SPI */
>>                 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
> 
> Just a small comment, but if the fixed-factor divide-by-two clock was
> modeled in Linux, then this driver could call clk_set_rate on that clock
> with the "correct" rate.
> 
> I guess that this driver would be the provider of that clock?

Good point, however I'm not sure if it is worth to model this divider
with a clk object.  It is an internal divider and the clock it provides
is only used internally within the SPI controller.  Thus the spi-s3c64xx
driver would be provider on the only consumer of this clock.

Additionally, the "There is half-multiplier before the SPI" comment
seems to be obfuscating how the hardware really looks like to me.
It talks about multiplier (which reminds me of PLLs with a divider
in the feedback loop) while there is a simple divider which should
be considered as an integral part of the controller IP block.

While we are at it, I'd propose to change this comment to something
like:

/* The SCLK_SPI clock is divided internally by 2 */

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible
  2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
  2016-07-08 20:23   ` Krzysztof Kozlowski
@ 2016-07-11 10:49   ` Sylwester Nawrocki
  2016-07-14 16:33   ` Applied "spi: s3c64xx: add exynos5433 spi compatible" to the spi tree Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Sylwester Nawrocki @ 2016-07-11 10:49 UTC (permalink / raw)
  To: Andi Shyti, Mark Brown, Stephen Boyd
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Tomasz Figa, Michael Turquette, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

On 07/08/2016 04:46 PM, Andi Shyti wrote:
> The samsung,exynos5433-spi has some peculiarities that bring the
> need of creating a new compatible in the binding.
> 
> One of those is the 3-clocks controller management where the spi
> is fed with three clocks: "spi", "busclkN" and "ioclk".
> 
> By adding the exynos5433-spi, we deprecate the exynos7 compatible
> and discourage its use.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 7/7] clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks
  2016-07-08 14:46 ` [PATCH v2 7/7] clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks Andi Shyti
@ 2016-07-11 10:58   ` Sylwester Nawrocki
  0 siblings, 0 replies; 36+ messages in thread
From: Sylwester Nawrocki @ 2016-07-11 10:58 UTC (permalink / raw)
  To: Andi Shyti, Mark Brown
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Tomasz Figa, Michael Turquette, Stephen Boyd, Chanwoo Choi,
	Jaehoon Chung, linux-clk, devicetree, linux-arm-kernel,
	linux-samsung-soc, linux-spi, Andi Shyti

On 07/08/2016 04:46 PM, Andi Shyti wrote:
> Because the Exynos5433 SPI driver supports the ioclk handling and
> the following patch:
> 
>   http://marc.info/?l=linux-kernel&m=146787645626318&w=2
> 
> fixes a synchronus abort issue, none of the SPI clocks require
s/synchronus/synchronous

> any critical handling: remove, then, the CLK_IGNORE_UNUSED flag
> for the SPI related clocks.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

In case this goes through the spi tree:
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-11 10:33     ` Sylwester Nawrocki
@ 2016-07-11 22:17       ` Michael Turquette
  2016-07-12 12:16         ` Sylwester Nawrocki
  2016-07-12  6:54       ` [PATCH v3 " Andi Shyti
  1 sibling, 1 reply; 36+ messages in thread
From: Michael Turquette @ 2016-07-11 22:17 UTC (permalink / raw)
  To: Sylwester Nawrocki, Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Tomasz Figa, Stephen Boyd, Chanwoo Choi,
	Jaehoon Chung, linux-clk, devicetree, linux-arm-kernel,
	linux-samsung-soc, linux-spi, Andi Shyti

Quoting Sylwester Nawrocki (2016-07-11 03:33:42)
> On 07/08/2016 06:17 PM, Michael Turquette wrote:
> > Quoting Andi Shyti (2016-07-08 07:46:40)
> =

> >> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> >> index 6da663f..32b66f0 100644
> >> --- a/drivers/spi/spi-s3c64xx.c
> >> +++ b/drivers/spi/spi-s3c64xx.c
> >> @@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_=
driver_data *sdd)
> >>         writel(val, regs + S3C64XX_SPI_MODE_CFG);
> >>  =

> >>         if (sdd->port_conf->clk_from_cmu) {
> >> +               /* There is half-multiplier before the SPI */
> >>                 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
> > =

> > Just a small comment, but if the fixed-factor divide-by-two clock was
> > modeled in Linux, then this driver could call clk_set_rate on that clock
> > with the "correct" rate.
> > =

> > I guess that this driver would be the provider of that clock?
> =

> Good point, however I'm not sure if it is worth to model this divider
> with a clk object.  It is an internal divider and the clock it provides
> is only used internally within the SPI controller.  Thus the spi-s3c64xx
> driver would be provider on the only consumer of this clock.

Sure, but it's only a few lines of code to this, and there are examples
in the kernel already.

> =

> Additionally, the "There is half-multiplier before the SPI" comment
> seems to be obfuscating how the hardware really looks like to me.
> It talks about multiplier (which reminds me of PLLs with a divider
> in the feedback loop) while there is a simple divider which should
> be considered as an integral part of the controller IP block.
> =

> While we are at it, I'd propose to change this comment to something
> like:
> =

> /* The SCLK_SPI clock is divided internally by 2 */

It's your choice, but debug output would benefit from showing the real
clock frequency at some point.

Regards,
Mike

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v3 6/7] spi: s3c64xx: restore removed comments
  2016-07-11 10:33     ` Sylwester Nawrocki
  2016-07-11 22:17       ` Michael Turquette
@ 2016-07-12  6:54       ` Andi Shyti
  2016-07-12  8:22         ` Mark Brown
                           ` (2 more replies)
  1 sibling, 3 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-12  6:54 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Patch a9e93e8 has erroneously removed some comments which are
important to understand why the bus frequency is multiplied by
two during the spi transfer.

Reword the previous comment to a more appropriate message.

Suggested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
---
Hi,

despite Mike's comments I'm sending the patch as it was
originally meant. I think that fixing the exact clk where to set
the rate should anyway go in a different patch.

V2->V3
The comment has been reworded as Sylwester recommended.

Thanks,
Andi

 drivers/spi/spi-s3c64xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 6da663f..5bedafc 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_MODE_CFG);
 
 	if (sdd->port_conf->clk_from_cmu) {
+		/* The src_clk clock is divided internally by 2 */
 		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
 	} else {
 		/* Configure Clock */
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v3 6/7] spi: s3c64xx: restore removed comments
  2016-07-12  6:54       ` [PATCH v3 " Andi Shyti
@ 2016-07-12  8:22         ` Mark Brown
  2016-07-12  8:25           ` Andi Shyti
  2016-07-12 18:07         ` Michael Turquette
  2016-07-14 16:32         ` Applied "spi: s3c64xx: restore removed comments" to the spi tree Mark Brown
  2 siblings, 1 reply; 36+ messages in thread
From: Mark Brown @ 2016-07-12  8:22 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Sylwester Nawrocki, Tomasz Figa, Michael Turquette, Stephen Boyd,
	Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

On Tue, Jul 12, 2016 at 03:54:04PM +0900, Andi Shyti wrote:
> Patch a9e93e8 has erroneously removed some comments which are
> important to understand why the bus frequency is multiplied by
> two during the spi transfer.

Please don't bury patches in the middle of old threads, it makes it very
confusing trying to figure out what's going on especially when you do
this one patch at a time in a series.  Submit new patches as a complete
series, ideally not threaded in with anything else (at least for me).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v3 6/7] spi: s3c64xx: restore removed comments
  2016-07-12  8:22         ` Mark Brown
@ 2016-07-12  8:25           ` Andi Shyti
  2016-07-12  9:00             ` Mark Brown
  0 siblings, 1 reply; 36+ messages in thread
From: Andi Shyti @ 2016-07-12  8:25 UTC (permalink / raw)
  To: Mark Brown
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Sylwester Nawrocki, Tomasz Figa, Michael Turquette, Stephen Boyd,
	Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

> > Patch a9e93e8 has erroneously removed some comments which are
> > important to understand why the bus frequency is multiplied by
> > two during the spi transfer.
> 
> Please don't bury patches in the middle of old threads, it makes it very
> confusing trying to figure out what's going on especially when you do
> this one patch at a time in a series.  Submit new patches as a complete
> series, ideally not threaded in with anything else (at least for me).

OK, sorry, do you want me to send everything again?

Andi

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v3 6/7] spi: s3c64xx: restore removed comments
  2016-07-12  8:25           ` Andi Shyti
@ 2016-07-12  9:00             ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-12  9:00 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Sylwester Nawrocki, Tomasz Figa, Michael Turquette, Stephen Boyd,
	Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

On Tue, Jul 12, 2016 at 05:25:46PM +0900, Andi Shyti wrote:

> > Please don't bury patches in the middle of old threads, it makes it very
> > confusing trying to figure out what's going on especially when you do
> > this one patch at a time in a series.  Submit new patches as a complete
> > series, ideally not threaded in with anything else (at least for me).

> OK, sorry, do you want me to send everything again?

Yes, please.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v2 6/7] spi: s3c64xx: restore removed comments
  2016-07-11 22:17       ` Michael Turquette
@ 2016-07-12 12:16         ` Sylwester Nawrocki
  0 siblings, 0 replies; 36+ messages in thread
From: Sylwester Nawrocki @ 2016-07-12 12:16 UTC (permalink / raw)
  To: Michael Turquette
  Cc: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Tomasz Figa, Stephen Boyd,
	Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti

On 07/12/2016 12:17 AM, Michael Turquette wrote:
> Quoting Sylwester Nawrocki (2016-07-11 03:33:42)
>> On 07/08/2016 06:17 PM, Michael Turquette wrote:

> Sure, but it's only a few lines of code to this, and there are examples
> in the kernel already.
> 
>> Additionally, the "There is half-multiplier before the SPI" comment
>> seems to be obfuscating how the hardware really looks like to me.
>> It talks about multiplier (which reminds me of PLLs with a divider
>> in the feedback loop) while there is a simple divider which should
>> be considered as an integral part of the controller IP block.
>>
>> While we are at it, I'd propose to change this comment to something
>> like:
>>
>> /* The SCLK_SPI clock is divided internally by 2 */
> 
> It's your choice, but debug output would benefit from showing the real
> clock frequency at some point.

OK, it's indeed fairly easy to add a fixed rate divide-by-two clock,
but for the older SoCs we would need to also model the internal mux, gate,
and an 8-bit divider.  Then it becomes a bit bigger task. Anyway it might
be worth to try it, this could let us deprecate the samsung,spi-src-clk
property and for all the SoCs use assigned-clock-parents.

-- 
Thanks,
Sylwester

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v3 6/7] spi: s3c64xx: restore removed comments
  2016-07-12  6:54       ` [PATCH v3 " Andi Shyti
  2016-07-12  8:22         ` Mark Brown
@ 2016-07-12 18:07         ` Michael Turquette
  2016-07-14 16:32         ` Applied "spi: s3c64xx: restore removed comments" to the spi tree Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Michael Turquette @ 2016-07-12 18:07 UTC (permalink / raw)
  To: Andi Shyti, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Quoting Andi Shyti (2016-07-11 23:54:04)
> Patch a9e93e8 has erroneously removed some comments which are
> important to understand why the bus frequency is multiplied by
> two during the spi transfer.
> =

> Reword the previous comment to a more appropriate message.
> =

> Suggested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> Reviewed-by: Michael Turquette <mturquette@baylibre.com>
> ---
> Hi,
> =

> despite Mike's comments I'm sending the patch as it was
> originally meant. I think that fixing the exact clk where to set
> the rate should anyway go in a different patch.

That sounds fair.

Regards,
Mike

> =

> V2->V3
> The comment has been reworded as Sylwester recommended.
> =

> Thanks,
> Andi
> =

>  drivers/spi/spi-s3c64xx.c | 1 +
>  1 file changed, 1 insertion(+)
> =

> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 6da663f..5bedafc 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_dri=
ver_data *sdd)
>         writel(val, regs + S3C64XX_SPI_MODE_CFG);
>  =

>         if (sdd->port_conf->clk_from_cmu) {
> +               /* The src_clk clock is divided internally by 2 */
>                 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
>         } else {
>                 /* Configure Clock */
> -- =

> 2.8.1
>=20

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Applied "spi: s3c64xx: restore removed comments" to the spi tree
  2016-07-12  6:54       ` [PATCH v3 " Andi Shyti
  2016-07-12  8:22         ` Mark Brown
  2016-07-12 18:07         ` Michael Turquette
@ 2016-07-14 16:32         ` Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-14 16:32 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Brown, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Michael Turquette, Stephen Boyd, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

The patch

   spi: s3c64xx: restore removed comments

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 0dbe70a1feb411d17fbcf8e73d61e6c7f33fda72 Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Tue, 12 Jul 2016 19:02:15 +0900
Subject: [PATCH] spi: s3c64xx: restore removed comments

Patch a9e93e8 has erroneously removed some comments which are
important to understand why the bus frequency is multiplied by
two during the spi transfer.

Reword the previous comment to a more appropriate message.

Suggested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-s3c64xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index a1e84686c70c..3c09e94cf827 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -642,6 +642,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_MODE_CFG);
 
 	if (sdd->port_conf->clk_from_cmu) {
+		/* The src_clk clock is divided internally by 2 */
 		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
 	} else {
 		/* Configure Clock */
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Applied "spi: s3c64xx: add Exynos5433 compatible for ioclk handling" to the spi tree
  2016-07-08 14:46 ` [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling Andi Shyti
  2016-07-08 16:13   ` Michael Turquette
  2016-07-08 20:39   ` Krzysztof Kozlowski
@ 2016-07-14 16:32   ` Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-14 16:32 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Brown, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Michael Turquette, Stephen Boyd, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

The patch

   spi: s3c64xx: add Exynos5433 compatible for ioclk handling

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 7990b00819e765ca180d36b38969c2bde2734e53 Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Tue, 12 Jul 2016 19:02:14 +0900
Subject: [PATCH] spi: s3c64xx: add Exynos5433 compatible for ioclk handling

The new compatible is related to the Samsung Exynos5433 SoC. The
difference between the previous is that in the exynos5433 the SPI
controller is driven by three clocks instead of only one.

The new clock (ioclk) is controlling the input/output clock
whenever the controller is slave or master.

The presence of the clock line is detected from the compatibility
structure (exynos5433_spi_port_config) as a boolean value.

The probe function checks whether the ioclk is present and if so,
it acquires.

The runtime suspend and resume functions will handle the clock
enabling and disabling as well.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-s3c64xx.c | 57 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 3d21f8a35837..a1e84686c70c 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -156,12 +156,14 @@ struct s3c64xx_spi_port_config {
 	int	quirks;
 	bool	high_speed;
 	bool	clk_from_cmu;
+	bool	clk_ioclk;
 };
 
 /**
  * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver.
  * @clk: Pointer to the spi clock.
  * @src_clk: Pointer to the clock used to generate SPI signals.
+ * @ioclk: Pointer to the i/o clock between master and slave
  * @master: Pointer to the SPI Protocol master.
  * @cntrlr_info: Platform specific data for the controller this driver manages.
  * @tgl_spi: Pointer to the last CS left untoggled by the cs_change hint.
@@ -181,6 +183,7 @@ struct s3c64xx_spi_driver_data {
 	void __iomem                    *regs;
 	struct clk                      *clk;
 	struct clk                      *src_clk;
+	struct clk                      *ioclk;
 	struct platform_device          *pdev;
 	struct spi_master               *master;
 	struct s3c64xx_spi_info  *cntrlr_info;
@@ -1154,6 +1157,21 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		goto err_disable_clk;
 	}
 
+	if (sdd->port_conf->clk_ioclk) {
+		sdd->ioclk = devm_clk_get(&pdev->dev, "spi_ioclk");
+		if (IS_ERR(sdd->ioclk)) {
+			dev_err(&pdev->dev, "Unable to acquire 'ioclk'\n");
+			ret = PTR_ERR(sdd->ioclk);
+			goto err_disable_src_clk;
+		}
+
+		ret = clk_prepare_enable(sdd->ioclk);
+		if (ret) {
+			dev_err(&pdev->dev, "Couldn't enable clock 'ioclk'\n");
+			goto err_disable_src_clk;
+		}
+	}
+
 	pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
 	pm_runtime_use_autosuspend(&pdev->dev);
 	pm_runtime_set_active(&pdev->dev);
@@ -1200,6 +1218,8 @@ err_pm_put:
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
+	clk_disable_unprepare(sdd->ioclk);
+err_disable_src_clk:
 	clk_disable_unprepare(sdd->src_clk);
 err_disable_clk:
 	clk_disable_unprepare(sdd->clk);
@@ -1218,6 +1238,8 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
 
 	writel(0, sdd->regs + S3C64XX_SPI_INT_EN);
 
+	clk_disable_unprepare(sdd->ioclk);
+
 	clk_disable_unprepare(sdd->src_clk);
 
 	clk_disable_unprepare(sdd->clk);
@@ -1276,6 +1298,7 @@ static int s3c64xx_spi_runtime_suspend(struct device *dev)
 
 	clk_disable_unprepare(sdd->clk);
 	clk_disable_unprepare(sdd->src_clk);
+	clk_disable_unprepare(sdd->ioclk);
 
 	return 0;
 }
@@ -1286,17 +1309,28 @@ static int s3c64xx_spi_runtime_resume(struct device *dev)
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
 	int ret;
 
+	if (sdd->port_conf->clk_ioclk) {
+		ret = clk_prepare_enable(sdd->ioclk);
+		if (ret != 0)
+			return ret;
+	}
+
 	ret = clk_prepare_enable(sdd->src_clk);
 	if (ret != 0)
-		return ret;
+		goto err_disable_ioclk;
 
 	ret = clk_prepare_enable(sdd->clk);
-	if (ret != 0) {
-		clk_disable_unprepare(sdd->src_clk);
-		return ret;
-	}
+	if (ret != 0)
+		goto err_disable_src_clk;
 
 	return 0;
+
+err_disable_src_clk:
+	clk_disable_unprepare(sdd->src_clk);
+err_disable_ioclk:
+	clk_disable_unprepare(sdd->ioclk);
+
+	return ret;
 }
 #endif /* CONFIG_PM */
 
@@ -1352,6 +1386,16 @@ static struct s3c64xx_spi_port_config exynos7_spi_port_config = {
 	.quirks		= S3C64XX_SPI_QUIRK_CS_AUTO,
 };
 
+static struct s3c64xx_spi_port_config exynos5433_spi_port_config = {
+	.fifo_lvl_mask	= { 0x1ff, 0x7f, 0x7f, 0x7f, 0x7f, 0x1ff},
+	.rx_lvl_offset	= 15,
+	.tx_st_done	= 25,
+	.high_speed	= true,
+	.clk_from_cmu	= true,
+	.clk_ioclk	= true,
+	.quirks		= S3C64XX_SPI_QUIRK_CS_AUTO,
+};
+
 static const struct platform_device_id s3c64xx_spi_driver_ids[] = {
 	{
 		.name		= "s3c2443-spi",
@@ -1382,6 +1426,9 @@ static const struct of_device_id s3c64xx_spi_dt_match[] = {
 	{ .compatible = "samsung,exynos7-spi",
 			.data = (void *)&exynos7_spi_port_config,
 	},
+	{ .compatible = "samsung,exynos5433-spi",
+			.data = (void *)&exynos5433_spi_port_config,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, s3c64xx_spi_dt_match);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Applied "spi: s3c64xx: use error code from clk_prepare_enable()" to the spi tree
  2016-07-08 14:46 ` [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable() Andi Shyti
  2016-07-08 20:33   ` Krzysztof Kozlowski
@ 2016-07-14 16:32   ` Mark Brown
  1 sibling, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-14 16:32 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Brown, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Michael Turquette, Stephen Boyd, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

The patch

   spi: s3c64xx: use error code from clk_prepare_enable()

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 25981d8281ee4cbbd6f7c5bc0f8c048ad9548037 Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Tue, 12 Jul 2016 19:02:13 +0900
Subject: [PATCH] spi: s3c64xx: use error code from clk_prepare_enable()

If clk_prepare_enable() fails do not return -EBUSY but use the
value provided by the function itself.

Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-s3c64xx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 0a93eb98c2b6..3d21f8a35837 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1133,9 +1133,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		goto err_deref_master;
 	}
 
-	if (clk_prepare_enable(sdd->clk)) {
+	ret = clk_prepare_enable(sdd->clk);
+	if (ret) {
 		dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
-		ret = -EBUSY;
 		goto err_deref_master;
 	}
 
@@ -1148,9 +1148,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		goto err_disable_clk;
 	}
 
-	if (clk_prepare_enable(sdd->src_clk)) {
+	ret = clk_prepare_enable(sdd->src_clk);
+	if (ret) {
 		dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
-		ret = -EBUSY;
 		goto err_disable_clk;
 	}
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Applied "spi: s3c64xx: rename goto labels to meaningful names" to the spi tree
  2016-07-08 14:46 ` [PATCH v2 3/7] spi: s3c64xx: rename goto labels to meaningful names Andi Shyti
@ 2016-07-14 16:32   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-14 16:32 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Brown, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Michael Turquette, Stephen Boyd, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

The patch

   spi: s3c64xx: rename goto labels to meaningful names

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 60a9a964420912a4c4b66efd210d98006177695a Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Tue, 12 Jul 2016 19:02:12 +0900
Subject: [PATCH] spi: s3c64xx: rename goto labels to meaningful names

The goto labels of the style of

  err4:
  err3:
  err2:
  err1:

are complex to insert in between new errors without renaming all
the goto statements. Replace the errX naming style to meaningful
names in order to make it easier to insert new goto exit points.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-s3c64xx.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 001c9ebf884d..0a93eb98c2b6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1078,7 +1078,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		if (ret < 0) {
 			dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
 				ret);
-			goto err0;
+			goto err_deref_master;
 		}
 		sdd->port_id = ret;
 	} else {
@@ -1116,13 +1116,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res);
 	if (IS_ERR(sdd->regs)) {
 		ret = PTR_ERR(sdd->regs);
-		goto err0;
+		goto err_deref_master;
 	}
 
 	if (sci->cfg_gpio && sci->cfg_gpio()) {
 		dev_err(&pdev->dev, "Unable to config gpio\n");
 		ret = -EBUSY;
-		goto err0;
+		goto err_deref_master;
 	}
 
 	/* Setup clocks */
@@ -1130,13 +1130,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	if (IS_ERR(sdd->clk)) {
 		dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n");
 		ret = PTR_ERR(sdd->clk);
-		goto err0;
+		goto err_deref_master;
 	}
 
 	if (clk_prepare_enable(sdd->clk)) {
 		dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
 		ret = -EBUSY;
-		goto err0;
+		goto err_deref_master;
 	}
 
 	sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr);
@@ -1145,13 +1145,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev,
 			"Unable to acquire clock '%s'\n", clk_name);
 		ret = PTR_ERR(sdd->src_clk);
-		goto err2;
+		goto err_disable_clk;
 	}
 
 	if (clk_prepare_enable(sdd->src_clk)) {
 		dev_err(&pdev->dev, "Couldn't enable clock '%s'\n", clk_name);
 		ret = -EBUSY;
-		goto err2;
+		goto err_disable_clk;
 	}
 
 	pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
@@ -1171,7 +1171,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	if (ret != 0) {
 		dev_err(&pdev->dev, "Failed to request IRQ %d: %d\n",
 			irq, ret);
-		goto err3;
+		goto err_pm_put;
 	}
 
 	writel(S3C64XX_SPI_INT_RX_OVERRUN_EN | S3C64XX_SPI_INT_RX_UNDERRUN_EN |
@@ -1181,7 +1181,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret != 0) {
 		dev_err(&pdev->dev, "cannot register SPI master: %d\n", ret);
-		goto err3;
+		goto err_pm_put;
 	}
 
 	dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n",
@@ -1195,15 +1195,15 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 
 	return 0;
 
-err3:
+err_pm_put:
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
 	clk_disable_unprepare(sdd->src_clk);
-err2:
+err_disable_clk:
 	clk_disable_unprepare(sdd->clk);
-err0:
+err_deref_master:
 	spi_master_put(master);
 
 	return ret;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Applied "spi: s3c64xx: document the clocks and the clock-name property" to the spi tree
  2016-07-11  2:36     ` [PATCH v3] " Andi Shyti
@ 2016-07-14 16:32       ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-14 16:32 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Brown, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Michael Turquette, Stephen Boyd, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

The patch

   spi: s3c64xx: document the clocks and the clock-name property

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 1ada32ede94fc91ff0f3236fcc70ae74dd0c2cb0 Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Tue, 12 Jul 2016 19:02:11 +0900
Subject: [PATCH] spi: s3c64xx: document the clocks and the clock-name property

These two properties were not documented but used in the spi
dts. Add the related documentation.

Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/spi/spi-samsung.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index ab4f0a46e859..49028a4f5df1 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -24,6 +24,15 @@ Required SoC Specific Properties:
 - dma-names: Names for the dma channels. There must be at least one channel
   named "tx" for transmit and named "rx" for receive.
 
+- clocks: specifies the clock IDs provided to the SPI controller; they are
+  required for interacting with the controller itself, for synchronizing the bus
+  and as I/O clock (the latter is required by exynos5433 and exynos7).
+
+- clock-names: string names of the clocks in the 'clocks' property; for all the
+  the devices the names must be "spi", "spi_busclkN" (where N is determined by
+  "samsung,spi-src-clk"), while Exynos5433 should specify a third clock
+  "spi_ioclk" for the I/O clock.
+
 Required Board Specific Properties:
 
 - #address-cells: should be 1.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Applied "spi: s3c64xx: add exynos5433 spi compatible" to the spi tree
  2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
  2016-07-08 20:23   ` Krzysztof Kozlowski
  2016-07-11 10:49   ` Sylwester Nawrocki
@ 2016-07-14 16:33   ` Mark Brown
  2 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2016-07-14 16:33 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Mark Brown, Rob Herring, Mark Rutland, Kukjin Kim,
	Krzysztof Kozlowski, Mark Brown, Sylwester Nawrocki, Tomasz Figa,
	Michael Turquette, Stephen Boyd, Chanwoo Choi, Jaehoon Chung,
	linux-clk, devicetree, linux-arm-kernel, linux-samsung-soc,
	linux-spi, Andi Shyti

The patch

   spi: s3c64xx: add exynos5433 spi compatible

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From c068042bf0872c9121f4a6eab281dd63f61df5d3 Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Tue, 12 Jul 2016 19:02:10 +0900
Subject: [PATCH] spi: s3c64xx: add exynos5433 spi compatible

The samsung,exynos5433-spi has some peculiarities that bring the
need of creating a new compatible in the binding.

One of those is the 3-clocks controller management where the spi
is fed with three clocks: "spi", "busclkN" and "ioclk".

By adding the exynos5433-spi, we deprecate the exynos7 compatible
and discourage its use.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/spi/spi-samsung.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index 930bc7349271..ab4f0a46e859 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -9,7 +9,8 @@ Required SoC Specific Properties:
     - samsung,s3c2443-spi: for s3c2443, s3c2416 and s3c2450 platforms
     - samsung,s3c6410-spi: for s3c6410 platforms
     - samsung,s5pv210-spi: for s5pv210 and s5pc110 platforms
-    - samsung,exynos7-spi: for exynos7 platforms
+    - samsung,exynos5433-spi: for exynos5433 compatible controllers
+    - samsung,exynos7-spi: for exynos7 platforms <DEPRECATED>
 
 - reg: physical base address of the controller and length of memory mapped
   region.
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v3 6/7] spi: s3c64xx: restore removed comments
  2016-07-12 10:02 [PATCH v3 " Andi Shyti
@ 2016-07-12 10:02 ` Andi Shyti
  0 siblings, 0 replies; 36+ messages in thread
From: Andi Shyti @ 2016-07-12 10:02 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kukjin Kim, Krzysztof Kozlowski,
	Mark Brown, Sylwester Nawrocki, Tomasz Figa, Michael Turquette,
	Stephen Boyd
  Cc: Chanwoo Choi, Jaehoon Chung, linux-clk, devicetree,
	linux-arm-kernel, linux-samsung-soc, linux-spi, Andi Shyti,
	Andi Shyti

Patch a9e93e8 has erroneously removed some comments which are
important to understand why the bus frequency is multiplied by
two during the spi transfer.

Reword the previous comment to a more appropriate message.

Suggested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Reviewed-by: Michael Turquette <mturquette@baylibre.com>
---
 drivers/spi/spi-s3c64xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 6da663f..5bedafc 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -639,6 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_MODE_CFG);
 
 	if (sdd->port_conf->clk_from_cmu) {
+		/* The src_clk clock is divided internally by 2 */
 		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
 	} else {
 		/* Configure Clock */
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2016-07-14 16:33 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 14:46 [PATCH v2 0/7] spi s3c64xx ioclk handling Andi Shyti
2016-07-08 14:46 ` [PATCH v2 1/7] bindings: spi-samsung: add exynos5433 spi compatible Andi Shyti
2016-07-08 20:23   ` Krzysztof Kozlowski
2016-07-11 10:49   ` Sylwester Nawrocki
2016-07-14 16:33   ` Applied "spi: s3c64xx: add exynos5433 spi compatible" to the spi tree Mark Brown
2016-07-08 14:46 ` [PATCH v2 2/7] bindings: spi-samsung: document the clocks and the clock-name property Andi Shyti
2016-07-08 20:32   ` Krzysztof Kozlowski
2016-07-11  2:36     ` [PATCH v3] " Andi Shyti
2016-07-14 16:32       ` Applied "spi: s3c64xx: document the clocks and the clock-name property" to the spi tree Mark Brown
2016-07-08 14:46 ` [PATCH v2 3/7] spi: s3c64xx: rename goto labels to meaningful names Andi Shyti
2016-07-14 16:32   ` Applied "spi: s3c64xx: rename goto labels to meaningful names" to the spi tree Mark Brown
2016-07-08 14:46 ` [PATCH v2 4/7] spi: s3c64xx: use error code from clk_prepare_enable() Andi Shyti
2016-07-08 20:33   ` Krzysztof Kozlowski
2016-07-14 16:32   ` Applied "spi: s3c64xx: use error code from clk_prepare_enable()" to the spi tree Mark Brown
2016-07-08 14:46 ` [PATCH v2 5/7] spi: s3c64xx: add exynos5433 compatible for ioclk handling Andi Shyti
2016-07-08 16:13   ` Michael Turquette
2016-07-08 16:31     ` Andi Shyti
2016-07-08 20:39   ` Krzysztof Kozlowski
2016-07-14 16:32   ` Applied "spi: s3c64xx: add Exynos5433 compatible for ioclk handling" to the spi tree Mark Brown
2016-07-08 14:46 ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Andi Shyti
2016-07-08 16:17   ` Michael Turquette
2016-07-08 16:35     ` Andi Shyti
2016-07-11 10:33     ` Sylwester Nawrocki
2016-07-11 22:17       ` Michael Turquette
2016-07-12 12:16         ` Sylwester Nawrocki
2016-07-12  6:54       ` [PATCH v3 " Andi Shyti
2016-07-12  8:22         ` Mark Brown
2016-07-12  8:25           ` Andi Shyti
2016-07-12  9:00             ` Mark Brown
2016-07-12 18:07         ` Michael Turquette
2016-07-14 16:32         ` Applied "spi: s3c64xx: restore removed comments" to the spi tree Mark Brown
2016-07-08 20:35   ` [PATCH v2 6/7] spi: s3c64xx: restore removed comments Krzysztof Kozlowski
2016-07-08 14:46 ` [PATCH v2 7/7] clk: exynos5433: remove CLK_IGNORE_UNUSED flag from SPI clocks Andi Shyti
2016-07-11 10:58   ` Sylwester Nawrocki
2016-07-08 16:21 ` [PATCH v2 0/7] spi s3c64xx ioclk handling Michael Turquette
2016-07-12 10:02 [PATCH v3 " Andi Shyti
2016-07-12 10:02 ` [PATCH v3 6/7] spi: s3c64xx: restore removed comments Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).