mtd: nand: reintroduce NAND_NO_READRDY as NAND_NEED_READRDY
Subsystems (2)
RFC 1/1 mtd: nand: reintroduce NAND_NO_READRDY as NAND_NEED_READRDY
This (somewhat) reverts commit 1696e6bc2ae83734e64e206ac99766ea19e9a14e.
In the patch "mtd: nand: kill NAND_NO_READRDY", I overlooked a few things.
The original documentation for NAND_NO_READRDY included "True for all large page devices, as they do not support autoincrement." I was conflating "not support autoincrement" with the NAND_NO_AUTOINCR option, which was in fact doing nothing. So, when I dropped NAND_NO_AUTOINCR, I concluded that I then could harmlessly drop NAND_NO_READRDY. But of course the fact the NAND_NO_AUTOINCR was doing nothing didn't mean NAND_NO_READRDY was doing nothing...
So, NAND_NO_READRDY is re-introduced as NAND_NEED_READRDY and applied only to those few remaining small-page NAND which needed it in the first place.
This is probably a candidate for stable, but there will certainly be conflicts, as drivers/mtd/nand/nand_ids.c has changed significantly.
Compile-tested only; I don't have a setup that requires this.
---
This is an attempt at a version 2 of Alexander's RFC patch. I feel like the original (per NAND chip type) option makes more sense than per driver (where Alexander sets this option only for the diskonchip driver). But it is certainly more invasive. And apparently, no one else needs this option (or at least, no one complains). Perhaps everyone has just moved beyond small-page NAND?
drivers/mtd/nand/nand_base.c | 16 +++++++++++ drivers/mtd/nand/nand_ids.c | 60 +++++++++++++++++++++--------------------- include/linux/mtd/nand.h | 8 ++++++ 3 files changed, 54 insertions(+), 30 deletions(-)
drivers/mtd/nand/nand_base.c +16 -0
@@ -1550,6 +1550,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, oobreadlen -= toread; } } + +if (chip->options &NAND_NEED_READRDY ) { +/* Apply delay or wait for ready/busy pin */ +if (!chip->dev_ready) +udelay (chip->chip_delay); +else +nand_wait_ready (mtd); + } }else {memcpy (buf, chip->buffers->databuf + col, bytes); buf += bytes;
@@ -1814,6 +1822,14 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, len =min (len, readlen); buf =nand_transfer_oob (chip, buf, ops, len); +if (chip->options &NAND_NEED_READRDY ) { +/* Apply delay or wait for ready/busy pin */ +if (!chip->dev_ready) +udelay (chip->chip_delay); +else +nand_wait_ready (mtd); + } + readlen -= len;if (!readlen)break ;
drivers/mtd/nand/nand_ids.c +30 -30
66 lines not on this page · raw message
include/linux/mtd/nand.h +8 -0
@@ -147,6 +147,14 @@ typedef enum {#define NAND_BUSWIDTH_16 0x00000002/* Chip has cache program function */ #define NAND_CACHEPRG 0x00000008 + +/* +* Chip requires ready check on read (for auto-incremented sequential read). +* True only for small page devices; large page devices do not support +* autoincrement. +*/ +#define NAND_NEED_READRDY 0x00000100 +/* Chip does not allow subpage writes */ #define NAND_NO_SUBPAGE_WRITE 0x00000200
Signature · 1 line
1.7.9.5
Quoted 5 lines · Brian Norris
This is an attempt at a version 2 of Alexander's RFC patch. I feel like the original (per NAND chip type) option makes more sense than per driver (where Alexander sets this option only for the diskonchip driver). But it is certainly more invasive. And apparently, no one else needs this option (or at least, no one complains). Perhaps everyone has just moved beyond small-page NAND?
I'm sorry, I meant to send this is a reply to Alexander's patch. See his RFC and RFC RESEND:
http://lists.infradead.org/pipermail/linux-mtd/2013-March/046024.html
http://lists.infradead.org/pipermail/linux-mtd/2013-March/046159.html
Brian
Hello.
Quoted 17 lines
This (somewhat) reverts commit
1696e6bc2ae83734e64e206ac99766ea19e9a14e.In the patch "mtd: nand: kill
NAND_NO_READRDY", I overlooked a few things.The original documentation for
NAND_NO_READRDYincluded "True for all large page devices, as they do not support autoincrement." I was conflating "not support autoincrement" with theNAND_NO_AUTOINCRoption, which was in fact doing nothing. So, when I droppedNAND_NO_AUTOINCR, I concluded that I then could harmlessly dropNAND_NO_READRDY. But of course the fact theNAND_NO_AUTOINCRwas doing nothing didn't meanNAND_NO_READRDYwas doing nothing...So,
NAND_NO_READRDYis re-introduced asNAND_NEED_READRDYand applied only to those few remaining small-page NAND which needed it in the first place.
Quoted 7 lines
This is probably a candidate for stable, but there will certainly be conflicts, as
drivers/mtd/nand/nand_ids.chas changed significantly.Compile-tested only; I don't have a setup that requires this.
Reported-by Alexander Shiyan <[email protected]>Signed-off-by Brian Norris <[email protected]>
Thanks. I will check this version tomorrow.
---
Quoted 24 lines
This (somewhat) reverts commit
1696e6bc2ae83734e64e206ac99766ea19e9a14e.In the patch "mtd: nand: kill
NAND_NO_READRDY", I overlooked a few things.The original documentation for
NAND_NO_READRDYincluded "True for all large page devices, as they do not support autoincrement." I was conflating "not support autoincrement" with theNAND_NO_AUTOINCRoption, which was in fact doing nothing. So, when I droppedNAND_NO_AUTOINCR, I concluded that I then could harmlessly dropNAND_NO_READRDY. But of course the fact theNAND_NO_AUTOINCRwas doing nothing didn't meanNAND_NO_READRDYwas doing nothing...So,
NAND_NO_READRDYis re-introduced asNAND_NEED_READRDYand applied only to those few remaining small-page NAND which needed it in the first place.This is probably a candidate for stable, but there will certainly be conflicts, as
drivers/mtd/nand/nand_ids.chas changed significantly.Compile-tested only; I don't have a setup that requires this.
Reported-by Alexander Shiyan <[email protected]>Signed-off-by Brian Norris <[email protected]>
Quoted 7 lines
---
This is an attempt at a version 2 of Alexander's RFC patch. I feel like the original (per NAND chip type) option makes more sense than per driver (where Alexander sets this option only for the diskonchip driver). But it is certainly more invasive. And apparently, no one else needs this option (or at least, no one complains). Perhaps everyone has just moved beyond small-page NAND?
...
Tested today with 3 DiskOnChip devices which contain following chips:
NAND device: Manufacturer ID: 0x98, Chip ID: 0x75 (Toshiba NAND 32MiB 3,3V 8-bit), 32MiB, page size: 512, OOB size: 16 NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit), 32MiB, page size: 512, OOB size: 16 NAND device: Manufacturer ID: 0x98, Chip ID: 0xe6 (Toshiba NAND 8MiB 3,3V 8-bit), 8MiB, page size: 512, OOB size: 16
All OK. Thanks.
---
Quoted 11 lines · Alexander Shiyan
Quoted 4 lines
This (somewhat) reverts commit
1696e6bc2ae83734e64e206ac99766ea19e9a14e.In the patch "mtd: nand: kill
NAND_NO_READRDY", I overlooked a few things...Tested today with 3 DiskOnChip devices which contain following chips:
NAND device: Manufacturer ID:0x98, Chip ID:0x75(Toshiba NAND 32MiB 3,3V 8-bit), 32MiB, page size: 512, OOB size: 16 NAND device: Manufacturer ID:0xec, Chip ID:0x75(Samsung NAND 32MiB 3,3V 8-bit), 32MiB, page size: 512, OOB size: 16 NAND device: Manufacturer ID:0x98, Chip ID:0xe6(Toshiba NAND 8MiB 3,3V 8-bit), 8MiB, page size: 512, OOB size: 16All OK. Thanks.
For 3.9 (and cc stable) then?
Signature · 1 line
dwmw2
drivers/mtd/nand/nand_base.c static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, · line 1560
Quoted 7 lines · Brian Norris
drivers/mtd/nand/nand_base.c +7
-0+if (chip->options &NAND_NEED_READRDY ) { +/* Apply delay or wait for ready/busy pin */ +if (!chip->dev_ready) +udelay (chip->chip_delay); +else +nand_wait_ready (mtd); + }
Am I right that this is a small page NAND-specific thing? If yes, can we just this magic to all small page NANDs without introducing the option?
Also, irrespectively of the final solution, let's do it this way:
1. Create a patch against the 3.9-rc2, not l2-mtd.git, and test it.
2. Add Cc stable, just like David asked.
2. Bug David to merge it.
3. I rebase the l2 tree on top of that.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 11 lines · Artem Bityutskiy
drivers/mtd/nand/nand_base.c static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, · line 1560
Quoted 7 lines · Brian Norris
drivers/mtd/nand/nand_base.c +7
-0+if (chip->options &NAND_NEED_READRDY ) { +/* Apply delay or wait for ready/busy pin */ +if (!chip->dev_ready) +udelay (chip->chip_delay); +else +nand_wait_ready (mtd); + }Am I right that this is a small page NAND-specific thing? If yes, can we just this magic to all small page NANDs without introducing the option?
Probably, but the option flag is the cleaner way of doing it. Yes, it's a slightly more intrusive patch right now, but it's nicer.
Quoted 6 lines
Also, irrespectively of the final solution, let's do it this way:
1. Create a patch against the 3.9-rc2, not l2-mtd.git, and test it.
2. Add Cc stable, just like David asked.
2. Bug David to merge it.
3. I rebase the l2 tree on top of that.
I've got a couple of (unrelated) patches in linux-mtd.git which I was about to send to Linus for 3.9. Let's put it on top of that and I'll send the whole lot together.
Signature · 1 line
dwmw2
Quoted 4 lines · David Woodhouse
I've got a couple of (unrelated) patches in linux-mtd.git which I was about to send to Linus for 3.9. Let's put it on top of that and I'll send the whole lot together.
Alexander, please could you retest the version I've just pushed out to linux-mtd.git?
Thanks.
http://git.infradead.org/linux-mtd.git/commitdiff/5bc7c33ca
Signature · 1 line
dwmw2
Alexander Shiyan
Tested-byQuoted 6 lines · David Woodhouse
Quoted 4 lines
I've got a couple of (unrelated) patches in linux-mtd.git which I was about to send to Linus for 3.9. Let's put it on top of that and I'll send the whole lot together.
Quoted 6 lines
Alexander, please could you retest the version I've just pushed out to linux-mtd.git?
Thanks.
All OK.
---
Quoted 6 lines · David Woodhouse
Quoted 4 lines · David Woodhouse
I've got a couple of (unrelated) patches in linux-mtd.git which I was about to send to Linus for 3.9. Let's put it on top of that and I'll send the whole lot together.
Quoted 6 lines
Alexander, please could you retest the version I've just pushed out to linux-mtd.git?
Thanks.
Your modified versions looks good to me. Thanks for taking this.
Brian