* [PATCH] [MTD] [NAND] nand_base.c: reset chip first
@ 2008-09-15 12:37 Karl Beldan
2008-09-15 14:08 ` Karl Beldan
2008-09-16 10:10 ` Ben Dooks
0 siblings, 2 replies; 4+ messages in thread
From: Karl Beldan @ 2008-09-15 12:37 UTC (permalink / raw)
To: linux-mtd; +Cc: David.Woodhouse
Some chips require a RESET after power-up (e.g. Micron MT29FxGxxxxx).
The first command sent is NAND_CMD_READID.
Issue a NAND_CMD_RESET in nand_scan_ident before reading the device id.
Tested with an MT29F4G08AAC.
Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
---
Prior to resetting, the chip gives a correct first ID byte though.
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d1129ba..2cfac9b 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2318,6 +2318,12 @@ static struct nand_flash_dev
*nand_get_flash_type(struct mtd_info *mtd,
/* Select the device */
chip->select_chip(mtd, 0);
+ /*
+ * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
+ * after power-up
+ */
+ chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
+
/* Send the command for reading device ID */
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
@@ -2488,6 +2494,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
/* Check for a chip array */
for (i = 1; i < maxchips; i++) {
chip->select_chip(mtd, i);
+ /* See comment in nand_get_flash_type for reset */
+ chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
/* Send the command for reading device ID */
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
/* Read manufacturer and device IDs */
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] [MTD] [NAND] nand_base.c: reset chip first
2008-09-15 12:37 [PATCH] [MTD] [NAND] nand_base.c: reset chip first Karl Beldan
@ 2008-09-15 14:08 ` Karl Beldan
2008-09-16 10:10 ` Ben Dooks
1 sibling, 0 replies; 4+ messages in thread
From: Karl Beldan @ 2008-09-15 14:08 UTC (permalink / raw)
To: linux-mtd; +Cc: David.Woodhouse
Some chips require a RESET after power-up (e.g. Micron MT29FxGxxxxx).
The first command sent is NAND_CMD_READID.
Issue a NAND_CMD_RESET in nand_scan_ident before reading the device id.
Tested with an MT29F4G08AAC.
Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
---
Prior to resetting, the chip gives a correct first ID byte though.
Resubmitted without(?) mail client formatting.
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d1129ba..2cfac9b 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2318,6 +2318,12 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
/* Select the device */
chip->select_chip(mtd, 0);
+ /*
+ * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
+ * after power-up
+ */
+ chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
+
/* Send the command for reading device ID */
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
@@ -2488,6 +2494,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
/* Check for a chip array */
for (i = 1; i < maxchips; i++) {
chip->select_chip(mtd, i);
+ /* See comment in nand_get_flash_type for reset */
+ chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
/* Send the command for reading device ID */
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
/* Read manufacturer and device IDs */
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] [MTD] [NAND] nand_base.c: reset chip first
2008-09-15 12:37 [PATCH] [MTD] [NAND] nand_base.c: reset chip first Karl Beldan
2008-09-15 14:08 ` Karl Beldan
@ 2008-09-16 10:10 ` Ben Dooks
2008-09-16 11:55 ` Karl Beldan
1 sibling, 1 reply; 4+ messages in thread
From: Ben Dooks @ 2008-09-16 10:10 UTC (permalink / raw)
To: Karl Beldan; +Cc: linux-mtd, David.Woodhouse
On Mon, Sep 15, 2008 at 02:37:29PM +0200, Karl Beldan wrote:
> Some chips require a RESET after power-up (e.g. Micron MT29FxGxxxxx).
> The first command sent is NAND_CMD_READID.
> Issue a NAND_CMD_RESET in nand_scan_ident before reading the device id.
> Tested with an MT29F4G08AAC.
This seems sensible to me, we don't really know what state the NAND
chip is in.
Does there need to be a delay after sending the reset command before
attempting to read the chip's identity?
> Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
> ---
> Prior to resetting, the chip gives a correct first ID byte though.
>
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index d1129ba..2cfac9b 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2318,6 +2318,12 @@ static struct nand_flash_dev
> *nand_get_flash_type(struct mtd_info *mtd,
> /* Select the device */
> chip->select_chip(mtd, 0);
>
> + /*
> + * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
> + * after power-up
> + */
> + chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
> +
> /* Send the command for reading device ID */
> chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
>
> @@ -2488,6 +2494,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
> /* Check for a chip array */
> for (i = 1; i < maxchips; i++) {
> chip->select_chip(mtd, i);
> + /* See comment in nand_get_flash_type for reset */
> + chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
> /* Send the command for reading device ID */
> chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
> /* Read manufacturer and device IDs */
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] [MTD] [NAND] nand_base.c: reset chip first
2008-09-16 10:10 ` Ben Dooks
@ 2008-09-16 11:55 ` Karl Beldan
0 siblings, 0 replies; 4+ messages in thread
From: Karl Beldan @ 2008-09-16 11:55 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-mtd, David.Woodhouse
Ben Dooks wrote:
> On Mon, Sep 15, 2008 at 02:37:29PM +0200, Karl Beldan wrote:
>> Some chips require a RESET after power-up (e.g. Micron MT29FxGxxxxx).
>> The first command sent is NAND_CMD_READID.
>> Issue a NAND_CMD_RESET in nand_scan_ident before reading the device id.
>> Tested with an MT29F4G08AAC.
>
> This seems sensible to me, we don't really know what state the NAND
> chip is in.
>
> Does there need to be a delay after sending the reset command before
> attempting to read the chip's identity?
>
There's the tWB + tRST delay which is handled by the CMD_RESET case in
nand_command if that's what you were thinking of.
Tested both R/B and STATUS_READY code paths.
>> Signed-off-by: Karl Beldan <karl.beldan@gmail.com>
>> ---
>> Prior to resetting, the chip gives a correct first ID byte though.
>>
>>
>> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
>> index d1129ba..2cfac9b 100644
>> --- a/drivers/mtd/nand/nand_base.c
>> +++ b/drivers/mtd/nand/nand_base.c
>> @@ -2318,6 +2318,12 @@ static struct nand_flash_dev
>> *nand_get_flash_type(struct mtd_info *mtd,
>> /* Select the device */
>> chip->select_chip(mtd, 0);
>>
>> + /*
>> + * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx)
>> + * after power-up
>> + */
>> + chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
>> +
>> /* Send the command for reading device ID */
>> chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
>>
>> @@ -2488,6 +2494,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips)
>> /* Check for a chip array */
>> for (i = 1; i < maxchips; i++) {
>> chip->select_chip(mtd, i);
>> + /* See comment in nand_get_flash_type for reset */
>> + chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
>> /* Send the command for reading device ID */
>> chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
>> /* Read manufacturer and device IDs */
>>
>> ______________________________________________________
>> Linux MTD discussion mailing list
>> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
--
Karl
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-16 11:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-15 12:37 [PATCH] [MTD] [NAND] nand_base.c: reset chip first Karl Beldan
2008-09-15 14:08 ` Karl Beldan
2008-09-16 10:10 ` Ben Dooks
2008-09-16 11:55 ` Karl Beldan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox