Skip to contentSkip to conversation

OF compatible MTD platform RAM driver ?

DISCUSSION Laurent Pinchart 6 participants 38 messages Mar 10, 2008 – Mar 31, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi everybody,

as part of a ARCH=ppc to ARCH=powerpc migration process, I'm looking for an OpenFirmware compatible way to handle a RAM-based MTD device.

On the platform_device based ppc architecture, the drivers/mtd/maps/plat-ram.c driver handled "mtd-ram" platform devices. There is no such driver for the OF-based powerpc architecture.

As a temporary workaround I hacked the physmap_of driver to handle "direct-mapped" OF devices oh type "ram" by adding a corresponding entry in the of_flash_match[] array. This seems to work fine.

What would be the preferred way to handle OF-compatible RAM-based MTD devices ? The 3 ways I can think of are

1. porting the plat-ram driver to OF (the driver isn't used in the kernel tree but I suspect it is used by out-of-tree boards)

2. creating a new plat-ram-of driver, much like the physmap_of driver comes from the physmap driver

3. extending the physmap_of driver to handle RAM devices (in which case references to "flash" in the function names should probably be replaced by "mtd")

I live option 3 better so far.

Has anyone already worked on this ? Is there any defined device tree mapping for MTD RAM devices ?

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#1 lore raw
Quoted 33 lines · [email protected] wrote:

Hi everybody,
=20
as part of a ARCH=3Dppc to ARCH=3Dpowerpc migration process, I'm looking for an
OpenFirmware compatible way to handle a RAM-based MTD device. =20
On the platform_device based ppc architecture, the drivers/mtd/maps/plat-ram.c
driver handled "mtd-ram" platform devices. There is no such driver for the
OF-based powerpc architecture.
=20
As a temporary workaround I hacked the physmap_of driver to handle "direct-mapped" OF devices oh type "ram" by adding a corresponding entry in the of_flash_match[] array. This seems to work fine.=20
=20
What would be the preferred way to handle OF-compatible RAM-based MTD devices ? The 3 ways I can think of are
=20
1. porting the plat-ram driver to OF (the driver isn't used in the kernel tree
but I suspect it is used by out-of-tree boards)
=20
2. creating a new plat-ram-of driver, much like the physmap_of driver comes
from the physmap driver
=20
3. extending the physmap_of driver to handle RAM devices (in which case
references to "flash" in the function names should probably be replaced
by "mtd")

Quoted 8 lines

=20
I live option 3 better so far.
=20
Has anyone already worked on this ? Is there any defined device tree mapping
for MTD RAM devices ?
=20
Best regards,

We ran ito the same issue.=20
We did option 3, as it was efinetly the easiest,
here is the sram entry in our dts:

        sram@9,0 {
            device_type =3D "rom";
            compatible =3D "direct-mapped";
            probe-type =3D "RAM";
            reg =3D <9 0 20000>;
            bank-width =3D <2>;
            device-width =3D <2>;
            #address-cells =3D <1>;
            #size-cells =3D <1>;
            partition@0 {
                label =3D "SRAM";
                reg =3D <0 20000>;
            };

here is the change to physmap_of.c:

(quoted diff) +0 -0

b/drivers/mtd/maps/physmap_of.c
old mode 100644
new mode 100755
index aeed9ea..687ef54

drivers/mtd/maps/physmap_of.c +0 -0
@@ -201,6 +201,8 @@ static struct mtd_info * __devinit

obsolete_probe(struct of_device *dev,
return do_map_probe("cfi_probe", map);
} else if (strcmp(of_probe, "JEDEC") =3D=3D 0) {
return do_map_probe("jedec_probe", map);
+ } else if (strcmp(of_probe, "RAM") =3D=3D 0) {
+ return do_map_probe("map_ram", map);
} else {
if (strcmp(of_probe, "ROM") !=3D 0)
dev_warn(&dev->dev, "obsolete_probe: don't know
probe "

#2 lore raw
Quoted 35 lines · Rune Torgersen
Quoted 34 lines · [email protected] wrote:

Hi everybody,

as part of a ARCH=ppc to ARCH=powerpc migration process, I'm looking for an
OpenFirmware compatible way to handle a RAM-based MTD device.

On the platform_device based ppc architecture, the drivers/mtd/maps/plat-ram.c
driver handled "mtd-ram" platform devices. There is no such driver for the
OF-based powerpc architecture.

As a temporary workaround I hacked the physmap_of driver to handle "direct-mapped" OF devices oh type "ram" by adding a corresponding entry in the of_flash_match[] array. This seems to work fine.

What would be the preferred way to handle OF-compatible RAM-based MTD devices ? The 3 ways I can think of are

1. porting the plat-ram driver to OF (the driver isn't used in the kernel tree
but I suspect it is used by out-of-tree boards)

2. creating a new plat-ram-of driver, much like the physmap_of driver comes
from the physmap driver

3. extending the physmap_of driver to handle RAM devices (in which case
references to "flash" in the function names should probably be replaced
by "mtd")

Quoted 8 lines
Quoted 5 lines

I live option 3 better so far.

Has anyone already worked on this ? Is there any defined device tree mapping
for MTD RAM devices ?

We ran ito the same issue.
We did option 3, as it was efinetly the easiest,

I think this is the best option in principle.

Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
Quoted 38 lines · David Gibson
Quoted 37 lines · Rune Torgersen
Quoted 36 lines · [email protected] wrote:

Hi everybody,

as part of a ARCH=ppc to ARCH=powerpc migration process, I'm looking for an
OpenFirmware compatible way to handle a RAM-based MTD device.

On the platform_device based ppc architecture, the drivers/mtd/maps/plat-ram.c
driver handled "mtd-ram" platform devices. There is no such driver for the
OF-based powerpc architecture.

As a temporary workaround I hacked the physmap_of driver to handle "direct-mapped" OF devices oh type "ram" by adding a corresponding entry in the of_flash_match[] array. This seems to work fine.

What would be the preferred way to handle OF-compatible RAM-based MTD devices ? The 3 ways I can think of are

1. porting the plat-ram driver to OF (the driver isn't used in the kernel tree
but I suspect it is used by out-of-tree boards)

2. creating a new plat-ram-of driver, much like the physmap_of driver comes
from the physmap driver

3. extending the physmap_of driver to handle RAM devices (in which case
references to "flash" in the function names should probably be replaced
by "mtd")

I live option 3 better so far.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Has anyone already worked on this ? Is there any defined device tree mapping
for MTD RAM devices ?

We ran ito the same issue.
We did option 3, as it was efinetly the easiest,

I think this is the best option in principle.

I'll implement that and post a patch after completing the ppc-to-powerpc migration.

Quoted 8 lines
Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

What "compatible" values should I use for ROM and RAM mappings ?

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#4 lore raw
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · David Gibson
Quoted 1 line · Rune Torgersen

[email protected] wrote:

[snip]

Quoted 10 lines
Quoted 4 lines
Quoted 2 lines

We ran ito the same issue.
We did option 3, as it was efinetly the easiest,

I think this is the best option in principle.

I'll implement that and post a patch after completing the ppc-to-powerpc migration.

Quoted 2 lines
Quoted 1 line

here is the sram entry in our dts:

Quoted 8 lines
Quoted 6 lines

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

What "compatible" values should I use for ROM and RAM mappings ?

That I'm not so sure of. We'll need to find some consensus.

There may be existing IEEE1275 bindings for roms, which we should investigate. Arguably RAM should be represented by a memory node, but that's going to get messy for this sort of application.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#5 lore raw
Quoted 22 lines · David Gibson
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · David Gibson
Quoted 1 line · Rune Torgersen

[email protected] wrote:

[snip]

Quoted 17 lines
Quoted 4 lines
Quoted 2 lines

We ran ito the same issue.
We did option 3, as it was efinetly the easiest,

I think this is the best option in principle.

I'll implement that and post a patch after completing the ppc-to-powerpc migration.

Quoted 8 lines
Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

Quoted 6 lines
Quoted 1 line

What "compatible" values should I use for ROM and RAM mappings ?

That I'm not so sure of. We'll need to find some consensus.

There may be existing IEEE1275 bindings for roms, which we should investigate.

Do you (or someone else here) have access to the IEEE1275 specification ? Is there any ROM binding in there ?

Quoted 2 lines

Arguably RAM should be represented by a memory node, but that's going to get messy for this sort of application.

We're talking about a very specific type of RAM, used for permanent storage with a battery backup. The RAM is really meant to be used as an MTD device and as such I think it makes sense to describe it as an mtd-compatible device on the local bus.

What about the following definition for the RAM node ?

        nvram@2,0000 {
                compatible = "mtd,ram";
                reg = <2 0x0000 0x00100000>;
                bank-width = <2>;
        };

Or should the node have a device-type property of either 'ram' or 'rom' with the compatible property just referencing MTD ?

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#6 lore raw

Hello.

Quoted 9 lines · Laurent Pinchart
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

What "compatible" values should I use for ROM and RAM mappings ?

That I'm not so sure of. We'll need to find some consensus.

There may be existing IEEE1275 bindings for roms, which we should investigate.

Do you (or someone else here) have access to the IEEE1275 specification ? Is

Yeah, and I can point you to it -- see the documantation section on
http://www.openbios.org/...

Quoted 1 line

there any ROM binding in there ?

No. We initially called the flash devices that physmap_of driver
controlled "rom" (I mean the "device_type" property) -- now this is obsoleted.

Quoted 1 line
Quoted 1 line

Arguably RAM should be represented by a memory node, but that's going to get messy for this sort of application.

Note that the OF "memory" type nodes do *not* represent RAM devices.

Quoted 5 lines

We're talking about a very specific type of RAM, used for permanent storage with a battery backup. The RAM is really meant to be used as an MTD device and as such I think it makes sense to describe it as an mtd-compatible device on the local bus.

What about the following definition for the RAM node ?

        nvram@2,0000 {

Note that there's a OF "device_type" of "nvram", so your (generic) device
name seems to add some mess. (IIRC, that OF device type didn't actually represent a "real" device, and only served to provide access to NVRAM for OF).

Quoted 1 line
                compatible = "mtd,ram";

The part before comma should be a company name or a stock ticker. What did
you mean here?

Quoted 5 lines
                reg = <2 0x0000 0x00100000>;
                bank-width = <2>;
        };

Or should the node have a device-type property of either 'ram' or 'rom' with the compatible property just referencing MTD ?

The "device_type" properties are not required and their further creation
has been discouraged on liunxppc-dev.

Quoted 1 line

Best regards,

WBR, Sergei

#7 lore raw

Hi Sergei,

Quoted 17 lines · Sergei Shtylyov

Hello.

Quoted 12 lines · Laurent Pinchart
Quoted 12 lines
Quoted 10 lines
Quoted 8 lines
Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

What "compatible" values should I use for ROM and RAM mappings ?

That I'm not so sure of. We'll need to find some consensus.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

There may be existing IEEE1275 bindings for roms, which we should investigate.

Do you (or someone else here) have access to the IEEE1275 specification ? Is

Yeah, and I can point you to it -- see the documantation section on
http://www.openbios.org/...

Thanks a lot for the pointer.

Quoted 15 lines
Quoted 1 line

there any ROM binding in there ?

No. We initially called the flash devices that physmap_of driver
controlled "rom" (I mean the "device_type" property) -- now this is obsoleted.

Quoted 2 lines
Quoted 2 lines

Arguably RAM should be represented by a memory node, but that's going to get messy for this sort of application.

Note that the OF "memory" type nodes do *not* represent RAM devices.

Quoted 4 lines

We're talking about a very specific type of RAM, used for permanent storage with a battery backup. The RAM is really meant to be used as an MTD device and as such I think it makes sense to describe it as an mtd-compatible device on the local bus.

Quoted 7 lines
Quoted 3 lines

What about the following definition for the RAM node ?

        nvram@2,0000 {

Note that there's a OF "device_type" of "nvram", so your (generic) device
name seems to add some mess. (IIRC, that OF device type didn't actually represent a "real" device, and only served to provide access to NVRAM for OF).

Ok.

Quoted 4 lines
Quoted 1 line
                compatible = "mtd,ram";

The part before comma should be a company name or a stock ticker. What did
you mean here?

I didn't know that. Let's say I meant "mtd-ram" :-)

Quoted 9 lines
Quoted 6 lines
                reg = <2 0x0000 0x00100000>;
                bank-width = <2>;
        };

Or should the node have a device-type property of either 'ram' or 'rom' with the compatible property just referencing MTD ?

The "device_type" properties are not required and their further creation
has been discouraged on liunxppc-dev.

What about

	mtdram@2,0000 {
		compatible = "mtd-ram";
		reg = <2 0x0000 0x00100000>;
		bank-width = <2>;
	};

ROMs could use "mtd-rom" for their compatible property.

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#8 lore raw
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines
Quoted 5 lines

We're talking about a very specific type of RAM, used for permanent storage with a battery backup. The RAM is really meant to be used as an MTD device and as such I think it makes sense to describe it as an mtd-compatible device on the local bus.

What about the following definition for the RAM node ?

       nvram@2,0000 {

Note that there's a OF "device_type" of "nvram", so your (generic) device
name seems to add some mess. (IIRC, that OF device type didn't actually represent a "real" device, and only served to provide access to NVRAM for OF).

Ok.

Well, I might have gone too far here -- it should be a real device
(spec'ed in Device Support Extensions recommended practice). It's just that the spec didn't mention "reg" property, only "#bytes" (the device capacity). So, it may be worth considering...

Quoted 18 lines
Quoted 4 lines
Quoted 1 line
               compatible = "mtd,ram";

The part before comma should be a company name or a stock ticker. What did
you mean here?

I didn't know that. Let's say I meant "mtd-ram" :-)

Quoted 8 lines
Quoted 5 lines
               reg = <2 0x0000 0x00100000>;
               bank-width = <2>;
       };

Or should the node have a device-type property of either 'ram' or 'rom' with the compatible property just referencing MTD ?

The "device_type" properties are not required and their further creation
has been discouraged on liunxppc-dev.

What about

Quoted 7 lines
	mtdram@2,0000 {
		compatible = "mtd-ram";
		reg = <2 0x0000 0x00100000>;
		bank-width = <2>;
	};

ROMs could use "mtd-rom" for their compatible property.

Heh, there was a whole company against mentioning "mtd" when we started
working on this (of course, the first idea was to call the flash device type "mtd"). I don't think "mtd" looks good here -- I'd suggest "flash-ram" (if this is just a linearly mapped NVRAM).

Quoted 1 line

Best regards,

WBR, Sergei

#9 lore raw
Quoted 3 lines · Sergei Shtylyov
Quoted 1 line · Laurent Pinchart
Quoted 1 line
Quoted 1 line

We're talking about a very specific type of RAM, used for permanent

storage

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

with a battery backup. The RAM is really meant to be used as an MTD

device

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and as such I think it makes sense to describe it as an mtd-compatible

device

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

on the local bus.

What about the following definition for the RAM node ?

       nvram@2,0000 {

Note that there's a OF "device_type" of "nvram", so your (generic)

device

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

name seems to add some mess. (IIRC, that OF device type didn't actually represent a "real" device, and only served to provide access to NVRAM for

OF).

Quoted 7 lines
Quoted 2 lines

Ok.

Well, I might have gone too far here -- it should be a real device
(spec'ed in Device Support Extensions recommended practice). It's just that the spec didn't mention "reg" property, only "#bytes" (the device capacity). So, it may be worth considering...

The nvram device descrived in the Device Support Extensions is probably meant to describe the kind of nvram found in RTC chips. That memory isn't directly accessible. As the spec doesn't mention this explicitely we could still reuse the nvram device type for direct-mapped battery-backed ram. I have no strong opinion for or against that.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
               compatible = "mtd,ram";

The part before comma should be a company name or a stock ticker. What

did

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

you mean here?

I didn't know that. Let's say I meant "mtd-ram" :-)

Quoted 5 lines
Quoted 5 lines
               reg = <2 0x0000 0x00100000>;
               bank-width = <2>;
       };

Or should the node have a device-type property of either 'ram' or 'rom'

with

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

the compatible property just referencing MTD ?

The "device_type" properties are not required and their further

creation

Quoted 10 lines
Quoted 9 lines
Quoted 1 line

has been discouraged on liunxppc-dev.

What about

	mtdram@2,0000 {
		compatible = "mtd-ram";
		reg = <2 0x0000 0x00100000>;
		bank-width = <2>;
	};
Quoted 6 lines
Quoted 1 line

ROMs could use "mtd-rom" for their compatible property.

Heh, there was a whole company against mentioning "mtd" when we started
working on this (of course, the first idea was to call the flash device type "mtd"). I don't think "mtd" looks good here -- I'd suggest "flash-ram" (if this is just a linearly mapped NVRAM).

I'm fine with "flash-ram" (even thought it looks a bit weird). I'll prepare a patch.

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#10 lore raw
Quoted 9 lines · Laurent Pinchart
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

We're talking about a very specific type of RAM, used for permanent storage with a battery backup. The RAM is really meant to be used as an MTD device and as such I think it makes sense to describe it as an mtd-compatible device on the local bus.

What about the following definition for the RAM node ?

      nvram@2,0000 {

Note that there's a OF "device_type" of "nvram", so your (generic) device
name seems to add some mess. (IIRC, that OF device type didn't actually represent a "real" device, and only served to provide access to NVRAM for OF).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Ok.

Well, I might have gone too far here -- it should be a real device
(spec'ed in Device Support Extensions recommended practice). It's just that the spec didn't mention "reg" property, only "#bytes" (the device capacity). So, it may be worth considering...

The nvram device descrived in the Device Support Extensions is probably meant to describe the kind of nvram found in RTC chips.

Well, that is only an assumption -- actually, the sentense in the
description of the "#bytes" prop about the typical size being from 4 to 32K speaks against it. The details of NVRAM implementation are hidden behind read/write/seek methods.

Quoted 1 line

That memory isn't directly accessible.

That's what we have a "compatible" prop for. ;-)

Quoted 20 lines

As the spec doesn't mention this explicitely we could still reuse the nvram device type for direct-mapped battery-backed ram. I have no strong opinion for or against that.

Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
Quoted 5 lines
              reg = <2 0x0000 0x00100000>;
              bank-width = <2>;
      };

Or should the node have a device-type property of either 'ram' or 'rom' with the compatible property just referencing MTD ?

The "device_type" properties are not required and their further creation

has been discouraged on liunxppc-dev.

What about

	mtdram@2,0000 {
		compatible = "mtd-ram";
		reg = <2 0x0000 0x00100000>;
		bank-width = <2>;
	};
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

ROMs could use "mtd-rom" for their compatible property.

Heh, there was a whole company against mentioning "mtd" when we started
working on this (of course, the first idea was to call the flash device type "mtd"). I don't think "mtd" looks good here -- I'd suggest "flash-ram" (if this is just a linearly mapped NVRAM).

I'm fine with "flash-ram" (even thought it looks a bit weird). I'll prepare a patch.

Yeah. I forgeot that "flash" means EEPROM. Actually, the main facts about
the NVRAM that I'd want to be stated in the "compatible" property is that it's non-volatile and directly/lineraly mapped... Just "nvram" doesn't seem enopugh, maybe "linear-nvram" is. And we can specify "device_type" of "nvram" indeed (and #size).

Quoted 1 line

Best regards,

WBR, Sergei

#11 lore raw
Quoted 7 lines · Sergei Shtylyov
Quoted 4 lines · Laurent Pinchart
Quoted 4 lines

Heh, there was a whole company against mentioning "mtd" when we started working on this (of course, the first idea was to call the flash device type "mtd"). I don't think "mtd" looks good here -- I'd suggest "flash-ram" (if this is just a linearly mapped NVRAM).

Quoted 7 lines
Quoted 2 lines

I'm fine with "flash-ram" (even thought it looks a bit weird). I'll prepare a patch.

Yeah. I forgeot that "flash" means EEPROM. Actually, the main facts about the NVRAM that I'd want to be stated in the "compatible" property is that it's non-volatile and directly/lineraly mapped... Just "nvram" doesn't seem enopugh, maybe "linear-nvram" is.

Direct mapping is a hard requirement for the nvram if we want to use it with the MTD subsystem. Regarding non-volatility nothing prevents a user from using a volatile RAM as an MTD device, but there's little point in doing so. Would it be acceptable for the "linear-nvram" specification not to include volatile RAM ? ROM chips would be excluded too. Is that an issue ?

Quoted 1 line

And we can specify "device_type" of "nvram" indeed (and #size).

I suppose you meant #bytes.

What about sub-partitions support ? Nothing prevents RAM-based MTD devices from being partioned. Would it be acceptable to reference the CFI/JEDEC flash section in Documentation/powerpc/booting-without-of.txt in the description of the nvram node ?

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#12 lore raw
Quoted 11 lines · Laurent Pinchart
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Heh, there was a whole company against mentioning "mtd" when we started working on this (of course, the first idea was to call the flash device type "mtd"). I don't think "mtd" looks good here -- I'd suggest
"flash-ram" (if this is just a linearly mapped NVRAM).

I'm fine with "flash-ram" (even thought it looks a bit weird). I'll prepare a patch.

Yeah. I forgeot that "flash" means EEPROM. Actually, the main facts about the NVRAM that I'd want to be stated in the "compatible" property is that it's non-volatile and directly/lineraly mapped... Just "nvram" doesn't seem enopugh, maybe "linear-nvram" is.

Direct mapping is a hard requirement for the nvram if we want to use it with the MTD subsystem.

I thought we're currently talking about a driver controlling the directly
mapped NVRAM. The "compatible" property wouldn't allow us to specify the compatibility to *any* NVRAM since there could be no "least common denominator" driver anyway.

Quoted 1 line

Regarding non-volatility nothing prevents a user from using a volatile RAM as an MTD device, but there's little point in doing so.

Indeed, if just for testing... we could specify non-volatility as the
device's prop, though...

Quoted 1 line

Would it be acceptable for the "linear-nvram" specification not to include volatile RAM ? ROM chips would be excluded too. Is that an issue ?

Well, I think we need a separate "compatible" prop for ROMs. Or we'll end
up with the "compatible" being just "memory" with the memory "attributes" (R/O, N/V) being described by other "properties"... :-)

Quoted 3 lines
Quoted 1 line

And we can specify "device_type" of "nvram" indeed (and #size).

I suppose you meant #bytes.

Of course. :-)

Quoted 1 line

What about sub-partitions support ? Nothing prevents RAM-based MTD devices

Hm... I remember that the knowledge of MTD partitions turned me away from
"nvram" device type when I started spec'ing the flash binding -- it's not uncommon to have a flash partition devoted to and labelled as "nvram". Therefore, that sole partition would have been a "nvram" device for OF...

Quoted 1 line

from being partioned. Would it be acceptable to reference the CFI/JEDEC flash section in Documentation/powerpc/booting-without-of.txt in the description of the nvram node ?

I don't see why not.

Quoted 1 line

Best regards,

WBR, Sergei

#13 lore raw
In reply to Laurent Pinchart
Quoted 7 lines · Laurent Pinchart
Quoted 2 lines · Sergei Shtylyov

Laurent Pinchart wrote:
=20

Regarding non-volatility nothing prevents a user from using a=20 volatile RAM as an MTD device, but there's little point in doing so. Would it be acceptable for the "linear-nvram" specification not to include > volatile RAM ? ROM chips would be excluded too. Is

that an issue ?

We actually use a volatile ram (SRAM) as an MTD device. We use it to store info from bootloader and system specific values between resets.

#14 lore raw
Quoted 4 lines · Rune Torgersen
Quoted 3 lines · Laurent Pinchart
Quoted 2 lines · Sergei Shtylyov

Laurent Pinchart wrote:

Quoted 8 lines
Quoted 4 lines

Regarding non-volatility nothing prevents a user from using a volatile RAM as an MTD device, but there's little point in doing so. Would it be acceptable for the "linear-nvram" specification not to include > volatile RAM ? ROM chips would be excluded too. Is

that an issue ?

We actually use a volatile ram (SRAM) as an MTD device. We use it to store info from bootloader and system specific values between resets.

So we're left with two main options.

- Reusing the nvram device type from the Device Support Extensions. Volatile devices wouldn't be supported, and we'd need a separate device specification for linear-mapped volatile RAMs. I'm not very happy with that.

- Using another device node with a compatible value set to "linear-ram" (or something similar). This would support both volatile and non-volatile devices, and a property could be added to specify if the device is volatile or not.

I'd go for the second option, and I'd specify a "linear-rom" compatible value as well while we're at it.

Both volatile and non-volatile RAMs can be handled by the physmap_of MTD driver. They both use the same map probe type ("map_ram"). Volatility isn't handled there.

ROMs should be handled by the same driver and should use the "mtd_rom" map probe type.

As all those devices use the physmap_of MTD driver, what about using "physmap-ram" and "physmap-rom" as compatibility names ?

Best regards,

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#15 lore raw
Quoted 14 lines · Laurent Pinchart
Quoted 8 lines
Quoted 3 lines

Regarding non-volatility nothing prevents a user from using a volatile RAM as an MTD device, but there's little point in doing so. Would it be acceptable for the "linear-nvram" specification
not to include > volatile RAM ? ROM chips would be excluded too. Is

that an issue ?

We actually use a volatile ram (SRAM) as an MTD device. We use it to store info from bootloader and system specific values between resets.

So we're left with two main options.

- Reusing the nvram device type from the Device Support Extensions. Volatile
devices wouldn't be supported, and we'd need a separate device specification for linear-mapped volatile RAMs. I'm not very happy with that.

Quoted 8 lines

- Using another device node with a compatible value set to "linear-ram" (or
something similar). This would support both volatile and non-volatile devices, and a property could be added to specify if the device is volatile or not.

I'd go for the second option, and I'd specify a "linear-rom" compatible value as well while we're at it.

Both volatile and non-volatile RAMs can be handled by the physmap_of MTD driver. They both use the same map probe type ("map_ram"). Volatility isn't handled there.

ROMs should be handled by the same driver and should use the "mtd_rom" map probe type.

OK, let's go with it.

Quoted 1 line

As all those devices use the physmap_of MTD driver, what about using "physmap-ram" and "physmap-rom" as compatibility names ?

Heh, we've gone thru "physmap" before -- it was labelled Linux-specific
name (well, I'd agree with that).

Quoted 1 line

Best regards,

WBR, Sergei

#16 lore raw
Quoted 6 lines · Sergei Shtylyov

Laurent Pinchart wrote:
=20

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Regarding non-volatility nothing prevents a user from using a=20 volatile RAM as an MTD device, but there's little point in doing so. Would it be acceptable for the "linear-nvram" specification not to include > volatile RAM ? ROM chips would be excluded too. Is

Quoted 9 lines

=20

Quoted 1 line
Quoted 1 line

that an issue ?

=20

Quoted 2 lines
Quoted 2 lines

We actually use a volatile ram (SRAM) as an MTD device. We use it to store info from bootloader and system specific values between resets.

=20

Quoted 1 line

So we're left with two main options.

=20

Quoted 1 line

- Reusing the nvram device type from the Device Support Extensions.=20

Volatile=20

Quoted 1 line
Quoted 1 line

devices wouldn't be supported, and we'd need a separate device=20

specification=20

Quoted 3 lines
Quoted 1 line

for linear-mapped volatile RAMs. I'm not very happy with that.

=20

Quoted 1 line

- Using another device node with a compatible value set to "linear-ram"=

=20
(or=20

Quoted 2 lines
Quoted 2 lines

something similar). This would support both volatile and non-volatile=20 devices, and a property could be added to specify if the device is=20

volatile=20

Quoted 3 lines
Quoted 1 line

or not.

=20

Quoted 1 line

I'd go for the second option, and I'd specify a "linear-rom" compatible=

=20
value=20

Quoted 3 lines
Quoted 1 line

as well while we're at it.

=20

Quoted 1 line

Both volatile and non-volatile RAMs can be handled by the physmap_of MT=

D=20

Quoted 1 line
Quoted 1 line

driver. They both use the same map probe type ("map_ram"). Volatility=20

isn't=20

Quoted 3 lines
Quoted 1 line

handled there.

=20

Quoted 1 line

ROMs should be handled by the same driver and should use the "mtd_rom" =

map=20

Quoted 8 lines
Quoted 1 line

probe type.

=20
OK, let's go with it.
=20

Quoted 2 lines

As all those devices use the physmap_of MTD driver, what about=20 using "physmap-ram" and "physmap-rom" as compatibility names ?

=20
Heh, we've gone thru "physmap" before -- it was labelled Linux-specif=

ic=20

Quoted 1 line

name (well, I'd agree with that).

physmap stands for physically mapped. That doesn't sound Linux-specific to = me,=20
the fact that the MTD driver has the same name is a pure coincidence.=20 linmap-rom and linmap-rom sound even more Linux-specific :-)

Could we agree on a name ? I'd like to submit a new patch.

=2D-=20
Laurent Pinchart
CSE Semaphore Belgium

Chauss=E9e de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
=46 +32 (2) 387 42 75

#17 lore raw
Quoted 2 lines · Laurent Pinchart
Quoted 1 line · Sergei Shtylyov

Laurent Pinchart wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

Heh, we've gone thru "physmap" before -- it was labelled Linux-specific
name (well, I'd agree with that).

physmap stands for physically mapped. That doesn't sound Linux-specific to me, the fact that the MTD driver has the same name is a pure coincidence. linmap-rom and linmap-rom sound even more Linux-specific :-)

It may not be Linux specific per se, but it's a bad name, because the fact that the device is physically direct mapped isn't a useful distinguishing feature of the device. Main memory is also direct physically mapped, after all, but that's not what you want to cover with this description. In general how a device is wired is described by where it sits in the tree, not by its properties.

It only seems like a usefully distinguishing name because it's the Linux "physmap_of" driver that uses it. So in this sense it is a Linux specific name after all. In fact, physmap_of is itself very badly named - right now it only handles direct mapped mtds, but that's not inherent; it could be trivially extended to also instantiate a non-direct-mapped device (as long as the underlying mtd layer supported it, of course). It bears no relation at all to the "physmap" driver, except historical accident.

Quoted 1 line

Could we agree on a name ? I'd like to submit a new patch.

For ROMs I think just plain "rom" should be sufficient. For RAMs we need something to indicate that it's memory but intended for secondary storage, not as main memory. Unfortunately, I'm finding myself unable to think of something.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#18 lore raw

Hello.

Quoted 7 lines · David Gibson
Quoted 1 line
Quoted 1 line

Laurent Pinchart wrote:

[snip]

Quoted 2 lines
Quoted 2 lines

Heh, we've gone thru "physmap" before -- it was labelled Linux-specific
name (well, I'd agree with that).

Quoted 8 lines
Quoted 4 lines

physmap stands for physically mapped. That doesn't sound Linux-specific to me, the fact that the MTD driver has the same name is a pure coincidence. linmap-rom and linmap-rom sound even more Linux-specific :-)

It may not be Linux specific per se, but it's a bad name, because the fact that the device is physically direct mapped isn't a useful distinguishing feature of the device.

Yeah, it's not a propery of a device itself (yet, the device would be
useless if this information is not supplied in the tree somehow). Yet remember the now ungoing discussion about "reg-shift" property for UARTs -- some people said that the fact that this property may not be a feature of device is irrelevant WRT the binding. :-)

Quoted 2 lines

Main memory is also direct physically mapped, after all, but that's not what you want to cover with this description.

Haven't ever seen the description of memory as a device (unless you mean
the "memory" node which can hardly be considered proper device -- mainly because of their usual placement at the top of the tree, and not where a RAM device logically should be in the bus hierarchy).

Quoted 1 line

In general how a device is wired is described by where it sits in the tree, not by its properties.

Oh, another argument against "reg-shift" in the Xilinx UART quarry... :-)

Quoted 4 lines

It only seems like a usefully distinguishing name because it's the Linux "physmap_of" driver that uses it. So in this sense it is a Linux specific name after all. In fact, physmap_of is itself very badly named - right now it only handles direct mapped mtds, but that's

Yeah, because that's what is what it has been written for.

Quoted 4 lines

not inherent; it could be trivially extended to also instantiate a non-direct-mapped device (as long as the underlying mtd layer
supported it, of course). It bears no relation at all to the
"physmap" driver, except historical accident.

This driver resides on the "top", device mapping layer of the MTD
hierarchy, and I don't see a point of cramming support for all the possible mappings into one driver vs doing it as the *separate* specific drivers in drivers/mtd/mapps/ -- as it has been done in the MTD tree before "the great OF revolution". This is really strange idea...

WBR, Sergei

#19 lore raw
Quoted 26 lines · Sergei Shtylyov

Hello.

Quoted 7 lines · David Gibson
Quoted 1 line
Quoted 1 line

Laurent Pinchart wrote:

[snip]

Quoted 2 lines
Quoted 2 lines

Heh, we've gone thru "physmap" before -- it was labelled
Linux-specific name (well, I'd agree with that).

Quoted 8 lines
Quoted 4 lines

physmap stands for physically mapped. That doesn't sound Linux-specific to me, the fact that the MTD driver has the same name is a pure coincidence. linmap-rom and linmap-rom sound even more Linux-specific :-)

It may not be Linux specific per se, but it's a bad name, because the fact that the device is physically direct mapped isn't a useful distinguishing feature of the device.

Yeah, it's not a propery of a device itself (yet, the device would be
useless if this information is not supplied in the tree somehow). Yet remember the now ungoing discussion about "reg-shift" property for UARTs -- some people said that the fact that this property may not be a feature of device is irrelevant WRT the binding. :-)

Quoted 8 lines
Quoted 3 lines

Main memory is also direct physically mapped, after all, but that's not what you want to cover
with this description.

Haven't ever seen the description of memory as a device (unless you mean
the "memory" node which can hardly be considered proper device -- mainly because of their usual placement at the top of the tree, and not where a RAM device logically should be in the bus hierarchy).

Yes, I mean the memory node. And although it's no very likely, there's no inherent reason a RAM device couldn't also be at the top of the tree, on a CPU with the right sort of localbus.

Quoted 5 lines
Quoted 2 lines

In general how a device is wired is described by where it sits in the tree, not by its properties.

Oh, another argument against "reg-shift" in the Xilinx UART quarry...
:-)

Not really. I was perhaps a bit strong, wiring information in the properties isn't necessarily wrong, but it does need a close look. "reg-shift" is a useful compromise.

Quoted 12 lines
Quoted 4 lines

It only seems like a usefully distinguishing name because it's the Linux "physmap_of" driver that uses it. So in this sense it is a Linux specific name after all. In fact, physmap_of is itself very badly named - right now it only handles direct mapped mtds, but that's

Yeah, because that's what is what it has been written for.

Quoted 4 lines

not inherent; it could be trivially extended to also instantiate a non-direct-mapped device (as long as the underlying mtd layer
supported it, of course). It bears no relation at all to the
"physmap" driver, except historical accident.

Quoted 4 lines

This driver resides on the "top", device mapping layer of the MTD
hierarchy, and I don't see a point of cramming support for all the possible mappings into one driver vs doing it as the *separate* specific drivers in drivers/mtd/mapps/

Because doing it as separate drivers would mean duplicating most of physmap_of for absolutely no reason. I'll say it again there is *nothing* that actually relies on the direct mapping in physmap_of; the *only* thing it does is take the device tree information and marshal it into an initialization call for the appropriate mtd chip drivers.

I really should get around to sending a patch to rename physmap_of to "of_mtd.c".

Quoted 2 lines

-- as it has been done in the MTD tree before "the great OF revolution". This is really strange idea...

The only reason mtd needs heaps of little "map drivers" (which barely deserve the title of "driver") is because there wasn't a single generally available source of information about where and how flash was mapped so a whole pile of platform or sitation specific ways of getting that information were needed. With a device tree all that can be replaced with just getting the information from the device tree.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#20 lore raw
Quoted 18 lines · David Gibson
Quoted 17 lines
Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

Heh, we've gone thru "physmap" before -- it was labelled
Linux-specific name (well, I'd agree with that).

physmap stands for physically mapped. That doesn't sound Linux-specific to me, the fact that the MTD driver has the same name is a pure coincidence. linmap-rom and linmap-rom sound even more Linux-specific :-)

It may not be Linux specific per se, but it's a bad name, because the fact that the device is physically direct mapped isn't a useful distinguishing feature of the device.

Yeah, it's not a propery of a device itself (yet, the device would be
useless if this information is not supplied in the tree somehow). Yet remember the now ungoing discussion about "reg-shift" property for UARTs -- some people said that the fact that this property may not be a feature of device is irrelevant WRT the binding. :-)

Quoted 2 lines

Main memory is also direct physically mapped, after all, but that's not what you want to cover with this description.

Quoted 6 lines
Quoted 2 lines

Haven't ever seen the description of memory as a device (unless you mean
the "memory" node which can hardly be considered proper device -- mainly because of their usual placement at the top of the tree, and not where a RAM device logically should be in the bus hierarchy).

Yes, I mean the memory node. And although it's no very likely, there's no inherent reason a RAM device couldn't also be at the top of the tree, on a CPU with the right sort of localbus.

Yeah, according to the spec. this represents a RAM device. Too bad it's
too often misplaced in the tree being on the top layer, and creating confusion (I used to misplace MTD device because of that)... :-(

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

In general how a device is wired is described by where it sits in the tree, not by its properties.

Oh, another argument against "reg-shift" in the Xilinx UART quarry...
:-)

Not really. I was perhaps a bit strong, wiring information in the properties isn't necessarily wrong, but it does need a close look. "reg-shift" is a useful compromise.

And I've heard it's been spec'ed already. :-)
And MTD could surely a subject to alike compromise since it can be wired
to the bus in a weird way too (not very likely though).

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

not inherent; it could be trivially extended to also instantiate a non-direct-mapped device (as long as the underlying mtd layer
supported it, of course). It bears no relation at all to the
"physmap" driver, except historical accident.

This driver resides on the "top", device mapping layer of the MTD

Which is actually bottom of course call-wise since it reads/writes the
actual data for the upper layers.

Quoted 4 lines
Quoted 1 line

hierarchy, and I don't see a point of cramming support for all the possible mappings into one driver vs doing it as the *separate* specific drivers in drivers/mtd/mapps/

Because doing it as separate drivers would mean duplicating most of physmap_of for absolutely no reason. I'll say it again there is

Duplicating what, device probe/remove code? Partition parsing has been at
last factored out into separate module by somebody (that patch should be queued in the MTD tree though I'm not sure), the old probing/partition code (i.e. our lame one) is not needed for the newly added devices...

Quoted 1 line

*nothing* that actually relies on the direct mapping in physmap_of;

Really? Even simple_map_init() call it does?

Quoted 3 lines

the *only* thing it does is take the device tree information and marshal it into an initialization call for the appropriate mtd chip drivers.

No, not only that...

Quoted 2 lines

I really should get around to sending a patch to rename physmap_of to "of_mtd.c".

I don't think you should bother with that.

Quoted 5 lines
Quoted 2 lines

-- as it has been done in the MTD tree before "the great OF revolution". This is really strange idea...

The only reason mtd needs heaps of little "map drivers" (which barely deserve the title of "driver")

It's a layered driver structure

Quoted 3 lines

is because there wasn't a single
generally available source of information about where and how flash was mapped

Not entirely true. You could try passing extra info with the platform
device information...

Quoted 2 lines

so a whole pile of platform or sitation specific ways of getting that information were needed.

Some drivers read the h/w registers to determine the right type of mapping
-- well, this probably could be replaced with reading this info from the device tree...

Quoted 2 lines

With a device tree all that can
be replaced with just getting the information from the device tree.

Don't forget that such a universal driver would be taking extra kernel
memory space as well, being loaded with the unused code handling all known mappings as well as extra probe/remove code...

WBR, Sergei

#21 lore raw
In reply to David Gibson
Quoted 28 lines · David Gibson
Quoted 2 lines · Laurent Pinchart
Quoted 1 line · Sergei Shtylyov

Laurent Pinchart wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

Heh, we've gone thru "physmap" before -- it was labelled Linux-specific name (well, I'd agree with that).

physmap stands for physically mapped. That doesn't sound Linux-specific to me, the fact that the MTD driver has the same name is a pure coincidence. linmap-rom and linmap-rom sound even more Linux-specific :-)

It may not be Linux specific per se, but it's a bad name, because the fact that the device is physically direct mapped isn't a useful distinguishing feature of the device. Main memory is also direct physically mapped, after all, but that's not what you want to cover with this description. In general how a device is wired is described by where it sits in the tree, not by its properties.

It only seems like a usefully distinguishing name because it's the Linux "physmap_of" driver that uses it. So in this sense it is a Linux specific name after all. In fact, physmap_of is itself very badly named - right now it only handles direct mapped mtds, but that's not inherent; it could be trivially extended to also instantiate a non-direct-mapped device (as long as the underlying mtd layer supported it, of course). It bears no relation at all to the "physmap" driver, except historical accident.

Quoted 6 lines
Quoted 1 line

Could we agree on a name ? I'd like to submit a new patch.

For ROMs I think just plain "rom" should be sufficient. For RAMs we need something to indicate that it's memory but intended for secondary storage, not as main memory. Unfortunately, I'm finding myself unable to think of something.

What about "storage-ram", "auxiliary-ram", "secondary-ram", "application-ram", "user-ram" or "ramdisk" ?

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#22 lore raw
Quoted 31 lines · Laurent Pinchart
Quoted 30 lines · David Gibson
Quoted 2 lines · Laurent Pinchart
Quoted 1 line · Sergei Shtylyov

Laurent Pinchart wrote:

[snip]

Quoted 7 lines
Quoted 2 lines

Heh, we've gone thru "physmap" before -- it was labelled Linux-specific name (well, I'd agree with that).

physmap stands for physically mapped. That doesn't sound Linux-specific to me, the fact that the MTD driver has the same name is a pure coincidence. linmap-rom and linmap-rom sound even more Linux-specific :-)

It may not be Linux specific per se, but it's a bad name, because the fact that the device is physically direct mapped isn't a useful distinguishing feature of the device. Main memory is also direct physically mapped, after all, but that's not what you want to cover with this description. In general how a device is wired is described by where it sits in the tree, not by its properties.

It only seems like a usefully distinguishing name because it's the Linux "physmap_of" driver that uses it. So in this sense it is a Linux specific name after all. In fact, physmap_of is itself very badly named - right now it only handles direct mapped mtds, but that's not inherent; it could be trivially extended to also instantiate a non-direct-mapped device (as long as the underlying mtd layer supported it, of course). It bears no relation at all to the "physmap" driver, except historical accident.

Quoted 1 line

Could we agree on a name ? I'd like to submit a new patch.

Quoted 7 lines
Quoted 4 lines

For ROMs I think just plain "rom" should be sufficient. For RAMs we need something to indicate that it's memory but intended for secondary storage, not as main memory. Unfortunately, I'm finding myself unable to think of something.

What about "storage-ram", "auxiliary-ram", "secondary-ram", "application-ram", "user-ram" or "ramdisk" ?

Well, I like all those better than anything previously suggested. "storage-ram" is probably my favourite. It still doesn't seem great, but given I've been unable to thing of something better.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#23 lore raw
In reply to David Gibson
Quoted 3 lines
Quoted 1 line

Could we agree on a name ? I'd like to submit a new patch.

For ROMs I think just plain "rom" should be sufficient.

Yes.

Quoted 3 lines

For RAMs we
need something to indicate that it's memory but intended for secondary storage, not as main memory.

How it is intended to be used is not a property of the hardware, so that information doesn't belong in the device tree at all. The Linux platform code should handle this, I imagine.

Segher

#24 lore raw
Quoted 7 lines · Segher Boessenkool
Quoted 3 lines

For RAMs we
need something to indicate that it's memory but intended for secondary storage, not as main memory.

How it is intended to be used is not a property of the hardware, so that information doesn't belong in the device tree at all. The Linux platform code should handle this, I imagine.

There must be some reason why it is not intended to be used as main memory. Presumably it has something different about it compared to "normal" RAM, and that difference could perfectly well be expressed in the device tree.

Paul.

#25 lore raw
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

For RAMs we
need something to indicate that it's memory but intended for secondary storage, not as main memory.

Quoted 8 lines
Quoted 3 lines

How it is intended to be used is not a property of the hardware, so that information doesn't belong in the device tree at all. The Linux platform code should handle this, I imagine.

There must be some reason why it is not intended to be used as main memory. Presumably it has something different about it compared to "normal" RAM, and that difference could perfectly well be expressed in the device tree.

Sure, that's a different thing. It might sit on a bus that doesn't do cache coherency, or maybe it's just slow (or sits on a slow bus). All these things can be usefully expressed in the device tree (but typically are not, it is left to the client code to know this stuff implicitly).

It's still the (platform) probe code its responsibility to figure out what (if anything) to do with any device. And "main memory" is probed differently (via /chosen/memory, for example) anyway. Well, actually, Linux searches for all nodes with device_type "memory", which should work fine as well [*].

So, all in all, I think we should just give these "auxiliary memory" devices a name of "ram" c.q. "rom", and some "reg", and that should be all that is needed: the main memory probe stuff won't consider these nodes, and the (platform) device probe code can do whatever it wants (create mtd devices, I guess).

Segher

[*] It seems to me the longtrail workaround code in prom_init.c is incorrect though: it will match any node with name "memory" that doesn't have a device_type?

#26 lore raw
Quoted 11 lines · Segher Boessenkool

It's still the (platform) probe code its responsibility to figure out what (if anything) to do with any device. And "main memory" is probed differently (via /chosen/memory, for example) anyway. Well, actually, Linux searches for all nodes with device_type "memory", which should work fine as well [*].

So, all in all, I think we should just give these "auxiliary memory" devices a name of "ram" c.q. "rom", and some "reg", and that should be all that is needed: the main memory probe stuff won't consider these nodes, and the (platform) device probe code can do whatever it wants (create mtd devices, I guess).

Sounds reasonable.

Quoted 3 lines

[*] It seems to me the longtrail workaround code in prom_init.c is incorrect though: it will match any node with name "memory" that doesn't have a device_type?

It only matches on children of the root node, and it's that way because the /memory node in the longtrail device tree doesn't have a device_type. Actually we could probably remove the longtrail stuff now; I think mine has stopped working, and I only know of 2 others in existence. :)

Paul.

#27 lore raw
Quoted 5 lines
Quoted 3 lines

[*] It seems to me the longtrail workaround code in prom_init.c is incorrect though: it will match any node with name "memory" that doesn't have a device_type?

It only matches on children of the root node,

Oh okay, I misread that then.

Quoted 3 lines

and it's that way
because the /memory node in the longtrail device tree doesn't have a device_type.

Yeah.

Quoted 3 lines

Actually we could probably remove the longtrail stuff
now; I think mine has stopped working, and I only know of 2 others in existence. :)

I'll prepare a patch.

Segher

#28 lore raw

[Removed linux-mtd from cc:]

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

[*] It seems to me the longtrail workaround code in prom_init.c is incorrect though: it will match any node with name "memory" that doesn't have a device_type?

It only matches on children of the root node,

Oh okay, I misread that then.

...No, I did not. prom_next_node() does a depth-first tree traversal.

Quoted 5 lines
Quoted 3 lines

Actually we could probably remove the longtrail stuff
now; I think mine has stopped working, and I only know of 2 others in existence. :)

I'll prepare a patch.

...Actually, that's a lot of code to rip out, and I can't test this at all, so I'll have to pass on this.

Segher

#29 lore raw
In reply to Segher Boessenkool
Quoted 23 lines · Segher Boessenkool
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

For RAMs we
need something to indicate that it's memory but intended for=20 secondary
storage, not as main memory.

Quoted 8 lines
Quoted 3 lines

How it is intended to be used is not a property of the hardware, so that information doesn't belong in the device tree at all. The Linux platform code should handle this, I imagine.

There must be some reason why it is not intended to be used as main memory. Presumably it has something different about it compared to "normal" RAM, and that difference could perfectly well be expressed in the device tree.

=20
Sure, that's a different thing. It might sit on a bus that doesn't do cache coherency, or maybe it's just slow (or sits on a slow bus). All these things can be usefully expressed in the device tree (but typically are not, it is left to the client code to know this stuff implicitly).
=20
It's still the (platform) probe code its responsibility to figure out what (if anything) to do with any device. And "main memory" is probed differently (via /chosen/memory, for example) anyway.

Quoted 8 lines

Well, actually, Linux searches for all nodes with device_type "memory", which should work fine as well [*].
=20
So, all in all, I think we should just give these "auxiliary memory" devices a name of "ram" c.q. "rom", and some "reg", and that should be all that is needed: the main memory probe stuff won't consider these nodes, and the (platform) device probe code can do whatever it wants (create mtd devices, I guess).

Ok, I get your point. I'll prepare a new documentation patch; changes to=20 physmap_of.c will go away.

