?? mtd.patch
字號:
diff -Naur linux26-cvs/Documentation/DocBook/librs.tmpl linux26-new/Documentation/DocBook/librs.tmpl--- linux26-cvs/Documentation/DocBook/librs.tmpl 2005-08-25 12:05:49.000000000 -0500+++ linux26-new/Documentation/DocBook/librs.tmpl 2005-08-25 14:09:03.000000000 -0500@@ -1,4 +1,6 @@-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> <book id="Reed-Solomon-Library-Guide"> <bookinfo>@@ -223,7 +225,7 @@ ..... /* Decode 512 byte in data8.*/ numerr = decode_rs8 (rs_decoder, NULL, NULL, 512, syn, 0, errpos, 0, corr);-for (i = 0; i < numerr; i++) {+for (i = 0; i < numerr; i++) { do_error_correction_in_your_buffer(errpos[i], corr[i]); } </programlisting>diff -Naur linux26-cvs/Documentation/DocBook/mtdnand.tmpl linux26-new/Documentation/DocBook/mtdnand.tmpl--- linux26-cvs/Documentation/DocBook/mtdnand.tmpl 2005-08-25 12:05:49.000000000 -0500+++ linux26-new/Documentation/DocBook/mtdnand.tmpl 2005-08-25 14:09:03.000000000 -0500@@ -1,4 +1,6 @@-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"+ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> <book id="MTD-NAND-Guide"> <bookinfo>@@ -238,9 +240,9 @@ struct nand_chip *this = (struct nand_chip *) mtd->priv; switch(cmd){ case NAND_CTL_SETCLE: this->IO_ADDR_W |= CLE_ADRR_BIT; break;- case NAND_CTL_CLRCLE: this->IO_ADDR_W &= ~CLE_ADRR_BIT; break;+ case NAND_CTL_CLRCLE: this->IO_ADDR_W &= ~CLE_ADRR_BIT; break; case NAND_CTL_SETALE: this->IO_ADDR_W |= ALE_ADRR_BIT; break;- case NAND_CTL_CLRALE: this->IO_ADDR_W &= ~ALE_ADRR_BIT; break;+ case NAND_CTL_CLRALE: this->IO_ADDR_W &= ~ALE_ADRR_BIT; break; } } </programlisting>@@ -391,7 +393,7 @@ /* Deselect all chips, set all nCE pins high */ GPIO(BOARD_NAND_NCE) |= 0xff; if (chip >= 0)- GPIO(BOARD_NAND_NCE) &= ~ (1 << chip); + GPIO(BOARD_NAND_NCE) &= ~ (1 << chip); } </programlisting> <para>@@ -405,8 +407,8 @@ struct nand_chip *this = (struct nand_chip *) mtd->priv; /* Deselect all chips */- this->IO_ADDR_R &= ~BOARD_NAND_ADDR_MASK;- this->IO_ADDR_W &= ~BOARD_NAND_ADDR_MASK;+ this->IO_ADDR_R &= ~BOARD_NAND_ADDR_MASK;+ this->IO_ADDR_W &= ~BOARD_NAND_ADDR_MASK; switch (chip) { case 0: this->IO_ADDR_R |= BOARD_NAND_ADDR_CHIP0;diff -Naur linux26-cvs/drivers/mtd/Kconfig linux26-new/drivers/mtd/Kconfig--- linux26-cvs/drivers/mtd/Kconfig 2005-08-25 12:05:58.000000000 -0500+++ linux26-new/drivers/mtd/Kconfig 2005-08-25 14:10:30.000000000 -0500@@ -1,4 +1,4 @@-# $Id: Kconfig,v 1.7 2004/11/22 11:33:56 ijc Exp $+# $Id: Kconfig,v 1.10 2005/07/11 10:39:27 gleixner Exp $ menu "Memory Technology Devices (MTD)" @@ -27,6 +27,15 @@ help Determines the verbosity level of the MTD debugging messages. +config MTD_CONCAT+ tristate "MTD concatenating support"+ depends on MTD+ help+ Support for concatenating several MTD devices into a single+ (virtual) one. This allows you to have -for example- a JFFS(2)+ file system spanning multiple physical flash chips. If unsure,+ say 'Y'.+ config MTD_PARTITIONS bool "MTD partitioning support" depends on MTD@@ -40,15 +49,6 @@ devices. Partitioning on NFTL 'devices' is a different - that's the 'normal' form of partitioning used on a block device. -config MTD_CONCAT- tristate "MTD concatenating support"- depends on MTD- help- Support for concatenating several MTD devices into a single- (virtual) one. This allows you to have -for example- a JFFS(2)- file system spanning multiple physical flash chips. If unsure,- say 'Y'.- config MTD_REDBOOT_PARTS tristate "RedBoot partition table parsing" depends on MTD_PARTITIONS@@ -253,6 +253,16 @@ permitted to copy, modify and distribute the code as you wish. Just not use it. +config RFD_FTL+ tristate "Resident Flash Disk (Flash Translation Layer) support"+ depends on MTD+ ---help---+ This provides support for the flash translation layer known + as the Resident Flash Disk (RFD), as used by the Embedded BIOS + of General Software. There is a blurb at:++ http://www.gensw.com/pages/prod/bios/rfd.htm+ source "drivers/mtd/chips/Kconfig" source "drivers/mtd/maps/Kconfig"diff -Naur linux26-cvs/drivers/mtd/Makefile linux26-new/drivers/mtd/Makefile--- linux26-cvs/drivers/mtd/Makefile 2005-08-25 12:05:58.000000000 -0500+++ linux26-new/drivers/mtd/Makefile 2005-08-25 14:11:38.000000000 -0500@@ -1,7 +1,7 @@ # # Makefile for the memory technology device drivers. #-# $Id: Makefile.common,v 1.5 2004/08/10 20:51:49 dwmw2 Exp $+# $Id: Makefile.common,v 1.7 2005/07/11 10:39:27 gleixner Exp $ # Core functionality. mtd-y := mtdcore.o@@ -20,8 +20,9 @@ obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o obj-$(CONFIG_NFTL) += nftl.o mtd_blkdevs.o obj-$(CONFIG_INFTL) += inftl.o mtd_blkdevs.o+obj-$(CONFIG_RFD_FTL) += rfd_ftl.o mtd_blkdevs.o nftl-objs := nftlcore.o nftlmount.o inftl-objs := inftlcore.o inftlmount.o -obj-y += chips/ maps/ devices/ nand/+obj-y += chips/ maps/ devices/ nand/ diff -Naur linux26-cvs/drivers/mtd/afs.c linux26-new/drivers/mtd/afs.c--- linux26-cvs/drivers/mtd/afs.c 2005-08-25 12:05:58.000000000 -0500+++ linux26-new/drivers/mtd/afs.c 2005-08-25 14:09:02.000000000 -0500@@ -21,7 +21,7 @@ This is access code for flashes using ARM's flash partitioning standards. - $Id: afs.c,v 1.13 2004/02/27 22:09:59 rmk Exp $+ $Id: afs.c,v 1.14 2005/07/06 18:31:48 gleixner Exp $ ======================================================================*/ @@ -219,7 +219,7 @@ */ for (idx = off = 0; off < mtd->size; off += mtd->erasesize) { struct image_info_struct iis;- u_int iis_ptr, img_ptr, size;+ u_int iis_ptr, img_ptr; /* Read the footer. */ ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask);@@ -236,21 +236,9 @@ continue; strcpy(str, iis.name);- size = mtd->erasesize + off - img_ptr;-- /*- * In order to support JFFS2 partitions on this layout,- * we must lie to MTD about the real size of JFFS2- * partitions; this ensures that the AFS flash footer- * won't be erased by JFFS2. Please ensure that your- * JFFS2 partitions are given image numbers between- * 1000 and 2000 inclusive.- */- if (iis.imageNumber >= 1000 && iis.imageNumber < 2000)- size -= mtd->erasesize; parts[idx].name = str;- parts[idx].size = size;+ parts[idx].size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1); parts[idx].offset = img_ptr; parts[idx].mask_flags = 0; diff -Naur linux26-cvs/drivers/mtd/chips/Kconfig linux26-new/drivers/mtd/chips/Kconfig--- linux26-cvs/drivers/mtd/chips/Kconfig 2005-08-25 12:05:58.000000000 -0500+++ linux26-new/drivers/mtd/chips/Kconfig 2005-08-25 14:09:02.000000000 -0500@@ -1,5 +1,5 @@ # drivers/mtd/chips/Kconfig-# $Id: Kconfig,v 1.13 2004/12/01 15:49:10 nico Exp $+# $Id: Kconfig,v 1.16 2005/07/11 09:37:59 gleixner Exp $ menu "RAM/ROM/Flash chip drivers" depends on MTD!=n@@ -155,6 +155,31 @@ If your flash chips are interleaved in eights - i.e. you have eight flash chips addressed by each bus cycle, then say 'Y'. +config MTD_OTP+ bool "Protection Registers aka one-time programmable (OTP) bits"+ depends on MTD_CFI_ADV_OPTIONS+ default n+ help+ This enables support for reading, writing and locking so called+ "Protection Registers" present on some flash chips.+ A subset of them are pre-programmed at the factory with a+ unique set of values. The rest is user-programmable.++ The user-programmable Protection Registers contain one-time+ programmable (OTP) bits; when programmed, register bits cannot be+ erased. Each Protection Register can be accessed multiple times to+ program individual bits, as long as the register remains unlocked.++ Each Protection Register has an associated Lock Register bit. When a+ Lock Register bit is programmed, the associated Protection Register+ can only be read; it can no longer be programmed. Additionally,+ because the Lock Register bits themselves are OTP, when programmed,+ Lock Register bits cannot be erased. Therefore, when a Protection+ Register is locked, it cannot be unlocked.++ This feature should therefore be used with extreme care. Any mistake+ in the programming of OTP bits will waste them.+ config MTD_CFI_INTELEXT tristate "Support for Intel/Sharp flash chips" depends on MTD_GEN_PROBE@@ -275,7 +300,7 @@ config MTD_XIP bool "XIP aware MTD support"- depends on !SMP && MTD_CFI_INTELEXT && EXPERIMENTAL+ depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && (ARM || ARM26) default y if XIP_KERNEL help This allows MTD support to work with flash memory which is alsodiff -Naur linux26-cvs/drivers/mtd/chips/amd_flash.c linux26-new/drivers/mtd/chips/amd_flash.c--- linux26-cvs/drivers/mtd/chips/amd_flash.c 2005-08-25 12:05:58.000000000 -0500+++ linux26-new/drivers/mtd/chips/amd_flash.c 2005-08-25 14:09:02.000000000 -0500@@ -3,7 +3,7 @@ * * Author: Jonas Holmberg <jonas.holmberg@axis.com> *- * $Id: amd_flash.c,v 1.26 2004/11/20 12:49:04 dwmw2 Exp $+ * $Id: amd_flash.c,v 1.27 2005/02/04 07:43:09 jonashg Exp $ * * Copyright (c) 2001 Axis Communications AB *@@ -67,7 +67,6 @@ #define AM29LV160DT 0x22C4 #define AM29LV160DB 0x2249 #define AM29BDS323D 0x22D1-#define AM29BDS643D 0x227E /* Atmel */ #define AT49xV16x 0x00C0@@ -618,17 +617,6 @@ { .offset = 0x3f0000, .erasesize = 0x02000, .numblocks = 8 }, } }, {- .mfr_id = MANUFACTURER_AMD,- .dev_id = AM29BDS643D,- .name = "AMD AM29BDS643D",- .size = 0x00800000,- .numeraseregions = 3,- .regions = {- { .offset = 0x000000, .erasesize = 0x10000, .numblocks = 96 },- { .offset = 0x600000, .erasesize = 0x10000, .numblocks = 31 },- { .offset = 0x7f0000, .erasesize = 0x02000, .numblocks = 8 },- }- }, { .mfr_id = MANUFACTURER_ATMEL, .dev_id = AT49xV16x, .name = "Atmel AT49xV16x",diff -Naur linux26-cvs/drivers/mtd/chips/cfi_cmdset_0001.c linux26-new/drivers/mtd/chips/cfi_cmdset_0001.c--- linux26-cvs/drivers/mtd/chips/cfi_cmdset_0001.c 2005-08-25 12:05:58.000000000 -0500+++ linux26-new/drivers/mtd/chips/cfi_cmdset_0001.c 2005-08-25 14:09:02.000000000 -0500@@ -4,7 +4,7 @@ * * (C) 2000 Red Hat. GPL'd *- * $Id: cfi_cmdset_0001.c,v 1.164 2004/11/16 18:29:00 dwmw2 Exp $+ * $Id: cfi_cmdset_0001.c,v 1.183 2005/08/06 04:46:56 nico Exp $ * * * 10/10/2000 Nicolas Pitre <nico@cam.org>@@ -29,6 +29,7 @@ #include <linux/slab.h> #include <linux/delay.h> #include <linux/interrupt.h>+#include <linux/reboot.h> #include <linux/mtd/xip.h> #include <linux/mtd/map.h> #include <linux/mtd/mtd.h>@@ -48,16 +49,26 @@ #define M50LPW080 0x002F static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);-//static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);-//static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); static int cfi_intelext_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);+static int cfi_intelext_writev(struct mtd_info *, const struct kvec *, unsigned long, loff_t, size_t *); static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *); static void cfi_intelext_sync (struct mtd_info *); static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len); static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len);+#ifdef CONFIG_MTD_OTP+static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);+static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);+static int cfi_intelext_write_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);+static int cfi_intelext_lock_user_prot_reg (struct mtd_info *, loff_t, size_t);+static int cfi_intelext_get_fact_prot_info (struct mtd_info *,+ struct otp_info *, size_t);+static int cfi_intelext_get_user_prot_info (struct mtd_info *,+ struct otp_info *, size_t);+#endif static int cfi_intelext_suspend (struct mtd_info *); static void cfi_intelext_resume (struct mtd_info *);+static int cfi_intelext_reboot (struct notifier_block *, unsigned long, void *); static void cfi_intelext_destroy(struct mtd_info *); @@ -95,6 +106,7 @@ static void cfi_tell_features(struct cfi_pri_intelext *extp) { int i;+ printk(" Extended Query version %c.%c\n", extp->MajorVersion, extp->MinorVersion); printk(" Feature/Command Support: %4.4X\n", extp->FeatureSupport); printk(" - Chip Erase: %s\n", extp->FeatureSupport&1?"supported":"unsupported"); printk(" - Suspend Erase: %s\n", extp->FeatureSupport&2?"supported":"unsupported");@@ -106,7 +118,8 @@ printk(" - Page-mode read: %s\n", extp->FeatureSupport&128?"supported":"unsupported"); printk(" - Synchronous read: %s\n", extp->FeatureSupport&256?"supported":"unsupported"); printk(" - Simultaneous operations: %s\n", extp->FeatureSupport&512?"supported":"unsupported");- for (i=10; i<32; i++) {+ printk(" - Extended Flash Array: %s\n", extp->FeatureSupport&1024?"supported":"unsupported");+ for (i=11; i<32; i++) { if (extp->FeatureSupport & (1<<i)) printk(" - Unknown Bit %X: supported\n", i); }@@ -120,12 +133,18 @@ printk(" Block Status Register Mask: %4.4X\n", extp->BlkStatusRegMask); printk(" - Lock Bit Active: %s\n", extp->BlkStatusRegMask&1?"yes":"no");- printk(" - Valid Bit Active: %s\n", extp->BlkStatusRegMask&2?"yes":"no");- for (i=2; i<16; i++) {+ printk(" - Lock-Down Bit Active: %s\n", extp->BlkStatusRegMask&2?"yes":"no");+ for (i=2; i<3; i++) { if (extp->BlkStatusRegMask & (1<<i)) printk(" - Unknown Bit %X Active: yes\n",i); }- + printk(" - EFA Lock Bit: %s\n", extp->BlkStatusRegMask&16?"yes":"no");+ printk(" - EFA Lock-Down Bit: %s\n", extp->BlkStatusRegMask&32?"yes":"no");+ for (i=6; i<16; i++) {+ if (extp->BlkStatusRegMask & (1<<i))+ printk(" - Unknown Bit %X Active: yes\n",i);+ }+ printk(" Vcc Logic Supply Optimum Program/Erase Voltage: %d.%d V\n", extp->VccOptimal >> 4, extp->VccOptimal & 0xf); if (extp->VppOptimal)@@ -197,6 +216,7 @@ if (cfi->cfiq->BufWriteTimeoutTyp) { printk(KERN_INFO "Using buffer write method\n" ); mtd->write = cfi_intelext_write_buffers;+ mtd->writev = cfi_intelext_writev; } } @@ -242,20 +262,30 @@ if (!extp) return NULL; + if (extp->MajorVersion != '1' ||+ (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {+ printk(KERN_ERR " Unknown Intel/Sharp Extended Query "+ "version %c.%c.\n", extp->MajorVersion,+ extp->MinorVersion);+ kfree(extp);+ return NULL;+ }+ /* Do some byteswapping if necessary */ extp->FeatureSupport = le32_to_cpu(extp->FeatureSupport); extp->BlkStatusRegMask = le16_to_cpu(extp->BlkStatusRegMask); extp->ProtRegAddr = le16_to_cpu(extp->ProtRegAddr); - if (extp->MajorVersion == '1' && extp->MinorVersion == '3') {+ if (extp->MajorVersion == '1' && extp->MinorVersion >= '3') { unsigned int extra_size = 0; int nb_parts, i; /* Protection Register info */- extra_size += (extp->NumProtectionFields - 1) * (4 + 6);+ extra_size += (extp->NumProtectionFields - 1) *+ sizeof(struct cfi_intelext_otpinfo); /* Burst Read info */- extra_size += 6;+ extra_size += (extp->MinorVersion < '4') ? 6 : 5; /* Number of hardware-partitions */ extra_size += 1;@@ -263,6 +293,10 @@ goto need_more; nb_parts = extp->extra[extra_size - 1]; + /* skip the sizeof(partregion) field in CFI 1.4 */+ if (extp->MinorVersion >= '4')+ extra_size += 2;+ for (i = 0; i < nb_parts; i++) { struct cfi_intelext_regioninfo *rinfo;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -