diff mbox

mtd nand : print flash size during detection

Message ID 1352199836-4516-1-git-send-email-matthieu.castet@parrot.com
State New, archived
Headers show

Commit Message

Matthieu CASTET Nov. 6, 2012, 11:03 a.m. UTC
This help to detect bad flash identification in case the size is not present
on the name (ONFI).

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
 drivers/mtd/nand/nand_base.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Huang Shijie Nov. 7, 2012, 6:22 a.m. UTC | #1
于 2012年11月06日 19:03, Matthieu CASTET 写道:
> This help to detect bad flash identification in case the size is not present
> on the name (ONFI).
>
I think you should give us a example of "bad flash identification".

I also want to add this patch to print out the flash size during 
detection, but not for the "bad flash identification" reason,

Best Regards
Huang Shijie
Artem Bityutskiy Nov. 16, 2012, 8:24 a.m. UTC | #2
On Tue, 2012-11-06 at 12:03 +0100, Matthieu CASTET wrote:
> This help to detect bad flash identification in case the size is not present
> on the name (ONFI).
> 
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
> ---
>  drivers/mtd/nand/nand_base.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index c90ef66..8916bc6 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3292,10 +3292,10 @@ ident_done:
>  		chip->cmdfunc = nand_command_lp;
>  
>  	pr_info("NAND device: Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s),"
> -		" page size: %d, OOB size: %d\n",
> +		" %dMiB page size: %d, OOB size: %d\n",

Is this readable? No comma after the size. I guess it is better to add
"size %dMiB," instead?
Huang Shijie Nov. 16, 2012, 8:38 a.m. UTC | #3
于 2012年11月16日 16:24, Artem Bityutskiy 写道:
> On Tue, 2012-11-06 at 12:03 +0100, Matthieu CASTET wrote:
>> This help to detect bad flash identification in case the size is not present
>> on the name (ONFI).
>>
>> Signed-off-by: Matthieu CASTET<matthieu.castet@parrot.com>
>> ---
>>   drivers/mtd/nand/nand_base.c |    4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index c90ef66..8916bc6 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -3292,10 +3292,10 @@ ident_done:
>>   		chip->cmdfunc = nand_command_lp;
>>
>>   	pr_info("NAND device: Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s),"
>> -		" page size: %d, OOB size: %d\n",
>> +		" %dMiB page size: %d, OOB size: %d\n",
> Is this readable? No comma after the size. I guess it is better to add
> "size %dMiB," instead?
>
In multi chip enables nand chips, such as some Micron nand chips, you 
will find half size is printed
after this patch is applied. Why? because we only scan one #CE, but this 
nand chip has two #CE, the #CE0 and #CE1.


a little confused.

Best Regards
Huang Shijie
Matthieu CASTET Nov. 22, 2012, 5:19 p.m. UTC | #4
Huang Shijie a écrit :
> 于 2012年11月06日 19:03, Matthieu CASTET 写道:
>> This help to detect bad flash identification in case the size is not present
>> on the name (ONFI).
>>
> I think you should give us a example of "bad flash identification".
> 
> I also want to add this patch to print out the flash size during 
> detection, but not for the "bad flash identification" reason,

When Onfi support in mtd wasn't good, it could have help us to catch case of bad
support of multi-lun nand (only a size of 1 lun where used).


Matthieu
Matthieu CASTET Nov. 22, 2012, 5:20 p.m. UTC | #5
Artem Bityutskiy a écrit :
> On Tue, 2012-11-06 at 12:03 +0100, Matthieu CASTET wrote:
>> This help to detect bad flash identification in case the size is not present
>> on the name (ONFI).
>>
>> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
>> ---
>>  drivers/mtd/nand/nand_base.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index c90ef66..8916bc6 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -3292,10 +3292,10 @@ ident_done:
>>  		chip->cmdfunc = nand_command_lp;
>>  
>>  	pr_info("NAND device: Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s),"
>> -		" page size: %d, OOB size: %d\n",
>> +		" %dMiB page size: %d, OOB size: %d\n",
> 
> Is this readable? No comma after the size. I guess it is better to add
> "size %dMiB," instead?
> 
ok
Matthieu CASTET Nov. 22, 2012, 5:36 p.m. UTC | #6
Huang Shijie a écrit :
>>
> In multi chip enables nand chips, such as some Micron nand chips, you 
> will find half size is printed
> after this patch is applied. Why? because we only scan one #CE, but this 
> nand chip has two #CE, the #CE0 and #CE1.
> 
> 
> a little confused.
nand_get_flash_type probe only one chip.

For multi chip, you should see the log :
"x NAND chips detected".

The resulting mtd size will be x * the chip size.
diff mbox

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c90ef66..8916bc6 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3292,10 +3292,10 @@  ident_done:
 		chip->cmdfunc = nand_command_lp;
 
 	pr_info("NAND device: Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s),"
-		" page size: %d, OOB size: %d\n",
+		" %dMiB page size: %d, OOB size: %d\n",
 		*maf_id, *dev_id, nand_manuf_ids[maf_idx].name,
 		chip->onfi_version ? chip->onfi_params.model : type->name,
-		mtd->writesize, mtd->oobsize);
+		(int)(chip->chipsize >> 20), mtd->writesize, mtd->oobsize);
 
 	return type;
 }