>From a4e80dc8edb19d323318900020e5cb2e010bda94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 14 May 2015 02:42:22 -0300
Subject: [PATCH] arch/powerpc: dts: First try at specifying partitions for the
 Kurobox HG.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is based on my (successful) experience with partitioning the MTD flash
device of the Kurobox HG by passing the `mtdparts` option to the kernel.

For the sake of documentation, the option that works is:

    mtdparts=physmap-flash.0:3072k@0k(firmimg),448k@3072k(bootcode),64k@3520k(status),512k@3584k(conf),4096k@0k(full)

Unfortunately, my attempts at mimic'ing the line above in
arch/powerpc/boot/dts/kuroboxHG.dts didn't bear fruits so far.

Signed-off-by: Rogério Brito <rbrito@ime.usp.br>
---
 arch/powerpc/boot/dts/kuroboxHG.dts | 68 +++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/arch/powerpc/boot/dts/kuroboxHG.dts b/arch/powerpc/boot/dts/kuroboxHG.dts
index 0e758b3..e3de7fb 100644
--- a/arch/powerpc/boot/dts/kuroboxHG.dts
+++ b/arch/powerpc/boot/dts/kuroboxHG.dts
@@ -143,5 +143,73 @@ XXXX add flash parts, rtc, ??
 				0x7000 0x0 0x0 0x4 &mpic 0x3 0x1
 			>;
 		};
+
+		/* Based on a mix of information from:
+		   - personal experiments
+		   - http://buffalo.nas-central.org/wiki/Flash_ROM
+		   - Documentation/devicetree/bindings/mtd/mtd-physmap.txt
+		   - Documentation/devicetree/bindings/mtd/partition.txt
+		 */
+		flash@fff80000 {
+			compatible = "amd,am29lv320" /*  Fujitsu 29PL32TM-90PFTN 4MB Flash ROM chip */, "cfi-flash";
+			reg = <0xfff80000 0x400000>;
+			bank-width = <1>; /* "Found 1 x16 devices at 0x0 in 8-bit bank." */
+			device-width = <1>; /* unneeded? */
+
+			/* linux,mtd-name = <>; */ /* FIXME: unneeded? */
+			/* use-advanced-sector-protection = <>; */ /* FIXME: unneeded? */
+			vendor-id = <0x0004>; /* "Manufacturer ID 0x000004" */
+			device-id = <0x007e>; /* "Chip ID 0x00007e" */
+
+			erase-size = <0x10000>; /* 64 KiB */
+
+			#address-cells = <1>; /* FIXME: verify */
+			#size-cells = <1>; /* FIXME: verify */
+
+			/*
+
+			My (rbrito) u-boot currently uses:
+
+			   mtdparts=physmap-flash.0:3072k@0k(firmimg),448k@3072k(bootcode),64k@3520k(status),512k@3584k(conf),4096k@0k(full)
+
+			  For reference:
+
+			  * 3072KiB = 0x300000
+			  *  448KiB =  0x70000
+			  * 3520KiB = 0x370000
+			  *   64KiB =  0x10000
+			  * 3584KiB = 0x380000
+			  *  512KiB =  0x80000
+			  * 4096KiB = 0x400000
+
+			  FIXME: A partition like uboot-env for uboot's environment
+			  should really exist.
+			*/
+
+			firmimg@0 {
+				label = "kernel + initrd";
+				reg = <0 0x300000>;		/* 3072k@0k */
+			};
+
+			bootcode@300000 {
+				label = "uboot";
+				reg = <0x300000 0x70000>;	/* 448k@3072k */
+			};
+
+			status@370000 {
+				label = "status";
+				reg = <0x370000 0x10000>;	/* 64k@3520k */
+			};
+
+			conf@680000 {
+				label = "conf";
+				reg = <0xc80000 0>;		/* 512k@3584k */
+			};
+
+			full@0 {
+				label = "full";
+				reg = <0 0x400000>;		/* 4096k@0k */
+			};
+		};
 	};
 };
-- 
2.1.4

