linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size
@ 2020-04-16 11:43 Ashish Kumar
  2020-04-16 12:04 ` Schrempf Frieder
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ashish Kumar @ 2020-04-16 11:43 UTC (permalink / raw)
  To: broonie, boris.brezillon, frieder.schrempf
  Cc: linux-spi, linux-kernel, Kuldeep Singh, Ashish Kumar

Reduce devm_ioremap size to (4 * AHB_BUFER_SIZE) rather than mapping
complete QSPI-Memmory as driver is now independent of flash size.
Flash of any size can be accessed.

Issue was reported on platform where devm_ioremap failure is observed
with size > 256M.
Error log on LS1021ATWR :
 fsl-quadspi 1550000.spi: ioremap failed for resource [mem 0x40000000-0x7fffffff]
 fsl-quadspi 1550000.spi: Freescale QuadSPI probe failed
 fsl-quadspi: probe of 1550000.spi failed with error -12

This change was also suggested previously:
https://patchwork.kernel.org/patch/10508753/#22166385

Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Signed-off-by: Ashish Kumar <Ashish.kumar@nxp.com>
---
v3: 
Update comment
v2:
Add Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Incorrporate review comments from Frieder
 drivers/spi/spi-fsl-qspi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index 63c9f7e..8b95e2f 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -859,14 +859,15 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
 					"QuadSPI-memory");
-	q->ahb_addr = devm_ioremap_resource(dev, res);
+	q->memmap_phy = res->start;
+	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
+	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
+				   (q->devtype_data->ahb_buf_size * 4));
 	if (IS_ERR(q->ahb_addr)) {
 		ret = PTR_ERR(q->ahb_addr);
 		goto err_put_ctrl;
 	}
 
-	q->memmap_phy = res->start;
-
 	/* find the clocks */
 	q->clk_en = devm_clk_get(dev, "qspi_en");
 	if (IS_ERR(q->clk_en)) {
-- 
2.7.4


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

* Re: [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size
  2020-04-16 11:43 [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size Ashish Kumar
@ 2020-04-16 12:04 ` Schrempf Frieder
  2020-04-16 12:06 ` Boris Brezillon
  2020-04-16 15:44 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Schrempf Frieder @ 2020-04-16 12:04 UTC (permalink / raw)
  To: Ashish Kumar, broonie, boris.brezillon
  Cc: linux-spi, linux-kernel, Kuldeep Singh

On 16.04.20 13:43, Ashish Kumar wrote:
> Reduce devm_ioremap size to (4 * AHB_BUFER_SIZE) rather than mapping
> complete QSPI-Memmory as driver is now independent of flash size.
> Flash of any size can be accessed.
> 
> Issue was reported on platform where devm_ioremap failure is observed
> with size > 256M.
> Error log on LS1021ATWR :
>   fsl-quadspi 1550000.spi: ioremap failed for resource [mem 0x40000000-0x7fffffff]
>   fsl-quadspi 1550000.spi: Freescale QuadSPI probe failed
>   fsl-quadspi: probe of 1550000.spi failed with error -12
> 
> This change was also suggested previously:
> https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F10508753%2F%2322166385&amp;data=02%7C01%7Cfrieder.schrempf%40kontron.de%7Cf2c2455908884198277708d7e1fb6146%7C8c9d3c973fd941c8a2b1646f3942daf1%7C0%7C0%7C637226342094777031&amp;sdata=QeApGgupC4RwfbSnQLIXs41o7VYKK747NCrZzn%2FRZKQ%3D&amp;reserved=0
> 
> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
> Signed-off-by: Ashish Kumar <Ashish.kumar@nxp.com>

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
> v3:
> Update comment
> v2:
> Add Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Incorrporate review comments from Frieder
>   drivers/spi/spi-fsl-qspi.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> index 63c9f7e..8b95e2f 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -859,14 +859,15 @@ static int fsl_qspi_probe(struct platform_device *pdev)
>   
>   	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>   					"QuadSPI-memory");
> -	q->ahb_addr = devm_ioremap_resource(dev, res);
> +	q->memmap_phy = res->start;
> +	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
> +	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
> +				   (q->devtype_data->ahb_buf_size * 4));
>   	if (IS_ERR(q->ahb_addr)) {
>   		ret = PTR_ERR(q->ahb_addr);
>   		goto err_put_ctrl;
>   	}
>   
> -	q->memmap_phy = res->start;
> -
>   	/* find the clocks */
>   	q->clk_en = devm_clk_get(dev, "qspi_en");
>   	if (IS_ERR(q->clk_en)) {
> 

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

* Re: [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size
  2020-04-16 11:43 [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size Ashish Kumar
  2020-04-16 12:04 ` Schrempf Frieder
