blob: 3cc0b23c5865cd3cd3fb1ffe5ad4496e7b5aeb59 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * MTD chip driver for pre-CFI Sharp flash chips
3 *
4 * Copyright 2000,2001 David A. Schleef <ds@schleef.org>
5 * 2000,2001 Lineo, Inc.
6 *
Richard Purdieee2d49d2005-11-29 14:28:31 +00007 * $Id: sharp.c,v 1.17 2005/11/29 14:28:28 gleixner Exp $
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * Devices supported:
10 * LH28F016SCT Symmetrical block flash memory, 2Mx8
11 * LH28F008SCT Symmetrical block flash memory, 1Mx8
12 *
13 * Documentation:
14 * http://www.sharpmeg.com/datasheets/memic/flashcmp/
15 * http://www.sharpmeg.com/datasheets/memic/flashcmp/01symf/16m/016sctl9.pdf
16 * 016sctl9.pdf
17 *
18 * Limitations:
19 * This driver only supports 4x1 arrangement of chips.
20 * Not tested on anything but PowerPC.
21 */
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/types.h>
26#include <linux/sched.h>
27#include <linux/errno.h>
28#include <linux/interrupt.h>
29#include <linux/mtd/map.h>
30#include <linux/mtd/mtd.h>
31#include <linux/mtd/cfi.h>
32#include <linux/delay.h>
33#include <linux/init.h>
Todd Poynor1da2c9a62005-08-02 21:36:09 +010034#include <linux/slab.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36#define CMD_RESET 0xffffffff
37#define CMD_READ_ID 0x90909090
38#define CMD_READ_STATUS 0x70707070
39#define CMD_CLEAR_STATUS 0x50505050
40#define CMD_BLOCK_ERASE_1 0x20202020
41#define CMD_BLOCK_ERASE_2 0xd0d0d0d0
42#define CMD_BYTE_WRITE 0x40404040
43#define CMD_SUSPEND 0xb0b0b0b0
44#define CMD_RESUME 0xd0d0d0d0
45#define CMD_SET_BLOCK_LOCK_1 0x60606060
46#define CMD_SET_BLOCK_LOCK_2 0x01010101
47#define CMD_SET_MASTER_LOCK_1 0x60606060
48#define CMD_SET_MASTER_LOCK_2 0xf1f1f1f1
49#define CMD_CLEAR_BLOCK_LOCKS_1 0x60606060
50#define CMD_CLEAR_BLOCK_LOCKS_2 0xd0d0d0d0
51
52#define SR_READY 0x80808080 // 1 = ready
53#define SR_ERASE_SUSPEND 0x40404040 // 1 = block erase suspended
54#define SR_ERROR_ERASE 0x20202020 // 1 = error in block erase or clear lock bits
55#define SR_ERROR_WRITE 0x10101010 // 1 = error in byte write or set lock bit
56#define SR_VPP 0x08080808 // 1 = Vpp is low
57#define SR_WRITE_SUSPEND 0x04040404 // 1 = byte write suspended
58#define SR_PROTECT 0x02020202 // 1 = lock bit set
59#define SR_RESERVED 0x01010101
60
61#define SR_ERRORS (SR_ERROR_ERASE|SR_ERROR_WRITE|SR_VPP|SR_PROTECT)
62
63/* Configuration options */
64
65#undef AUTOUNLOCK /* automatically unlocks blocks before erasing */
66
Adrian Bunk0500abf2006-03-31 02:29:42 -080067static struct mtd_info *sharp_probe(struct map_info *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd);
70
71static int sharp_read(struct mtd_info *mtd, loff_t from, size_t len,
72 size_t *retlen, u_char *buf);
73static int sharp_write(struct mtd_info *mtd, loff_t from, size_t len,
74 size_t *retlen, const u_char *buf);
75static int sharp_erase(struct mtd_info *mtd, struct erase_info *instr);
76static void sharp_sync(struct mtd_info *mtd);
77static int sharp_suspend(struct mtd_info *mtd);
78static void sharp_resume(struct mtd_info *mtd);
79static void sharp_destroy(struct mtd_info *mtd);
80
81static int sharp_write_oneword(struct map_info *map, struct flchip *chip,
82 unsigned long adr, __u32 datum);
83static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip,
84 unsigned long adr);
85#ifdef AUTOUNLOCK
86static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip,
87 unsigned long adr);
88#endif
89
90
91struct sharp_info{
92 struct flchip *chip;
93 int bogus;
94 int chipshift;
95 int numchips;
96 struct flchip chips[1];
97};
98
Linus Torvalds1da177e2005-04-16 15:20:36 -070099static void sharp_destroy(struct mtd_info *mtd);
100
101static struct mtd_chip_driver sharp_chipdrv = {
102 .probe = sharp_probe,
103 .destroy = sharp_destroy,
104 .name = "sharp",
105 .module = THIS_MODULE
106};
107
108
Adrian Bunk0500abf2006-03-31 02:29:42 -0800109static struct mtd_info *sharp_probe(struct map_info *map)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110{
111 struct mtd_info *mtd = NULL;
112 struct sharp_info *sharp = NULL;
113 int width;
114
115 mtd = kmalloc(sizeof(*mtd), GFP_KERNEL);
116 if(!mtd)
117 return NULL;
118
119 sharp = kmalloc(sizeof(*sharp), GFP_KERNEL);
120 if(!sharp) {
121 kfree(mtd);
122 return NULL;
123 }
124
125 memset(mtd, 0, sizeof(*mtd));
126
127 width = sharp_probe_map(map,mtd);
128 if(!width){
129 kfree(mtd);
130 kfree(sharp);
131 return NULL;
132 }
133
134 mtd->priv = map;
135 mtd->type = MTD_NORFLASH;
136 mtd->erase = sharp_erase;
137 mtd->read = sharp_read;
138 mtd->write = sharp_write;
139 mtd->sync = sharp_sync;
140 mtd->suspend = sharp_suspend;
141 mtd->resume = sharp_resume;
142 mtd->flags = MTD_CAP_NORFLASH;
143 mtd->name = map->name;
144
145 memset(sharp, 0, sizeof(*sharp));
146 sharp->chipshift = 23;
147 sharp->numchips = 1;
148 sharp->chips[0].start = 0;
149 sharp->chips[0].state = FL_READY;
150 sharp->chips[0].mutex = &sharp->chips[0]._spinlock;
151 sharp->chips[0].word_write_time = 0;
152 init_waitqueue_head(&sharp->chips[0].wq);
153 spin_lock_init(&sharp->chips[0]._spinlock);
154
155 map->fldrv = &sharp_chipdrv;
156 map->fldrv_priv = sharp;
157
158 __module_get(THIS_MODULE);
159 return mtd;
160}
161
Richard Purdieee2d49d2005-11-29 14:28:31 +0000162static inline void sharp_send_cmd(struct map_info *map, unsigned long cmd, unsigned long adr)
163{
164 map_word map_cmd;
165 map_cmd.x[0] = cmd;
166 map_write(map, map_cmd, adr);
167}
168
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
170{
Richard Purdieee2d49d2005-11-29 14:28:31 +0000171 map_word tmp, read0, read4;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 unsigned long base = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 int width = 4;
174
Richard Purdieee2d49d2005-11-29 14:28:31 +0000175 tmp = map_read(map, base+0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Richard Purdieee2d49d2005-11-29 14:28:31 +0000177 sharp_send_cmd(map, CMD_READ_ID, base+0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178
Richard Purdieee2d49d2005-11-29 14:28:31 +0000179 read0 = map_read(map, base+0);
180 read4 = map_read(map, base+4);
181 if(read0.x[0] == 0x89898989){
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 printk("Looks like sharp flash\n");
Richard Purdieee2d49d2005-11-29 14:28:31 +0000183 switch(read4.x[0]){
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184 case 0xaaaaaaaa:
185 case 0xa0a0a0a0:
186 /* aa - LH28F016SCT-L95 2Mx8, 32 64k blocks*/
187 /* a0 - LH28F016SCT-Z4 2Mx8, 32 64k blocks*/
188 mtd->erasesize = 0x10000 * width;
189 mtd->size = 0x200000 * width;
190 return width;
191 case 0xa6a6a6a6:
192 /* a6 - LH28F008SCT-L12 1Mx8, 16 64k blocks*/
193 /* a6 - LH28F008SCR-L85 1Mx8, 16 64k blocks*/
194 mtd->erasesize = 0x10000 * width;
195 mtd->size = 0x100000 * width;
196 return width;
197#if 0
198 case 0x00000000: /* unknown */
199 /* XX - LH28F004SCT 512kx8, 8 64k blocks*/
200 mtd->erasesize = 0x10000 * width;
201 mtd->size = 0x80000 * width;
202 return width;
203#endif
204 default:
Richard Purdieee2d49d2005-11-29 14:28:31 +0000205 printk("Sort-of looks like sharp flash, 0x%08lx 0x%08lx\n",
206 read0.x[0], read4.x[0]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 }
Richard Purdieee2d49d2005-11-29 14:28:31 +0000208 }else if((map_read(map, base+0).x[0] == CMD_READ_ID)){
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 /* RAM, probably */
210 printk("Looks like RAM\n");
Richard Purdieee2d49d2005-11-29 14:28:31 +0000211 map_write(map, tmp, base+0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212 }else{
Richard Purdieee2d49d2005-11-29 14:28:31 +0000213 printk("Doesn't look like sharp flash, 0x%08lx 0x%08lx\n",
214 read0.x[0], read4.x[0]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215 }
216
217 return 0;
218}
219
220/* This function returns with the chip->mutex lock held. */
221static int sharp_wait(struct map_info *map, struct flchip *chip)
222{
Richard Purdieee2d49d2005-11-29 14:28:31 +0000223 int i;
224 map_word status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 unsigned long timeo = jiffies + HZ;
226 DECLARE_WAITQUEUE(wait, current);
227 int adr = 0;
228
229retry:
230 spin_lock_bh(chip->mutex);
231
232 switch(chip->state){
233 case FL_READY:
Richard Purdieee2d49d2005-11-29 14:28:31 +0000234 sharp_send_cmd(map, CMD_READ_STATUS, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 chip->state = FL_STATUS;
236 case FL_STATUS:
Todd Poynor1da2c9a62005-08-02 21:36:09 +0100237 for(i=0;i<100;i++){
Richard Purdieee2d49d2005-11-29 14:28:31 +0000238 status = map_read(map, adr);
239 if((status.x[0] & SR_READY)==SR_READY)
Todd Poynor1da2c9a62005-08-02 21:36:09 +0100240 break;
241 udelay(1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 }
243 break;
244 default:
245 printk("Waiting for chip\n");
246
247 set_current_state(TASK_INTERRUPTIBLE);
248 add_wait_queue(&chip->wq, &wait);
249
250 spin_unlock_bh(chip->mutex);
251
252 schedule();
253 remove_wait_queue(&chip->wq, &wait);
254
255 if(signal_pending(current))
256 return -EINTR;
257
258 timeo = jiffies + HZ;
259
260 goto retry;
261 }
262
Richard Purdieee2d49d2005-11-29 14:28:31 +0000263 sharp_send_cmd(map, CMD_RESET, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264
265 chip->state = FL_READY;
266
267 return 0;
268}
269
270static void sharp_release(struct flchip *chip)
271{
272 wake_up(&chip->wq);
273 spin_unlock_bh(chip->mutex);
274}
275
276static int sharp_read(struct mtd_info *mtd, loff_t from, size_t len,
277 size_t *retlen, u_char *buf)
278{
279 struct map_info *map = mtd->priv;
280 struct sharp_info *sharp = map->fldrv_priv;
281 int chipnum;
282 int ret = 0;
283 int ofs = 0;
284
285 chipnum = (from >> sharp->chipshift);
286 ofs = from & ((1 << sharp->chipshift)-1);
287
288 *retlen = 0;
289
290 while(len){
291 unsigned long thislen;
292
293 if(chipnum>=sharp->numchips)
294 break;
295
296 thislen = len;
297 if(ofs+thislen >= (1<<sharp->chipshift))
298 thislen = (1<<sharp->chipshift) - ofs;
299
300 ret = sharp_wait(map,&sharp->chips[chipnum]);
301 if(ret<0)
302 break;
303
304 map_copy_from(map,buf,ofs,thislen);
305
306 sharp_release(&sharp->chips[chipnum]);
307
308 *retlen += thislen;
309 len -= thislen;
310 buf += thislen;
311
312 ofs = 0;
313 chipnum++;
314 }
315 return ret;
316}
317
318static int sharp_write(struct mtd_info *mtd, loff_t to, size_t len,
319 size_t *retlen, const u_char *buf)
320{
321 struct map_info *map = mtd->priv;
322 struct sharp_info *sharp = map->fldrv_priv;
323 int ret = 0;
324 int i,j;
325 int chipnum;
326 unsigned long ofs;
327 union { u32 l; unsigned char uc[4]; } tbuf;
328
329 *retlen = 0;
330
331 while(len){
332 tbuf.l = 0xffffffff;
333 chipnum = to >> sharp->chipshift;
334 ofs = to & ((1<<sharp->chipshift)-1);
335
336 j=0;
337 for(i=ofs&3;i<4 && len;i++){
338 tbuf.uc[i] = *buf;
339 buf++;
340 to++;
341 len--;
342 j++;
343 }
344 sharp_write_oneword(map, &sharp->chips[chipnum], ofs&~3, tbuf.l);
345 if(ret<0)
346 return ret;
347 (*retlen)+=j;
348 }
349
350 return 0;
351}
352
353static int sharp_write_oneword(struct map_info *map, struct flchip *chip,
354 unsigned long adr, __u32 datum)
355{
356 int ret;
357 int timeo;
358 int try;
359 int i;
Richard Purdieee2d49d2005-11-29 14:28:31 +0000360 map_word data, status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361
Richard Purdieee2d49d2005-11-29 14:28:31 +0000362 status.x[0] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 ret = sharp_wait(map,chip);
364
365 for(try=0;try<10;try++){
Richard Purdieee2d49d2005-11-29 14:28:31 +0000366 sharp_send_cmd(map, CMD_BYTE_WRITE, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367 /* cpu_to_le32 -> hack to fix the writel be->le conversion */
Richard Purdieee2d49d2005-11-29 14:28:31 +0000368 data.x[0] = cpu_to_le32(datum);
369 map_write(map, data, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370
371 chip->state = FL_WRITING;
372
373 timeo = jiffies + (HZ/2);
374
Richard Purdieee2d49d2005-11-29 14:28:31 +0000375 sharp_send_cmd(map, CMD_READ_STATUS, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376 for(i=0;i<100;i++){
Richard Purdieee2d49d2005-11-29 14:28:31 +0000377 status = map_read(map, adr);
378 if((status.x[0] & SR_READY) == SR_READY)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 break;
380 }
381 if(i==100){
382 printk("sharp: timed out writing\n");
383 }
384
Richard Purdieee2d49d2005-11-29 14:28:31 +0000385 if(!(status.x[0] & SR_ERRORS))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 break;
387
Richard Purdieee2d49d2005-11-29 14:28:31 +0000388 printk("sharp: error writing byte at addr=%08lx status=%08lx\n", adr, status.x[0]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389
Richard Purdieee2d49d2005-11-29 14:28:31 +0000390 sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 }
Richard Purdieee2d49d2005-11-29 14:28:31 +0000392 sharp_send_cmd(map, CMD_RESET, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 chip->state = FL_READY;
394
395 wake_up(&chip->wq);
396 spin_unlock_bh(chip->mutex);
397
398 return 0;
399}
400
401static int sharp_erase(struct mtd_info *mtd, struct erase_info *instr)
402{
403 struct map_info *map = mtd->priv;
404 struct sharp_info *sharp = map->fldrv_priv;
405 unsigned long adr,len;
406 int chipnum, ret=0;
407
408//printk("sharp_erase()\n");
409 if(instr->addr & (mtd->erasesize - 1))
410 return -EINVAL;
411 if(instr->len & (mtd->erasesize - 1))
412 return -EINVAL;
413 if(instr->len + instr->addr > mtd->size)
414 return -EINVAL;
415
416 chipnum = instr->addr >> sharp->chipshift;
417 adr = instr->addr & ((1<<sharp->chipshift)-1);
418 len = instr->len;
419
420 while(len){
421 ret = sharp_erase_oneblock(map, &sharp->chips[chipnum], adr);
422 if(ret)return ret;
423
424 adr += mtd->erasesize;
425 len -= mtd->erasesize;
426 if(adr >> sharp->chipshift){
427 adr = 0;
428 chipnum++;
429 if(chipnum>=sharp->numchips)
430 break;
431 }
432 }
433
434 instr->state = MTD_ERASE_DONE;
435 mtd_erase_callback(instr);
436
437 return 0;
438}
439
440static int sharp_do_wait_for_ready(struct map_info *map, struct flchip *chip,
441 unsigned long adr)
442{
443 int ret;
444 unsigned long timeo;
Richard Purdieee2d49d2005-11-29 14:28:31 +0000445 map_word status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 DECLARE_WAITQUEUE(wait, current);
447
Richard Purdieee2d49d2005-11-29 14:28:31 +0000448 sharp_send_cmd(map, CMD_READ_STATUS, adr);
449 status = map_read(map, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450
451 timeo = jiffies + HZ;
452
453 while(time_before(jiffies, timeo)){
Richard Purdieee2d49d2005-11-29 14:28:31 +0000454 sharp_send_cmd(map, CMD_READ_STATUS, adr);
455 status = map_read(map, adr);
456 if((status.x[0] & SR_READY)==SR_READY){
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 ret = 0;
458 goto out;
459 }
460 set_current_state(TASK_INTERRUPTIBLE);
461 add_wait_queue(&chip->wq, &wait);
462
463 //spin_unlock_bh(chip->mutex);
464
465 schedule_timeout(1);
466 schedule();
467 remove_wait_queue(&chip->wq, &wait);
468
469 //spin_lock_bh(chip->mutex);
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000470
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 if (signal_pending(current)){
472 ret = -EINTR;
473 goto out;
474 }
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000475
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 }
477 ret = -ETIME;
478out:
479 return ret;
480}
481
482static int sharp_erase_oneblock(struct map_info *map, struct flchip *chip,
483 unsigned long adr)
484{
485 int ret;
486 //int timeo;
Richard Purdieee2d49d2005-11-29 14:28:31 +0000487 map_word status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 //int i;
489
490//printk("sharp_erase_oneblock()\n");
491
492#ifdef AUTOUNLOCK
493 /* This seems like a good place to do an unlock */
494 sharp_unlock_oneblock(map,chip,adr);
495#endif
496
Richard Purdieee2d49d2005-11-29 14:28:31 +0000497 sharp_send_cmd(map, CMD_BLOCK_ERASE_1, adr);
498 sharp_send_cmd(map, CMD_BLOCK_ERASE_2, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499
500 chip->state = FL_ERASING;
501
502 ret = sharp_do_wait_for_ready(map,chip,adr);
503 if(ret<0)return ret;
504
Richard Purdieee2d49d2005-11-29 14:28:31 +0000505 sharp_send_cmd(map, CMD_READ_STATUS, adr);
506 status = map_read(map, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507
Richard Purdieee2d49d2005-11-29 14:28:31 +0000508 if(!(status.x[0] & SR_ERRORS)){
509 sharp_send_cmd(map, CMD_RESET, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 chip->state = FL_READY;
511 //spin_unlock_bh(chip->mutex);
512 return 0;
513 }
514
Richard Purdieee2d49d2005-11-29 14:28:31 +0000515 printk("sharp: error erasing block at addr=%08lx status=%08lx\n", adr, status.x[0]);
516 sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517
518 //spin_unlock_bh(chip->mutex);
519
520 return -EIO;
521}
522
523#ifdef AUTOUNLOCK
524static void sharp_unlock_oneblock(struct map_info *map, struct flchip *chip,
525 unsigned long adr)
526{
527 int i;
Richard Purdieee2d49d2005-11-29 14:28:31 +0000528 map_word status;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529
Richard Purdieee2d49d2005-11-29 14:28:31 +0000530 sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_1, adr);
531 sharp_send_cmd(map, CMD_CLEAR_BLOCK_LOCKS_2, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532
533 udelay(100);
534
Richard Purdieee2d49d2005-11-29 14:28:31 +0000535 status = map_read(map, adr);
536 printk("status=%08lx\n", status.x[0]);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537
538 for(i=0;i<1000;i++){
Richard Purdieee2d49d2005-11-29 14:28:31 +0000539 //sharp_send_cmd(map, CMD_READ_STATUS, adr);
540 status = map_read(map, adr);
541 if((status.x[0] & SR_READY) == SR_READY)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 break;
543 udelay(100);
544 }
545 if(i==1000){
546 printk("sharp: timed out unlocking block\n");
547 }
548
Richard Purdieee2d49d2005-11-29 14:28:31 +0000549 if(!(status.x[0] & SR_ERRORS)){
550 sharp_send_cmd(map, CMD_RESET, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 chip->state = FL_READY;
552 return;
553 }
554
Richard Purdieee2d49d2005-11-29 14:28:31 +0000555 printk("sharp: error unlocking block at addr=%08lx status=%08lx\n", adr, status.x[0]);
556 sharp_send_cmd(map, CMD_CLEAR_STATUS, adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557}
558#endif
559
560static void sharp_sync(struct mtd_info *mtd)
561{
562 //printk("sharp_sync()\n");
563}
564
565static int sharp_suspend(struct mtd_info *mtd)
566{
567 printk("sharp_suspend()\n");
568 return -EINVAL;
569}
570
571static void sharp_resume(struct mtd_info *mtd)
572{
573 printk("sharp_resume()\n");
Thomas Gleixner1f948b42005-11-07 11:15:37 +0000574
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575}
576
577static void sharp_destroy(struct mtd_info *mtd)
578{
579 printk("sharp_destroy()\n");
580
581}
582
Adrian Bunk0500abf2006-03-31 02:29:42 -0800583static int __init sharp_probe_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584{
585 printk("MTD Sharp chip driver <ds@lineo.com>\n");
586
587 register_mtd_chip_driver(&sharp_chipdrv);
588
589 return 0;
590}
591
592static void __exit sharp_probe_exit(void)
593{
594 unregister_mtd_chip_driver(&sharp_chipdrv);
595}
596
597module_init(sharp_probe_init);
598module_exit(sharp_probe_exit);
599
600
601MODULE_LICENSE("GPL");
602MODULE_AUTHOR("David Schleef <ds@schleef.org>");
603MODULE_DESCRIPTION("Old MTD chip driver for pre-CFI Sharp flash chips");