Index: drivers/mtd/maps/Kconfig
===================================================================
RCS file: /cvs/eps/dev_eng/sw/products/Linux/PXAEngine/pxa/linux-2.6.17-rc5/drivers/mtd/maps/Kconfig,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -3 -p -r1.1.1.1 -r1.2
*** drivers/mtd/maps/Kconfig	29 May 2006 00:58:44 -0000	1.1.1.1
--- drivers/mtd/maps/Kconfig	30 May 2006 13:04:33 -0000	1.2
*************** config MTD_MAINSTONE
*** 137,142 ****
--- 137,149 ----
  	  This provides a driver for the on-board flash of the Intel
  	  'Mainstone PXA27x evaluation board.
  
+ config MTD_LOGICPD_PXA270
+ 	tristate "CFI Flash device mapped on LogicPD PXA270 Card Engine"
+ 	depends on MACH_LOGICPD_PXA270 && MTD_CFI_INTELEXT && MTD_PARTITIONS
+ 	help
+ 	  This provides a driver for the on-board flash of the LogicPD
+ 	  PXA270 Card Engine.
+ 
  config MTD_OCTAGON
  	tristate "JEDEC Flash device mapped on Octagon 5066 SBC"
  	depends on X86 && MTD_JEDEC && MTD_COMPLEX_MAPPINGS
Index: drivers/mtd/maps/Makefile
===================================================================
RCS file: /cvs/eps/dev_eng/sw/products/Linux/PXAEngine/pxa/linux-2.6.17-rc5/drivers/mtd/maps/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -3 -p -r1.1.1.1 -r1.2
*** drivers/mtd/maps/Makefile	29 May 2006 00:58:44 -0000	1.1.1.1
--- drivers/mtd/maps/Makefile	30 May 2006 13:04:33 -0000	1.2
*************** obj-$(CONFIG_MTD_ICHXROM)	+= ichxrom.o
*** 22,27 ****
--- 22,28 ----
  obj-$(CONFIG_MTD_TSUNAMI)	+= tsunami_flash.o
  obj-$(CONFIG_MTD_LUBBOCK)	+= lubbock-flash.o
  obj-$(CONFIG_MTD_MAINSTONE)	+= mainstone-flash.o
+ obj-$(CONFIG_MTD_LOGICPD_PXA270)+= lpd270-flash.o
  obj-$(CONFIG_MTD_MBX860)	+= mbx860.o
  obj-$(CONFIG_MTD_CEIVA)		+= ceiva.o
  obj-$(CONFIG_MTD_OCTAGON)	+= octagon-5066.o
