Skip to contentSkip to conversation

ARM: kirkwood: Move the nand node under the mbus node

PATCH New Jason Gunthorpe 3 participants 5 messages Sep 17, 2013 – Oct 1, 2013 Device tree bindings

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ARM: kirkwood: Move the nand node under the mbus node

There should be no nodes that are not children of the mbus. Move the nand node under the mbus, and rework the board .dts files to use an & reference to the nand node.

---
 arch/arm/boot/dts/kirkwood-db.dtsi                 | 44 +++++------
 arch/arm/boot/dts/kirkwood-dnskw.dtsi              | 76 +++++++++----------
 arch/arm/boot/dts/kirkwood-dockstar.dts            | 40 +++++-----
 arch/arm/boot/dts/kirkwood-goflexnet.dts           | 51 ++++++-------
 .../arm/boot/dts/kirkwood-guruplug-server-plus.dts | 40 +++++-----
 arch/arm/boot/dts/kirkwood-ib62x0.dts              | 44 +++++------
 arch/arm/boot/dts/kirkwood-iconnect.dts            | 58 +++++++--------
 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts      | 51 ++++++-------
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts         | 14 ++--
 arch/arm/boot/dts/kirkwood-mplcec4.dts             | 62 ++++++++--------
 .../boot/dts/kirkwood-netgear_readynas_duo_v2.dts  | 60 +++++++--------
 arch/arm/boot/dts/kirkwood-nsa310-common.dtsi      | 86 +++++++++++-----------
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts       | 74 +++++++++----------
 arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi  | 42 +++++------
 arch/arm/boot/dts/kirkwood-topkick.dts             | 62 ++++++++--------
 arch/arm/boot/dts/kirkwood.dtsi                    | 31 ++++----
 16 files changed, 418 insertions(+), 417 deletions(-)
arch/arm/boot/dts/kirkwood-db.dtsi +22 -22
index c0e2a58..053aa20 100644
@@ -39,28 +39,6 @@
 			status = "ok";
 		};
 
-		nand at 3000000 {
-			pinctrl-0 = <&pmx_nand>;
-			pinctrl-names = "default";
-			chip-delay = <25>;
-			status = "okay";
-
-			partition at 0 {
-				label = "uboot";
-				reg = <0x0 0x100000>;
-			};
-
-			partition at 100000 {
-				label = "uImage";
-				reg = <0x100000 0x400000>;
-			};
-
-			partition at 500000 {
-				label = "root";
-				reg = <0x500000 0x1fb00000>;
-			};
-		};
-
 		sata at 80000 {
 			nr-ports = <2>;
 			status = "okay";
@@ -80,6 +58,28 @@
 	};
 };
 
+&nand {
+	pinctrl-0 = <&pmx_nand>;
+	pinctrl-names = "default";
+	chip-delay = <25>;
+	status = "okay";
+
+	partition at 0 {
+		label = "uboot";
+		reg = <0x0 0x100000>;
+	};
+
+	partition at 100000 {
+		label = "uImage";
+		reg = <0x100000 0x400000>;
+	};
+
+	partition at 500000 {
+		label = "root";
+		reg = <0x500000 0x1fb00000>;
+	};
+};
+
 &mdio {
 	status = "okay";
 
arch/arm/boot/dts/kirkwood-dnskw.dtsi +38 -38

88 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-dockstar.dts +20 -20
index 59a2117..33ff368 100644
@@ -34,26 +34,6 @@
 		serial at 12000 {
 			status = "ok";
 		};
-
-		nand at 3000000 {
-			status = "okay";
-
-			partition at 0 {
-				label = "u-boot";
-				reg = <0x0000000 0x100000>;
-				read-only;
-			};
-
-			partition at 100000 {
-				label = "uImage";
-				reg = <0x0100000 0x400000>;
-			};
-
-			partition at 500000 {
-				label = "data";
-				reg = <0x0500000 0xfb00000>;
-			};
-		};
 	};
 	gpio-leds {
 		compatible = "gpio-leds";
@@ -91,6 +71,26 @@
 	};
 };
 
+&nand {
+	status = "okay";
+
+	partition at 0 {
+		label = "u-boot";
+		reg = <0x0000000 0x100000>;
+		read-only;
+	};
+
+	partition at 100000 {
+		label = "uImage";
+		reg = <0x0100000 0x400000>;
+	};
+
+	partition at 500000 {
+		label = "data";
+		reg = <0x0500000 0xfb00000>;
+	};
+};
+
 &mdio {
 	status = "okay";
 
arch/arm/boot/dts/kirkwood-goflexnet.dts +26 -25

63 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts +20 -20
index 6548b9d..d30a91a 100644
@@ -40,26 +40,6 @@
 			status = "ok";
 		};
 
-		nand at 3000000 {
-			status = "okay";
-
-			partition at 0 {
-				label = "u-boot";
-				reg = <0x00000000 0x00100000>;
-				read-only;
-			};
-
-			partition at 100000 {
-				label = "uImage";
-				reg = <0x00100000 0x00400000>;
-			};
-
-			partition at 500000 {
-				label = "data";
-				reg = <0x00500000 0x1fb00000>;
-			};
-		};
-
 		sata at 80000 {
 			status = "okay";
 			nr-ports = <1>;
@@ -97,6 +77,26 @@
 	};
 };
 
+&nand {
+	status = "okay";
+
+	partition at 0 {
+		label = "u-boot";
+		reg = <0x00000000 0x00100000>;
+		read-only;
+	};
+
+	partition at 100000 {
+		label = "uImage";
+		reg = <0x00100000 0x00400000>;
+	};
+
+	partition at 500000 {
+		label = "data";
+		reg = <0x00500000 0x1fb00000>;
+	};
+};
+
 &mdio {
 	status = "okay";
 
arch/arm/boot/dts/kirkwood-ib62x0.dts +22 -22

56 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-iconnect.dts +29 -29

70 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts +26 -25

63 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-km_kirkwood.dts +7 -7
index 6899408..cd44f37 100644
@@ -34,13 +34,6 @@
 		serial at 12000 {
 			status = "ok";
 		};
-
-		nand at 3000000 {
-			pinctrl-0 = <&pmx_nand>;
-			pinctrl-names = "default";
-			status = "ok";
-			chip-delay = <25>;
-		};
 	};
 
 	i2c at 0 {
@@ -51,6 +44,13 @@
 	};
 };
 
+&nand {
+	pinctrl-0 = <&pmx_nand>;
+	pinctrl-names = "default";
+	status = "ok";
+	chip-delay = <25>;
+};
+
 &mdio {
 	status = "okay";
 
arch/arm/boot/dts/kirkwood-mplcec4.dts +31 -31

74 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts +30 -30

72 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-nsa310-common.dtsi +43 -43

95 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-openblocks_a6.dts +37 -37

86 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi +21 -21

54 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-topkick.dts +31 -31

74 lines not on this page · raw message

arch/arm/boot/dts/kirkwood.dtsi +15 -16
index 76b1627..632b647 100644
@@ -45,12 +45,25 @@
 			clocks = <&gate_clk 17>;
 			status = "okay";
 		};
+
+		nand: nand at 012f {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cle = <0>;
+			ale = <1>;
+			bank-width = <1>;
+			compatible = "marvell,orion-nand";
+			reg = <MBUS_ID(0x01, 0x2f) 0 0x400>;
+			chip-delay = <25>;
+			/* set partition map and/or chip-delay in board dts */
+			clocks = <&gate_clk 7>;
+			status = "disabled";
+		};
 	};
 
 	ocp at f1000000 {
 		compatible = "simple-bus";
-		ranges = <0x00000000 0xf1000000 0x0100000
-		          0xf4000000 0xf4000000 0x0000400>;
+		ranges = <0x00000000 0xf1000000 0x0100000>;
 		#address-cells = <1>;
 		#size-cells = <1>;
 
@@ -206,20 +219,6 @@
 			status = "okay";
 		};
 
-		nand at 3000000 {
-			#address-cells = <1>;
-			#size-cells = <1>;
-			cle = <0>;
-			ale = <1>;
-			bank-width = <1>;
-			compatible = "marvell,orion-nand";
-			reg = <0xf4000000 0x400>;
-			chip-delay = <25>;
-			/* set partition map and/or chip-delay in board dts */
-			clocks = <&gate_clk 7>;
-			status = "disabled";
-		};
-
 		i2c at 11000 {
 			compatible = "marvell,mv64xxx-i2c";
 			reg = <0x11000 0x20>;
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 3/3 ARM: kirkwood: Move the nand node under the mbus node

Hi Jason,

Quoted 4 lines · Jason Gunthorpe

There should be no nodes that are not children of the mbus. Move the nand node under the mbus, and rework the board .dts files to use an & reference to the nand node.

Thanks for taking the time to do this. However, notice this may be not the accurate way of representing NAND in DT. The kirkwood specification has a NAND Flash Registers section which speaks about registers and they seem to match (to some extent) the MVEBU's Device Bus.

Therefore, my understanding is that NAND should be a child of a 'mvebu-devbus' compatible node in the device tree.

I haven't had time to investigate this any further and that's why NAND hasn't been moved yet.

Maybe you can take a look at armada-xp.dtsi and armada-xp-openblocks-ax3-4.dts to see how the devbus is handled now. You'll notice that Kirkwood's NAND window IDs matches Armada 370/XP Device Bus BOOTCS window IDs.

What do you think?

Signature · 3 lines
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#2 lore raw

PATCH 3/3 ARM: kirkwood: Move the nand node under the mbus node

Quoted 9 lines · Ezequiel Garcia

Hi Jason,

Quoted 3 lines · Jason Gunthorpe

There should be no nodes that are not children of the mbus. Move the nand node under the mbus, and rework the board .dts files to use an & reference to the nand node.

Thanks for taking the time to do this. However, notice this may be not the accurate way of representing NAND in DT.

These patches (nand and crypto) are just intended to fix the current use of the mbus driver in the kirkwood boards, not fix the small problems in the other drivers :)

Quoted 3 lines

The kirkwood specification has a NAND Flash Registers section which speaks about registers and they seem to match (to some extent) the MVEBU's Device Bus.

Yes, the NAND IP is dual ported like crypto and has a register block on the internal-regs block that controls the interface timing. The driver should bind to this block and it should write to it.

However, it is not like devbus. devbus is a generic bus that can connect to a wide range of devices we already have in the kernel, and the bus timing configuration cannot be auto-detected. This is why you need the 'mvebu-devbus' node. That node sets up the bus and then allows a Linux generic child driver to bind to it.

NAND is not a generic bus, the NAND driver is the final consumer.

Further, the NAND driver itself should determine the bus timing in a NAND specific way by following the ONFI defined auto detection method, probably with some help from the MTD layer. That is to say, determining the timing parmeters is intimately entangled with NAND itself and should not be separated.

So, there is no need for a mvebu-devbus node with NAND, and the orion-nand driver should be improved. As things are now the driver relies on the firmware to set the correct interface timing and doesn't touch anything.

Quoted 2 lines

I haven't had time to investigate this any further and that's why NAND hasn't been moved yet.

Moving the block and improving the orion driver don't need to be linked. The new location for the nand block doesn't preclude anything :)

FWIW, my ideal NAND binding would look something like this:

               nand: nand at 012f {
                       compatible = "marvell,orion-nand";
                       #address-cells = <1>;
                       #size-cells = <1>;
                       reg = <MBUS_ID(0x01, 0x2f) 0 0x400
                              MBUS_ID(0xf0, 0x01)  ......>; // control regs
		       /* Clock frequency that is divided down to
		          generate timings */
                       clocks = <&gate_clk 7>; 
		       
		       /* One of these two, if read-gpio is specified
		          then chip-delay is not used, and the driver
		          waits for the flash to raise the RDY# pin to
		          indicate command completion */
                       chip-delay = <25>;
		       ready-gpio = <&gpio ...>;

		       // Indicate that the board cannot support faster timings
		       onfi-disabled-timings = <...>;

                       cle = <0>;
                       ale = <1>;
                       bank-width = <1>;
                       /* partition map  ... */
                       status = "disabled";
               };

