All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
@ 2014-06-12 13:13 ` Naveen Krishna Chatradhi
  0 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-06-12 13:13 UTC (permalink / raw)
  To: linux-arm-kernel, spi-devel-general, linux-samsung-soc
  Cc: naveenkrishna.ch, broonie, grant.likely, jaswinder.singh,
	kgene.kim, cpgs, devicetree, Javier Martinez Canillas,
	Doug Anderson, Tomasz Figa

Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)

spi-s3c64xx.c driver expects
1. chip select gpios from "cs-gpio"(singular) under the
   "controller-data" node of the client/slave device of the SPI.

2. "cs-gpio"(singular) entry to be present in the SPI device node.

Eg of current broken usage:
&spi_1 {
	cs-gpio <>;	/* this entry is checked during probe */
	...
	slave_node {
		controller-data {
			cs-gpio <&gpioa2 5 0>;
			/* This field is parsed during .setup() */
		}
	};
};

The following dts files which were using this driver. But,
din't have the "cs-gpio" entry under SPI node.
-- arch/arm/boot/dts/exynos4210-smdkv310.dts
-- arch/arm/boot/dts/exynos4412-trats2.dts
-- arch/arm/boot/dts/exynos5250-smdk5250.dts

Also, the SPI core and many drivers moved on to using "cs-gpios"
from SPI node and removed the gpio handling code from drivers
(including spi-s3c64xx.c).

Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
considering the time with no compliants about the breakage.

We are assuming it is safe to remove the "cs-gpio"(singular) usage
from device tree binding of spi-samsung.txt and makes appropriate
changes in the driver to use "cs-gpios"(plural) from
SPI device node.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
 drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
 2 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index 86aa061..2d29dac 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -42,15 +42,13 @@ Optional Board Specific Properties:
 - num-cs: Specifies the number of chip select lines supported. If
   not specified, the default number of chip select lines is set to 1.
 
+- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
+
 SPI Controller specific data in SPI slave nodes:
 
 - The spi slave nodes should provide the following information which is required
   by the spi controller.
 
-  - cs-gpio: A gpio specifier that specifies the gpio line used as
-    the slave select line by the spi controller. The format of the gpio
-    specifier depends on the gpio controller.
-
   - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
     miso line (to account for any lag in the miso line). The following are the
     valid values.
@@ -85,6 +83,7 @@ Example:
 		#size-cells = <0>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&spi0_bus>;
+		cs-gpios = <&gpa2 5 0>;
 
 		w25q80bw@0 {
 			#address-cells = <1>;
@@ -94,7 +93,6 @@ Example:
 			spi-max-frequency = <10000>;
 
 			controller-data {
-				cs-gpio = <&gpa2 5 1 0 3>;
 				samsung,spi-feedback-delay = <0>;
 			};
 
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 75a5696..b888c66 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data {
 	struct s3c64xx_spi_dma_data	tx_dma;
 	struct s3c64xx_spi_port_config	*port_conf;
 	unsigned int			port_id;
-	bool				cs_gpio;
 };
 
 static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
@@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
 		return ERR_PTR(-ENOMEM);
 	}
 
-	/* The CS line is asserted/deasserted by the gpio pin */
-	if (sdd->cs_gpio)
-		cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
-
-	if (!gpio_is_valid(cs->line)) {
-		dev_err(&spi->dev, "chip select gpio is not specified or invalid\n");
-		kfree(cs);
-		of_node_put(data_np);
-		return ERR_PTR(-EINVAL);
-	}
-
 	of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
 	cs->fb_delay = fb_delay;
 	of_node_put(data_np);
@@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 		spi->controller_data = cs;
 	}
 
+	/* For the non-DT platforms derive chip selects from controller data */
+	if (!spi->dev.of_node)
+		spi->cs_gpio = cs->line;
+
 	if (IS_ERR_OR_NULL(cs)) {
 		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
 		return -ENODEV;
@@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 
 	if (!spi_get_ctldata(spi)) {
 		/* Request gpio only if cs line is asserted by gpio pins */
-		if (sdd->cs_gpio) {
-			err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
-					dev_name(&spi->dev));
+		if (gpio_is_valid(spi->cs_gpio)) {
+			err = gpio_request_one(spi->cs_gpio,
+						GPIOF_OUT_INIT_HIGH,
+						dev_name(&spi->dev));
 			if (err) {
 				dev_err(&spi->dev,
 					"Failed to get /CS gpio [%d]: %d\n",
-					cs->line, err);
+					spi->cs_gpio, err);
 				goto err_gpio_req;
 			}
-
-			spi->cs_gpio = cs->line;
+		} else {
+			dev_err(&spi->dev, "chip select gpio is invalid\n");
+			return -EINVAL;
 		}
 
 		spi_set_ctldata(spi, cs);
@@ -884,7 +878,8 @@ setup_exit:
 	/* setup() returns with device de-selected */
 	writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
 
-	gpio_free(cs->line);
+	if (gpio_is_valid(spi->cs_gpio))
+		gpio_free(spi->cs_gpio);
 	spi_set_ctldata(spi, NULL);
 
 err_gpio_req:
@@ -900,10 +895,12 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi)
 	struct s3c64xx_spi_driver_data *sdd;
 
 	sdd = spi_master_get_devdata(spi->master);
-	if (spi->cs_gpio) {
+	if (gpio_is_valid(spi->cs_gpio)) {
 		gpio_free(spi->cs_gpio);
 		if (spi->dev.of_node)
 			kfree(cs);
+		else
+			spi->cs_gpio = -ENOENT;
 	}
 	spi_set_ctldata(spi, NULL);
 }
@@ -1075,11 +1072,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	sdd->cntrlr_info = sci;
 	sdd->pdev = pdev;
 	sdd->sfr_start = mem_res->start;
-	sdd->cs_gpio = true;
 	if (pdev->dev.of_node) {
-		if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL))
-			sdd->cs_gpio = false;
-
 		ret = of_alias_get_id(pdev->dev.of_node, "spi");
 		if (ret < 0) {
 			dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
-- 
1.7.9.5

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

* [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
@ 2014-06-12 13:13 ` Naveen Krishna Chatradhi
  0 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-06-12 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)

spi-s3c64xx.c driver expects
1. chip select gpios from "cs-gpio"(singular) under the
   "controller-data" node of the client/slave device of the SPI.

2. "cs-gpio"(singular) entry to be present in the SPI device node.

Eg of current broken usage:
&spi_1 {
	cs-gpio <>;	/* this entry is checked during probe */
	...
	slave_node {
		controller-data {
			cs-gpio <&gpioa2 5 0>;
			/* This field is parsed during .setup() */
		}
	};
};

The following dts files which were using this driver. But,
din't have the "cs-gpio" entry under SPI node.
-- arch/arm/boot/dts/exynos4210-smdkv310.dts
-- arch/arm/boot/dts/exynos4412-trats2.dts
-- arch/arm/boot/dts/exynos5250-smdk5250.dts

Also, the SPI core and many drivers moved on to using "cs-gpios"
from SPI node and removed the gpio handling code from drivers
(including spi-s3c64xx.c).

Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
considering the time with no compliants about the breakage.

We are assuming it is safe to remove the "cs-gpio"(singular) usage
from device tree binding of spi-samsung.txt and makes appropriate
changes in the driver to use "cs-gpios"(plural) from
SPI device node.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
 drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
 2 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
index 86aa061..2d29dac 100644
--- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
+++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
@@ -42,15 +42,13 @@ Optional Board Specific Properties:
 - num-cs: Specifies the number of chip select lines supported. If
   not specified, the default number of chip select lines is set to 1.
 
+- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
+
 SPI Controller specific data in SPI slave nodes:
 
 - The spi slave nodes should provide the following information which is required
   by the spi controller.
 
-  - cs-gpio: A gpio specifier that specifies the gpio line used as
-    the slave select line by the spi controller. The format of the gpio
-    specifier depends on the gpio controller.
-
   - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
     miso line (to account for any lag in the miso line). The following are the
     valid values.
@@ -85,6 +83,7 @@ Example:
 		#size-cells = <0>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&spi0_bus>;
+		cs-gpios = <&gpa2 5 0>;
 
 		w25q80bw at 0 {
 			#address-cells = <1>;
@@ -94,7 +93,6 @@ Example:
 			spi-max-frequency = <10000>;
 
 			controller-data {
-				cs-gpio = <&gpa2 5 1 0 3>;
 				samsung,spi-feedback-delay = <0>;
 			};
 
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 75a5696..b888c66 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data {
 	struct s3c64xx_spi_dma_data	tx_dma;
 	struct s3c64xx_spi_port_config	*port_conf;
 	unsigned int			port_id;
-	bool				cs_gpio;
 };
 
 static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
@@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
 		return ERR_PTR(-ENOMEM);
 	}
 
-	/* The CS line is asserted/deasserted by the gpio pin */
-	if (sdd->cs_gpio)
-		cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
-
-	if (!gpio_is_valid(cs->line)) {
-		dev_err(&spi->dev, "chip select gpio is not specified or invalid\n");
-		kfree(cs);
-		of_node_put(data_np);
-		return ERR_PTR(-EINVAL);
-	}
-
 	of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
 	cs->fb_delay = fb_delay;
 	of_node_put(data_np);
@@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 		spi->controller_data = cs;
 	}
 
+	/* For the non-DT platforms derive chip selects from controller data */
+	if (!spi->dev.of_node)
+		spi->cs_gpio = cs->line;
+
 	if (IS_ERR_OR_NULL(cs)) {
 		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
 		return -ENODEV;
@@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 
 	if (!spi_get_ctldata(spi)) {
 		/* Request gpio only if cs line is asserted by gpio pins */
-		if (sdd->cs_gpio) {
-			err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
-					dev_name(&spi->dev));
+		if (gpio_is_valid(spi->cs_gpio)) {
+			err = gpio_request_one(spi->cs_gpio,
+						GPIOF_OUT_INIT_HIGH,
+						dev_name(&spi->dev));
 			if (err) {
 				dev_err(&spi->dev,
 					"Failed to get /CS gpio [%d]: %d\n",
-					cs->line, err);
+					spi->cs_gpio, err);
 				goto err_gpio_req;
 			}
-
-			spi->cs_gpio = cs->line;
+		} else {
+			dev_err(&spi->dev, "chip select gpio is invalid\n");
+			return -EINVAL;
 		}
 
 		spi_set_ctldata(spi, cs);
@@ -884,7 +878,8 @@ setup_exit:
 	/* setup() returns with device de-selected */
 	writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
 
-	gpio_free(cs->line);
+	if (gpio_is_valid(spi->cs_gpio))
+		gpio_free(spi->cs_gpio);
 	spi_set_ctldata(spi, NULL);
 
 err_gpio_req:
@@ -900,10 +895,12 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi)
 	struct s3c64xx_spi_driver_data *sdd;
 
 	sdd = spi_master_get_devdata(spi->master);
-	if (spi->cs_gpio) {
+	if (gpio_is_valid(spi->cs_gpio)) {
 		gpio_free(spi->cs_gpio);
 		if (spi->dev.of_node)
 			kfree(cs);
+		else
+			spi->cs_gpio = -ENOENT;
 	}
 	spi_set_ctldata(spi, NULL);
 }
@@ -1075,11 +1072,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	sdd->cntrlr_info = sci;
 	sdd->pdev = pdev;
 	sdd->sfr_start = mem_res->start;
-	sdd->cs_gpio = true;
 	if (pdev->dev.of_node) {
-		if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL))
-			sdd->cs_gpio = false;
-
 		ret = of_alias_get_id(pdev->dev.of_node, "spi");
 		if (ret < 0) {
 			dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
-- 
1.7.9.5

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

* [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
  2014-06-12 13:13 ` Naveen Krishna Chatradhi
@ 2014-06-12 13:13   ` Naveen Krishna Chatradhi
  -1 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-06-12 13:13 UTC (permalink / raw)
  To: linux-arm-kernel, spi-devel-general, linux-samsung-soc
  Cc: naveenkrishna.ch, broonie, grant.likely, jaswinder.singh,
	kgene.kim, cpgs, devicetree, Javier Martinez Canillas,
	Doug Anderson, Tomasz Figa

Use controller_data structure only for the Non Device tree  platforms.
For Device tree platforms, always derive the chipselect info from
DT node.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index b888c66..f27e15d 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 	int err;
 
 	sdd = spi_master_get_devdata(spi->master);
-	if (!cs && spi->dev.of_node) {
+	if (spi->dev.of_node) {
 		cs = s3c64xx_get_slave_ctrldata(spi);
 		spi->controller_data = cs;
-	}
-
-	/* For the non-DT platforms derive chip selects from controller data */
-	if (!spi->dev.of_node)
+	} else {
+		/* For the non-DT platforms derive chip
+		 * selects from controller data
+		 */
 		spi->cs_gpio = cs->line;
+	}
 
 	if (IS_ERR_OR_NULL(cs)) {
 		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
-- 
1.7.9.5

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

* [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
@ 2014-06-12 13:13   ` Naveen Krishna Chatradhi
  0 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-06-12 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

Use controller_data structure only for the Non Device tree  platforms.
For Device tree platforms, always derive the chipselect info from
DT node.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index b888c66..f27e15d 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
 	int err;
 
 	sdd = spi_master_get_devdata(spi->master);
-	if (!cs && spi->dev.of_node) {
+	if (spi->dev.of_node) {
 		cs = s3c64xx_get_slave_ctrldata(spi);
 		spi->controller_data = cs;
-	}
-
-	/* For the non-DT platforms derive chip selects from controller data */
-	if (!spi->dev.of_node)
+	} else {
+		/* For the non-DT platforms derive chip
+		 * selects from controller data
+		 */
 		spi->cs_gpio = cs->line;
+	}
 
 	if (IS_ERR_OR_NULL(cs)) {
 		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
-- 
1.7.9.5

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

* [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
  2014-06-12 13:13 ` Naveen Krishna Chatradhi
@ 2014-06-12 13:13   ` Naveen Krishna Chatradhi
  -1 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-06-12 13:13 UTC (permalink / raw)
  To: linux-arm-kernel, spi-devel-general, linux-samsung-soc
  Cc: naveenkrishna.ch, broonie, grant.likely, jaswinder.singh,
	kgene.kim, cpgs, devicetree, Javier Martinez Canillas,
	Doug Anderson, Tomasz Figa

This patch replaces the "cs-gpio" from "controller-data" node
as was specified in the old binding and use the standard
"cs-gpios" property expected by the SPI core as is defined in
the new binding.

Respective changes are preposed to spi-s3c64xx.c driver.
@ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 arch/arm/boot/dts/exynos4210-smdkv310.dts |    2 +-
 arch/arm/boot/dts/exynos4412-trats2.dts   |    2 +-
 arch/arm/boot/dts/exynos5250-smdk5250.dts |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 636d166..9191491 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -169,6 +169,7 @@
 
 	spi_2: spi@13940000 {
 		status = "okay";
+		cs-gpios = <&gpc1 2 0>;
 
 		w25x80@0 {
 			#address-cells = <1>;
@@ -178,7 +179,6 @@
 			spi-max-frequency = <1000000>;
 
 			controller-data {
-				cs-gpio = <&gpc1 2 0>;
 				samsung,spi-feedback-delay = <0>;
 			};
 
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 8a558b7..204b0de 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -512,6 +512,7 @@
 	spi_1: spi@13930000 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&spi1_bus>;
+		cs-gpios = <&gpb 5 0>;
 		status = "okay";
 
 		s5c73m3_spi: s5c73m3 {
@@ -519,7 +520,6 @@
 			spi-max-frequency = <50000000>;
 			reg = <0>;
 			controller-data {
-				cs-gpio = <&gpb 5 0>;
 				samsung,spi-feedback-delay = <2>;
 			};
 		};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a794a70..0c6433a 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -316,6 +316,7 @@
 	};
 
 	spi_1: spi@12d30000 {
+		cs-gpios = <&gpa2 5 0>;
 		status = "okay";
 
 		w25q80bw@0 {
@@ -326,7 +327,6 @@
 			spi-max-frequency = <1000000>;
 
 			controller-data {
-				cs-gpio = <&gpa2 5 0>;
 				samsung,spi-feedback-delay = <0>;
 			};
 
-- 
1.7.9.5

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

* [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
@ 2014-06-12 13:13   ` Naveen Krishna Chatradhi
  0 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Chatradhi @ 2014-06-12 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

This patch replaces the "cs-gpio" from "controller-data" node
as was specified in the old binding and use the standard
"cs-gpios" property expected by the SPI core as is defined in
the new binding.

Respective changes are preposed to spi-s3c64xx.c driver.
@ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 arch/arm/boot/dts/exynos4210-smdkv310.dts |    2 +-
 arch/arm/boot/dts/exynos4412-trats2.dts   |    2 +-
 arch/arm/boot/dts/exynos5250-smdk5250.dts |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 636d166..9191491 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -169,6 +169,7 @@
 
 	spi_2: spi at 13940000 {
 		status = "okay";
+		cs-gpios = <&gpc1 2 0>;
 
 		w25x80 at 0 {
 			#address-cells = <1>;
@@ -178,7 +179,6 @@
 			spi-max-frequency = <1000000>;
 
 			controller-data {
-				cs-gpio = <&gpc1 2 0>;
 				samsung,spi-feedback-delay = <0>;
 			};
 
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
index 8a558b7..204b0de 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -512,6 +512,7 @@
 	spi_1: spi at 13930000 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&spi1_bus>;
+		cs-gpios = <&gpb 5 0>;
 		status = "okay";
 
 		s5c73m3_spi: s5c73m3 {
@@ -519,7 +520,6 @@
 			spi-max-frequency = <50000000>;
 			reg = <0>;
 			controller-data {
-				cs-gpio = <&gpb 5 0>;
 				samsung,spi-feedback-delay = <2>;
 			};
 		};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a794a70..0c6433a 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -316,6 +316,7 @@
 	};
 
 	spi_1: spi at 12d30000 {
+		cs-gpios = <&gpa2 5 0>;
 		status = "okay";
 
 		w25q80bw at 0 {
@@ -326,7 +327,6 @@
 			spi-max-frequency = <1000000>;
 
 			controller-data {
-				cs-gpio = <&gpa2 5 0>;
 				samsung,spi-feedback-delay = <0>;
 			};
 
-- 
1.7.9.5

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

* Re: [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
  2014-06-12 13:13 ` Naveen Krishna Chatradhi
@ 2014-06-12 14:00     ` Javier Martinez Canillas
  -1 siblings, 0 replies; 22+ messages in thread
From: Javier Martinez Canillas @ 2014-06-12 14:00 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA
  Cc: naveenkrishna.ch-Re5JQEeQqe8AvxtiuMwx3w,
	broonie-DgEjT+Ai2ygdnm+yROfE0A,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A,
	kgene.kim-Sze3O3UU22JBDgjK7y7TUQ, cpgs-Sze3O3UU22JBDgjK7y7TUQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Doug Anderson, Tomasz Figa

Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)
> 
> spi-s3c64xx.c driver expects
> 1. chip select gpios from "cs-gpio"(singular) under the
>    "controller-data" node of the client/slave device of the SPI.
> 
> 2. "cs-gpio"(singular) entry to be present in the SPI device node.
> 
> Eg of current broken usage:
> &spi_1 {
> 	cs-gpio <>;	/* this entry is checked during probe */
> 	...
> 	slave_node {
> 		controller-data {
> 			cs-gpio <&gpioa2 5 0>;
> 			/* This field is parsed during .setup() */
> 		}
> 	};
> };
> 
> The following dts files which were using this driver. But,
> din't have the "cs-gpio" entry under SPI node.
> -- arch/arm/boot/dts/exynos4210-smdkv310.dts
> -- arch/arm/boot/dts/exynos4412-trats2.dts
> -- arch/arm/boot/dts/exynos5250-smdk5250.dts
> 
> Also, the SPI core and many drivers moved on to using "cs-gpios"
> from SPI node and removed the gpio handling code from drivers
> (including spi-s3c64xx.c).
> 
> Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
> considering the time with no compliants about the breakage.
> 
> We are assuming it is safe to remove the "cs-gpio"(singular) usage
> from device tree binding of spi-samsung.txt and makes appropriate
> changes in the driver to use "cs-gpios"(plural) from
> SPI device node.
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Javier Martinez Canillas <javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
> Cc: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Cc: Tomasz Figa <t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---

Usually when you send a new version of a series is good to keep a history of the
patch-set so reviewers don't have to look at the previous threads in order to
see what changed from version to version.

Anything that is between "---" and the actual diff is not part of a commit and
tools like git am omits that part so that's were you usually describe the history.

>  .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
>  drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
>  2 files changed, 20 insertions(+), 29 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
> index 86aa061..2d29dac 100644
> --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
> @@ -42,15 +42,13 @@ Optional Board Specific Properties:
>  - num-cs: Specifies the number of chip select lines supported. If
>    not specified, the default number of chip select lines is set to 1.
>  
> +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
> +
>  SPI Controller specific data in SPI slave nodes:
>  
>  - The spi slave nodes should provide the following information which is required
>    by the spi controller.
>  
> -  - cs-gpio: A gpio specifier that specifies the gpio line used as
> -    the slave select line by the spi controller. The format of the gpio
> -    specifier depends on the gpio controller.
> -
>    - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
>      miso line (to account for any lag in the miso line). The following are the
>      valid values.
> @@ -85,6 +83,7 @@ Example:
>  		#size-cells = <0>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&spi0_bus>;
> +		cs-gpios = <&gpa2 5 0>;
>  
>  		w25q80bw@0 {
>  			#address-cells = <1>;
> @@ -94,7 +93,6 @@ Example:
>  			spi-max-frequency = <10000>;
>  
>  			controller-data {
> -				cs-gpio = <&gpa2 5 1 0 3>;
>  				samsung,spi-feedback-delay = <0>;
>  			};
>  
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 75a5696..b888c66 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data {
>  	struct s3c64xx_spi_dma_data	tx_dma;
>  	struct s3c64xx_spi_port_config	*port_conf;
>  	unsigned int			port_id;
> -	bool				cs_gpio;
>  };
>  
>  static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
> @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
>  		return ERR_PTR(-ENOMEM);
>  	}
>  
> -	/* The CS line is asserted/deasserted by the gpio pin */
> -	if (sdd->cs_gpio)
> -		cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
> -
> -	if (!gpio_is_valid(cs->line)) {
> -		dev_err(&spi->dev, "chip select gpio is not specified or invalid\n");
> -		kfree(cs);
> -		of_node_put(data_np);
> -		return ERR_PTR(-EINVAL);
> -	}
> -
>  	of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
>  	cs->fb_delay = fb_delay;
>  	of_node_put(data_np);
> @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  		spi->controller_data = cs;
>  	}
>  
> +	/* For the non-DT platforms derive chip selects from controller data */
> +	if (!spi->dev.of_node)
> +		spi->cs_gpio = cs->line;
> +
>  	if (IS_ERR_OR_NULL(cs)) {
>  		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>  		return -ENODEV;
> @@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  
>  	if (!spi_get_ctldata(spi)) {
>  		/* Request gpio only if cs line is asserted by gpio pins */
> -		if (sdd->cs_gpio) {
> -			err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
> -					dev_name(&spi->dev));
> +		if (gpio_is_valid(spi->cs_gpio)) {
> +			err = gpio_request_one(spi->cs_gpio,
> +						GPIOF_OUT_INIT_HIGH,
> +						dev_name(&spi->dev));
>  			if (err) {
>  				dev_err(&spi->dev,
>  					"Failed to get /CS gpio [%d]: %d\n",
> -					cs->line, err);
> +					spi->cs_gpio, err);
>  				goto err_gpio_req;
>  			}
> -
> -			spi->cs_gpio = cs->line;
> +		} else {
> +			dev_err(&spi->dev, "chip select gpio is invalid\n");
> +			return -EINVAL;
>  		}
>  
>  		spi_set_ctldata(spi, cs);
> @@ -884,7 +878,8 @@ setup_exit:
>  	/* setup() returns with device de-selected */
>  	writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
>  
> -	gpio_free(cs->line);
> +	if (gpio_is_valid(spi->cs_gpio))
> +		gpio_free(spi->cs_gpio);
>  	spi_set_ctldata(spi, NULL);
>  
>  err_gpio_req:
> @@ -900,10 +895,12 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi)
>  	struct s3c64xx_spi_driver_data *sdd;
>  
>  	sdd = spi_master_get_devdata(spi->master);
> -	if (spi->cs_gpio) {
> +	if (gpio_is_valid(spi->cs_gpio)) {
>  		gpio_free(spi->cs_gpio);
>  		if (spi->dev.of_node)
>  			kfree(cs);
> +		else
> +			spi->cs_gpio = -ENOENT;
>  	}
>  	spi_set_ctldata(spi, NULL);
>  }
> @@ -1075,11 +1072,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>  	sdd->cntrlr_info = sci;
>  	sdd->pdev = pdev;
>  	sdd->sfr_start = mem_res->start;
> -	sdd->cs_gpio = true;
>  	if (pdev->dev.of_node) {
> -		if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL))
> -			sdd->cs_gpio = false;
> -
>  		ret = of_alias_get_id(pdev->dev.of_node, "spi");
>  		if (ret < 0) {
>  			dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
> 

Your changes look good to me now.

Reviewed-by: Javier Martinez Canillas <javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>

Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
@ 2014-06-12 14:00     ` Javier Martinez Canillas
  0 siblings, 0 replies; 22+ messages in thread
From: Javier Martinez Canillas @ 2014-06-12 14:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)
> 
> spi-s3c64xx.c driver expects
> 1. chip select gpios from "cs-gpio"(singular) under the
>    "controller-data" node of the client/slave device of the SPI.
> 
> 2. "cs-gpio"(singular) entry to be present in the SPI device node.
> 
> Eg of current broken usage:
> &spi_1 {
> 	cs-gpio <>;	/* this entry is checked during probe */
> 	...
> 	slave_node {
> 		controller-data {
> 			cs-gpio <&gpioa2 5 0>;
> 			/* This field is parsed during .setup() */
> 		}
> 	};
> };
> 
> The following dts files which were using this driver. But,
> din't have the "cs-gpio" entry under SPI node.
> -- arch/arm/boot/dts/exynos4210-smdkv310.dts
> -- arch/arm/boot/dts/exynos4412-trats2.dts
> -- arch/arm/boot/dts/exynos5250-smdk5250.dts
> 
> Also, the SPI core and many drivers moved on to using "cs-gpios"
> from SPI node and removed the gpio handling code from drivers
> (including spi-s3c64xx.c).
> 
> Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
> considering the time with no compliants about the breakage.
> 
> We are assuming it is safe to remove the "cs-gpio"(singular) usage
> from device tree binding of spi-samsung.txt and makes appropriate
> changes in the driver to use "cs-gpios"(plural) from
> SPI device node.
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---

Usually when you send a new version of a series is good to keep a history of the
patch-set so reviewers don't have to look at the previous threads in order to
see what changed from version to version.

Anything that is between "---" and the actual diff is not part of a commit and
tools like git am omits that part so that's were you usually describe the history.

>  .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
>  drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
>  2 files changed, 20 insertions(+), 29 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
> index 86aa061..2d29dac 100644
> --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
> @@ -42,15 +42,13 @@ Optional Board Specific Properties:
>  - num-cs: Specifies the number of chip select lines supported. If
>    not specified, the default number of chip select lines is set to 1.
>  
> +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
> +
>  SPI Controller specific data in SPI slave nodes:
>  
>  - The spi slave nodes should provide the following information which is required
>    by the spi controller.
>  
> -  - cs-gpio: A gpio specifier that specifies the gpio line used as
> -    the slave select line by the spi controller. The format of the gpio
> -    specifier depends on the gpio controller.
> -
>    - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
>      miso line (to account for any lag in the miso line). The following are the
>      valid values.
> @@ -85,6 +83,7 @@ Example:
>  		#size-cells = <0>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&spi0_bus>;
> +		cs-gpios = <&gpa2 5 0>;
>  
>  		w25q80bw at 0 {
>  			#address-cells = <1>;
> @@ -94,7 +93,6 @@ Example:
>  			spi-max-frequency = <10000>;
>  
>  			controller-data {
> -				cs-gpio = <&gpa2 5 1 0 3>;
>  				samsung,spi-feedback-delay = <0>;
>  			};
>  
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 75a5696..b888c66 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data {
>  	struct s3c64xx_spi_dma_data	tx_dma;
>  	struct s3c64xx_spi_port_config	*port_conf;
>  	unsigned int			port_id;
> -	bool				cs_gpio;
>  };
>  
>  static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
> @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
>  		return ERR_PTR(-ENOMEM);
>  	}
>  
> -	/* The CS line is asserted/deasserted by the gpio pin */
> -	if (sdd->cs_gpio)
> -		cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
> -
> -	if (!gpio_is_valid(cs->line)) {
> -		dev_err(&spi->dev, "chip select gpio is not specified or invalid\n");
> -		kfree(cs);
> -		of_node_put(data_np);
> -		return ERR_PTR(-EINVAL);
> -	}
> -
>  	of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
>  	cs->fb_delay = fb_delay;
>  	of_node_put(data_np);
> @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  		spi->controller_data = cs;
>  	}
>  
> +	/* For the non-DT platforms derive chip selects from controller data */
> +	if (!spi->dev.of_node)
> +		spi->cs_gpio = cs->line;
> +
>  	if (IS_ERR_OR_NULL(cs)) {
>  		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>  		return -ENODEV;
> @@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  
>  	if (!spi_get_ctldata(spi)) {
>  		/* Request gpio only if cs line is asserted by gpio pins */
> -		if (sdd->cs_gpio) {
> -			err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
> -					dev_name(&spi->dev));
> +		if (gpio_is_valid(spi->cs_gpio)) {
> +			err = gpio_request_one(spi->cs_gpio,
> +						GPIOF_OUT_INIT_HIGH,
> +						dev_name(&spi->dev));
>  			if (err) {
>  				dev_err(&spi->dev,
>  					"Failed to get /CS gpio [%d]: %d\n",
> -					cs->line, err);
> +					spi->cs_gpio, err);
>  				goto err_gpio_req;
>  			}
> -
> -			spi->cs_gpio = cs->line;
> +		} else {
> +			dev_err(&spi->dev, "chip select gpio is invalid\n");
> +			return -EINVAL;
>  		}
>  
>  		spi_set_ctldata(spi, cs);
> @@ -884,7 +878,8 @@ setup_exit:
>  	/* setup() returns with device de-selected */
>  	writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
>  
> -	gpio_free(cs->line);
> +	if (gpio_is_valid(spi->cs_gpio))
> +		gpio_free(spi->cs_gpio);
>  	spi_set_ctldata(spi, NULL);
>  
>  err_gpio_req:
> @@ -900,10 +895,12 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi)
>  	struct s3c64xx_spi_driver_data *sdd;
>  
>  	sdd = spi_master_get_devdata(spi->master);
> -	if (spi->cs_gpio) {
> +	if (gpio_is_valid(spi->cs_gpio)) {
>  		gpio_free(spi->cs_gpio);
>  		if (spi->dev.of_node)
>  			kfree(cs);
> +		else
> +			spi->cs_gpio = -ENOENT;
>  	}
>  	spi_set_ctldata(spi, NULL);
>  }
> @@ -1075,11 +1072,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>  	sdd->cntrlr_info = sci;
>  	sdd->pdev = pdev;
>  	sdd->sfr_start = mem_res->start;
> -	sdd->cs_gpio = true;
>  	if (pdev->dev.of_node) {
> -		if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL))
> -			sdd->cs_gpio = false;
> -
>  		ret = of_alias_get_id(pdev->dev.of_node, "spi");
>  		if (ret < 0) {
>  			dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
> 

Your changes look good to me now.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

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

* Re: [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
  2014-06-12 13:13   ` Naveen Krishna Chatradhi
@ 2014-06-12 14:06     ` Javier Martinez Canillas
  -1 siblings, 0 replies; 22+ messages in thread
From: Javier Martinez Canillas @ 2014-06-12 14:06 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi, linux-arm-kernel, spi-devel-general,
	linux-samsung-soc
  Cc: naveenkrishna.ch, broonie, grant.likely, jaswinder.singh,
	kgene.kim, cpgs, devicetree, Doug Anderson, Tomasz Figa

Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> Use controller_data structure only for the Non Device tree  platforms.
> For Device tree platforms, always derive the chipselect info from
> DT node.
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index b888c66..f27e15d 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  	int err;
>  
>  	sdd = spi_master_get_devdata(spi->master);
> -	if (!cs && spi->dev.of_node) {
> +	if (spi->dev.of_node) {
>  		cs = s3c64xx_get_slave_ctrldata(spi);
>  		spi->controller_data = cs;
> -	}
> -
> -	/* For the non-DT platforms derive chip selects from controller data */
> -	if (!spi->dev.of_node)
> +	} else {
> +		/* For the non-DT platforms derive chip
> +		 * selects from controller data
> +		 */
>  		spi->cs_gpio = cs->line;
> +	}
>  
>  	if (IS_ERR_OR_NULL(cs)) {
>  		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
> 

Personally I wouldn't have this change as a separate patch since it's too
related to what you changed in Patch 1. But it's just a nitpick.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

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

* [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
@ 2014-06-12 14:06     ` Javier Martinez Canillas
  0 siblings, 0 replies; 22+ messages in thread
From: Javier Martinez Canillas @ 2014-06-12 14:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> Use controller_data structure only for the Non Device tree  platforms.
> For Device tree platforms, always derive the chipselect info from
> DT node.
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index b888c66..f27e15d 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  	int err;
>  
>  	sdd = spi_master_get_devdata(spi->master);
> -	if (!cs && spi->dev.of_node) {
> +	if (spi->dev.of_node) {
>  		cs = s3c64xx_get_slave_ctrldata(spi);
>  		spi->controller_data = cs;
> -	}
> -
> -	/* For the non-DT platforms derive chip selects from controller data */
> -	if (!spi->dev.of_node)
> +	} else {
> +		/* For the non-DT platforms derive chip
> +		 * selects from controller data
> +		 */
>  		spi->cs_gpio = cs->line;
> +	}
>  
>  	if (IS_ERR_OR_NULL(cs)) {
>  		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
> 

Personally I wouldn't have this change as a separate patch since it's too
related to what you changed in Patch 1. But it's just a nitpick.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

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

* Re: [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
  2014-06-12 13:13   ` Naveen Krishna Chatradhi
@ 2014-06-12 14:07     ` Javier Martinez Canillas
  -1 siblings, 0 replies; 22+ messages in thread
From: Javier Martinez Canillas @ 2014-06-12 14:07 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi, linux-arm-kernel, spi-devel-general,
	linux-samsung-soc
  Cc: naveenkrishna.ch, broonie, grant.likely, jaswinder.singh,
	kgene.kim, cpgs, devicetree, Doug Anderson, Tomasz Figa

Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> This patch replaces the "cs-gpio" from "controller-data" node
> as was specified in the old binding and use the standard
> "cs-gpios" property expected by the SPI core as is defined in
> the new binding.
> 
> Respective changes are preposed to spi-s3c64xx.c driver.
> @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  arch/arm/boot/dts/exynos4210-smdkv310.dts |    2 +-
>  arch/arm/boot/dts/exynos4412-trats2.dts   |    2 +-
>  arch/arm/boot/dts/exynos5250-smdk5250.dts |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
> index 636d166..9191491 100644
> --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
> +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
> @@ -169,6 +169,7 @@
>  
>  	spi_2: spi@13940000 {
>  		status = "okay";
> +		cs-gpios = <&gpc1 2 0>;
>  
>  		w25x80@0 {
>  			#address-cells = <1>;
> @@ -178,7 +179,6 @@
>  			spi-max-frequency = <1000000>;
>  
>  			controller-data {
> -				cs-gpio = <&gpc1 2 0>;
>  				samsung,spi-feedback-delay = <0>;
>  			};
>  
> diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
> index 8a558b7..204b0de 100644
> --- a/arch/arm/boot/dts/exynos4412-trats2.dts
> +++ b/arch/arm/boot/dts/exynos4412-trats2.dts
> @@ -512,6 +512,7 @@
>  	spi_1: spi@13930000 {
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&spi1_bus>;
> +		cs-gpios = <&gpb 5 0>;
>  		status = "okay";
>  
>  		s5c73m3_spi: s5c73m3 {
> @@ -519,7 +520,6 @@
>  			spi-max-frequency = <50000000>;
>  			reg = <0>;
>  			controller-data {
> -				cs-gpio = <&gpb 5 0>;
>  				samsung,spi-feedback-delay = <2>;
>  			};
>  		};
> diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
> index a794a70..0c6433a 100644
> --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
> +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
> @@ -316,6 +316,7 @@
>  	};
>  
>  	spi_1: spi@12d30000 {
> +		cs-gpios = <&gpa2 5 0>;
>  		status = "okay";
>  
>  		w25q80bw@0 {
> @@ -326,7 +327,6 @@
>  			spi-max-frequency = <1000000>;
>  
>  			controller-data {
> -				cs-gpio = <&gpa2 5 0>;
>  				samsung,spi-feedback-delay = <0>;
>  			};
>  
> 

Looks good to me.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

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

* [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
@ 2014-06-12 14:07     ` Javier Martinez Canillas
  0 siblings, 0 replies; 22+ messages in thread
From: Javier Martinez Canillas @ 2014-06-12 14:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> This patch replaces the "cs-gpio" from "controller-data" node
> as was specified in the old binding and use the standard
> "cs-gpios" property expected by the SPI core as is defined in
> the new binding.
> 
> Respective changes are preposed to spi-s3c64xx.c driver.
> @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  arch/arm/boot/dts/exynos4210-smdkv310.dts |    2 +-
>  arch/arm/boot/dts/exynos4412-trats2.dts   |    2 +-
>  arch/arm/boot/dts/exynos5250-smdk5250.dts |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
> index 636d166..9191491 100644
> --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
> +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
> @@ -169,6 +169,7 @@
>  
>  	spi_2: spi at 13940000 {
>  		status = "okay";
> +		cs-gpios = <&gpc1 2 0>;
>  
>  		w25x80 at 0 {
>  			#address-cells = <1>;
> @@ -178,7 +179,6 @@
>  			spi-max-frequency = <1000000>;
>  
>  			controller-data {
> -				cs-gpio = <&gpc1 2 0>;
>  				samsung,spi-feedback-delay = <0>;
>  			};
>  
> diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts
> index 8a558b7..204b0de 100644
> --- a/arch/arm/boot/dts/exynos4412-trats2.dts
> +++ b/arch/arm/boot/dts/exynos4412-trats2.dts
> @@ -512,6 +512,7 @@
>  	spi_1: spi at 13930000 {
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&spi1_bus>;
> +		cs-gpios = <&gpb 5 0>;
>  		status = "okay";
>  
>  		s5c73m3_spi: s5c73m3 {
> @@ -519,7 +520,6 @@
>  			spi-max-frequency = <50000000>;
>  			reg = <0>;
>  			controller-data {
> -				cs-gpio = <&gpb 5 0>;
>  				samsung,spi-feedback-delay = <2>;
>  			};
>  		};
> diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
> index a794a70..0c6433a 100644
> --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
> +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
> @@ -316,6 +316,7 @@
>  	};
>  
>  	spi_1: spi at 12d30000 {
> +		cs-gpios = <&gpa2 5 0>;
>  		status = "okay";
>  
>  		w25q80bw at 0 {
> @@ -326,7 +327,6 @@
>  			spi-max-frequency = <1000000>;
>  
>  			controller-data {
> -				cs-gpio = <&gpa2 5 0>;
>  				samsung,spi-feedback-delay = <0>;
>  			};
>  
> 

Looks good to me.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

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

* Re: [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
  2014-06-12 14:00     ` Javier Martinez Canillas
@ 2014-06-12 16:06       ` Naveen Krishna Ch
  -1 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Ch @ 2014-06-12 16:06 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Naveen Krishna Chatradhi, linux-arm-kernel, spi-devel-general,
	linux-samsung-soc, broonie, grant.likely, jaswinder.singh,
	Kukjin Kim, cpgs, devicetree, Doug Anderson, Tomasz Figa

Hello Javier,

On 12 June 2014 19:30, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> Hello Naveen,
>
> On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
>> Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)
>>
>> spi-s3c64xx.c driver expects
>> 1. chip select gpios from "cs-gpio"(singular) under the
>>    "controller-data" node of the client/slave device of the SPI.
>>
>> 2. "cs-gpio"(singular) entry to be present in the SPI device node.
>>
>> Eg of current broken usage:
>> &spi_1 {
>>       cs-gpio <>;     /* this entry is checked during probe */
>>       ...
>>       slave_node {
>>               controller-data {
>>                       cs-gpio <&gpioa2 5 0>;
>>                       /* This field is parsed during .setup() */
>>               }
>>       };
>> };
>>
>> The following dts files which were using this driver. But,
>> din't have the "cs-gpio" entry under SPI node.
>> -- arch/arm/boot/dts/exynos4210-smdkv310.dts
>> -- arch/arm/boot/dts/exynos4412-trats2.dts
>> -- arch/arm/boot/dts/exynos5250-smdk5250.dts
>>
>> Also, the SPI core and many drivers moved on to using "cs-gpios"
>> from SPI node and removed the gpio handling code from drivers
>> (including spi-s3c64xx.c).
>>
>> Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
>> considering the time with no compliants about the breakage.
>>
>> We are assuming it is safe to remove the "cs-gpio"(singular) usage
>> from device tree binding of spi-samsung.txt and makes appropriate
>> changes in the driver to use "cs-gpios"(plural) from
>> SPI device node.
>>
>> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
>> Acked-by: Rob Herring <robh@kernel.org>
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Doug Anderson <dianders@chromium.org>
>> Cc: Tomasz Figa <t.figa@samsung.com>
>> ---
>
> Usually when you send a new version of a series is good to keep a history of the
> patch-set so reviewers don't have to look at the previous threads in order to
> see what changed from version to version.

Yes, I usually keep track of all the changes in my previous CLs.
But, I missed it in this version my bad.

>
> Anything that is between "---" and the actual diff is not part of a commit and
> tools like git am omits that part so that's were you usually describe the history.

I've used it in my earlier patches.
Anyway, Thanks for the detailed information.

>
>>  .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
>>  drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
>>  2 files changed, 20 insertions(+), 29 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
>> index 86aa061..2d29dac 100644
>> --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
>> +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
>> @@ -42,15 +42,13 @@ Optional Board Specific Properties:
>>  - num-cs: Specifies the number of chip select lines supported. If
>>    not specified, the default number of chip select lines is set to 1.
>>
>> +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
>> +
>>  SPI Controller specific data in SPI slave nodes:
>>
>>  - The spi slave nodes should provide the following information which is required
>>    by the spi controller.
>>
>> -  - cs-gpio: A gpio specifier that specifies the gpio line used as
>> -    the slave select line by the spi controller. The format of the gpio
>> -    specifier depends on the gpio controller.
>> -
>>    - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
>>      miso line (to account for any lag in the miso line). The following are the
>>      valid values.
>> @@ -85,6 +83,7 @@ Example:
>>               #size-cells = <0>;
>>               pinctrl-names = "default";
>>               pinctrl-0 = <&spi0_bus>;
>> +             cs-gpios = <&gpa2 5 0>;
>>
>>               w25q80bw@0 {
>>                       #address-cells = <1>;
>> @@ -94,7 +93,6 @@ Example:
>>                       spi-max-frequency = <10000>;
>>
>>                       controller-data {
>> -                             cs-gpio = <&gpa2 5 1 0 3>;
>>                               samsung,spi-feedback-delay = <0>;
>>                       };
>>
>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>> index 75a5696..b888c66 100644
>> --- a/drivers/spi/spi-s3c64xx.c
>> +++ b/drivers/spi/spi-s3c64xx.c
>> @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data {
>>       struct s3c64xx_spi_dma_data     tx_dma;
>>       struct s3c64xx_spi_port_config  *port_conf;
>>       unsigned int                    port_id;
>> -     bool                            cs_gpio;
>>  };
>>
>>  static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
>> @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
>>               return ERR_PTR(-ENOMEM);
>>       }
>>
>> -     /* The CS line is asserted/deasserted by the gpio pin */
>> -     if (sdd->cs_gpio)
>> -             cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
>> -
>> -     if (!gpio_is_valid(cs->line)) {
>> -             dev_err(&spi->dev, "chip select gpio is not specified or invalid\n");
>> -             kfree(cs);
>> -             of_node_put(data_np);
>> -             return ERR_PTR(-EINVAL);
>> -     }
>> -
>>       of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
>>       cs->fb_delay = fb_delay;
>>       of_node_put(data_np);
>> @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>               spi->controller_data = cs;
>>       }
>>
>> +     /* For the non-DT platforms derive chip selects from controller data */
>> +     if (!spi->dev.of_node)
>> +             spi->cs_gpio = cs->line;
>> +
>>       if (IS_ERR_OR_NULL(cs)) {
>>               dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>>               return -ENODEV;
>> @@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>
>>       if (!spi_get_ctldata(spi)) {
>>               /* Request gpio only if cs line is asserted by gpio pins */
>> -             if (sdd->cs_gpio) {
>> -                     err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
>> -                                     dev_name(&spi->dev));
>> +             if (gpio_is_valid(spi->cs_gpio)) {
>> +                     err = gpio_request_one(spi->cs_gpio,
>> +                                             GPIOF_OUT_INIT_HIGH,
>> +                                             dev_name(&spi->dev));
>>                       if (err) {
>>                               dev_err(&spi->dev,
>>                                       "Failed to get /CS gpio [%d]: %d\n",
>> -                                     cs->line, err);
>> +                                     spi->cs_gpio, err);
>>                               goto err_gpio_req;
>>                       }
>> -
>> -                     spi->cs_gpio = cs->line;
>> +             } else {
>> +                     dev_err(&spi->dev, "chip select gpio is invalid\n");
>> +                     return -EINVAL;
>>               }
>>
>>               spi_set_ctldata(spi, cs);
>> @@ -884,7 +878,8 @@ setup_exit:
>>       /* setup() returns with device de-selected */
>>       writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
>>
>> -     gpio_free(cs->line);
>> +     if (gpio_is_valid(spi->cs_gpio))
>> +             gpio_free(spi->cs_gpio);
>>       spi_set_ctldata(spi, NULL);
>>
>>  err_gpio_req:
>> @@ -900,10 +895,12 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi)
>>       struct s3c64xx_spi_driver_data *sdd;
>>
>>       sdd = spi_master_get_devdata(spi->master);
>> -     if (spi->cs_gpio) {
>> +     if (gpio_is_valid(spi->cs_gpio)) {
>>               gpio_free(spi->cs_gpio);
>>               if (spi->dev.of_node)
>>                       kfree(cs);
>> +             else
>> +                     spi->cs_gpio = -ENOENT;
>>       }
>>       spi_set_ctldata(spi, NULL);
>>  }
>> @@ -1075,11 +1072,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>>       sdd->cntrlr_info = sci;
>>       sdd->pdev = pdev;
>>       sdd->sfr_start = mem_res->start;
>> -     sdd->cs_gpio = true;
>>       if (pdev->dev.of_node) {
>> -             if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL))
>> -                     sdd->cs_gpio = false;
>> -
>>               ret = of_alias_get_id(pdev->dev.of_node, "spi");
>>               if (ret < 0) {
>>                       dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
>>
>
> Your changes look good to me now.
>
> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Thanks for your review.
>
> Best regards,
> Javier



-- 
Shine bright,
(: Nav :)

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

* [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
@ 2014-06-12 16:06       ` Naveen Krishna Ch
  0 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Ch @ 2014-06-12 16:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Javier,

On 12 June 2014 19:30, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> Hello Naveen,
>
> On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
>> Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)
>>
>> spi-s3c64xx.c driver expects
>> 1. chip select gpios from "cs-gpio"(singular) under the
>>    "controller-data" node of the client/slave device of the SPI.
>>
>> 2. "cs-gpio"(singular) entry to be present in the SPI device node.
>>
>> Eg of current broken usage:
>> &spi_1 {
>>       cs-gpio <>;     /* this entry is checked during probe */
>>       ...
>>       slave_node {
>>               controller-data {
>>                       cs-gpio <&gpioa2 5 0>;
>>                       /* This field is parsed during .setup() */
>>               }
>>       };
>> };
>>
>> The following dts files which were using this driver. But,
>> din't have the "cs-gpio" entry under SPI node.
>> -- arch/arm/boot/dts/exynos4210-smdkv310.dts
>> -- arch/arm/boot/dts/exynos4412-trats2.dts
>> -- arch/arm/boot/dts/exynos5250-smdk5250.dts
>>
>> Also, the SPI core and many drivers moved on to using "cs-gpios"
>> from SPI node and removed the gpio handling code from drivers
>> (including spi-s3c64xx.c).
>>
>> Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
>> considering the time with no compliants about the breakage.
>>
>> We are assuming it is safe to remove the "cs-gpio"(singular) usage
>> from device tree binding of spi-samsung.txt and makes appropriate
>> changes in the driver to use "cs-gpios"(plural) from
>> SPI device node.
>>
>> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
>> Acked-by: Rob Herring <robh@kernel.org>
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Doug Anderson <dianders@chromium.org>
>> Cc: Tomasz Figa <t.figa@samsung.com>
>> ---
>
> Usually when you send a new version of a series is good to keep a history of the
> patch-set so reviewers don't have to look at the previous threads in order to
> see what changed from version to version.

Yes, I usually keep track of all the changes in my previous CLs.
But, I missed it in this version my bad.

>
> Anything that is between "---" and the actual diff is not part of a commit and
> tools like git am omits that part so that's were you usually describe the history.

I've used it in my earlier patches.
Anyway, Thanks for the detailed information.

>
>>  .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
>>  drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
>>  2 files changed, 20 insertions(+), 29 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/spi/spi-samsung.txt b/Documentation/devicetree/bindings/spi/spi-samsung.txt
>> index 86aa061..2d29dac 100644
>> --- a/Documentation/devicetree/bindings/spi/spi-samsung.txt
>> +++ b/Documentation/devicetree/bindings/spi/spi-samsung.txt
>> @@ -42,15 +42,13 @@ Optional Board Specific Properties:
>>  - num-cs: Specifies the number of chip select lines supported. If
>>    not specified, the default number of chip select lines is set to 1.
>>
>> +- cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
>> +
>>  SPI Controller specific data in SPI slave nodes:
>>
>>  - The spi slave nodes should provide the following information which is required
>>    by the spi controller.
>>
>> -  - cs-gpio: A gpio specifier that specifies the gpio line used as
>> -    the slave select line by the spi controller. The format of the gpio
>> -    specifier depends on the gpio controller.
>> -
>>    - samsung,spi-feedback-delay: The sampling phase shift to be applied on the
>>      miso line (to account for any lag in the miso line). The following are the
>>      valid values.
>> @@ -85,6 +83,7 @@ Example:
>>               #size-cells = <0>;
>>               pinctrl-names = "default";
>>               pinctrl-0 = <&spi0_bus>;
>> +             cs-gpios = <&gpa2 5 0>;
>>
>>               w25q80bw at 0 {
>>                       #address-cells = <1>;
>> @@ -94,7 +93,6 @@ Example:
>>                       spi-max-frequency = <10000>;
>>
>>                       controller-data {
>> -                             cs-gpio = <&gpa2 5 1 0 3>;
>>                               samsung,spi-feedback-delay = <0>;
>>                       };
>>
>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>> index 75a5696..b888c66 100644
>> --- a/drivers/spi/spi-s3c64xx.c
>> +++ b/drivers/spi/spi-s3c64xx.c
>> @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data {
>>       struct s3c64xx_spi_dma_data     tx_dma;
>>       struct s3c64xx_spi_port_config  *port_conf;
>>       unsigned int                    port_id;
>> -     bool                            cs_gpio;
>>  };
>>
>>  static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
>> @@ -776,17 +775,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
>>               return ERR_PTR(-ENOMEM);
>>       }
>>
>> -     /* The CS line is asserted/deasserted by the gpio pin */
>> -     if (sdd->cs_gpio)
>> -             cs->line = of_get_named_gpio(data_np, "cs-gpio", 0);
>> -
>> -     if (!gpio_is_valid(cs->line)) {
>> -             dev_err(&spi->dev, "chip select gpio is not specified or invalid\n");
>> -             kfree(cs);
>> -             of_node_put(data_np);
>> -             return ERR_PTR(-EINVAL);
>> -     }
>> -
>>       of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
>>       cs->fb_delay = fb_delay;
>>       of_node_put(data_np);
>> @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>               spi->controller_data = cs;
>>       }
>>
>> +     /* For the non-DT platforms derive chip selects from controller data */
>> +     if (!spi->dev.of_node)
>> +             spi->cs_gpio = cs->line;
>> +
>>       if (IS_ERR_OR_NULL(cs)) {
>>               dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>>               return -ENODEV;
>> @@ -819,17 +811,19 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>
>>       if (!spi_get_ctldata(spi)) {
>>               /* Request gpio only if cs line is asserted by gpio pins */
>> -             if (sdd->cs_gpio) {
>> -                     err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
>> -                                     dev_name(&spi->dev));
>> +             if (gpio_is_valid(spi->cs_gpio)) {
>> +                     err = gpio_request_one(spi->cs_gpio,
>> +                                             GPIOF_OUT_INIT_HIGH,
>> +                                             dev_name(&spi->dev));
>>                       if (err) {
>>                               dev_err(&spi->dev,
>>                                       "Failed to get /CS gpio [%d]: %d\n",
>> -                                     cs->line, err);
>> +                                     spi->cs_gpio, err);
>>                               goto err_gpio_req;
>>                       }
>> -
>> -                     spi->cs_gpio = cs->line;
>> +             } else {
>> +                     dev_err(&spi->dev, "chip select gpio is invalid\n");
>> +                     return -EINVAL;
>>               }
>>
>>               spi_set_ctldata(spi, cs);
>> @@ -884,7 +878,8 @@ setup_exit:
>>       /* setup() returns with device de-selected */
>>       writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
>>
>> -     gpio_free(cs->line);
>> +     if (gpio_is_valid(spi->cs_gpio))
>> +             gpio_free(spi->cs_gpio);
>>       spi_set_ctldata(spi, NULL);
>>
>>  err_gpio_req:
>> @@ -900,10 +895,12 @@ static void s3c64xx_spi_cleanup(struct spi_device *spi)
>>       struct s3c64xx_spi_driver_data *sdd;
>>
>>       sdd = spi_master_get_devdata(spi->master);
>> -     if (spi->cs_gpio) {
>> +     if (gpio_is_valid(spi->cs_gpio)) {
>>               gpio_free(spi->cs_gpio);
>>               if (spi->dev.of_node)
>>                       kfree(cs);
>> +             else
>> +                     spi->cs_gpio = -ENOENT;
>>       }
>>       spi_set_ctldata(spi, NULL);
>>  }
>> @@ -1075,11 +1072,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>>       sdd->cntrlr_info = sci;
>>       sdd->pdev = pdev;
>>       sdd->sfr_start = mem_res->start;
>> -     sdd->cs_gpio = true;
>>       if (pdev->dev.of_node) {
>> -             if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL))
>> -                     sdd->cs_gpio = false;
>> -
>>               ret = of_alias_get_id(pdev->dev.of_node, "spi");
>>               if (ret < 0) {
>>                       dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
>>
>
> Your changes look good to me now.
>
> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Thanks for your review.
>
> Best regards,
> Javier



-- 
Shine bright,
(: Nav :)

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

* Re: [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
  2014-06-12 14:06     ` Javier Martinez Canillas
@ 2014-06-12 16:09       ` Naveen Krishna Ch
  -1 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Ch @ 2014-06-12 16:09 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Naveen Krishna Chatradhi, linux-arm-kernel, spi-devel-general,
	linux-samsung-soc, broonie, grant.likely, jaswinder.singh,
	Kukjin Kim, cpgs, devicetree, Doug Anderson, Tomasz Figa

Hello Javier,

On 12 June 2014 19:36, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> Hello Naveen,
>
> On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
>> Use controller_data structure only for the Non Device tree  platforms.
>> For Device tree platforms, always derive the chipselect info from
>> DT node.
>>
>> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Doug Anderson <dianders@chromium.org>
>> Cc: Tomasz Figa <t.figa@samsung.com>
>> ---
>>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>> index b888c66..f27e15d 100644
>> --- a/drivers/spi/spi-s3c64xx.c
>> +++ b/drivers/spi/spi-s3c64xx.c
>> @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>       int err;
>>
>>       sdd = spi_master_get_devdata(spi->master);
>> -     if (!cs && spi->dev.of_node) {
>> +     if (spi->dev.of_node) {
>>               cs = s3c64xx_get_slave_ctrldata(spi);
>>               spi->controller_data = cs;
>> -     }
>> -
>> -     /* For the non-DT platforms derive chip selects from controller data */
>> -     if (!spi->dev.of_node)
>> +     } else {
>> +             /* For the non-DT platforms derive chip
>> +              * selects from controller data
>> +              */
>>               spi->cs_gpio = cs->line;
>> +     }
>>
>>       if (IS_ERR_OR_NULL(cs)) {
>>               dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>>
>
> Personally I wouldn't have this change as a separate patch since it's too
> related to what you changed in Patch 1. But it's just a nitpick.

Patch 1/3 seems to be crowded with multiple changes.
Thought, this would keep the changes cleaner.

>
> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Thanks
>
> Best regards,
> Javier



-- 
Shine bright,
(: Nav :)

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

* [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
@ 2014-06-12 16:09       ` Naveen Krishna Ch
  0 siblings, 0 replies; 22+ messages in thread
From: Naveen Krishna Ch @ 2014-06-12 16:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Javier,

On 12 June 2014 19:36, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> Hello Naveen,
>
> On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
>> Use controller_data structure only for the Non Device tree  platforms.
>> For Device tree platforms, always derive the chipselect info from
>> DT node.
>>
>> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Doug Anderson <dianders@chromium.org>
>> Cc: Tomasz Figa <t.figa@samsung.com>
>> ---
>>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>> index b888c66..f27e15d 100644
>> --- a/drivers/spi/spi-s3c64xx.c
>> +++ b/drivers/spi/spi-s3c64xx.c
>> @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>       int err;
>>
>>       sdd = spi_master_get_devdata(spi->master);
>> -     if (!cs && spi->dev.of_node) {
>> +     if (spi->dev.of_node) {
>>               cs = s3c64xx_get_slave_ctrldata(spi);
>>               spi->controller_data = cs;
>> -     }
>> -
>> -     /* For the non-DT platforms derive chip selects from controller data */
>> -     if (!spi->dev.of_node)
>> +     } else {
>> +             /* For the non-DT platforms derive chip
>> +              * selects from controller data
>> +              */
>>               spi->cs_gpio = cs->line;
>> +     }
>>
>>       if (IS_ERR_OR_NULL(cs)) {
>>               dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>>
>
> Personally I wouldn't have this change as a separate patch since it's too
> related to what you changed in Patch 1. But it's just a nitpick.

Patch 1/3 seems to be crowded with multiple changes.
Thought, this would keep the changes cleaner.

>
> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Thanks
>
> Best regards,
> Javier



-- 
Shine bright,
(: Nav :)

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

* Re: [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
  2014-06-12 13:13   ` Naveen Krishna Chatradhi
@ 2014-06-12 23:14     ` Doug Anderson
  -1 siblings, 0 replies; 22+ messages in thread
From: Doug Anderson @ 2014-06-12 23:14 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi
  Cc: linux-arm-kernel, spi-devel-general, linux-samsung-soc,
	Naveen Krishna, broonie, Grant Likely, Jaswinder Singh,
	Kukjin Kim, cpgs .,
	devicetree, Javier Martinez Canillas, Tomasz Figa

Hi,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> This patch replaces the "cs-gpio" from "controller-data" node
> as was specified in the old binding and use the standard
> "cs-gpios" property expected by the SPI core as is defined in
> the new binding.
>
> Respective changes are preposed to spi-s3c64xx.c driver.
> @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  arch/arm/boot/dts/exynos4210-smdkv310.dts |    2 +-
>  arch/arm/boot/dts/exynos4412-trats2.dts   |    2 +-
>  arch/arm/boot/dts/exynos5250-smdk5250.dts |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

This looks fine, though I will note that you're not very consistent
with the ordering of "cs-gpios" and "status".

Reviewed-by: Doug Anderson <dianders@chromium.org>

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

* [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes
@ 2014-06-12 23:14     ` Doug Anderson
  0 siblings, 0 replies; 22+ messages in thread
From: Doug Anderson @ 2014-06-12 23:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> This patch replaces the "cs-gpio" from "controller-data" node
> as was specified in the old binding and use the standard
> "cs-gpios" property expected by the SPI core as is defined in
> the new binding.
>
> Respective changes are preposed to spi-s3c64xx.c driver.
> @ http://www.spinics.net/lists/linux-samsung-soc/msg32282.html
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  arch/arm/boot/dts/exynos4210-smdkv310.dts |    2 +-
>  arch/arm/boot/dts/exynos4412-trats2.dts   |    2 +-
>  arch/arm/boot/dts/exynos5250-smdk5250.dts |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

This looks fine, though I will note that you're not very consistent
with the ordering of "cs-gpios" and "status".

Reviewed-by: Doug Anderson <dianders@chromium.org>

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

* Re: [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
  2014-06-12 13:13 ` Naveen Krishna Chatradhi
@ 2014-06-12 23:25   ` Doug Anderson
  -1 siblings, 0 replies; 22+ messages in thread
From: Doug Anderson @ 2014-06-12 23:25 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi
  Cc: linux-arm-kernel, spi-devel-general, linux-samsung-soc,
	Naveen Krishna, broonie, Grant Likely, Jaswinder Singh,
	Kukjin Kim, cpgs .,
	devicetree, Javier Martinez Canillas, Tomasz Figa

Naveen,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)
>
> spi-s3c64xx.c driver expects
> 1. chip select gpios from "cs-gpio"(singular) under the
>    "controller-data" node of the client/slave device of the SPI.
>
> 2. "cs-gpio"(singular) entry to be present in the SPI device node.
>
> Eg of current broken usage:
> &spi_1 {
>         cs-gpio <>;     /* this entry is checked during probe */
>         ...
>         slave_node {
>                 controller-data {
>                         cs-gpio <&gpioa2 5 0>;
>                         /* This field is parsed during .setup() */
>                 }
>         };
> };
>
> The following dts files which were using this driver. But,
> din't have the "cs-gpio" entry under SPI node.
> -- arch/arm/boot/dts/exynos4210-smdkv310.dts
> -- arch/arm/boot/dts/exynos4412-trats2.dts
> -- arch/arm/boot/dts/exynos5250-smdk5250.dts
>
> Also, the SPI core and many drivers moved on to using "cs-gpios"
> from SPI node and removed the gpio handling code from drivers
> (including spi-s3c64xx.c).
>
> Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
> considering the time with no compliants about the breakage.
>
> We are assuming it is safe to remove the "cs-gpio"(singular) usage
> from device tree binding of spi-samsung.txt and makes appropriate
> changes in the driver to use "cs-gpios"(plural) from
> SPI device node.
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
>  drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
>  2 files changed, 20 insertions(+), 29 deletions(-)

I'm not planning to do an in-depth review of this patch since it seems
that others are on top of it, but I've tested it.  With it (and some
patches that haven't been sent up yet) I can talk to the EC on
exynos5420-pit.

Tested-by: Doug Anderson <dianders@chromium.org>

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

* [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
@ 2014-06-12 23:25   ` Doug Anderson
  0 siblings, 0 replies; 22+ messages in thread
From: Doug Anderson @ 2014-06-12 23:25 UTC (permalink / raw)
  To: linux-arm-kernel

Naveen,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> Since, (3146bee spi: s3c64xx: Added provision for dedicated cs pin)
>
> spi-s3c64xx.c driver expects
> 1. chip select gpios from "cs-gpio"(singular) under the
>    "controller-data" node of the client/slave device of the SPI.
>
> 2. "cs-gpio"(singular) entry to be present in the SPI device node.
>
> Eg of current broken usage:
> &spi_1 {
>         cs-gpio <>;     /* this entry is checked during probe */
>         ...
>         slave_node {
>                 controller-data {
>                         cs-gpio <&gpioa2 5 0>;
>                         /* This field is parsed during .setup() */
>                 }
>         };
> };
>
> The following dts files which were using this driver. But,
> din't have the "cs-gpio" entry under SPI node.
> -- arch/arm/boot/dts/exynos4210-smdkv310.dts
> -- arch/arm/boot/dts/exynos4412-trats2.dts
> -- arch/arm/boot/dts/exynos5250-smdk5250.dts
>
> Also, the SPI core and many drivers moved on to using "cs-gpios"
> from SPI node and removed the gpio handling code from drivers
> (including spi-s3c64xx.c).
>
> Hence, spi-s3c64xx.c is broken since "Jun 21 11:26:12 2013" and
> considering the time with no compliants about the breakage.
>
> We are assuming it is safe to remove the "cs-gpio"(singular) usage
> from device tree binding of spi-samsung.txt and makes appropriate
> changes in the driver to use "cs-gpios"(plural) from
> SPI device node.
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  .../devicetree/bindings/spi/spi-samsung.txt        |    8 ++--
>  drivers/spi/spi-s3c64xx.c                          |   41 ++++++++------------
>  2 files changed, 20 insertions(+), 29 deletions(-)

I'm not planning to do an in-depth review of this patch since it seems
that others are on top of it, but I've tested it.  With it (and some
patches that haven't been sent up yet) I can talk to the EC on
exynos5420-pit.

Tested-by: Doug Anderson <dianders@chromium.org>

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

* Re: [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
  2014-06-12 13:13   ` Naveen Krishna Chatradhi
@ 2014-06-12 23:26     ` Doug Anderson
  -1 siblings, 0 replies; 22+ messages in thread
From: Doug Anderson @ 2014-06-12 23:26 UTC (permalink / raw)
  To: Naveen Krishna Chatradhi
  Cc: linux-arm-kernel, spi-devel-general, linux-samsung-soc,
	Naveen Krishna, broonie, Grant Likely, Jaswinder Singh,
	Kukjin Kim, cpgs .,
	devicetree, Javier Martinez Canillas, Tomasz Figa

Naveen,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> Use controller_data structure only for the Non Device tree  platforms.
> For Device tree platforms, always derive the chipselect info from
> DT node.
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

I'm not planning to do an in-depth review of this patch since it seems
that others are on top of it, but I've tested it.  With it (and some
patches that haven't been sent up yet) I can talk to the EC on
exynos5420-pit (which uses device tree for specifying the cs-gpios)

Tested-by: Doug Anderson <dianders@chromium.org>

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

* [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node
@ 2014-06-12 23:26     ` Doug Anderson
  0 siblings, 0 replies; 22+ messages in thread
From: Doug Anderson @ 2014-06-12 23:26 UTC (permalink / raw)
  To: linux-arm-kernel

Naveen,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> Use controller_data structure only for the Non Device tree  platforms.
> For Device tree platforms, always derive the chipselect info from
> DT node.
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

I'm not planning to do an in-depth review of this patch since it seems
that others are on top of it, but I've tested it.  With it (and some
patches that haven't been sent up yet) I can talk to the EC on
exynos5420-pit (which uses device tree for specifying the cs-gpios)

Tested-by: Doug Anderson <dianders@chromium.org>

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

end of thread, other threads:[~2014-06-12 23:26 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 13:13 [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver Naveen Krishna Chatradhi
2014-06-12 13:13 ` Naveen Krishna Chatradhi
2014-06-12 13:13 ` [PATCH 2/3 v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node Naveen Krishna Chatradhi
2014-06-12 13:13   ` Naveen Krishna Chatradhi
2014-06-12 14:06   ` Javier Martinez Canillas
2014-06-12 14:06     ` Javier Martinez Canillas
2014-06-12 16:09     ` Naveen Krishna Ch
2014-06-12 16:09       ` Naveen Krishna Ch
2014-06-12 23:26   ` Doug Anderson
2014-06-12 23:26     ` Doug Anderson
2014-06-12 13:13 ` [PATCH 3/3 v4] ARM: DTS: fix the chip select gpios definition in the SPI nodes Naveen Krishna Chatradhi
2014-06-12 13:13   ` Naveen Krishna Chatradhi
2014-06-12 14:07   ` Javier Martinez Canillas
2014-06-12 14:07     ` Javier Martinez Canillas
2014-06-12 23:14   ` Doug Anderson
2014-06-12 23:14     ` Doug Anderson
     [not found] ` <1402578821-27338-1-git-send-email-ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-06-12 14:00   ` [PATCH 1/3 v4] spi: s3c64xx: fix broken "cs_gpios" usage in the driver Javier Martinez Canillas
2014-06-12 14:00     ` Javier Martinez Canillas
2014-06-12 16:06     ` Naveen Krishna Ch
2014-06-12 16:06       ` Naveen Krishna Ch
2014-06-12 23:25 ` Doug Anderson
2014-06-12 23:25   ` Doug Anderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.