cfi_cmdset_0001.c: do_write_buffer: wrong length
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 [email protected]
Hi,
Quoted 18 lines · Nicolas Pitre
Quoted 9 lines · David Vrabel
In
cfi_cmdset_0001.cdo_write_bufferwrites an incorrect length to the chipcfi_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...
Quoted 8 lines
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 [email protected]
Quoted 12 lines · David Vrabel
Hi,
In
cfi_cmdset_0001.cdo_write_bufferwrites an incorrect length to the chipcfi_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
Quoted 8 lines
cfi_write(map, CMD(len/2-1), cmd_adr); <-- FailsWhen it should be
cfi_write(map, CMD(len-1), cmd_adr); <-- WorksShould 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 [email protected]
Quoted 31 lines · D. Vrabel
Hi,
Quoted 16 lines · Nicolas Pitre
Quoted 8 lines · David Vrabel
In
cfi_cmdset_0001.cdo_write_bufferwrites an incorrect length to the chipcfi_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...
Quoted 8 lines
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...
Quoted 8 lines
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-1So 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 [email protected]
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 [email protected]
Review
Quoted 11 lines · Shane Nay
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 modeIt's only one change...
cfi_cmdset_0001.c:
/* Write length of data to come */(quoted diff) +1
-1-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 [email protected]
Quoted 19 lines · David Vrabel
Quoted 11 lines · Shane Nay
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 modeIt'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...
Quoted 8 lines
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-1It'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 [email protected]