[U-Boot] [PATCH 2/2] cros_ec: Add crosec flashinfo command

Moritz Fischer moritz.fischer at ettus.com
Tue Sep 13 23:44:49 CEST 2016


Add command to print out the flash info as reported by the
ec. The data read back includes size, write block size,
erase block size.

Signed-off-by: Moritz Fischer <moritz.fischer at ettus.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: u-boot at lists.denx.de
---
 drivers/misc/cros_ec.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index 931fdf5..cb5db0f 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -1382,6 +1382,15 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			printf("Offset: %x\n", offset);
 			printf("Size:   %x\n", size);
 		}
+	} else if (0 == strcmp("flashinfo", cmd)) {
+		struct ec_response_flash_info p;
+
+		ret = cros_ec_read_flashinfo(dev, &p);
+		if (!ret) {
+			printf("Flash size:         %u\n", p.flash_size);
+			printf("Write block size:   %u\n", p.write_block_size);
+			printf("Erase block size:   %u\n", p.erase_block_size);
+		}
 	} else if (0 == strcmp("vbnvcontext", cmd)) {
 		uint8_t block[EC_VBNV_BLOCK_SIZE];
 		char buf[3];
@@ -1501,6 +1510,7 @@ U_BOOT_CMD(
 	"crosec events              Read CROS-EC host events\n"
 	"crosec clrevents [mask]    Clear CROS-EC host events\n"
 	"crosec regioninfo <ro|rw>  Read image info\n"
+	"crosec flashinfo           Read flash info\n"
 	"crosec erase <ro|rw>       Erase EC image\n"
 	"crosec read <ro|rw> <addr> [<size>]   Read EC image\n"
 	"crosec write <ro|rw> <addr> [<size>]  Write EC image\n"
-- 
2.7.4



More information about the U-Boot mailing list