Skip to contentSkip to conversation

physmap_of and partitions (mtd concat support)

DISCUSSION Stefan Roese 3 participants 9 messages Mar 23, 2009 – Mar 25, 2009 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

I just noticed that physmap_of can't handle multiple devices of different type described in one device node. For example the Intel P30 48F4400 (64MByte) consists internally of 2 non-identical NOR chips. So a "simple"

	flash@0,0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "cfi-flash";
		reg = <0 0 0x04000000>;
		bank-width = <2>;
		device-width = <2>;
		partition@0 {
			label = "test-part";
			reg = <0 0x04000000>;
		};
	}

is not working. It will "detect" 2 identical 32MByte chips which is wrong. Adding a 2nd flash node solves this problem:

	flash@0,0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "cfi-flash";
		reg = <0 0 0x02000000>;
		bank-width = <2>;
		device-width = <2>;
		partition@0 {
			label = "test-part1";
			reg = <0 0x02000000>;
		};
	}
	flash@1,0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "cfi-flash";
		reg = <0 0x02000000 0x02000000>;
		bank-width = <2>;
		device-width = <2>;
		partition@0 {
			label = "test-part2";
			reg = <0 0x02000000>;
		};
	}

This way both chips are detected correctly.

Now the real problem: How should I describe a partition in the device tree spanning over both devices (concat)?. The current physmap_of driver doesn't handle concat at all (physmap.c does). I already have some ideas on how to implement this concat support in physmap_of. But ideas about a device-tree syntax for such partitions are very welcome.

Thanks.

Best regards,
Stefan

#1 lore raw
Quoted 3 lines · Stefan Roese

I just noticed that physmap_of can't handle multiple devices of different type described in one device node. For example the Intel P30 48F4400 (64MByte) consists internally of 2 non-identical NOR chips. So a "simple"

[...]

Quoted 5 lines

Now the real problem: How should I describe a partition in the device tree spanning over both devices (concat)?. The current physmap_of driver doesn't handle concat at all (physmap.c does). I already have some ideas on how to implement this concat support in physmap_of. But ideas about a device-tree syntax for such partitions are very welcome.

Sounds to me like a physmap_of driver bug. I don't think there is any advantage in changing the partition syntax since concatenated flash will always be used as a single device. It doesn't make any sense to try and span partitions over two nodes.

Do additional properties need to be added to describe the concat layout?

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#2 lore raw
Quoted 13 lines · Grant Likely
Quoted 3 lines · Stefan Roese

I just noticed that physmap_of can't handle multiple devices of different type described in one device node. For example the Intel P30 48F4400 (64MByte) consists internally of 2 non-identical NOR chips. So a "simple"

[...]

Quoted 5 lines

Now the real problem: How should I describe a partition in the device tree spanning over both devices (concat)?. The current physmap_of driver doesn't handle concat at all (physmap.c does). I already have some ideas on how to implement this concat support in physmap_of. But ideas about a device-tree syntax for such partitions are very welcome.

Quoted 4 lines

Sounds to me like a physmap_of driver bug. I don't think there is any advantage in changing the partition syntax since concatenated flash will always be used as a single device. It doesn't make any sense to try and span partitions over two nodes.

Yes, I would really love to make this possible with only one flash node. But just think about the following system configuration:

One Intel Strataflash (compatible = "cfi-flash") and one non-cfi compatible flash (e.g. compatible = "jedec-flash"). And the user wants to define a partition that spans over both flash chips. How could this be described in one flash node?

Quoted 1 line

Do additional properties need to be added to describe the concat layout?

Not sure. If we have multiple identical devices they can currently be described in one flash node. So with some changes to the physmap_of driver this configuration will work with concat as well. But more complex is a system configuration as described above. Meaning two or more non-identical chips. I don't see how this could be described in a sane way in one flash node.

Best regards,
Stefan

#3 lore raw
Quoted 27 lines · Stefan Roese
Quoted 13 lines · Grant Likely
Quoted 3 lines · Stefan Roese

I just noticed that physmap_of can't handle multiple devices of different type described in one device node. For example the Intel P30 48F4400 (64MByte) consists internally of 2 non-identical NOR chips. So a "simple"

[...]

Quoted 5 lines

