
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

--- linux-2.6.10/fs/jffs2/build.c~mtd_sharpsl_extra-r1.patch
+++ linux-2.6.10/fs/jffs2/build.c
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <asm/mach-types.h>
 #include "nodelist.h"
 
 static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *, struct jffs2_inode_cache *, struct jffs2_full_dirent **);
@@ -297,7 +298,10 @@
 
 	c->free_size = c->flash_size;
 	c->nr_blocks = c->flash_size / c->sector_size;
-	c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL);
+	if(machine_is_husky())
+		c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks);
+	else
+		c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL);
 	if (!c->blocks)
 		return -ENOMEM;
 	for (i=0; i<c->nr_blocks; i++) {
@@ -336,7 +340,10 @@
 		D1(printk(KERN_DEBUG "build_fs failed\n"));
 		jffs2_free_ino_caches(c);
 		jffs2_free_raw_node_refs(c);
-		kfree(c->blocks);
+		if(machine_is_husky())
+			vfree(c->blocks);
+		else
+			kfree(c->blocks);
 		return -EIO;
 	}
 
--- linux-2.6.10/fs/jffs2/fs.c~mtd_sharpsl_extra-r1.patch
+++ linux-2.6.10/fs/jffs2/fs.c
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 #include <linux/vfs.h>
 #include <linux/crc32.h>
+#include <asm/mach-types.h>
 #include "nodelist.h"
 
 
@@ -463,10 +464,10 @@
 	 */
 	c->sector_size = c->mtd->erasesize; 
 	blocks = c->flash_size / c->sector_size;
-	while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
-		blocks >>= 1;
-		c->sector_size <<= 1;
-	}	
+//	while ((blocks * sizeof (struct jffs2_eraseblock)) > (128 * 1024)) {
+//		blocks >>= 1;
+//		c->sector_size <<= 1;
+//	}	
 	
 	/*
 	 * Size alignment check
@@ -533,7 +534,10 @@
  out_nodes:
 	jffs2_free_ino_caches(c);
 	jffs2_free_raw_node_refs(c);
-	kfree(c->blocks);
+	if(machine_is_husky())
+		vfree(c->blocks);
+	else
+		kfree(c->blocks);
  out_inohash:
 	kfree(c->inocache_list);
  out_wbuf:
--- linux-2.6.10/fs/jffs2/super.c~mtd_sharpsl_extra-r1.patch
+++ linux-2.6.10/fs/jffs2/super.c
@@ -24,6 +24,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/ctype.h>
 #include <linux/namei.h>
+#include <asm/mach-types.h>
 #include "compr.h"
 #include "nodelist.h"
 
@@ -277,7 +278,10 @@
 	up(&c->alloc_sem);
 	jffs2_free_ino_caches(c);
 	jffs2_free_raw_node_refs(c);
-	kfree(c->blocks);
+	if(machine_is_husky())
+		vfree(c->blocks);
+	else
+		kfree(c->blocks);
 	jffs2_flash_cleanup(c);
 	kfree(c->inocache_list);
 	if (c->mtd->sync)
--- linux-2.6.10/include/linux/jffs2_fs_sb.h~mtd_sharpsl_extra-r1.patch
+++ linux-2.6.10/include/linux/jffs2_fs_sb.h
@@ -68,6 +68,10 @@
 						 * from the offset (blocks[ofs / sector_size]) */
 	struct jffs2_eraseblock *nextblock;	/* The block we're currently filling */
 
+#if defined(CONFIG_MACH_HUSKY) || defined(CONFIG_ARCH_PXA_TOSA)
+	dma_addr_t	blocks_phys;
+#endif
+
 	struct jffs2_eraseblock *gcblock;	/* The block we're currently garbage-collecting */
 
 	struct list_head clean_list;		/* Blocks 100% full of clean data */
--- linux-2.6.10/fs/jffs2/compr.h~mtd_sharpsl_extra-r1.patch
+++ linux-2.6.10/fs/jffs2/compr.h
@@ -36,6 +36,7 @@
 
 #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */
 #define JFFS2_DYNRUBIN_DISABLED  /*        for decompression */
+#define JFFS2_RTIME_DISABLED
 
 #define JFFS2_COMPR_MODE_NONE       0
 #define JFFS2_COMPR_MODE_PRIORITY   1
--- linux-2.6.10/drivers/mtd/nand/sharpsl.c~mtd_sharpsl_extra-r1.patch
+++ linux-2.6.10/drivers/mtd/nand/sharpsl.c
@@ -21,6 +21,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/interrupt.h>
 #include <asm/io.h>
+#include <asm/mach-types.h>
 #include <asm/hardware.h>
 
 static void __iomem *sharpsl_io_base;
@@ -54,26 +55,6 @@
  */
 #define DEFAULT_NUM_PARTITIONS 3
 
-#if defined CONFIG_MACH_POODLE
-#define SHARPSL_ROOTFS_SIZE 22
-#define SHARPSL_FLASH_SIZE 64
-#elif defined CONFIG_MACH_CORGI 
-#define SHARPSL_ROOTFS_SIZE 25
-#define SHARPSL_FLASH_SIZE 32
-#elif defined CONFIG_MACH_SHEPHERD
-#define SHARPSL_ROOTFS_SIZE 25
-#define SHARPSL_FLASH_SIZE 64
-#elif defined CONFIG_MACH_HUSKY
-#define SHARPSL_ROOTFS_SIZE 53
-#define SHARPSL_FLASH_SIZE 128
-#elif defined CONFIG_MACH_TOSA
-#define SHARPSL_ROOTFS_SIZE 28
-#define SHARPSL_FLASH_SIZE 64
-#else
-#define SHARPSL_ROOTFS_SIZE 30
-#define SHARPSL_FLASH_SIZE 64
-#endif
-
 static int nr_partitions;
 static struct mtd_partition sharpsl_nand_default_partition_info[] = {
 	{
@@ -85,12 +66,12 @@
 	{
 	.name = "NAND flash partition 1",
 	.offset = 7 * 1024 * 1024,
-	.size = SHARPSL_ROOTFS_SIZE * 1024 * 1024,
+	.size = 30 * 1024 * 1024,
 	},
 	{
 	.name = "NAND flash partition 2",
-	.offset = (SHARPSL_ROOTFS_SIZE+7) * 1024 * 1024,
-	.size = (SHARPSL_FLASH_SIZE - SHARPSL_ROOTFS_SIZE - 7) * 1024 * 1024,
+	.offset = (30+7) * 1024 * 1024,
+	.size = (64 - 30 - 7) * 1024 * 1024,
 	},
 };
 
@@ -133,6 +114,11 @@
 	.pattern = scan_ff_pattern
 };
 
+int sharpsl_scan_bbt(struct mtd_info *mtd)
+{
+	return nand_scan_bbt(mtd, &sharpsl_bbt);
+}
+
 static int
 sharpsl_nand_dev_ready(struct mtd_info* mtd)
 {
@@ -215,7 +201,7 @@
 	this->enable_hwecc = sharpsl_nand_enable_hwecc;
 	this->calculate_ecc = sharpsl_nand_calculate_ecc;
 	this->correct_data = nand_correct_data;
-	this->badblock_pattern = &sharpsl_bbt;
+	this->scan_bbt = sharpsl_scan_bbt;
 
 	/* Scan to find existence of the device */
 	err=nand_scan(sharpsl_mtd,1);
@@ -233,11 +219,21 @@
 	if (nr_partitions <= 0) {
 		nr_partitions = DEFAULT_NUM_PARTITIONS;
 		sharpsl_partition_info = sharpsl_nand_default_partition_info;
+		if (machine_is_poodle()) {
+			sharpsl_partition_info[1].size=22 * 1024 * 1024;
+			sharpsl_partition_info[2].offset = (22+7) * 1024 * 1024;
+			sharpsl_partition_info[2].size= (64 - 22 - 7) * 1024 * 1024;
+		} else if (machine_is_corgi() || machine_is_shepherd()) {
+			sharpsl_partition_info[1].size=25 * 1024 * 1024;
+			sharpsl_partition_info[2].offset = (25+7) * 1024 * 1024;
+			sharpsl_partition_info[2].size= (64 - 25 - 7) * 1024 * 1024;
+		} else if (machine_is_husky()) {
+			sharpsl_partition_info[1].size=53 * 1024 * 1024;
+			sharpsl_partition_info[2].offset = (53+7) * 1024 * 1024;
+			sharpsl_partition_info[2].size= (128 - 53 - 7) * 1024 * 1024;
+		} 
 	}
 
-	/* Need to use small eraseblock size for backward compatibility */
-	sharpsl_mtd->flags |= MTD_NO_VIRTBLOCKS;
-
 	add_mtd_partitions(sharpsl_mtd, sharpsl_partition_info, nr_partitions);
 
 	/* Return happy */

