cros_ec: Add function to read back flash parameters
Subsystems (2)
PATCH 1/2 cros_ec: Add function to read back flash parameters
Add support for reading back flash parameters as reported by the ec.
--- drivers/misc/cros_ec.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/misc/cros_ec.c +21 -0
@@ -809,6 +809,27 @@ static int cros_ec_data_is_erased(const uint32_t *data, int size)return 1 ; } +/** +* Read back flash parameters +* +* This function reads back parameters of the flash as reported by the EC +* +* @param dev Pointer to device +* @param info Pointer to output flash info struct +*/ +int cros_ec_read_flashinfo (struct cros_ec_dev *dev, +struct ec_response_flash_info *info) +{ +int ret; + + ret =ec_command (dev,EC_CMD_FLASH_INFO ,0 , +NULL ,0 , info,sizeof (*info)); +if (ret <0 ) +return ret; + +return ret <sizeof (*info) ?-1 :0 ; +} +int cros_ec_flash_write (struct cros_ec_dev *dev,const uint8_t *data,uint32_t offset,uint32_t size) {
Signature · 1 line
2.7.4
PATCH 2/2 cros_ec: Add crosec flashinfo command
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.
--- drivers/misc/cros_ec.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/misc/cros_ec.c +10 -0
@@ -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"
Signature · 1 line
2.7.4
PATCH 1/2 cros_ec: Add function to read back flash parameters
In reply to Moritz FischerQuoted 9 lines · Moritz Fischer
Add support for reading back flash parameters as reported by the ec.
Signed-off-by Moritz Fischer <[email protected]>Cc Simon Glass <[email protected]>Cc u-boot at lists.denx.de--- drivers/misc/cros_ec.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
PATCH 2/2 cros_ec: Add crosec flashinfo command
In reply to Moritz FischerHi Moritz,
Quoted 10 lines · Moritz Fischer
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 <[email protected]>Cc Simon Glass <[email protected]>Cc u-boot at lists.denx.de--- drivers/misc/cros_ec.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
If you have the energy, it might be useful to move the command code from this file into cmd/cros_ec.c
Regards,
Simon
PATCH 1/2 cros_ec: Add function to read back flash parameters
In reply to Simon GlassQuoted 4 lines · Simon Glass
Quoted 3 lines · Moritz Fischer
Add support for reading back flash parameters as reported by the ec.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Moritz Fischer <[email protected]>Cc Simon Glass <[email protected]>Cc u-boot at lists.denx.de--- drivers/misc/cros_ec.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)Acked-by Simon Glass <[email protected]>
Applied to u-boot-dm, thanks!
PATCH 2/2 cros_ec: Add crosec flashinfo command
In reply to Simon GlassQuoted 14 lines · Simon Glass
Hi Moritz,
Quoted 10 lines · Moritz Fischer
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 <[email protected]>Cc Simon Glass <[email protected]>Cc u-boot at lists.denx.de--- drivers/misc/cros_ec.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Quoted 7 lines
Acked-by Simon Glass <[email protected]>If you have the energy, it might be useful to move the command code from this file into
cmd/cros_ec.cRegards,
Simon
Applied to u-boot-dm, thanks!