Skip to contentSkip to conversation

arm: dts: Add pnor label for wspoon and romulus

PATCH In review Joel Stanley 2 participants 4 messages Nov 11, 2016 – Nov 14, 2016

Subsystems (2)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 arm: dts: Add pnor label for wspoon and romulus

This is required by userspace (pflash) to identify the PNOR.

---
 arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts     | 1 +
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 1 +
 2 files changed, 2 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts +1 -0
index 4c4c547fe412..c23627ec5e84 100644
@@ -40,6 +40,7 @@
 
 	flash@0 {
 		status = "okay";
+		label = "pnor";
 	};
 };
 
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
index 7badbda288d3..75c6b68950f9 100644
@@ -40,6 +40,7 @@
 
 	flash@0 {
 		status = "okay";
+		label = "pnor";
 	};
 };
 
Signature · 1 line
2.10.2
#1 lore raw
Quoted 26 lines · Joel Stanley

This is required by userspace (pflash) to identify the PNOR.

---
 arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts     | 1 +
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 1 +
 2 files changed, 2 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts +1 -0
index 4c4c547fe412..c23627ec5e84 100644
@@ -40,6 +40,7 @@
 
 	flash@0 {
 		status = "okay";
+		label = "pnor";
 	};
 };
 
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index 7badbda288d3..75c6b68950f9 100644

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 46

Quoted 7 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
@@ -40,6 +40,7 @@
 
 	flash@0 {
 		status = "okay";
+		label = "pnor";
 	};
 };
 

So, according to :

Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt Documentation/devicetree/bindings/mtd/partitions.txt

we can not label the flash module node but we can label the partition instead. Would a patch like below fit the need ? Here is what we get on a palmetto and an EVB, the approach are different.

	root@palmetto:~# cat /proc/mtd 
	dev:    size   erasesize  name
	mtd0: 00060000 00001000 "u-boot"
	mtd1: 00020000 00001000 "u-boot-env"
	mtd2: 00280000 00001000 "kernel"
	mtd3: 001c0000 00001000 "initramfs"
	mtd4: 01740000 00001000 "rofs"
	mtd5: 00400000 00001000 "rwfs"
	mtd6: 02000000 00010000 "1e630000.spi:pnor@0"
	root@evb-ast2500:~# cat /proc/mtd 
	dev:    size   erasesize  name
	mtd0: 00060000 00001000 "u-boot"
	mtd1: 00020000 00001000 "u-boot-env"
	mtd2: 00280000 00001000 "kernel"
	mtd3: 001c0000 00001000 "initramfs"
	mtd4: 01740000 00001000 "rofs"
	mtd5: 00400000 00001000 "rwfs"
	mtd6: 02000000 00010000 "pnor"

The partition definitions probably belongs to the machine dts.

And a udev rules would also fit the purpose I think.

Cheers,

C.

From 614e34a070c852f36d7f277e4fda0da1f67293c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <[email protected]>
Date: Fri, 11 Nov 2016 08:53:45 +0100
Subject: [PATCH] ARM: dts: aspeed: remove label and use partitions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 arch/arm/boot/dts/aspeed-bmc-opp-flash-layout.dtsi | 5 ++++-
 arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts      | 3 +--
 arch/arm/boot/dts/aspeed-g5.dtsi                   | 9 +++++++++
 3 files changed, 14 insertions(+), 3 deletions(-)
arch/arm/boot/dts/aspeed-bmc-opp-flash-layout.dtsi +4 -1
index ca8639b52f6d..be57e7b11bac 100644
@@ -1,7 +1,9 @@
 /* This file is the label for the bmc primary flash and its partitions */
-				label = "bmc";
+
+		    partitions {
 				#address-cells = < 1 >;
 				#size-cells = < 1 >;
+				compatible = "fixed-partitions";
 				u-boot {
 					reg = < 0 0x60000 >;
 					label = "u-boot";
@@ -26,3 +28,4 @@
 					reg = < 0x1c00000 0x400000 >;
 					label = "rwfs";
 				};
+		    };
\ No newline at end of file
arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts +1 -2
index 0fd60c4eafad..8fe248f4d531 100644
@@ -58,10 +58,9 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "aspeed,ast2400-smc";
-			flash {
+			pnor@0 {
 				reg = < 0 >;
 				compatible = "jedec,spi-nor" ;
-				label = "pnor";
 			};
 		};
 	};
