aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2008-12-10 08:37:21 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-12-10 08:37:21 -0500
commit69423d99fc182a81f3c5db3eb5c140acc6fc64be (patch)
tree5f1818e6fb69388f0da276152646bf0597e318c0 /drivers/mtd/chips
parent8a4c2495b142fe612b291a810d9e695f269c26db (diff)
[MTD] update internal API to support 64-bit device size
MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. Extending the external API is a separate issue for several reasons. First, no one needs it at the moment. Secondly, whether the implementation is done with IOCTLs, sysfs or both is still debated. Thirdly external API changes require the internal API to be accepted first. Note that although the MTD API will be able to support 64-bit device sizes, existing drivers do not and are not required to do so, although NAND base has been updated. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats - division and modulus of 64-bit values - NAND base support - 32-bit local variables used by mtdpart and mtdconcat - naughtily assuming one structure maps to another in MEMERASE ioctl Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c12
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c8
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c14
-rw-r--r--drivers/mtd/chips/fwh_lock.h4
4 files changed, 19 insertions, 19 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index c93a8be5d5f1..f5ab6fa1057b 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -58,8 +58,8 @@ static int cfi_intelext_write_buffers(struct mtd_info *, loff_t, size_t, size_t
58static int cfi_intelext_writev(struct mtd_info *, const struct kvec *, unsigned long, loff_t, size_t *); 58static int cfi_intelext_writev(struct mtd_info *, const struct kvec *, unsigned long, loff_t, size_t *);
59static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *); 59static int cfi_intelext_erase_varsize(struct mtd_info *, struct erase_info *);
60static void cfi_intelext_sync (struct mtd_info *); 60static void cfi_intelext_sync (struct mtd_info *);
61static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len); 61static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
62static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len); 62static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
63#ifdef CONFIG_MTD_OTP 63#ifdef CONFIG_MTD_OTP
64static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 64static int cfi_intelext_read_fact_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
65static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *); 65static int cfi_intelext_read_user_prot_reg (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
@@ -558,8 +558,8 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
558 } 558 }
559 559
560 for (i=0; i<mtd->numeraseregions;i++){ 560 for (i=0; i<mtd->numeraseregions;i++){
561 printk(KERN_DEBUG "erase region %d: offset=0x%x,size=0x%x,blocks=%d\n", 561 printk(KERN_DEBUG "erase region %d: offset=0x%llx,size=0x%x,blocks=%d\n",
562 i,mtd->eraseregions[i].offset, 562 i,(unsigned long long)mtd->eraseregions[i].offset,
563 mtd->eraseregions[i].erasesize, 563 mtd->eraseregions[i].erasesize,
564 mtd->eraseregions[i].numblocks); 564 mtd->eraseregions[i].numblocks);
565 } 565 }
@@ -2058,7 +2058,7 @@ out: put_chip(map, chip, adr);
2058 return ret; 2058 return ret;
2059} 2059}
2060 2060
2061static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len) 2061static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
2062{ 2062{
2063 int ret; 2063 int ret;
2064 2064
@@ -2082,7 +2082,7 @@ static int cfi_intelext_lock(struct mtd_info *mtd, loff_t ofs, size_t len)
2082 return ret; 2082 return ret;
2083} 2083}
2084 2084
2085static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) 2085static int cfi_intelext_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
2086{ 2086{
2087 int ret; 2087 int ret;
2088 2088
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index d74ec46aa032..f9c435a42670 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -71,8 +71,8 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
71static void put_chip(struct map_info *map, struct flchip *chip, unsigned long adr); 71static void put_chip(struct map_info *map, struct flchip *chip, unsigned long adr);
72#include "fwh_lock.h" 72#include "fwh_lock.h"
73 73
74static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, size_t len); 74static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
75static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, size_t len); 75static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
76 76
77static struct mtd_chip_driver cfi_amdstd_chipdrv = { 77static struct mtd_chip_driver cfi_amdstd_chipdrv = {
78 .probe = NULL, /* Not usable directly */ 78 .probe = NULL, /* Not usable directly */
@@ -1774,12 +1774,12 @@ out_unlock:
1774 return ret; 1774 return ret;
1775} 1775}
1776 1776
1777static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, size_t len) 1777static int cfi_atmel_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
1778{ 1778{
1779 return cfi_varsize_frob(mtd, do_atmel_lock, ofs, len, NULL); 1779 return cfi_varsize_frob(mtd, do_atmel_lock, ofs, len, NULL);
1780} 1780}
1781 1781
1782static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) 1782static int cfi_atmel_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
1783{ 1783{
1784 return cfi_varsize_frob(mtd, do_atmel_unlock, ofs, len, NULL); 1784 return cfi_varsize_frob(mtd, do_atmel_unlock, ofs, len, NULL);
1785} 1785}
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index d4714dd9f7ab..6c740f346f91 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -42,8 +42,8 @@ static int cfi_staa_writev(struct mtd_info *mtd, const struct kvec *vecs,
42 unsigned long count, loff_t to, size_t *retlen); 42 unsigned long count, loff_t to, size_t *retlen);
43static int cfi_staa_erase_varsize(struct mtd_info *, struct erase_info *); 43static int cfi_staa_erase_varsize(struct mtd_info *, struct erase_info *);
44static void cfi_staa_sync (struct mtd_info *); 44static void cfi_staa_sync (struct mtd_info *);
45static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, size_t len); 45static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
46static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, size_t len); 46static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
47static int cfi_staa_suspend (struct mtd_info *); 47static int cfi_staa_suspend (struct mtd_info *);
48static void cfi_staa_resume (struct mtd_info *); 48static void cfi_staa_resume (struct mtd_info *);
49 49
@@ -221,8 +221,8 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
221 } 221 }
222 222
223 for (i=0; i<mtd->numeraseregions;i++){ 223 for (i=0; i<mtd->numeraseregions;i++){
224 printk(KERN_DEBUG "%d: offset=0x%x,size=0x%x,blocks=%d\n", 224 printk(KERN_DEBUG "%d: offset=0x%llx,size=0x%x,blocks=%d\n",
225 i,mtd->eraseregions[i].offset, 225 i, (unsigned long long)mtd->eraseregions[i].offset,
226 mtd->eraseregions[i].erasesize, 226 mtd->eraseregions[i].erasesize,
227 mtd->eraseregions[i].numblocks); 227 mtd->eraseregions[i].numblocks);
228 } 228 }
@@ -964,7 +964,7 @@ static int cfi_staa_erase_varsize(struct mtd_info *mtd,
964 adr += regions[i].erasesize; 964 adr += regions[i].erasesize;
965 len -= regions[i].erasesize; 965 len -= regions[i].erasesize;
966 966
967 if (adr % (1<< cfi->chipshift) == ((regions[i].offset + (regions[i].erasesize * regions[i].numblocks)) %( 1<< cfi->chipshift))) 967 if (adr % (1<< cfi->chipshift) == (((unsigned long)regions[i].offset + (regions[i].erasesize * regions[i].numblocks)) %( 1<< cfi->chipshift)))
968 i++; 968 i++;
969 969
970 if (adr >> cfi->chipshift) { 970 if (adr >> cfi->chipshift) {
@@ -1135,7 +1135,7 @@ retry:
1135 spin_unlock_bh(chip->mutex); 1135 spin_unlock_bh(chip->mutex);
1136 return 0; 1136 return 0;
1137} 1137}
1138static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, size_t len) 1138static int cfi_staa_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
1139{ 1139{
1140 struct map_info *map = mtd->priv; 1140 struct map_info *map = mtd->priv;
1141 struct cfi_private *cfi = map->fldrv_priv; 1141 struct cfi_private *cfi = map->fldrv_priv;
@@ -1284,7 +1284,7 @@ retry:
1284 spin_unlock_bh(chip->mutex); 1284 spin_unlock_bh(chip->mutex);
1285 return 0; 1285 return 0;
1286} 1286}
1287static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) 1287static int cfi_staa_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
1288{ 1288{
1289 struct map_info *map = mtd->priv; 1289 struct map_info *map = mtd->priv;
1290 struct cfi_private *cfi = map->fldrv_priv; 1290 struct cfi_private *cfi = map->fldrv_priv;
diff --git a/drivers/mtd/chips/fwh_lock.h b/drivers/mtd/chips/fwh_lock.h
index ab44f2b996f8..57e0e4e921f9 100644
--- a/drivers/mtd/chips/fwh_lock.h
+++ b/drivers/mtd/chips/fwh_lock.h
@@ -77,7 +77,7 @@ static int fwh_xxlock_oneblock(struct map_info *map, struct flchip *chip,
77} 77}
78 78
79 79
80static int fwh_lock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len) 80static int fwh_lock_varsize(struct mtd_info *mtd, loff_t ofs, uint64_t len)
81{ 81{
82 int ret; 82 int ret;
83 83
@@ -88,7 +88,7 @@ static int fwh_lock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len)
88} 88}
89 89
90 90
91static int fwh_unlock_varsize(struct mtd_info *mtd, loff_t ofs, size_t len) 91static int fwh_unlock_varsize(struct mtd_info *mtd, loff_t ofs, uint64_t len)
92{ 92{
93 int ret; 93 int ret;
94 94