Now the real problem: How should I describe a partition in the device tree spanning over both devices (concat)?. The current physmap_of driver doesn't handle concat at all (physmap.c does). I already have some ideas on how to implement this concat support in physmap_of. But ideas about a device-tree syntax for such partitions are very welcome.

Quoted 4 lines

Sounds to me like a physmap_of driver bug.  I don't think there is any advantage in changing the partition syntax since concatenated flash will always be used as a single device.  It doesn't make any sense to try and span partitions over two nodes.

Yes, I would really love to make this possible with only one flash node. But just think about the following system configuration:

One Intel Strataflash (compatible = "cfi-flash") and one non-cfi compatible flash (e.g. compatible = "jedec-flash"). And the user wants to define a partition that spans over both flash chips. How could this be described in one flash node?

Quoted 8 lines
Quoted 1 line

Do additional properties need to be added to describe the concat layout?

Not sure. If we have multiple identical devices they can currently be described in one flash node. So with some changes to the physmap_of driver this configuration will work with concat as well. But more complex is a system configuration as described above. Meaning two or more non-identical chips. I don't see how this could be described in a sane way in one flash node.

Are there any such platforms? Is there much likelihood that such a platform will be created? Would it even be a good idea to span partitions across such an arrangement given that different devices will behave differently?

I think just leave that arrangement as hypothetical until the situation actually occurs. If it does occur, then strongly recommend to not span a partition across the boundary. If someone really insists on doing this then we can create a new binding for the purpose; but leave the old binding as is. Maybe something like:

mtd {
        #address-cells = <1>;
        #size-cells = <1>;
        compatibly = "weird-mtd-concat";
        devices = <&mtd1 &mtd2 &mtd3>;
        partition1@0 {
                reg = <0 0x100000>;
        };
        partition2@100000 {
                reg = <0x100000 0x100000>;
        };
}

Where mtd1, 2 & 3 point to real flash nodes. That way the concatenated MTD devices could be anything NAND, NOR, SRAM, whatever and it doesn't have to try and overload the existing device bindings.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

A message that is not in the archive (sent off-list or not yet received): fa686aa40903240757n569f2b04t1309e817fd30728d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 15 lines · Grant Likely
Quoted 15 lines
Quoted 4 lines

Sounds to me like a physmap_of driver bug.  I don't think there is any advantage in changing the partition syntax since concatenated flash will always be used as a single device.  It doesn't make any sense to try and span partitions over two nodes.

Yes, I would really love to make this possible with only one flash node. But just think about the following system configuration:

One Intel Strataflash (compatible = "cfi-flash") and one non-cfi compatible flash (e.g. compatible = "jedec-flash"). And the user wants to define a partition that spans over both flash chips. How could this be described in one flash node?

Quoted 1 line

Do additional properties need to be added to describe the concat layout?

Quoted 8 lines
Quoted 6 lines

Not sure. If we have multiple identical devices they can currently be described in one flash node. So with some changes to the physmap_of driver this configuration will work with concat as well. But more complex is a system configuration as described above. Meaning two or more non-identical chips. I don't see how this could be described in a sane way in one flash node.

Are there any such platforms?

Yes, I know some. Even though they are currently not used with a partition spanning over those multiple chips (jedec and cfi).

Quoted 4 lines

Is there much likelihood that such a
platform will be created? Would it even be a good idea to span partitions across such an arrangement given that different devices will behave differently?

OK, in the example above such a spanning partition is not so likely. But think about my original example, the Intel P30 with two different cfi compatible chips on one die. Here a partition spanning over both devices is very likely.

As a sidenote: All this (concat over different chips) is possible with the physmap.c mapping driver which was used on most of my platforms in the "old" arch/ppc days.

Quoted 19 lines

I think just leave that arrangement as hypothetical until the situation actually occurs. If it does occur, then strongly recommend to not span a partition across the boundary. If someone really insists on doing this then we can create a new binding for the purpose; but leave the old binding as is. Maybe something like:

mtd {
        #address-cells = <1>;
        #size-cells = <1>;
        compatibly = "weird-mtd-concat";
        devices = <&mtd1 &mtd2 &mtd3>;
        partition1@0 {
                reg = <0 0x100000>;
        };
        partition2@100000 {
                reg = <0x100000 0x100000>;
        };
}
Quoted 3 lines