arch/arm/boot/dts/aspeed-g5.dtsi +9 -0
index be95fd42dbd7..53bb2472664e 100644
@@ -62,6 +62,15 @@
 				reg = < 0 >;
 				compatible = "jedec,spi-nor";
 				status = "disabled";
+				partitions {
+					   compatible = "fixed-partitions";
+					   #address-cells = < 1 >;
+					   #size-cells = < 1 >;
+					   pnor@0 {
+						reg = < 0x0 0x2000000 >;
+					   };
+				};
+
 			};
 			flash@1 {
 				reg = < 1 >;
Signature · 1 line
2.7.4
author maintainer
#2 lore raw
Quoted 9 lines · Cédric Le Goater

So, according to :

Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt Documentation/devicetree/bindings/mtd/partitions.txt

we can not label the flash module node but we can label the partition instead. Would a patch like below fit the need ? Here is what we get on a palmetto and an EVB, the approach are different.

Okay. That's annoying.

Is there a reason we can't coax the ast2400 version to call it just 'pnor' as well?

Quoted 21 lines
        root@palmetto:~# cat /proc/mtd
        dev:    size   erasesize  name
        mtd0: 00060000 00001000 "u-boot"
        mtd1: 00020000 00001000 "u-boot-env"
        mtd2: 00280000 00001000 "kernel"
        mtd3: 001c0000 00001000 "initramfs"
        mtd4: 01740000 00001000 "rofs"
        mtd5: 00400000 00001000 "rwfs"
        mtd6: 02000000 00010000 "1e630000.spi:pnor@0"
        root@evb-ast2500:~# cat /proc/mtd
        dev:    size   erasesize  name
        mtd0: 00060000 00001000 "u-boot"
        mtd1: 00020000 00001000 "u-boot-env"
        mtd2: 00280000 00001000 "kernel"
        mtd3: 001c0000 00001000 "initramfs"
        mtd4: 01740000 00001000 "rofs"
        mtd5: 00400000 00001000 "rwfs"
        mtd6: 02000000 00010000 "pnor"
Quoted 3 lines

The partition definitions probably belongs to the machine dts.

And a udev rules would also fit the purpose I think.

What would you suggest? A symlink to create a /dev/pnor node?

Cheers,

Joel

#3 lore raw
Quoted 11 lines · Joel Stanley
Quoted 9 lines · Cédric Le Goater

So, according to :

Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt Documentation/devicetree/bindings/mtd/partitions.txt

we can not label the flash module node but we can label the partition instead. Would a patch like below fit the need ? Here is what we get on a palmetto and an EVB, the approach are different.

Quoted 4 lines

Okay. That's annoying.

Is there a reason we can't coax the ast2400 version to call it just 'pnor' as well?

none. that was a proposal for different solutions.

Quoted 10 lines
Quoted 10 lines
        root@palmetto:~# cat /proc/mtd
        dev:    size   erasesize  name
        mtd0: 00060000 00001000 "u-boot"
        mtd1: 00020000 00001000 "u-boot-env"
        mtd2: 00280000 00001000 "kernel"
        mtd3: 001c0000 00001000 "initramfs"
        mtd4: 01740000 00001000 "rofs"
        mtd5: 00400000 00001000 "rwfs"
        mtd6: 02000000 00010000 "1e630000.spi:pnor@0"

we can do a strstr when parsing /proc/mtd. This is probably the best solution to simply handle compatibility.

Quoted 9 lines
Quoted 9 lines
        root@evb-ast2500:~# cat /proc/mtd
        dev:    size   erasesize  name
        mtd0: 00060000 00001000 "u-boot"
        mtd1: 00020000 00001000 "u-boot-env"
        mtd2: 00280000 00001000 "kernel"
        mtd3: 001c0000 00001000 "initramfs"
        mtd4: 01740000 00001000 "rofs"
        mtd5: 00400000 00001000 "rwfs"
        mtd6: 02000000 00010000 "pnor"

The problem here is that we need to know the size of the pnor ...

Quoted 6 lines
Quoted 4 lines

The partition definitions probably belongs to the machine dts.

And a udev rules would also fit the purpose I think.

What would you suggest? A symlink to create a /dev/pnor node?

yes. like we did for the vuart. we will need to find a udev attribute for it. I think this is the cleanest.

Cheers,

C.

Quoted 5 lines

Cheers,

Joel