linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shawn Guo <shawnguo@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] spi: spi-fsl-dspi: Fix imprecise abort on VF500 during probe
Date: Mon, 02 Jul 2018 14:48:52 +0200	[thread overview]
Message-ID: <5e8df85076b005de1214ecb5e5de4927@agner.ch> (raw)
In-Reply-To: <1530271989-9022-1-git-send-email-krzk@kernel.org>

On 29.06.2018 13:33, Krzysztof Kozlowski wrote:
> Registers of DSPI should not be accessed before enabling its clock.  On
> Toradex Colibri VF50 on Iris carrier board this could be seen during
> bootup as imprecise abort:
> 
>     Unhandled fault: imprecise external abort (0x1c06) at 0x00000000
>     Internal error: : 1c06 [#1] ARM
>     Modules linked in:
>     CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.39-dirty #97
>     Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
>     Backtrace:
>     [<804166a8>] (regmap_write) from [<80466b5c>] (dspi_probe+0x1f0/0x8dc)
>     [<8046696c>] (dspi_probe) from [<8040107c>] (platform_drv_probe+0x54/0xb8)
>     [<80401028>] (platform_drv_probe) from [<803ff53c>]
> (driver_probe_device+0x280/0x2f8)
>     [<803ff2bc>] (driver_probe_device) from [<803ff674>]
> (__driver_attach+0xc0/0xc4)
>     [<803ff5b4>] (__driver_attach) from [<803fd818>]
> (bus_for_each_dev+0x70/0xa4)
>     [<803fd7a8>] (bus_for_each_dev) from [<803fee74>] (driver_attach+0x24/0x28)
>     [<803fee50>] (driver_attach) from [<803fe980>] (bus_add_driver+0x1a0/0x218)
>     [<803fe7e0>] (bus_add_driver) from [<803fffe8>] (driver_register+0x80/0x100)
>     [<803fff68>] (driver_register) from [<80400fdc>]
> (__platform_driver_register+0x48/0x50)
>     [<80400f94>] (__platform_driver_register) from [<8091cf7c>]
> (fsl_dspi_driver_init+0x1c/0x20)
>     [<8091cf60>] (fsl_dspi_driver_init) from [<8010195c>]
> (do_one_initcall+0x4c/0x174)
>     [<80101910>] (do_one_initcall) from [<80900e8c>]
> (kernel_init_freeable+0x144/0x1d8)
>     [<80900d48>] (kernel_init_freeable) from [<805ff6a8>]
> (kernel_init+0x10/0x114)
>     [<805ff698>] (kernel_init) from [<80107be8>] (ret_from_fork+0x14/0x2c)
> 
> Cc: <stable@vger.kernel.org>
> Fixes: 5ee67b587a2b ("spi: dspi: clear SPI_SR before enable interrupt")
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Reviewed-by: Stefan Agner <stefan@agner.ch>

Up until commit d2233325e5b7 ("spi: spi-fsl-dspi: remove clk reference
when regmap_mmio initialize") regmap with clocks has been used. I guess
an alternative would have been to use this again, but I guess this has
been dropped for good reasons.

--
Stefan


> ---
>  drivers/spi/spi-fsl-dspi.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
> index ff7456be9d6d..89a1e7a4fe5d 100644
> --- a/drivers/spi/spi-fsl-dspi.c
> +++ b/drivers/spi/spi-fsl-dspi.c
> @@ -1071,30 +1071,30 @@ static int dspi_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	dspi->clk = devm_clk_get(&pdev->dev, "dspi");
> +	if (IS_ERR(dspi->clk)) {
> +		ret = PTR_ERR(dspi->clk);
> +		dev_err(&pdev->dev, "unable to get clock\n");
> +		goto out_master_put;
> +	}
> +	ret = clk_prepare_enable(dspi->clk);
> +	if (ret)
> +		goto out_master_put;
> +
>  	dspi_init(dspi);
>  	dspi->irq = platform_get_irq(pdev, 0);
>  	if (dspi->irq < 0) {
>  		dev_err(&pdev->dev, "can't get platform irq\n");
>  		ret = dspi->irq;
> -		goto out_master_put;
> +		goto out_clk_put;
>  	}
>  
>  	ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt, 0,
>  			pdev->name, dspi);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n");
> -		goto out_master_put;
> -	}
> -
> -	dspi->clk = devm_clk_get(&pdev->dev, "dspi");
> -	if (IS_ERR(dspi->clk)) {
> -		ret = PTR_ERR(dspi->clk);
> -		dev_err(&pdev->dev, "unable to get clock\n");
> -		goto out_master_put;
> +		goto out_clk_put;
>  	}
> -	ret = clk_prepare_enable(dspi->clk);
> -	if (ret)
> -		goto out_master_put;
>  
>  	if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) {
>  		ret = dspi_request_dma(dspi, res->start);

      parent reply	other threads:[~2018-07-02 12:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 11:33 [PATCH] spi: spi-fsl-dspi: Fix imprecise abort on VF500 during probe Krzysztof Kozlowski
2018-07-02 10:12 ` Applied "spi: spi-fsl-dspi: Fix imprecise abort on VF500 during probe" to the spi tree Mark Brown
2018-07-02 12:48 ` Stefan Agner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e8df85076b005de1214ecb5e5de4927@agner.ch \
    --to=stefan@agner.ch \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).