public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] bad block table stored in nand flash
Date: Wed, 27 Jan 2010 12:28:54 -0600	[thread overview]
Message-ID: <20100127182854.GA6755@loki.buserror.net> (raw)
In-Reply-To: <4B603A4E.3010707@local.elnec.sk>

On Wed, Jan 27, 2010 at 02:06:22PM +0100, Ing. Jozef Goril wrote:
> Later, in function write_bbt, there is a code that converts RAM-based BBT to 
> flash-based one at lines 720-730.
> For line
> buf[offs + (i >> sft)] &= ~(msk[dat & 0x03] << sftcnt);
> 
> I cannot understand the case, if (dat&0x03) == 10b (reserved block).
> In that case, msk[2] value should be used.
> The value of msk[2] is set few lines above (line 649): msk[2] = ~rcode;
> The value of rcode is set at time of declaration:
> rcode = td->reserved_block_code;
> 
> Now, in case of reserved_block_code == 01b:
> rcode = 0x02;
> msk[2] = ~rcode = ~0x02 = FD;
> 
> Regarding to line
> buf[offs + (i >> sft)] &= ~(msk[dat & 0x03] << sftcnt);
> 
> it should be shifted left by sftcnt bits (sftcnt can be [0,2,4,6]).
> I.e. that the value in the parenthesis on the left side can be of
> [FD,F4,D0,40]. After negation: [02,0B,2F,BF].
> These are values, that original byte in buffer can be ANDed with. Since there 
> are zeros on higher bits position (over mask 11b), this ANDing will destroy the 
> block status information of some blocks using the same byte. 00b in flash means 
> invalid block...
> 
> Am I missing something important or is there a bug?

This code came from Linux; I'd try asking on linux-mtd at lists.infradead.org.

-Scott

      parent reply	other threads:[~2010-01-27 18:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 13:06 [U-Boot] bad block table stored in nand flash Ing. Jozef Goril
2010-01-27 13:25 ` Ing. Jozef Goril
2010-01-27 18:28 ` Scott Wood [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100127182854.GA6755@loki.buserror.net \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox