linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] spi: rockchip: fix error handling when probe
@ 2017-06-13  5:25 Jeffy Chen
  2017-06-13  5:25 ` [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property Jeffy Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Jeffy Chen @ 2017-06-13  5:25 UTC (permalink / raw)
  To: linux-kernel, broonie
  Cc: briannorris, dianders, heiko, Jeffy Chen, linux-spi,
	linux-rockchip, linux-arm-kernel

After failed to request dma tx chain, we need to disable pm_runtime.
Also cleanup error labels for better readability.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

Changes in v2: None

 drivers/spi/spi-rockchip.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index acf31f3..bab9b13 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -684,33 +684,33 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 	rs->regs = devm_ioremap_resource(&pdev->dev, mem);
 	if (IS_ERR(rs->regs)) {
 		ret =  PTR_ERR(rs->regs);
-		goto err_ioremap_resource;
+		goto err_put_master;
 	}
 
 	rs->apb_pclk = devm_clk_get(&pdev->dev, "apb_pclk");
 	if (IS_ERR(rs->apb_pclk)) {
 		dev_err(&pdev->dev, "Failed to get apb_pclk\n");
 		ret = PTR_ERR(rs->apb_pclk);
-		goto err_ioremap_resource;
+		goto err_put_master;
 	}
 
 	rs->spiclk = devm_clk_get(&pdev->dev, "spiclk");
 	if (IS_ERR(rs->spiclk)) {
 		dev_err(&pdev->dev, "Failed to get spi_pclk\n");
 		ret = PTR_ERR(rs->spiclk);
-		goto err_ioremap_resource;
+		goto err_put_master;
 	}
 
 	ret = clk_prepare_enable(rs->apb_pclk);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to enable apb_pclk\n");
-		goto err_ioremap_resource;
+		goto err_put_master;
 	}
 
 	ret = clk_prepare_enable(rs->spiclk);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to enable spi_clk\n");
-		goto err_spiclk_enable;
+		goto err_disable_apbclk;
 	}
 
 	spi_enable_chip(rs, 0);
@@ -728,7 +728,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 	if (!rs->fifo_len) {
 		dev_err(&pdev->dev, "Failed to get fifo length\n");
 		ret = -EINVAL;
-		goto err_get_fifo_len;
+		goto err_disable_spiclk;
 	}
 
 	spin_lock_init(&rs->lock);
@@ -755,7 +755,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 		/* Check tx to see if we need defer probing driver */
 		if (PTR_ERR(rs->dma_tx.ch) == -EPROBE_DEFER) {
 			ret = -EPROBE_DEFER;
-			goto err_get_fifo_len;
+			goto err_disable_pm_runtime;
 		}
 		dev_warn(rs->dev, "Failed to request TX DMA channel\n");
 		rs->dma_tx.ch = NULL;
@@ -786,23 +786,24 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to register master\n");
-		goto err_register_master;
+		goto err_free_dma_rx;
 	}
 
 	return 0;
 
-err_register_master:
-	pm_runtime_disable(&pdev->dev);
+err_free_dma_rx:
 	if (rs->dma_rx.ch)
 		dma_release_channel(rs->dma_rx.ch);
 err_free_dma_tx:
 	if (rs->dma_tx.ch)
 		dma_release_channel(rs->dma_tx.ch);
-err_get_fifo_len:
+err_disable_pm_runtime:
+	pm_runtime_disable(&pdev->dev);
+err_disable_spiclk:
 	clk_disable_unprepare(rs->spiclk);
-err_spiclk_enable:
+err_disable_apbclk:
 	clk_disable_unprepare(rs->apb_pclk);
-err_ioremap_resource:
+err_put_master:
 	spi_master_put(master);
 
 	return ret;
-- 
2.1.4

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

* [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property
  2017-06-13  5:25 [PATCH v2 1/4] spi: rockchip: fix error handling when probe Jeffy Chen
@ 2017-06-13  5:25 ` Jeffy Chen
  2017-06-13 17:24   ` kbuild test robot
  2017-06-13 17:33   ` Brian Norris
  2017-06-13  5:25 ` [PATCH v2 3/4] dt-bindings: spi/rockchip: add "cs-gpios" optional property Jeffy Chen
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 16+ messages in thread
From: Jeffy Chen @ 2017-06-13  5:25 UTC (permalink / raw)
  To: linux-kernel, broonie
  Cc: briannorris, dianders, heiko, Jeffy Chen, linux-spi,
	linux-rockchip, linux-arm-kernel

Support using "cs-gpios" property to specify cs gpios.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
1/ request cs gpios in probe for better error handling
2/ use gpiod* function
(suggested by Heiko Stuebner)

3/ split dt-binding changes to new patch
(suggested by Shawn Lin & Heiko Stuebner)

---

Changes in v2: None

 drivers/spi/spi-rockchip.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index bab9b13..ad8997b 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -16,7 +16,7 @@
 #include <linux/clk.h>
 #include <linux/dmaengine.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
@@ -663,6 +663,27 @@ static bool rockchip_spi_can_dma(struct spi_master *master,
 	return (xfer->len > rs->fifo_len);
 }
 
+static int rockchip_spi_setup_cs_gpios(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct gpio_desc *cs_gpio;
+	int i, nb;
+
+	if (!np)
+		return 0;
+
+	nb = of_gpio_named_count(np, "cs-gpios");
+	for (i = 0; i < nb; i++) {
+		/* We support both GPIO CS and HW CS */
+		cs_gpio = devm_gpiod_get_index_optional(dev, "cs",
+							i, GPIOD_ASIS);
+		if (IS_ERR(cs_gpio))
+			return PTR_ERR(cs_gpio);
+	}
+
+	return 0;
+}
+
 static int rockchip_spi_probe(struct platform_device *pdev)
 {
 	int ret = 0;
@@ -749,6 +770,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 	master->transfer_one = rockchip_spi_transfer_one;
 	master->max_transfer_size = rockchip_spi_max_transfer_size;
 	master->handle_err = rockchip_spi_handle_err;
+	master->flags = SPI_MASTER_GPIO_SS;
 
 	rs->dma_tx.ch = dma_request_chan(rs->dev, "tx");
 	if (IS_ERR(rs->dma_tx.ch)) {
@@ -783,6 +805,12 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 		master->dma_rx = rs->dma_rx.ch;
 	}
 
+	ret = rockchip_spi_setup_cs_gpios(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to setup cs gpios\n");
+		goto err_free_dma_rx;
+	}
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to register master\n");
-- 
2.1.4

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

* [PATCH v2 3/4] dt-bindings: spi/rockchip: add "cs-gpios" optional property
  2017-06-13  5:25 [PATCH v2 1/4] spi: rockchip: fix error handling when probe Jeffy Chen
  2017-06-13  5:25 ` [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property Jeffy Chen
@ 2017-06-13  5:25 ` Jeffy Chen
  2017-06-13  5:25 ` [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi Jeffy Chen
  2017-06-13 17:29 ` [PATCH v2 1/4] spi: rockchip: fix error handling when probe Brian Norris
  3 siblings, 0 replies; 16+ messages in thread
From: Jeffy Chen @ 2017-06-13  5:25 UTC (permalink / raw)
  To: linux-kernel, broonie
  Cc: briannorris, dianders, heiko, Jeffy Chen, devicetree, linux-spi,
	linux-rockchip, Rob Herring, Mark Rutland, linux-arm-kernel

Update document devicetree bindings to support "cs-gpios" property.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

Changes in v2: None

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

diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
index 83da493..d0be2e6 100644
--- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt
+++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt
@@ -25,6 +25,7 @@ Required Properties:
 
 Optional Properties:
 
+- cs-gpios : Specifies the gpio pins to be used for chipselects.
 - dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
 		Documentation/devicetree/bindings/dma/dma.txt
 - dma-names: DMA request names should include "tx" and "rx" if present.
@@ -48,6 +49,7 @@ Example:
 		#address-cells = <1>;
 		#size-cells = <0>;
 		interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+		cs-gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
 		clocks = <&cru SCLK_SPI0>, <&cru PCLK_SPI0>;
 		clock-names = "spiclk", "apb_pclk";
 		pinctrl-0 = <&spi1_pins>;
-- 
2.1.4

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

* [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-13  5:25 [PATCH v2 1/4] spi: rockchip: fix error handling when probe Jeffy Chen
  2017-06-13  5:25 ` [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property Jeffy Chen
  2017-06-13  5:25 ` [PATCH v2 3/4] dt-bindings: spi/rockchip: add "cs-gpios" optional property Jeffy Chen
@ 2017-06-13  5:25 ` Jeffy Chen
  2017-06-13 17:50   ` Brian Norris
  2017-06-13 17:29 ` [PATCH v2 1/4] spi: rockchip: fix error handling when probe Brian Norris
  3 siblings, 1 reply; 16+ messages in thread
From: Jeffy Chen @ 2017-06-13  5:25 UTC (permalink / raw)
  To: linux-kernel, broonie
  Cc: briannorris, dianders, heiko, Jeffy Chen, devicetree,
	linux-rockchip, Rob Herring, linux-arm-kernel, Will Deacon,
	Mark Rutland, Catalin Marinas

The cros_ec requires CS line to be active after last message. But the CS
would be toggled when powering off/on rockchip spi, which breaks ec xfer.
Use GPIO CS to prevent that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

Changes in v2:
Fix wrong pinconf for spi5_cs0.

 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
index eb50593..b34a51d 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
@@ -790,6 +790,8 @@ ap_i2c_audio: &i2c8 {
 &spi5 {
 	status = "okay";
 
+	cs-gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
+
 	cros_ec: ec@0 {
 		compatible = "google,cros-ec-spi";
 		reg = <0>;
@@ -813,6 +815,10 @@ ap_i2c_audio: &i2c8 {
 	};
 };
 
+&spi5_cs0 {
+	rockchip,pins = <RK_GPIO2 23 RK_FUNC_GPIO &pcfg_output_high>;
+};
+
 &tsadc {
 	status = "okay";
 
-- 
2.1.4

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

* Re: [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property
  2017-06-13  5:25 ` [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property Jeffy Chen
@ 2017-06-13 17:24   ` kbuild test robot
  2017-06-13 17:33   ` Brian Norris
  1 sibling, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2017-06-13 17:24 UTC (permalink / raw)
  To: Jeffy Chen
  Cc: kbuild-all, linux-kernel, broonie, briannorris, dianders, heiko,
	Jeffy Chen, linux-spi, linux-rockchip, linux-arm-kernel

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

Hi Jeffy,

[auto build test ERROR on rockchip/for-next]
[also build test ERROR on v4.12-rc5 next-20170613]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jeffy-Chen/spi-rockchip-fix-error-handling-when-probe/20170613-172725
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: x86_64-randconfig-s5-06132355 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/spi/spi-rockchip.c: In function 'rockchip_spi_setup_cs_gpios':
>> drivers/spi/spi-rockchip.c:678:13: error: implicit declaration of function 'devm_gpiod_get_index_optional' [-Werror=implicit-function-declaration]
      cs_gpio = devm_gpiod_get_index_optional(dev, "cs",
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/spi/spi-rockchip.c:679:11: error: 'GPIOD_ASIS' undeclared (first use in this function)
           i, GPIOD_ASIS);
              ^~~~~~~~~~
   drivers/spi/spi-rockchip.c:679:11: note: each undeclared identifier is reported only once for each function it appears in
   cc1: some warnings being treated as errors

vim +/devm_gpiod_get_index_optional +678 drivers/spi/spi-rockchip.c

   672		if (!np)
   673			return 0;
   674	
   675		nb = of_gpio_named_count(np, "cs-gpios");
   676		for (i = 0; i < nb; i++) {
   677			/* We support both GPIO CS and HW CS */
 > 678			cs_gpio = devm_gpiod_get_index_optional(dev, "cs",
 > 679								i, GPIOD_ASIS);
   680			if (IS_ERR(cs_gpio))
   681				return PTR_ERR(cs_gpio);
   682		}

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21781 bytes --]

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

* Re: [PATCH v2 1/4] spi: rockchip: fix error handling when probe
  2017-06-13  5:25 [PATCH v2 1/4] spi: rockchip: fix error handling when probe Jeffy Chen
                   ` (2 preceding siblings ...)
  2017-06-13  5:25 ` [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi Jeffy Chen
@ 2017-06-13 17:29 ` Brian Norris
  3 siblings, 0 replies; 16+ messages in thread
From: Brian Norris @ 2017-06-13 17:29 UTC (permalink / raw)
  To: Jeffy Chen
  Cc: linux-kernel, broonie, dianders, heiko, linux-spi,
	linux-rockchip, linux-arm-kernel

On Tue, Jun 13, 2017 at 01:25:40PM +0800, Jeffy Chen wrote:
> After failed to request dma tx chain, we need to disable pm_runtime.
> Also cleanup error labels for better readability.
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
> 
> Changes in v2: None

Looks good to me. I guess the original code was sort of trying to do a
different style of error handling, where you name the labels after the
point where the failure comes from (i.e., if ioremap fails, you 'goto
ioremap_fail' or something like that). But since we have enough devm_*
usage here that doesn't need unwound explicitly, and we didn't add
extra labels for all them, then that "style" doesn't really make much
sense.

Reviewed-by: Brian Norris <briannorris@chromium.org>

>  drivers/spi/spi-rockchip.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
> index acf31f3..bab9b13 100644
> --- a/drivers/spi/spi-rockchip.c
> +++ b/drivers/spi/spi-rockchip.c
> @@ -684,33 +684,33 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  	rs->regs = devm_ioremap_resource(&pdev->dev, mem);
>  	if (IS_ERR(rs->regs)) {
>  		ret =  PTR_ERR(rs->regs);
> -		goto err_ioremap_resource;
> +		goto err_put_master;
>  	}
>  
>  	rs->apb_pclk = devm_clk_get(&pdev->dev, "apb_pclk");
>  	if (IS_ERR(rs->apb_pclk)) {
>  		dev_err(&pdev->dev, "Failed to get apb_pclk\n");
>  		ret = PTR_ERR(rs->apb_pclk);
> -		goto err_ioremap_resource;
> +		goto err_put_master;
>  	}
>  
>  	rs->spiclk = devm_clk_get(&pdev->dev, "spiclk");
>  	if (IS_ERR(rs->spiclk)) {
>  		dev_err(&pdev->dev, "Failed to get spi_pclk\n");
>  		ret = PTR_ERR(rs->spiclk);
> -		goto err_ioremap_resource;
> +		goto err_put_master;
>  	}
>  
>  	ret = clk_prepare_enable(rs->apb_pclk);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to enable apb_pclk\n");
> -		goto err_ioremap_resource;
> +		goto err_put_master;
>  	}
>  
>  	ret = clk_prepare_enable(rs->spiclk);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to enable spi_clk\n");
> -		goto err_spiclk_enable;
> +		goto err_disable_apbclk;
>  	}
>  
>  	spi_enable_chip(rs, 0);
> @@ -728,7 +728,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  	if (!rs->fifo_len) {
>  		dev_err(&pdev->dev, "Failed to get fifo length\n");
>  		ret = -EINVAL;
> -		goto err_get_fifo_len;
> +		goto err_disable_spiclk;
>  	}
>  
>  	spin_lock_init(&rs->lock);
> @@ -755,7 +755,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  		/* Check tx to see if we need defer probing driver */
>  		if (PTR_ERR(rs->dma_tx.ch) == -EPROBE_DEFER) {
>  			ret = -EPROBE_DEFER;
> -			goto err_get_fifo_len;
> +			goto err_disable_pm_runtime;
>  		}
>  		dev_warn(rs->dev, "Failed to request TX DMA channel\n");
>  		rs->dma_tx.ch = NULL;
> @@ -786,23 +786,24 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  	ret = devm_spi_register_master(&pdev->dev, master);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to register master\n");
> -		goto err_register_master;
> +		goto err_free_dma_rx;
>  	}
>  
>  	return 0;
>  
> -err_register_master:
> -	pm_runtime_disable(&pdev->dev);
> +err_free_dma_rx:
>  	if (rs->dma_rx.ch)
>  		dma_release_channel(rs->dma_rx.ch);
>  err_free_dma_tx:
>  	if (rs->dma_tx.ch)
>  		dma_release_channel(rs->dma_tx.ch);
> -err_get_fifo_len:
> +err_disable_pm_runtime:
> +	pm_runtime_disable(&pdev->dev);
> +err_disable_spiclk:
>  	clk_disable_unprepare(rs->spiclk);
> -err_spiclk_enable:
> +err_disable_apbclk:
>  	clk_disable_unprepare(rs->apb_pclk);
> -err_ioremap_resource:
> +err_put_master:
>  	spi_master_put(master);
>  
>  	return ret;
> -- 
> 2.1.4
> 
> 

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

* Re: [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property
  2017-06-13  5:25 ` [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property Jeffy Chen
  2017-06-13 17:24   ` kbuild test robot
@ 2017-06-13 17:33   ` Brian Norris
  2017-06-14  1:27     ` jeffy
  1 sibling, 1 reply; 16+ messages in thread
From: Brian Norris @ 2017-06-13 17:33 UTC (permalink / raw)
  To: Jeffy Chen
  Cc: linux-kernel, broonie, dianders, heiko, linux-spi,
	linux-rockchip, linux-arm-kernel

Hi Jeffy,

On Tue, Jun 13, 2017 at 01:25:41PM +0800, Jeffy Chen wrote:
> Support using "cs-gpios" property to specify cs gpios.
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> 1/ request cs gpios in probe for better error handling
> 2/ use gpiod* function
> (suggested by Heiko Stuebner)
> 
> 3/ split dt-binding changes to new patch
> (suggested by Shawn Lin & Heiko Stuebner)
> 
> ---
> 
> Changes in v2: None
> 
>  drivers/spi/spi-rockchip.c | 30 +++++++++++++++++++++++++++++-
>  1 file changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
> index bab9b13..ad8997b 100644
> --- a/drivers/spi/spi-rockchip.c
> +++ b/drivers/spi/spi-rockchip.c
> @@ -16,7 +16,7 @@
>  #include <linux/clk.h>
>  #include <linux/dmaengine.h>
>  #include <linux/module.h>
> -#include <linux/of.h>
> +#include <linux/of_gpio.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/platform_device.h>
>  #include <linux/spi/spi.h>
> @@ -663,6 +663,27 @@ static bool rockchip_spi_can_dma(struct spi_master *master,
>  	return (xfer->len > rs->fifo_len);
>  }
>  
> +static int rockchip_spi_setup_cs_gpios(struct device *dev)
> +{
> +	struct device_node *np = dev->of_node;
> +	struct gpio_desc *cs_gpio;
> +	int i, nb;
> +
> +	if (!np)
> +		return 0;
> +
> +	nb = of_gpio_named_count(np, "cs-gpios");
> +	for (i = 0; i < nb; i++) {
> +		/* We support both GPIO CS and HW CS */
> +		cs_gpio = devm_gpiod_get_index_optional(dev, "cs",
> +							i, GPIOD_ASIS);
> +		if (IS_ERR(cs_gpio))
> +			return PTR_ERR(cs_gpio);

I'm a bit confused why you need this function at all. You aren't using
the references that you're grabbing here, so essentially this is just
error-checking.

Are you doing anything here that isn't covered in
of_spi_register_master()?

> +	}
> +
> +	return 0;
> +}
> +
>  static int rockchip_spi_probe(struct platform_device *pdev)
>  {
>  	int ret = 0;
> @@ -749,6 +770,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  	master->transfer_one = rockchip_spi_transfer_one;
>  	master->max_transfer_size = rockchip_spi_max_transfer_size;
>  	master->handle_err = rockchip_spi_handle_err;
> +	master->flags = SPI_MASTER_GPIO_SS;

I'm curious, do you actually need to assert both the HW and GPIO CS?

Brian

>  
>  	rs->dma_tx.ch = dma_request_chan(rs->dev, "tx");
>  	if (IS_ERR(rs->dma_tx.ch)) {
> @@ -783,6 +805,12 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>  		master->dma_rx = rs->dma_rx.ch;
>  	}
>  
> +	ret = rockchip_spi_setup_cs_gpios(&pdev->dev);
> +	if (ret) {
> +		dev_err(&pdev->dev, "Failed to setup cs gpios\n");
> +		goto err_free_dma_rx;
> +	}
> +
>  	ret = devm_spi_register_master(&pdev->dev, master);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to register master\n");
> -- 
> 2.1.4
> 
> 

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-13  5:25 ` [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi Jeffy Chen
@ 2017-06-13 17:50   ` Brian Norris
  2017-06-13 18:22     ` Mark Brown
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Norris @ 2017-06-13 17:50 UTC (permalink / raw)
  To: Jeffy Chen, Mark Brown
  Cc: linux-kernel, dianders, heiko, devicetree, linux-rockchip,
	Rob Herring, linux-arm-kernel, Will Deacon, Mark Rutland,
	Catalin Marinas

On Tue, Jun 13, 2017 at 01:25:43PM +0800, Jeffy Chen wrote:
> The cros_ec requires CS line to be active after last message. But the CS
> would be toggled when powering off/on rockchip spi, which breaks ec xfer.
> Use GPIO CS to prevent that.

I suppose this change is fine. (At least, I don't have a good reason not
to do this.)

But I still wonder whether this is something that the SPI core can be
expected to handle. drivers/mfd/cros_ec_spi.c already sets the
appropriate trans->cs_change bits, to ensure CS remains active in
between certain messages (all under spi_bus_lock()). But you're
suggesting that your bus controller may deassert CS if you runtime
suspend the device (e.g., in between messages).

So, is your controller just peculiar? Or should the SPI core avoid
autosuspending the bus controller when it's been instructed to keep CS
active? Any thoughts Mark?

> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
> 
> Changes in v2:
> Fix wrong pinconf for spi5_cs0.
> 
>  arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
> index eb50593..b34a51d 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
> @@ -790,6 +790,8 @@ ap_i2c_audio: &i2c8 {
>  &spi5 {
>  	status = "okay";
>  
> +	cs-gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;

This isn't actually true; it's not active high, it's active low. I guess it
doesn't really matter because the SPI framework uses the gpio_* APIs, which
don't account for the ACTIVE_* flags, and it has separate flags for uncommon
device polarity ("spi-cs-high").

Brian

> +
>  	cros_ec: ec@0 {
>  		compatible = "google,cros-ec-spi";
>  		reg = <0>;
> @@ -813,6 +815,10 @@ ap_i2c_audio: &i2c8 {
>  	};
>  };
>  
> +&spi5_cs0 {
> +	rockchip,pins = <RK_GPIO2 23 RK_FUNC_GPIO &pcfg_output_high>;
> +};
> +
>  &tsadc {
>  	status = "okay";
>  
> -- 
> 2.1.4
> 
> 

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-13 17:50   ` Brian Norris
@ 2017-06-13 18:22     ` Mark Brown
  2017-06-20  0:47       ` Brian Norris
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Brown @ 2017-06-13 18:22 UTC (permalink / raw)
  To: Brian Norris
  Cc: Jeffy Chen, linux-kernel, dianders, heiko, devicetree,
	linux-rockchip, Rob Herring, linux-arm-kernel, Will Deacon,
	Mark Rutland, Catalin Marinas

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

On Tue, Jun 13, 2017 at 10:50:44AM -0700, Brian Norris wrote:
> On Tue, Jun 13, 2017 at 01:25:43PM +0800, Jeffy Chen wrote:
> > The cros_ec requires CS line to be active after last message. But the CS
> > would be toggled when powering off/on rockchip spi, which breaks ec xfer.
> > Use GPIO CS to prevent that.

> I suppose this change is fine. (At least, I don't have a good reason not
> to do this.)

> But I still wonder whether this is something that the SPI core can be
> expected to handle. drivers/mfd/cros_ec_spi.c already sets the
> appropriate trans->cs_change bits, to ensure CS remains active in
> between certain messages (all under spi_bus_lock()). But you're
> suggesting that your bus controller may deassert CS if you runtime
> suspend the device (e.g., in between messages).

> So, is your controller just peculiar? Or should the SPI core avoid
> autosuspending the bus controller when it's been instructed to keep CS
> active? Any thoughts Mark?

This sounds like the controller being unusual - though frankly the
ChromeOS chip select usage is also odd so it's fairly rare for something
like this to come up.  I'd not expect a runtime suspend to loose the pin
state, though possibly through use of pinctrl rather than the
controller.

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

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

* Re: [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property
  2017-06-13 17:33   ` Brian Norris
@ 2017-06-14  1:27     ` jeffy
  0 siblings, 0 replies; 16+ messages in thread
From: jeffy @ 2017-06-14  1:27 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-kernel, broonie, dianders, heiko, linux-spi,
	linux-rockchip, linux-arm-kernel

Hi Brian,

Thanx for your comments :)

On 06/14/2017 01:33 AM, Brian Norris wrote:
> Hi Jeffy,
>
> On Tue, Jun 13, 2017 at 01:25:41PM +0800, Jeffy Chen wrote:
>> Support using "cs-gpios" property to specify cs gpios.
>>
>> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>> 1/ request cs gpios in probe for better error handling
>> 2/ use gpiod* function
>> (suggested by Heiko Stuebner)
>>
>> 3/ split dt-binding changes to new patch
>> (suggested by Shawn Lin & Heiko Stuebner)
>>
>> ---
>>
>> Changes in v2: None
>>
>>   drivers/spi/spi-rockchip.c | 30 +++++++++++++++++++++++++++++-
>>   1 file changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
>> index bab9b13..ad8997b 100644
>> --- a/drivers/spi/spi-rockchip.c
>> +++ b/drivers/spi/spi-rockchip.c
>> @@ -16,7 +16,7 @@
>>   #include <linux/clk.h>
>>   #include <linux/dmaengine.h>
>>   #include <linux/module.h>
>> -#include <linux/of.h>
>> +#include <linux/of_gpio.h>
>>   #include <linux/pinctrl/consumer.h>
>>   #include <linux/platform_device.h>
>>   #include <linux/spi/spi.h>
>> @@ -663,6 +663,27 @@ static bool rockchip_spi_can_dma(struct spi_master *master,
>>   	return (xfer->len > rs->fifo_len);
>>   }
>>
>> +static int rockchip_spi_setup_cs_gpios(struct device *dev)
>> +{
>> +	struct device_node *np = dev->of_node;
>> +	struct gpio_desc *cs_gpio;
>> +	int i, nb;
>> +
>> +	if (!np)
>> +		return 0;
>> +
>> +	nb = of_gpio_named_count(np, "cs-gpios");
>> +	for (i = 0; i < nb; i++) {
>> +		/* We support both GPIO CS and HW CS */
>> +		cs_gpio = devm_gpiod_get_index_optional(dev, "cs",
>> +							i, GPIOD_ASIS);
>> +		if (IS_ERR(cs_gpio))
>> +			return PTR_ERR(cs_gpio);
>
> I'm a bit confused why you need this function at all. You aren't using
> the references that you're grabbing here, so essentially this is just
> error-checking.

actually this is error-checking plus gpiod_request(see gpiod_get_index 
in gpiolib.c)
>
> Are you doing anything here that isn't covered in
> of_spi_register_master()?

expect for gpiod_request, another difference would be
when the of_spi_register_master calls of_get_named_gpio to parse 
cs-gpios, it would not do error handling here(fallback to HW CS):

         for (i = 0; i < nb; i++)
                 cs[i] = of_get_named_gpio(np, "cs-gpios", i);

but in our case, if something wrong happens(except for ENOENT), we 
cannot fallback to HW CS, because we already let pinctrl config GPIO CS.

>
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>>   static int rockchip_spi_probe(struct platform_device *pdev)
>>   {
>>   	int ret = 0;
>> @@ -749,6 +770,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>>   	master->transfer_one = rockchip_spi_transfer_one;
>>   	master->max_transfer_size = rockchip_spi_max_transfer_size;
>>   	master->handle_err = rockchip_spi_handle_err;
>> +	master->flags = SPI_MASTER_GPIO_SS;
>
> I'm curious, do you actually need to assert both the HW and GPIO CS?

yes, it would hang if we do spi xfer with wrong HW CS register 
config(seems to be another controller limit)...

>
> Brian
>
>>
>>   	rs->dma_tx.ch = dma_request_chan(rs->dev, "tx");
>>   	if (IS_ERR(rs->dma_tx.ch)) {
>> @@ -783,6 +805,12 @@ static int rockchip_spi_probe(struct platform_device *pdev)
>>   		master->dma_rx = rs->dma_rx.ch;
>>   	}
>>
>> +	ret = rockchip_spi_setup_cs_gpios(&pdev->dev);
>> +	if (ret) {
>> +		dev_err(&pdev->dev, "Failed to setup cs gpios\n");
>> +		goto err_free_dma_rx;
>> +	}
>> +
>>   	ret = devm_spi_register_master(&pdev->dev, master);
>>   	if (ret) {
>>   		dev_err(&pdev->dev, "Failed to register master\n");
>> --
>> 2.1.4
>>
>>
>
>
>

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-13 18:22     ` Mark Brown
@ 2017-06-20  0:47       ` Brian Norris
  2017-06-22 22:47         ` Doug Anderson
  0 siblings, 1 reply; 16+ messages in thread
From: Brian Norris @ 2017-06-20  0:47 UTC (permalink / raw)
  To: Mark Brown
  Cc: Jeffy Chen, linux-kernel, dianders, heiko, devicetree,
	linux-rockchip, Rob Herring, linux-arm-kernel, Will Deacon,
	Mark Rutland, Catalin Marinas

Hi Mark,

Forgot to follow up here:

On Tue, Jun 13, 2017 at 07:22:25PM +0100, Mark Brown wrote:
> On Tue, Jun 13, 2017 at 10:50:44AM -0700, Brian Norris wrote:
> > On Tue, Jun 13, 2017 at 01:25:43PM +0800, Jeffy Chen wrote:
> > > The cros_ec requires CS line to be active after last message. But the CS
> > > would be toggled when powering off/on rockchip spi, which breaks ec xfer.
> > > Use GPIO CS to prevent that.
> 
> > I suppose this change is fine. (At least, I don't have a good reason not
> > to do this.)
> 
> > But I still wonder whether this is something that the SPI core can be
> > expected to handle. drivers/mfd/cros_ec_spi.c already sets the
> > appropriate trans->cs_change bits, to ensure CS remains active in
> > between certain messages (all under spi_bus_lock()). But you're
> > suggesting that your bus controller may deassert CS if you runtime
> > suspend the device (e.g., in between messages).
> 
> > So, is your controller just peculiar? Or should the SPI core avoid
> > autosuspending the bus controller when it's been instructed to keep CS
> > active? Any thoughts Mark?
> 
> This sounds like the controller being unusual - though frankly the
> ChromeOS chip select usage is also odd so it's fairly rare for something
> like this to come up.  I'd not expect a runtime suspend to loose the pin
> state, though possibly through use of pinctrl rather than the
> controller.

I haven't personally verified this behavior (it probably wouldn't be too
hard to rig up a test driver to hold CS low while allowing the
controller to autosuspend? spidev can do this?), but Rockchip folks seem
to have concluded this.

I suppose I'm fine with relying on cs-gpios as a workaround.

Brian

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-20  0:47       ` Brian Norris
@ 2017-06-22 22:47         ` Doug Anderson
  2017-06-23  3:51           ` jeffy
  0 siblings, 1 reply; 16+ messages in thread
From: Doug Anderson @ 2017-06-22 22:47 UTC (permalink / raw)
  To: Brian Norris
  Cc: Mark Brown, Jeffy Chen, linux-kernel, Heiko Stübner,
	devicetree, open list:ARM/Rockchip SoC...,
	Rob Herring, linux-arm-kernel, Will Deacon, Mark Rutland,
	Catalin Marinas

Hi,

On Mon, Jun 19, 2017 at 5:47 PM, Brian Norris <briannorris@chromium.org> wrote:
> Hi Mark,
>
> Forgot to follow up here:
>
> On Tue, Jun 13, 2017 at 07:22:25PM +0100, Mark Brown wrote:
>> On Tue, Jun 13, 2017 at 10:50:44AM -0700, Brian Norris wrote:
>> > On Tue, Jun 13, 2017 at 01:25:43PM +0800, Jeffy Chen wrote:
>> > > The cros_ec requires CS line to be active after last message. But the CS
>> > > would be toggled when powering off/on rockchip spi, which breaks ec xfer.
>> > > Use GPIO CS to prevent that.
>>
>> > I suppose this change is fine. (At least, I don't have a good reason not
>> > to do this.)
>>
>> > But I still wonder whether this is something that the SPI core can be
>> > expected to handle. drivers/mfd/cros_ec_spi.c already sets the
>> > appropriate trans->cs_change bits, to ensure CS remains active in
>> > between certain messages (all under spi_bus_lock()). But you're
>> > suggesting that your bus controller may deassert CS if you runtime
>> > suspend the device (e.g., in between messages).
>>
>> > So, is your controller just peculiar? Or should the SPI core avoid
>> > autosuspending the bus controller when it's been instructed to keep CS
>> > active? Any thoughts Mark?
>>
>> This sounds like the controller being unusual - though frankly the
>> ChromeOS chip select usage is also odd so it's fairly rare for something
>> like this to come up.  I'd not expect a runtime suspend to loose the pin
>> state, though possibly through use of pinctrl rather than the
>> controller.
>
> I haven't personally verified this behavior (it probably wouldn't be too
> hard to rig up a test driver to hold CS low while allowing the
> controller to autosuspend? spidev can do this?), but Rockchip folks seem
> to have concluded this.
>
> I suppose I'm fine with relying on cs-gpios as a workaround.

I'm similarly hesitant to rely on cs-gpios as a workaround, though I
won't directly stand in its way...  ...it seems like it would be
slightly better to actually add a runtime_suspend() callback and
adjust the pinmux dynamically (that would allow us to use the hardware
chip select control if we ever enable that in the driver), but I'm not
sure all the extra work to do that is worth it.

It feels a little bit to me like the workaround here doesn't belong in
the board's device tree file, though.  This is a quirk of the SoC's
SPI controller whenever it's runtime suspended.  Any board using this
SPI could possibly be affected, right?


Oh wait (!!!!)


Let's think about this.  Let me ask a question.  When you runtime
suspend the SPI part (and turn off the power domain) but don't
configure pins to be GPIO, what happens?  I'm assuming it's one of
three things:

1. The line is driven a certain direction (probably low).  This seems unlikely.

2. The line is no longer driven by the SPI controller and thus the
pin's pulls take effect.  This seems _likely_.

3. The line is no longer driven by the SPI controller and somehow the
pulls stop taking effect.  This seems unlikely.


...I'll assume that #2 is right (please correct if I'm wrong).
Thinking about that makes me think that we need to worry not just
about the chip select line but about the other SPI lines too, right?
AKA if the SPI controller stops driving the chip select line, it's
probably also not driving MISO, MOSI, or TXD.

...so looking at all the SPI lines, they all have pullup configured in
the "default" mode in rk3399.dtsi.

...and looking as "cros_ec_spi.c", I see that we appear to be using MODE_0.


That means if you runtime suspend while the cros EC code was running
and none of your patches have landed, all lines will float high.

1. Chip select will be deasserted (this is the problem you're trying to solve).

2. Data line and clock line will get pulled high.

Using spi.h, MODE_0 means SPI_CPOL=0 and SPI_CPHA=0.  Using Wikipedia
(which is never wrong, of course), that means data is captured on the
clock's rising edge.  Thus we'll actually clock one bit of data here,
but at the same time that we try to turn off chip select.


...now we look at your proposed solution and we'll leave chip select
on, but we'll still clock one bit of data (oops).  ...or, I guess, if
the EC itself has pulls configured we might be in some state where the
different pulls are fighting, but that still seems non-ideal.

---

So how do we fix this?  IMHO:

Add 4 new pinctrl states in rk3399.dtsi:

  cs_low_clk_low, cs_low_clk_high, cs_high_clk_low, cs_high_clk_high

These would each look something like this:

spi5_cs_low_data_low: spi5-cs-low-data-low {
  rockchip,pins = <2 22 RK_FUNC_0 &pcfg_output_low>,
    <2 23 RK_FUNC_0 &pcfg_output_low>;
};

Where "pcfg_output_low" would be moved from the existing location in
"rk3399-gru.dtsi" to the main "rk3399.dtsi" file.


...now, you'd define runtime_suspend and runtime_resume functions
where you'd look at the current state of the chip select and output
and select one of these 4 pinmuxes so that things _don't_ change.

If the pinmuxes didn't exist you'd simply deny PM Runtime Transitions.
That would nicely take care of the backward compatibility problem.
Old DTS files would work, they just wouldn't be able to Runtime PM
properly.

---

Anyway, maybe that's all crazy.  What do others think?


-Doug

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-22 22:47         ` Doug Anderson
@ 2017-06-23  3:51           ` jeffy
  2017-06-23  4:26             ` Doug Anderson
  0 siblings, 1 reply; 16+ messages in thread
From: jeffy @ 2017-06-23  3:51 UTC (permalink / raw)
  To: Doug Anderson, Brian Norris
  Cc: Mark Brown, linux-kernel, Heiko Stübner, devicetree,
	open list:ARM/Rockchip SoC...,
	Rob Herring, linux-arm-kernel, Will Deacon, Mark Rutland,
	Catalin Marinas

Hi doug,

Thanx for your comments.

On 06/23/2017 06:47 AM, Doug Anderson wrote:
> Hi,
>
> On Mon, Jun 19, 2017 at 5:47 PM, Brian Norris <briannorris@chromium.org> wrote:
>> Hi Mark,
>>
>> Forgot to follow up here:
>>
>> On Tue, Jun 13, 2017 at 07:22:25PM +0100, Mark Brown wrote:
>>> On Tue, Jun 13, 2017 at 10:50:44AM -0700, Brian Norris wrote:
>>>> On Tue, Jun 13, 2017 at 01:25:43PM +0800, Jeffy Chen wrote:
>>>>> The cros_ec requires CS line to be active after last message. But the CS
>>>>> would be toggled when powering off/on rockchip spi, which breaks ec xfer.
>>>>> Use GPIO CS to prevent that.
>>>
>>>> I suppose this change is fine. (At least, I don't have a good reason not
>>>> to do this.)
>>>
>>>> But I still wonder whether this is something that the SPI core can be
>>>> expected to handle. drivers/mfd/cros_ec_spi.c already sets the
>>>> appropriate trans->cs_change bits, to ensure CS remains active in
>>>> between certain messages (all under spi_bus_lock()). But you're
>>>> suggesting that your bus controller may deassert CS if you runtime
>>>> suspend the device (e.g., in between messages).
>>>
>>>> So, is your controller just peculiar? Or should the SPI core avoid
>>>> autosuspending the bus controller when it's been instructed to keep CS
>>>> active? Any thoughts Mark?
>>>
>>> This sounds like the controller being unusual - though frankly the
>>> ChromeOS chip select usage is also odd so it's fairly rare for something
>>> like this to come up.  I'd not expect a runtime suspend to loose the pin
>>> state, though possibly through use of pinctrl rather than the
>>> controller.
>>
>> I haven't personally verified this behavior (it probably wouldn't be too
>> hard to rig up a test driver to hold CS low while allowing the
>> controller to autosuspend? spidev can do this?), but Rockchip folks seem
>> to have concluded this.
>>
>> I suppose I'm fine with relying on cs-gpios as a workaround.
>
> I'm similarly hesitant to rely on cs-gpios as a workaround, though I
> won't directly stand in its way...  ...it seems like it would be
> slightly better to actually add a runtime_suspend() callback and
> adjust the pinmux dynamically (that would allow us to use the hardware
> chip select control if we ever enable that in the driver), but I'm not
> sure all the extra work to do that is worth it.
>
> It feels a little bit to me like the workaround here doesn't belong in
> the board's device tree file, though.  This is a quirk of the SoC's
> SPI controller whenever it's runtime suspended.  Any board using this
> SPI could possibly be affected, right?
hmm, so i should add cs_gpio to all rockchip boards right?
>
>
> Oh wait (!!!!)
>
>
> Let's think about this.  Let me ask a question.  When you runtime
> suspend the SPI part (and turn off the power domain) but don't
> configure pins to be GPIO, what happens?  I'm assuming it's one of
> three things:
>
> 1. The line is driven a certain direction (probably low).  This seems unlikely.
>
> 2. The line is no longer driven by the SPI controller and thus the
> pin's pulls take effect.  This seems _likely_.
>
> 3. The line is no longer driven by the SPI controller and somehow the
> pulls stop taking effect.  This seems unlikely.
>
>
> ...I'll assume that #2 is right (please correct if I'm wrong).
> Thinking about that makes me think that we need to worry not just
> about the chip select line but about the other SPI lines too, right?
> AKA if the SPI controller stops driving the chip select line, it's
> probably also not driving MISO, MOSI, or TXD.
>
> ...so looking at all the SPI lines, they all have pullup configured in
> the "default" mode in rk3399.dtsi.
>
> ...and looking as "cros_ec_spi.c", I see that we appear to be using MODE_0.
>
>
> That means if you runtime suspend while the cros EC code was running
> and none of your patches have landed, all lines will float high.
>
> 1. Chip select will be deasserted (this is the problem you're trying to solve).
>
> 2. Data line and clock line will get pulled high.
>
> Using spi.h, MODE_0 means SPI_CPOL=0 and SPI_CPHA=0.  Using Wikipedia
> (which is never wrong, of course), that means data is captured on the
> clock's rising edge.  Thus we'll actually clock one bit of data here,
> but at the same time that we try to turn off chip select.
>
>
> ...now we look at your proposed solution and we'll leave chip select
> on, but we'll still clock one bit of data (oops).  ...or, I guess, if
> the EC itself has pulls configured we might be in some state where the
> different pulls are fighting, but that still seems non-ideal.
>
> ---
>
> So how do we fix this?  IMHO:
>
> Add 4 new pinctrl states in rk3399.dtsi:
>
>    cs_low_clk_low, cs_low_clk_high, cs_high_clk_low, cs_high_clk_high
>
> These would each look something like this:
>
> spi5_cs_low_data_low: spi5-cs-low-data-low {
>    rockchip,pins = <2 22 RK_FUNC_0 &pcfg_output_low>,
>      <2 23 RK_FUNC_0 &pcfg_output_low>;
> };
>
> Where "pcfg_output_low" would be moved from the existing location in
> "rk3399-gru.dtsi" to the main "rk3399.dtsi" file.
>
>
> ...now, you'd define runtime_suspend and runtime_resume functions
> where you'd look at the current state of the chip select and output
> and select one of these 4 pinmuxes so that things _don't_ change.
>
> If the pinmuxes didn't exist you'd simply deny PM Runtime Transitions.
> That would nicely take care of the backward compatibility problem.
> Old DTS files would work, they just wouldn't be able to Runtime PM
> properly.
so we should use runtime pinmuxes to fix this issue, and also support 
cs_gpio as an option right?
>
> ---
>
> Anyway, maybe that's all crazy.  What do others think?
>
>
> -Doug
>
>
>

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
  2017-06-23  3:51           ` jeffy
@ 2017-06-23  4:26             ` Doug Anderson
       [not found]               ` <594D0723.7010108@rock-chips.com>
  0 siblings, 1 reply; 16+ messages in thread
From: Doug Anderson @ 2017-06-23  4:26 UTC (permalink / raw)
  To: jeffy
  Cc: Brian Norris, Mark Brown, linux-kernel, Heiko Stübner,
	devicetree, open list:ARM/Rockchip SoC...,
	Rob Herring, linux-arm-kernel, Will Deacon, Mark Rutland,
	Catalin Marinas

Hi,

On Thu, Jun 22, 2017 at 8:51 PM, jeffy <jeffy.chen@rock-chips.com> wrote:
> Hi doug,
>
> Thanx for your comments.
>
>
> On 06/23/2017 06:47 AM, Doug Anderson wrote:
>>
>> Hi,
>>
>> On Mon, Jun 19, 2017 at 5:47 PM, Brian Norris <briannorris@chromium.org>
>> wrote:
>>>
>>> Hi Mark,
>>>
>>> Forgot to follow up here:
>>>
>>> On Tue, Jun 13, 2017 at 07:22:25PM +0100, Mark Brown wrote:
>>>>
>>>> On Tue, Jun 13, 2017 at 10:50:44AM -0700, Brian Norris wrote:
>>>>>
>>>>> On Tue, Jun 13, 2017 at 01:25:43PM +0800, Jeffy Chen wrote:
>>>>>>
>>>>>> The cros_ec requires CS line to be active after last message. But the
>>>>>> CS
>>>>>> would be toggled when powering off/on rockchip spi, which breaks ec
>>>>>> xfer.
>>>>>> Use GPIO CS to prevent that.
>>>>
>>>>
>>>>> I suppose this change is fine. (At least, I don't have a good reason
>>>>> not
>>>>> to do this.)
>>>>
>>>>
>>>>> But I still wonder whether this is something that the SPI core can be
>>>>> expected to handle. drivers/mfd/cros_ec_spi.c already sets the
>>>>> appropriate trans->cs_change bits, to ensure CS remains active in
>>>>> between certain messages (all under spi_bus_lock()). But you're
>>>>> suggesting that your bus controller may deassert CS if you runtime
>>>>> suspend the device (e.g., in between messages).
>>>>
>>>>
>>>>> So, is your controller just peculiar? Or should the SPI core avoid
>>>>> autosuspending the bus controller when it's been instructed to keep CS
>>>>> active? Any thoughts Mark?
>>>>
>>>>
>>>> This sounds like the controller being unusual - though frankly the
>>>> ChromeOS chip select usage is also odd so it's fairly rare for something
>>>> like this to come up.  I'd not expect a runtime suspend to loose the pin
>>>> state, though possibly through use of pinctrl rather than the
>>>> controller.
>>>
>>>
>>> I haven't personally verified this behavior (it probably wouldn't be too
>>> hard to rig up a test driver to hold CS low while allowing the
>>> controller to autosuspend? spidev can do this?), but Rockchip folks seem
>>> to have concluded this.
>>>
>>> I suppose I'm fine with relying on cs-gpios as a workaround.
>>
>>
>> I'm similarly hesitant to rely on cs-gpios as a workaround, though I
>> won't directly stand in its way...  ...it seems like it would be
>> slightly better to actually add a runtime_suspend() callback and
>> adjust the pinmux dynamically (that would allow us to use the hardware
>> chip select control if we ever enable that in the driver), but I'm not
>> sure all the extra work to do that is worth it.
>>
>> It feels a little bit to me like the workaround here doesn't belong in
>> the board's device tree file, though.  This is a quirk of the SoC's
>> SPI controller whenever it's runtime suspended.  Any board using this
>> SPI could possibly be affected, right?
>
> hmm, so i should add cs_gpio to all rockchip boards right?

I think with the pinmux change I suggested below (which would be in
rk3399.dtsi) you wouldn't need the cs-gpios workaround anywhere.  If
someone _wanted_ to get cs-gpios to get more than one chip select or
to use a different GPIO as a chip select, they could.  ...but there
would be no need to use cs-gpios as a workaround.


>> Oh wait (!!!!)
>>
>>
>> Let's think about this.  Let me ask a question.  When you runtime
>> suspend the SPI part (and turn off the power domain) but don't
>> configure pins to be GPIO, what happens?  I'm assuming it's one of
>> three things:
>>
>> 1. The line is driven a certain direction (probably low).  This seems
>> unlikely.
>>
>> 2. The line is no longer driven by the SPI controller and thus the
>> pin's pulls take effect.  This seems _likely_.
>>
>> 3. The line is no longer driven by the SPI controller and somehow the
>> pulls stop taking effect.  This seems unlikely.
>>
>>
>> ...I'll assume that #2 is right (please correct if I'm wrong).
>> Thinking about that makes me think that we need to worry not just
>> about the chip select line but about the other SPI lines too, right?
>> AKA if the SPI controller stops driving the chip select line, it's
>> probably also not driving MISO, MOSI, or TXD.
>>
>> ...so looking at all the SPI lines, they all have pullup configured in
>> the "default" mode in rk3399.dtsi.
>>
>> ...and looking as "cros_ec_spi.c", I see that we appear to be using
>> MODE_0.
>>
>>
>> That means if you runtime suspend while the cros EC code was running
>> and none of your patches have landed, all lines will float high.
>>
>> 1. Chip select will be deasserted (this is the problem you're trying to
>> solve).
>>
>> 2. Data line and clock line will get pulled high.
>>
>> Using spi.h, MODE_0 means SPI_CPOL=0 and SPI_CPHA=0.  Using Wikipedia
>> (which is never wrong, of course), that means data is captured on the
>> clock's rising edge.  Thus we'll actually clock one bit of data here,
>> but at the same time that we try to turn off chip select.
>>
>>
>> ...now we look at your proposed solution and we'll leave chip select
>> on, but we'll still clock one bit of data (oops).  ...or, I guess, if
>> the EC itself has pulls configured we might be in some state where the
>> different pulls are fighting, but that still seems non-ideal.
>>
>> ---
>>
>> So how do we fix this?  IMHO:
>>
>> Add 4 new pinctrl states in rk3399.dtsi:
>>
>>    cs_low_clk_low, cs_low_clk_high, cs_high_clk_low, cs_high_clk_high
>>
>> These would each look something like this:
>>
>> spi5_cs_low_data_low: spi5-cs-low-data-low {
>>    rockchip,pins = <2 22 RK_FUNC_0 &pcfg_output_low>,
>>      <2 23 RK_FUNC_0 &pcfg_output_low>;
>> };
>>
>> Where "pcfg_output_low" would be moved from the existing location in
>> "rk3399-gru.dtsi" to the main "rk3399.dtsi" file.
>>
>>
>> ...now, you'd define runtime_suspend and runtime_resume functions
>> where you'd look at the current state of the chip select and output
>> and select one of these 4 pinmuxes so that things _don't_ change.
>>
>> If the pinmuxes didn't exist you'd simply deny PM Runtime Transitions.
>> That would nicely take care of the backward compatibility problem.
>> Old DTS files would work, they just wouldn't be able to Runtime PM
>> properly.
>
> so we should use runtime pinmuxes to fix this issue, and also support
> cs_gpio as an option right?

Right.  So in my opinion:

* Your patch to add "SPI_MASTER_GPIO_SS" would be fine to post and
land, but it wouldn't be needed for the runtime PM issue.  Thinking
about this and the GPIO chip selects, I wonder if the whole
SPI_MASTER_GPIO_SS concept is broken if you use one "GPIO" based chip
select and one native chip select.  I can try looking through the code
tomorrow if you're going to pursue this and haven't figured it out...

* If you want to improve the way that the SPI framework handles GPIO
chip selects (to handle errors better and request the GPIO better),
that would be fine.  ...but it also wouldn't be needed for the runtime
PM issue.

* There should be no need to add cs-gpios to existing boards if you're
using the pinmux solution.

* You'd want to add the pinmux configs to the main rk3399.dtsi file
and then add code to the rockchip SPI driver to select the right
pinmux (depending on the current state of the chip select and the
current polarity) at runtime suspend.  ...then go back to "default"
mode at runtime resume.


-Doug

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
       [not found]                 ` <CAD=FV=XjW4a9mqH0UtUAmHkj-aAO75bpSXuyy__jBB7YC8PBVg@mail.gmail.com>
@ 2017-06-26  3:26                   ` jeffy
  2017-06-26  3:27                   ` jeffy
  1 sibling, 0 replies; 16+ messages in thread
From: jeffy @ 2017-06-26  3:26 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Caesar Wang, Mark Brown, lkml, Brian Norris, Heiko Stuebner,
	linux-spi, open list:ARM/Rockchip SoC...,
	linux-arm-kernel

Hi Doug,

On 06/24/2017 12:14 AM, Doug Anderson wrote:
> Jeffy
>
> On Fri, Jun 23, 2017 at 5:18 AM, jeffy <jeffy.chen@rock-chips.com> wrote:
>>>>> So how do we fix this?  IMHO:
>>>>>
>>>>> Add 4 new pinctrl states in rk3399.dtsi:
>>>>>
>>>>>      cs_low_clk_low, cs_low_clk_high, cs_high_clk_low, cs_high_clk_high
>>>>>
>>>>> These would each look something like this:
>>>>>
>>>>> spi5_cs_low_data_low: spi5-cs-low-data-low {
>>>>>      rockchip,pins = <2 22 RK_FUNC_0 &pcfg_output_low>,
>>>>>        <2 23 RK_FUNC_0 &pcfg_output_low>;
>>>>> };
>>>>>
>>>>> Where "pcfg_output_low" would be moved from the existing location in
>>>>> "rk3399-gru.dtsi" to the main "rk3399.dtsi" file.
>>>>>
>>>>>
>>>>> ...now, you'd define runtime_suspend and runtime_resume functions
>>>>> where you'd look at the current state of the chip select and output
>>>>> and select one of these 4 pinmuxes so that things _don't_ change.
>>
>
> *** NOTE *** The more I look at this, the more I'm getting convinced
> that the right thing to do is to just disable Runtime PM while the
> chip select is asserted.  ...so probably you can just skip the next
> chunk of text and go straight to "PROPOSAL".
ok
>
>> it looks like the clk would be low when spi idle, so do we only need
>> *_clk_low?
>
> You're only looking at one polarity.  From Wikipedia
> <https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus>, the
> source of all that is "true":
>
> * At CPOL=0 the base value of the clock is zero, i.e. the idle state
> is 0 and active state is 1.
> -> For CPHA=0, data are captured and output on the clock's rising edge
> (low→high transition)
> -> For CPHA=1, data are captured and output on the clock's falling edge.
>
> * At CPOL=1 the base value of the clock is one (inversion of CPOL=0),
> i.e. the idle state is 1 and active state is 0.
> -> For CPHA=0, data are captured and output on clock's falling edge.
> -> For CPHA=1, data are captured and output on clock's rising edge.
>
> If you're adding code to the generic Rockchip SPI driver you need to
> handle both polarities.
>
>
>> and the rockchip spi supports 2 cs, so should we use cs0_low_cs1_low_clk_low
>> or should we put these pinmux into sub spi device?
>
> By default the pinctrl for rk3399.dtsi just sets up cs0, so I'd worry
> about that.  If someone wants to make cs1 work then they'd have to
> specify the right pinctrl there.
>
>
>>> * You'd want to add the pinmux configs to the main rk3399.dtsi file
>>> and then add code to the rockchip SPI driver to select the right
>>> pinmux (depending on the current state of the chip select and the
>>> current polarity) at runtime suspend.  ...then go back to "default"
>>> mode at runtime resume.
>>
>> i uploaded 2 testonly CLs:
>> remote:   https://chromium-review.googlesource.com/544391 TESTONLY: spi:
>> rockchip: use pinmux to config cs
>> remote:   https://chromium-review.googlesource.com/544392 TESTONLY: dts:
>> bob: only enable ec spi
>>
>> but they are not working well, not sure why, maybe cs still toggled will
>> switching pinmux? will use scope to check it next week.
>
> Yeah, scope is probably the right thing to do.  One thing you'd have
> to make sure is that everything is being done glitch free.  In other
> words, if this is happening:
>
> A) Pinmux to GPIO
> B) Set GPIO to output
> C) Drive GPIO state low
>
> Then that's bad because:
>
> After step A but before step B, you might still be an input and pulls
> might take effect.  Thus you could glitch the line.
>
> After step B but before step C, you might be outputting something else
> if the GPIO had previously been configured to output high.
>
>
> You need to make sure that the sequence is instead:
>
> A) Drive GPIO state high
> B) Set GPIO to output
> C) Pinmux to GPIO
>
>
> Ensuring things are glitch free and dealing with two chip selects
> means it might be cleaner would be to do all the GPIO stuff yourself
> in the driver.  Then you'd have to specify the GPIOs in the device
> tree.
>
> ======
>
> OK, I took a look at your CL and I'm now of the opinion that we should
> disable Runtime PM when the chip select is asserted.  Maybe just
> ignore the above and instead look at:
>
>
> PROPOSAL: Disable Runtime PM when chip select is asserted
>
> I think this proposal will be very easy and is pretty clean.
> Basically go into "rockchip_spi_set_cs()" and adjust the
> "pm_runtime_get_sync()" and "pm_runtime_put_sync()" calls.  Only call
> the "get_sync" at the top of the function if you're asserting the chip
> select (and it wasn't already asserted).  Only call the "put_sync" at
> the bottom of the function if you're deasserting the chip select (and
> it wasn't already deasserted).
hmm, looks like a better way to solve this, but i think we need to call 
pm_runtime_get_sync unconditionally to make sure the read ser register safe.
>
> This should avoid entering PM sleep any time a transaction is midway
> through happening.
>
> Secondly, make sure that the chip selects have a pullup on them (they
> already do).  When you Runtime PM then the SPI part will stop driving
> the pins and the pull will take effect.  Since we can only Runtime PM
> when the chip select is deasserted then this pull will always be
> correct.  Also: since we Runtime PM when the chip select is deasserted
> then the state of the other pins isn't terribly important (though to
> avoid leakage it's probably good to choose a sane pull).
>
>
> How does that sound?  It should only be a few lines of code and only one patch.
>
sounds good, new patch sent(https://patchwork.kernel.org/patch/9808601)
>
> -Doug
>
>
>

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

* Re: [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi
       [not found]                 ` <CAD=FV=XjW4a9mqH0UtUAmHkj-aAO75bpSXuyy__jBB7YC8PBVg@mail.gmail.com>
  2017-06-26  3:26                   ` jeffy
@ 2017-06-26  3:27                   ` jeffy
  1 sibling, 0 replies; 16+ messages in thread
From: jeffy @ 2017-06-26  3:27 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Caesar Wang, Mark Brown, lkml, Brian Norris, Heiko Stuebner,
	linux-spi, open list:ARM/Rockchip SoC...,
	linux-arm-kernel

Hi Doug,

On 06/24/2017 12:14 AM, Doug Anderson wrote:
> Jeffy
>
> On Fri, Jun 23, 2017 at 5:18 AM, jeffy <jeffy.chen@rock-chips.com> wrote:
>>>>> So how do we fix this?  IMHO:
>>>>>
>>>>> Add 4 new pinctrl states in rk3399.dtsi:
>>>>>
>>>>>      cs_low_clk_low, cs_low_clk_high, cs_high_clk_low, cs_high_clk_high
>>>>>
>>>>> These would each look something like this:
>>>>>
>>>>> spi5_cs_low_data_low: spi5-cs-low-data-low {
>>>>>      rockchip,pins = <2 22 RK_FUNC_0 &pcfg_output_low>,
>>>>>        <2 23 RK_FUNC_0 &pcfg_output_low>;
>>>>> };
>>>>>
>>>>> Where "pcfg_output_low" would be moved from the existing location in
>>>>> "rk3399-gru.dtsi" to the main "rk3399.dtsi" file.
>>>>>
>>>>>
>>>>> ...now, you'd define runtime_suspend and runtime_resume functions
>>>>> where you'd look at the current state of the chip select and output
>>>>> and select one of these 4 pinmuxes so that things _don't_ change.
>>
>
> *** NOTE *** The more I look at this, the more I'm getting convinced
> that the right thing to do is to just disable Runtime PM while the
> chip select is asserted.  ...so probably you can just skip the next
> chunk of text and go straight to "PROPOSAL".
ok
>
>> it looks like the clk would be low when spi idle, so do we only need
>> *_clk_low?
>
> You're only looking at one polarity.  From Wikipedia
> <https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus>, the
> source of all that is "true":
>
> * At CPOL=0 the base value of the clock is zero, i.e. the idle state
> is 0 and active state is 1.
> -> For CPHA=0, data are captured and output on the clock's rising edge
> (low→high transition)
> -> For CPHA=1, data are captured and output on the clock's falling edge.
>
> * At CPOL=1 the base value of the clock is one (inversion of CPOL=0),
> i.e. the idle state is 1 and active state is 0.
> -> For CPHA=0, data are captured and output on clock's falling edge.
> -> For CPHA=1, data are captured and output on clock's rising edge.
>
> If you're adding code to the generic Rockchip SPI driver you need to
> handle both polarities.
>
>
>> and the rockchip spi supports 2 cs, so should we use cs0_low_cs1_low_clk_low
>> or should we put these pinmux into sub spi device?
>
> By default the pinctrl for rk3399.dtsi just sets up cs0, so I'd worry
> about that.  If someone wants to make cs1 work then they'd have to
> specify the right pinctrl there.
>
>
>>> * You'd want to add the pinmux configs to the main rk3399.dtsi file
>>> and then add code to the rockchip SPI driver to select the right
>>> pinmux (depending on the current state of the chip select and the
>>> current polarity) at runtime suspend.  ...then go back to "default"
>>> mode at runtime resume.
>>
>> i uploaded 2 testonly CLs:
>> remote:   https://chromium-review.googlesource.com/544391 TESTONLY: spi:
>> rockchip: use pinmux to config cs
>> remote:   https://chromium-review.googlesource.com/544392 TESTONLY: dts:
>> bob: only enable ec spi
>>
>> but they are not working well, not sure why, maybe cs still toggled will
>> switching pinmux? will use scope to check it next week.
>
> Yeah, scope is probably the right thing to do.  One thing you'd have
> to make sure is that everything is being done glitch free.  In other
> words, if this is happening:
>
> A) Pinmux to GPIO
> B) Set GPIO to output
> C) Drive GPIO state low
>
> Then that's bad because:
>
> After step A but before step B, you might still be an input and pulls
> might take effect.  Thus you could glitch the line.
>
> After step B but before step C, you might be outputting something else
> if the GPIO had previously been configured to output high.
>
>
> You need to make sure that the sequence is instead:
>
> A) Drive GPIO state high
> B) Set GPIO to output
> C) Pinmux to GPIO
>
>
> Ensuring things are glitch free and dealing with two chip selects
> means it might be cleaner would be to do all the GPIO stuff yourself
> in the driver.  Then you'd have to specify the GPIOs in the device
> tree.
>
> ======
>
> OK, I took a look at your CL and I'm now of the opinion that we should
> disable Runtime PM when the chip select is asserted.  Maybe just
> ignore the above and instead look at:
>
>
> PROPOSAL: Disable Runtime PM when chip select is asserted
>
> I think this proposal will be very easy and is pretty clean.
> Basically go into "rockchip_spi_set_cs()" and adjust the
> "pm_runtime_get_sync()" and "pm_runtime_put_sync()" calls.  Only call
> the "get_sync" at the top of the function if you're asserting the chip
> select (and it wasn't already asserted).  Only call the "put_sync" at
> the bottom of the function if you're deasserting the chip select (and
> it wasn't already deasserted).
hmm, looks like a better way to solve this, but i think we need to call 
pm_runtime_get_sync unconditionally to make sure the read ser register safe.
>
> This should avoid entering PM sleep any time a transaction is midway
> through happening.
>
> Secondly, make sure that the chip selects have a pullup on them (they
> already do).  When you Runtime PM then the SPI part will stop driving
> the pins and the pull will take effect.  Since we can only Runtime PM
> when the chip select is deasserted then this pull will always be
> correct.  Also: since we Runtime PM when the chip select is deasserted
> then the state of the other pins isn't terribly important (though to
> avoid leakage it's probably good to choose a sane pull).
>
>
> How does that sound?  It should only be a few lines of code and only one patch.
>
sounds good, new patch sent(https://patchwork.kernel.org/patch/9808601)
>
> -Doug
>
>
>

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

end of thread, other threads:[~2017-06-26  3:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13  5:25 [PATCH v2 1/4] spi: rockchip: fix error handling when probe Jeffy Chen
2017-06-13  5:25 ` [PATCH v2 2/4] spi: rockchip: add support for "cs-gpios" dts property Jeffy Chen
2017-06-13 17:24   ` kbuild test robot
2017-06-13 17:33   ` Brian Norris
2017-06-14  1:27     ` jeffy
2017-06-13  5:25 ` [PATCH v2 3/4] dt-bindings: spi/rockchip: add "cs-gpios" optional property Jeffy Chen
2017-06-13  5:25 ` [PATCH v2 4/4] arm64: dts: rockchip: use cs-gpios for cros_ec_spi Jeffy Chen
2017-06-13 17:50   ` Brian Norris
2017-06-13 18:22     ` Mark Brown
2017-06-20  0:47       ` Brian Norris
2017-06-22 22:47         ` Doug Anderson
2017-06-23  3:51           ` jeffy
2017-06-23  4:26             ` Doug Anderson
     [not found]               ` <594D0723.7010108@rock-chips.com>
     [not found]                 ` <CAD=FV=XjW4a9mqH0UtUAmHkj-aAO75bpSXuyy__jBB7YC8PBVg@mail.gmail.com>
2017-06-26  3:26                   ` jeffy
2017-06-26  3:27                   ` jeffy
2017-06-13 17:29 ` [PATCH v2 1/4] spi: rockchip: fix error handling when probe Brian Norris

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).