more complete nand driver with mtd-utils support

This commit is contained in:
rajkosto 2010-09-27 18:30:49 +02:00
parent a82116871b
commit da14953654
6 changed files with 2218 additions and 1922 deletions

View File

@ -797,10 +797,10 @@ CONFIG_MTD_CMDLINE_PARTS=y
#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=m
CONFIG_MTD_BLKDEVS=m
CONFIG_MTD_BLOCK=m
CONFIG_MTD_BLOCK_RO=m
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_BLOCK_RO=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
@ -837,6 +837,7 @@ CONFIG_MTD_CFI_I2=y
# Self-contained MTD device drivers
#
# CONFIG_MTD_MSM_NAND is not set
CONFIG_MTD_HTCLEO_NAND=y
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_MTDRAM is not set

View File

@ -59,6 +59,14 @@ config MTD_MSM_NAND
help
Support for some NAND chips connected to the MSM NAND controller.
config MTD_HTCLEO_NAND
tristate "HTCLEO NAND Device Support"
depends on MTD && ARCH_MSM
select MTD_NAND_IDS
default y
help
Support for some NAND chips connected to the HTC LEO NAND controller.
config MTD_DATAFLASH
tristate "Support for AT45xxx DataFlash"
depends on SPI_MASTER && EXPERIMENTAL

View File

@ -2,20 +2,20 @@
# linux/drivers/devices/Makefile
#
obj-$(CONFIG_MTD_DOC2000) += doc2000.o
obj-$(CONFIG_MTD_DOC2001) += doc2001.o
obj-$(CONFIG_MTD_DOC2001PLUS) += doc2001plus.o
obj-$(CONFIG_MTD_DOCPROBE) += docprobe.o
obj-$(CONFIG_MTD_DOCECC) += docecc.o
obj-$(CONFIG_MTD_SLRAM) += slram.o
obj-$(CONFIG_MTD_PHRAM) += phram.o
obj-$(CONFIG_MTD_PMC551) += pmc551.o
obj-$(CONFIG_MTD_MS02NV) += ms02-nv.o
obj-$(CONFIG_MTD_MSM_NAND) += msm_nand.o
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-nand.o
obj-$(CONFIG_MTD_MTDRAM) += mtdram.o
obj-$(CONFIG_MTD_LART) += lart.o
obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
obj-$(CONFIG_MTD_M25P80) += m25p80.o
obj-$(CONFIG_MTD_SST25L) += sst25l.o
obj-$(CONFIG_MTD_DOC2000) += doc2000.o
obj-$(CONFIG_MTD_DOC2001) += doc2001.o
obj-$(CONFIG_MTD_DOC2001PLUS) += doc2001plus.o
obj-$(CONFIG_MTD_DOCPROBE) += docprobe.o
obj-$(CONFIG_MTD_DOCECC) += docecc.o
obj-$(CONFIG_MTD_SLRAM) += slram.o
obj-$(CONFIG_MTD_PHRAM) += phram.o
obj-$(CONFIG_MTD_PMC551) += pmc551.o
obj-$(CONFIG_MTD_MS02NV) += ms02-nv.o
obj-$(CONFIG_MTD_MSM_NAND) += msm_nand.o
obj-$(CONFIG_MTD_HTCLEO_NAND) += htcleo_nand.o
obj-$(CONFIG_MTD_MTDRAM) += mtdram.o
obj-$(CONFIG_MTD_LART) += lart.o
obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
obj-$(CONFIG_MTD_M25P80) += m25p80.o
obj-$(CONFIG_MTD_SST25L) += sst25l.o

File diff suppressed because it is too large Load Diff

2177
drivers/mtd/devices/htcleo_nand.c Executable file

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,12 @@ const char *yaffs_mtdif2_c_version =
#include "yaffs_packedtags2.h"
#ifdef CONFIG_YAFFS_DOES_ECC
#define OOB_TAGS_SIZE sizeof(yaffs_PackedTags2)
#else
#define OOB_TAGS_SIZE sizeof(yaffs_PackedTags2TagsPart)
#endif
/* NB For use with inband tags....
* We assume that the data buffer is of size totalBytersPerChunk so that we can also
* use it to load the tags.
@ -68,8 +74,8 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device *dev, int chunkInNAND,
yaffs_PackTags2(&pt, tags);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
ops.mode = MTD_OOB_AUTO;
ops.ooblen = (dev->inbandTags) ? 0 : sizeof(pt);
ops.mode = MTD_OOB_AUTO;
ops.ooblen = (dev->inbandTags) ? 0 : OOB_TAGS_SIZE;
ops.len = dev->totalBytesPerChunk;
ops.ooboffs = 0;
ops.datbuf = (__u8 *)data;
@ -131,8 +137,8 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND,
&dummy, data);
else if (tags) {
ops.mode = MTD_OOB_AUTO;
ops.ooblen = sizeof(pt);
ops.len = data ? dev->nDataBytesPerChunk : sizeof(pt);
ops.ooblen = OOB_TAGS_SIZE;
ops.len = data ? dev->nDataBytesPerChunk : OOB_TAGS_SIZE;
ops.ooboffs = 0;
ops.datbuf = data;
ops.oobbuf = dev->spareBuffer;
@ -165,7 +171,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device *dev, int chunkInNAND,
}
} else {
if (tags) {
memcpy(&pt, dev->spareBuffer, sizeof(pt));
memcpy(&pt, dev->spareBuffer, OOB_TAGS_SIZE);
yaffs_UnpackTags2(tags, &pt);
}
}