Skip to contentSkip to conversation

m25p80: wait for flash before returning after erase

PATCH Applied Eric Bénard 2 participants 2 messages Aug 28, 2012 – Aug 29, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m25p80: wait for flash before returning after erase

else when we do "erase /dev/m25p0.rootfs; reset", the board will never reboot as the flash is busy to finish the erase command.

---
 drivers/nor/m25p80.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/nor/m25p80.c +3 -1
index daaf60c..5713ad5 100644
@@ -257,6 +257,9 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, loff_t offset)
 		}
 	}
 
+	if (wait_till_ready(flash))
+		return -ETIMEDOUT;
+
 	return 0;
 }
 
@@ -684,7 +687,6 @@ static const struct spi_device_id *jedec_probe(struct spi_device *spi)
 	return NULL;
 }
 
-
 static struct file_operations m25p80_ops = {
 	.read   = m25p80_read,
 	.write  = m25p80_write,
Signature · 7 lines
1.7.7.6


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 3 lines · Eric Bénard

else when we do "erase /dev/m25p0.rootfs; reset", the board will never reboot as the flash is busy to finish the erase command.

Applied, thanks

Sascha

Quoted 36 lines
---
 drivers/nor/m25p80.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/nor/m25p80.c +3 -1
index daaf60c..5713ad5 100644
@@ -257,6 +257,9 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, loff_t offset)
 		}
 	}
 
+	if (wait_till_ready(flash))
+		return -ETIMEDOUT;
+
 	return 0;
 }
 
@@ -684,7 +687,6 @@ static const struct spi_device_id *jedec_probe(struct spi_device *spi)
 	return NULL;
 }
 
-
 static struct file_operations m25p80_ops = {
 	.read   = m25p80_read,
 	.write  = m25p80_write,
Signature · 7 lines
1.7.7.6


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox