aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 14:49:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 14:49:21 -0400
commite8a89cebdbaab14caaa26debdb4ffd493b8831af (patch)
treee0843f082628408ce259c72db36da54dff603987 /drivers/mtd/chips
parent8196867c74890ccdf40a2b5e3e173597fbc4f9ac (diff)
parent6ae0185fe201eae0548dace2a84acb5050fc8606 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (79 commits) mtd: Remove obsolete <mtd/compatmac.h> include mtd: Update copyright notices jffs2: Update copyright notices mtd-physmap: add support users can assign the probe type in board files mtd: remove redwood map driver mxc_nand: Add v3 (i.MX51) Support mxc_nand: support 8bit ecc mxc_nand: fix correct_data function mxc_nand: add V1_V2 namespace to registers mxc_nand: factor out a check_int function mxc_nand: make some internally used functions overwriteable mxc_nand: rework get_dev_status mxc_nand: remove 0xe00 offset from registers mtd: denali: Add multi connected NAND support mtd: denali: Remove set_ecc_config function mtd: denali: Remove unuseful code in get_xx_nand_para functions mtd: denali: Remove device_info_tag structure mtd: m25p80: add support for the Winbond W25Q32 SPI flash chip mtd: m25p80: add support for the Intel/Numonyx {16,32,64}0S33B SPI flash chips mtd: m25p80: add support for the EON EN25P{32, 64} SPI flash chips ... Fix up trivial conflicts in drivers/mtd/maps/{Kconfig,redwood.c} due to redwood driver removal.
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c31
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c17
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c1
-rw-r--r--drivers/mtd/chips/cfi_probe.c4
-rw-r--r--drivers/mtd/chips/cfi_util.c1
-rw-r--r--drivers/mtd/chips/chipreg.c1
-rw-r--r--drivers/mtd/chips/map_absent.c1
-rw-r--r--drivers/mtd/chips/map_ram.c1
-rw-r--r--drivers/mtd/chips/map_rom.c1
9 files changed, 35 insertions, 23 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 62f3ea9de848..9e2b7e9e0ad9 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -34,7 +34,6 @@
34#include <linux/mtd/xip.h> 34#include <linux/mtd/xip.h>
35#include <linux/mtd/map.h> 35#include <linux/mtd/map.h>
36#include <linux/mtd/mtd.h> 36#include <linux/mtd/mtd.h>
37#include <linux/mtd/compatmac.h>
38#include <linux/mtd/cfi.h> 37#include <linux/mtd/cfi.h>
39 38
40/* #define CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE */ 39/* #define CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE */
@@ -63,6 +62,8 @@ static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *);
63static void cfi_intelext_sync (struct mtd_info *); 62static void cfi_intelext_sync (struct mtd_info *);
64static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 63static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
65static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 64static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
65static int cfi_intelext_is_locked(struct mtd_info *mtd, loff_t ofs,
66 uint64_t len);
66#ifdef CONFIG_MTD_OTP 67#ifdef CONFIG_MTD_OTP
67static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 68static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
68static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 69static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
@@ -448,6 +449,7 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
448 mtd->sync = cfi_intelext_sync; 449 mtd->sync = cfi_intelext_sync;
449 mtd->lock = cfi_intelext_lock; 450 mtd->lock = cfi_intelext_lock;
450 mtd->unlock = cfi_intelext_unlock; 451 mtd->unlock = cfi_intelext_unlock;
452 mtd->is_locked = cfi_intelext_is_locked;
451 mtd->suspend = cfi_intelext_suspend; 453 mtd->suspend = cfi_intelext_suspend;
452 mtd->resume = cfi_intelext_resume; 454 mtd->resume = cfi_intelext_resume;
453 mtd->flags = MTD_CAP_NORFLASH; 455 mtd->flags = MTD_CAP_NORFLASH;
@@ -717,7 +719,7 @@ static int cfi_intelext_partition_fixup(struct mtd_info *mtd,
717 chip = &newcfi->chips[0]; 719 chip = &newcfi->chips[0];
718 for (i = 0; i < cfi->numchips; i++) { 720 for (i = 0; i < cfi->numchips; i++) {
719 shared[i].writing = shared[i].erasing = NULL; 721 shared[i].writing = shared[i].erasing = NULL;
720 spin_lock_init(&shared[i].lock); 722 mutex_init(&shared[i].lock);
721 for (j = 0; j < numparts; j++) { 723 for (j = 0; j < numparts; j++) {
722 *chip = cfi->chips[i]; 724 *chip = cfi->chips[i];
723 chip->start += j << partshift; 725 chip->start += j << partshift;
@@ -886,7 +888,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
886 */ 888 */
887 struct flchip_shared *shared = chip->priv; 889 struct flchip_shared *shared = chip->priv;
888 struct flchip *contender; 890 struct flchip *contender;
889 spin_lock(&shared->lock); 891 mutex_lock(&shared->lock);
890 contender = shared->writing; 892 contender = shared->writing;
891 if (contender && contender != chip) { 893 if (contender && contender != chip) {
892 /* 894 /*
@@ -899,7 +901,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
899 * get_chip returns success we're clear to go ahead. 901 * get_chip returns success we're clear to go ahead.
900 */ 902 */
901 ret = mutex_trylock(&contender->mutex); 903 ret = mutex_trylock(&contender->mutex);
902 spin_unlock(&shared->lock); 904 mutex_unlock(&shared->lock);
903 if (!ret) 905 if (!ret)
904 goto retry; 906 goto retry;
905 mutex_unlock(&chip->mutex); 907 mutex_unlock(&chip->mutex);
@@ -914,7 +916,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
914 mutex_unlock(&contender->mutex); 916 mutex_unlock(&contender->mutex);
915 return ret; 917 return ret;
916 } 918 }
917 spin_lock(&shared->lock); 919 mutex_lock(&shared->lock);
918 920
919 /* We should not own chip if it is already 921 /* We should not own chip if it is already
920 * in FL_SYNCING state. Put contender and retry. */ 922 * in FL_SYNCING state. Put contender and retry. */
@@ -930,7 +932,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
930 * on this chip. Sleep. */ 932 * on this chip. Sleep. */
931 if (mode == FL_ERASING && shared->erasing 933 if (mode == FL_ERASING && shared->erasing
932 && shared->erasing->oldstate == FL_ERASING) { 934 && shared->erasing->oldstate == FL_ERASING) {
933 spin_unlock(&shared->lock); 935 mutex_unlock(&shared->lock);
934 set_current_state(TASK_UNINTERRUPTIBLE); 936 set_current_state(TASK_UNINTERRUPTIBLE);
935 add_wait_queue(&chip->wq, &wait); 937 add_wait_queue(&chip->wq, &wait);
936 mutex_unlock(&chip->mutex); 938 mutex_unlock(&chip->mutex);
@@ -944,7 +946,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
944 shared->writing = chip; 946 shared->writing = chip;
945 if (mode == FL_ERASING) 947 if (mode == FL_ERASING)
946 shared->erasing = chip; 948 shared->erasing = chip;
947 spin_unlock(&shared->lock); 949 mutex_unlock(&shared->lock);
948 } 950 }
949 ret = chip_ready(map, chip, adr, mode); 951 ret = chip_ready(map, chip, adr, mode);
950 if (ret == -EAGAIN) 952 if (ret == -EAGAIN)
@@ -959,7 +961,7 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long ad
959 961
960 if (chip->priv) { 962 if (chip->priv) {
961 struct flchip_shared *shared = chip->priv; 963 struct flchip_shared *shared = chip->priv;
962 spin_lock(&shared->lock); 964 mutex_lock(&shared->lock);
963 if (shared->writing == chip && chip->oldstate == FL_READY) { 965 if (shared->writing == chip && chip->oldstate == FL_READY) {
964 /* We own the ability to write, but we're done */ 966 /* We own the ability to write, but we're done */
965 shared->writing = shared->erasing; 967 shared->writing = shared->erasing;
@@ -967,7 +969,7 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long ad
967 /* give back ownership to who we loaned it from */ 969 /* give back ownership to who we loaned it from */
968 struct flchip *loaner = shared->writing; 970 struct flchip *loaner = shared->writing;
969 mutex_lock(&loaner->mutex); 971 mutex_lock(&loaner->mutex);
970 spin_unlock(&shared->lock); 972 mutex_unlock(&shared->lock);
971 mutex_unlock(&chip->mutex); 973 mutex_unlock(&chip->mutex);
972 put_chip(map, loaner, loaner->start); 974 put_chip(map, loaner, loaner->start);
973 mutex_lock(&chip->mutex); 975 mutex_lock(&chip->mutex);
@@ -985,11 +987,11 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long ad
985 * Don't let the switch below mess things up since 987 * Don't let the switch below mess things up since
986 * we don't have ownership to resume anything. 988 * we don't have ownership to resume anything.
987 */ 989 */
988 spin_unlock(&shared->lock); 990 mutex_unlock(&shared->lock);
989 wake_up(&chip->wq); 991 wake_up(&chip->wq);
990 return; 992 return;
991 } 993 }
992 spin_unlock(&shared->lock); 994 mutex_unlock(&shared->lock);
993 } 995 }
994 996
995 switch(chip->oldstate) { 997 switch(chip->oldstate) {
@@ -2139,6 +2141,13 @@ static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
2139 return ret; 2141 return ret;
2140} 2142}
2141 2143
2144static int cfi_intelext_is_locked(struct mtd_info *mtd, loff_t ofs,
2145 uint64_t len)
2146{
2147 return cfi_varsize_frob(mtd, do_getlockstatus_oneblock,
2148 ofs, len, NULL) ? 1 : 0;
2149}
2150
2142#ifdef CONFIG_MTD_OTP 2151#ifdef CONFIG_MTD_OTP
2143 2152
2144typedef int (*otp_op_t)(struct map_info *map, struct flchip *chip, 2153typedef int (*otp_op_t)(struct map_info *map, struct flchip *chip,
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index d81079ef91a5..3e6c47bdce53 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -33,7 +33,6 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/reboot.h> 35#include <linux/reboot.h>
36#include <linux/mtd/compatmac.h>
37#include <linux/mtd/map.h> 36#include <linux/mtd/map.h>
38#include <linux/mtd/mtd.h> 37#include <linux/mtd/mtd.h>
39#include <linux/mtd/cfi.h> 38#include <linux/mtd/cfi.h>
@@ -417,16 +416,26 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
417 */ 416 */
418 cfi_fixup_major_minor(cfi, extp); 417 cfi_fixup_major_minor(cfi, extp);
419 418
419 /*
420 * Valid primary extension versions are: 1.0, 1.1, 1.2, 1.3, 1.4
421 * see: http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_r20.pdf, page 19
422 * http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_100_20011201.pdf
423 * http://www.spansion.com/Support/Datasheets/s29ws-p_00_a12_e.pdf
424 */
420 if (extp->MajorVersion != '1' || 425 if (extp->MajorVersion != '1' ||
421 (extp->MinorVersion < '0' || extp->MinorVersion > '4')) { 426 (extp->MajorVersion == '1' && (extp->MinorVersion < '0' || extp->MinorVersion > '4'))) {
422 printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query " 427 printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query "
423 "version %c.%c.\n", extp->MajorVersion, 428 "version %c.%c (%#02x/%#02x).\n",
424 extp->MinorVersion); 429 extp->MajorVersion, extp->MinorVersion,
430 extp->MajorVersion, extp->MinorVersion);
425 kfree(extp); 431 kfree(extp);
426 kfree(mtd); 432 kfree(mtd);
427 return NULL; 433 return NULL;
428 } 434 }
429 435
436 printk(KERN_INFO " Amd/Fujitsu Extended Query version %c.%c.\n",
437 extp->MajorVersion, extp->MinorVersion);
438
430 /* Install our own private info structure */ 439 /* Install our own private info structure */
431 cfi->cmdset_priv = extp; 440 cfi->cmdset_priv = extp;
432 441
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index e54e8c169d76..314af1f5a370 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -33,7 +33,6 @@
33#include <linux/mtd/map.h> 33#include <linux/mtd/map.h>
34#include <linux/mtd/cfi.h> 34#include <linux/mtd/cfi.h>
35#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
36#include <linux/mtd/compatmac.h>
37 36
38 37
39static int cfi_staa_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); 38static int cfi_staa_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index b2acd32f4fbf..8f5b96aa87a0 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -235,9 +235,9 @@ static int __xipram cfi_chip_setup(struct map_info *map,
235 cfi_qry_mode_off(base, map, cfi); 235 cfi_qry_mode_off(base, map, cfi);
236 xip_allowed(base, map); 236 xip_allowed(base, map);
237 237
238 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n", 238 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank. Manufacturer ID %#08x Chip ID %#08x\n",
239 map->name, cfi->interleave, cfi->device_type*8, base, 239 map->name, cfi->interleave, cfi->device_type*8, base,
240 map->bankwidth*8); 240 map->bankwidth*8, cfi->mfr, cfi->id);
241 241
242 return 1; 242 return 1;
243} 243}
diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
index d7c2c672757e..e503b2ca894d 100644
--- a/drivers/mtd/chips/cfi_util.c
+++ b/drivers/mtd/chips/cfi_util.c
@@ -22,7 +22,6 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/map.h> 23#include <linux/mtd/map.h>
24#include <linux/mtd/cfi.h> 24#include <linux/mtd/cfi.h>
25#include <linux/mtd/compatmac.h>
26 25
27int __xipram cfi_qry_present(struct map_info *map, __u32 base, 26int __xipram cfi_qry_present(struct map_info *map, __u32 base,
28 struct cfi_private *cfi) 27 struct cfi_private *cfi)
diff --git a/drivers/mtd/chips/chipreg.c b/drivers/mtd/chips/chipreg.c
index c85760968227..da1f96f385c7 100644
--- a/drivers/mtd/chips/chipreg.c
+++ b/drivers/mtd/chips/chipreg.c
@@ -10,7 +10,6 @@
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/mtd/map.h> 11#include <linux/mtd/map.h>
12#include <linux/mtd/mtd.h> 12#include <linux/mtd/mtd.h>
13#include <linux/mtd/compatmac.h>
14 13
15static DEFINE_SPINLOCK(chip_drvs_lock); 14static DEFINE_SPINLOCK(chip_drvs_lock);
16static LIST_HEAD(chip_drvs_list); 15static LIST_HEAD(chip_drvs_list);
diff --git a/drivers/mtd/chips/map_absent.c b/drivers/mtd/chips/map_absent.c
index 494d30d0631a..f2b872946871 100644
--- a/drivers/mtd/chips/map_absent.c
+++ b/drivers/mtd/chips/map_absent.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
27#include <linux/mtd/map.h> 27#include <linux/mtd/map.h>
28#include <linux/mtd/compatmac.h>
29 28
30static int map_absent_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 29static int map_absent_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
31static int map_absent_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 30static int map_absent_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
diff --git a/drivers/mtd/chips/map_ram.c b/drivers/mtd/chips/map_ram.c
index 6bdc50c727e7..67640ccb2d41 100644
--- a/drivers/mtd/chips/map_ram.c
+++ b/drivers/mtd/chips/map_ram.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/mtd/mtd.h> 14#include <linux/mtd/mtd.h>
15#include <linux/mtd/map.h> 15#include <linux/mtd/map.h>
16#include <linux/mtd/compatmac.h>
17 16
18 17
19static int mapram_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 18static int mapram_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c
index 076090a67b90..593f73d480d2 100644
--- a/drivers/mtd/chips/map_rom.c
+++ b/drivers/mtd/chips/map_rom.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/mtd/mtd.h> 14#include <linux/mtd/mtd.h>
15#include <linux/mtd/map.h> 15#include <linux/mtd/map.h>
16#include <linux/mtd/compatmac.h>
17 16
18static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 17static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
19static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 18static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);