public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: David Woodhouse <dwmw2@infradead.org>
Cc: jwboyer@gmail.com, linux-mtd@lists.infradead.org,
	Corinna Schultz <cschultz@linux.vnet.ibm.com>
Subject: Re: ST M29W320D incorrectly configured
Date: Fri, 31 Oct 2008 21:44:42 -0700	[thread overview]
Message-ID: <m1tzasjbr9.fsf@frodo.ebiederm.org> (raw)
In-Reply-To: 1225463927.16774.106.camel@macbook.infradead.org

David Woodhouse <dwmw2@infradead.org> writes:

> On Wed, 2008-10-29 at 19:53 -0400, Corinna Schultz wrote:
>> I'm having a problem getting the unlock addresses correctly configured  
>> for the ST M29W320D chip. CFI query data is shown below (from  
>> debugging statements I enabled and/or added to the driver). The chip  
>> is wired so that the #BYTE pin is low, putting the chip into x8 mode.  
>> The data bus is physically 8 bits.
>> 
>> I don't understand everything that's going on in the code, but it  
>> seems to me that the following code (taken from cfi_cmdset_0002.c,  
>> which sets the unlock addresses needed for writing and erasing) has a  
>> logic error. Maybe someone can explain it to me?
>> 
>>   if (    /* x16 in x8 mode */
>>      ((cfi->device_type == CFI_DEVICETYPE_X8) &&
>>       (cfi->cfiq->InterfaceDesc == 2))
>> 
>> 
>> The reason I think this is in error is that both the device type and  
>> the interfaceDesc are defined by the hardware, and not indicative of  
>> the mode. Besides, isn't this conditional actually testing if the chip
>> is an X8 chip and supports x8 and x16 async modes?

Ok.  I spent some time trying to understand the confusion.  And after looking
at this the code I don't see how we could possibly have a problem.

The only thing that sets device_type is gen_probe.  gen_probe sets
device_type to: map_bankwidth(map)/nr_chips.  Which is the bus width
the chip experiences.  Not how wide the chip actually is.

So I don't have a clue how you can get a device type of x16.  In a 8 bit wide
bus.

> It would be nice if we could do it that way, but these ST chips don't
> seem to work. When they're in 16-bit mode, they really do need a byte
> address of 0x555 for the second unlock address, not 0x554 (0x2aa*2) as
> every other chip seems to accept. Although it takes _extra_ logic to
> check the input on the 'A-1' pin, they seem to have it.

???  In 16bit mode there isn't an a low address pin so you can't even
express a byte address of 0x555.

David if device_type was actually returned or generated by the hardware
your patch makes sense.  But I can't find anywhere that seems to be
happening.

Now perhaps the proper fix is to rename device_type something like device_bus_width,
so it is clearer what is going.  Beyond that I don't see the need for change.

Eric

  parent reply	other threads:[~2008-11-01  4:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29 23:53 ST M29W320D incorrectly configured Corinna Schultz
2008-10-30 20:33 ` cfi_cmdset_0002.c possible BUG (was Re: ST M29W320D incorrectly configured) Corinna Schultz
2008-10-31 14:38 ` ST M29W320D incorrectly configured David Woodhouse
2008-10-31 22:50   ` Corinna Schultz
2008-11-01  4:44   ` Eric W. Biederman [this message]
2008-11-01  7:18     ` David Woodhouse
2008-11-01  6:33   ` Eric W. Biederman
2008-11-01  7:33     ` David Woodhouse
2008-11-01  8:36       ` Eric W. Biederman
2008-11-01  8:49         ` David Woodhouse
2008-11-01 10:23           ` Eric W. Biederman
2008-11-01 10:29             ` [PATCH 1/2] mtd: Fix cfi_send_gen_cmd the handling of x16 devices in x8 mode Eric W. Biederman
2008-11-01 10:31               ` [PATCH 2/2] mtd: Simplify cfi_send_gen_cmd Eric W. Biederman
2008-11-01 10:43               ` [PATCH 1/2] mtd: Fix cfi_send_gen_cmd the handling of x16 devices in x8 mode David Woodhouse
2008-11-01 10:58                 ` David Woodhouse
2008-11-01 11:26                   ` Eric W. Biederman
2008-11-01 11:19               ` [PATCH] mtd: Fix cfi_send_gen_cmd the handling of x16 devices in x8 mode v4 Eric W. Biederman
2008-11-01  7:04   ` ST M29W320D incorrectly configured Eric W. Biederman

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=m1tzasjbr9.fsf@frodo.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=cschultz@linux.vnet.ibm.com \
    --cc=dwmw2@infradead.org \
    --cc=jwboyer@gmail.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