public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Ken Gordon" <ken@magneticscrolls.com>
To: <linux-mtd@lists.infradead.org>
Subject: More protection register fun.
Date: Thu, 19 Jun 2003 13:07:14 +0100	[thread overview]
Message-ID: <003701c3365b$52c1eaf0$1207a8c0@kenlap> (raw)

from cfi_intelext_read_prot_reg in cfi_cmdset_0001.c (in CVS)

        int ofs_factor = cfi->interleave * cfi->device_type;


                while (count && ((offst-base_offst) < reg_sz)) {
                        *buf =
map_read8(map,(chip->start+((extp->ProtRegAddr+1)*ofs_factor)+offst));
                        buf++;
                        offst++;
                        count--;
                }

In my case (2x Intel Strataflash J3 on a PXA255, configured as 2x16 bit on a
32 bit bus):

    interleave = 2
    device_type = 2

    so ofs_factor = 4

    Now ProtRegAddr is 0x100 and appears to be a byte address within the
device. Now I don't claim any understanding of what device_type means and I
can only test this on hardware I have so can someone who fully uderstands
this code say whether it ought to be more like:

while (count && ((offst-base_offst) < reg_sz)) {
                       *buf =
map_read8(map,(chip->start+((extp->ProtRegAddr+2)*cfi->interleave)+offst));
// also +2 not +1 'cos the lock register is 16 bits
                       buf++;
                       offst++;
                       count--;
               }

Actually this doen't really work either 'cos it gets the same bytes for each
of the two chips.

Any ideas (I'm about to hack my one for my hardware and stop spending time
on this)

    Ken

                 reply	other threads:[~2003-06-19 12:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='003701c3365b$52c1eaf0$1207a8c0@kenlap' \
    --to=ken@magneticscrolls.com \
    --cc=linux-mtd@lists.infradead.org \
    /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