summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2024-10-01 14:24:40 +0200
committerTom Rini <trini@konsulko.com>2024-10-10 16:02:20 -0600
commit0319bae9e72922f55dd34e90aedf14cf1dd93045 (patch)
tree96bdf186dc966367518c3b89ce9df64b892487b3
parent5d162bbb203502516b92934b78316b874c20d176 (diff)
mtd: implement support for LED activity
Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal mtd operations. LED activity is implemented HERE and not in the subsystem side to limit any performance degradation in case multiple call to MTD subsystem read/write are done. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--cmd/mtd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/mtd.c b/cmd/mtd.c
index 795aaa2b37d..f178d7bea61 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -10,6 +10,7 @@
#include <command.h>
#include <console.h>
+#include <led.h>
#if CONFIG_IS_ENABLED(CMD_MTD_OTP)
#include <hexdump.h>
#endif
@@ -558,6 +559,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
while (mtd_block_isbad(mtd, off))
off += mtd->erasesize;
+ led_activity_blink();
+
/* Loop over the pages to do the actual read/write */
while (remaining) {
/* Skip the block if it is bad */
@@ -585,6 +588,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
io_op.oobbuf += io_op.oobretlen;
}
+ led_activity_off();
+
if (!ret && dump)
mtd_dump_device_buf(mtd, start_off, buf, len, woob);
@@ -652,6 +657,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.addr = off;
erase_op.len = mtd->erasesize;
+ led_activity_blink();
+
while (len) {
if (!scrub) {
ret = mtd_block_isbad(mtd, erase_op.addr);
@@ -680,6 +687,8 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
erase_op.addr += mtd->erasesize;
}
+ led_activity_off();
+
if (ret && ret != -EIO)
ret = CMD_RET_FAILURE;
else