linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd : print out the page size and oob size after parsing out the nand
@ 2012-04-09  3:41 Huang Shijie
  2012-04-10 10:28 ` Florian Fainelli
  2012-04-22  5:15 ` Artem Bityutskiy
  0 siblings, 2 replies; 5+ messages in thread
From: Huang Shijie @ 2012-04-09  3:41 UTC (permalink / raw)
  To: dedekind1; +Cc: Huang Shijie, linux-mtd

Some not-supported nand chips may pass the current parsing code,
and get the wrong page size and oob size. Sometimes, it's hard to notice
that you get the wrong values, because there is no warning or error.

So it's useful to print out the page size and oob size in the end of
the parsing function. We can check these values with the datasheet of the nand
chip as soon as possible.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/nand_base.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 47b19c0..6315b94 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3155,9 +3155,10 @@ ident_done:
 		chip->cmdfunc = nand_command_lp;
 
 	pr_info("NAND device: Manufacturer ID:"
-		" 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
-		nand_manuf_ids[maf_idx].name,
-		chip->onfi_version ? chip->onfi_params.model : type->name);
+		" 0x%02x, Chip ID: 0x%02x (%s %s), pagesize: %d, oobsize: %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);
 
 	return type;
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd : print out the page size and oob size after parsing out the nand
  2012-04-09  3:41 [PATCH] mtd : print out the page size and oob size after parsing out the nand Huang Shijie
@ 2012-04-10 10:28 ` Florian Fainelli
  2012-04-11  2:01   ` Huang Shijie
  2012-04-22  5:15 ` Artem Bityutskiy
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2012-04-10 10:28 UTC (permalink / raw)
  To: Huang Shijie; +Cc: linux-mtd, dedekind1

Hi Huang,

Le 04/09/12 05:41, Huang Shijie a écrit :
> Some not-supported nand chips may pass the current parsing code,
> and get the wrong page size and oob size. Sometimes, it's hard to notice
> that you get the wrong values, because there is no warning or error.
>
> So it's useful to print out the page size and oob size in the end of
> the parsing function. We can check these values with the datasheet of the nand
> chip as soon as possible.

Relying on the kernel to print something to assert the correctness of 
the NAND detection is really weak, you'd better query these properties 
in userland. Also, I am afraid everyone adds a new NAND property print-out.

>
> Signed-off-by: Huang Shijie<b32955@freescale.com>
> ---
>   drivers/mtd/nand/nand_base.c |    7 ++++---
>   1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 47b19c0..6315b94 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3155,9 +3155,10 @@ ident_done:
>   		chip->cmdfunc = nand_command_lp;
>
>   	pr_info("NAND device: Manufacturer ID:"
> -		" 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
> -		nand_manuf_ids[maf_idx].name,
> -		chip->onfi_version ? chip->onfi_params.model : type->name);
> +		" 0x%02x, Chip ID: 0x%02x (%s %s), pagesize: %d, oobsize: %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);
>
>   	return type;
>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd : print out the page size and oob size after parsing out the nand
  2012-04-10 10:28 ` Florian Fainelli
@ 2012-04-11  2:01   ` Huang Shijie
  2012-04-21 14:21     ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Huang Shijie @ 2012-04-11  2:01 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-mtd, dedekind1

Hi,
> Relying on the kernel to print something to assert the correctness of 
> the NAND detection is really weak, you'd better query these properties 
> in userland. Also, I am afraid everyone adds a new NAND property 
> print-out.
thanks.

If no one like this patch, just ignore it.

Huang Shijie

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd : print out the page size and oob size after parsing out the nand
  2012-04-11  2:01   ` Huang Shijie
@ 2012-04-21 14:21     ` Artem Bityutskiy
  0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2012-04-21 14:21 UTC (permalink / raw)
  To: Huang Shijie; +Cc: linux-mtd, Florian Fainelli

On Wed, 2012-04-11 at 10:01 +0800, Huang Shijie wrote:
> Hi,
> > Relying on the kernel to print something to assert the correctness of 
> > the NAND detection is really weak, you'd better query these properties 
> > in userland. Also, I am afraid everyone adds a new NAND property 
> > print-out.
> thanks.
> 
> If no one like this patch, just ignore it.

Yeah, relying on printks is not reliable, but printing the basic
geometry information very useful, I think.

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd : print out the page size and oob size after parsing out the nand
  2012-04-09  3:41 [PATCH] mtd : print out the page size and oob size after parsing out the nand Huang Shijie
  2012-04-10 10:28 ` Florian Fainelli
@ 2012-04-22  5:15 ` Artem Bityutskiy
  1 sibling, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2012-04-22  5:15 UTC (permalink / raw)
  To: Huang Shijie; +Cc: linux-mtd

On Mon, 2012-04-09 at 11:41 +0800, Huang Shijie wrote:
>  	pr_info("NAND device: Manufacturer ID:"
> -		" 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
> -		nand_manuf_ids[maf_idx].name,
> -		chip->onfi_version ? chip->onfi_params.model : type->name);
> +		" 0x%02x, Chip ID: 0x%02x (%s %s), pagesize: %d, oobsize: %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);

I've amended this to print "page size" and "OOB size" instead, because
this is a bit more user-friendly, and pushed to l2-mtd.git, thanks.

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-22  5:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-09  3:41 [PATCH] mtd : print out the page size and oob size after parsing out the nand Huang Shijie
2012-04-10 10:28 ` Florian Fainelli
2012-04-11  2:01   ` Huang Shijie
2012-04-21 14:21     ` Artem Bityutskiy
2012-04-22  5:15 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).