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

📄 1009.mtd.patch

📁 sm86xx内核源包括补丁( GPL )的
💻 PATCH
📖 第 1 页 / 共 3 页
字号:
+	    write16: physmap_write16,+	    write32: physmap_write32,+	    copy_to: physmap_copy_to+	},+};+#else struct map_info physmap_map = { 	name: "Physically mapped flash",-	size: WINDOW_SIZE,-	buswidth: BUSWIDTH,+	size: 0, /* Initially WINDOW_SIZE, but will be initialized later */+	buswidth: BUSWIDTH, /* The default width, may be probed to change later */ 	read8: physmap_read8, 	read16: physmap_read16, 	read32: physmap_read32,@@ -78,28 +163,38 @@ 	write32: physmap_write32, 	copy_to: physmap_copy_to };+#endif /* CONFIG_TANGO2_XENV */  #ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_CMDLINE_PARTS static struct mtd_partition *mtd_parts = 0; static int                   mtd_parts_nb = 0; #else+#if defined(CONFIG_TANGO2_XENV)+static struct mtd_partition *physmap_partitions[MAX_FLASH] = { NULL, NULL, NULL, NULL };+#else static struct mtd_partition physmap_partitions[] = { /* Put your own partition definitions here */-#if 0+#if defined(CONFIG_TANGO2_SIG_BLOCK)+	{	name: "Partition1", size: 0, offset: 0, mask_flags: 0 },+	{	name: "Partition2", size: 0, offset: 0, mask_flags: 0 },+	{	name: "Partition3", size: 0, offset: 0, mask_flags: 0 },+	{	name: "Partition4", size: 0, offset: 0, mask_flags: 0 },+	{	name: "Partition5", size: 0, offset: 0, mask_flags: 0 }+#else 	{-		name:		"bootROM",-		size:		0x80000,+		name:		"zBoot",+		size:		0x10000, 		offset:		0, 		mask_flags:	MTD_WRITEABLE,  /* force read-only */ 	}, {-		name:		"zImage",-		size:		0x100000,+		name:		"BootStage1",+		size:		0x30000, 		offset:		MTDPART_OFS_APPEND, 		mask_flags:	MTD_WRITEABLE,  /* force read-only */ 	}, {-		name:		"ramdisk.gz",-		size:		0x300000,+		name:		"Linux",+		size:		0x3b0000, 		offset:		MTDPART_OFS_APPEND, 		mask_flags:	MTD_WRITEABLE,  /* force read-only */ 	}, {@@ -107,21 +202,190 @@ 		size:		MTDPART_SIZ_FULL, 		offset:		MTDPART_OFS_APPEND, 	}-#endif+#endif /* CONFIG_TANGO2_SIG_BLOCK */ };+#endif  -#define NUM_PARTITIONS	(sizeof(physmap_partitions)/sizeof(struct mtd_partition))--#endif+#if !defined(CONFIG_TANGO2_XENV)+static int num_partitions = (sizeof(physmap_partitions)/sizeof(struct mtd_partition)); #endif +#endif /* CONFIG_MTD_CMDLINE_PARTS */+#endif /* CONFIG_MTD_PARTITIONS */++#if defined(CONFIG_TANGO2_XENV) int __init init_physmap(void) { 	static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 }; 	const char **type;+	int i, j;+	struct mtd_partition *part_ptr;+	unsigned long w_addr;+	unsigned long csconfig = gbus_read_uint32(pGBus, REG_BASE_host_interface + PB_CS_config) & 0xf;+	struct mtd_info *mtdinfo;++	for (i = 0, w_addr = 0x40000000; i < MAX_FLASH; i++, w_addr += 0x04000000) {+		mtdinfo = NULL;+		if ((physmap_map[i].size = xenv_cs_flash_size[i]) == 0)+			continue;+		physmap_map[i].map_priv_1 = (unsigned long)ioremap(w_addr, physmap_map[i].size);+		if (physmap_map[i].map_priv_1 == 0) {+			printk("Failed to ioremap at 0x%08lx, size 0x%08lx\n", w_addr, physmap_map[i].size);+			return -EIO;+		}+		printk(KERN_NOTICE "physmap flash device CS%d: %x at %x (%x)\n", i, +				physmap_map[i].size, w_addr, physmap_map[i].map_priv_1);+		physmap_map[i].buswidth = ((csconfig >> i) & 0x1) ? 1 : 2;+		printk(KERN_NOTICE " detected buswidth: %d\n", physmap_map[i].buswidth);++		/* Try to detect the actual size of flash memory */+		for (type = rom_probe_types; (mtdinfo == NULL) && *type; type++) +			mtdinfo = do_map_probe(*type, &physmap_map[i]);+		if (mtdinfo == NULL) {+			iounmap((void *)physmap_map[i].map_priv_1);+			continue;+		} else if (mtdinfo->size != physmap_map[i].size) {+			printk(KERN_NOTICE "Flash size mismatched (specified: 0x%x, detected: 0x%x).\n", +					physmap_map[i].size, mtdinfo->size);+		}++		if ((physmap_map[i].size > 0) && (xenv_cs_flash_parts[i] > 0)) {+			unsigned long part_cnt;+			physmap_partitions[i] = (struct mtd_partition *)kmalloc(sizeof(struct mtd_partition) *+					xenv_cs_flash_parts[i], GFP_KERNEL);+			if ((part_ptr = physmap_partitions[i]) != NULL) {+				memset(physmap_partitions[i], 0, sizeof(struct mtd_partition) * xenv_cs_flash_parts[i]);+				for (part_cnt = j = 0; j < xenv_cs_flash_parts[i]; j++) {+					if (((xenv_flash_parts_size[i][j] & 0x7fffffff) + xenv_flash_parts_offset[i][j]) > +								mtdinfo->size) {+						printk(KERN_NOTICE "CS%d-Part%d (offset:0x%x, size:0x%x) outside physical map, removed.\n", +								i, j + 1, xenv_flash_parts_offset[i][j], xenv_flash_parts_size[i][j] & 0x7fffffff);+							continue;+					}++					part_ptr->size = xenv_flash_parts_size[i][j] & 0x7fffffff;+					if (xenv_flash_parts_size[i][j] & 0x80000000)+						part_ptr->mask_flags = MTD_WRITEABLE;+					part_ptr->offset = xenv_flash_parts_offset[i][j];+					part_ptr->name = (char *)kmalloc(16, GFP_KERNEL);+					if (part_ptr->name != NULL)+						sprintf(part_ptr->name, "CS%d-Part%d", i, j + 1);+					part_cnt++;+					part_ptr++;+				} +				xenv_cs_flash_parts[i] = part_cnt;+			} else {+				printk("Cannot allocate memory, size 0x%x\n", +						sizeof(struct mtd_partition) * xenv_cs_flash_parts[i]);+				return(-ENOMEM);+			}+		} -       	printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);-	physmap_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);+		mymtd[i] = mtdinfo;++		if ((mymtd[i]) && (mymtd[i]->size != physmap_map[i].size)) {+			/* Redo ioremap */+			iounmap((void *)physmap_map[i].map_priv_1);+			physmap_map[i].size = mymtd[i]->size;+			physmap_map[i].map_priv_1 = (unsigned long)ioremap(w_addr, physmap_map[i].size);+			if (physmap_map[i].map_priv_1 == 0) {+				printk("Failed to ioremap at 0x%08lx, size 0x%08lx\n", w_addr, physmap_map[i].size);+				return -EIO;+			}+			printk(KERN_NOTICE "physmap flash device CS%d: %x at %x (remapped %x)\n", i, +					physmap_map[i].size, w_addr, physmap_map[i].map_priv_1);+		}++		if (mymtd[i]) {+			mymtd[i]->module = THIS_MODULE;+			add_mtd_device(mymtd[i]);+			if (xenv_cs_flash_parts[i] > 0) {+				printk(KERN_NOTICE "Using physmap partition definition\n");+				add_mtd_partitions (mymtd[i], physmap_partitions[i], xenv_cs_flash_parts[i]);+			}+		}+	}+	return(0);+}++static void __exit cleanup_physmap(void)+{+	int i, j;+	struct mtd_partition *part_ptr;+	for (i = 0; i < MAX_FLASH; i++) {+		if (mymtd[i]) {+			del_mtd_device(mymtd[i]);+			map_destroy(mymtd[i]);+		}++		if (physmap_map[i].map_priv_1) {+			iounmap((void *)physmap_map[i].map_priv_1);+			physmap_map[i].map_priv_1 = 0;+			if (physmap_partitions[i] != NULL) {+				if ((part_ptr = physmap_partitions[i]) != NULL) {+					for (j = 0; j < xenv_cs_flash_parts[i]; j++, part_ptr++) {+						if (part_ptr->name != NULL) {+							kfree(part_ptr->name);+							part_ptr->name = NULL;+						}+					}+				}+				kfree(physmap_partitions[i]);+				physmap_partitions[i] = NULL;+			}+		}+	}+}++#else /* !CONFIG_TANGO2_XENV */++int __init init_physmap(void)+{+	static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 };+	const char **type;++#ifdef CONFIG_TANGO2_SIG_BLOCK+	extern struct signature_block *sigptr;+	if (pflash_info(sigptr, &window_addr, &window_size) < 0) {+		printk(KERN_NOTICE "invalid flash description in signature block.\n");+		return -EIO;+	}+#endif++	physmap_map.map_priv_1 = (unsigned long)ioremap(window_addr, window_size);+       	printk(KERN_NOTICE "physmap flash device: %x at %x (%x)\n", window_size, window_addr, physmap_map.map_priv_1);++	physmap_map.size = window_size;++#ifdef CONFIG_TANGO2_SIG_BLOCK+	/* If window size larger than 0, and window address is the same as CSx (x=0..3),+	 * we can then probe for the buswidth from PB_CS_config */+	if (window_size > 0) {+		unsigned long cs = 0xf;+		unsigned long csconfig = gbus_read_uint32(pGBus, REG_BASE_host_interface + PB_CS_config) & 0xf;+		switch(window_addr) {+			case 0x40000000: cs = 0;+					 break;+			case 0x44000000: cs = 1;+					 break;+			case 0x48000000: cs = 2;+					 break;+			case 0x4c000000: cs = 3;+					 break;+		}+		if (cs != 0xf) {+			/* Tango2 only supports 8 or 16 bits */+			physmap_map.buswidth = ((csconfig >> cs) & 0x1) ? 1 : 2;+			printk(KERN_NOTICE " detected buswidth: %d\n", physmap_map.buswidth);+		} else {+			/* Use whatever has been setup */+			printk(KERN_NOTICE " detected buswidth: failed, use default %d\n", physmap_map.buswidth);+		}+	} else {+		/* Use whatever has been setup */+		printk(KERN_NOTICE " detected buswidth: failed, use default %d\n", physmap_map.buswidth);+	}+#endif  	if (!physmap_map.map_priv_1) { 		printk("Failed to ioremap\n");@@ -137,6 +401,25 @@ 		mymtd->module = THIS_MODULE;  		add_mtd_device(mymtd);++#if defined(CONFIG_TANGO2_SIG_BLOCK)+		{+			int i, idx;+			unsigned long size, offset;+			for (idx = 0, i = 1; i <= pflash_num_partitions(); i++) {+				if (pflash_partition_info(sigptr, i, &offset, &size) < 0)+					continue;+				else if ((size & 0x7fffffff) == 0)      /* Skip the empty partition */+					continue;+				physmap_partitions[idx].size = size & 0x7fffffff;+				physmap_partitions[idx].offset = offset;+				physmap_partitions[idx].mask_flags = ((size & 0x80000000UL) ? MTD_WRITEABLE : 0);+				idx++;+			}+			num_partitions = idx;+		}+#endif+ #ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_CMDLINE_PARTS 		mtd_parts_nb = parse_cmdline_partitions(mymtd, &mtd_parts, @@ -148,11 +431,11 @@ 			add_mtd_partitions (mymtd, mtd_parts, mtd_parts_nb); 		} #else-		if (NUM_PARTITIONS != 0) +		if (num_partitions != 0)  		{ 			printk(KERN_NOTICE  			       "Using physmap partition definition\n");-			add_mtd_partitions (mymtd, physmap_partitions, NUM_PARTITIONS);+			add_mtd_partitions (mymtd, physmap_partitions, num_partitions); 		}  #endif@@ -175,6 +458,7 @@ 		physmap_map.map_priv_1 = 0; 	} }+#endif /* CONFIG_TANGO2_XENV */  module_init(init_physmap); module_exit(cleanup_physmap);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/README.1009.mtd.patch linuxmips-2.4.30/README.1009.mtd.patch--- linuxmips-2.4.30.ref/README.1009.mtd.patch	1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/README.1009.mtd.patch	2006-08-22 15:11:12.000000000 -0700@@ -0,0 +1,19 @@+Feature:+--------+MTD support for SMP863x.++Prerequisite patch numbers:+---------------------------+0000+1000++Primary author:+---------------+YH Lin++Related to which chip version SMP863x x=?+-----------------------------------------+all++(linux patches) which CONFIG_... are provided:+----------------------------------------------

⌨️ 快捷键说明

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