2007-10-10 18:05:48 +00:00
|
|
|
/*
|
|
|
|
* YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
|
|
|
|
*
|
2012-10-30 14:58:17 +00:00
|
|
|
* Copyright (C) 2002-2010 Aleph One Ltd.
|
2007-10-10 18:05:48 +00:00
|
|
|
* 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"
|
|
|
|
|
2012-10-30 14:58:17 +00:00
|
|
|
#include "yaffs_linux.h"
|
2007-10-10 18:05:48 +00:00
|
|
|
|
2012-10-30 14:58:17 +00:00
|
|
|
int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
|
2007-10-10 18:05:48 +00:00
|
|
|
{
|
2012-10-30 14:58:17 +00:00
|
|
|
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
|
2007-10-10 18:05:48 +00:00
|
|
|
__u32 addr =
|
2012-10-30 14:58:17 +00:00
|
|
|
((loff_t) blockNumber) * dev->param.total_bytes_per_chunk
|
|
|
|
* dev->param.chunks_per_block;
|
2007-10-10 18:05:48 +00:00
|
|
|
struct erase_info ei;
|
2012-10-30 14:58:17 +00:00
|
|
|
|
2007-10-10 18:05:48 +00:00
|
|
|
int retval = 0;
|
|
|
|
|
|
|
|
ei.mtd = mtd;
|
|
|
|
ei.addr = addr;
|
2012-10-30 14:58:17 +00:00
|
|
|
ei.len = dev->param.total_bytes_per_chunk * dev->param.chunks_per_block;
|
2007-10-10 18:05:48 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-10-30 14:58:17 +00:00
|
|
|
int nandmtd_InitialiseNAND(yaffs_dev_t *dev)
|
2007-10-10 18:05:48 +00:00
|
|
|
{
|
|
|
|
return YAFFS_OK;
|
|
|
|
}
|
|
|
|
|