From dedekind at infradead.org  Tue May  3 11:11:43 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:49 2006
Subject: mtd/fs/jffs2 erase.c,1.75,1.76
Message-ID: <E1DSz3n-0000O7-1A@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv1472

Modified Files:
	erase.c 
Log Message:
Fix the bug that caouses problems when compiling for NOR.
We read  a newly erased block so we don't need to check ECC.


Index: erase.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/erase.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- erase.c	5 Apr 2005 12:51:54 -0000	1.75
+++ erase.c	3 May 2005 15:11:40 -0000	1.76
@@ -333,10 +333,7 @@
 
 			bad_offset = ofs;
 
-			if (!jffs2_is_writebuffered(c) || !jffs2_cleanmarker_oob(c))
-				ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf);
-			else
-				ret = c->mtd->read_ecc(c->mtd, ofs, readlen, &retlen, ebuf, NULL, c->oobinfo);
+			ret = c->mtd->read(c->mtd, ofs, readlen, &retlen, ebuf);
 
 			if (ret) {
 				printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret);



From dedekind at infradead.org  Tue May  3 11:19:02 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:49 2006
Subject: mtd/fs/jffs2 os-linux.h,1.55,1.56
Message-ID: <E1DSzAs-0000Ok-U4@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv1509

Modified Files:
	os-linux.h 
Log Message:
Define jffs2_is_writebuffered as zero if there is no wbuf.


Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- os-linux.h	17 Mar 2005 20:23:06 -0000	1.55
+++ os-linux.h	3 May 2005 15:19:00 -0000	1.56
@@ -99,11 +99,11 @@
 
 
 #define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & MS_RDONLY)
-#define jffs2_is_writebuffered(c) (c->wbuf != NULL)
 
 #ifndef CONFIG_JFFS2_FS_WRITEBUFFER
 #define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) )
 #define jffs2_can_mark_obsolete(c) (1)
+#define jffs2_is_writebuffered(c) (0)
 #define jffs2_cleanmarker_oob(c) (0)
 #define jffs2_write_nand_cleanmarker(c,jeb) (-EIO)
 
@@ -125,6 +125,7 @@
 
 #else /* NAND and/or ECC'd NOR support present */
 
+#define jffs2_is_writebuffered(c) (c->wbuf != NULL)
 #define SECTOR_ADDR(x) ( ((unsigned long)(x) / (unsigned long)(c->sector_size)) * c->sector_size )
 #define jffs2_can_mark_obsolete(c) ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & MTD_ECC)) || c->mtd->type == MTD_RAM)
 #define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH)



From dedekind at infradead.org  Fri May  6 05:30:30 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:50 2006
Subject: mtd/fs/jffs2 nodemgmt.c,1.121,1.122
Message-ID: <E1DTzAE-00061V-Im@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv23062

Modified Files:
	nodemgmt.c 
Log Message:
Embrace uneeded messages in D1().


Index: nodemgmt.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodemgmt.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- nodemgmt.c	6 Apr 2005 16:02:52 -0000	1.121
+++ nodemgmt.c	6 May 2005 09:30:27 -0000	1.122
@@ -75,7 +75,7 @@
 			dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size + c->unchecked_size;
 			if (dirty < c->nospc_dirty_size) {
 				if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) {
-					printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n");
+					D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n"));
 					break;
 				}
 				D1(printk(KERN_DEBUG "dirty size 0x%08x + unchecked_size 0x%08x < nospc_dirty_size 0x%08x, returning -ENOSPC\n",
@@ -98,7 +98,7 @@
 			avail = c->free_size + c->dirty_size + c->erasing_size + c->unchecked_size;
 			if ( (avail / c->sector_size) <= blocksneeded) {
 				if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) {
-					printk(KERN_NOTICE "jffs2_reserve_space(): Low on possibly available space, but it's a deletion. Allowing...\n");
+					D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on possibly available space, but it's a deletion. Allowing...\n"));
 					break;
 				}
 



From havasi at infradead.org  Mon May  9 04:16:11 2005
From: havasi at infradead.org (havasi@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/fs Kconfig,1.16,1.17
Message-ID: <E1DV3Qx-0007J5-Lf@phoenix.infradead.org>

Update of /home/cvs/mtd/fs
In directory phoenix.infradead.org:/tmp/cvs-serv28074

Modified Files:
	Kconfig 
Log Message:
Summary fixes for JFFS3
- remove NO_CRC option (it could cause incorrect behaviour)
- fix a bug (locking) by Artem



Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/fs/Kconfig,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Kconfig	13 Mar 2005 19:24:31 -0000	1.16
+++ Kconfig	9 May 2005 08:16:08 -0000	1.17
@@ -183,17 +183,6 @@
           by the utility 'sumtool'.
 
           If unsure, say 'N'.
-		  
-config JFFS3_SUMMARY_NOCRCCHECK
-        bool "JFFS3 no crc check for summarized nodes (EXPERIMENTAL) (DANGEROUS)"
-        depends on JFFS3_SUMMARY
-        default n
-        help
-          This feature makes it possible not to check CRC for summarized nodes
-          for faster mount. The disadvantage of it can be that it will be
-          harder to detect the flash hardware failures.
-          
-          If unsure, say 'N'.
 
 config JFFS3_COMPRESSION_OPTIONS
 	bool "Advanced compression options for JFFS3"
@@ -261,4 +250,3 @@
           result.
 
 endchoice
-



From havasi at infradead.org  Mon May  9 04:16:12 2005
From: havasi at infradead.org (havasi@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/fs/jffs3 scan.c,3.17,3.18 summary.c,3.10,3.11
Message-ID: <E1DV3Qy-0007J9-91@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs3
In directory phoenix.infradead.org:/tmp/cvs-serv28074/jffs3

Modified Files:
	scan.c summary.c 
Log Message:
Summary fixes for JFFS3
- remove NO_CRC option (it could cause incorrect behaviour)
- fix a bug (locking) by Artem



Index: scan.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/scan.c,v
retrieving revision 3.17
retrieving revision 3.18
diff -u -r3.17 -r3.18
--- scan.c	14 Apr 2005 09:12:09 -0000	3.17
+++ scan.c	9 May 2005 08:16:09 -0000	3.18
@@ -782,9 +782,7 @@
 			return -ENOMEM;
 		}
 	}
-#ifdef CONFIG_JFFS3_SUMMARY_NOCRCCHECK
-	ic->state = INO_STATE_UNCHECKED;
-#endif
+	
 	/* Wheee. It worked */
 
 	raw->flash_offset = ofs | REF_UNCHECKED;
@@ -868,19 +866,12 @@
 		return -ENOMEM;
 	}
 	
-	ic = jffs3_get_ino_cache(c, je32_to_cpu(rd->pino));
+	ic = jffs3_scan_make_ino_cache(c, je32_to_cpu(rd->pino));
 	if (!ic) {
-		ic = jffs3_scan_make_ino_cache(c, je32_to_cpu(rd->pino));
-		if (!ic) {
-			jffs3_free_full_dirent(fd);
-			jffs3_free_raw_node_ref(raw);
-			return -ENOMEM;
-		}
-	#ifdef CONFIG_JFFS3_SUMMARY_NOCRCCHECK	
-		ic->state = INO_STATE_CHECKEDABSENT;
-	#endif
+		jffs3_free_full_dirent(fd);
+		jffs3_free_raw_node_ref(raw);
+		return -ENOMEM;
 	}
-	
 
 #ifdef TMP_TOTLEN
 	raw->__totlen = PAD(je32_to_cpu(rd->totlen));

Index: summary.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs3/summary.c,v
retrieving revision 3.10
retrieving revision 3.11
diff -u -r3.10 -r3.11
--- summary.c	15 Feb 2005 10:23:16 -0000	3.10
+++ summary.c	9 May 2005 08:16:09 -0000	3.11
@@ -395,8 +395,8 @@
 
 		for(i = 0; i < je16_to_cpu(summary->sum_num); i++) {
 
-			DBG_SUMMARY(1,"Processing summary information %d\n", i);
 			uint8_t *temp8ptr = NULL;
+			DBG_SUMMARY(1,"Processing summary information %d\n", i);
 
 			switch (je16_to_cpu(sp->nodetype)) {
 
@@ -413,26 +413,15 @@
 						return -ENOMEM;
 					}
 
-					ic = jffs3_get_ino_cache(c, ino);
+					ic = jffs3_scan_make_ino_cache(c, ino);
 					if (!ic) {
-						ic = jffs3_scan_make_ino_cache(c, ino);
-						if (!ic) {
-							WARNING_MSG("scan_make_ino_cache failed\n");
-							jffs3_free_raw_node_ref(raw);
-							kfree(summary);
-							return -ENOMEM;
-						}
-				#ifdef CONFIG_JFFS3_SUMMARY_NOCRCCHECK	
-					ic->state = INO_STATE_CHECKEDABSENT;
-				#endif
+						WARNING_MSG("scan_make_ino_cache failed\n");
+						jffs3_free_raw_node_ref(raw);
+						kfree(summary);
+						return -ENOMEM;
 					}
 
-					raw->flash_offset = (jeb->offset + je32_to_cpu(spi->offset)) | 
-				#ifdef CONFIG_JFFS3_SUMMARY_NOCRCCHECK
-					REF_NORMAL; 
-				#else
-					REF_UNCHECKED;
-				#endif
+					raw->flash_offset = (jeb->offset + je32_to_cpu(spi->offset)) | REF_UNCHECKED;
 
 #ifdef TMP_TOTLEN
 					raw->__totlen = PAD(je32_to_cpu(spi->totlen));
@@ -448,11 +437,8 @@
 					jeb->last_node = raw;
 
 					*pseudo_random += je32_to_cpu(spi->version);
-				#ifdef CONFIG_JFFS3_SUMMARY_NOCRCCHECK
-					USED_SPACE(PAD(je32_to_cpu(spi->totlen)));
-				#else
+					
 					UNCHECKED_SPACE(PAD(je32_to_cpu(spi->totlen)));
-				#endif
 					
 					temp8ptr = (uint8_t *) sp;
 					temp8ptr += JFFS3_SUMMARY_INODE_SIZE;
@@ -482,18 +468,12 @@
 						return -ENOMEM;
 					}
 					
-					ic = jffs3_get_ino_cache(c, je32_to_cpu(spd->pino));
+					ic = jffs3_scan_make_ino_cache(c, je32_to_cpu(spd->pino));
 					if (!ic) {
-						ic = jffs3_scan_make_ino_cache(c, je32_to_cpu(spd->pino));
-						if (!ic) {
-							jffs3_free_full_dirent(fd);
-							jffs3_free_raw_node_ref(raw);
-							kfree(summary);
-							return -ENOMEM;
-						}
-					#ifdef CONFIG_JFFS3_SUMMARY_NOCRCCHECK	
-						ic->state = INO_STATE_CHECKEDABSENT;
-					#endif
+						jffs3_free_full_dirent(fd);
+						jffs3_free_raw_node_ref(raw);
+						kfree(summary);
+						return -ENOMEM;
 					}
 
 #ifdef TMP_TOTLEN
@@ -754,7 +734,9 @@
 		return 0;
 	}
 	
+	spin_unlock(&c->erase_completion_lock);
 	summary_ref = jffs3_alloc_raw_node_ref();
+	spin_lock(&c->erase_completion_lock);
 	
 	if (!summary_ref) {
 		printk(KERN_NOTICE "Failed to allocate node ref for summary\n");



From havasi at infradead.org  Mon May  9 04:17:54 2005
From: havasi at infradead.org (havasi@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/html/faq jffs3.xml,1.1,1.2
Message-ID: <E1DV3Sc-0007Jn-VI@phoenix.infradead.org>

Update of /home/cvs/mtd/html/faq
In directory phoenix.infradead.org:/tmp/cvs-serv28123

Modified Files:
	jffs3.xml 
Log Message:
Fix my name :)



Index: jffs3.xml
===================================================================
RCS file: /home/cvs/mtd/html/faq/jffs3.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jffs3.xml	12 Mar 2005 13:48:22 -0000	1.1
+++ jffs3.xml	9 May 2005 08:17:52 -0000	1.2
@@ -12,7 +12,7 @@
 <h2>JFFS3 specific</h2>
 
 <h3>What is fs/jffs3 in the MTD CVS repository?</h3>
-<p>This is currently almost the same as JFFS2 + Fernc Havasi's "summary"
+<p>This is currently almost the same as JFFS2 + Ferenc Havasi's "summary"
 patch applied. The patch is available seperately 
 <a href="http://www.inf.u-szeged.hu/jffs2/">here</a><br />
 Some other minor improvements have been committed.</p>



From domenico.di-tullio at st.com  Mon May  9 04:25:46 2005
From: domenico.di-tullio at st.com (Domenico DI TULLIO)
Date: Mon May 15 21:51:50 2006
Subject: Mtd
Message-ID: <001a01c55470$b480afd0$443682a4@nap.st.com>

Hi all,

I would like know which NAND flash device
are qualified and/or tested with the different
version of MTD?

Where can i find this kind of informations?

Thank you in advance, for your support.

Best Regards,
Domenico



From joern at infradead.org  Fri May 13 05:45:52 2005
From: joern at infradead.org (joern@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/drivers/mtd/devices ramtd.c, NONE, 1.1 Kconfig, 1.16,
	1.17 Makefile.common, 1.7, 1.8
Message-ID: <E1DWWjw-00011R-Cc@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/home/joern/mtd/drivers/mtd/devices

Modified Files:
	Kconfig Makefile.common 
Added Files:
	ramtd.c 
Log Message:
Add ramtd driver.
This driver is similar to mtdram, but allocates/frees memory
dynamically, thus being able to support devices much larger than
physical memory.



--- NEW FILE ramtd.c ---
/**
 * Simple mtd driver that dynamically allocates/frees memory
 *
 * $Id: ramtd.c,v 1.1 2005/05/13 09:45:48 joern Exp $
 *
 * Copyright (c) 2005 Joern Engel <joern@wh.fh-wedel.de>
 */
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/vmalloc.h>

struct ramtd {
	struct mtd_info mtd;
	struct list_head list;
	u32 size;
	void *page[];
};

static LIST_HEAD(ramtd_list);
static DECLARE_MUTEX(ramtd_mutex);


static void *get_pool_page(void)
{
	TRACE();
	void *ret = (void*)__get_free_page(GFP_KERNEL);
	return ret;
}


static void free_pool_page(void *page)
{
	TRACE();
	free_page((unsigned long)page);
}


static int ramtd_erase(struct mtd_info *mtd, struct erase_info *instr)
{
	struct ramtd *ramtd = container_of(mtd, typeof(*ramtd), mtd);
	u32 addr = instr->addr;
	u32 len = instr->len;

	TRACE();
	if (addr + len > mtd->size)
		return -EINVAL;
	if (addr % PAGE_SIZE)
		return -EINVAL;
	if (len % PAGE_SIZE)
		return -EINVAL;

	while (len) {
		u32 page = addr / PAGE_SIZE;

		down_interruptible(&ramtd_mutex);
		kfree(ramtd->page[page]);
		ramtd->page[page] = NULL;
		up(&ramtd_mutex);

		addr += PAGE_SIZE;
		len -= PAGE_SIZE;
	}
	instr->state = MTD_ERASE_DONE;
	mtd_erase_callback(instr);

	return 0;
}


static int ramtd_read(struct mtd_info *mtd, loff_t from, size_t len,
		size_t *retlen, u_char *buf)
{
	struct ramtd *ramtd = container_of(mtd, typeof(*ramtd), mtd);

	TRACE();
	if (from >= mtd->size)
		return -EINVAL;

	if (len > mtd->size - from)
		len = mtd->size - from;

	while (len) {
		u32 page = from / PAGE_SIZE;
		u32 ofs = from % PAGE_SIZE;
		u32 rlen = min_t(u32, len, PAGE_SIZE - ofs);

		down_interruptible(&ramtd_mutex);
		if (!ramtd->page[page])
			memset(buf, 0xff, rlen);
		else
			memcpy(buf, ramtd->page[page] + ofs, rlen);
		up(&ramtd_mutex);

		buf += rlen;
		from += rlen;
		*retlen += rlen;
		len -= rlen;
	}
	return 0;
}


static int ramtd_write(struct mtd_info *mtd, loff_t to, size_t len,
		size_t *retlen, const u_char *buf)
{
	struct ramtd *ramtd = container_of(mtd, typeof(*ramtd), mtd);

	TRACE();
	if (to >= mtd->size)
		return -EINVAL;

	if (len > mtd->size - to)
		len = mtd->size - to;

	*retlen = 0;

	while (len) {
		u32 page = to / PAGE_SIZE;
		u32 ofs = to % PAGE_SIZE;
		u32 wlen = min_t(u32, len, PAGE_SIZE - ofs);

		down_interruptible(&ramtd_mutex);
		if (!ramtd->page[page]) {
			TRACE();
			ramtd->page[page] = get_pool_page;
			memset(ramtd->page[page], 0xff, PAGE_SIZE);
		}
		if (!ramtd->page[page])
			return -EIO;

		TRACE();
		memcpy(ramtd->page[page] + ofs, buf, wlen);
		up(&ramtd_mutex);

		buf += wlen;
		to += wlen;
		*retlen += wlen;
		len -= wlen;
	}
	return 0;
}


static int register_device(const char *name, u32 size)
{
	struct ramtd *new;
	u32 pages_size;

	TRACE();
	size = PAGE_ALIGN(size);
	pages_size = size / PAGE_SIZE * sizeof(void*);
	new = vmalloc(sizeof(*new) + pages_size);
	if (!new)
		return -ENOMEM;
	memset(new, 0, sizeof(*new) + pages_size);

	new->mtd.name = (char*)name;
	new->mtd.size = size;
	new->mtd.flags = MTD_CAP_RAM | MTD_ERASEABLE | MTD_VOLATILE;
	new->mtd.owner = THIS_MODULE;
	new->mtd.type = MTD_RAM;
	new->mtd.erasesize = PAGE_SIZE;
	new->mtd.write = ramtd_write;
	new->mtd.read = ramtd_read;
	new->mtd.erase = ramtd_erase;

	if (add_mtd_device(&new->mtd)) {
		free_pool_page(new);
		return -EAGAIN;
	}

	down_interruptible(&ramtd_mutex);
	list_add(&new->list, &ramtd_list);
	up(&ramtd_mutex);
	return 0;
}


static int __init ramtd_init(void)
{
	TRACE();
	return register_device("ramtd", 4*1024*1024); /* FIXME */
}

static void __exit ramtd_exit(void)
{
	struct ramtd *this, *next;

	TRACE();
	down_interruptible(&ramtd_mutex);
	list_for_each_entry_safe(this, next, &ramtd_list, list) {
		del_mtd_device(&this->mtd);
		kfree(this);
	}
	up(&ramtd_mutex);
}


module_init(ramtd_init);
module_exit(ramtd_exit);


MODULE_LICENSE("GPL");
MODULE_AUTHOR("Joern Engel <joern@wh.fh-wedel.de>");
MODULE_DESCRIPTION("MTD using dynamic memory allocation");

Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Kconfig,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Kconfig	6 Jan 2005 15:15:47 -0000	1.16
+++ Kconfig	13 May 2005 09:45:48 -0000	1.17
@@ -113,6 +113,15 @@
 	  allocating space from Linux's available memory. Otherwise, leave 
 	  this set to zero. Most people will want to leave this as zero.
 
+config RAMTD
+	tristate "MTD using dynamic memory allocation"
+	depends on MTD
+	help
+	  This driver dynamically allocates memory as the devices are written
+	  to and frees it on erases.
+
+	  If unsure, say n.
+
 config MTD_BLKMTD
 	tristate "MTD emulation using block device"
 	depends on MTD

Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/Makefile.common,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile.common	22 Dec 2004 17:51:15 -0000	1.7
+++ Makefile.common	13 May 2005 09:45:48 -0000	1.8
@@ -23,3 +23,4 @@
 obj-$(CONFIG_MTD_LART)		+= lart.o
 obj-$(CONFIG_MTD_BLKMTD)	+= blkmtd.o
 obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd.o
+obj-$(CONFIG_RAMTD)		+= ramtd.o



From dedekind at infradead.org  Wed May 18 07:37:28 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:50 2006
Subject: mtd/fs/jffs2 super.c,1.105,1.106
Message-ID: <E1DYMrg-0002q2-3C@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv10902

Modified Files:
	super.c 
Log Message:
First kill GC thread, then start clearing the internal structures

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- super.c	9 Feb 2005 09:23:54 -0000	1.105
+++ super.c	18 May 2005 11:37:25 -0000	1.106
@@ -270,8 +270,6 @@
 
 	D2(printk(KERN_DEBUG "jffs2: jffs2_put_super()\n"));
 
-	if (!(sb->s_flags & MS_RDONLY))
-		jffs2_stop_garbage_collect_thread(c);
 	down(&c->alloc_sem);
 	jffs2_flush_wbuf_pad(c);
 	up(&c->alloc_sem);
@@ -292,6 +290,8 @@
 static void jffs2_kill_sb(struct super_block *sb)
 {
 	struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
+	if (!(sb->s_flags & MS_RDONLY))
+		jffs2_stop_garbage_collect_thread(c);
 	generic_shutdown_super(sb);
 	put_mtd_device(c->mtd);
 	kfree(c);



From gleixner at infradead.org  Thu May 19 12:09:01 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/include/mtd mtd-abi.h,1.10,1.11
Message-ID: <E1DYna1-0004WN-P4@phoenix.infradead.org>

Update of /home/cvs/mtd/include/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv17371

Modified Files:
	mtd-abi.h 
Log Message:
Honour autoplacement schemes supplied by the caller

Index: mtd-abi.h
===================================================================
RCS file: /home/cvs/mtd/include/mtd/mtd-abi.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- mtd-abi.h	9 Feb 2005 09:17:42 -0000	1.10
+++ mtd-abi.h	19 May 2005 16:08:58 -0000	1.11
@@ -61,6 +61,7 @@
 #define MTD_NANDECC_PLACE	1	// Use the given placement in the structure (YAFFS1 legacy mode)
 #define MTD_NANDECC_AUTOPLACE	2	// Use the default placement scheme
 #define MTD_NANDECC_PLACEONLY	3	// Use the given placement in the structure (Do not store ecc result on read)
+#define MTD_NANDECC_AUTOPL_USR 	4	// Use the given autoplacement scheme rather than using the default
 
 /* OTP mode selection */
 #define MTD_OTP_OFF		0



From gleixner at infradead.org  Thu May 19 12:10:26 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/drivers/mtd/nand nand_base.c,1.142,1.143
Message-ID: <E1DYnbO-0004X5-Bd@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv17415

Modified Files:
	nand_base.c 
Log Message:
Honour autoplacement schemes supplied by the caller

Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- nand_base.c	11 Apr 2005 14:16:07 -0000	1.142
+++ nand_base.c	19 May 2005 16:10:22 -0000	1.143
@@ -1195,7 +1195,8 @@
 		}	
 
 		/* get oob area, if we have no oob buffer from fs-driver */
-		if (!oob_buf || oobsel->useecc == MTD_NANDECC_AUTOPLACE)
+		if (!oob_buf || oobsel->useecc == MTD_NANDECC_AUTOPLACE ||
+			oobsel->useecc == MTD_NANDECC_AUTOPL_USR)
 			oob_data = &this->data_buf[end];
 
 		eccsteps = this->eccsteps;
@@ -1284,6 +1285,7 @@
 			/* without autoplace. Legacy mode used by YAFFS1 */
 			switch(oobsel->useecc) {
 			case MTD_NANDECC_AUTOPLACE:
+			case MTD_NANDECC_AUTOPL_USR:
 				/* Walk through the autoplace chunks */
 				for (i = 0; oobsel->oobfree[i][1]; i++) {
 					int from = oobsel->oobfree[i][0];
@@ -1645,6 +1647,8 @@
 		oobsel = this->autooob;
 		autoplace = 1;
 	}	
+	if (oobsel->useecc == MTD_NANDECC_AUTOPL_USR)
+		autoplace = 1;
 
 	/* Setup variables and oob buffer */
 	totalpages = len >> this->page_shift;
@@ -1919,6 +1923,8 @@
 		oobsel = this->autooob;
 		autoplace = 1;
 	}	
+	if (oobsel->useecc == MTD_NANDECC_AUTOPL_USR)
+		autoplace = 1;
 
 	/* Setup start page */
 	page = (int) (to >> this->page_shift);



From gleixner at infradead.org  Thu May 19 12:12:20 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/include/linux jffs2_fs_sb.h,1.51,1.52
Message-ID: <E1DYndE-0004Xm-9a@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv17458/include/linux

Modified Files:
	jffs2_fs_sb.h 
Log Message:
Convert thread start to completion

Index: jffs2_fs_sb.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/jffs2_fs_sb.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- jffs2_fs_sb.h	28 Feb 2005 08:21:06 -0000	1.51
+++ jffs2_fs_sb.h	19 May 2005 16:12:17 -0000	1.52
@@ -32,7 +32,7 @@
 	unsigned int flags;
 
 	struct task_struct *gc_task;	/* GC task struct */
-	struct semaphore gc_thread_start; /* GC thread start mutex */
+	struct completion gc_thread_start; /* GC thread start completion */
 	struct completion gc_thread_exit; /* GC thread exit completion port */
 
 	struct semaphore alloc_sem;	/* Used to protect all the following 



From gleixner at infradead.org  Thu May 19 12:18:11 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:50 2006
Subject: mtd/fs/jffs2 background.c,1.51,1.52
Message-ID: <E1DYnit-0004Yw-Fj@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv17530

Modified Files:
	background.c 
Log Message:
Convert thread start to completion

Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- background.c	17 Mar 2005 20:15:58 -0000	1.51
+++ background.c	19 May 2005 16:18:08 -0000	1.52
@@ -37,7 +37,7 @@
 	if (c->gc_task)
 		BUG();
 
-	init_MUTEX_LOCKED(&c->gc_thread_start);
+	init_completion(&c->gc_thread_start);
 	init_completion(&c->gc_thread_exit);
 
 	pid = kernel_thread(jffs2_garbage_collect_thread, c, CLONE_FS|CLONE_FILES);
@@ -48,7 +48,7 @@
 	} else {
 		/* Wait for it... */
 		D1(printk(KERN_DEBUG "JFFS2: Garbage collect thread is pid %d\n", pid));
-		down(&c->gc_thread_start);
+		wait_for_completion(&c->gc_thread_start);
 	}
  
 	return ret;
@@ -75,7 +75,7 @@
 	allow_signal(SIGCONT);
 
 	c->gc_task = current;
-	up(&c->gc_thread_start);
+	complete(&c->gc_thread_start);
 
 	set_user_nice(current, 10);
 



From nico at infradead.org  Thu May 19 13:02:01 2005
From: nico at infradead.org (Nicolas Pitre)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.176,1.177
Message-ID: <E1DYoPJ-0004bX-7k@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv17669/drivers/mtd/chips

Modified Files:
	cfi_cmdset_0001.c 
Log Message:
flash locking reorg for XIP

This reworks the XIP locking to make sure no lock primitive is ever
called from XIP disabled paths even if in theory they should not
cause any reschedule.  Relying on the current spinlock implementation
is rather fragile and not especially clean from an abstraction pov.
The recent RT work makes it even more obvious.

Signed-off-by: Nicolas Pitre <nico@cam.org>


Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- cfi_cmdset_0001.c	27 Apr 2005 20:01:49 -0000	1.176
+++ cfi_cmdset_0001.c	19 May 2005 17:01:57 -0000	1.177
@@ -826,10 +826,6 @@
  * assembly to make sure inline functions were actually inlined and that gcc
  * didn't emit calls to its own support functions). Also configuring MTD CFI
  * support to a single buswidth and a single interleave is also recommended.
- * Note that not only IRQs are disabled but the preemption count is also
- * increased to prevent other locking primitives (namely spin_unlock) from
- * decrementing the preempt count to zero and scheduling the CPU away while
- * not in array mode.
  */
 
 static void xip_disable(struct map_info *map, struct flchip *chip,
@@ -837,7 +833,6 @@
 {
 	/* TODO: chips with no XIP use should ignore and return */
 	(void) map_read(map, adr); /* ensure mmu mapping is up to date */
-	preempt_disable();
 	local_irq_disable();
 }
 
@@ -852,7 +847,6 @@
 	(void) map_read(map, adr);
 	asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */
 	local_irq_enable();
-	preempt_enable();
 }
 
 /*
@@ -928,7 +922,7 @@
 			(void) map_read(map, adr);
 			asm volatile (".rep 8; nop; .endr");
 			local_irq_enable();
-			preempt_enable();
+			spin_unlock(chip->mutex);
 			asm volatile (".rep 8; nop; .endr");
 			cond_resched();
 
@@ -938,15 +932,15 @@
 			 * a suspended erase state.  If so let's wait
 			 * until it's done.
 			 */
-			preempt_disable();
+			spin_lock(chip->mutex);
 			while (chip->state != newstate) {
 				DECLARE_WAITQUEUE(wait, current);
 				set_current_state(TASK_UNINTERRUPTIBLE);
 				add_wait_queue(&chip->wq, &wait);
-				preempt_enable();
+				spin_unlock(chip->mutex);
 				schedule();
 				remove_wait_queue(&chip->wq, &wait);
-				preempt_disable();
+				spin_lock(chip->mutex);
 			}
 			/* Disallow XIP again */
 			local_irq_disable();
@@ -975,12 +969,14 @@
  * The INVALIDATE_CACHED_RANGE() macro is normally used in parallel while
  * the flash is actively programming or erasing since we have to poll for
  * the operation to complete anyway.  We can't do that in a generic way with
- * a XIP setup so do it before the actual flash operation in this case.
+ * a XIP setup so do it before the actual flash operation in this case
+ * and stub it out from INVALIDATE_CACHE_UDELAY.
  */
-#undef INVALIDATE_CACHED_RANGE
-#define INVALIDATE_CACHED_RANGE(x...)
-#define XIP_INVAL_CACHED_RANGE(map, from, size) \
-	do { if(map->inval_cache) map->inval_cache(map, from, size); } while(0)
+#define XIP_INVAL_CACHED_RANGE(map, from, size)  \
+	INVALIDATE_CACHED_RANGE(map, from, size)
+
+#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec)  \
+	UDELAY(map, chip, adr, usec)
 
 /*
  * Extra notes:
@@ -1003,11 +999,23 @@
 
 #define xip_disable(map, chip, adr)
 #define xip_enable(map, chip, adr)
-
-#define UDELAY(map, chip, adr, usec)  cfi_udelay(usec)
-
 #define XIP_INVAL_CACHED_RANGE(x...)
 
+#define UDELAY(map, chip, adr, usec)  \
+do {  \
+	spin_unlock(chip->mutex);  \
+	cfi_udelay(usec);  \
+	spin_lock(chip->mutex);  \
+} while (0)
+
+#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec)  \
+do {  \
+	spin_unlock(chip->mutex);  \
+	INVALIDATE_CACHED_RANGE(map, adr, len);  \
+	cfi_udelay(usec);  \
+	spin_lock(chip->mutex);  \
+} while (0)
+
 #endif
 
 static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t adr, size_t len)
@@ -1227,10 +1235,9 @@
 	map_write(map, datum, adr);
 	chip->state = mode;
 
-	spin_unlock(chip->mutex);
-	INVALIDATE_CACHED_RANGE(map, adr, map_bankwidth(map));
-	UDELAY(map, chip, adr, chip->word_write_time);
-	spin_lock(chip->mutex);
+	INVALIDATE_CACHE_UDELAY(map, chip,
+				adr, map_bankwidth(map),
+				chip->word_write_time));
 
 	timeo = jiffies + (HZ/2);
 	z = 0;
@@ -1263,10 +1270,8 @@
 		}
 
 		/* Latency issues. Drop the lock, wait a while and retry */
-		spin_unlock(chip->mutex);
 		z++;
 		UDELAY(map, chip, adr, 1);
-		spin_lock(chip->mutex);
 	}
 	if (!z) {
 		chip->word_write_time--;
@@ -1430,9 +1435,7 @@
 		if (map_word_andequal(map, status, status_OK, status_OK))
 			break;
 
-		spin_unlock(chip->mutex);
 		UDELAY(map, chip, cmd_adr, 1);
-		spin_lock(chip->mutex);
 
 		if (++z > 20) {
 			/* Argh. Not ready for write to buffer */
@@ -1478,10 +1481,9 @@
 	map_write(map, CMD(0xd0), cmd_adr);
 	chip->state = FL_WRITING;
 
-	spin_unlock(chip->mutex);
-	INVALIDATE_CACHED_RANGE(map, adr, len);
-	UDELAY(map, chip, cmd_adr, chip->buffer_write_time);
-	spin_lock(chip->mutex);
+	INVALIDATE_CACHE_UDELAY(map, chip, 
+				cmd_adr, len,
+				chip->buffer_write_time);
 
 	timeo = jiffies + (HZ/2);
 	z = 0;
@@ -1513,10 +1515,8 @@
 		}
 		
 		/* Latency issues. Drop the lock, wait a while and retry */
-		spin_unlock(chip->mutex);
-		UDELAY(map, chip, cmd_adr, 1);
 		z++;
-		spin_lock(chip->mutex);
+		UDELAY(map, chip, cmd_adr, 1);
 	}
 	if (!z) {
 		chip->buffer_write_time--;
@@ -1644,10 +1644,9 @@
 	chip->state = FL_ERASING;
 	chip->erase_suspended = 0;
 
-	spin_unlock(chip->mutex);
-	INVALIDATE_CACHED_RANGE(map, adr, len);
-	UDELAY(map, chip, adr, chip->erase_time*1000/2);
-	spin_lock(chip->mutex);
+	INVALIDATE_CACHE_UDELAY(map, chip,
+				adr, len,
+				chip->erase_time*1000/2);
 
 	/* FIXME. Use a timer to check this, and return immediately. */
 	/* Once the state machine's known to be working I'll do that */
@@ -1692,9 +1691,7 @@
 		}
 		
 		/* Latency issues. Drop the lock, wait a while and retry */
