From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lpp01m010-f49.google.com ([209.85.215.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SLrh8-0002lY-Tx for linux-mtd@lists.infradead.org; Sun, 22 Apr 2012 07:58:59 +0000 Received: by lagy4 with SMTP id y4so9494941lag.36 for ; Sun, 22 Apr 2012 00:58:50 -0700 (PDT) Date: Sun, 22 Apr 2012 10:58:44 +0300 From: Shmulik Ladkani To: Brian Norris , Mike Dunn Subject: Re: [PATCH 1/2] mtd: nand: add OOB argument to NAND {read, write}_page interfaces Message-ID: <20120422105844.7f131f90@pixies.home.jungo.com> In-Reply-To: References: <1334615755-15418-1-git-send-email-computersforpeace@gmail.com> <1334615755-15418-2-git-send-email-computersforpeace@gmail.com> <4F8D20C4.9010607@parrot.com> <4F904238.4070600@newsguy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Cc: "linux-mtd@lists.infradead.org" , prabhakar@freescale.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, 19 Apr 2012 15:06:33 -0700 Brian Norris wrote: > On Thu, Apr 19, 2012 at 9:50 AM, Mike Dunn wrote: > > On 04/17/2012 08:44 PM, Brian Norris wrote: > > > >> Now, in future revisions of this ASIC, it may be possible to access > >> OOB via DMA as well, but even if this happens, it doesn't make a lot > >> of sense on this hardware to *always* pull OOB data. > > > > > > No, it doesn't. In fact, I'm not aware of any code within or on top of = mtd that > > does anything with the oob data when a page is read. If oob is needed, > > mtd_read_oob() is used. >=20 > I guess this may not be an issue for page read, but I know one use for > write_page data+OOB. MLC NAND, for instance, requires that you write > *once* to a page, so I introduced ioctl(MEMWRITE) which generically > allows page, OOB, or both to be written. This trickles down to the > nand_ecc_ctrl.write_page function, I think. There are probably other > cases that I'm not really thinking of right now. =46rom MTD user's perspective, mtd_read() and mtd_write() interfaces do not expose the OOB to the user at all. OTHO, mtd_read_oob() and mtd_write_oob() allow the user to read/write either the OOB on its own (NULL 'ops->datbuf'), or the page data along with its accompanying OOB (non-null 'ops->datbuf' and 'ops->oobbuf'). There are few users of the mtd_read_oob/mtd_write_oob interfaces that provide a non-null 'ops->datbuf': - nand_bbt.c - MEMWRITE mtdchar ioctl - mtdswap.c - sm_ftl.c - yaffs2 (out-of-tree) Regards, Shmulik