* [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
@ 2015-04-07 13:32 ` Maxime Ripard
0 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2015-04-07 13:32 UTC (permalink / raw)
To: Ezequiel Garcia, Brian Norris
Cc: Maxime Ripard, Boris Brezillon, linux-mtd, Baruch Siach,
linux-arm-kernel
Now that the driver handles the FIFO draining in a threaded interrupt, we can
base our timeout on jiffies and sleeping, instead of using mdelay.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
Changes from v1:
- Switch to readl_relaxed_poll_timeout() instead of using our own custom
implementation of it.
drivers/mtd/nand/pxa3xx_nand.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 10b1f7a4fe50..55eb1334675b 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -22,6 +22,7 @@
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <linux/of.h>
@@ -483,7 +484,8 @@ static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask)
static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
{
if (info->ecc_bch) {
- int timeout;
+ u32 val;
+ int ret;
/*
* According to the datasheet, when reading from NDDB
@@ -496,16 +498,12 @@ static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
while (len > 8) {
__raw_readsl(info->mmio_base + NDDB, data, 8);
- for (timeout = 0;
- !(nand_readl(info, NDSR) & NDSR_RDDREQ);
- timeout++) {
- if (timeout >= 5) {
- dev_err(&info->pdev->dev,
- "Timeout on RDDREQ while draining the FIFO\n");
- return;
- }
-
- mdelay(1);
+ ret = readl_relaxed_poll_timeout(info->mmio_base + NDSR, val,
+ val & NDSR_RDDREQ, 1000, 5000);
+ if (ret) {
+ dev_err(&info->pdev->dev,
+ "Timeout on RDDREQ while draining the FIFO\n");
+ return;
}
data += 32;
--
2.3.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
@ 2015-04-07 13:32 ` Maxime Ripard
0 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2015-04-07 13:32 UTC (permalink / raw)
To: linux-arm-kernel
Now that the driver handles the FIFO draining in a threaded interrupt, we can
base our timeout on jiffies and sleeping, instead of using mdelay.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
Changes from v1:
- Switch to readl_relaxed_poll_timeout() instead of using our own custom
implementation of it.
drivers/mtd/nand/pxa3xx_nand.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 10b1f7a4fe50..55eb1334675b 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -22,6 +22,7 @@
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <linux/of.h>
@@ -483,7 +484,8 @@ static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask)
static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
{
if (info->ecc_bch) {
- int timeout;
+ u32 val;
+ int ret;
/*
* According to the datasheet, when reading from NDDB
@@ -496,16 +498,12 @@ static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len)
while (len > 8) {
__raw_readsl(info->mmio_base + NDDB, data, 8);
- for (timeout = 0;
- !(nand_readl(info, NDSR) & NDSR_RDDREQ);
- timeout++) {
- if (timeout >= 5) {
- dev_err(&info->pdev->dev,
- "Timeout on RDDREQ while draining the FIFO\n");
- return;
- }
-
- mdelay(1);
+ ret = readl_relaxed_poll_timeout(info->mmio_base + NDSR, val,
+ val & NDSR_RDDREQ, 1000, 5000);
+ if (ret) {
+ dev_err(&info->pdev->dev,
+ "Timeout on RDDREQ while draining the FIFO\n");
+ return;
}
data += 32;
--
2.3.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
2015-04-07 13:32 ` Maxime Ripard
@ 2015-04-28 13:30 ` Maxime Ripard
-1 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2015-04-28 13:30 UTC (permalink / raw)
To: Ezequiel Garcia, Brian Norris
Cc: Boris Brezillon, linux-mtd, Baruch Siach, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 556 bytes --]
Hi Brian,
On Tue, Apr 07, 2015 at 03:32:45PM +0200, Maxime Ripard wrote:
> Now that the driver handles the FIFO draining in a threaded interrupt, we can
> base our timeout on jiffies and sleeping, instead of using mdelay.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Ping?
You were the one that asked for this patch in the first place, so I
was kind of expecting you would merge it :)
Thanks,
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
@ 2015-04-28 13:30 ` Maxime Ripard
0 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2015-04-28 13:30 UTC (permalink / raw)
To: linux-arm-kernel
Hi Brian,
On Tue, Apr 07, 2015 at 03:32:45PM +0200, Maxime Ripard wrote:
> Now that the driver handles the FIFO draining in a threaded interrupt, we can
> base our timeout on jiffies and sleeping, instead of using mdelay.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Ping?
You were the one that asked for this patch in the first place, so I
was kind of expecting you would merge it :)
Thanks,
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150428/f257d4a9/attachment-0001.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
2015-04-07 13:32 ` Maxime Ripard
@ 2015-05-07 7:06 ` Brian Norris
-1 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2015-05-07 7:06 UTC (permalink / raw)
To: Maxime Ripard
Cc: Boris Brezillon, Baruch Siach, linux-mtd, linux-arm-kernel,
Ezequiel Garcia
On Tue, Apr 07, 2015 at 03:32:45PM +0200, Maxime Ripard wrote:
> Now that the driver handles the FIFO draining in a threaded interrupt, we can
> base our timeout on jiffies and sleeping, instead of using mdelay.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> Changes from v1:
> - Switch to readl_relaxed_poll_timeout() instead of using our own custom
> implementation of it.
Pushed to l2-mtd.git
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
@ 2015-05-07 7:06 ` Brian Norris
0 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2015-05-07 7:06 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 07, 2015 at 03:32:45PM +0200, Maxime Ripard wrote:
> Now that the driver handles the FIFO draining in a threaded interrupt, we can
> base our timeout on jiffies and sleeping, instead of using mdelay.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> Changes from v1:
> - Switch to readl_relaxed_poll_timeout() instead of using our own custom
> implementation of it.
Pushed to l2-mtd.git
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-07 7:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 13:32 [PATCH v2] mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout Maxime Ripard
2015-04-07 13:32 ` Maxime Ripard
2015-04-28 13:30 ` Maxime Ripard
2015-04-28 13:30 ` Maxime Ripard
2015-05-07 7:06 ` Brian Norris
2015-05-07 7:06 ` Brian Norris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.