-		spin_unlock(chip->mutex);
 		UDELAY(map, chip, adr, 1000000/HZ);
-		spin_lock(chip->mutex);
 	}
 
 	/* We've broken this before. It doesn't hurt to be safe */
@@ -1866,11 +1863,8 @@
 	 * to delay.
 	 */
 
-	if (!extp || !(extp->FeatureSupport & (1 << 5))) {
-		spin_unlock(chip->mutex);
+	if (!extp || !(extp->FeatureSupport & (1 << 5)))
 		UDELAY(map, chip, adr, 1000000/HZ);
-		spin_lock(chip->mutex);
-	}
 
 	/* FIXME. Use a timer to check this, and return immediately. */
 	/* Once the state machine's known to be working I'll do that */
@@ -1897,9 +1891,7 @@
 		}
 		
 		/* Latency issues. Drop the lock, wait a while and retry */
-		spin_unlock(chip->mutex);
 		UDELAY(map, chip, adr, 1);
-		spin_lock(chip->mutex);
 	}
 	
 	/* Done and happy. */
@@ -1979,8 +1971,7 @@
 	}
 
 	/* let's ensure we're not reading back cached data from array mode */
-	if (map->inval_cache)
-		map->inval_cache(map, chip->start + offset, size);
+	INVALIDATE_CACHED_RANGE(map, chip->start + offset, size);
 
 	xip_disable(map, chip, chip->start);
 	if (chip->state != FL_JEDEC_QUERY) {
@@ -1991,8 +1982,7 @@
 	xip_enable(map, chip, chip->start);
 
 	/* then ensure we don't keep OTP data in the cache */
-	if (map->inval_cache)
-		map->inval_cache(map, chip->start + offset, size);
+	INVALIDATE_CACHED_RANGE(map, chip->start + offset, size);
 
 	put_chip(map, chip, chip->start);
 	spin_unlock(chip->mutex);



From nico at infradead.org  Thu May 19 13:05:47 2005
From: nico at infradead.org (Nicolas Pitre)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0001.c,1.177,1.178
Message-ID: <E1DYoSx-0004cB-8W@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv17731/drivers/mtd/chips

Modified Files:
	cfi_cmdset_0001.c 
Log Message:
silly compile fix


Index: cfi_cmdset_0001.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0001.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -r1.177 -r1.178
--- cfi_cmdset_0001.c	19 May 2005 17:01:57 -0000	1.177
+++ cfi_cmdset_0001.c	19 May 2005 17:05:43 -0000	1.178
@@ -1237,7 +1237,7 @@
 
 	INVALIDATE_CACHE_UDELAY(map, chip,
 				adr, map_bankwidth(map),
-				chip->word_write_time));
+				chip->word_write_time);
 
 	timeo = jiffies + (HZ/2);
 	z = 0;



From ebiederman at lnxi.com  Thu May 19 23:28:26 2005
From: ebiederman at lnxi.com (ebiederman@lnxi.com)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0002.c,1.114,1.115
Message-ID: <E1DYyBW-0005Ld-TE@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv20544/drivers/mtd/chips

Modified Files:
	cfi_cmdset_0002.c 
Log Message:
- Check for errors besides infinite loops when writing and erasing.


Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- cfi_cmdset_0002.c	11 Dec 2004 15:43:53 -0000	1.114
+++ cfi_cmdset_0002.c	20 May 2005 03:28:23 -0000	1.115
@@ -43,6 +43,7 @@
 #define MANUFACTURER_AMD	0x0001
 #define MANUFACTURER_SST	0x00BF
 #define SST49LF004B	        0x0060
+#define SST49LF008A		0x005a
 
 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -191,6 +192,7 @@
 };
 static struct cfi_fixup jedec_fixup_table[] = {
 	{ MANUFACTURER_SST, SST49LF004B, fixup_use_fwh_lock, NULL, },
+	{ MANUFACTURER_SST, SST49LF008A, fixup_use_fwh_lock, NULL, },
 	{ 0, 0, NULL, NULL }
 };
 
@@ -401,6 +403,32 @@
 	return map_word_equal(map, d, t);
 }
 
+/*
+ * Return true if the chip is ready and has the correct value.
+ *
+ * Ready is one of: read mode, query mode, erase-suspend-read mode (in any
+ * non-suspended sector) and it is indicated by no bits toggling.
+ *
+ * Error are indicated by toggling bits or bits held with the wrong value,
+ * or with bits toggling.
+ *
+ * Note that anything more complicated than checking if no bits are toggling
+ * (including checking DQ5 for an error status) is tricky to get working
+ * correctly and is therefore not done	(particulary with interleaved chips
+ * as each chip must be checked independantly of the others).
+ *
+ */
+static int chip_good(struct map_info *map, unsigned long addr, map_word expected)
+{
+	map_word oldd, curd;
+
+	oldd = map_read(map, addr);
+	curd = map_read(map, addr);
+
+	return	map_word_equal(map, oldd, curd) && 
+		map_word_equal(map, curd, expected);
+}
+
 static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode)
 {
 	DECLARE_WAITQUEUE(wait, current);
@@ -765,26 +793,29 @@
 		}
 
 		if (chip_ready(map, adr))
-			goto op_done;
+			break;
 
-		if (time_after(jiffies, timeo))
+		if (time_after(jiffies, timeo)) {
+			printk(KERN_WARNING "MTD %s(): software timeout\n", __func__);
                         break;
+		}
 
 		/* Latency issues. Drop the lock, wait a while and retry */
 		cfi_spin_unlock(chip->mutex);
 		cfi_udelay(1);
 		cfi_spin_lock(chip->mutex);
 	}
+	/* Did we succeed? */
+	if (!chip_good(map, adr, datum)) {
+		/* reset on all failures. */
+		map_write( map, CMD(0xF0), chip->start );
+		/* FIXME - should have reset delay before continuing */
 
-	printk(KERN_WARNING "MTD %s(): software timeout\n", __func__);
-
-	/* reset on all failures. */
-	map_write( map, CMD(0xF0), chip->start );
-	/* FIXME - should have reset delay before continuing */
-	if (++retry_cnt <= MAX_WORD_RETRIES) 
-		goto retry;
+		if (++retry_cnt <= MAX_WORD_RETRIES) 
+			goto retry;
 
-	ret = -EIO;
+		ret = -EIO;
+	}
  op_done:
 	chip->state = FL_READY;
 	put_chip(map, chip, adr);
@@ -1187,10 +1218,13 @@
 		}
 
 		if (chip_ready(map, adr))
-			goto op_done;
+			break;
 
-		if (time_after(jiffies, timeo))
+		if (time_after(jiffies, timeo)) {
+			printk(KERN_WARNING "MTD %s(): software timeout\n",
+				__func__ );
 			break;
+		}
 
 		/* Latency issues. Drop the lock, wait a while and retry */
 		cfi_spin_unlock(chip->mutex);
@@ -1198,16 +1232,15 @@
 		schedule_timeout(1);
 		cfi_spin_lock(chip->mutex);
 	}
+	/* Did we succeed? */
+	if (!chip_good(map, adr, map_word_ff(map))) {
+		/* reset on all failures. */
+		map_write( map, CMD(0xF0), chip->start );
+		/* FIXME - should have reset delay before continuing */
 
-	printk(KERN_WARNING "MTD %s(): software timeout\n",
-	       __func__ );
-
-	/* reset on all failures. */
-	map_write( map, CMD(0xF0), chip->start );
-	/* FIXME - should have reset delay before continuing */
+		ret = -EIO;
+	}
 
-	ret = -EIO;
- op_done:
 	chip->state = FL_READY;
 	put_chip(map, chip, adr);
 	cfi_spin_unlock(chip->mutex);
@@ -1272,10 +1305,13 @@
 		}
 
 		if (chip_ready(map, adr))
-			goto op_done;
+			break;
 
-		if (time_after(jiffies, timeo))
+		if (time_after(jiffies, timeo)) {
+			printk(KERN_WARNING "MTD %s(): software timeout\n",
+				__func__ );
 			break;
+		}
 
 		/* Latency issues. Drop the lock, wait a while and retry */
 		cfi_spin_unlock(chip->mutex);
@@ -1283,16 +1319,15 @@
 		schedule_timeout(1);
 		cfi_spin_lock(chip->mutex);
 	}
-	
-	printk(KERN_WARNING "MTD %s(): software timeout\n",
-	       __func__ );
-	
-	/* reset on all failures. */
-	map_write( map, CMD(0xF0), chip->start );
-	/* FIXME - should have reset delay before continuing */
+	/* Did we succeed? */
+	if (chip_good(map, adr, map_word_ff(map))) {
+		/* reset on all failures. */
+		map_write( map, CMD(0xF0), chip->start );
+		/* FIXME - should have reset delay before continuing */
+
+		ret = -EIO;
+	}
 
-	ret = -EIO;
- op_done:
 	chip->state = FL_READY;
 	put_chip(map, chip, adr);
 	cfi_spin_unlock(chip->mutex);



From lavinen at infradead.org  Fri May 20 08:41:29 2005
From: lavinen at infradead.org (lavinen@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/devices ramtd.c,1.1,1.2
Message-ID: <E1DZ6oj-0005r3-NF@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv22496

Modified Files:
	ramtd.c 
Log Message:
Removed all traces of TRACE().


Index: ramtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/ramtd.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ramtd.c	13 May 2005 09:45:48 -0000	1.1
+++ ramtd.c	20 May 2005 12:41:26 -0000	1.2
@@ -24,7 +24,6 @@
 
 static void *get_pool_page(void)
 {
-	TRACE();
 	void *ret = (void*)__get_free_page(GFP_KERNEL);
 	return ret;
 }
@@ -32,7 +31,6 @@
 
 static void free_pool_page(void *page)
 {
-	TRACE();
 	free_page((unsigned long)page);
 }
 
@@ -43,7 +41,6 @@
 	u32 addr = instr->addr;
 	u32 len = instr->len;
 
-	TRACE();
 	if (addr + len > mtd->size)
 		return -EINVAL;
 	if (addr % PAGE_SIZE)
@@ -74,7 +71,6 @@
 {
 	struct ramtd *ramtd = container_of(mtd, typeof(*ramtd), mtd);
 
-	TRACE();
 	if (from >= mtd->size)
 		return -EINVAL;
 
@@ -107,7 +103,6 @@
 {
 	struct ramtd *ramtd = container_of(mtd, typeof(*ramtd), mtd);
 
-	TRACE();
 	if (to >= mtd->size)
 		return -EINVAL;
 
@@ -123,14 +118,12 @@
 
 		down_interruptible(&ramtd_mutex);
 		if (!ramtd->page[page]) {
-			TRACE();
 			ramtd->page[page] = get_pool_page;
 			memset(ramtd->page[page], 0xff, PAGE_SIZE);
 		}
 		if (!ramtd->page[page])
 			return -EIO;
 
-		TRACE();
 		memcpy(ramtd->page[page] + ofs, buf, wlen);
 		up(&ramtd_mutex);
 
@@ -148,7 +141,6 @@
 	struct ramtd *new;
 	u32 pages_size;
 
-	TRACE();
 	size = PAGE_ALIGN(size);
 	pages_size = size / PAGE_SIZE * sizeof(void*);
 	new = vmalloc(sizeof(*new) + pages_size);
@@ -180,7 +172,6 @@
 
 static int __init ramtd_init(void)
 {
-	TRACE();
 	return register_device("ramtd", 4*1024*1024); /* FIXME */
 }
 
@@ -188,7 +179,6 @@
 {
 	struct ramtd *this, *next;
 
-	TRACE();
 	down_interruptible(&ramtd_mutex);
 	list_for_each_entry_safe(this, next, &ramtd_list, list) {
 		del_mtd_device(&this->mtd);



From joern at infradead.org  Fri May 20 10:45:37 2005
From: joern at infradead.org (joern@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/devices ramtd.c,1.2,1.3
Message-ID: <E1DZ8kr-0005y7-Pa@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/home/joern/mtd/drivers/mtd/devices

Modified Files:
	ramtd.c 
Log Message:
Fix stupid non-initialization bug in read().



Index: ramtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/ramtd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ramtd.c	20 May 2005 12:41:26 -0000	1.2
+++ ramtd.c	20 May 2005 14:45:34 -0000	1.3
@@ -77,6 +77,7 @@
 	if (len > mtd->size - from)
 		len = mtd->size - from;
 
+	*retlen = 0;
 	while (len) {
 		u32 page = from / PAGE_SIZE;
 		u32 ofs = from % PAGE_SIZE;
@@ -110,7 +111,6 @@
 		len = mtd->size - to;
 
 	*retlen = 0;
-
 	while (len) {
 		u32 page = to / PAGE_SIZE;
 		u32 ofs = to % PAGE_SIZE;



From joern at infradead.org  Fri May 20 11:08:24 2005
From: joern at infradead.org (joern@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/devices ramtd.c,1.3,1.4
Message-ID: <E1DZ96u-000600-Oh@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/home/joern/mtd/drivers/mtd/devices

Modified Files:
	ramtd.c 
Log Message:
Bugfix.



Index: ramtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/ramtd.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ramtd.c	20 May 2005 14:45:34 -0000	1.3
+++ ramtd.c	20 May 2005 15:08:21 -0000	1.4
@@ -118,7 +118,7 @@
 
 		down_interruptible(&ramtd_mutex);
 		if (!ramtd->page[page]) {
-			ramtd->page[page] = get_pool_page;
+			ramtd->page[page] = get_pool_page();
 			memset(ramtd->page[page], 0xff, PAGE_SIZE);
 		}
 		if (!ramtd->page[page])



From gleixner at infradead.org  Fri May 20 11:26:49 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/fs/jffs2 file.c,1.100,1.101
Message-ID: <E1DZ9Oj-00061R-3P@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv23141

Modified Files:
	file.c 
Log Message:
Upstream sync. PAGE_BUG is not longer available

Index: file.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/file.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- file.c	17 Mar 2005 20:23:06 -0000	1.100
+++ file.c	20 May 2005 15:26:45 -0000	1.101
@@ -79,8 +79,7 @@
 
 	D2(printk(KERN_DEBUG "jffs2_do_readpage_nolock(): ino #%lu, page at offset 0x%lx\n", inode->i_ino, pg->index << PAGE_CACHE_SHIFT));
 
-	if (!PageLocked(pg))
-                PAGE_BUG(pg);
+	BUG_ON(!PageLocked(pg));
 
 	pg_buf = kmap(pg);
 	/* FIXME: Can kmap fail? */



From gleixner at infradead.org  Fri May 20 11:39:57 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/fs/jffs2 compr_rubin.c,1.20,1.21 compr_zlib.c,1.29,1.30
Message-ID: <E1DZ9bR-00062T-Ir@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv23205

Modified Files:
	compr_rubin.c compr_zlib.c 
Log Message:
Upstream sync. Another round of make static by Adrian

Index: compr_rubin.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_rubin.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- compr_rubin.c	23 Jun 2004 16:34:40 -0000	1.20
+++ compr_rubin.c	20 May 2005 15:39:54 -0000	1.21
@@ -228,8 +228,10 @@
 	return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
 }
 #endif
-int jffs2_dynrubin_compress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t *sourcelen, uint32_t *dstlen, void *model)
+static int jffs2_dynrubin_compress(unsigned char *data_in,
+				   unsigned char *cpage_out,
+				   uint32_t *sourcelen, uint32_t *dstlen,
+				   void *model)
 {
 	int bits[8];
 	unsigned char histo[256];
@@ -306,15 +308,19 @@
 }		   
 
 
-int jffs2_rubinmips_decompress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t sourcelen, uint32_t dstlen, void *model)
+static int jffs2_rubinmips_decompress(unsigned char *data_in,
+				      unsigned char *cpage_out,
+				      uint32_t sourcelen, uint32_t dstlen,
+				      void *model)
 {
 	rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
         return 0;
 }
 
-int jffs2_dynrubin_decompress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t sourcelen, uint32_t dstlen, void *model)
+static int jffs2_dynrubin_decompress(unsigned char *data_in,
+				     unsigned char *cpage_out,
+				     uint32_t sourcelen, uint32_t dstlen,
+				     void *model)
 {
 	int bits[8];
 	int c;

Index: compr_zlib.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_zlib.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- compr_zlib.c	16 Nov 2004 20:36:11 -0000	1.29
+++ compr_zlib.c	20 May 2005 15:39:54 -0000	1.30
@@ -69,8 +69,10 @@
 #define free_workspaces() do { } while(0)
 #endif /* __KERNEL__ */
 
-int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, 
-		   uint32_t *sourcelen, uint32_t *dstlen, void *model)
+static int jffs2_zlib_compress(unsigned char *data_in,
+			       unsigned char *cpage_out,
+			       uint32_t *sourcelen, uint32_t *dstlen,
+			       void *model)
 {
 	int ret;
 
@@ -135,8 +137,10 @@
 	return ret;
 }
 
-int jffs2_zlib_decompress(unsigned char *data_in, unsigned char *cpage_out,
-		      uint32_t srclen, uint32_t destlen, void *model)
+static int jffs2_zlib_decompress(unsigned char *data_in,
+				 unsigned char *cpage_out,
+				 uint32_t srclen, uint32_t destlen,
+				 void *model)
 {
 	int ret;
 	int wbits = MAX_WBITS;



From joern at infradead.org  Fri May 20 11:50:47 2005
From: joern at infradead.org (joern@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/devices ramtd.c,1.4,1.5
Message-ID: <E1DZ9lv-00063c-Dq@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/home/joern/mtd/drivers/mtd/devices

Modified Files:
	ramtd.c 
Log Message:
Next bugfix.



Index: ramtd.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/ramtd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ramtd.c	20 May 2005 15:08:21 -0000	1.4
+++ ramtd.c	20 May 2005 15:50:43 -0000	1.5
@@ -52,7 +52,7 @@
 		u32 page = addr / PAGE_SIZE;
 
 		down_interruptible(&ramtd_mutex);
-		kfree(ramtd->page[page]);
+		free_pool_page(ramtd->page[page]);
 		ramtd->page[page] = NULL;
 		up(&ramtd_mutex);
 



From gleixner at infradead.org  Fri May 20 12:29:08 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/maps pci.c,1.10,1.11
Message-ID: <E1DZAN2-00067G-KM@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv23502

Modified Files:
	pci.c 
Log Message:
[PATCH] sort-out-pci_rom_address_enable-vs-ioresource_rom_enable.patch

From: Jon Smirl <jonsmirl@gmail.com>

This sorts out the usage of PCI_ROM_ADDRESS_ENABLE vs
IORESOURCE_ROM_ENABLE.  PCI_ROM_ADDRESS_ENABLE is for actually manipulating
the ROM's PCI config space.  IORESOURCE_ROM_ENABLE is for tracking the
IORESOURCE that the ROM is enabled.  Both are defined to 1 so code
shouldn't change.

Just to remind people, there are new PCI routines for enable/disable ROMs
so please call them instead of directly coding access in device drivers.
There are ten or so drivers that need to be converted to the new API.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>



Index: pci.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/pci.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- pci.c	18 Mar 2005 14:04:35 -0000	1.10
+++ pci.c	20 May 2005 16:29:05 -0000	1.11
@@ -205,9 +205,9 @@
 		 * or simply enabling it?
 		 */
 		if (!(pci_resource_flags(dev, PCI_ROM_RESOURCE) &
-		     PCI_ROM_ADDRESS_ENABLE)) {
+				    IORESOURCE_ROM_ENABLE)) {
 		     	u32 val;
-			pci_resource_flags(dev, PCI_ROM_RESOURCE) |= PCI_ROM_ADDRESS_ENABLE;
+			pci_resource_flags(dev, PCI_ROM_RESOURCE) |= IORESOURCE_ROM_ENABLE;
 			pci_read_config_dword(dev, PCI_ROM_ADDRESS, &val);
 			val |= PCI_ROM_ADDRESS_ENABLE;
 			pci_write_config_dword(dev, PCI_ROM_ADDRESS, val);
@@ -241,7 +241,7 @@
 	/*
 	 * We need to undo the PCI BAR2/PCI ROM BAR address alteration.
 	 */
-	pci_resource_flags(dev, PCI_ROM_RESOURCE) &= ~PCI_ROM_ADDRESS_ENABLE;
+	pci_resource_flags(dev, PCI_ROM_RESOURCE) &= ~IORESOURCE_ROM_ENABLE;
 	pci_read_config_dword(dev, PCI_ROM_ADDRESS, &val);
 	val &= ~PCI_ROM_ADDRESS_ENABLE;
 	pci_write_config_dword(dev, PCI_ROM_ADDRESS, val);



From gleixner at infradead.org  Fri May 20 12:30:36 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:51 2006
Subject: mtd/drivers/mtd/maps sa1100-flash.c,1.48,1.49
Message-ID: <E1DZAOS-00067d-VC@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv23525

Modified Files:
	sa1100-flash.c 
Log Message:
[PATCH] fix u32 vs. pm_message_t in drivers/mmc,mtd,scsi

This fixes u32 vs. pm_message_t in drivers/mmc, drivers/mtd and
drivers/scsi.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>



Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- sa1100-flash.c	18 Mar 2005 02:01:48 -0000	1.48
+++ sa1100-flash.c	20 May 2005 16:30:33 -0000	1.49
@@ -403,7 +403,7 @@
 }
 
 #ifdef CONFIG_PM
-static int sa1100_mtd_suspend(struct device *dev, u32 state, u32 level)
+static int sa1100_mtd_suspend(struct device *dev, pm_message_t state, u32 level)
 {
 	struct sa_info *info = dev_get_drvdata(dev);
 	int ret = 0;



From gleixner at infradead.org  Fri May 20 15:24:38 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/fs/jffs2 background.c,1.52,1.53
Message-ID: <E1DZD6s-0006FO-5j@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv24006

Modified Files:
	background.c 
Log Message:
Do not call wait_for_completion, when the gc task is not there. Prevent an oops when the gc thread was not started.

Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- background.c	19 May 2005 16:18:08 -0000	1.52
+++ background.c	20 May 2005 19:24:34 -0000	1.53
@@ -56,13 +56,16 @@
 
 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
 {
+	int wait = 0
 	spin_lock(&c->erase_completion_lock);
 	if (c->gc_task) {
 		D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid));
 		send_sig(SIGKILL, c->gc_task, 1);
+		wait = 1;
 	}
 	spin_unlock(&c->erase_completion_lock);
-	wait_for_completion(&c->gc_thread_exit);
+	if (wait)
+		wait_for_completion(&c->gc_thread_exit);
 }
 
 static int jffs2_garbage_collect_thread(void *_c)



From gleixner at infradead.org  Fri May 20 15:30:09 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/fs/jffs2 compr_zlib.c,1.30,1.31
Message-ID: <E1DZDCD-0006Fv-UZ@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv24039

Modified Files:
	compr_zlib.c 
Log Message:
Include sched.h instead of asm/semaphore.h to make it compile everywhere.

Index: compr_zlib.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/compr_zlib.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- compr_zlib.c	20 May 2005 15:39:54 -0000	1.30
+++ compr_zlib.c	20 May 2005 19:30:06 -0000	1.31
@@ -17,10 +17,10 @@
 
 #include <linux/config.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/zlib.h>
 #include <linux/zutil.h>
-#include <asm/semaphore.h>
 #include "nodelist.h"
 #include "compr.h"
 



From gleixner at infradead.org  Fri May 20 17:37:15 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/fs/jffs2 background.c,1.53,1.54
Message-ID: <E1DZFBD-0006bb-R9@phoenix.infradead.org>

Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv25383

Modified Files:
	background.c 
Log Message:
Adding a semicolon helps a lot. gcc is stupid and pedantic. It should know that I intended to put a semicolon there

Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- background.c	20 May 2005 19:24:34 -0000	1.53
+++ background.c	20 May 2005 21:37:12 -0000	1.54
@@ -56,7 +56,7 @@
 
 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
 {
-	int wait = 0
+	int wait = 0;
 	spin_lock(&c->erase_completion_lock);
 	if (c->gc_task) {
 		D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid));



From gleixner at infradead.org  Sun May 22 17:11:46 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/scripts patchin.xml,1.4,1.5 treewalk.py,1.4,1.5
Message-ID: <E1DZxje-0004yE-Ay@phoenix.infradead.org>

Update of /home/cvs/mtd/scripts
In directory phoenix.infradead.org:/tmp/cvs-serv19093/scripts

Modified Files:
	patchin.xml treewalk.py 
Log Message:
Remove bk stuff and add some helpers for the gitify and patch monkey job

Index: patchin.xml
===================================================================
RCS file: /home/cvs/mtd/scripts/patchin.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- patchin.xml	14 Mar 2005 16:54:48 -0000	1.4
+++ patchin.xml	22 May 2005 21:11:43 -0000	1.5
@@ -99,25 +99,14 @@
 <PATCHROOT name="mtd">
 	<OPTION name="jffs2" help="Include JFFS2" />
 	<OPTION name="jffs3" help="Include JFFS3" />
-	<OPTION name="bk" help="Bitkeeper checkout" />
 	<OPTION name="cp" help="copy into target tree" />
 	<OPTION name="ln" help="link into target tree" />
 	<OPTION name="rm" help="remove the patched files" />
+	<OPTION name="diff" help="diff files against target tree" />
 
 	<CHECKTARGET file="Makefile" pattern="PATCHLEVEL.=.6" 
 		help="Linux-Kernel 2.6" />
 
-	<ACTION name="bk" depends="bk" except="rm">
-		cd $dstpath;
-		if [ -e "SCCS/s.$dstfiles" ];
-		then 
-			bk unedit -q $dstfiles; 
-			bk edit -q $dstfiles;
-		else
-			rm -f $dstfiles;
-		fi
-	</ACTION>
-
 	<ACTION name="cp" depends="cp" except="rm,ln">
 		rm -f $dstpath/$dstfiles;
 		cp -f $srcpath/$srcfiles $dstpath/$dstfiles
@@ -132,19 +121,27 @@
 		ln -s $srcpath/$srcfiles $dstpath/$dstfiles
 	</ACTION>
 
-	<ACTION name="mkdir" except="rm" mode="all">
+	<ACTION name="diff" depends="diff" except="rm,ln,cp">
+		diff -uN $dstpath/$dstfiles $srcpath/$srcfiles | sed -e s@$dstbase@linux@g -e s@$srcbase@linux@g >>$srcbase/mtd.diff;
+		if [ $? -eq 1 ];
+		then
+			exit 0;
+		fi
+	</ACTION>
+
+	<ACTION name="mkdir" except="rm,diff" mode="all">
 		mkdir -p $dstpath
 	</ACTION>
 
-	<ACTION name="modify" except="rm">
+	<ACTION name="modify" except="rm,diff">
 		scripts/modify.py -p $options $srcpath/$srcfiles $dstpath/$dstfiles
 	</ACTION>
 
-	<ACTION name="insert" except="rm">
+	<ACTION name="insert" except="rm,diff">
 		scripts/modify.py -i -p $options $srcpath/$srcfiles $dstpath/$dstfiles
 	</ACTION>
 
-	<ACTIONORDER order="bk,rm,cp,ln" />
+	<ACTIONORDER order="diff,rm,cp,ln" />
 
 	<SUBDIR name="Documentation/DocBook">
 		<UPDATE pattern=".*\.tmpl$" />
@@ -162,13 +159,13 @@
 	<SUBDIR name="include/linux/mtd">
 		<UPDATE pattern=".*\.h$" />
 	</SUBDIR>
-	<SUBDIR name="fs" actions="bk,modify">
+	<SUBDIR name="fs" actions="modify">
 		<UPDATE pattern="Kconfig" depends="jffs2" 
 			options="JFFS2,JFFS3,JFFS2,CRAMFS" />
 		<UPDATE pattern="Kconfig" depends="jffs3" 
 			options="JFFS3,CRAMFS,JFFS3,CRAMFS" />
 	</SUBDIR>
-	<SUBDIR name="fs" actions="bk,insert" depends="jffs3">
+	<SUBDIR name="fs" actions="insert" depends="jffs3">
 		<UPDATE pattern="Makefile.jffs3" target="Makefile"
 			depends="jffs3" options="JFFS3,JFFS3,JFFS2,JFFS2" />
 		<UPDATE pattern="Kconfig" depends="jffs3" 
@@ -192,6 +189,6 @@
 		<UPDATE pattern="Kconfig" />
 		<UPDATE pattern="Makefile.common" target="Makefile" />
 		<EXCLUDE pattern=".*24.c" />
-		<EXCLUDE pattern="ssfdc.c" depends="bk" />
+		<EXCLUDE pattern="ssfdc.c" depends="tolinus" />
 	</SUBDIR>
 </PATCHROOT>

Index: treewalk.py
===================================================================
RCS file: /home/cvs/mtd/scripts/treewalk.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- treewalk.py	15 Mar 2005 08:46:08 -0000	1.4
+++ treewalk.py	22 May 2005 21:11:43 -0000	1.5
@@ -141,6 +141,12 @@
 		cmd = "export srcpath=\'%s\';" %(srcpath)
 		cmd = cmd + "export dstpath=\'%s\';" %(dstpath)
 		cmd = cmd + "export options=\'%s\';" %(options)
+		cmd = cmd + "export srcbase=\'%s\';" %(srcbase)
+		cmd = cmd + "export dstbase=\'%s\';" %(dstbase)
+		relpath = os.path.join(srcpath.replace(srcbase,""))
+		cmd = cmd + "export srcrelpath=\'%s\';" %(relpath)
+		relpath = os.path.join(dstpath.replace(dstbase,""))
+		cmd = cmd + "export dstrelpath=\'%s\';" %(relpath)
 		# All files mode ?
 		if self.mode:
 			cmd = cmd + "export srcfiles=\'"



From dedekind at infradead.org  Mon May 23 04:50:49 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:52 2006
Subject: mtd/drivers/mtd/nand Kconfig,1.26,1.27 nandsim.c,1.8,1.9
Message-ID: <E1Da8e9-0005QW-Nj@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv20843/drivers/mtd/nand

Modified Files:
	Kconfig nandsim.c 
Log Message:
There are two bugs in nandsim. The first is in Kconfig. MTD_NAND_NANDSIM
is defined as a bool value, so it can have a value of 'y' or be
undefined. This way nandsim cannot be compiled as a module, it will
directly go into the kernel.
The second bug is in nandsim.c. Large page chips <=128M use 4 bytes for
addressing, not 5.
Signed-off-by: Patrik Kluba



Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Kconfig,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Kconfig	5 Jan 2005 12:42:24 -0000	1.26
+++ Kconfig	23 May 2005 08:50:46 -0000	1.27
@@ -197,11 +197,10 @@
  	depends on MTD_NAND	&& ARCH_PXA
  
  config MTD_NAND_NANDSIM
- 	bool "Support for NAND Flash Simulator"
- 	depends on MTD_NAND && MTD_PARTITIONS
-
+	tristate "Support for NAND Flash Simulator"
+	depends on m && MTD_NAND && MTD_PARTITIONS
 	help
 	  The simulator may simulate verious NAND flash chips for the
 	  MTD nand layer.
- 
+
 endmenu

Index: nandsim.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nandsim.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- nandsim.c	19 Mar 2005 15:33:56 -0000	1.8
+++ nandsim.c	23 May 2005 08:50:46 -0000	1.9
@@ -165,7 +165,7 @@
 /* After a command is input, the simulator goes to one of the following states */
 #define STATE_CMD_READ0        0x00000001 /* read data from the beginning of page */
 #define STATE_CMD_READ1        0x00000002 /* read data from the second half of page */
-#define STATE_CMD_READSTART      0x00000003 /* read data second command (large page devices) */
+#define STATE_CMD_READSTART    0x00000003 /* read data second command (large page devices) */
 #define STATE_CMD_PAGEPROG     0x00000004 /* start page programm */
 #define STATE_CMD_READOOB      0x00000005 /* read OOB area */
 #define STATE_CMD_ERASE1       0x00000006 /* sector erase first command */
@@ -406,7 +406,7 @@
 		}
 	} else {
 		if (ns->geom.totsz <= (128 << 20)) {
-			ns->geom.pgaddrbytes  = 5;
+			ns->geom.pgaddrbytes  = 4;
 			ns->geom.secaddrbytes = 2;
 		} else {
 			ns->geom.pgaddrbytes  = 5;



From dedekind at infradead.org  Mon May 23 06:12:13 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:52 2006
Subject: mtd/drivers/mtd/nand Kconfig,1.27,1.28 nandsim.c,1.9,1.10
Message-ID: <E1Da9uu-0005U1-SA@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv21066/drivers/mtd/nand

Modified Files:
	Kconfig nandsim.c 
Log Message:
Nandsim uses several module parameters for specifying what chip to
simulate. Some default values are in the source itself. It's much
convenient to have them in Kconfig so you don't need to specify module
parameters every time you load it.
Signed-off-by: Patrik Kluba, <pajko@kukac.halom.u-szeged.hu>


Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Kconfig,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Kconfig	23 May 2005 08:50:46 -0000	1.27
+++ Kconfig	23 May 2005 10:12:10 -0000	1.28
@@ -192,15 +192,90 @@
 	  load time (assuming you build diskonchip as a module) with the module
 	  parameter "inftl_bbt_write=1".
 	  
- config MTD_NAND_SHARPSL
+config MTD_NAND_SHARPSL
  	bool "Support for NAND Flash on Sharp SL Series (C7xx + others)"
  	depends on MTD_NAND	&& ARCH_PXA
  
- config MTD_NAND_NANDSIM
+config MTD_NAND_NANDSIM
 	tristate "Support for NAND Flash Simulator"
 	depends on m && MTD_NAND && MTD_PARTITIONS
 	help
 	  The simulator may simulate verious NAND flash chips for the
 	  MTD nand layer.
 
+config MTD_NAND_NANDSIM_FIRST_ID
+	hex "First ID byte"
+	range 0x00 0xff
+	default 0x98
+	depends on MTD_NAND_NANDSIM
+	help 
+     	  The fist byte returned by NAND Flash 'read ID' command (manufaturer ID).
+
+config MTD_NAND_NANDSIM_SECOND_ID
+	hex "Second ID byte"
+	range 0x00 0xff
+	default 0x39
+	depends on MTD_NAND_NANDSIM
+	help
+	  The second byte returned by NAND Flash 'read ID' command (chip ID).
+
+config MTD_NAND_NANDSIM_THIRD_ID
+	hex "Third ID byte"
+	range 0x00 0xff
+	default 0xff
+	depends on MTD_NAND_NANDSIM
+	help
+	  The third byte returned by NAND Flash 'read ID' command.
+
+config MTD_NAND_NANDSIM_FOURTH_ID
+	hex "Fourth ID byte"
+	range 0x00 0xff
+	default 0xff
+	depends on MTD_NAND_NANDSIM
+	help
+	  The fourth byte returned by NAND Flash 'read ID' command.
+
+config MTD_NAND_NANDSIM_DEBUG
+	bool "NAND Simulator debugging"
+	depends on MTD_NAND_NANDSIM
+	help
+	  Only helful for tracking problems.
+
+config MTD_NAND_NANDSIM_LOG
+        bool "NAND Simulator logging"
+	depends on MTD_NAND_NANDSIM
+	help
+	   Logs the track of NAND read/write/erase commands.
+
+config MTD_NAND_NANDSIM_DELAY
+	bool "Emulate NAND chip delays using busy-wait cycles"
+	default n
+	depends on MTD_NAND_NANDSIM
+
+config MTD_NAND_NANDSIM_ACCESS_DELAY
+	int "Access delay (microiseconds)"
+	default 25
+	depends on MTD_NAND_NANDSIM_DELAY
+
+config MTD_NAND_NANDSIM_PROGRAM_DELAY
+	int "Program delay (microseconds)"
+	default 200
+	depends on MTD_NAND_NANDSIM_DELAY
+
+config MTD_NAND_NANDSIM_ERASE_DELAY
+	int "Erase delay (milliseconds)"
+	default 2
+	depends on MTD_NAND_NANDSIM_DELAY
+
+config MTD_NAND_NANDSIM_OUTPUT_CYCLE
+	int "Word output (from flash) cicle time (nanodeconds)"
+	default 40
+	depends on MTD_NAND_NANDSIM_DELAY
+	 
+
+config MTD_NAND_NANDSIM_INPUT_CYCLE
+	int "Word input (to flash) time (nanodeconds)"
+	default 50
+	depends on MTD_NAND_NANDSIM_DELAY
+	
 endmenu

Index: nandsim.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nandsim.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- nandsim.c	23 May 2005 08:50:46 -0000	1.9
+++ nandsim.c	23 May 2005 10:12:10 -0000	1.10
@@ -38,63 +38,76 @@
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/delay.h>
+
 #ifdef CONFIG_NS_ABS_POS
 #include <asm/io.h>
 #endif
 
+#define CONFIG_NANDSIM_FIRST_ID_BYTE        CONFIG_MTD_NAND_NANDSIM_FIRST_ID
+#define CONFIG_NANDSIM_SECOND_ID_BYTE       CONFIG_MTD_NAND_NANDSIM_SECOND_ID
+#define CONFIG_NANDSIM_THIRD_ID_BYTE        CONFIG_MTD_NAND_NANDSIM_THIRD_ID
+#define CONFIG_NANDSIM_FOURTH_ID_BYTE       CONFIG_MTD_NAND_NANDSIM_FOURTH_ID
 
-/* Default simulator parameters values */
-#if !defined(CONFIG_NANDSIM_FIRST_ID_BYTE)  || \
-    !defined(CONFIG_NANDSIM_SECOND_ID_BYTE) || \
-    !defined(CONFIG_NANDSIM_THIRD_ID_BYTE)  || \
-    !defined(CONFIG_NANDSIM_FOURTH_ID_BYTE)
-#define CONFIG_NANDSIM_FIRST_ID_BYTE  0x98
-#define CONFIG_NANDSIM_SECOND_ID_BYTE 0x39
-#define CONFIG_NANDSIM_THIRD_ID_BYTE  0xFF /* No byte */
-#define CONFIG_NANDSIM_FOURTH_ID_BYTE 0xFF /* No byte */
+#ifndef CONFIG_MTD_NAND_NANDSIM_ACCESS_DELAY
+#  define CONFIG_MTD_NAND_NANDSIM_ACCESS_DELAY   25
 #endif
 
-#ifndef CONFIG_NANDSIM_ACCESS_DELAY
-#define CONFIG_NANDSIM_ACCESS_DELAY 25
-#endif
-#ifndef CONFIG_NANDSIM_PROGRAMM_DELAY
-#define CONFIG_NANDSIM_PROGRAMM_DELAY 200
+#ifndef CONFIG_MTD_NAND_NANDSIM_PROGRAM_DELAY
+#  define CONFIG_MTD_NAND_NANDSIM_PROGRAM_DELAY  200
 #endif
-#ifndef CONFIG_NANDSIM_ERASE_DELAY
-#define CONFIG_NANDSIM_ERASE_DELAY 2
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_ERASE_DELAY
+#  define CONFIG_MTD_NAND_NANDSIM_ERASE_DELAY    2
 #endif
-#ifndef CONFIG_NANDSIM_OUTPUT_CYCLE
-#define CONFIG_NANDSIM_OUTPUT_CYCLE 40
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_OUTPUT_CYCLE
+#  define CONFIG_MTD_NAND_NANDSIM_OUTPUT_CYCLE   40
 #endif
-#ifndef CONFIG_NANDSIM_INPUT_CYCLE
-#define CONFIG_NANDSIM_INPUT_CYCLE  50
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_INPUT_CYCLE
+#  define CONFIG_MTD_NAND_NANDSIM_INPUT_CYCLE    50
 #endif
-#ifndef CONFIG_NANDSIM_BUS_WIDTH
-#define CONFIG_NANDSIM_BUS_WIDTH  8
+
+#ifdef CONFIG_MTD_NAND_NANDSIM_16BIT_BUS
+#  define CONFIG_NANDSIM_BUS_WIDTH      16
+#else
+#  define CONFIG_NANDSIM_BUS_WIDTH      8
 #endif
-#ifndef CONFIG_NANDSIM_DO_DELAYS
-#define CONFIG_NANDSIM_DO_DELAYS  0
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_DELAY
+#  define CONFIG_MTD_NAND_NANDSIM_DELAY 0
+#else
+#  undef CONFIG_MTD_NAND_NANDSIM_DELAY
+#  define CONFIG_MTD_NAND_NANDSIM_DELAY 1
 #endif
-#ifndef CONFIG_NANDSIM_LOG
-#define CONFIG_NANDSIM_LOG        0
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_LOG
+#  define CONFIG_MTD_NAND_NANDSIM_LOG   0
+#else
+#  undef CONFIG_MTD_NAND_NANDSIM_LOG
+#  define CONFIG_MTD_NAND_NANDSIM_LOG   1
 #endif
-#ifndef CONFIG_NANDSIM_DBG
-#define CONFIG_NANDSIM_DBG        0
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_DEBUG
+#  define CONFIG_MTD_NAND_NANDSIM_DEBUG 0
+#else
+#  undef CONFIG_MTD_NAND_NANDSIM_DEBUG
+#  define CONFIG_MTD_NAND_NANDSIM_DEBUG 1
 #endif
 
 static uint first_id_byte  = CONFIG_NANDSIM_FIRST_ID_BYTE;
 static uint second_id_byte = CONFIG_NANDSIM_SECOND_ID_BYTE;
 static uint third_id_byte  = CONFIG_NANDSIM_THIRD_ID_BYTE;
 static uint fourth_id_byte = CONFIG_NANDSIM_FOURTH_ID_BYTE;
-static uint access_delay   = CONFIG_NANDSIM_ACCESS_DELAY;
-static uint programm_delay = CONFIG_NANDSIM_PROGRAMM_DELAY;
-static uint erase_delay    = CONFIG_NANDSIM_ERASE_DELAY;
-static uint output_cycle   = CONFIG_NANDSIM_OUTPUT_CYCLE;
-static uint input_cycle    = CONFIG_NANDSIM_INPUT_CYCLE;
+static uint access_delay   = CONFIG_MTD_NAND_NANDSIM_ACCESS_DELAY;
+static uint programm_delay = CONFIG_MTD_NAND_NANDSIM_PROGRAM_DELAY;
+static uint erase_delay    = CONFIG_MTD_NAND_NANDSIM_ERASE_DELAY;
+static uint output_cycle   = CONFIG_MTD_NAND_NANDSIM_OUTPUT_CYCLE;
+static uint input_cycle    = CONFIG_MTD_NAND_NANDSIM_INPUT_CYCLE;
 static uint bus_width      = CONFIG_NANDSIM_BUS_WIDTH;
-static uint do_delays      = CONFIG_NANDSIM_DO_DELAYS;
-static uint log            = CONFIG_NANDSIM_LOG;
-static uint dbg            = CONFIG_NANDSIM_DBG;
+static uint do_delays      = CONFIG_MTD_NAND_NANDSIM_DELAY;
+static uint log            = CONFIG_MTD_NAND_NANDSIM_LOG;
+static uint dbg            = CONFIG_MTD_NAND_NANDSIM_DEBUG;
 
 module_param(first_id_byte,  uint, 0400);
 module_param(second_id_byte, uint, 0400);



From dedekind at infradead.org  Mon May 23 08:51:07 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:52 2006
Subject: mtd/drivers/mtd/nand Kconfig,1.28,1.29 nandsim.c,1.10,1.11
Message-ID: <E1DaCOh-0005ZY-Hl@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv21412

Modified Files:
	Kconfig nandsim.c 
Log Message:
s/nanodeconds/nanoseconds/


Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Kconfig,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- Kconfig	23 May 2005 10:12:10 -0000	1.28
+++ Kconfig	23 May 2005 12:51:04 -0000	1.29
@@ -268,13 +268,13 @@
 	depends on MTD_NAND_NANDSIM_DELAY
 
 config MTD_NAND_NANDSIM_OUTPUT_CYCLE
-	int "Word output (from flash) cicle time (nanodeconds)"
+	int "Word output (from flash) cicle time (nanoseconds)"
 	default 40
 	depends on MTD_NAND_NANDSIM_DELAY
 	 
 
 config MTD_NAND_NANDSIM_INPUT_CYCLE
-	int "Word input (to flash) time (nanodeconds)"
+	int "Word input (to flash) time (nanoseconds)"
 	default 50
 	depends on MTD_NAND_NANDSIM_DELAY
 	

Index: nandsim.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nandsim.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- nandsim.c	23 May 2005 10:12:10 -0000	1.10
+++ nandsim.c	23 May 2005 12:51:04 -0000	1.11
@@ -130,8 +130,8 @@
 MODULE_PARM_DESC(access_delay,   "Initial page access delay (microiseconds)");
 MODULE_PARM_DESC(programm_delay, "Page programm delay (microseconds");
 MODULE_PARM_DESC(erase_delay,    "Sector erase delay (milliseconds)");
-MODULE_PARM_DESC(output_cycle,   "Word output (from flash) time (nanodeconds)");
-MODULE_PARM_DESC(input_cycle,    "Word input (to flash) time (nanodeconds)");
+MODULE_PARM_DESC(output_cycle,   "Word output (from flash) time (nanoseconds)");
+MODULE_PARM_DESC(input_cycle,    "Word input (to flash) time (nanoseconds)");
 MODULE_PARM_DESC(bus_width,      "Chip's bus width (8- or 16-bit)");
 MODULE_PARM_DESC(do_delays,      "Simulate NAND delays using busy-waits if not zero");
 MODULE_PARM_DESC(log,            "Perform logging if not zero");



From dedekind at infradead.org  Mon May 23 08:59:43 2005
From: dedekind at infradead.org (Artem Bityuckiy)
Date: Mon May 15 21:51:52 2006
Subject: mtd/drivers/mtd/nand Kconfig,1.29,1.30
Message-ID: <E1DaCX1-0005aB-EM@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv21451

Modified Files:
	Kconfig 
Log Message:
Fix parameter comments.


Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/Kconfig,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Kconfig	23 May 2005 12:51:04 -0000	1.29
+++ Kconfig	23 May 2005 12:59:40 -0000	1.30
@@ -268,14 +268,17 @@
 	depends on MTD_NAND_NANDSIM_DELAY
 
 config MTD_NAND_NANDSIM_OUTPUT_CYCLE
-	int "Word output (from flash) cicle time (nanoseconds)"
+	int "Word output (from flash) time (nanoseconds)"
 	default 40
 	depends on MTD_NAND_NANDSIM_DELAY
-	 
+	help
+	  For 16 bit devices word is 2 bytes, for 8 bit devices - 1 byte
 
 config MTD_NAND_NANDSIM_INPUT_CYCLE
 	int "Word input (to flash) time (nanoseconds)"
 	default 50
 	depends on MTD_NAND_NANDSIM_DELAY
+	help
+	  For 16 bit devices word is 2 bytes, for 8 bit devices - 1 byte
 	
 endmenu



From gleixner at infradead.org  Tue May 24 09:29:46 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/drivers/mtd/chips cfi_cmdset_0002.c,1.115,1.116
Message-ID: <E1DaZTe-0006Rf-2X@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv24767

Modified Files:
	cfi_cmdset_0002.c 
Log Message:
[MTD] cfi_cmdset_0002: Fix broken status check

Index: cfi_cmdset_0002.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/cfi_cmdset_0002.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- cfi_cmdset_0002.c	20 May 2005 03:28:23 -0000	1.115
+++ cfi_cmdset_0002.c	24 May 2005 13:29:42 -0000	1.116
@@ -1320,7 +1320,7 @@
 		cfi_spin_lock(chip->mutex);
 	}
 	/* Did we succeed? */
-	if (chip_good(map, adr, map_word_ff(map))) {
+	if (!chip_good(map, adr, map_word_ff(map))) {
 		/* reset on all failures. */
 		map_write( map, CMD(0xF0), chip->start );
 		/* FIXME - should have reset delay before continuing */



From gleixner at infradead.org  Tue May 24 14:45:18 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/include/linux/mtd map.h,1.48,1.49
Message-ID: <E1DaeP0-0006bV-2r@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv25374

Modified Files:
	map.h 
Log Message:
Make map_word_ff ware of the flash buswidth

map_word_ff() was setting the mapword to ~0UL regardless of the
buswidth of the mapped flash chip. The read_map functions are
buswidth aware and therefor the map_word_equal function failed.



Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- map.h	16 Feb 2005 15:54:59 -0000	1.48
+++ map.h	24 May 2005 18:45:15 -0000	1.49
@@ -340,13 +340,22 @@
 	return orig;
 }
 
+#if BITS_PER_LONG < 64
+#define MAP_FF_LIMIT 4
+#else
+#define MAP_FF_LIMIT 8
+#endif
+
 static inline map_word map_word_ff(struct map_info *map)
 {
 	map_word r;
 	int i;
-
-	for (i=0; i<map_words(map); i++) {
-		r.x[i] = ~0UL;
+	
+	if (map_bank_width(map) < MAP_FF_LIMIT) {
+		r.x[0] = (1 << (8*map_bank_width(map))) - 1;
+	} else {
+		for (i=0; i<map_words(map); i++)
+			r.x[i] = ~0UL;
 	}
 	return r;
 }



From dwmw2 at infradead.org  Wed May 25 05:53:21 2005
From: dwmw2 at infradead.org (David Woodhouse)
Date: Mon May 15 21:51:52 2006
Subject: mtd/include/linux/mtd map.h,1.49,1.50
Message-ID: <E1DasZl-0007CE-4D@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27643

Modified Files:
	map.h 
Log Message:
s/map_bank_width/map_bankwidth/


Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- map.h	24 May 2005 18:45:15 -0000	1.49
+++ map.h	25 May 2005 09:53:17 -0000	1.50
@@ -351,8 +351,8 @@
 	map_word r;
 	int i;
 	
-	if (map_bank_width(map) < MAP_FF_LIMIT) {
-		r.x[0] = (1 << (8*map_bank_width(map))) - 1;
+	if (map_bankwidth(map) < MAP_FF_LIMIT) {
+		r.x[0] = (1 << (8*map_bankwidth(map))) - 1;
 	} else {
 		for (i=0; i<map_words(map); i++)
 			r.x[i] = ~0UL;



From gleixner at infradead.org  Wed May 25 06:15:32 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/include/linux/mtd map.h,1.50,1.51
Message-ID: <E1DasvE-0007ED-NK@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27777

Modified Files:
	map.h 
Log Message:
Fix a compiler warning

Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- map.h	25 May 2005 09:53:17 -0000	1.50
+++ map.h	25 May 2005 10:15:29 -0000	1.51
@@ -352,7 +352,8 @@
 	int i;
 	
 	if (map_bankwidth(map) < MAP_FF_LIMIT) {
-		r.x[0] = (1 << (8*map_bankwidth(map))) - 1;
+		int bw = 8 * map_bankwidth;
+		r.x[0] = (1 << bw) - 1;
 	} else {
 		for (i=0; i<map_words(map); i++)
 			r.x[i] = ~0UL;



From gleixner at infradead.org  Wed May 25 06:29:45 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:52 2006
Subject: mtd/include/linux/mtd map.h,1.51,1.52
Message-ID: <E1Dat8z-0007Eq-2P@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv27816

Modified Files:
	map.h 
Log Message:
tglx hides

Index: map.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/map.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- map.h	25 May 2005 10:15:29 -0000	1.51
+++ map.h	25 May 2005 10:29:41 -0000	1.52
@@ -352,7 +352,7 @@
 	int i;
 	
 	if (map_bankwidth(map) < MAP_FF_LIMIT) {
-		int bw = 8 * map_bankwidth;
+		int bw = 8 * map_bankwidth(map);
 		r.x[0] = (1 << bw) - 1;
 	} else {
 		for (i=0; i<map_words(map); i++)



From gleixner at infradead.org  Fri May 27 04:31:36 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:53 2006
Subject: mtd/include/linux/mtd nand.h,1.71,1.72
Message-ID: <E1DbaFk-0000Sn-Mb@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv1771/include/linux/mtd

Modified Files:
	nand.h 
Log Message:
Add Hynix to the NAND manufacturer list. Patch by Nicolas S. Dade \<daden@symbol.com\>

Index: nand.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/nand.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- nand.h	9 Feb 2005 12:12:59 -0000	1.71
+++ nand.h	27 May 2005 08:31:33 -0000	1.72
@@ -384,6 +384,7 @@
 #define NAND_MFR_NATIONAL	0x8f
 #define NAND_MFR_RENESAS	0x07
 #define NAND_MFR_STMICRO	0x20
+#define NAND_MFR_HYNIX          0xad
 
 /**
  * struct nand_flash_dev - NAND Flash Device ID Structure



From gleixner at infradead.org  Fri May 27 04:31:37 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:53 2006
Subject: mtd/drivers/mtd/nand nand_ids.c,1.12,1.13
Message-ID: <E1DbaFl-0000Sr-7L@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv1771/drivers/mtd/nand

Modified Files:
	nand_ids.c 
Log Message:
Add Hynix to the NAND manufacturer list. Patch by Nicolas S. Dade \<daden@symbol.com\>

Index: nand_ids.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_ids.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- nand_ids.c	16 Feb 2005 09:33:27 -0000	1.12
+++ nand_ids.c	27 May 2005 08:31:34 -0000	1.13
@@ -116,6 +116,7 @@
 	{NAND_MFR_NATIONAL, "National"},
 	{NAND_MFR_RENESAS, "Renesas"},
 	{NAND_MFR_STMICRO, "ST Micro"},
+        {NAND_MFR_HYNIX, "Hynix"},
 	{0x0, "Unknown"}
 };
 



From gleixner at infradead.org  Tue May 31 11:47:35 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:53 2006
Subject: mtd/util nandwrite.c,1.30,1.31
Message-ID: <E1Dd8xr-0008JR-2e@phoenix.infradead.org>

Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv31945

Modified Files:
	nandwrite.c 
Log Message:
Add missing short options. Pointed out by Peter Grayson <pgrayson@realmsys.com>

Index: nandwrite.c
===================================================================
RCS file: /home/cvs/mtd/util/nandwrite.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- nandwrite.c	7 Apr 2005 14:17:46 -0000	1.30
+++ nandwrite.c	31 May 2005 15:47:31 -0000	1.31
@@ -124,20 +124,20 @@
 
 	for (;;) {
 		int option_index = 0;
-		static const char *short_options = "os:ajynqp";
+		static const char *short_options = "ab:fjnopqs:y";
 		static const struct option long_options[] = {
 			{"help", no_argument, 0, 0},
 			{"version", no_argument, 0, 0},
-			{"oob", no_argument, 0, 'o'},
-			{"start", required_argument, 0, 's'},
 			{"autoplace", no_argument, 0, 'a'},
-			{"jffs2", no_argument, 0, 'j'},
-			{"yaffs", no_argument, 0, 'y'},
+		   	{"blockalign", required_argument, 0, 'b'},
 			{"forcelegacy", no_argument, 0, 'f'},
+			{"jffs2", no_argument, 0, 'j'},
 			{"noecc", no_argument, 0, 'n'},
-			{"quiet", no_argument, 0, 'q'},
+			{"oob", no_argument, 0, 'o'},
 			{"pad", no_argument, 0, 'p'},
-		   	{"blockalign", required_argument, 0, 'b'},
+			{"quiet", no_argument, 0, 'q'},
+			{"start", required_argument, 0, 's'},
+			{"yaffs", no_argument, 0, 'y'},
 			{0, 0, 0, 0},
 		};
 



From gleixner at infradead.org  Tue May 31 15:39:19 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:53 2006
Subject: mtd/drivers/mtd/nand nand_base.c,1.143,1.144
Message-ID: <E1DdCa7-0008S2-VB@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv32473/drivers/mtd/nand

Modified Files:
	nand_base.c 
Log Message:
[MTD] NAND: Reorganize chip locking

The code was wrong in several aspects. The locking order was
inconsistent, the device aquire code did not reset a variable
after a wakeup and the wakeup handling was not working for
applications where multiple chips are sharing a single
hardware controller.
When a hardware controller is available the locking is now
reduced to the hardware controller lock and the waitqueue is
moved to the hardware controller structure in order to avoid
a wake_up_all().

The problem was pointed out by Ben Dooks, who also found the
missing variable reset as main cause for his deadlock problem.



Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- nand_base.c	19 May 2005 16:10:22 -0000	1.143
+++ nand_base.c	31 May 2005 19:39:16 -0000	1.144
@@ -167,17 +167,21 @@
 
 	/* De-select the NAND device */
 	this->select_chip(mtd, -1);
-	/* Do we have a hardware controller ? */
+
 	if (this->controller) {
+		/* Release the controller and the chip */
 		spin_lock(&this->controller->lock);
 		this->controller->active = NULL;
+		this->state = FL_READY;
+		wake_up(&this->controller->wq);
 		spin_unlock(&this->controller->lock);
+	} else {
+		/* Release the chip */
+		spin_lock(&this->chip_lock);
+		this->state = FL_READY;
+		wake_up(&this->wq);
+		spin_unlock(&this->chip_lock);
 	}
-	/* Release the chip */
-	spin_lock (&this->chip_lock);
-	this->state = FL_READY;
-	wake_up (&this->wq);
-	spin_unlock (&this->chip_lock);
 }
 
 /**
@@ -753,37 +757,34 @@
  */
 static void nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int new_state)
 {
-	struct nand_chip *active = this;
-
+	struct nand_chip *active;
+	spinlock_t *lock;
+	wait_queue_head_t *wq;
 	DECLARE_WAITQUEUE (wait, current);
 
-	/* 
-	 * Grab the lock and see if the device is available 
-	*/
+	lock = (this->controller) ? &this->controller->lock : &this->lock;
+	wq = (this->controller) ? &this->controller->wq : &this->wq;
 retry:
+	active = this;
+	spin_lock(lock);
+
 	/* Hardware controller shared among independend devices */
 	if (this->controller) {
-		spin_lock (&this->controller->lock);
 		if (this->controller->active)
 			active = this->controller->active;
 		else
 			this->controller->active = this;
-		spin_unlock (&this->controller->lock);
 	}
-	
-	if (active == this) {
-		spin_lock (&this->chip_lock);
-		if (this->state == FL_READY) {
-			this->state = new_state;
-			spin_unlock (&this->chip_lock);
-			return;
-		}
-	}	
-	set_current_state (TASK_UNINTERRUPTIBLE);
-	add_wait_queue (&active->wq, &wait);
-	spin_unlock (&active->chip_lock);
-	schedule ();
-	remove_wait_queue (&active->wq, &wait);
+	if (active == this && this->state == FL_READY) {
+		this->state = new_state;
+		spin_unlock(lock);
+		return;
+	}
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	add_wait_queue(wq, &wait);
+	spin_unlock(lock);
+	schedule();
+	remove_wait_queue(wq, &wait);
 	goto retry;
 }
 



From gleixner at infradead.org  Tue May 31 15:39:20 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:53 2006
Subject: mtd/include/linux/mtd nand.h,1.72,1.73
Message-ID: <E1DdCa8-0008S6-Ir@phoenix.infradead.org>

Update of /home/cvs/mtd/include/linux/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv32473/include/linux/mtd

Modified Files:
	nand.h 
Log Message:
[MTD] NAND: Reorganize chip locking

The code was wrong in several aspects. The locking order was
inconsistent, the device aquire code did not reset a variable
after a wakeup and the wakeup handling was not working for
applications where multiple chips are sharing a single
hardware controller.
When a hardware controller is available the locking is now
reduced to the hardware controller lock and the waitqueue is
moved to the hardware controller structure in order to avoid
a wake_up_all().

The problem was pointed out by Ben Dooks, who also found the
missing variable reset as main cause for his deadlock problem.



Index: nand.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/mtd/nand.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- nand.h	27 May 2005 08:31:33 -0000	1.72
+++ nand.h	31 May 2005 19:39:17 -0000	1.73
@@ -253,10 +253,13 @@
  * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices
  * @lock:               protection lock  
  * @active:		the mtd device which holds the controller currently
+ * @wq:			wait queue to sleep on if a NAND operation is in progress
+ *                      used instead of the per chip wait queue when a hw controller is available
  */
 struct nand_hw_control {
 	spinlock_t	 lock;
 	struct nand_chip *active;
+	wait_queue_head_t wq;
 };
 
 /**



From gleixner at infradead.org  Tue May 31 16:32:56 2005
From: gleixner at infradead.org (gleixner@infradead.org)
Date: Mon May 15 21:51:53 2006
Subject: mtd/drivers/mtd/nand nand_base.c,1.144,1.145
Message-ID: <E1DdDQ0-0008U8-Al@phoenix.infradead.org>

Update of /home/cvs/mtd/drivers/mtd/nand
In directory phoenix.infradead.org:/tmp/cvs-serv32608

Modified Files:
	nand_base.c 
Log Message:
Grmbl

Index: nand_base.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- nand_base.c	31 May 2005 19:39:16 -0000	1.144
+++ nand_base.c	31 May 2005 20:32:53 -0000	1.145
@@ -762,7 +762,7 @@
 	wait_queue_head_t *wq;
 	DECLARE_WAITQUEUE (wait, current);
 
-	lock = (this->controller) ? &this->controller->lock : &this->lock;
+	lock = (this->controller) ? &this->controller->lock : &this->chip_lock;
 	wq = (this->controller) ? &this->controller->wq : &this->wq;
 retry:
 	active = this;



