diff mbox series

[U-Boot,4/4] cmd: mtd: Add info text to mtd erase subcommand

Message ID 20180806151253.31205-4-sr@denx.de
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series [U-Boot,1/4] spi: spi-mem: Add optional half-duplex SPI transfer mode | expand

Commit Message

Stefan Roese Aug. 6, 2018, 3:12 p.m. UTC
Adding this info helps seeing, what really is being erased - especially
if no arguments are passed for offset and size. Now this is the
output:

=> mtd erase spi-nand0
Erasing 0x00000000 ... 0x07ffffff (65536 page(s))
nand: attempt to erase a bad/reserved block @6000000
nand: attempt to erase a bad/reserved block @7fe0000

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Jagan Teki <jagan@openedev.com>
---
 cmd/mtd.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Boris Brezillon Aug. 6, 2018, 8:41 p.m. UTC | #1
On Mon,  6 Aug 2018 17:12:53 +0200
Stefan Roese <sr@denx.de> wrote:

> Adding this info helps seeing, what really is being erased - especially
> if no arguments are passed for offset and size. Now this is the
> output:
> 
> => mtd erase spi-nand0  
> Erasing 0x00000000 ... 0x07ffffff (65536 page(s))
> nand: attempt to erase a bad/reserved block @6000000
> nand: attempt to erase a bad/reserved block @7fe0000
> 
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
> Cc: Jagan Teki <jagan@openedev.com>
> ---
>  cmd/mtd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/cmd/mtd.c b/cmd/mtd.c
> index 38a89736cf..6d27698d1e 100644
> --- a/cmd/mtd.c
> +++ b/cmd/mtd.c
> @@ -355,6 +355,9 @@ static int do_mtd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  			return EINVAL;
>  		}
>  
> +		printf("Erasing 0x%08llx ... 0x%08llx (%d page(s))\n",
> +		       off, off + len - 1, mtd_len_to_pages(mtd, len));

Just a detail, but we usually count things in eraseblocks (not pages)
when erasing an MTD device (you can use mtd_div_by_eb(len, mtd) to do
that).

> +
>  		erase_op.mtd = mtd;
>  		erase_op.addr = off;
>  		erase_op.len = len;
Stefan Roese Aug. 7, 2018, 5:08 a.m. UTC | #2
Hi Boris,

On 06.08.2018 22:41, Boris Brezillon wrote:
> On Mon,  6 Aug 2018 17:12:53 +0200
> Stefan Roese <sr@denx.de> wrote:
> 
>> Adding this info helps seeing, what really is being erased - especially
>> if no arguments are passed for offset and size. Now this is the
>> output:
>>
>> => mtd erase spi-nand0
>> Erasing 0x00000000 ... 0x07ffffff (65536 page(s))
>> nand: attempt to erase a bad/reserved block @6000000
>> nand: attempt to erase a bad/reserved block @7fe0000
>>
>> Signed-off-by: Stefan Roese <sr@denx.de>
>> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
>> Cc: Boris Brezillon <boris.brezillon@bootlin.com>
>> Cc: Jagan Teki <jagan@openedev.com>
>> ---
>>   cmd/mtd.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/cmd/mtd.c b/cmd/mtd.c
>> index 38a89736cf..6d27698d1e 100644
>> --- a/cmd/mtd.c
>> +++ b/cmd/mtd.c
>> @@ -355,6 +355,9 @@ static int do_mtd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>   			return EINVAL;
>>   		}
>>   
>> +		printf("Erasing 0x%08llx ... 0x%08llx (%d page(s))\n",
>> +		       off, off + len - 1, mtd_len_to_pages(mtd, len));
> 
> Just a detail, but we usually count things in eraseblocks (not pages)
> when erasing an MTD device (you can use mtd_div_by_eb(len, mtd) to do
> that).

Will do for v2.

Thanks,
Stefan
diff mbox series

Patch

diff --git a/cmd/mtd.c b/cmd/mtd.c
index 38a89736cf..6d27698d1e 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -355,6 +355,9 @@  static int do_mtd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			return EINVAL;
 		}
 
+		printf("Erasing 0x%08llx ... 0x%08llx (%d page(s))\n",
+		       off, off + len - 1, mtd_len_to_pages(mtd, len));
+
 		erase_op.mtd = mtd;
 		erase_op.addr = off;
 		erase_op.len = len;