@@ -10,6 +10,7 @@
#include <command.h>
#include <console.h>
+#include <status_led.h>
#if CONFIG_IS_ENABLED(CMD_MTD_OTP)
#include <hexdump.h>
#endif
@@ -558,6 +559,11 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
while (mtd_block_isbad(mtd, off))
off += mtd->erasesize;
+#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE
+ if (!read)
+ status_led_activity_start(CONFIG_LED_STATUS_ACTIVITY);
+#endif
+
/* Loop over the pages to do the actual read/write */
while (remaining) {
/* Skip the block if it is bad */
@@ -585,6 +591,11 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
io_op.oobbuf += io_op.oobretlen;
}
+#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE
+ if (!read)
+ status_led_activity_stop(CONFIG_LED_STATUS_ACTIVITY);
+#endif
+
if (!ret && dump)
mtd_dump_device_buf(mtd, start_off, buf, len, woob);
@@ -652,6 +663,10 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.addr = off;
erase_op.len = mtd->erasesize;
+#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE
+ status_led_activity_start(CONFIG_LED_STATUS_ACTIVITY);
+#endif
+
while (len) {
if (!scrub) {
ret = mtd_block_isbad(mtd, erase_op.addr);
@@ -680,6 +695,10 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.addr += mtd->erasesize;
}
+#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE
+ status_led_activity_stop(CONFIG_LED_STATUS_ACTIVITY);
+#endif
+
if (ret && ret != -EIO)
ret = CMD_RET_FAILURE;
else
Implement support for LED status activity. If the feature is enabled, make the defined ACTIVITY LED to signal mtd write or erase operations. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- cmd/mtd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)