Where mtd1, 2 & 3 point to real flash nodes. That way the concatenated MTD devices could be anything NAND, NOR, SRAM, whatever and it doesn't have to try and overload the existing device bindings.

I think I like this idea. If nobody objects or has a better idea then I could start implementing it this way in a while.

Thanks.

Best regards,
Stefan

#6 lore raw
Quoted 23 lines · Stefan Roese
Quoted 22 lines · Grant Likely
Quoted 21 lines
Quoted 4 lines

Sounds to me like a physmap_of driver bug.  I don't think there is any advantage in changing the partition syntax since concatenated flash will always be used as a single device.  It doesn't make any sense to try and span partitions over two nodes.

Yes, I would really love to make this possible with only one flash node. But just think about the following system configuration:

One Intel Strataflash (compatible = "cfi-flash") and one non-cfi compatible flash (e.g. compatible = "jedec-flash"). And the user wants to define a partition that spans over both flash chips. How could this be described in one flash node?

Quoted 1 line

Do additional properties need to be added to describe the concat layout?

Not sure. If we have multiple identical devices they can currently be described in one flash node. So with some changes to the physmap_of driver this configuration will work with concat as well. But more complex is a system configuration as described above. Meaning two or more non-identical chips. I don't see how this could be described in a sane way in one flash node.

Quoted 4 lines
Quoted 1 line

Are there any such platforms?

Yes, I know some. Even though they are currently not used with a partition spanning over those multiple chips (jedec and cfi).

OK

Quoted 8 lines
Quoted 4 lines

Is there much likelihood that such a
platform will be created?  Would it even be a good idea to span partitions across such an arrangement given that different devices will behave differently?

OK, in the example above such a spanning partition is not so likely. But think about my original example, the Intel P30 with two different cfi compatible chips on one die. Here a partition spanning over both devices is very likely.

I agree. Same thing when two or more flash chips are put on a board in consecutive addresses. I've worked on plenty of these arrangements myself.

This case really does sound like a driver bug and that the existing cfi-flash binding is sufficient to describe the hardware. IIUC, when all the flash chips are of the same type the physmap_of driver should be smart enough to detect each of the flash chips within the reg range.

If I'm wrong and it cannot do this, then it would be a simple matter of adding an additional tuple to reg for each discrete chip. A simple, backwards compatible extension which doesn't require a new binding.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

A message that is not in the archive (sent off-list or not yet received): fa686aa40903240928t2a3fcccdrb4508e34c7079aef-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw
Quoted 8 lines · Grant Likely
Quoted 4 lines

OK, in the example above such a spanning partition is not so likely. But think about my original example, the Intel P30 with two different cfi compatible chips on one die. Here a partition spanning over both devices is very likely.

I agree. Same thing when two or more flash chips are put on a board in consecutive addresses. I've worked on plenty of these arrangements myself.

Yes, multiple identical devices are no problem at all. This is handled correctly with the current code and device tree syntax.

Quoted 5 lines

This case really does sound like a driver bug and that the existing cfi-flash binding is sufficient to describe the hardware. IIUC, when all the flash chips are of the same type the physmap_of driver should be smart enough to detect each of the flash chips within the reg range.

*When* all are identical then this works, yes. But in the Intel P30 case the 2 chips are not identical. And from my understanding this is not a problem/bug in the physmap_of driver.

Quoted 4 lines

If I'm wrong and it cannot do this, then it would be a simple matter of adding an additional tuple to reg for each discrete chip. A simple, backwards compatible extension which doesn't require a new binding.

So you are thinking of something like this?

	flash@f0000000,0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "cfi-flash";
		reg = <0 0x00000000 0x02000000
		       0 0x02000000 0x02000000>;
                bank-width = <2>;
                device-width = <2>;
                partition@0 {
                        label = "test-part1";
                        reg = <0 0x04000000>;
                };
	};

That's also fine with me. Changes to physmap_of would be minimal this way.

Do we have a consensus that this should be the way to implement concat support in physmap_of?

Thanks.

Best regards,
Stefan

