yaffs Forgot to remove some files from last commit.
[yaffs2.git] / yaffs_mtdif.c
1 /*
2  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2010 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 #include "yportenv.h"
15
16 #include "yaffs_mtdif.h"
17
18 #include "linux/mtd/mtd.h"
19 #include "linux/types.h"
20 #include "linux/time.h"
21 #include "linux/mtd/nand.h"
22
23 #include "yaffs_linux.h"
24
25 int nandmtd_erase_block(struct yaffs_dev *dev, int block_no)
26 {
27         struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
28         u32 addr =
29             ((loff_t) block_no) * dev->param.total_bytes_per_chunk
30             * dev->param.chunks_per_block;
31         struct erase_info ei;
32
33         int retval = 0;
34
35         ei.mtd = mtd;
36         ei.addr = addr;
37         ei.len = dev->param.total_bytes_per_chunk * dev->param.chunks_per_block;
38         ei.time = 1000;
39         ei.retries = 2;
40         ei.callback = NULL;
41         ei.priv = (u_long) dev;
42
43         retval = mtd->erase(mtd, &ei);
44
45         if (retval == 0)
46                 return YAFFS_OK;
47         else
48                 return YAFFS_FAIL;
49 }
50
51 int nandmtd_initialise(struct yaffs_dev *dev)
52 {
53         return YAFFS_OK;
54 }