diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 14:15:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 14:15:28 -0400 |
commit | 2c4aabcca847ac4c92aa5e960c3f6053e1051b62 (patch) | |
tree | 756481631c3375d6a1b07233013efa12d8aa3725 /drivers/mtd | |
parent | bcf35afb528109a31264b45d4851fa6ae72dbe18 (diff) | |
parent | a98889f3d8882995b5aa2255b931cf0202325cc0 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
[MTD][NOR] Add physical address to point() method
[JFFS2] Track parent inode for directories (for NFS export)
[JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.
[JFFS2] Quiet lockdep false positive.
[JFFS2] Clean up jffs2_alloc_inode() and jffs2_i_init_once()
[MTD] Delete long-unused jedec.h header file.
[MTD] [NAND] at91_nand: use at91_nand_{en,dis}able consistently.
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 14 | ||||
-rw-r--r-- | drivers/mtd/devices/mtdram.c | 11 | ||||
-rw-r--r-- | drivers/mtd/devices/phram.c | 13 | ||||
-rw-r--r-- | drivers/mtd/devices/pmc551.c | 27 | ||||
-rw-r--r-- | drivers/mtd/devices/slram.c | 15 | ||||
-rw-r--r-- | drivers/mtd/maps/uclinux.c | 6 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/at91_nand.c | 42 |
8 files changed, 78 insertions, 58 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e812df607a5c..fcd1aeccdf93 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -82,9 +82,8 @@ static struct mtd_info *cfi_intelext_setup (struct mtd_info *); | |||
82 | static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); | 82 | static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); |
83 | 83 | ||
84 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, | 84 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, |
85 | size_t *retlen, u_char **mtdbuf); | 85 | size_t *retlen, void **virt, resource_size_t *phys); |
86 | static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, | 86 | static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len); |
87 | size_t len); | ||
88 | 87 | ||
89 | static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); | 88 | static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); |
90 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); | 89 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); |
@@ -1240,7 +1239,8 @@ static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t a | |||
1240 | return ret; | 1239 | return ret; |
1241 | } | 1240 | } |
1242 | 1241 | ||
1243 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) | 1242 | static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, |
1243 | size_t *retlen, void **virt, resource_size_t *phys) | ||
1244 | { | 1244 | { |
1245 | struct map_info *map = mtd->priv; | 1245 | struct map_info *map = mtd->priv; |
1246 | struct cfi_private *cfi = map->fldrv_priv; | 1246 | struct cfi_private *cfi = map->fldrv_priv; |
@@ -1257,8 +1257,10 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si | |||
1257 | chipnum = (from >> cfi->chipshift); | 1257 | chipnum = (from >> cfi->chipshift); |
1258 | ofs = from - (chipnum << cfi->chipshift); | 1258 | ofs = from - (chipnum << cfi->chipshift); |
1259 | 1259 | ||
1260 | *mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs; | 1260 | *virt = map->virt + cfi->chips[chipnum].start + ofs; |
1261 | *retlen = 0; | 1261 | *retlen = 0; |
1262 | if (phys) | ||
1263 | *phys = map->phys + cfi->chips[chipnum].start + ofs; | ||
1262 | 1264 | ||
1263 | while (len) { | 1265 | while (len) { |
1264 | unsigned long thislen; | 1266 | unsigned long thislen; |
@@ -1291,7 +1293,7 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si | |||
1291 | return 0; | 1293 | return 0; |
1292 | } | 1294 | } |
1293 | 1295 | ||
1294 | static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 1296 | static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
1295 | { | 1297 | { |
1296 | struct map_info *map = mtd->priv; | 1298 | struct map_info *map = mtd->priv; |
1297 | struct cfi_private *cfi = map->fldrv_priv; | 1299 | struct cfi_private *cfi = map->fldrv_priv; |
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index bf485ff49457..0399be178620 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c | |||
@@ -48,18 +48,21 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, | 50 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, |
51 | size_t *retlen, u_char **mtdbuf) | 51 | size_t *retlen, void **virt, resource_size_t *phys) |
52 | { | 52 | { |
53 | if (from + len > mtd->size) | 53 | if (from + len > mtd->size) |
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | 55 | ||
56 | *mtdbuf = mtd->priv + from; | 56 | /* can we return a physical address with this driver? */ |
57 | if (phys) | ||
58 | return -EINVAL; | ||
59 | |||
60 | *virt = mtd->priv + from; | ||
57 | *retlen = len; | 61 | *retlen = len; |
58 | return 0; | 62 | return 0; |
59 | } | 63 | } |
60 | 64 | ||
61 | static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, | 65 | static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
62 | size_t len) | ||
63 | { | 66 | { |
64 | } | 67 | } |
65 | 68 | ||
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 5f960182da95..c7987b1c5e01 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c | |||
@@ -57,20 +57,21 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, | 59 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, |
60 | size_t *retlen, u_char **mtdbuf) | 60 | size_t *retlen, void **virt, resource_size_t *phys) |
61 | { | 61 | { |
62 | u_char *start = mtd->priv; | ||
63 | |||
64 | if (from + len > mtd->size) | 62 | if (from + len > mtd->size) |
65 | return -EINVAL; | 63 | return -EINVAL; |
66 | 64 | ||
67 | *mtdbuf = start + from; | 65 | /* can we return a physical address with this driver? */ |
66 | if (phys) | ||
67 | return -EINVAL; | ||
68 | |||
69 | *virt = mtd->priv + from; | ||
68 | *retlen = len; | 70 | *retlen = len; |
69 | return 0; | 71 | return 0; |
70 | } | 72 | } |
71 | 73 | ||
72 | static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, | 74 | static void phram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
73 | size_t len) | ||
74 | { | 75 | { |
75 | } | 76 | } |
76 | 77 | ||
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index 7060a0895ce2..bc9981749064 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c | |||
@@ -134,7 +134,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
134 | eoff_lo = end & (priv->asize - 1); | 134 | eoff_lo = end & (priv->asize - 1); |
135 | soff_lo = instr->addr & (priv->asize - 1); | 135 | soff_lo = instr->addr & (priv->asize - 1); |
136 | 136 | ||
137 | pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr); | 137 | pmc551_point(mtd, instr->addr, instr->len, &retlen, |
138 | (void **)&ptr, NULL); | ||
138 | 139 | ||
139 | if (soff_hi == eoff_hi || mtd->size == priv->asize) { | 140 | if (soff_hi == eoff_hi || mtd->size == priv->asize) { |
140 | /* The whole thing fits within one access, so just one shot | 141 | /* The whole thing fits within one access, so just one shot |
@@ -154,7 +155,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
154 | } | 155 | } |
155 | soff_hi += priv->asize; | 156 | soff_hi += priv->asize; |
156 | pmc551_point(mtd, (priv->base_map0 | soff_hi), | 157 | pmc551_point(mtd, (priv->base_map0 | soff_hi), |
157 | priv->asize, &retlen, &ptr); | 158 | priv->asize, &retlen, |
159 | (void **)&ptr, NULL); | ||
158 | } | 160 | } |
159 | memset(ptr, 0xff, eoff_lo); | 161 | memset(ptr, 0xff, eoff_lo); |
160 | } | 162 | } |
@@ -170,7 +172,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
170 | } | 172 | } |
171 | 173 | ||
172 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | 174 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, |
173 | size_t * retlen, u_char ** mtdbuf) | 175 | size_t *retlen, void **virt, resource_size_t *phys) |
174 | { | 176 | { |
175 | struct mypriv *priv = mtd->priv; | 177 | struct mypriv *priv = mtd->priv; |
176 | u32 soff_hi; | 178 | u32 soff_hi; |
@@ -188,6 +190,10 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
188 | return -EINVAL; | 190 | return -EINVAL; |
189 | } | 191 | } |
190 | 192 | ||
193 | /* can we return a physical address with this driver? */ | ||
194 | if (phys) | ||
195 | return -EINVAL; | ||
196 | |||
191 | soff_hi = from & ~(priv->asize - 1); | 197 | soff_hi = from & ~(priv->asize - 1); |
192 | soff_lo = from & (priv->asize - 1); | 198 | soff_lo = from & (priv->asize - 1); |
193 | 199 | ||
@@ -198,13 +204,12 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
198 | priv->curr_map0 = soff_hi; | 204 | priv->curr_map0 = soff_hi; |
199 | } | 205 | } |
200 | 206 | ||
201 | *mtdbuf = priv->start + soff_lo; | 207 | *virt = priv->start + soff_lo; |
202 | *retlen = len; | 208 | *retlen = len; |
203 | return 0; | 209 | return 0; |
204 | } | 210 | } |
205 | 211 | ||
206 | static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, | 212 | static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
207 | size_t len) | ||
208 | { | 213 | { |
209 | #ifdef CONFIG_MTD_PMC551_DEBUG | 214 | #ifdef CONFIG_MTD_PMC551_DEBUG |
210 | printk(KERN_DEBUG "pmc551_unpoint()\n"); | 215 | printk(KERN_DEBUG "pmc551_unpoint()\n"); |
@@ -242,7 +247,7 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
242 | soff_lo = from & (priv->asize - 1); | 247 | soff_lo = from & (priv->asize - 1); |
243 | eoff_lo = end & (priv->asize - 1); | 248 | eoff_lo = end & (priv->asize - 1); |
244 | 249 | ||
245 | pmc551_point(mtd, from, len, retlen, &ptr); | 250 | pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL); |
246 | 251 | ||
247 | if (soff_hi == eoff_hi) { | 252 | if (soff_hi == eoff_hi) { |
248 | /* The whole thing fits within one access, so just one shot | 253 | /* The whole thing fits within one access, so just one shot |
@@ -263,7 +268,8 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
263 | goto out; | 268 | goto out; |
264 | } | 269 | } |
265 | soff_hi += priv->asize; | 270 | soff_hi += priv->asize; |
266 | pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); | 271 | pmc551_point(mtd, soff_hi, priv->asize, retlen, |
272 | (void **)&ptr, NULL); | ||
267 | } | 273 | } |
268 | memcpy(copyto, ptr, eoff_lo); | 274 | memcpy(copyto, ptr, eoff_lo); |
269 | copyto += eoff_lo; | 275 | copyto += eoff_lo; |
@@ -308,7 +314,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
308 | soff_lo = to & (priv->asize - 1); | 314 | soff_lo = to & (priv->asize - 1); |
309 | eoff_lo = end & (priv->asize - 1); | 315 | eoff_lo = end & (priv->asize - 1); |
310 | 316 | ||
311 | pmc551_point(mtd, to, len, retlen, &ptr); | 317 | pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL); |
312 | 318 | ||
313 | if (soff_hi == eoff_hi) { | 319 | if (soff_hi == eoff_hi) { |
314 | /* The whole thing fits within one access, so just one shot | 320 | /* The whole thing fits within one access, so just one shot |
@@ -329,7 +335,8 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
329 | goto out; | 335 | goto out; |
330 | } | 336 | } |
331 | soff_hi += priv->asize; | 337 | soff_hi += priv->asize; |
332 | pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); | 338 | pmc551_point(mtd, soff_hi, priv->asize, retlen, |
339 | (void **)&ptr, NULL); | ||
333 | } | 340 | } |
334 | memcpy(ptr, copyfrom, eoff_lo); | 341 | memcpy(ptr, copyfrom, eoff_lo); |
335 | copyfrom += eoff_lo; | 342 | copyfrom += eoff_lo; |
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index d293add1857c..cb86db746f28 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
@@ -76,8 +76,9 @@ static char *map; | |||
76 | static slram_mtd_list_t *slram_mtdlist = NULL; | 76 | static slram_mtd_list_t *slram_mtdlist = NULL; |
77 | 77 | ||
78 | static int slram_erase(struct mtd_info *, struct erase_info *); | 78 | static int slram_erase(struct mtd_info *, struct erase_info *); |
79 | static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **); | 79 | static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **, |
80 | static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 80 | resource_size_t *); |
81 | static void slram_unpoint(struct mtd_info *, loff_t, size_t); | ||
81 | static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 82 | static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
82 | static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 83 | static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
83 | 84 | ||
@@ -104,19 +105,23 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
104 | } | 105 | } |
105 | 106 | ||
106 | static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, | 107 | static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, |
107 | size_t *retlen, u_char **mtdbuf) | 108 | size_t *retlen, void **virt, resource_size_t *phys) |
108 | { | 109 | { |
109 | slram_priv_t *priv = mtd->priv; | 110 | slram_priv_t *priv = mtd->priv; |
110 | 111 | ||
112 | /* can we return a physical address with this driver? */ | ||
113 | if (phys) | ||
114 | return -EINVAL; | ||
115 | |||
111 | if (from + len > mtd->size) | 116 | if (from + len > mtd->size) |
112 | return -EINVAL; | 117 | return -EINVAL; |
113 | 118 | ||
114 | *mtdbuf = priv->start + from; | 119 | *virt = priv->start + from; |
115 | *retlen = len; | 120 | *retlen = len; |
116 | return(0); | 121 | return(0); |
117 | } | 122 | } |
118 | 123 | ||
119 | static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 124 | static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
120 | { | 125 | { |
121 | } | 126 | } |
122 | 127 | ||
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index 14ffb1a9302a..c42f4b83f686 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
@@ -40,10 +40,12 @@ struct mtd_partition uclinux_romfs[] = { | |||
40 | /****************************************************************************/ | 40 | /****************************************************************************/ |
41 | 41 | ||
42 | int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, | 42 | int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, |
43 | size_t *retlen, u_char **mtdbuf) | 43 | size_t *retlen, void **virt, resource_size_t *phys) |
44 | { | 44 | { |
45 | struct map_info *map = mtd->priv; | 45 | struct map_info *map = mtd->priv; |
46 | *mtdbuf = (u_char *) (map->virt + ((int) from)); | 46 | *virt = map->virt + from; |
47 | if (phys) | ||
48 | *phys = map->phys + from; | ||
47 | *retlen = len; | 49 | *retlen = len; |
48 | return(0); | 50 | return(0); |
49 | } | 51 | } |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index c66902df3171..07c701169344 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -68,7 +68,7 @@ static int part_read (struct mtd_info *mtd, loff_t from, size_t len, | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static int part_point (struct mtd_info *mtd, loff_t from, size_t len, | 70 | static int part_point (struct mtd_info *mtd, loff_t from, size_t len, |
71 | size_t *retlen, u_char **buf) | 71 | size_t *retlen, void **virt, resource_size_t *phys) |
72 | { | 72 | { |
73 | struct mtd_part *part = PART(mtd); | 73 | struct mtd_part *part = PART(mtd); |
74 | if (from >= mtd->size) | 74 | if (from >= mtd->size) |
@@ -76,14 +76,14 @@ static int part_point (struct mtd_info *mtd, loff_t from, size_t len, | |||
76 | else if (from + len > mtd->size) | 76 | else if (from + len > mtd->size) |
77 | len = mtd->size - from; | 77 | len = mtd->size - from; |
78 | return part->master->point (part->master, from + part->offset, | 78 | return part->master->point (part->master, from + part->offset, |
79 | len, retlen, buf); | 79 | len, retlen, virt, phys); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 82 | static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
83 | { | 83 | { |
84 | struct mtd_part *part = PART(mtd); | 84 | struct mtd_part *part = PART(mtd); |
85 | 85 | ||
86 | part->master->unpoint (part->master, addr, from + part->offset, len); | 86 | part->master->unpoint(part->master, from + part->offset, len); |
87 | } | 87 | } |
88 | 88 | ||
89 | static int part_read_oob(struct mtd_info *mtd, loff_t from, | 89 | static int part_read_oob(struct mtd_info *mtd, loff_t from, |
diff --git a/drivers/mtd/nand/at91_nand.c b/drivers/mtd/nand/at91_nand.c index 414ceaecdb3a..0adb287027a2 100644 --- a/drivers/mtd/nand/at91_nand.c +++ b/drivers/mtd/nand/at91_nand.c | |||
@@ -94,6 +94,24 @@ struct at91_nand_host { | |||
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Enable NAND. | ||
98 | */ | ||
99 | static void at91_nand_enable(struct at91_nand_host *host) | ||
100 | { | ||
101 | if (host->board->enable_pin) | ||
102 | at91_set_gpio_value(host->board->enable_pin, 0); | ||
103 | } | ||
104 | |||
105 | /* | ||
106 | * Disable NAND. | ||
107 | */ | ||
108 | static void at91_nand_disable(struct at91_nand_host *host) | ||
109 | { | ||
110 | if (host->board->enable_pin) | ||
111 | at91_set_gpio_value(host->board->enable_pin, 1); | ||
112 | } | ||
113 | |||
114 | /* | ||
97 | * Hardware specific access to control-lines | 115 | * Hardware specific access to control-lines |
98 | */ | 116 | */ |
99 | static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | 117 | static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) |
@@ -101,11 +119,11 @@ static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) | |||
101 | struct nand_chip *nand_chip = mtd->priv; | 119 | struct nand_chip *nand_chip = mtd->priv; |
102 | struct at91_nand_host *host = nand_chip->priv; | 120 | struct at91_nand_host *host = nand_chip->priv; |
103 | 121 | ||
104 | if (host->board->enable_pin && (ctrl & NAND_CTRL_CHANGE)) { | 122 | if (ctrl & NAND_CTRL_CHANGE) { |
105 | if (ctrl & NAND_NCE) | 123 | if (ctrl & NAND_NCE) |
106 | at91_set_gpio_value(host->board->enable_pin, 0); | 124 | at91_nand_enable(host); |
107 | else | 125 | else |
108 | at91_set_gpio_value(host->board->enable_pin, 1); | 126 | at91_nand_disable(host); |
109 | } | 127 | } |
110 | if (cmd == NAND_CMD_NONE) | 128 | if (cmd == NAND_CMD_NONE) |
111 | return; | 129 | return; |
@@ -128,24 +146,6 @@ static int at91_nand_device_ready(struct mtd_info *mtd) | |||
128 | } | 146 | } |
129 | 147 | ||
130 | /* | 148 | /* |
131 | * Enable NAND. | ||
132 | */ | ||
133 | static void at91_nand_enable(struct at91_nand_host *host) | ||
134 | { | ||
135 | if (host->board->enable_pin) | ||
136 | at91_set_gpio_value(host->board->enable_pin, 0); | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Disable NAND. | ||
141 | */ | ||
142 | static void at91_nand_disable(struct at91_nand_host *host) | ||
143 | { | ||
144 | if (host->board->enable_pin) | ||
145 | at91_set_gpio_value(host->board->enable_pin, 1); | ||
146 | } | ||
147 | |||
148 | /* | ||
149 | * write oob for small pages | 149 | * write oob for small pages |
150 | */ | 150 | */ |
151 | static int at91_nand_write_oob_512(struct mtd_info *mtd, | 151 | static int at91_nand_write_oob_512(struct mtd_info *mtd, |