blob: d25535279404a7b7d101692b3f5c3f262cd0626e [file] [log] [blame]
Thomas Gleixner1f948b42005-11-07 11:15:37 +00001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 Common Flash Interface probe code.
3 (C) 2000 Red Hat. GPL'd.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004*/
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <linux/module.h>
7#include <linux/types.h>
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <asm/io.h>
11#include <asm/byteorder.h>
12#include <linux/errno.h>
13#include <linux/slab.h>
14#include <linux/interrupt.h>
15
16#include <linux/mtd/xip.h>
17#include <linux/mtd/map.h>
18#include <linux/mtd/cfi.h>
19#include <linux/mtd/gen_probe.h>
20
Thomas Gleixner1f948b42005-11-07 11:15:37 +000021//#define DEBUG_CFI
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23#ifdef DEBUG_CFI
24static void print_cfi_ident(struct cfi_ident *);
25#endif
26
27static int cfi_probe_chip(struct map_info *map, __u32 base,
28 unsigned long *chip_map, struct cfi_private *cfi);
29static int cfi_chip_setup(struct map_info *map, struct cfi_private *cfi);
30
31struct mtd_info *cfi_probe(struct map_info *map);
32
33#ifdef CONFIG_MTD_XIP
34
35/* only needed for short periods, so this is rather simple */
36#define xip_disable() local_irq_disable()
37
38#define xip_allowed(base, map) \
39do { \
40 (void) map_read(map, base); \
Paulius Zaleckasca5c23c2008-02-27 01:42:39 +020041 xip_iprefetch(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 local_irq_enable(); \
43} while (0)
44
45#define xip_enable(base, map, cfi) \
46do { \
David Woodhousec314dfd2008-08-07 11:55:07 +010047 cfi_qry_mode_off(base, map, cfi); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 xip_allowed(base, map); \
49} while (0)
50
51#define xip_disable_qry(base, map, cfi) \
52do { \
53 xip_disable(); \
David Woodhousec314dfd2008-08-07 11:55:07 +010054 cfi_qry_mode_on(base, map, cfi); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070055} while (0)
56
57#else
58
59#define xip_disable() do { } while (0)
60#define xip_allowed(base, map) do { } while (0)
61#define xip_enable(base, map, cfi) do { } while (0)
62#define xip_disable_qry(base, map, cfi) do { } while (0)
63
64#endif
65
66/* check for QRY.
67 in: interleave,type,mode
68 ret: table index, <0 for error
69 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
71static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
72 unsigned long *chip_map, struct cfi_private *cfi)
73{
74 int i;
Thomas Gleixner1f948b42005-11-07 11:15:37 +000075
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 if ((base + 0) >= map->size) {
77 printk(KERN_NOTICE
78 "Probe at base[0x00](0x%08lx) past the end of the map(0x%08lx)\n",
79 (unsigned long)base, map->size -1);
80 return 0;
81 }
82 if ((base + 0xff) >= map->size) {
83 printk(KERN_NOTICE
84 "Probe at base[0x55](0x%08lx) past the end of the map(0x%08lx)\n",
85 (unsigned long)base + 0x55, map->size -1);
86 return 0;
87 }
88
89 xip_disable();
David Woodhousec314dfd2008-08-07 11:55:07 +010090 if (!cfi_qry_mode_on(base, map, cfi)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 xip_enable(base, map, cfi);
92 return 0;
93 }
94
95 if (!cfi->numchips) {
Thomas Gleixner1f948b42005-11-07 11:15:37 +000096 /* This is the first time we're called. Set up the CFI
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 stuff accordingly and return */
98 return cfi_chip_setup(map, cfi);
99 }
100
101 /* Check each previous chip to see if it's an alias */
102 for (i=0; i < (base >> cfi->chipshift); i++) {
103 unsigned long start;
104 if(!test_bit(i, chip_map)) {
105 /* Skip location; no valid chip at this address */
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000106 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 }
108 start = i << cfi->chipshift;
109 /* This chip should be in read mode if it's one
110 we've already touched. */
David Woodhousec314dfd2008-08-07 11:55:07 +0100111 if (cfi_qry_present(map, start, cfi)) {
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000112 /* Eep. This chip also had the QRY marker.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 * Is it an alias for the new one? */
David Woodhousec314dfd2008-08-07 11:55:07 +0100114 cfi_qry_mode_off(start, map, cfi);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
116 /* If the QRY marker goes away, it's an alias */
David Woodhousec314dfd2008-08-07 11:55:07 +0100117 if (!cfi_qry_present(map, start, cfi)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 xip_allowed(base, map);
119 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
120 map->name, base, start);
121 return 0;
122 }
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000123 /* Yes, it's actually got QRY for data. Most
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 * unfortunate. Stick the new chip in read mode
125 * too and if it's the same, assume it's an alias. */
126 /* FIXME: Use other modes to do a proper check */
David Woodhousec314dfd2008-08-07 11:55:07 +0100127 cfi_qry_mode_off(base, map, cfi);
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000128
David Woodhousec314dfd2008-08-07 11:55:07 +0100129 if (cfi_qry_present(map, base, cfi)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 xip_allowed(base, map);
131 printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
132 map->name, base, start);
133 return 0;
134 }
135 }
136 }
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 /* OK, if we got to here, then none of the previous chips appear to
139 be aliases for the current one. */
140 set_bit((base >> cfi->chipshift), chip_map); /* Update chip map */
141 cfi->numchips++;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000142
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 /* Put it back into Read Mode */
David Woodhousec314dfd2008-08-07 11:55:07 +0100144 cfi_qry_mode_off(base, map, cfi);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 xip_allowed(base, map);
146
147 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
148 map->name, cfi->interleave, cfi->device_type*8, base,
149 map->bankwidth*8);
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000150
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 return 1;
152}
153
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000154static int __xipram cfi_chip_setup(struct map_info *map,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 struct cfi_private *cfi)
156{
157 int ofs_factor = cfi->interleave*cfi->device_type;
158 __u32 base = 0;
159 int num_erase_regions = cfi_read_query(map, base + (0x10 + 28)*ofs_factor);
160 int i;
Guillaume LECERFad7026f2010-04-24 17:57:57 +0200161 int addr_unlock1 = 0x555, addr_unlock2 = 0x2AA;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162
163 xip_enable(base, map, cfi);
164#ifdef DEBUG_CFI
165 printk("Number of erase regions: %d\n", num_erase_regions);
166#endif
167 if (!num_erase_regions)
168 return 0;
169
170 cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
171 if (!cfi->cfiq) {
172 printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
173 return 0;
174 }
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000175
176 memset(cfi->cfiq,0,sizeof(struct cfi_ident));
177
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178 cfi->cfi_mode = CFI_MODE_CFI;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000179
Guillaume LECERF08968042010-10-26 10:45:23 +0100180 cfi->sector_erase_cmd = CMD(0x30);
181
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 /* Read the CFI info structure */
183 xip_disable_qry(base, map, cfi);
184 for (i=0; i<(sizeof(struct cfi_ident) + num_erase_regions * 4); i++)
185 ((unsigned char *)cfi->cfiq)[i] = cfi_read_query(map,base + (0x10 + i)*ofs_factor);
186
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 /* Do any necessary byteswapping */
188 cfi->cfiq->P_ID = le16_to_cpu(cfi->cfiq->P_ID);
189
190 cfi->cfiq->P_ADR = le16_to_cpu(cfi->cfiq->P_ADR);
191 cfi->cfiq->A_ID = le16_to_cpu(cfi->cfiq->A_ID);
192 cfi->cfiq->A_ADR = le16_to_cpu(cfi->cfiq->A_ADR);
193 cfi->cfiq->InterfaceDesc = le16_to_cpu(cfi->cfiq->InterfaceDesc);
194 cfi->cfiq->MaxBufWriteSize = le16_to_cpu(cfi->cfiq->MaxBufWriteSize);
195
196#ifdef DEBUG_CFI
197 /* Dump the information therein */
198 print_cfi_ident(cfi->cfiq);
199#endif
200
201 for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
202 cfi->cfiq->EraseRegionInfo[i] = le32_to_cpu(cfi->cfiq->EraseRegionInfo[i]);
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000203
204#ifdef DEBUG_CFI
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 printk(" Erase Region #%d: BlockSize 0x%4.4X bytes, %d blocks\n",
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000206 i, (cfi->cfiq->EraseRegionInfo[i] >> 8) & ~0xff,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 (cfi->cfiq->EraseRegionInfo[i] & 0xffff) + 1);
208#endif
209 }
210
Guillaume LECERF54b93a42010-04-24 17:58:02 +0200211 if (cfi->cfiq->P_ID == P_ID_SST_OLD) {
212 addr_unlock1 = 0x5555;
213 addr_unlock2 = 0x2AAA;
214 }
215
Guillaume LECERF84730442010-04-24 17:57:52 +0200216 /*
217 * Note we put the device back into Read Mode BEFORE going into Auto
218 * Select Mode, as some devices support nesting of modes, others
219 * don't. This way should always work.
220 * On cmdset 0001 the writes of 0xaa and 0x55 are not needed, and
221 * so should be treated as nops or illegal (and so put the device
222 * back into Read Mode, which is a nop in this case).
223 */
224 cfi_send_gen_cmd(0xf0, 0, base, map, cfi, cfi->device_type, NULL);
Guillaume LECERFad7026f2010-04-24 17:57:57 +0200225 cfi_send_gen_cmd(0xaa, addr_unlock1, base, map, cfi, cfi->device_type, NULL);
226 cfi_send_gen_cmd(0x55, addr_unlock2, base, map, cfi, cfi->device_type, NULL);
227 cfi_send_gen_cmd(0x90, addr_unlock1, base, map, cfi, cfi->device_type, NULL);
Guillaume LECERF84730442010-04-24 17:57:52 +0200228 cfi->mfr = cfi_read_query16(map, base);
229 cfi->id = cfi_read_query16(map, base + ofs_factor);
230
231 /* Get AMD/Spansion extended JEDEC ID */
232 if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
233 cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
234 cfi_read_query(map, base + 0xf * ofs_factor);
235
236 /* Put it back into Read Mode */
237 cfi_qry_mode_off(base, map, cfi);
238 xip_allowed(base, map);
239
Guillaume LECERF771a1152010-06-29 10:32:37 +0200240 printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank. Manufacturer ID %#08x Chip ID %#08x\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241 map->name, cfi->interleave, cfi->device_type*8, base,
Guillaume LECERF771a1152010-06-29 10:32:37 +0200242 map->bankwidth*8, cfi->mfr, cfi->id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243
244 return 1;
245}
246
247#ifdef DEBUG_CFI
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000248static char *vendorname(__u16 vendor)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249{
250 switch (vendor) {
251 case P_ID_NONE:
252 return "None";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000253
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 case P_ID_INTEL_EXT:
255 return "Intel/Sharp Extended";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000256
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 case P_ID_AMD_STD:
258 return "AMD/Fujitsu Standard";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000259
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 case P_ID_INTEL_STD:
261 return "Intel/Sharp Standard";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000262
Linus Torvalds1da177e2005-04-16 15:20:36 -0700263 case P_ID_AMD_EXT:
264 return "AMD/Fujitsu Extended";
265
266 case P_ID_WINBOND:
267 return "Winbond Standard";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000268
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269 case P_ID_ST_ADV:
270 return "ST Advanced";
271
272 case P_ID_MITSUBISHI_STD:
273 return "Mitsubishi Standard";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000274
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 case P_ID_MITSUBISHI_EXT:
276 return "Mitsubishi Extended";
277
278 case P_ID_SST_PAGE:
279 return "SST Page Write";
280
Guillaume LECERF54b93a42010-04-24 17:58:02 +0200281 case P_ID_SST_OLD:
282 return "SST 39VF160x/39VF320x";
283
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 case P_ID_INTEL_PERFORMANCE:
285 return "Intel Performance Code";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000286
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 case P_ID_INTEL_DATA:
288 return "Intel Data";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000289
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 case P_ID_RESERVED:
291 return "Not Allowed / Reserved for Future Use";
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000292
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293 default:
294 return "Unknown";
295 }
296}
297
298
299static void print_cfi_ident(struct cfi_ident *cfip)
300{
301#if 0
302 if (cfip->qry[0] != 'Q' || cfip->qry[1] != 'R' || cfip->qry[2] != 'Y') {
303 printk("Invalid CFI ident structure.\n");
304 return;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000305 }
306#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 printk("Primary Vendor Command Set: %4.4X (%s)\n", cfip->P_ID, vendorname(cfip->P_ID));
308 if (cfip->P_ADR)
309 printk("Primary Algorithm Table at %4.4X\n", cfip->P_ADR);
310 else
311 printk("No Primary Algorithm Table\n");
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000312
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 printk("Alternative Vendor Command Set: %4.4X (%s)\n", cfip->A_ID, vendorname(cfip->A_ID));
314 if (cfip->A_ADR)
315 printk("Alternate Algorithm Table at %4.4X\n", cfip->A_ADR);
316 else
317 printk("No Alternate Algorithm Table\n");
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000318
319
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 printk("Vcc Minimum: %2d.%d V\n", cfip->VccMin >> 4, cfip->VccMin & 0xf);
321 printk("Vcc Maximum: %2d.%d V\n", cfip->VccMax >> 4, cfip->VccMax & 0xf);
322 if (cfip->VppMin) {
323 printk("Vpp Minimum: %2d.%d V\n", cfip->VppMin >> 4, cfip->VppMin & 0xf);
324 printk("Vpp Maximum: %2d.%d V\n", cfip->VppMax >> 4, cfip->VppMax & 0xf);
325 }
326 else
327 printk("No Vpp line\n");
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000328
David Woodhouse151e7652006-05-14 01:51:54 +0100329 printk("Typical byte/word write timeout: %d µs\n", 1<<cfip->WordWriteTimeoutTyp);
330 printk("Maximum byte/word write timeout: %d µs\n", (1<<cfip->WordWriteTimeoutMax) * (1<<cfip->WordWriteTimeoutTyp));
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000331
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 if (cfip->BufWriteTimeoutTyp || cfip->BufWriteTimeoutMax) {
David Woodhouse151e7652006-05-14 01:51:54 +0100333 printk("Typical full buffer write timeout: %d µs\n", 1<<cfip->BufWriteTimeoutTyp);
334 printk("Maximum full buffer write timeout: %d µs\n", (1<<cfip->BufWriteTimeoutMax) * (1<<cfip->BufWriteTimeoutTyp));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 }
336 else
337 printk("Full buffer write not supported\n");
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000338
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 printk("Typical block erase timeout: %d ms\n", 1<<cfip->BlockEraseTimeoutTyp);
340 printk("Maximum block erase timeout: %d ms\n", (1<<cfip->BlockEraseTimeoutMax) * (1<<cfip->BlockEraseTimeoutTyp));
341 if (cfip->ChipEraseTimeoutTyp || cfip->ChipEraseTimeoutMax) {
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000342 printk("Typical chip erase timeout: %d ms\n", 1<<cfip->ChipEraseTimeoutTyp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 printk("Maximum chip erase timeout: %d ms\n", (1<<cfip->ChipEraseTimeoutMax) * (1<<cfip->ChipEraseTimeoutTyp));
344 }
345 else
346 printk("Chip erase not supported\n");
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000347
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20));
349 printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc);
350 switch(cfip->InterfaceDesc) {
Bartlomiej Siekade7921f2007-11-26 18:55:18 +0100351 case CFI_INTERFACE_X8_ASYNC:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 printk(" - x8-only asynchronous interface\n");
353 break;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000354
Bartlomiej Siekade7921f2007-11-26 18:55:18 +0100355 case CFI_INTERFACE_X16_ASYNC:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 printk(" - x16-only asynchronous interface\n");
357 break;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000358
Bartlomiej Siekade7921f2007-11-26 18:55:18 +0100359 case CFI_INTERFACE_X8_BY_X16_ASYNC:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 printk(" - supports x8 and x16 via BYTE# with asynchronous interface\n");
361 break;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000362
Bartlomiej Siekade7921f2007-11-26 18:55:18 +0100363 case CFI_INTERFACE_X32_ASYNC:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364 printk(" - x32-only asynchronous interface\n");
365 break;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000366
Bartlomiej Siekade7921f2007-11-26 18:55:18 +0100367 case CFI_INTERFACE_X16_BY_X32_ASYNC:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368 printk(" - supports x16 and x32 via Word# with asynchronous interface\n");
369 break;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000370
Bartlomiej Siekade7921f2007-11-26 18:55:18 +0100371 case CFI_INTERFACE_NOT_ALLOWED:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372 printk(" - Not Allowed / Reserved\n");
373 break;
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000374
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375 default:
376 printk(" - Unknown\n");
377 break;
378 }
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000379
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 printk("Max. bytes in buffer write: 0x%x\n", 1<< cfip->MaxBufWriteSize);
381 printk("Number of Erase Block Regions: %d\n", cfip->NumEraseRegions);
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000382
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383}
384#endif /* DEBUG_CFI */
385
386static struct chip_probe cfi_chip_probe = {
387 .name = "CFI",
388 .probe_chip = cfi_probe_chip
389};
390
391struct mtd_info *cfi_probe(struct map_info *map)
392{
393 /*
394 * Just use the generic probe stuff to call our CFI-specific
395 * chip_probe routine in all the possible permutations, etc.
396 */
397 return mtd_do_chip_probe(map, &cfi_chip_probe);
398}
399
400static struct mtd_chip_driver cfi_chipdrv = {
401 .probe = cfi_probe,
402 .name = "cfi_probe",
403 .module = THIS_MODULE
404};
405
Adrian Bunk2b9175c2005-11-29 14:49:38 +0000406static int __init cfi_probe_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407{
408 register_mtd_chip_driver(&cfi_chipdrv);
409 return 0;
410}
411
412static void __exit cfi_probe_exit(void)
413{
414 unregister_mtd_chip_driver(&cfi_chipdrv);
415}
416
417module_init(cfi_probe_init);
418module_exit(cfi_probe_exit);
419
420MODULE_LICENSE("GPL");
421MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org> et al.");
422MODULE_DESCRIPTION("Probe code for CFI-compliant flash chips");