Jason

#3 lore raw

PATCH 3/3 ARM: kirkwood: Move the nand node under the mbus node

Hi Jason,

Quoted 42 lines · Jason Gunthorpe
Quoted 9 lines · Ezequiel Garcia

Hi Jason,

Quoted 3 lines · Jason Gunthorpe

There should be no nodes that are not children of the mbus. Move the nand node under the mbus, and rework the board .dts files to use an & reference to the nand node.

Thanks for taking the time to do this. However, notice this may be not the accurate way of representing NAND in DT.

These patches (nand and crypto) are just intended to fix the current use of the mbus driver in the kirkwood boards, not fix the small problems in the other drivers :)

Quoted 3 lines

The kirkwood specification has a NAND Flash Registers section which speaks about registers and they seem to match (to some extent) the MVEBU's Device Bus.

Yes, the NAND IP is dual ported like crypto and has a register block on the internal-regs block that controls the interface timing. The driver should bind to this block and it should write to it.

However, it is not like devbus. devbus is a generic bus that can connect to a wide range of devices we already have in the kernel, and the bus timing configuration cannot be auto-detected. This is why you need the 'mvebu-devbus' node. That node sets up the bus and then allows a Linux generic child driver to bind to it.

NAND is not a generic bus, the NAND driver is the final consumer.

Further, the NAND driver itself should determine the bus timing in a NAND specific way by following the ONFI defined auto detection method, probably with some help from the MTD layer. That is to say, determining the timing parmeters is intimately entangled with NAND itself and should not be separated.

So, there is no need for a mvebu-devbus node with NAND, and the orion-nand driver should be improved. As things are now the driver relies on the firmware to set the correct interface timing and doesn't touch anything.

Quoted 7 lines
Quoted 2 lines

I haven't had time to investigate this any further and that's why NAND hasn't been moved yet.

Moving the block and improving the orion driver don't need to be linked. The new location for the nand block doesn't preclude anything :)

Agreed. So we can move it now, and fix it later.

And, in Openblocks-A6:

Signature · 3 lines
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#4 lore raw

PATCH 3/3 ARM: kirkwood: Move the nand node under the mbus node

In reply to Jason Gunthorpe
Quoted 15 lines · Jason Gunthorpe

There should be no nodes that are not children of the mbus. Move the nand node under the mbus, and rework the board .dts files to use an & reference to the nand node.

---
 arch/arm/boot/dts/kirkwood-db.dtsi                 | 44 +++++------
 arch/arm/boot/dts/kirkwood-dnskw.dtsi              | 76 +++++++++----------
 arch/arm/boot/dts/kirkwood-dockstar.dts            | 40 +++++-----
 arch/arm/boot/dts/kirkwood-goflexnet.dts           | 51 ++++++-------
 .../arm/boot/dts/kirkwood-guruplug-server-plus.dts | 40 +++++-----
 arch/arm/boot/dts/kirkwood-ib62x0.dts              | 44 +++++------
 arch/arm/boot/dts/kirkwood-iconnect.dts            | 58 +++++++--------
 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts      | 51 ++++++-------
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts         | 14 ++--
Quoted 8 lines
 arch/arm/boot/dts/kirkwood-mplcec4.dts             | 62 ++++++++--------
 .../boot/dts/kirkwood-netgear_readynas_duo_v2.dts  | 60 +++++++--------
 arch/arm/boot/dts/kirkwood-nsa310-common.dtsi      | 86 +++++++++++-----------
 arch/arm/boot/dts/kirkwood-openblocks_a6.dts       | 74 +++++++++----------
 arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi  | 42 +++++------
 arch/arm/boot/dts/kirkwood-topkick.dts             | 62 ++++++++--------
 arch/arm/boot/dts/kirkwood.dtsi                    | 31 ++++----
 16 files changed, 418 insertions(+), 417 deletions(-)

Applied to mvebu/dt with Ezequiel's Ack and Tested-by.

thx,

Jason.