@ 2020-04-16 12:06 ` Boris Brezillon
  2020-04-16 15:44 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Boris Brezillon @ 2020-04-16 12:06 UTC (permalink / raw)
  To: Ashish Kumar
  Cc: broonie, frieder.schrempf, linux-spi, linux-kernel, Kuldeep Singh

On Thu, 16 Apr 2020 17:13:19 +0530
Ashish Kumar <Ashish.Kumar@nxp.com> wrote:

> Reduce devm_ioremap size to (4 * AHB_BUFER_SIZE) rather than mapping
> complete QSPI-Memmory as driver is now independent of flash size.
> Flash of any size can be accessed.
> 
> Issue was reported on platform where devm_ioremap failure is observed
> with size > 256M.
> Error log on LS1021ATWR :
>  fsl-quadspi 1550000.spi: ioremap failed for resource [mem 0x40000000-0x7fffffff]
>  fsl-quadspi 1550000.spi: Freescale QuadSPI probe failed
>  fsl-quadspi: probe of 1550000.spi failed with error -12
> 
> This change was also suggested previously:
> https://patchwork.kernel.org/patch/10508753/#22166385
> 
> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
> Signed-off-by: Ashish Kumar <Ashish.kumar@nxp.com>
> ---
> v3: 
> Update comment
> v2:
> Add Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Incorrporate review comments from Frieder
>  drivers/spi/spi-fsl-qspi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> index 63c9f7e..8b95e2f 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -859,14 +859,15 @@ static int fsl_qspi_probe(struct platform_device *pdev)
>  
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>  					"QuadSPI-memory");
> -	q->ahb_addr = devm_ioremap_resource(dev, res);
> +	q->memmap_phy = res->start;
> +	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
> +	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
> +				   (q->devtype_data->ahb_buf_size * 4));
>  	if (IS_ERR(q->ahb_addr)) {
>  		ret = PTR_ERR(q->ahb_addr);
>  		goto err_put_ctrl;
>  	}
>  
> -	q->memmap_phy = res->start;
> -

Looks like this line move is unrelated to the ioremap range change. Not
a big but I thought I'd mention it. In any case,

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

>  	/* find the clocks */
>  	q->clk_en = devm_clk_get(dev, "qspi_en");
>  	if (IS_ERR(q->clk_en)) {


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

* Re: [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size
  2020-04-16 11:43 [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size Ashish Kumar
  2020-04-16 12:04 ` Schrempf Frieder
  2020-04-16 12:06 ` Boris Brezillon
@ 2020-04-16 15:44 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-04-16 15:44 UTC (permalink / raw)
  To: frieder.schrempf, Ashish Kumar, boris.brezillon
  Cc: Kuldeep Singh, Ashish Kumar, linux-kernel, linux-spi

On Thu, 16 Apr 2020 17:13:19 +0530, Ashish Kumar wrote:
> Reduce devm_ioremap size to (4 * AHB_BUFER_SIZE) rather than mapping
> complete QSPI-Memmory as driver is now independent of flash size.
> Flash of any size can be accessed.
> 
> Issue was reported on platform where devm_ioremap failure is observed
> with size > 256M.
> Error log on LS1021ATWR :
>  fsl-quadspi 1550000.spi: ioremap failed for resource [mem 0x40000000-0x7fffffff]
>  fsl-quadspi 1550000.spi: Freescale QuadSPI probe failed
>  fsl-quadspi: probe of 1550000.spi failed with error -12
> 
> [...]

Applied, thanks!

[1/1] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size
      commit: 858e26a515c28df3ef542d9c09493b54a329d6cf

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2020-04-16 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 11:43 [PATCH v3] spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size Ashish Kumar
2020-04-16 12:04 ` Schrempf Frieder
2020-04-16 12:06 ` Boris Brezillon
2020-04-16 15:44 ` Mark Brown

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