Mercurial > yaffs-ecoscentric-gpl
annotate packages/fs/yaffs/current/src/yaffs_mtdif.c @ 425:dea4d7d250ad ecos
Move sources into packages/fs/yaffs/current/src/
| author | Ross Younger <wry@ecoscentric.com> |
|---|---|
| date | Fri, 14 May 2010 16:03:09 +0100 |
| parents | yaffs_mtdif.c@b5309c9b6d7f |
| children |
| rev | line source |
|---|---|
| 7 | 1 /* |
| 168 | 2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. |
| 7 | 3 * |
|
409
b5309c9b6d7f
yaffs Some cleanups.
Charles Manning <cdhmanning@gmail.com>
parents:
360
diff
changeset
|
4 * Copyright (C) 2002-2010 Aleph One Ltd. |
| 7 | 5 * for Toby Churchill Ltd and Brightstar Engineering |
| 6 * | |
| 7 * Created by Charles Manning <charles@aleph1.co.uk> | |
| 8 * | |
| 9 * This program is free software; you can redistribute it and/or modify | |
| 10 * it under the terms of the GNU General Public License version 2 as | |
| 11 * published by the Free Software Foundation. | |
| 12 */ | |
| 13 | |
|
45
1f2f55618d63
If kernel/config.h is included in yportenv.h, then yportenv.h must be
marty <marty>
parents:
43
diff
changeset
|
14 #include "yportenv.h" |
| 7 | 15 |
| 16 | |
| 17 #include "yaffs_mtdif.h" | |
| 18 | |
| 19 #include "linux/mtd/mtd.h" | |
| 20 #include "linux/types.h" | |
| 21 #include "linux/time.h" | |
| 22 #include "linux/mtd/nand.h" | |
| 23 | |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
24 #include "yaffs_linux.h" |
|
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
25 |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
26 int nandmtd_EraseBlockInNAND(yaffs_Device *dev, int blockNumber) |
| 7 | 27 { |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
28 struct mtd_info *mtd = yaffs_DeviceToContext(dev)->mtd; |
| 76 | 29 __u32 addr = |
|
358
7c3694ed38db
Fix mtdif erasing to work properly for inband tags
charles <charles>
parents:
356
diff
changeset
|
30 ((loff_t) blockNumber) * dev->param.totalBytesPerChunk |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
31 * dev->param.nChunksPerBlock; |
| 7 | 32 struct erase_info ei; |
|
356
7ee0cc4ba753
Rationalise context and parameter handling
charles <charles>
parents:
271
diff
changeset
|
33 |
| 76 | 34 int retval = 0; |
| 35 | |
| 7 | 36 ei.mtd = mtd; |
| 37 ei.addr = addr; | |
|
358
7c3694ed38db
Fix mtdif erasing to work properly for inband tags
charles <charles>
parents:
356
diff
changeset
|
38 ei.len = dev->param.totalBytesPerChunk * dev->param.nChunksPerBlock; |
| 7 | 39 ei.time = 1000; |
| 40 ei.retries = 2; | |
| 41 ei.callback = NULL; | |
| 76 | 42 ei.priv = (u_long) dev; |
| 43 | |
| 44 retval = mtd->erase(mtd, &ei); | |
| 7 | 45 |
| 76 | 46 if (retval == 0) |
| 47 return YAFFS_OK; | |
| 48 else | |
| 49 return YAFFS_FAIL; | |
| 7 | 50 } |
| 51 | |
|
271
c0dfae9e8073
Major whitespace/style changes to match Linux checkpatch.pl code style
wookey <wookey>
parents:
198
diff
changeset
|
52 int nandmtd_InitialiseNAND(yaffs_Device *dev) |
| 7 | 53 { |
| 54 return YAFFS_OK; | |
| 55 } | |
| 56 |
