mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-01 01:00:17 +02:00
34b60fad1a
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34013 3c298f89-4303-0410-b956-a3cf2f4a3e73
57 lines
1.2 KiB
C
57 lines
1.2 KiB
C
/*
|
|
* 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;
|
|
}
|
|
|