Remove oldestDirtySequence from checkpoint
[yaffs2.git] / yaffs_mtdif.c
1 /*
2  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2007 Aleph One Ltd.
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
14 const char *yaffs_mtdif_c_version =
15         "$Id: yaffs_mtdif.c,v 1.25 2010-02-19 01:06:31 charles Exp $";
16
17 #include "yportenv.h"
18
19
20 #include "yaffs_mtdif.h"
21
22 #include "linux/mtd/mtd.h"
23 #include "linux/types.h"
24 #include "linux/time.h"
25 #include "linux/mtd/nand.h"
26
27 #include "yaffs_linux.h"
28
29 int nandmtd_EraseBlockInNAND(yaffs_Device *dev, int blockNumber)
30 {
31         struct mtd_info *mtd = yaffs_DeviceToContext(dev)->mtd;
32         __u32 addr =
33             ((loff_t) blockNumber) * dev->param.totalBytesPerChunk
34                 * dev->param.nChunksPerBlock;
35         struct erase_info ei;
36         
37         int retval = 0;
38
39         ei.mtd = mtd;
40         ei.addr = addr;
41         ei.len = dev->param.totalBytesPerChunk * dev->param.nChunksPerBlock;
42         ei.time = 1000;
43         ei.retries = 2;
44         ei.callback = NULL;
45         ei.priv = (u_long) dev;
46
47         retval = mtd->erase(mtd, &ei);
48
49         if (retval == 0)
50                 return YAFFS_OK;
51         else
52                 return YAFFS_FAIL;
53 }
54
55 int nandmtd_InitialiseNAND(yaffs_Device *dev)
56 {
57         return YAFFS_OK;
58 }
59