If I understand you correctly, there should be no "compatible" property on = the=20
ram and rom devices. Should the "non-volatile", "slow" and "static ram"=20 properties still be expressed in the device tree ?

=2D-=20
Laurent Pinchart
CSE Semaphore Belgium

Chauss=E9e de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
=46 +32 (2) 387 42 75

#30 lore raw
Quoted 8 lines
Quoted 5 lines

So, all in all, I think we should just give these "auxiliary memory" devices a name of "ram" c.q. "rom", and some "reg", and that should be all that is needed: the main memory probe stuff won't consider these nodes, and the (platform) device probe code can do whatever it wants (create mtd devices, I guess).

Ok, I get your point. I'll prepare a new documentation patch; changes to physmap_of.c will go away.

Thanks.

Quoted 2 lines

If I understand you correctly, there should be no "compatible" property on the ram and rom devices.

They aren't normally needed here, I think.

Quoted 2 lines

Should the "non-volatile", "slow" and "static ram" properties still be expressed in the device tree ?

If those are useful. I'll need to see a proposed binding to form an opinion on this, it's too vague now, sorry.

Segher

#31 lore raw
In reply to Laurent Pinchart
Quoted 3 lines

So we're left with two main options.

- Reusing the nvram device type from the Device Support Extensions.

This wouldn't bring you anything. A device_type is only used internally by OF, to decide what device nodes support which OF programming model. If you only have a flat device tree, "device_type" should be used only as a workaround for older kernels that require it.

