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

--- linux-2.6.10-rc2/fs/jffs2/build.c~mtd_sharpsl_extra-r0.patch
+++ linux-2.6.10-rc2/fs/jffs2/build.c
@@ -297,7 +297,14 @@
 
 	c->free_size = c->flash_size;
 	c->nr_blocks = c->flash_size / c->sector_size;
+#if defined(CONFIG_MACH_HUSKY) || defined(CONFIG_ARCH_PXA_TOSA)
+	printk("Trying to alloc_coherent...#%u,#%u\n", c->flash_size,c->sector_size);
+	c->blocks = dma_alloc_coherent(NULL,
+				     sizeof(struct jffs2_eraseblock) * c->nr_blocks,
+				     &c->blocks_phys,GFP_KERNEL);
+#else
 	c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL);
+#endif
 	if (!c->blocks)
 		return -ENOMEM;
 	for (i=0; i<c->nr_blocks; i++) {
@@ -336,7 +343,13 @@
 		D1(printk(KERN_DEBUG "build_fs failed\n"));
 		jffs2_free_ino_caches(c);
 		jffs2_free_raw_node_refs(c);
+#if defined(CONFIG_MACH_HUSKY) || defined(CONFIG_ARCH_PXA_TOSA)
+		dma_free_coherent(NULL,
+				 sizeof(struct jffs2_eraseblock) * c->nr_blocks,
+				  c->blocks,c->blocks_phys );
+#else
 		kfree(c->blocks);
+#endif
 		return -EIO;
 	}
 
--- linux-2.6.10-rc2/fs/jffs2/fs.c~mtd_sharpsl_extra-r0.patch
+++ linux-2.6.10-rc2/fs/jffs2/fs.c
@@ -463,10 +463,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 +533,13 @@
  out_nodes:
 	jffs2_free_ino_caches(c);
 	jffs2_free_raw_node_refs(c);
+#if defined(CONFIG_MACH_HUSKY) || defined(CONFIG_ARCH_PXA_TOSA)
+	dma_free_coherent(NULL,
+			 sizeof(struct jffs2_eraseblock) * c->nr_blocks,
+			  c->blocks,c->blocks_phys );
+#else
 	kfree(c->blocks);
+#endif
  out_inohash:
 	kfree(c->inocache_list);
  out_wbuf:
--- linux-2.6.10-rc2/fs/jffs2/super.c~mtd_sharpsl_extra-r0.patch
+++ linux-2.6.10-rc2/fs/jffs2/super.c
@@ -266,7 +266,13 @@
 	up(&c->alloc_sem);
 	jffs2_free_ino_caches(c);
 	jffs2_free_raw_node_refs(c);
+#if defined(CONFIG_MACH_HUSKY) || defined(CONFIG_ARCH_PXA_TOSA)
+	dma_free_coherent(NULL,
+			 sizeof(struct jffs2_eraseblock) * c->nr_blocks,
+			  c->blocks,c->blocks_phys );
+#else
 	kfree(c->blocks);
+#endif	
 	jffs2_flash_cleanup(c);
 	kfree(c->inocache_list);
 	if (c->mtd->sync)
--- linux-2.6.10-rc2/include/linux/jffs2_fs_sb.h~mtd_sharpsl_extra-r0.patch
+++ linux-2.6.10-rc2/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-rc2/fs/jffs2/compr.h~mtd_sharpsl_extra-r0.patch
+++ linux-2.6.10-rc2/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-rc2/drivers/mtd/nand/sharpsl.c~mtd_sharpsl_extra-r0.patch
+++ linux-2.6.10-rc2/drivers/mtd/nand/sharpsl.c
@@ -133,6 +133,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 +220,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);
@@ -235,9 +240,6 @@
 		sharpsl_partition_info = sharpsl_nand_default_partition_info;
 	}
 
-	/* 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 */
