chip drivers
I need to use different flash chips (AMD compatible, mixed CFI and non-CFI, mixed geometry etc) at the same time :). I think I will need to change the cfi drivers and the cfi- and jedec-probe to accomplish this.
I'm not going to try to use different chips in interleave (the code for that would probably be unreadable, and who needs it?).
Are there other cases I ought to handle as well? Would anyone object if I replace the cfi_probe and jedec_probe with one unified flash_probe?
I'll do some thinking and testing and come up with a more detailed plan before I start doing any serious damag^H^H^H^H^Hcoding.
/Jonas
Quoted 4 lines · [email protected] said:
I need to use different flash chips (AMD compatible, mixed CFI and non-CFI, mixed geometry etc) at the same time :). I think I will need to change the cfi drivers and the cfi- and jedec-probe to accomplish this.
Why do you think this? They should be fine. Just set up as many map structures as you require and call the appropriate probe functions.
--
dwmw2
Quoted 9 lines · David Woodhouse
Quoted 4 lines · [email protected] said:
I need to use different flash chips (AMD compatible, mixed CFI and non-CFI, mixed geometry etc) at the same time :). I think I will need to change the cfi drivers and the cfi- and jedec-probe to accomplish this.
Why do you think this? They should be fine. Just set up as many map structures as you require and call the appropriate probe functions.
Do you mean using two map structures (one for each probe) and just let the cfi_probe fill out one of them and jedec_probe the other? Because I don't think that will work without complex code that calls the probes over and over again.
/Jonas
Quoted 2 lines · [email protected] said:
Do you mean using two map structures (one for each probe) and just
let thecfi_probefill out one of them andjedec_probethe other?
Yes.
Quoted 2 lines
Because I don't think that will work without complex code that calls the probes over and over again.
Look at drivers/mtd/maps/ocelot.c. It has two map structures and calls two probe functions.
--
dwmw2
Quoted 5 lines
Quoted 2 lines
Because I don't think that will work without complex code that calls the probes over and over again.
Look at
drivers/mtd/maps/ocelot.c. It has two map structures and calls two probe functions.
But how would I be able to detect all chips if I had a configuration like this:
0x00000000 - 0x003FFFFF 4MiB CFI chip0x00400000 - 0x005FFFFF 2MiB jedec only chip0x00600000 - 0x009FFFFF 4MiB CFI chip
I could call the cfi-probe first and it would find the first chip but it would try to find the next chip at 0x00400000 and that's not a CFI chip so it would continue to look at 0x00800000 and miss the chip at 0x00600000. And I would have to make the jedec_probe start looking at 0x00400000 because it wouldn't find any chip at 0x00000000.
Let's say that all chips above are 2MiB instead so that the can be detected by the probes. Would it be possible to make a partition that is located both in a CFI and in a non-CFI chip?
Can the cfi-driver really handle chips of different sizes and/or eraseregion-layouts?
I noticed that the jedec_probe only accepts identical chips (IDs) and it thinks that it has found a new chip if my window is bigger than all my chips together (I'll have to fix that).
/Jonas (slightly confused)
Quoted 6 lines · [email protected] said:
But how would I be able to detect all chips if I had a configuration
like this:
0x00000000-0x003FFFFF4MiB CFI chip0x00400000-0x005FFFFF2MiB jedec only chip0x00600000-0x009FFFFF4MiB CFI chip
You'd need three maps, three probe calls. Although I suppose you could have a single map driver for the first and last chips where the access calls do something like:
return *(volatile __u32 *) (addr + (addr>0x400000?0x200000:0));
You probably don't want that though. Register them as three separate chips and then use the partition code that's been fixed to let you combine ranges of separate devices into one 'partition' rather than just split devices up.
--
dwmw2
Patch for jedec_probe
I need the jedec_probe to give up when finding a chip of a different manufacturer or device id (or no chip at all) than a previously found chip in the same map.
This patch below fixes that. Is it OK to commit?
/Jonas
Index: jedec_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/jedec_probe.c,v retrieving revision 1.10
02/04 10:46:45 renamed from 01/21 18:09:01 1.10 +5 -0
@@ -832,6 +832,19 @@ goto retry; } return 0; + } else { + __u16 mfr; + __u16 id; + + /* Make sure it is a chip of the same manufacturer and
id */
+ mfr = jedec_read_mfr(map, base, cfi);
+ id = jedec_read_id(map, base, cfi);
+
+ if ((mfr != cfi->mfr) || (id != cfi->id)) {
+ printk(KERN_DEBUG "%s: Found different chip or
no chip at all (mfr %x, id %x) at 0x%x\n",
+ map->name, mfr, id, base);
+ return 0;
+ }
}
/* Check each previous chip to see if it's an alias */Re: Patch for jedec_probe
Quoted 5 lines · Jonas Holmberg
I need the
jedec_probeto give up when finding a chip of a different manufacturer or device id (or no chip at all) than a previously found chip in the same map.This patch below fixes that. Is it OK to commit?
Looks sane. Go ahead.
Signature · 1 line
dwmw2
Quoted 3 lines
Register them as three separate chips
and then use the partition code that's been fixed to let you combine ranges of separate devices into one 'partition' rather than just split devices up.
I haven't got past the probing part yet. I'm trying to use cfi_probe and jedec_probe to find all chips in a really big window. So when the cfi_probe or the jedec_probe has found something I make a copy of the map it used and increase map_priv_1 (used by the read and write callbacks as in physmap.c) in the new map. The new map is then used for the next probe.
The problem is that I cannot determine if a previous probe found any alias or not. I must not probe where an alias has been found by a previous probe since the next probe will think it is a new chip and not recognize it as an alias (sinze it will think that it found the chip at location zero). And I must continue probing until the end of the window.
Do I have to change the interface of the probe functions (I need the address of the last found alias without "manually" looking for aliases like the probe functions do)?
/Jonas
Quoted 3 lines
Do I have to change the interface of the probe functions (I need the address of the last found alias without "manually" looking for aliases like the probe functions do)?
I'm giving up on making the ultimate super-mega-grand-flash-probe-de-lux that only needs one map and a window size to magically find all chips within that window. The more I try the more problems I find.
I will just do cfi_probe and jedec_probe on the two chip selects (two maps) on the hardware I use (ETRAX 100LX) and assume that noone mounts different chips on the same map (it requires external hardware to mount more than one chip on each chip select anyway). That will cover all existing hardware configurations that I know of. The code will be hardware-specific so I will not make it a part of MTD (I'll just put it in our linux/arch/cris/axisflashmap.c when I'm done).
/Jonas
Quoted 4 lines
Quoted 3 lines
0x00000000-0x003FFFFF4MiB CFI chip0x00400000-0x005FFFFF2MiB jedec only chip0x00600000-0x009FFFFF4MiB CFI chip
Quoted 8 lines
You'd need three maps, three probe calls. Although I suppose you could have a single map driver for the first and last chips where the access calls do something like:
return *(volatile __u32 *) (addr + (addr>0x400000?0x200000:0));You probably don't want that though. Register them as three separate chips and then use the partition code that's been fixed to let you combine ranges of separate devices into one 'partition' rather than just split devices up.
Can you explain that a bit further? I can't figure out how use add_mtd_partitions (current CVS) when I want to make a partition that starts in one map and ends in another. Since the map is an argument to app_mtd_partitions I must make two calls to add_mtd_partitions, right? But how do I make add_mtd_partitions merge the start of the device (in the endo of the first map) with the end of the device (in the beginning of the other map)?
/Jonas
Quoted 3 lines · Jonas Holmberg
Can you explain that a bit further? I can't figure out how use
add_mtd_partitions(current CVS) when I want to make a partition that starts in one map and ends in another.
It's not in CVS. There were patches on the mailing list. You need to either use those, or write your own indirection routines to do what you require, in place of the existing mtdpart methods.
Signature · 1 line
dwmw2