Index: drivers/mtd/maps/lpd270-flash.c
===================================================================
--- /dev/null	2006-05-22 10:25:23.000000000 -0400
+++ drivers/mtd/maps/lpd270-flash.c	2006-12-29 13:19:54.000000000 -0500
@@ -0,0 +1,197 @@
+ /*
+  * $Id: lpd270-flash.c,v 1.1 2006/05/30 13:03:55 LOGIC+peterb Exp $
+  *
+  * Map driver for the Lpd270 developer platform.
+  *
+  * Author:	Nicolas Pitre
+  * Copyright:	(C) 2001 MontaVista Software Inc.
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License version 2 as
+  * published by the Free Software Foundation.
+  */
+ 
+ #include <linux/module.h>
+ #include <linux/types.h>
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/slab.h>
+ 
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/map.h>
+ #include <linux/mtd/partitions.h>
+ 
+ #include <asm/io.h>
+ #include <asm/hardware.h>
+ #include <asm/arch/pxa-regs.h>
+ // #include <asm/arch/lpd270.h>
+ 
+ 
+ #define ROM_ADDR	0x00000000
+ #define FLASH_ADDR	0x04000000
+ 
+ #define WINDOW_SIZE 	0x04000000
+ 
+ static void lpd270_map_inval_cache(struct map_info *map, unsigned long from,
+ 				      ssize_t len)
+ {
+ 	consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
+ }
+ 
+ static struct map_info lpd270_maps[2] = { {
+ 	.size =		WINDOW_SIZE,
+ 	.phys =		PXA_CS0_PHYS,
+ 	.inval_cache = 	lpd270_map_inval_cache,
+ }, {
+ 	.size =		WINDOW_SIZE,
+ 	.phys =		PXA_CS1_PHYS,
+ 	.inval_cache = 	lpd270_map_inval_cache,
+ } };
+ 
+ static struct mtd_partition lpd270_partitions[] = {
+ 	{
+ 		.name =		"Bootloader",
+ 		.size =		0x000C0000,
+ 		.offset =	0,
+ 		.mask_flags =	MTD_WRITEABLE  /* force read-only */
+ 	},{
+ 		.name =		"YAFFS",
+ 		.size =		0x00F40000,
+ 		.offset =	0x000C0000,
+ 	},{
+ 		.name =		"Filesystem",
+ 		.size =		MTDPART_SIZ_FULL,
+ 		.offset =	0x01000000
+ 	}
+ };
+ 
+ static struct mtd_info *mymtds[2];
+ static struct mtd_partition *parsed_parts[2];
+ static int nr_parsed_parts[2];
+ 
+ static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+ 
+ static int __init init_lpd270(void)
+ {
+ 	int SW7 = 0;  /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
+ 	int ret = 0, i;
+ 
+ 	lpd270_maps[0].bankwidth = (BOOT_DEF & 1) ? 2 : 4;
+ 	lpd270_maps[1].bankwidth = 4;
+ 
+ 	/* Compensate for SW7 which swaps the flash banks */
+ 	lpd270_maps[SW7].name = "processor flash";
+ 	lpd270_maps[SW7 ^ 1].name = "main board flash";
+ 
+ 	printk(KERN_CRIT "FLASH ENABLED!!!!!!!!!! Lpd270 configured to boot from %s\n",
+ 	       lpd270_maps[0].name);
+ 
+ 	// Set VPP in CPLD to allow writes to the flash
+ 	{
+ 	  unsigned short *p;
+ 
+ 	  p = ioremap(0x08000000, PAGE_SIZE);
+ 	  if (!p) {
+ 	    printk("%s:%d ioremap failed\n", __FUNCTION__, __LINE__);
+ 	  } else {
+ 	    printk("%s:%d CTRL REG %04x\n", __FUNCTION__, __LINE__, *p);
+ 	    *p |= (1<<3); // FL_VPEN
+ 	    iounmap(p);
+ 	  }
+ 	}
+ 
+ 	for (i = 0; i < 2; i++) {
+ 		lpd270_maps[i].virt = ioremap_nocache(lpd270_maps[i].phys,
+ 						 WINDOW_SIZE);
+ 		if (!lpd270_maps[i].virt) {
+ 			printk(KERN_WARNING "Failed to ioremap %s\n",
+ 			       lpd270_maps[i].name);
+ 			if (!ret)
+ 				ret = -ENOMEM;
+ 			continue;
+ 		}
+ #if 0
+ 		lpd270_maps[i].cached =
+ 			ioremap_cached(lpd270_maps[i].phys, WINDOW_SIZE);
+ 		if (!lpd270_maps[i].cached)
+ 			printk(KERN_WARNING "Failed to ioremap cached %s\n",
+ 			       lpd270_maps[i].name);
+ #endif
+ 		simple_map_init(&lpd270_maps[i]);
+ 
+ 		printk(KERN_NOTICE
+ 		       "Probing %s at physical address 0x%08lx"
+ 		       " (%d-bit bankwidth)\n",
+ 		       lpd270_maps[i].name, lpd270_maps[i].phys,
+ 		       lpd270_maps[i].bankwidth * 8);
+ 
+ 		mymtds[i] = do_map_probe("cfi_probe", &lpd270_maps[i]);
+ 
+ 		if (!mymtds[i]) {
+ 			iounmap((void *)lpd270_maps[i].virt);
+ 			if (lpd270_maps[i].cached)
+ 				iounmap(lpd270_maps[i].cached);
+ 			if (!ret)
+ 				ret = -EIO;
+ 			continue;
+ 		}
+ 		mymtds[i]->owner = THIS_MODULE;
+ 
+ 		ret = parse_mtd_partitions(mymtds[i], probes,
+ 					   &parsed_parts[i], 0);
+ 
+ 		if (ret > 0)
+ 			nr_parsed_parts[i] = ret;
+ 	}
+ 
+ 	if (!mymtds[0] && !mymtds[1])
+ 		return ret;
+ 
+ 	for (i = 0; i < 2; i++) {
+ 		if (!mymtds[i]) {
+ 			printk(KERN_WARNING "%s is absent. Skipping\n",
+ 			       lpd270_maps[i].name);
+ 		} else if (nr_parsed_parts[i]) {
+ 			add_mtd_partitions(mymtds[i], parsed_parts[i],
+ 					   nr_parsed_parts[i]);
+ 		} else if (!i) {
+ 			printk("Using static partitions on %s\n",
+ 			       lpd270_maps[i].name);
+ 			add_mtd_partitions(mymtds[i], lpd270_partitions,
+ 					   ARRAY_SIZE(lpd270_partitions));
+ 		} else {
+ 			printk("Registering %s as whole device\n",
+ 			       lpd270_maps[i].name);
+ 			add_mtd_device(mymtds[i]);
+ 		}
+ 	}
+ 	return 0;
+ }
+ 
+ static void __exit cleanup_lpd270(void)
+ {
+ 	int i;
+ 	for (i = 0; i < 2; i++) {
+ 		if (!mymtds[i])
+ 			continue;
+ 
+ 		if (nr_parsed_parts[i] || !i)
+ 			del_mtd_partitions(mymtds[i]);
+ 		else
+ 			del_mtd_device(mymtds[i]);
+ 
+ 		map_destroy(mymtds[i]);
+ 		iounmap((void *)lpd270_maps[i].virt);
+ 		if (lpd270_maps[i].cached)
+ 			iounmap(lpd270_maps[i].cached);
+ 		kfree(parsed_parts[i]);
+ 	}
+ }
+ 
+ module_init(init_lpd270);
+ module_exit(cleanup_lpd270);
+ 
+ MODULE_LICENSE("GPL");
+ MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
+ MODULE_DESCRIPTION("MTD map driver for Logic PXA270");