Quoted 5 lines

- Using another device node with a compatible value set to "linear-ram" (or
something similar). This would support both volatile and non-volatile devices, and a property could be added to specify if the device is volatile or not.

"memory-mapped-memory" perhaps :-)

Or, just "memory". Although that one might play havoc with some not-quite-correct main memory probing code.

Segher

#32 lore raw
Quoted 9 lines · Segher Boessenkool
Quoted 5 lines

- Using another device node with a compatible value set to "linear-ram" (or
something similar). This would support both volatile and non-volatile devices, and a property could be added to specify if the device is volatile or not.

"memory-mapped-memory" perhaps :-)

Or, just "memory". Although that one might play havoc with some

I'd suggest "ram" and "rom" then. Luckily the device trees don't contain
binding for the real RAM chips yet. :-)

Quoted 1 line

not-quite-correct main memory probing code.

You mean the there's parsers that search the "compatible" prop for
"memory" as well as "device_type" prop?

Quoted 1 line

Segher

WBR, Sergei

#33 lore raw
Quoted 9 lines · Sergei Shtylyov
Quoted 6 lines · Segher Boessenkool
Quoted 6 lines

- Using another device node with a compatible value set to "linear-ram" (or
something similar). This would support both volatile and non-volatile devices, and a property could be added to specify if the device is volatile
or not.

