From f6aaf41d1b0c770000dc4f6a5f9bb3031d60abc0 Mon Sep 17 00:00:00 2001
From: Patrick Doyle <wpd@mit.edu>
Date: Tue, 14 Jun 2011 15:46:54 -0400
Subject: [PATCH] Added support for NOR FLASH bootldr partitions

---
 package/kernel/patches/2.6.37.6/balloon3-nor.patch |   95 ++++++++++++++++++++
 .../patches/2.6.37.6/series-balloon3.default       |    1 +
 2 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 package/kernel/patches/2.6.37.6/balloon3-nor.patch

diff --git a/package/kernel/patches/2.6.37.6/balloon3-nor.patch b/package/kernel/patches/2.6.37.6/balloon3-nor.patch
new file mode 100644
index 0000000..dfc7583
--- /dev/null
+++ b/package/kernel/patches/2.6.37.6/balloon3-nor.patch
@@ -0,0 +1,95 @@
+Index: linux-2.6.37.6/arch/arm/mach-pxa/balloon3.c
+===================================================================
+--- linux-2.6.37.6.orig/arch/arm/mach-pxa/balloon3.c	2011-06-14 15:05:23.000000000 -0400
++++ linux-2.6.37.6/arch/arm/mach-pxa/balloon3.c	2011-06-14 15:45:14.000000000 -0400
+@@ -129,10 +129,37 @@
+ #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
+ static struct mtd_partition balloon3_nor_partitions[] = {
+ 	{
+-		.name		= "Flash",
++		.name		= "bootldr",
+ 		.offset		= 0x00000000,
+-		.size		= MTDPART_SIZ_FULL,
+-	}
++		.size		= 0x00040000,
++#ifndef CONFIG_MTD_PHYSMAP_BALLOON3_BOOTLDR_RW
++                .mask_flags     = MTD_WRITEABLE,
++#endif
++	},
++	{
++		.name		= "params",
++		.offset		= 0x00040000,
++		.size		= 0x00040000,
++#ifndef CONFIG_MTD_PHYSMAP_BALLOON3_PARAMS_RW
++                .mask_flags     = MTD_WRITEABLE,
++#endif
++	},
++	{
++		.name		= "fpga",
++		.offset		= 0x00100000,
++		.size		= 0x00100000,
++#ifndef CONFIG_MTD_PHYSMAP_BALLOON3_FPGA_RW
++                .mask_flags     = MTD_WRITEABLE,
++#endif
++	},
++	{
++		.name		= "kernel",
++		.offset		= 0x00200000,
++		.size		= 0x00400000,
++#ifndef CONFIG_MTD_PHYSMAP_BALLOON3_KERNEL_RW
++                .mask_flags     = MTD_WRITEABLE,
++#endif
++	},
+ };
+ 
+ static struct physmap_flash_data balloon3_flash_data[] = {
+Index: linux-2.6.37.6/drivers/mtd/maps/Kconfig
+===================================================================
+--- linux-2.6.37.6.orig/drivers/mtd/maps/Kconfig	2011-06-14 15:09:59.000000000 -0400
++++ linux-2.6.37.6/drivers/mtd/maps/Kconfig	2011-06-14 15:45:32.000000000 -0400
+@@ -21,6 +21,45 @@
+ 	  To compile this driver as a module, choose M here: the
+ 	  module will be called physmap.
+ 
++config MTD_PHYSMAP_BALLOON3_BOOTLDR_RW
++        bool "Writable Balloon3 MTD bootldr partition"
++	default false
++	depends on MACH_BALLOON3 && MTD_PHYSMAP
++	help
++	  By default, the bootldr MTD partion is readonly.  Enabling this
++	  option will make that partition RW and allow your kernel to
++	  overwrite the bootloader, possibly with disastrous results.
++
++config MTD_PHYSMAP_BALLOON3_PARAMS_RW
++        bool "Writable Balloon3 MTD params partition"
++	default false
++	depends on MACH_BALLOON3 && MTD_PHYSMAP
++	help
++	  By default, the params MTD partion is readonly.  Enabling
++	  this option will make that partition RW and allow your
++	  kernel to overwrite the bootloader parameters, possibly with
++	  disasterous results.
++
++config MTD_PHYSMAP_BALLOON3_FPGA_RW
++        bool "Writable Balloon3 MTD FPGA partition"
++	default false
++	depends on MACH_BALLOON3 && MTD_PHYSMAP
++	help
++	  By default, the FPGA MTD partion is readonly.  Enabling
++	  this option will make that partition RW and allow your
++	  kernel to overwrite the fpga/cpld image, possibly with
++	  disastrous results.
++
++config MTD_PHYSMAP_BALLOON3_KERNEL_RW
++        bool "Writable Balloon3 MTD rescue kernel partition"
++	default false
++	depends on MACH_BALLOON3 && MTD_PHYSMAP
++	help
++	  By default, the rescue kernel MTD partion is readonly.  Enabling
++	  this option will make that partition RW and allow your
++	  kernel to overwrite the rescue kernel, possibly with
++	  disastrous results.
++
+ config MTD_PHYSMAP_COMPAT
+ 	bool "Physmap compat support"
+ 	depends on MTD_PHYSMAP
diff --git a/package/kernel/patches/2.6.37.6/series-balloon3.default b/package/kernel/patches/2.6.37.6/series-balloon3.default
index 091a26f..068aae5 100644
--- a/package/kernel/patches/2.6.37.6/series-balloon3.default
+++ b/package/kernel/patches/2.6.37.6/series-balloon3.default
@@ -4,3 +4,4 @@ balloon3.patch
 balloon3-cpufreq.patch
 balloon3-ac97.patch
 balloon3-nand.patch -p0
+balloon3-nor.patch
-- 
1.7.2.5

