public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Proposal: allow reading oob with AUTOPLACE
@ 2005-10-19  1:08 Charles Manning
  0 siblings, 0 replies; only message in thread
From: Charles Manning @ 2005-10-19  1:08 UTC (permalink / raw)
  To: linux-mtd

Hi folks

As has been discussed in various places, it would be nice to be able to read 
oob with AUTOPLACE, without reading the whole data page too. At present there 
is no way to do this.

Having this capability is quite important to YAFFS2 since it allows the tags 
(in oob) to be scanned without having to do the extra (useless) work of 
dummy-reading the data. Currently people have to manually fiddle around to 
get the required semantics.

There are three ways I can see to achieve this:

1) Change the semantics of read_oob(). That would work, but would break anyone 
expecting read_oob() to have its current semantics of reading raw.

2) Change read_oob() to take an oobsel argument to allow reading raw or 
AUTOPLACE or whatever. That would break some code, but very little. At least 
it would be obvious where something needs fixing (whereas (1) does not make 
it obvious).

3) Change read_ecc() to allow passing in a NULL data buf pointer to indicate 
that only the oob should be read.

Personally, I think 2 is neatest from an interface perspective, but 3 breaks 
the least and 1 is the worst because semantics change in an uncontrolled way. 
However, this is a personal taste issue and I will be happy with any solution 
that gives the function.

I have below an**untested** patch for option 3 - sorry folk; no hw == no test. 
I wrote this with the intent of seeing how traumatic the changes might be, 
rather than try build shippable code.

I expect the patch does not conform to guidelines, but I hope not to get a 
public flogging.

diff /opt/mtd_virgin/drivers/mtd/nand/nand_base.c /opt/mtd/drivers/mtd/nand/nand_base.c
1118a1119
>       int oob_only, oob_once;
1147a1149,1150
>       oob_once = oob_only = (!buf); /* buf is NULL, so only reading OOB */
>               
1174c1177
<       while (read < len) {
---
>       while (read < len || oob_once) {
1200c1203
<                       this->cmdfunc (mtd, NAND_CMD_READ0, 0x00, page);
---
>                       this->cmdfunc (mtd, (oob_only) ? NAND_CMD_READOOB : 
NAND_CMD_READ0, 0x00, page);
1201a1205
>                       oob_once = 0;
1208a1213
>               
1210a1216,1218
>               if(oob_only)
>                       goto read_oob_data;
>                       
1256a1265
> read_oob_data:
1260c1269
<               if (!compareecc)
---
>               if (!compareecc || oob_only)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-19  1:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-19  1:08 Proposal: allow reading oob with AUTOPLACE Charles Manning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox