aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c
diff options
context:
space:
mode:
authorJames <>2013-03-17 12:16:37 +0000
committerJames <>2013-03-17 12:16:37 +0000
commit27b76ab0671089c47506615a796a261e993896a7 (patch)
tree61213d67e7fa87b20356b23798558e2c4212c42f /target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c
downloadtrunk-36060-master.tar.gz
trunk-36060-master.tar.bz2
trunk-36060-master.zip
Diffstat (limited to 'target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c')
-rw-r--r--target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c b/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c
new file mode 100644
index 0000000..b2d4318
--- /dev/null
+++ b/target/linux/generic/files/fs/yaffs2/yaffs_mtdif.c
@@ -0,0 +1,56 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ * for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include "yportenv.h"
+
+
+#include "yaffs_mtdif.h"
+
+#include "linux/mtd/mtd.h"
+#include "linux/types.h"
+#include "linux/time.h"
+#include "linux/mtd/nand.h"
+
+#include "yaffs_linux.h"
+
+int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
+{
+ struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
+ __u32 addr =
+ ((loff_t) blockNumber) * dev->param.total_bytes_per_chunk
+ * dev->param.chunks_per_block;
+ struct erase_info ei;
+
+ int retval = 0;
+
+ ei.mtd = mtd;
+ ei.addr = addr;
+ ei.len = dev->param.total_bytes_per_chunk * dev->param.chunks_per_block;
+ ei.time = 1000;
+ ei.retries = 2;
+ ei.callback = NULL;
+ ei.priv = (u_long) dev;
+
+ retval = mtd->erase(mtd, &ei);
+
+ if (retval == 0)
+ return YAFFS_OK;
+ else
+ return YAFFS_FAIL;
+}
+
+int nandmtd_InitialiseNAND(yaffs_dev_t *dev)
+{
+ return YAFFS_OK;
+}
+