Add support for NEO1973 NOR flash to MTD

From: warmcat <[EMAIL PROTECTED]>

You will need the default config from svn

http://svn.openmoko.org/trunk/src/target/kernel/config/

in the top level of your kernel dir to apply this patch -- and
you need to use the patched config to build the kernel

Whether the NOR flash is present at 0x18000000 or not (it
varies according to GTA revision... -02 A3 and A4 should work
fine and A2 if booted from NOR only) the whole 2MByte NOR
region appears as /dev/mtdblock0 and the NAND partitions start
from /dev/mtdblock1 up.

/dev/mtdblock0  2MB NOR
/dev/mtdblock1  U-Boot
/dev/mtdblock2  U-Boot env
/dev/mtdblock3  Kernel
/dev/mtdblock4  Splash
/dev/mtdblock5  rootfs

After applying this patch, you need to adjust the kernel cmdline
to identify root=/dev/mtdblock5 in order to boot into the rootfs

Once booted, you can do, eg

# mount -t jffs2 /dev/mtdblock0 /mnt

to mount the NOR 2MB partition on /mnt

Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---

 arch/arm/mach-s3c2440/mach-gta02.c |   31 +++++++++++++++++++++++++++++++
 defconfig-2.6.22.5                 |   21 ++++++++++++++++-----
 2 files changed, 47 insertions(+), 5 deletions(-)


diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 4e333b6..c81bfcd 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -68,6 +68,8 @@
 #include <asm/arch/spi-gpio.h>
 #include <asm/arch/usb-control.h>
 
+#include <linux/mtd/physmap.h>
+
 #include <asm/arch/gta01.h>
 #include <asm/arch/gta02.h>
 
@@ -305,6 +307,34 @@ struct platform_device gta02_pmu_dev = {
 	},
 };
 
+
+/* NOR Flash */
+
+#define GTA02_FLASH_BASE	0x18000000 /* GCS3 */
+#define GTA02_FLASH_SIZE	0x200000 /* 2MBytes */
+
+static struct physmap_flash_data gta02_nor_flash_data = {
+	.width		= 2,
+};
+
+static struct resource gta02_nor_flash_resource = {
+	.start		= GTA02_FLASH_BASE,
+	.end		= GTA02_FLASH_BASE + GTA02_FLASH_SIZE - 1,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device gta02_nor_flash = {
+	.name		= "physmap-flash",
+	.id		= 0,
+	.dev		= {
+				.platform_data	= &gta02_nor_flash_data,
+			},
+	.resource	= &gta02_nor_flash_resource,
+	.num_resources	= 1,
+};
+
+
+
 static struct platform_device *gta02_devices[] __initdata = {
 	&s3c_device_usb,
 	&s3c_device_wdt,
@@ -316,6 +346,7 @@ static struct platform_device *gta02_devices[] __initdata = {
 	&s3c_device_ts,
 	&s3c_device_spi0,
 	&s3c_device_spi1,
+	&gta02_nor_flash,
 };
 
 static struct s3c2410_nand_set gta02_nand_sets[] = {
diff --git a/defconfig-2.6.22.5 b/defconfig-2.6.22.5
index e9e40fe..5fb6146 100644
--- a/defconfig-2.6.22.5
+++ b/defconfig-2.6.22.5
@@ -658,8 +658,10 @@ CONFIG_MTD_BLOCK=y
 #
 # RAM/ROM/Flash chip drivers
 #
-# CONFIG_MTD_CFI is not set
-# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_CFI=y
+CONFIG_MTD_JEDECPROBE=y
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
 CONFIG_MTD_MAP_BANK_WIDTH_1=y
 CONFIG_MTD_MAP_BANK_WIDTH_2=y
 CONFIG_MTD_MAP_BANK_WIDTH_4=y
@@ -670,14 +672,23 @@ CONFIG_MTD_CFI_I1=y
 CONFIG_MTD_CFI_I2=y
 # CONFIG_MTD_CFI_I4 is not set
 # CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_CFI_STAA=y
+CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
-# CONFIG_MTD_ROM is not set
-# CONFIG_MTD_ABSENT is not set
+CONFIG_MTD_ROM=y
 
 #
 # Mapping drivers for chip access
 #
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_COMPLEX_MAPPINGS=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0x0
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=2
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_IMPA7 is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #

Reply via email to