From: ebiederman@lnxi.com (Eric W. Biederman)
To: Ben Dooks <ben-mtd@fluff.org>
Cc: ben@fluff.org, linux-mtd@lists.infradead.org
Subject: Re: Fix to jedec_probe unlock addresses
Date: 22 Sep 2004 19:48:40 -0600 [thread overview]
Message-ID: <m3brfxycuf.fsf@maxwell.lnxi.com> (raw)
In-Reply-To: <20040920234450.GA17169@home.fluff.org>
Ben Dooks <ben-mtd@fluff.org> writes:
> Fix unlock address calculation for non-x8 chips for the
> cfi cmdset code, which assumes always X8
>
> Patch against 2.6.9-rc2 with 19th September CVS
>
> Signed-off-by: Ben Dooks <ben-mtd@fluff.org>
>
> --- linux-2.6.9-rc2-bk6-mtd20040919/drivers/mtd/chips/jedec_probe.c 2004-09-20
> 13:02:46.000000000 +0100
>
> +++ linux-2.6.9-rc2-bk6-mtd20040919-work/drivers/mtd/chips/jedec_probe.c
> 2004-09-20 23:21:40.000000000 +0100
>
> @@ -2046,7 +2046,15 @@
> printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
> map->name, cfi_interleave(cfi), cfi->device_type*8, base,
> map->bankwidth*8);
> -
> +
> + /* fixup unlock addresses for the cmdset */
> +
> + cfi->addr_unlock1 *= cfi_interleave(cfi) * cfi->device_type;
> + cfi->addr_unlock2 *= cfi_interleave(cfi) * cfi->device_type;
> +
> + printk(KERN_DEBUG "unlocks at %08x,%08x\n",
> + cfi->addr_unlock1, cfi->addr_unlock2);
> +
> return 1;
> }
Hmm. I think that points out a real issue but I think the bug actually
lies in cfi_cmdset_0002.
That fix makes below comment from cfi_cmdset_0002 clearly wrong.
/*
* The CFI_DEVICETYPE_X8 argument is needed even when
* cfi->device_type != CFI_DEVICETYPE_X8. The addresses for
* command sequences don't scale even when the device is
* wider. This is the case for many of the cfi_send_gen_cmd()
* below. I'm not sure, however, why some use
* cfi->device_type.
*/
So I think it is more likely we need to change this hunk of code below.
/*
* These might already be setup (more correctly) by
* jedec_probe.c - still need it for cfi_probe.c path.
*/
if ( ! (cfi->addr_unlock1 && cfi->addr_unlock2) ) {
switch (cfi->device_type) {
case CFI_DEVICETYPE_X8:
cfi->addr_unlock1 = 0x555;
cfi->addr_unlock2 = 0x2aa;
break;
case CFI_DEVICETYPE_X16:
cfi->addr_unlock1 = 0xaaa;
if (map_bankwidth(map) == cfi_interleave(cfi)) {
/* X16 chip(s) in X8 mode */
cfi->addr_unlock2 = 0x555;
} else {
cfi->addr_unlock2 = 0x554;
}
break;
case CFI_DEVICETYPE_X32:
cfi->addr_unlock1 = 0x1554;
if (map_bankwidth(map) == cfi_interleave(cfi)*2) {
/* X32 chip(s) in X16 mode */
cfi->addr_unlock1 = 0xaaa;
} else {
cfi->addr_unlock2 = 0xaa8;
}
break;
default:
printk(KERN_WARNING
"MTD %s(): Unsupported device type %d\n",
__func__, cfi->device_type);
kfree(mtd);
kfree(extp);
return NULL;
}
}
Does anyone have cfi cmdset 0002 devices in an interleaved configuration
who would care to comment?
Eric
next prev parent reply other threads:[~2004-09-23 1:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-20 23:44 Fix to jedec_probe unlock addresses Ben Dooks
2004-09-23 1:48 ` Eric W. Biederman [this message]
2004-09-23 21:01 ` Ben Dooks
2004-09-23 21:36 ` Eric W. Biederman
2004-09-24 4:29 ` [CFT] FIX CFI cmdset 0002 for x16 and x32 devices Eric W. Biederman
2004-09-28 12:15 ` Ben Dooks
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=m3brfxycuf.fsf@maxwell.lnxi.com \
--to=ebiederman@lnxi.com \
--cc=ben-mtd@fluff.org \
--cc=ben@fluff.org \
--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 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.