linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add optional reset control for Cadence SPI
@ 2024-05-02 10:47 Ji Sheng Teoh
  2024-05-02 10:47 ` [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support Ji Sheng Teoh
  2024-05-02 10:48 ` [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control Ji Sheng Teoh
  0 siblings, 2 replies; 10+ messages in thread
From: Ji Sheng Teoh @ 2024-05-02 10:47 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Ji Sheng Teoh, Ley Foon Tan, linux-spi, devicetree, linux-kernel

The first patch adds optional reset control to support assertion and
deassertion of reset signal to properly bring the SPI device into an
operating condition.
The second patch documents the optional reset control into dt-bindings.

Changes since v1:
 - Dropped resets description and added reset-names property in dt-bindings.
 - Specified "spi" as reset control name instead of using NULL in
   devm_reset_control_get_optional_exclusive().
 - Included reset.h in spi-cadence.c missing in v1.

Ji Sheng Teoh (2):
  spi: spi-cadence: Add optional reset control support
  dt-bindings: spi: spi-cadence: Add optional reset control

 .../devicetree/bindings/spi/spi-cadence.yaml        |  7 +++++++
 drivers/spi/spi-cadence.c                           | 13 +++++++++++++
 2 files changed, 20 insertions(+)

-- 
2.43.2


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

* [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support
  2024-05-02 10:47 [PATCH v2 0/2] Add optional reset control for Cadence SPI Ji Sheng Teoh
@ 2024-05-02 10:47 ` Ji Sheng Teoh
  2024-05-02 14:16   ` Krzysztof Kozlowski
  2024-05-02 10:48 ` [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control Ji Sheng Teoh
  1 sibling, 1 reply; 10+ messages in thread
From: Ji Sheng Teoh @ 2024-05-02 10:47 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Ji Sheng Teoh, Ley Foon Tan, linux-spi, devicetree, linux-kernel,
	Eng Lee Teh

Add optional reset control support for spi-cadence to properly bring
the SPI device into an operating condition.

Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
---
 drivers/spi/spi-cadence.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index e5140532071d..11530a531673 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -18,6 +18,7 @@
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/spi/spi.h>
 
 /* Name of this driver */
@@ -111,6 +112,7 @@
  * @dev_busy:		Device busy flag
  * @is_decoded_cs:	Flag for decoder property set or not
  * @tx_fifo_depth:	Depth of the TX FIFO
+ * @rstc:		Optional reset control for SPI controller
  */
 struct cdns_spi {
 	void __iomem *regs;
@@ -125,6 +127,7 @@ struct cdns_spi {
 	u8 dev_busy;
 	u32 is_decoded_cs;
 	unsigned int tx_fifo_depth;
+	struct reset_control *rstc;
 };
 
 /* Macros for the SPI controller read/write */
@@ -588,6 +591,16 @@ static int cdns_spi_probe(struct platform_device *pdev)
 		goto remove_ctlr;
 	}
 
+	xspi->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, "spi");
+	if (IS_ERR(xspi->rstc)) {
+		ret = PTR_ERR(xspi->rstc);
+		dev_err(&pdev->dev, "Cannot get SPI reset.\n");
+		goto remove_ctlr;
+	}
+
+	reset_control_assert(xspi->rstc);
+	reset_control_deassert(xspi->rstc);
+
 	if (!spi_controller_is_target(ctlr)) {
 		xspi->ref_clk = devm_clk_get_enabled(&pdev->dev, "ref_clk");
 		if (IS_ERR(xspi->ref_clk)) {
-- 
2.43.2


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

* [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control
  2024-05-02 10:47 [PATCH v2 0/2] Add optional reset control for Cadence SPI Ji Sheng Teoh
  2024-05-02 10:47 ` [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support Ji Sheng Teoh
@ 2024-05-02 10:48 ` Ji Sheng Teoh
  2024-05-02 12:21   ` Krzysztof Kozlowski
  2024-05-02 13:53   ` Krzysztof Kozlowski
  1 sibling, 2 replies; 10+ messages in thread
From: Ji Sheng Teoh @ 2024-05-02 10:48 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Ji Sheng Teoh, Ley Foon Tan, linux-spi, devicetree, linux-kernel,
	Eng Lee Teh

Document the optional reset control to SPI.

Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
---
 Documentation/devicetree/bindings/spi/spi-cadence.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-cadence.yaml b/Documentation/devicetree/bindings/spi/spi-cadence.yaml
index d4b61b0e8301..8de96abe9da1 100644
--- a/Documentation/devicetree/bindings/spi/spi-cadence.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-cadence.yaml
@@ -55,6 +55,13 @@ properties:
   label:
     description: Descriptive name of the SPI controller.
 
+  resets:
+    maxItems: 1
+
+  reset-names:
+    items:
+      - const: spi
+
 required:
   - compatible
   - reg
-- 
2.43.2


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

* Re: [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control
  2024-05-02 10:48 ` [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control Ji Sheng Teoh
@ 2024-05-02 12:21   ` Krzysztof Kozlowski
  2024-05-02 12:45     ` JiSheng Teoh
  2024-05-02 13:53   ` Krzysztof Kozlowski
  1 sibling, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-02 12:21 UTC (permalink / raw)
  To: Ji Sheng Teoh, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Ley Foon Tan, linux-spi, devicetree, linux-kernel, Eng Lee Teh

On 02/05/2024 12:48, Ji Sheng Teoh wrote:
> Document the optional reset control to SPI.
> 
> Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>

Who is the author here? What are these three SoBs expressing? Rob asked
for this last time.

Best regards,
Krzysztof


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

* RE: [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control
  2024-05-02 12:21   ` Krzysztof Kozlowski
@ 2024-05-02 12:45     ` JiSheng Teoh
  2024-05-02 12:48       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 10+ messages in thread
From: JiSheng Teoh @ 2024-05-02 12:45 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Leyfoon Tan, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	EngLee Teh

> On 02/05/2024 12:48, Ji Sheng Teoh wrote:
> > Document the optional reset control to SPI.
> >
> > Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
> > Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> > Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
> 
> Who is the author here? What are these three SoBs expressing? Rob asked for this last time.

First SoB was the original author, the subsequent SoB made changes to the original patch.
If intend to only keep the author, then please take the first SoB. Sorry for the noise.


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

* Re: [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control
  2024-05-02 12:45     ` JiSheng Teoh
@ 2024-05-02 12:48       ` Krzysztof Kozlowski
  2024-05-02 12:58         ` JiSheng Teoh
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-02 12:48 UTC (permalink / raw)
  To: JiSheng Teoh, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Leyfoon Tan, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	EngLee Teh

On 02/05/2024 14:45, JiSheng Teoh wrote:
>> On 02/05/2024 12:48, Ji Sheng Teoh wrote:
>>> Document the optional reset control to SPI.
>>>
>>> Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
>>> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
>>> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
>>
>> Who is the author here? What are these three SoBs expressing? Rob asked for this last time.
> 
> First SoB was the original author, the subsequent SoB made changes to the original patch.
> If intend to only keep the author, then please take the first SoB. Sorry for the noise.

Then you miss Co-developed-by tags.

Best regards,
Krzysztof


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

* RE: [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control
  2024-05-02 12:48       ` Krzysztof Kozlowski
@ 2024-05-02 12:58         ` JiSheng Teoh
  0 siblings, 0 replies; 10+ messages in thread
From: JiSheng Teoh @ 2024-05-02 12:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Leyfoon Tan, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	EngLee Teh

> On 02/05/2024 14:45, JiSheng Teoh wrote:
> >> On 02/05/2024 12:48, Ji Sheng Teoh wrote:
> >>> Document the optional reset control to SPI.
> >>>
> >>> Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
> >>> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> >>> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
> >>
> >> Who is the author here? What are these three SoBs expressing? Rob asked for this last time.
> >
> > First SoB was the original author, the subsequent SoB made changes to the original patch.
> > If intend to only keep the author, then please take the first SoB. Sorry for the noise.
> 
> Then you miss Co-developed-by tags.

Thanks, I will fix the tags in the next revision.

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

* Re: [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control
  2024-05-02 10:48 ` [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control Ji Sheng Teoh
  2024-05-02 12:21   ` Krzysztof Kozlowski
@ 2024-05-02 13:53   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-02 13:53 UTC (permalink / raw)
  To: Ji Sheng Teoh, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Ley Foon Tan, linux-spi, devicetree, linux-kernel, Eng Lee Teh

On 02/05/2024 12:48, Ji Sheng Teoh wrote:
> Document the optional reset control to SPI.
> 
> Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
> Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof


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

* Re: [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support
  2024-05-02 10:47 ` [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support Ji Sheng Teoh
@ 2024-05-02 14:16   ` Krzysztof Kozlowski
  2024-05-03  1:20     ` JiSheng Teoh
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2024-05-02 14:16 UTC (permalink / raw)
  To: Ji Sheng Teoh, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Ley Foon Tan, linux-spi, devicetree, linux-kernel, Eng Lee Teh

On 02/05/2024 12:47, Ji Sheng Teoh wrote:
>  
>  /* Macros for the SPI controller read/write */
> @@ -588,6 +591,16 @@ static int cdns_spi_probe(struct platform_device *pdev)
>  		goto remove_ctlr;
>  	}
>  
> +	xspi->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, "spi");
> +	if (IS_ERR(xspi->rstc)) {
> +		ret = PTR_ERR(xspi->rstc);
> +		dev_err(&pdev->dev, "Cannot get SPI reset.\n");

Please switch to:
ret = dev_err_probe()

Best regards,
Krzysztof


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

* RE: [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support
  2024-05-02 14:16   ` Krzysztof Kozlowski
@ 2024-05-03  1:20     ` JiSheng Teoh
  0 siblings, 0 replies; 10+ messages in thread
From: JiSheng Teoh @ 2024-05-03  1:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Philipp Zabel, Michal Simek, Lars-Peter Clausen
  Cc: Leyfoon Tan, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	EngLee Teh

> On 02/05/2024 12:47, Ji Sheng Teoh wrote:
> >
> >  /* Macros for the SPI controller read/write */ @@ -588,6 +591,16 @@
> > static int cdns_spi_probe(struct platform_device *pdev)
> >  		goto remove_ctlr;
> >  	}
> >
> > +	xspi->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, "spi");
> > +	if (IS_ERR(xspi->rstc)) {
> > +		ret = PTR_ERR(xspi->rstc);
> > +		dev_err(&pdev->dev, "Cannot get SPI reset.\n");
> 
> Please switch to:
> ret = dev_err_probe()

Ok, will switch to that. Thanks.

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

end of thread, other threads:[~2024-05-03  1:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-02 10:47 [PATCH v2 0/2] Add optional reset control for Cadence SPI Ji Sheng Teoh
2024-05-02 10:47 ` [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support Ji Sheng Teoh
2024-05-02 14:16   ` Krzysztof Kozlowski
2024-05-03  1:20     ` JiSheng Teoh
2024-05-02 10:48 ` [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control Ji Sheng Teoh
2024-05-02 12:21   ` Krzysztof Kozlowski
2024-05-02 12:45     ` JiSheng Teoh
2024-05-02 12:48       ` Krzysztof Kozlowski
2024-05-02 12:58         ` JiSheng Teoh
2024-05-02 13:53   ` Krzysztof Kozlowski

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