public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* chip drivers
@ 2002-02-01 11:06 Jonas Holmberg
  2002-02-01 13:34 ` David Woodhouse
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-01 11:06 UTC (permalink / raw)
  To: linux-mtd

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

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

* Re: chip drivers
  2002-02-01 11:06 chip drivers Jonas Holmberg
@ 2002-02-01 13:34 ` David Woodhouse
  2002-02-01 13:47   ` Jonas Holmberg
  0 siblings, 1 reply; 12+ messages in thread
From: David Woodhouse @ 2002-02-01 13:34 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: linux-mtd

jonas.holmberg@axis.com 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

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

* Re: chip drivers
  2002-02-01 13:34 ` David Woodhouse
@ 2002-02-01 13:47   ` Jonas Holmberg
  2002-02-01 13:49     ` David Woodhouse
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-01 13:47 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

On Fri, 2002-02-01 at 14:34, David Woodhouse wrote:
> 
> jonas.holmberg@axis.com 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

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

* Re: chip drivers
  2002-02-01 13:47   ` Jonas Holmberg
@ 2002-02-01 13:49     ` David Woodhouse
  2002-02-01 14:49       ` Jonas Holmberg
  0 siblings, 1 reply; 12+ messages in thread
From: David Woodhouse @ 2002-02-01 13:49 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: linux-mtd

jonas.holmberg@axis.com said:
>  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?

Yes.

> 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

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

* Re: chip drivers
  2002-02-01 13:49     ` David Woodhouse
@ 2002-02-01 14:49       ` Jonas Holmberg
  2002-02-01 15:04         ` David Woodhouse
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-01 14:49 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

> > 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 chip
0x00400000 - 0x005FFFFF 2MiB jedec only chip
0x00600000 - 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)

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

* Re: chip drivers
  2002-02-01 14:49       ` Jonas Holmberg
@ 2002-02-01 15:04         ` David Woodhouse
  2002-02-04 10:52           ` Patch for jedec_probe Jonas Holmberg
                             ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: David Woodhouse @ 2002-02-01 15:04 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: linux-mtd

jonas.holmberg@axis.com said:
>  But how would I be able to detect all chips if I had a configuration
> like this:

> 0x00000000 - 0x003FFFFF 4MiB CFI chip
> 0x00400000 - 0x005FFFFF 2MiB jedec only chip
> 0x00600000 - 0x009FFFFF 4MiB 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

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

* Patch for jedec_probe
  2002-02-01 15:04         ` David Woodhouse
@ 2002-02-04 10:52           ` Jonas Holmberg
  2002-02-05  3:06             ` David Woodhouse
  2002-02-04 15:47           ` chip drivers Jonas Holmberg
  2002-02-06 13:49           ` Jonas Holmberg
  2 siblings, 1 reply; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-04 10:52 UTC (permalink / raw)
  To: linux-mtd

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
diff -u -r1.10 jedec_probe.c
--- jedec_probe.c       2002/01/21 18:09:01     1.10
+++ jedec_probe.c       2002/02/04 10:46:45
@@ -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 */

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

* Re: chip drivers
  2002-02-01 15:04         ` David Woodhouse
  2002-02-04 10:52           ` Patch for jedec_probe Jonas Holmberg
@ 2002-02-04 15:47           ` Jonas Holmberg
  2002-02-05 16:48             ` Jonas Holmberg
  2002-02-06 13:49           ` Jonas Holmberg
  2 siblings, 1 reply; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-04 15:47 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

> 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

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

* Re: Patch for jedec_probe
  2002-02-04 10:52           ` Patch for jedec_probe Jonas Holmberg
@ 2002-02-05  3:06             ` David Woodhouse
  0 siblings, 0 replies; 12+ messages in thread
From: David Woodhouse @ 2002-02-05  3:06 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: linux-mtd

On 4 Feb 2002, Jonas Holmberg wrote:

> 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?

Looks sane. Go ahead.

-- 
dwmw2

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

* Re: chip drivers
  2002-02-04 15:47           ` chip drivers Jonas Holmberg
@ 2002-02-05 16:48             ` Jonas Holmberg
  0 siblings, 0 replies; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-05 16:48 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

> 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

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

* Re: chip drivers
  2002-02-01 15:04         ` David Woodhouse
  2002-02-04 10:52           ` Patch for jedec_probe Jonas Holmberg
  2002-02-04 15:47           ` chip drivers Jonas Holmberg
@ 2002-02-06 13:49           ` Jonas Holmberg
  2002-02-06 14:22             ` David Woodhouse
  2 siblings, 1 reply; 12+ messages in thread
From: Jonas Holmberg @ 2002-02-06 13:49 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

> > 0x00000000 - 0x003FFFFF 4MiB CFI chip
> > 0x00400000 - 0x005FFFFF 2MiB jedec only chip
> > 0x00600000 - 0x009FFFFF 4MiB 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.

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

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

* Re: chip drivers
  2002-02-06 13:49           ` Jonas Holmberg
@ 2002-02-06 14:22             ` David Woodhouse
  0 siblings, 0 replies; 12+ messages in thread
From: David Woodhouse @ 2002-02-06 14:22 UTC (permalink / raw)
  To: Jonas Holmberg; +Cc: linux-mtd

On 6 Feb 2002, Jonas Holmberg wrote:

> 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.

-- 
dwmw2

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

end of thread, other threads:[~2002-02-06 14:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-01 11:06 chip drivers Jonas Holmberg
2002-02-01 13:34 ` David Woodhouse
2002-02-01 13:47   ` Jonas Holmberg
2002-02-01 13:49     ` David Woodhouse
2002-02-01 14:49       ` Jonas Holmberg
2002-02-01 15:04         ` David Woodhouse
2002-02-04 10:52           ` Patch for jedec_probe Jonas Holmberg
2002-02-05  3:06             ` David Woodhouse
2002-02-04 15:47           ` chip drivers Jonas Holmberg
2002-02-05 16:48             ` Jonas Holmberg
2002-02-06 13:49           ` Jonas Holmberg
2002-02-06 14:22             ` David Woodhouse

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