* [PATCH] mtd: call mtd_erase with complete area if possible
@ 2013-05-27 8:38 Sascha Hauer
2013-05-27 11:17 ` Renaud Barbier
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2013-05-27 8:38 UTC (permalink / raw)
To: barebox
If a device does not have bad blocks loop over the eraseblocks
in the driver instead of the core. This allows the mtd_dataflash
driver to erase blocks instead of pages to gain more speed during
erasing. Also the mtd_dataflash driver modifies the erase_info
struct which causes the outer loop in the core to never end.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Renaud, you recently sent a patch to fix erase on non uniform
flashes. This patch should fix this (by accident) aswell (or maybe
it causes other problems ;). Could you please test this one?
Thanks
Sascha
drivers/mtd/core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 61744b6..f358098 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -107,6 +107,12 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, loff_t offset)
memset(&erase, 0, sizeof(erase));
erase.mtd = mtd;
erase.addr = offset;
+
+ if (!mtd->block_isbad) {
+ erase.len = count;
+ return mtd_erase(mtd, &erase);
+ }
+
erase.len = mtd->erasesize;
while (count > 0) {
--
1.8.2.rc2
_______________________________________________
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] mtd: call mtd_erase with complete area if possible
2013-05-27 8:38 [PATCH] mtd: call mtd_erase with complete area if possible Sascha Hauer
@ 2013-05-27 11:17 ` Renaud Barbier
0 siblings, 0 replies; 2+ messages in thread
From: Renaud Barbier @ 2013-05-27 11:17 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 27/05/2013 09:38, Sascha Hauer wrote:
> If a device does not have bad blocks loop over the eraseblocks
> in the driver instead of the core. This allows the mtd_dataflash
> driver to erase blocks instead of pages to gain more speed during
> erasing. Also the mtd_dataflash driver modifies the erase_info
> struct which causes the outer loop in the core to never end.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>
> Renaud, you recently sent a patch to fix erase on non uniform
> flashes. This patch should fix this (by accident) aswell (or maybe
> it causes other problems ;). Could you please test this one?
>
> Thanks
> Sascha
It does work.
If I define /dev/env0 to be 64KB i.e two sectors, then data in both
sector has been erased.
barebox> / unprotect /dev/env0
barebox> / erase /dev/env0
mtd_op_erase = 65536
cfi_erase: erase 0x00000000 (size 65536)
intel_flash_erase_one:sect = 0
intel_flash_erase_one:sect = 1
_______________________________________________
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:[~2013-05-27 11:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-27 8:38 [PATCH] mtd: call mtd_erase with complete area if possible Sascha Hauer
2013-05-27 11:17 ` Renaud Barbier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox