⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1009.mtd.patch

📁 sm86xx内核源包括补丁( GPL )的
💻 PATCH
📖 第 1 页 / 共 3 页
字号:
+		}+	}++	/* Write buffer is worth it only if more than one word to write... */+	while(len > CFIDEV_BUSWIDTH) {+		/* We must not cross write block boundaries */+		int size = wbufsize - (ofs & (wbufsize-1));++		if (size > len)+			size = len & ~(CFIDEV_BUSWIDTH-1);+		ret = do_write_buffer(map, &cfi->chips[chipnum], +				      ofs, buf, size);+		if (ret)+			return ret;++		ofs += size;+		buf += size;+		(*retlen) += size;+		len -= size;++		if (ofs >> cfi->chipshift) {+			chipnum ++; +			ofs = 0;+			if (chipnum == cfi->numchips)+				return 0;+		}+	}++	/* ... and write the remaining bytes */+	if (len > 0) {+		size_t local_retlen;+		ret = cfi_amdstd_write_words(mtd, ofs + (chipnum << cfi->chipshift),+					     len, &local_retlen, buf);+		if (ret)+			return ret;+		(*retlen) += local_retlen;+	}++	return 0;+}+ static inline int do_erase_chip(struct map_info *map, struct flchip *chip) { 	unsigned int oldstatus, status;@@ -718,6 +965,11 @@ 	unsigned int adr; 	struct cfi_private *cfi = map->fldrv_priv; 	DECLARE_WAITQUEUE(wait, current);+#ifdef CONFIG_TANGO2+	unsigned int newv;+	const unsigned int oldv = 0xffffffff;+	unsigned int mask = ((cfi_buswidth_is_2()) ? 0xffff : 0xff);+#endif   retry: 	cfi_spin_lock(chip->mutex);@@ -751,7 +1003,16 @@ 	cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X8, NULL); 	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, CFI_DEVICETYPE_X8, NULL); 	cfi_send_gen_cmd(0x10, cfi->addr_unlock1, chip->start, map, cfi, CFI_DEVICETYPE_X8, NULL);-	timeo = jiffies + (HZ*20);++	if ((cfi->cfiq->ChipEraseTimeoutTyp == 0) || (cfi->cfiq->ChipEraseTimeoutMax == 0)) {+		int j, nblks;+		for (j = nblks = 0; j < cfi->cfiq->NumEraseRegions; j++) +			nblks += (cfi->cfiq->EraseRegionInfo[j] & 0xffff) + 1;+		timeo = jiffies + ((nblks * cfi->cfiq->BlockEraseTimeoutMax * HZ) / 1000) + 1;+	} else {+		timeo = jiffies + (((cfi->cfiq->ChipEraseTimeoutTyp << cfi->cfiq->ChipEraseTimeoutMax) * HZ) / 1000) + 1; +	}+ 	adr = cfi->addr_unlock1;  	/* Wait for the end of programing/erasure by using the toggle method.@@ -766,13 +1027,21 @@ 	dq6 = CMD(1<<6); 	dq5 = CMD(1<<5); -	oldstatus = cfi_read(map, adr);-	status = cfi_read(map, adr);-	while( ((status & dq6) != (oldstatus & dq6)) && -		((status & dq5) != dq5) &&-		!time_after(jiffies, timeo)) {+	do { 		int wait_reps; +		oldstatus = cfi_read(map, adr);+		status = cfi_read(map, adr);+#ifdef CONFIG_TANGO2+		newv = *(volatile unsigned int *)map->map_priv_1;+		if ((oldv & mask) == (newv & mask)) {+#endif+			if (!(((status & dq6) != (oldstatus & dq6)) && ((status & dq5) != dq5)))+				break;+#ifdef CONFIG_TANGO2+		}+#endif+ 		/* an initial short sleep */ 		cfi_spin_unlock(chip->mutex); 		schedule_timeout(HZ/100);@@ -813,9 +1082,8 @@ 			oldstatus = cfi_read(map, adr); 			status = cfi_read(map, adr); 		}-		oldstatus = cfi_read(map, adr);-		status = cfi_read(map, adr);-	}+	} while( !time_after(jiffies, timeo) );+ 	if ((status & dq6) != (oldstatus & dq6)) { 		/* The erasing didn't stop?? */ 		if ((status & dq5) == dq5) {@@ -844,6 +1112,10 @@ 	unsigned long timeo = jiffies + HZ; 	struct cfi_private *cfi = map->fldrv_priv; 	DECLARE_WAITQUEUE(wait, current);+#ifdef CONFIG_TANGO2+	unsigned int oldv, newv;+	unsigned int mask = ((cfi_buswidth_is_2()) ? 0xffff : 0xff);+#endif   retry: 	cfi_spin_lock(chip->mutex);@@ -866,6 +1138,12 @@ 	}	  	chip->state = FL_ERASING;+#ifdef CONFIG_TANGO2+	if (adr == 0)+		oldv = 0xffffffff;+	else+		oldv = *(volatile unsigned int *)map->map_priv_1;+#endif  	adr += chip->start; 	ENABLE_VPP(map);@@ -876,7 +1154,9 @@ 	cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, CFI_DEVICETYPE_X8, NULL); 	cfi_write(map, CMD(0x30), adr); 	-	timeo = jiffies + (HZ*20);+	timeo = jiffies + ((((chip->erase_time << cfi->cfiq->BlockEraseTimeoutMax) * HZ) / 1000) == 0 ? +			(HZ*20) :+			(((chip->erase_time << cfi->cfiq->BlockEraseTimeoutMax) * HZ) / 1000) + 1);   	/* Wait for the end of programing/erasure by using the toggle method. 	 * As long as there is a programming procedure going on, bit 6 of the last@@ -890,13 +1170,20 @@ 	dq6 = CMD(1<<6); 	dq5 = CMD(1<<5); -	oldstatus = cfi_read(map, adr);-	status = cfi_read(map, adr);-	while( ((status & dq6) != (oldstatus & dq6)) && -		((status & dq5) != dq5) &&-		!time_after(jiffies, timeo)) {+	do { 		int wait_reps; +		oldstatus = cfi_read(map, adr);+		status = cfi_read(map, adr);+#ifdef CONFIG_TANGO2+		newv = *(volatile unsigned int *)map->map_priv_1;+		if ((oldv & mask) == (newv & mask)) {+#endif+			if (!(((status & dq6) != (oldstatus & dq6)) && ((status & dq5) != dq5))) +				break;+#ifdef CONFIG_TANGO2+		}+#endif 		/* an initial short sleep */ 		cfi_spin_unlock(chip->mutex); 		schedule_timeout(HZ/100);@@ -937,9 +1224,8 @@ 			oldstatus = cfi_read(map, adr); 			status = cfi_read(map, adr); 		}-		oldstatus = cfi_read(map, adr);-		status = cfi_read(map, adr);-	}+	} while( !time_after(jiffies, timeo) );+ 	if( (status & dq6) != (oldstatus & dq6) )  	{                                        		/* The erasing didn't stop?? */@@ -1068,7 +1354,7 @@ 	instr->state = MTD_ERASE_DONE; 	if (instr->callback) 		instr->callback(instr);-	+ 	return 0; } diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/mtd/Config.in linuxmips-2.4.30/drivers/mtd/Config.in--- linuxmips-2.4.30.ref/drivers/mtd/Config.in	2003-02-25 16:53:49.000000000 -0800+++ linuxmips-2.4.30/drivers/mtd/Config.in	2006-08-22 15:10:17.000000000 -0700@@ -14,7 +14,9 @@    dep_tristate '  MTD partitioning support' CONFIG_MTD_PARTITIONS $CONFIG_MTD    dep_tristate '  MTD concatenating support' CONFIG_MTD_CONCAT $CONFIG_MTD    dep_tristate '  RedBoot partition table parsing' CONFIG_MTD_REDBOOT_PARTS $CONFIG_MTD_PARTITIONS-   dep_tristate '  Command line partition table parsing' CONFIG_MTD_CMDLINE_PARTS $CONFIG_MTD_PARTITIONS+   if [ ! "$CONFIG_TANGO2_SIG_BLOCK" = "y" -a ! "$CONFIG_TANGO2_XENV" = "y" ]; then+       dep_tristate '  Command line partition table parsing' CONFIG_MTD_CMDLINE_PARTS $CONFIG_MTD_PARTITIONS+   fi    if [ "$CONFIG_ARM" = "y" ]; then       dep_tristate '  ARM Firmware Suite partition parsing' CONFIG_MTD_AFS_PARTS $CONFIG_MTD_PARTITIONS    fidiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/mtd/maps/Config.in linuxmips-2.4.30/drivers/mtd/maps/Config.in--- linuxmips-2.4.30.ref/drivers/mtd/maps/Config.in	2004-02-25 16:46:35.000000000 -0800+++ linuxmips-2.4.30/drivers/mtd/maps/Config.in	2006-08-22 15:10:17.000000000 -0700@@ -8,9 +8,17 @@  dep_tristate '  CFI Flash device in physical memory map' CONFIG_MTD_PHYSMAP $CONFIG_MTD_GEN_PROBE if [ "$CONFIG_MTD_PHYSMAP" = "y" -o "$CONFIG_MTD_PHYSMAP" = "m" ]; then-   hex '    Physical start address of flash mapping' CONFIG_MTD_PHYSMAP_START 0x8000000-   hex '    Physical length of flash mapping' CONFIG_MTD_PHYSMAP_LEN 0x4000000-   int '    Bus width in octets' CONFIG_MTD_PHYSMAP_BUSWIDTH 2+   if [ "$CONFIG_TANGO2" = "y" ]; then+      if [ ! "$CONFIG_TANGO2_SIG_BLOCK" = "y" -a ! "$CONFIG_TANGO2_XENV" = "y" ]; then+         hex '    Physical start address of flash mapping' CONFIG_MTD_PHYSMAP_START 0x48000000+         hex '    Physical length of flash mapping' CONFIG_MTD_PHYSMAP_LEN 0x4000000+         int '    Bus width in octets' CONFIG_MTD_PHYSMAP_BUSWIDTH 2+      fi+   else+      hex '    Physical start address of flash mapping' CONFIG_MTD_PHYSMAP_START 0x48000000+      hex '    Physical length of flash mapping' CONFIG_MTD_PHYSMAP_LEN 0x4000000+      int '    Bus width in octets' CONFIG_MTD_PHYSMAP_BUSWIDTH 2+   fi fi  if [ "$CONFIG_SPARC" = "y" -o "$CONFIG_SPARC64" = "y" ]; thendiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/drivers/mtd/maps/physmap.c linuxmips-2.4.30/drivers/mtd/maps/physmap.c--- linuxmips-2.4.30.ref/drivers/mtd/maps/physmap.c	2003-02-25 16:53:50.000000000 -0800+++ linuxmips-2.4.30/drivers/mtd/maps/physmap.c	2006-08-22 15:10:37.000000000 -0700@@ -16,11 +16,40 @@ #include <linux/mtd/partitions.h> #endif +#ifdef CONFIG_TANGO2+#include <asm/tango2/rmdefs.h>+#include <asm/tango2/emhwlib_registers_tango2.h>+#define MAX_FLASH                   4+#define XENV_MAX_FLASH_PARTITIONS   16+extern unsigned int xenv_cs_flash_size[MAX_FLASH];+extern unsigned int xenv_cs_flash_parts[MAX_FLASH];+extern unsigned int xenv_flash_parts_size[MAX_FLASH][XENV_MAX_FLASH_PARTITIONS];+extern unsigned int xenv_flash_parts_offset[MAX_FLASH][XENV_MAX_FLASH_PARTITIONS];+#endif++#ifdef CONFIG_TANGO2_SIG_BLOCK+#include <asm/tango2/sigblock.h>+#include <asm/tango2/zboot.h>+#define WINDOW_ADDR	0+#define WINDOW_SIZE	0+#define BUSWIDTH       1+#elif defined(CONFIG_TANGO2_XENV) /* Do nothing here */+#else #define WINDOW_ADDR CONFIG_MTD_PHYSMAP_START #define WINDOW_SIZE CONFIG_MTD_PHYSMAP_LEN+#endif++#if !defined(CONFIG_TANGO2_SIG_BLOCK) && !defined(CONFIG_TANGO2_XENV) #define BUSWIDTH CONFIG_MTD_PHYSMAP_BUSWIDTH+#endif +#if defined(CONFIG_TANGO2_XENV)+static struct mtd_info *mymtd[MAX_FLASH] = { NULL, NULL, NULL, NULL };+#else+static unsigned long window_addr = WINDOW_ADDR;+static unsigned long window_size = WINDOW_SIZE; static struct mtd_info *mymtd;+#endif /* CONFIG_TANGO2_XENV */  __u8 physmap_read8(struct map_info *map, unsigned long ofs) {@@ -65,10 +94,66 @@ 	memcpy_toio(map->map_priv_1 + to, from, len); } +#if defined(CONFIG_TANGO2_XENV)+struct map_info physmap_map[MAX_FLASH] = {+	{+            name: "CS0: Physically mapped flash",+	    size: 0, /* Initially 0, but will be initialized later */+	    buswidth: 1, /* The default width, may be probed to change later */+	    read8: physmap_read8,+	    read16: physmap_read16,+	    read32: physmap_read32,+	    copy_from: physmap_copy_from,+	    write8: physmap_write8,+	    write16: physmap_write16,+	    write32: physmap_write32,+	    copy_to: physmap_copy_to+	},+	{+            name: "CS1: Physically mapped flash",+	    size: 0, /* Initially 0, but will be initialized later */+	    buswidth: 1, /* The default width, may be probed to change later */+	    read8: physmap_read8,+	    read16: physmap_read16,+	    read32: physmap_read32,+	    copy_from: physmap_copy_from,+	    write8: physmap_write8,+	    write16: physmap_write16,+	    write32: physmap_write32,+	    copy_to: physmap_copy_to+	},+	{+            name: "CS2: Physically mapped flash",+	    size: 0, /* Initially 0, but will be initialized later */+	    buswidth: 1, /* The default width, may be probed to change later */+	    read8: physmap_read8,+	    read16: physmap_read16,+	    read32: physmap_read32,+	    copy_from: physmap_copy_from,+	    write8: physmap_write8,+	    write16: physmap_write16,+	    write32: physmap_write32,+	    copy_to: physmap_copy_to+	},+	{+            name: "CS3: Physically mapped flash",+	    size: 0, /* Initially 0, but will be initialized later */+	    buswidth: 1, /* The default width, may be probed to change later */+	    read8: physmap_read8,+	    read16: physmap_read16,+	    read32: physmap_read32,+	    copy_from: physmap_copy_from,+	    write8: physmap_write8,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -