* [PATCH] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts
@ 2018-06-30 10:54 Vignesh R
2018-06-30 13:21 ` Marek Vasut
2018-07-06 13:38 ` Boris Brezillon
0 siblings, 2 replies; 3+ messages in thread
From: Vignesh R @ 2018-06-30 10:54 UTC (permalink / raw)
To: Marek Vasut, Boris Brezillon
Cc: Richard Weinberger, linux-mtd, linux-kernel,
Linux ARM Mailing List, Vignesh R
Sometimes when writing large size files to flash in direct/memory mapped
mode, it is seen that flash write enable command times out with error:
[ 503.146293] cadence-qspi 47040000.ospi: Flash command execution timed out.
This is because, we need to make sure previous direct write operation
is complete by polling for IDLE bit in CONFIG_REG before starting the
next operation.
Fix this by polling for IDLE bit after memory mapped write.
Fixes: a27f2eaf2b27 ("mtd: spi-nor: cadence-quadspi: Add support for direct access mode")
Cc: stable@vger.kernel.org
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index c3f7aaa5d18f..d7e10b36a0b9 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -926,10 +926,12 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
if (ret)
return ret;
- if (f_pdata->use_direct_mode)
+ if (f_pdata->use_direct_mode) {
memcpy_toio(cqspi->ahb_base + to, buf, len);
- else
+ ret = cqspi_wait_idle(cqspi);
+ } else {
ret = cqspi_indirect_write_execute(nor, to, buf, len);
+ }
if (ret)
return ret;
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts
2018-06-30 10:54 [PATCH] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts Vignesh R
@ 2018-06-30 13:21 ` Marek Vasut
2018-07-06 13:38 ` Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2018-06-30 13:21 UTC (permalink / raw)
To: Vignesh R, Boris Brezillon
Cc: Richard Weinberger, linux-mtd, linux-kernel, Linux ARM Mailing List
On 06/30/2018 12:54 PM, Vignesh R wrote:
> Sometimes when writing large size files to flash in direct/memory mapped
> mode, it is seen that flash write enable command times out with error:
> [ 503.146293] cadence-qspi 47040000.ospi: Flash command execution timed out.
>
> This is because, we need to make sure previous direct write operation
> is complete by polling for IDLE bit in CONFIG_REG before starting the
> next operation.
>
> Fix this by polling for IDLE bit after memory mapped write.
>
> Fixes: a27f2eaf2b27 ("mtd: spi-nor: cadence-quadspi: Add support for direct access mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index c3f7aaa5d18f..d7e10b36a0b9 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -926,10 +926,12 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
> if (ret)
> return ret;
>
> - if (f_pdata->use_direct_mode)
> + if (f_pdata->use_direct_mode) {
> memcpy_toio(cqspi->ahb_base + to, buf, len);
> - else
> + ret = cqspi_wait_idle(cqspi);
> + } else {
> ret = cqspi_indirect_write_execute(nor, to, buf, len);
> + }
> if (ret)
> return ret;
>
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts
2018-06-30 10:54 [PATCH] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts Vignesh R
2018-06-30 13:21 ` Marek Vasut
@ 2018-07-06 13:38 ` Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-07-06 13:38 UTC (permalink / raw)
To: Vignesh R
Cc: Marek Vasut, Richard Weinberger, linux-mtd, linux-kernel,
Linux ARM Mailing List
On Sat, 30 Jun 2018 16:24:21 +0530
Vignesh R <vigneshr@ti.com> wrote:
> Sometimes when writing large size files to flash in direct/memory mapped
> mode, it is seen that flash write enable command times out with error:
> [ 503.146293] cadence-qspi 47040000.ospi: Flash command execution timed out.
>
> This is because, we need to make sure previous direct write operation
> is complete by polling for IDLE bit in CONFIG_REG before starting the
> next operation.
>
> Fix this by polling for IDLE bit after memory mapped write.
>
> Fixes: a27f2eaf2b27 ("mtd: spi-nor: cadence-quadspi: Add support for direct access mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vignesh R <vigneshr@ti.com>
Applied.
Thanks,
Boris
> ---
> drivers/mtd/spi-nor/cadence-quadspi.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index c3f7aaa5d18f..d7e10b36a0b9 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -926,10 +926,12 @@ static ssize_t cqspi_write(struct spi_nor *nor, loff_t to,
> if (ret)
> return ret;
>
> - if (f_pdata->use_direct_mode)
> + if (f_pdata->use_direct_mode) {
> memcpy_toio(cqspi->ahb_base + to, buf, len);
> - else
> + ret = cqspi_wait_idle(cqspi);
> + } else {
> ret = cqspi_indirect_write_execute(nor, to, buf, len);
> + }
> if (ret)
> return ret;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-06 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-30 10:54 [PATCH] mtd: spi-nor: cadence-quadspi: Fix direct mode write timeouts Vignesh R
2018-06-30 13:21 ` Marek Vasut
2018-07-06 13:38 ` Boris Brezillon
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).