public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* cfi_cmdset_0001.c: do_write_buffer: wrong length
@ 2000-12-08 14:45 David Vrabel
  2000-12-08 18:21 ` Nicolas Pitre
  0 siblings, 1 reply; 7+ messages in thread
From: David Vrabel @ 2000-12-08 14:45 UTC (permalink / raw)
  To: mtd

Hi,

In cfi_cmdset_0001.c do_write_buffer writes an incorrect length to the
chip

    cfi_write(map, CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),
cmd_adr);

which with 1 x16 chip in x8 mode eg on the SBC-MediaGX (buswidth == 1;
interleave == 1; 
devicetype == 2) works out as

    cfi_write(map, CMD(len/2-1), cmd_adr); <-- Fails

When it should be

    cfi_write(map, CMD(len-1), cmd_adr); <-- Works

Should it it be?
    cfi_write(map, CMD(len/map->buswidth-1), cmd_adr);

David Vrabel



To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfi_cmdset_0001.c: do_write_buffer: wrong length
  2000-12-08 14:45 cfi_cmdset_0001.c: do_write_buffer: wrong length David Vrabel
@ 2000-12-08 18:21 ` Nicolas Pitre
  2000-12-08 19:56   ` D. Vrabel
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Pitre @ 2000-12-08 18:21 UTC (permalink / raw)
  To: David Vrabel; +Cc: mtd



On Fri, 8 Dec 2000, David Vrabel wrote:

> Hi,
>
> In cfi_cmdset_0001.c do_write_buffer writes an incorrect length to the
> chip
>
>     cfi_write(map, CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),
> cmd_adr);
>
> which with 1 x16 chip in x8 mode eg on the SBC-MediaGX (buswidth == 1;
> interleave == 1;
> devicetype == 2) works out as
>
>     cfi_write(map, CMD(len/2-1), cmd_adr); <-- Fails
>
> When it should be
>
>     cfi_write(map, CMD(len-1), cmd_adr); <-- Works
>
> Should it it be?
>     cfi_write(map, CMD(len/map->buswidth-1), cmd_adr);

No.  This will break the case where the interleave isn't 1.

Hmmm... Will it?

Euh...  Each time I get around this question I get confused...

Does someone have the data sheet nearby? (I don't ATM)...  What should the
lenght be if a x16 chip is used in x8 mode?  bytes/sizeof(char) or
bytes/sizeof(short)?

On a 2 x16 arrangement you have buswidth=4, interleave=2, devicetype=2.  In
that case it should be len/4 - 1.

Maybe you are right after all.


Nicolas



To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfi_cmdset_0001.c: do_write_buffer: wrong length
  2000-12-08 18:21 ` Nicolas Pitre
@ 2000-12-08 19:56   ` D. Vrabel
  2000-12-18 22:13     ` Shane Nay
  2000-12-18 22:24     ` Shane Nay
  0 siblings, 2 replies; 7+ messages in thread
From: D. Vrabel @ 2000-12-08 19:56 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: mtd

Hi,

Nicolas Pitre wrote:
> 
> On Fri, 8 Dec 2000, David Vrabel wrote:
> >
> > In cfi_cmdset_0001.c do_write_buffer writes an incorrect length to the
> > chip
> >
> >     cfi_write(map, CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),
> >         cmd_adr);
> >
> > Should it it be?
> >     cfi_write(map, CMD(len/map->buswidth-1), cmd_adr);
> 
> No.  This will break the case where the interleave isn't 1.
> 
> Hmmm... Will it?
> 
> Euh...  Each time I get around this question I get confused...
> 
> Does someone have the data sheet nearby? (I don't ATM)...  What should the
> lenght be if a x16 chip is used in x8 mode?  bytes/sizeof(char) or
> bytes/sizeof(short)?
> 
> On a 2 x16 arrangement you have buswidth=4, interleave=2, devicetype=2.  In
> that case it should be len/4 - 1.
> 
> Maybe you are right after all.

Time to compile a big list of all the arrangements of chips and the
resultant buffer write length...

So far we have:

device type  interleave  bus width    buf write len
2 (x16)      1           1 (x8)       len/1-1
2 (x16)      1           2 (x16)      len/2-1
2 (x16)      2           4 (x32)      len/4-1

So far it len/buswidth-1...

David Vrabel


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfi_cmdset_0001.c: do_write_buffer: wrong length
  2000-12-08 19:56   ` D. Vrabel
@ 2000-12-18 22:13     ` Shane Nay
  2000-12-18 22:24     ` Shane Nay
  1 sibling, 0 replies; 7+ messages in thread
From: Shane Nay @ 2000-12-18 22:13 UTC (permalink / raw)
  To: D. Vrabel, Nicolas Pitre; +Cc: mtd

On Friday 08 December 2000 19:56, D. Vrabel wrote:
> Hi,
>
> Nicolas Pitre wrote:
> > On Fri, 8 Dec 2000, David Vrabel wrote:
> > > In cfi_cmdset_0001.c do_write_buffer writes an incorrect length to the
> > > chip
> > >
> > >     cfi_write(map, CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),
> > >         cmd_adr);
> > >
> > > Should it it be?
> > >     cfi_write(map, CMD(len/map->buswidth-1), cmd_adr);
> >
> > No.  This will break the case where the interleave isn't 1.
> >
> > Hmmm... Will it?
> >
> > Euh...  Each time I get around this question I get confused...
> >
> > Does someone have the data sheet nearby? (I don't ATM)...  What should
> > the lenght be if a x16 chip is used in x8 mode?  bytes/sizeof(char) or
> > bytes/sizeof(short)?
> >
> > On a 2 x16 arrangement you have buswidth=4, interleave=2, devicetype=2. 
> > In that case it should be len/4 - 1.
> >
> > Maybe you are right after all.
>
> Time to compile a big list of all the arrangements of chips and the
> resultant buffer write length...
>
> So far we have:
>
> device type  interleave  bus width    buf write len
> 2 (x16)      1           1 (x8)       len/1-1
> 2 (x16)      1           2 (x16)      len/2-1
> 2 (x16)      2           4 (x32)      len/4-1
>
> So far it len/buswidth-1...


Yea..., this is what I was _trying_ to say, but communicated very poorly 
about 2 weeks ago.  It's fixed in the patches I posted to the agenda site.

Thanks,
Shane.


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfi_cmdset_0001.c: do_write_buffer: wrong length
  2000-12-08 19:56   ` D. Vrabel
  2000-12-18 22:13     ` Shane Nay
@ 2000-12-18 22:24     ` Shane Nay
  2000-12-19  9:41       ` David Vrabel
  1 sibling, 1 reply; 7+ messages in thread
From: Shane Nay @ 2000-12-18 22:24 UTC (permalink / raw)
  To: D. Vrabel, Nicolas Pitre; +Cc: mtd

Okay, last message was way cryptic again..., I'm not a master communicator.  
Anyway, I have succesfully tested the following change on two interleaves.  
First device:
two x16 devices in x8 mode interleaved
Second device:
one x16 device in x16 mode

It's only one change... cfi_cmdset_0001.c:
/* Write length of data to come */
-cfi_write(map,CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),cmd_adr);
+cfi_write(map,CMD((len/(cfi->device_type))-1),cmd_adr);

Dividing by CFIDEV_INTERLEAVE there I think is wrong.  The interleave 
_increases_ not decreases the number of bytes/words you are going to write.

Thanks,
Shane.


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfi_cmdset_0001.c: do_write_buffer: wrong length
  2000-12-19  9:41       ` David Vrabel
@ 2000-12-18 23:07         ` Shane Nay
  0 siblings, 0 replies; 7+ messages in thread
From: Shane Nay @ 2000-12-18 23:07 UTC (permalink / raw)
  To: David Vrabel; +Cc: mtd

On Tuesday 19 December 2000 09:41, David Vrabel wrote:
> On Mon, 18 Dec 2000, Shane Nay wrote:
> > Okay, last message was way cryptic again..., I'm not a master
> > communicator. Anyway, I have succesfully tested the following change on
> > two interleaves. First device:
> > two x16 devices in x8 mode interleaved
> > Second device:
> > one x16 device in x16 mode
> >
> > It's only one change... cfi_cmdset_0001.c:
> > /* Write length of data to come */
> > -cfi_write(map,CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),cmd_adr)
> >; +cfi_write(map,CMD((len/(cfi->device_type))-1),cmd_adr);
>
> However this would break the case 1 in the table below.  Whereas
>     cfi_write(map, CMD(len/CFIDEV_BUSWIDTH-1), cmd_adr);
> would work.
>
> To add to the table...
>
> device type  interleave  bus width  buf write len
> 2 (x16)      1           1 (x8)     len/1-1
> 2 (x16)      1           2 (x16)    len/2-1
> 2 (x16)      2           4 (x32)    len/4-1
> 2 (x16)      2           2 (x16)    len/2-1
>
> It's still len/buswidth-1.
>

Hmm..., good point.  But what about interleaved x8 devices?  Would they be 
fine?  (Brains not functioning at the moment, but my instinct says it would 
be divided by 2 when it should be divided by 1, but I might be messing up the 
"len" calculation that happens before this.  I initially did it the way you 
mention here, but thought I found a flaw, but could definetly be wrong.)

Thanks,
Shane.


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfi_cmdset_0001.c: do_write_buffer: wrong length
  2000-12-18 22:24     ` Shane Nay
@ 2000-12-19  9:41       ` David Vrabel
  2000-12-18 23:07         ` Shane Nay
  0 siblings, 1 reply; 7+ messages in thread
From: David Vrabel @ 2000-12-19  9:41 UTC (permalink / raw)
  To: Shane Nay; +Cc: mtd

On Mon, 18 Dec 2000, Shane Nay wrote:

> Okay, last message was way cryptic again..., I'm not a master communicator.  
> Anyway, I have succesfully tested the following change on two interleaves.  
> First device:
> two x16 devices in x8 mode interleaved
> Second device:
> one x16 device in x16 mode
> 
> It's only one change... cfi_cmdset_0001.c:
> /* Write length of data to come */
> -cfi_write(map,CMD((len/(cfi->device_type*CFIDEV_INTERLEAVE))-1),cmd_adr);
> +cfi_write(map,CMD((len/(cfi->device_type))-1),cmd_adr);

However this would break the case 1 in the table below.  Whereas 
    cfi_write(map, CMD(len/CFIDEV_BUSWIDTH-1), cmd_adr);
would work.

To add to the table...

device type  interleave  bus width  buf write len
2 (x16)      1           1 (x8)     len/1-1
2 (x16)      1           2 (x16)    len/2-1
2 (x16)      2           4 (x32)    len/4-1
2 (x16)      2           2 (x16)    len/2-1

It's still len/buswidth-1.

David Vrabel



To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-12-19 10:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-08 14:45 cfi_cmdset_0001.c: do_write_buffer: wrong length David Vrabel
2000-12-08 18:21 ` Nicolas Pitre
2000-12-08 19:56   ` D. Vrabel
2000-12-18 22:13     ` Shane Nay
2000-12-18 22:24     ` Shane Nay
2000-12-19  9:41       ` David Vrabel
2000-12-18 23:07         ` Shane Nay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox