X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/d57e4d97e77506e9f634eabe6412c57d81ce0bd4..318e0f93c68d8fd47a49617767eab5fc41a3a48a:/target/linux/storm/patches/007-mtd.patch diff --git a/target/linux/storm/patches/007-mtd.patch b/target/linux/storm/patches/007-mtd.patch index 75dfd6acc..bc9a03ee4 100644 --- a/target/linux/storm/patches/007-mtd.patch +++ b/target/linux/storm/patches/007-mtd.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/chips/Kconfig +++ b/drivers/mtd/chips/Kconfig -@@ -220,6 +220,13 @@ +@@ -220,6 +220,13 @@ config MTD_ROM This option enables basic support for ROM chips accessed through a bus mapping driver. @@ -35,7 +35,7 @@ #define MANUFACTURER_AMD 0x0001 #define MANUFACTURER_ATMEL 0x001F -@@ -322,6 +327,13 @@ +@@ -322,6 +327,13 @@ struct mtd_info *cfi_cmdset_0002(struct #endif bootloc = extp->TopBottom; @@ -49,7 +49,7 @@ if ((bootloc != 2) && (bootloc != 3)) { printk(KERN_WARNING "%s: CFI does not contain boot " "bank location. Assuming top.\n", map->name); -@@ -340,6 +352,9 @@ +@@ -340,6 +352,9 @@ struct mtd_info *cfi_cmdset_0002(struct cfi->cfiq->EraseRegionInfo[j] = swap; } } @@ -59,7 +59,7 @@ /* Set the default CFI lock/unlock addresses */ cfi->addr_unlock1 = 0x555; cfi->addr_unlock2 = 0x2aa; -@@ -461,6 +476,7 @@ +@@ -461,6 +476,7 @@ static int __xipram chip_ready(struct ma map_word d, t; d = map_read(map, addr); @@ -67,7 +67,7 @@ t = map_read(map, addr); return map_word_equal(map, d, t); -@@ -626,7 +642,9 @@ +@@ -626,7 +642,9 @@ static void put_chip(struct map_info *ma default: printk(KERN_ERR "MTD: put_chip() called with oldstate %d!!\n", chip->oldstate); } @@ -77,7 +77,7 @@ } #ifdef CONFIG_MTD_XIP -@@ -940,7 +958,9 @@ +@@ -940,7 +958,9 @@ static inline int do_read_secsi_onechip( cfi_send_gen_cmd(0x90, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x00, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); @@ -87,7 +87,7 @@ spin_unlock(chip->mutex); return 0; -@@ -1005,7 +1025,10 @@ +@@ -1005,7 +1025,10 @@ static int __xipram do_write_oneword(str */ unsigned long uWriteTimeout = ( HZ / 1000 ) + 1; int ret = 0; @@ -99,7 +99,7 @@ int retry_cnt = 0; adr += chip->start; -@@ -1037,9 +1060,15 @@ +@@ -1037,9 +1060,15 @@ static int __xipram do_write_oneword(str ENABLE_VPP(map); xip_disable(map, chip, adr); retry: @@ -115,7 +115,7 @@ map_write(map, datum, adr); chip->state = FL_WRITING; -@@ -1072,7 +1101,13 @@ +@@ -1072,7 +1101,13 @@ static int __xipram do_write_oneword(str } if (chip_ready(map, adr)) @@ -130,7 +130,7 @@ /* Latency issues. Drop the lock, wait a while and retry */ UDELAY(map, chip, adr, 1); -@@ -1084,8 +1119,17 @@ +@@ -1084,8 +1119,17 @@ static int __xipram do_write_oneword(str /* FIXME - should have reset delay before continuing */ if (++retry_cnt <= MAX_WORD_RETRIES) @@ -149,7 +149,7 @@ ret = -EIO; } xip_enable(map, chip, adr); -@@ -1171,7 +1215,14 @@ +@@ -1171,7 +1215,14 @@ static int cfi_amdstd_write_words(struct return 0; } } @@ -165,7 +165,7 @@ /* We are now aligned, write as much as possible */ while(len >= map_bankwidth(map)) { map_word datum; -@@ -1181,7 +1232,15 @@ +@@ -1181,7 +1232,15 @@ static int cfi_amdstd_write_words(struct ret = do_write_oneword(map, &cfi->chips[chipnum], ofs, datum); if (ret) @@ -181,7 +181,7 @@ ofs += map_bankwidth(map); buf += map_bankwidth(map); -@@ -1189,19 +1248,38 @@ +@@ -1189,19 +1248,38 @@ static int cfi_amdstd_write_words(struct len -= map_bankwidth(map); if (ofs >> cfi->chipshift) { @@ -220,7 +220,7 @@ spin_lock(cfi->chips[chipnum].mutex); if (cfi->chips[chipnum].state != FL_READY) { -@@ -1221,7 +1299,11 @@ +@@ -1221,7 +1299,11 @@ static int cfi_amdstd_write_words(struct #endif goto retry1; } @@ -233,7 +233,7 @@ tmp_buf = map_read(map, ofs + chipstart); spin_unlock(cfi->chips[chipnum].mutex); -@@ -1231,11 +1313,23 @@ +@@ -1231,11 +1313,23 @@ static int cfi_amdstd_write_words(struct ret = do_write_oneword(map, &cfi->chips[chipnum], ofs, tmp_buf); if (ret) @@ -258,7 +258,7 @@ return 0; } -@@ -1275,6 +1369,7 @@ +@@ -1275,6 +1369,7 @@ static int __xipram do_write_buffer(stru ENABLE_VPP(map); xip_disable(map, chip, cmd_adr); @@ -266,7 +266,7 @@ cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0x55, cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type, NULL); //cfi_send_gen_cmd(0xA0, cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type, NULL); -@@ -1535,6 +1630,9 @@ +@@ -1535,6 +1630,9 @@ static int __xipram do_erase_oneblock(st DECLARE_WAITQUEUE(wait, current); int ret = 0; @@ -276,7 +276,7 @@ adr += chip->start; spin_lock(chip->mutex); -@@ -1613,6 +1711,9 @@ +@@ -1613,6 +1711,9 @@ static int __xipram do_erase_oneblock(st chip->state = FL_READY; put_chip(map, chip, adr); spin_unlock(chip->mutex); @@ -479,7 +479,7 @@ +MODULE_DESCRIPTION("MTD chip driver for ROM chips"); --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig -@@ -614,5 +614,30 @@ +@@ -614,5 +614,30 @@ config MTD_PLATRAM This selection automatically selects the map_ram driver. @@ -1943,7 +1943,7 @@ + --- /dev/null +++ b/drivers/mtd/maps/sl2312_flashmap.h -@@ -0,0 +1,21 @@ +@@ -0,0 +1,20 @@ +/* + * Please note that the name are used in mkflash script. Therefore + * don't change them. If you want to add different partitions, you @@ -1959,8 +1959,7 @@ +static struct mtd_partition sl2312_partitions[] = { + { name: "RedBoot", offset: 0x00000000, size: 0x00020000, }, + { name: "kernel", offset: 0x00020000, size: 0x00100000, }, -+ { name: "rootfs", offset: 0x00120000, size: 0x00500000, }, -+ { name: "rootfs_data", offset: 0x00620000, size: 0x001A0000, }, ++ { name: "rootfs", offset: 0x00120000, size: 0x006A0000, }, + { name: "VCTL", offset: 0x007C0000, size: 0x00010000, }, + { name: "cfg", offset: 0x007D0000, size: 0x00020000, }, + { name: "FIS directory", offset: 0x007F0000, size: 0x00010000, } @@ -2015,7 +2014,7 @@ +}; --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c -@@ -59,6 +59,77 @@ +@@ -59,6 +59,77 @@ struct mtd_file_info { enum mtd_file_modes mode; }; @@ -2093,7 +2092,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig) { struct mtd_file_info *mfi = file->private_data; -@@ -162,13 +233,21 @@ +@@ -162,13 +233,21 @@ static ssize_t mtd_read(struct file *fil int len; char *kbuf; @@ -2116,7 +2115,7 @@ /* FIXME: Use kiovec in 2.5 to lock down the user's buffers and pass them directly to the MTD functions */ -@@ -178,8 +257,12 @@ +@@ -178,8 +257,12 @@ static ssize_t mtd_read(struct file *fil else kbuf=kmalloc(count, GFP_KERNEL); @@ -2130,7 +2129,7 @@ while (count) { -@@ -224,6 +307,9 @@ +@@ -224,6 +307,9 @@ static ssize_t mtd_read(struct file *fil *ppos += retlen; if (copy_to_user(buf, kbuf, retlen)) { kfree(kbuf); @@ -2140,7 +2139,7 @@ return -EFAULT; } else -@@ -235,13 +321,19 @@ +@@ -235,13 +321,19 @@ static ssize_t mtd_read(struct file *fil count = 0; } else { @@ -2161,7 +2160,7 @@ return total_retlen; } /* mtd_read */ -@@ -255,24 +347,40 @@ +@@ -255,24 +347,40 @@ static ssize_t mtd_write(struct file *fi int ret=0; int len; @@ -2205,7 +2204,7 @@ while (count) { -@@ -283,6 +391,9 @@ +@@ -283,6 +391,9 @@ static ssize_t mtd_write(struct file *fi if (copy_from_user(kbuf, buf, len)) { kfree(kbuf); @@ -2215,7 +2214,7 @@ return -EFAULT; } -@@ -323,11 +434,17 @@ +@@ -323,11 +434,17 @@ static ssize_t mtd_write(struct file *fi } else { kfree(kbuf); @@ -2233,7 +2232,7 @@ return total_retlen; } /* mtd_write */ -@@ -381,36 +498,67 @@ +@@ -381,36 +498,67 @@ static int mtd_ioctl(struct inode *inode u_long size; struct mtd_info_user info; @@ -2304,7 +2303,7 @@ break; } -@@ -433,7 +581,12 @@ +@@ -433,7 +581,12 @@ static int mtd_ioctl(struct inode *inode struct erase_info *erase; if(!(file->f_mode & 2)) @@ -2317,7 +2316,7 @@ erase=kzalloc(sizeof(struct erase_info),GFP_KERNEL); if (!erase) -@@ -447,6 +600,9 @@ +@@ -447,6 +600,9 @@ static int mtd_ioctl(struct inode *inode if (copy_from_user(&erase->addr, argp, sizeof(struct erase_info_user))) { kfree(erase); @@ -2327,7 +2326,7 @@ return -EFAULT; } erase->mtd = mtd; -@@ -484,14 +640,26 @@ +@@ -484,14 +640,26 @@ static int mtd_ioctl(struct inode *inode struct mtd_oob_buf buf; struct mtd_oob_ops ops; @@ -2357,7 +2356,7 @@ if (!mtd->write_oob) ret = -EOPNOTSUPP; -@@ -499,8 +667,12 @@ +@@ -499,8 +667,12 @@ static int mtd_ioctl(struct inode *inode ret = access_ok(VERIFY_READ, buf.ptr, buf.length) ? 0 : EFAULT; @@ -2371,7 +2370,7 @@ ops.ooblen = buf.length; ops.ooboffs = buf.start & (mtd->oobsize - 1); -@@ -536,19 +708,35 @@ +@@ -536,19 +708,35 @@ static int mtd_ioctl(struct inode *inode struct mtd_oob_buf buf; struct mtd_oob_ops ops; @@ -2411,7 +2410,7 @@ ops.ooblen = buf.length; ops.ooboffs = buf.start & (mtd->oobsize - 1); -@@ -580,7 +768,12 @@ +@@ -580,7 +768,12 @@ static int mtd_ioctl(struct inode *inode struct erase_info_user info; if (copy_from_user(&info, argp, sizeof(info))) @@ -2424,7 +2423,7 @@ if (!mtd->lock) ret = -EOPNOTSUPP; -@@ -594,7 +787,12 @@ +@@ -594,7 +787,12 @@ static int mtd_ioctl(struct inode *inode struct erase_info_user info; if (copy_from_user(&info, argp, sizeof(info))) @@ -2437,7 +2436,7 @@ if (!mtd->unlock) ret = -EOPNOTSUPP; -@@ -629,11 +827,21 @@ +@@ -629,11 +827,21 @@ static int mtd_ioctl(struct inode *inode loff_t offs; if (copy_from_user(&offs, argp, sizeof(loff_t))) @@ -2459,7 +2458,7 @@ break; } -@@ -642,11 +850,21 @@ +@@ -642,11 +850,21 @@ static int mtd_ioctl(struct inode *inode loff_t offs; if (copy_from_user(&offs, argp, sizeof(loff_t))) @@ -2481,7 +2480,7 @@ break; } -@@ -654,8 +872,12 @@ +@@ -654,8 +872,12 @@ static int mtd_ioctl(struct inode *inode case OTPSELECT: { int mode; @@ -2495,7 +2494,7 @@ mfi->mode = MTD_MODE_NORMAL; -@@ -670,7 +892,12 @@ +@@ -670,7 +892,12 @@ static int mtd_ioctl(struct inode *inode { struct otp_info *buf = kmalloc(4096, GFP_KERNEL); if (!buf) @@ -2508,7 +2507,7 @@ ret = -EOPNOTSUPP; switch (mfi->mode) { case MTD_MODE_OTP_FACTORY: -@@ -701,12 +928,24 @@ +@@ -701,12 +928,24 @@ static int mtd_ioctl(struct inode *inode { struct otp_info info; @@ -2536,7 +2535,7 @@ ret = mtd->lock_user_prot_reg(mtd, info.start, info.length); break; } -@@ -742,8 +981,12 @@ +@@ -742,8 +981,12 @@ static int mtd_ioctl(struct inode *inode break; case MTD_MODE_RAW: @@ -2550,7 +2549,7 @@ mfi->mode = arg; case MTD_MODE_NORMAL: -@@ -766,6 +1009,10 @@ +@@ -766,6 +1009,10 @@ static int mtd_ioctl(struct inode *inode ret = -ENOTTY; } @@ -2563,7 +2562,7 @@ --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig -@@ -44,6 +44,13 @@ +@@ -44,6 +44,13 @@ config MTD_NAND_AUTCPU12 This enables the driver for the autronix autcpu12 board to access the SmartMediaCard. @@ -4939,7 +4938,7 @@ +#endif --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile -@@ -71,3 +71,7 @@ +@@ -71,3 +71,7 @@ obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o obj-$(CONFIG_MTD_TQM834x) += tqm834x.o