* [PATCH] drivers/mtd: improve docg3 write speed
@ 2012-03-11 11:07 Robert Jarzmik
2012-03-13 12:25 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Robert Jarzmik @ 2012-03-11 11:07 UTC (permalink / raw)
To: barebox
When programming or erasing a page, don't wait
systematically for 3s, but finish the operation as soon as
the hardware has finished, and timeout if 3 seconds have
passed.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/mtd/devices/docg3.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 88d707c..7a40908 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -21,6 +21,7 @@
#include <driver.h>
#include <errno.h>
#include <malloc.h>
+#include <clock.h>
#include <io.h>
#include <linux/kernel.h>
#include <linux/mtd/mtd.h>
@@ -780,9 +781,9 @@ static int doc_get_op_status(struct docg3 *docg3)
static int doc_write_erase_wait_status(struct docg3 *docg3)
{
int status, ret = 0;
+ uint64_t start = get_time_ns();
- if (!doc_is_ready(docg3))
- mdelay(3000);
+ while (!is_timeout(start, 3000 * MSECOND) && !doc_is_ready(docg3));
if (!doc_is_ready(docg3)) {
doc_dbg("Timeout reached and the chip is still not ready\n");
ret = -EAGAIN;
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drivers/mtd: improve docg3 write speed
2012-03-11 11:07 [PATCH] drivers/mtd: improve docg3 write speed Robert Jarzmik
@ 2012-03-13 12:25 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-03-13 12:25 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: barebox
On Sun, Mar 11, 2012 at 12:07:06PM +0100, Robert Jarzmik wrote:
> When programming or erasing a page, don't wait
> systematically for 3s, but finish the operation as soon as
> the hardware has finished, and timeout if 3 seconds have
> passed.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Applied, thanks
Sascha
> ---
> drivers/mtd/devices/docg3.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> index 88d707c..7a40908 100644
> --- a/drivers/mtd/devices/docg3.c
> +++ b/drivers/mtd/devices/docg3.c
> @@ -21,6 +21,7 @@
> #include <driver.h>
> #include <errno.h>
> #include <malloc.h>
> +#include <clock.h>
> #include <io.h>
> #include <linux/kernel.h>
> #include <linux/mtd/mtd.h>
> @@ -780,9 +781,9 @@ static int doc_get_op_status(struct docg3 *docg3)
> static int doc_write_erase_wait_status(struct docg3 *docg3)
> {
> int status, ret = 0;
> + uint64_t start = get_time_ns();
>
> - if (!doc_is_ready(docg3))
> - mdelay(3000);
> + while (!is_timeout(start, 3000 * MSECOND) && !doc_is_ready(docg3));
> if (!doc_is_ready(docg3)) {
> doc_dbg("Timeout reached and the chip is still not ready\n");
> ret = -EAGAIN;
> --
> 1.7.5.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-13 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-11 11:07 [PATCH] drivers/mtd: improve docg3 write speed Robert Jarzmik
2012-03-13 12:25 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox