linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] spi: spi-axi-spi-engine: Access register after clock initialization
       [not found] <67f644c1-a0cf-4897-a66a-e2ad4b11140d@secom.com.pl>
@ 2020-04-09 15:26 ` Ardelean, Alexandru
  0 siblings, 0 replies; 3+ messages in thread
From: Ardelean, Alexandru @ 2020-04-09 15:26 UTC (permalink / raw)
  To: linux-spi, broonie, rafal.hibner, linux-kernel


On Thu, 2020-04-09 at 17:23 +0200, Rafał Hibner wrote:
> [External]
> 
> Move register access after clock initialization.
> 
> Clock "s_axi_aclk" is needed for register access. Without the clock running
> 
> AXI bus hangs and causes kernel freeze.
> 

This email looks like it has HTML formatting.

Can you switch to [and use only] plain-text?


Out of curiosity: did you use the 'git send-email' command for this patch?


> Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
> 
> Signed-off-by: Rafał Hibner <rafal.hibner@secom.com.pl>
> 
> ---
> 
>  drivers/spi/spi-axi-spi-engine.c | 32 ++++++++++++++++----------------
> 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-
> engine.c
> 
> index eb9b78a90d..af86e6d6e1 100644
> 
> --- a/drivers/spi/spi-axi-spi-engine.c
> 
> +++ b/drivers/spi/spi-axi-spi-engine.c
> 
> @@ -489,22 +489,6 @@ static int spi_engine_probe(struct platform_device *pdev)
> 
>  
> 
>   spin_lock_init(&spi_engine->lock);
> 
>  
> 
> - spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
> 
> - if (IS_ERR(spi_engine->base)) {
> 
> - ret = PTR_ERR(spi_engine->base);
> 
> - goto err_put_master;
> 
> - }
> 
> -
> 
> - version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
> 
> - if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
> 
> - dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
> 
> - SPI_ENGINE_VERSION_MAJOR(version),
> 
> - SPI_ENGINE_VERSION_MINOR(version),
> 
> - SPI_ENGINE_VERSION_PATCH(version));
> 
> - ret = -ENODEV;
> 
> - goto err_put_master;
> 
> - }
> 
> -
> 
>   spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
> 
>   if (IS_ERR(spi_engine->clk)) {
> 
>   ret = PTR_ERR(spi_engine->clk);
> 
> @@ -525,6 +509,22 @@ static int spi_engine_probe(struct platform_device *pdev)
> 
>   if (ret)
> 
>   goto err_clk_disable;
> 
>  
> 
> + spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
> 
> + if (IS_ERR(spi_engine->base)) {
> 
> + ret = PTR_ERR(spi_engine->base);
> 
> + goto err_ref_clk_disable;
> 
> + }
> 
> +
> 
> + version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
> 
> + if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
> 
> + dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
> 
> + SPI_ENGINE_VERSION_MAJOR(version),
> 
> + SPI_ENGINE_VERSION_MINOR(version),
> 
> + SPI_ENGINE_VERSION_PATCH(version));
> 
> + ret = -ENODEV;
> 
> + goto err_ref_clk_disable;
> 
> + }
> 
> +
> 
>   writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_RESET);
> 
>   writel_relaxed(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
> 
>   writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);
> 
> --
> 
> 2.24.1
> 

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

* Re: [PATCH] spi: spi-axi-spi-engine: Access register after clock initialization
  2020-04-09 15:56 Rafał Hibner
@ 2020-04-09 17:22 ` Ardelean, Alexandru
  0 siblings, 0 replies; 3+ messages in thread
From: Ardelean, Alexandru @ 2020-04-09 17:22 UTC (permalink / raw)
  To: rafal.hibner; +Cc: linux-spi, broonie, linux-kernel

On Thu, 2020-04-09 at 17:56 +0200, Rafał Hibner wrote:
> [External]
> 
> Move register access after clock initialization.
> Clock "s_axi_aclk" is needed for register access. Without the clock running
> AXI bus hangs and causes kernel freeze.

this patch should have been marked as V2
the easiest way to apply V2 tags, is to run  'git format-patch -v2' 
[or -v3 for 3rd version]

no idea if you need to re-send this;
i guess it's up to the maintainer;
maybe try to remember this when re-sending patches, each re-send is an increment

also, it's a good idea to add a changelog right after the --- line
that line doesn't get applied;

other than that:

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> 
> Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Signed-off-by: Rafał Hibner <rafal.hibner@secom.com.pl>
> ---

so here, something like:
Changelog v1 -> v2:
* re-send in plain-text format


>  drivers/spi/spi-axi-spi-engine.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-
> engine.c
> index eb9b78a90d..af86e6d6e1 100644
> --- a/drivers/spi/spi-axi-spi-engine.c
> +++ b/drivers/spi/spi-axi-spi-engine.c
> @@ -489,22 +489,6 @@ static int spi_engine_probe(struct platform_device *pdev)
>  
>  	spin_lock_init(&spi_engine->lock);
>  
> -	spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(spi_engine->base)) {
> -		ret = PTR_ERR(spi_engine->base);
> -		goto err_put_master;
> -	}
> -
> -	version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
> -	if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
> -		dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
> -			SPI_ENGINE_VERSION_MAJOR(version),
> -			SPI_ENGINE_VERSION_MINOR(version),
> -			SPI_ENGINE_VERSION_PATCH(version));
> -		ret = -ENODEV;
> -		goto err_put_master;
> -	}
> -
>  	spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
>  	if (IS_ERR(spi_engine->clk)) {
>  		ret = PTR_ERR(spi_engine->clk);
> @@ -525,6 +509,22 @@ static int spi_engine_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_clk_disable;
>  
> +	spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(spi_engine->base)) {
> +		ret = PTR_ERR(spi_engine->base);
> +		goto err_ref_clk_disable;
> +	}
> +
> +	version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
> +	if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
> +		dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
> +			SPI_ENGINE_VERSION_MAJOR(version),
> +			SPI_ENGINE_VERSION_MINOR(version),
> +			SPI_ENGINE_VERSION_PATCH(version));
> +		ret = -ENODEV;
> +		goto err_ref_clk_disable;
> +	}
> +
>  	writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_RESET);
>  	writel_relaxed(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
>  	writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);

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

* [PATCH] spi: spi-axi-spi-engine: Access register after clock  initialization
@ 2020-04-09 15:56 Rafał Hibner
  2020-04-09 17:22 ` Ardelean, Alexandru
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Hibner @ 2020-04-09 15:56 UTC (permalink / raw)
  Cc: Rafał Hibner, Alexandru Ardelean, Mark Brown, linux-spi,
	linux-kernel

Move register access after clock initialization.
Clock "s_axi_aclk" is needed for register access. Without the clock running
AXI bus hangs and causes kernel freeze.

Cc: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Rafał Hibner <rafal.hibner@secom.com.pl>
---
 drivers/spi/spi-axi-spi-engine.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c
index eb9b78a90d..af86e6d6e1 100644
--- a/drivers/spi/spi-axi-spi-engine.c
+++ b/drivers/spi/spi-axi-spi-engine.c
@@ -489,22 +489,6 @@ static int spi_engine_probe(struct platform_device *pdev)
 
 	spin_lock_init(&spi_engine->lock);
 
-	spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(spi_engine->base)) {
-		ret = PTR_ERR(spi_engine->base);
-		goto err_put_master;
-	}
-
-	version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
-	if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
-		dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
-			SPI_ENGINE_VERSION_MAJOR(version),
-			SPI_ENGINE_VERSION_MINOR(version),
-			SPI_ENGINE_VERSION_PATCH(version));
-		ret = -ENODEV;
-		goto err_put_master;
-	}
-
 	spi_engine->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
 	if (IS_ERR(spi_engine->clk)) {
 		ret = PTR_ERR(spi_engine->clk);
@@ -525,6 +509,22 @@ static int spi_engine_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_clk_disable;
 
+	spi_engine->base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(spi_engine->base)) {
+		ret = PTR_ERR(spi_engine->base);
+		goto err_ref_clk_disable;
+	}
+
+	version = readl(spi_engine->base + SPI_ENGINE_REG_VERSION);
+	if (SPI_ENGINE_VERSION_MAJOR(version) != 1) {
+		dev_err(&pdev->dev, "Unsupported peripheral version %u.%u.%c\n",
+			SPI_ENGINE_VERSION_MAJOR(version),
+			SPI_ENGINE_VERSION_MINOR(version),
+			SPI_ENGINE_VERSION_PATCH(version));
+		ret = -ENODEV;
+		goto err_ref_clk_disable;
+	}
+
 	writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_RESET);
 	writel_relaxed(0xff, spi_engine->base + SPI_ENGINE_REG_INT_PENDING);
 	writel_relaxed(0x00, spi_engine->base + SPI_ENGINE_REG_INT_ENABLE);
-- 
2.24.1


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

end of thread, other threads:[~2020-04-09 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <67f644c1-a0cf-4897-a66a-e2ad4b11140d@secom.com.pl>
2020-04-09 15:26 ` [PATCH] spi: spi-axi-spi-engine: Access register after clock initialization Ardelean, Alexandru
2020-04-09 15:56 Rafał Hibner
2020-04-09 17:22 ` Ardelean, Alexandru

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