#9 lore raw
Quoted 19 lines · Stefan Roese
Quoted 8 lines · Grant Likely
Quoted 4 lines

OK, in the example above such a spanning partition is not so likely. But think about my original example, the Intel P30 with two different cfi compatible chips on one die. Here a partition spanning over both devices is very likely.

I agree.  Same thing when two or more flash chips are put on a board in consecutive addresses.  I've worked on plenty of these arrangements myself.

Yes, multiple identical devices are no problem at all. This is handled correctly with the current code and device tree syntax.

Quoted 5 lines

This case really does sound like a driver bug and that the existing cfi-flash binding is sufficient to describe the hardware.  IIUC, when all the flash chips are of the same type the physmap_of driver should be smart enough to detect each of the flash chips within the reg range.

Quoted 3 lines

*When* all are identical then this works, yes. But in the Intel P30 case the 2 chips are not identical. And from my understanding this is not a problem/bug in the physmap_of driver.

To satisfy my own curiosity, why is physmap_of unable to probe multiple cfi chips that are non identical? After detecting the first chip it and calculated then end address of it can it not do another full cfi probe for the rest of the reg range?

Regardless, even if it could the solution you have below is probably a better idea anyway than relying on probing.

Quoted 7 lines
Quoted 4 lines

If I'm wrong and it cannot do this, then it would be a simple matter of adding an additional tuple to reg for each discrete chip.  A simple, backwards compatible extension which doesn't require a new binding.

So you are thinking of something like this?

Quoted 13 lines

       flash@f0000000,0 {
               #address-cells = <1>;
               #size-cells = <1>;
               compatible = "cfi-flash";
               reg = <0 0x00000000 0x02000000
                      0 0x02000000 0x02000000>;
               bank-width = <2>;
               device-width = <2>;
               partition@0 {
                       label = "test-part1";
                       reg = <0 0x04000000>;
               };
       };

Yes, this looks good to me. In fact, it is probably better to be explicit about multiple chips anyway in terms of providing the driver as much information as possible about where to probe for the chips. It also elegantly supports sparsely mapped flash chips (ie. if the board supports larger chips than is actually populated).

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

A message that is not in the archive (sent off-list or not yet received): fa686aa40903250628t1e5e97c0q340746dd78e61c83-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw
Quoted 6 lines · Grant Likely
Quoted 6 lines
Quoted 5 lines

This case really does sound like a driver bug and that the existing cfi-flash binding is sufficient to describe the hardware.  IIUC, when all the flash chips are of the same type the physmap_of driver should be smart enough to detect each of the flash chips within the reg range.

Quoted 8 lines
Quoted 3 lines

*When* all are identical then this works, yes. But in the Intel P30 case the 2 chips are not identical. And from my understanding this is not a problem/bug in the physmap_of driver.

To satisfy my own curiosity, why is physmap_of unable to probe multiple cfi chips that are non identical? After detecting the first chip it and calculated then end address of it can it not do another full cfi probe for the rest of the reg range?

The "real" probing is done in the mtd core (cfi_probe). So it's nothing that could be changed in physmap_of. I have to admit that I didn't fully debug it.

Quoted 24 lines

Regardless, even if it could the solution you have below is probably a better idea anyway than relying on probing.

Quoted 7 lines
Quoted 4 lines

If I'm wrong and it cannot do this, then it would be a simple matter of adding an additional tuple to reg for each discrete chip.  A simple, backwards compatible extension which doesn't require a new binding.

So you are thinking of something like this?

Quoted 13 lines

       flash@f0000000,0 {
               #address-cells = <1>;
               #size-cells = <1>;
               compatible = "cfi-flash";
               reg = <0 0x00000000 0x02000000
                      0 0x02000000 0x02000000>;
               bank-width = <2>;
               device-width = <2>;
               partition@0 {
                       label = "test-part1";
                       reg = <0 0x04000000>;
               };
       };

Quoted 5 lines

Yes, this looks good to me. In fact, it is probably better to be explicit about multiple chips anyway in terms of providing the driver as much information as possible about where to probe for the chips. It also elegantly supports sparsely mapped flash chips (ie. if the board supports larger chips than is actually populated).

OK, then we have a solution. Grant, thanks for your input here.

Best regards,
Stefan