Quoted 6 lines
Quoted 3 lines

"memory-mapped-memory" perhaps :-)

Or, just "memory". Although that one might play havoc with some

I'd suggest "ram" and "rom" then. Luckily the device trees don't contain
binding for the real RAM chips yet. :-)

And when it will we'll be in trouble.

Here are a few names. I like physmap-r[ao]m better. Does anyone have another suggestion ? I'd like to send a revised patch.

linear-r[ao]m
linear-mapped-r[ao]m
mapped-r[ao]m
memory-mapped-r[ao]m
physmap-r[ao]m

Quoted 4 lines
Quoted 1 line

not-quite-correct main memory probing code.

You mean the there's parsers that search the "compatible" prop for
"memory" as well as "device_type" prop?

Signature · 9 lines
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75
#34 lore raw
In reply to Sergei Shtylyov
Quoted 11 lines
Quoted 3 lines

"memory-mapped-memory" perhaps :-)

Or, just "memory". Although that one might play havoc with some

I'd suggest "ram" and "rom" then. Luckily the device trees don't
contain binding for the real RAM chips yet. :-)

Quoted 1 line

not-quite-correct main memory probing code.

You mean the there's parsers that search the "compatible" prop for
"memory" as well as "device_type" prop?

There are parsers that make all kinds of mistakes, sure.

The code that figures out what region of ram to use should look at the node pointed to by /chosen/memory, it's shouldn't look for anything with a certain "compatible", and it shouldn't look at "device_type" _at all_.

Segher

#35 lore raw
In reply to Laurent Pinchart
Quoted 2 lines

The nvram device descrived in the Device Support Extensions is probably meant to describe the kind of nvram found in RTC chips.

It describes a generic interface _within OF_ for _all kinds_ of NVRAM, both physical and virtual.

Segher

#36 lore raw
In reply to David Gibson
Quoted 6 lines · David Gibson
Quoted 2 lines · Rune Torgersen

We ran ito the same issue.
We did option 3, as it was efinetly the easiest,

I think this is the best option in principle.

Quoted 8 lines
Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

Yea, I know. But it was the easiest way of doing it at the time we did our port....
In a timecrunch, easier is sometimes better than correct. :)

#37 lore raw
Quoted 11 lines · Rune Torgersen
Quoted 10 lines · David Gibson
Quoted 2 lines · Rune Torgersen

We ran ito the same issue.
We did option 3, as it was efinetly the easiest,

I think this is the best option in principle.

Quoted 1 line

here is the sram entry in our dts:

Except that your implementation of it is not good.

Quoted 8 lines
Quoted 4 lines

You're relying on the old obsolete flash binding with the "probe-type" field. The solution should be adapted to the new approach which uses values in the "compatible" field to indicate various sorts of flash device.

Yea, I know. But it was the easiest way of doing it at the time we did our port....
In a timecrunch, easier is sometimes better than correct. :)

Well sure, but don't expect others to be swayed by your time pressure.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson