mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
Subsystems (2)
PATCH 1/1 mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
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.
--- drivers/mtd/nand/pxa3xx_nand.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/mtd/nand/pxa3xx_nand.c +4 -5
@@ -496,16 +496,15 @@ 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 ) { + timeout = jiffies +msecs_to_jiffies (5 ); +while (!(nand_readl (info,NDSR ) &NDSR_RDDREQ )) { +if (!time_before (jiffies, timeout)) {dev_err (&info->pdev->dev,"Timeout on RDDREQ while draining the FIFO\n" );return ; } -mdelay (1 ); +msleep (1 ); } data +=32 ;
Signature · 1 line
2.3.0
PATCH 1/1 mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
Hi Maxime,
Quoted 21 lines · Maxime Ripard
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 <[email protected]>--- drivers/mtd/nand/pxa3xx_nand.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/mtd/nand/pxa3xx_nand.c +1
-4@@ -496,16 +496,15 @@ 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 ) { + timeout = jiffies +msecs_to_jiffies (5 );
drivers/mtd/nand/pxa3xx_nand.c static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len) · line 508
Quoted 10 lines
drivers/mtd/nand/pxa3xx_nand.c +3
-1+while (!(nand_readl (info,NDSR ) &NDSR_RDDREQ )) { +if (!time_before (jiffies, timeout)) {dev_err (&info->pdev->dev,"Timeout on RDDREQ while draining the FIFO\n" );return ; } -mdelay (1 ); +msleep (1 ); }
You may want to consider using readl_relaxed_poll_timeout() from linux/iopoll.h, which was introduced in v4.0-rc1.
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -PATCH 1/1 mtd: nand: pxa3xx: Switch FIFO draining to jiffies-based timeout
Hi Baruch,
Quoted 31 lines · Baruch Siach
Hi Maxime,
Quoted 28 lines · Maxime Ripard
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 <[email protected]>--- drivers/mtd/nand/pxa3xx_nand.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/mtd/nand/pxa3xx_nand.c +3
-4@@ -496,16 +496,15 @@ 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 ) { + timeout = jiffies +msecs_to_jiffies (5 ); +while (!(nand_readl (info,NDSR ) &NDSR_RDDREQ )) { +if (!time_before (jiffies, timeout)) {dev_err (&info->pdev->dev,"Timeout on RDDREQ while draining the FIFO\n" );return ; }
Quoted 6 lines
drivers/mtd/nand/pxa3xx_nand.c static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len) · line 508
Quoted 3 lines
drivers/mtd/nand/pxa3xx_nand.c +1
-1-mdelay (1 ); +msleep (1 ); }You may want to consider using
readl_relaxed_poll_timeout()fromlinux/iopoll.h, which was introduced in v4.0-rc1.
Thanks for pointing this out.
I'll send a new version using this.
Thanks!
Maxime
Signature · 10 lines
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/20150304/06bd1069/attachment-0001.sig>