public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Michel Stempin <michel.stempin@telecom-design.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] [MTD] gen_probe.c: Probe chips in decreasing device size (most significant first)
Date: Sun, 14 Sep 2008 13:09:12 +0200	[thread overview]
Message-ID: <1221390552.25179.14.camel@Mikeul> (raw)

Probe chips in decreasing device size to detect most significant chip
IDs first in case there are two chips with the same LSB.

This case has been found between SST39VF3201 (Mfr: 0x0020, Id: 0x235B)
and SST49LF080A (Mfr: 0x0020, Id: 0x005B) chips.

Signed-off-by: Michel Stempin <michel.stempin@wanadoo.fr>
---
 gen_probe.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/gen_probe.c
b/drivers/mtd/chips/gen_probe.c
index f061885..d1875f8 100644
--- a/drivers/mtd/chips/gen_probe.c
+++ b/drivers/mtd/chips/gen_probe.c
@@ -170,7 +170,7 @@ static int genprobe_new_chip(struct map_info *map,
struct chip_probe *cp,
 {
        int min_chips = (map_bankwidth(map)/4?:1); /* At most 4-bytes
wide. */
        int max_chips = map_bankwidth(map); /* And minimum 1 */
-       int nr_chips, type;
+       int nr_chips, min_type, type;
 
        for (nr_chips = max_chips; nr_chips >= min_chips; nr_chips >>=
1) {
 
@@ -181,9 +181,9 @@ static int genprobe_new_chip(struct map_info *map,
struct chip_probe *cp,
 
                /* Minimum device size. Don't look for one 8-bit device
                   in a 16-bit bus, etc. */
-               type = map_bankwidth(map) / nr_chips;
+               min_type = map_bankwidth(map) / nr_chips;
 
-               for (; type <= CFI_DEVICETYPE_X32; type<<=1) {
+               for (type = CFI_DEVICETYPE_X32; type >= min_type;
type>>=1) {
                        cfi->device_type = type;
 
                        if (cp->probe_chip(map, 0, NULL, cfi))

             reply	other threads:[~2008-09-14 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-14 11:09 Michel Stempin [this message]
2008-10-08 12:46 ` [PATCH] [MTD] gen_probe.c: Probe chips in decreasing device size (most significant first) Josh Boyer

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=1221390552.25179.14.camel@Mikeul \
    --to=michel.stempin@telecom-design.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