From 38747167ce47d4e95bc8f2b3ee33ce61ba0286fc Mon Sep 17 00:00:00 2001
From: Torben Hohn <torbenh@linutronix.de>
Date: Mon, 17 Mar 2014 17:14:05 +0100
Subject: [PATCH 35/51] dts am335x-pcm051: Add nandflash, and fixup a few
 errors

---
 arch/arm/boot/dts/am335x-pcm051.dts |  114 ++++++++++++++++++++++++++++++++++-
 1 file changed, 111 insertions(+), 3 deletions(-)

@ arch/arm/boot/dts/am335x-pcm051.dts:10 @
  */
 /dts-v1/;
 
-/include/ "am33xx.dtsi"
+#include "am33xx.dtsi"
 
 / {
 	model = "TI AM335x PHYTEC pcm051";
@ arch/arm/boot/dts/am335x-pcm051.dts:64 @
 			>;
 		};
 
+		nandflash_pins_s0: nandflash_pins_s0 {
+			pinctrl-single,pins = <
+				0x0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad0.gpmc_ad0 */
+				0x4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad1.gpmc_ad1 */
+				0x8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad2.gpmc_ad2 */
+				0xc (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad3.gpmc_ad3 */
+				0x10 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad4.gpmc_ad4 */
+				0x14 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad5.gpmc_ad5 */
+				0x18 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad6.gpmc_ad6 */
+				0x1c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad7.gpmc_ad7 */
+				0x70 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_wait0.gpmc_wait0 */
+				0x74 (PIN_INPUT_PULLUP | MUX_MODE7)	/* gpmc_wpn.gpio0_30 */
+				0x7c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_csn0.gpmc_csn0  */
+				0x90 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_advn_ale.gpmc_advn_ale */
+				0x94 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_oen_ren.gpmc_oen_ren */
+				0x98 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_wen.gpmc_wen */
+				0x9c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_be0n_cle.gpmc_be0n_cle */
+			>;
+		};
+
 		ecap0_pins: backlight_pins {
 			pinctrl-single,pins = <
 				0x164 0x0	/* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
@ arch/arm/boot/dts/am335x-pcm051.dts:99 @
 	};
 
 	ocp {
-		uart1: serial@44e09000 {
+		uart0: serial@44e09000 {
 			status = "okay";
 		};
 
-		i2c1: i2c@44e0b000 {
+		i2c0: i2c@44e0b000 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&i2c0_pins>;
 
@ arch/arm/boot/dts/am335x-pcm051.dts:116 @
 
 		};
 
+		elm: elm@48080000 {
+			status = "okay";
+		};
+
+
 		epwmss0: epwmss@48300000 {
 			status = "okay";
 
@ arch/arm/boot/dts/am335x-pcm051.dts:130 @
 				pinctrl-0 = <&ecap0_pins>;
 			};
 		};
+
+		gpmc: gpmc@50000000 {
+			status = "okay";
+			pinctrl-names = "default";
+			pinctrl-0 = <&nandflash_pins_s0>;
+			ranges = <0 0 0x08000000 0x10000000>;	/* CS0: NAND */
+			nand@0,0 {
+				reg = <0 0 0>; /* CS0, offset 0 */
+				nand-bus-width = <8>;
+				ti,nand-ecc-opt = "bch8";
+				gpmc,device-nand = "true";
+				gpmc,device-width = <1>;
+				gpmc,sync-clk-ps = <0>;
+				gpmc,cs-on-ns = <0>;
+				gpmc,cs-rd-off-ns = <30>;
+				gpmc,cs-wr-off-ns = <30>;
+				gpmc,adv-on-ns = <0>;
+				gpmc,adv-rd-off-ns = <30>;
+				gpmc,adv-wr-off-ns = <30>;
+				gpmc,we-on-ns = <0>;
+				gpmc,we-off-ns = <20>;
+				gpmc,oe-on-ns = <10>;
+				gpmc,oe-off-ns = <30>;
+				gpmc,access-ns = <30>;
+				gpmc,rd-cycle-ns = <30>;
+				gpmc,wr-cycle-ns = <30>;
+				gpmc,wait-on-read = "true";
+				gpmc,wait-on-write = "true";
+				gpmc,bus-turnaround-ns = <0>;
+				gpmc,cycle2cycle-delay-ns = <50>;
+				gpmc,clk-activation-ns = <0>;
+				gpmc,wait-monitoring-ns = <0>;
+				gpmc,wr-access-ns = <30>;
+				gpmc,wr-data-mux-bus-ns = <0>;
+
+				#address-cells = <1>;
+				#size-cells = <1>;
+				elm_id = <&elm>;
+
+
+				partition@0 {
+					label = "xload";
+					reg = <0x0 0x20000>;
+				};
+
+				partition@1 {
+					label = "xload_backup1";
+					reg = <0x20000 0x20000>;
+				};
+
+				partition@2 {
+					label = "xload_backup2";
+					reg = <0x40000 0x20000>;
+				};
+
+				partition@3 {
+					label = "xload_backup3";
+					reg = <0x60000 0x20000>;
+				};
+
+				partition@4 {
+					label = "barebox";
+					reg = <0x80000 0x80000>;
+				};
+
+				partition@5 {
+					label = "bareboxenv";
+					reg = <0x100000 0x20000>;
+				};
+
+				partition@6 {
+					label = "kernel";
+					reg = <0x120000 0x800000>;
+				};
+
+				partition@7 {
+					label = "root";
+					reg = <0x920000 0x1f6e0000>;
+				};
+			};
+		};
 	};
 
 	backlight {
@ arch/arm/boot/dts/am335x-pcm051.dts:275 @
 	phy_id = <&davinci_mdio>, <1>;
 };
 
+/*
 &mmc1 {
 	status = "okay";
 	vmmc-supply = <&ldo3_reg>;
 };
+*/
 
 &lcdc {
 	status = "okay";
-- 
1.7.10.4