All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [U-boot]question: why write bbt and search bbt use different ops mode in nand_bbt.c in U-boot 2013.04?
@ 2013-09-24  2:13 TigerLiu at viatech.com.cn
  2013-09-24 19:53 ` Scott Wood
  0 siblings, 1 reply; 2+ messages in thread
From: TigerLiu at viatech.com.cn @ 2013-09-24  2:13 UTC (permalink / raw)
  To: u-boot

Hi , Scott:

First, My uboot version is 2013.04.

 

In the function scan_write_bbt(), U-boot uses MTD_OOB_PLACE to write BBT
data and BBT pattern. See ">>>" below

 

static int scan_write_bbt(struct mtd_info *mtd, loff_t offs, size_t len,

                              uint8_t *buf, uint8_t *oob)

{

         struct mtd_oob_ops ops;

 

>>>  ops.mode = MTD_OOB_PLACE;

         ops.ooboffs = 0;

         ops.ooblen = mtd->oobsize;

         ops.datbuf = buf;

         ops.oobbuf = oob;

         ops.len = len;

 

         return mtd->write_oob(mtd, offs, &ops);

}

 

while in funtion search_bbt() (actually in function
scan_read_raw_oob()), U-boot uses MTD_OOB_RAW to read BBT data and BBT
pattern. See ">>>" below.

 

static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t
offs,

                            size_t len)

{

         struct mtd_oob_ops ops;

         int res;

 

>>>  ops.mode = MTD_OOB_RAW;

         ops.ooboffs = 0;

         ops.ooblen = mtd->oobsize;

 

 

         while (len > 0) {

                   if (len <= mtd->writesize) {

                            ops.oobbuf = buf + len;

                            ops.datbuf = buf;

                            ops.len = len;

                            return mtd->read_oob(mtd, offs, &ops);

                   } else {

                            ops.oobbuf = buf + mtd->writesize;

                            ops.datbuf = buf;

                            ops.len = mtd->writesize;

                            res = mtd->read_oob(mtd, offs, &ops);

 

                            if (res)

                                     return res;

                   }

 

                   buf += mtd->oobsize + mtd->writesize;

                   len -= mtd->writesize;

         }

         return 0;

}

 

It's confused that search BBT and write BBT uses different mtd ops mode.
And also data will not be valid if U-boot uses mtd ops MTD_OOB_RAW
during reading and no software ECC is implemented. 

I also noticed that in U-boot2013.07 both search BBT and write BBT uses
mtd ops MTD_OPS_PLACE_OOB.

 

Best wishes,

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

* [U-Boot] [U-boot]question: why write bbt and search bbt use different ops mode in nand_bbt.c in U-boot 2013.04?
  2013-09-24  2:13 [U-Boot] [U-boot]question: why write bbt and search bbt use different ops mode in nand_bbt.c in U-boot 2013.04? TigerLiu at viatech.com.cn
@ 2013-09-24 19:53 ` Scott Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2013-09-24 19:53 UTC (permalink / raw)
  To: u-boot

On Tue, 2013-09-24 at 10:13 +0800, TigerLiu at viatech.com.cn wrote:
> It's confused that search BBT and write BBT uses different mtd ops
> mode. And also data will not be valid if U-boot uses mtd ops
> MTD_OOB_RAW during reading and no software ECC is implemented. 
> 
> I also noticed that in U-boot2013.07 both search BBT and write BBT
> uses mtd ops MTD_OPS_PLACE_OOB.

We inherited this code from Linux.  Presumably it was a bug that got
fixed.

-Scott

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

end of thread, other threads:[~2013-09-24 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-24  2:13 [U-Boot] [U-boot]question: why write bbt and search bbt use different ops mode in nand_bbt.c in U-boot 2013.04? TigerLiu at viatech.com.cn
2013-09-24 19:53 ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.