blob: f6bf8e56d912d8b77d76d6d9bdcd20860870da4a [file] [log] [blame]
Arve Hjønnevåg3de69a72010-05-18 20:35:30 -07001/*
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
25int 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
Steve Mucklef132c6c2012-06-06 18:30:57 -070043 retval = mtd_erase(mtd, &ei);
Arve Hjønnevåg3de69a72010-05-18 20:35:30 -070044
45 if (retval == 0)
46 return YAFFS_OK;
47 else
48 return YAFFS_FAIL;
49}
50
51int nandmtd_initialise(struct yaffs_dev *dev)
52{
53 return YAFFS_OK;
54}