[Yaffs] 2.6.12.1 - no data after umount ?
Manav Gautam
bandwidthcrunch at gmail.com
Fri Aug 19 14:31:33 BST 2005
Dear All,
I have a pxa board with samsung nand 64MB k91208UOM
loaded. I have been trying to implement yaffs on a 2.6.12.1 kernel but
all well and good untill I umount the nand partition , nothing is
retained
[root at Sarva /mnt]#mount -t yaffs /dev/mtdblock3 /mnt/nand/
yaffs: dev is 32505859 name is "(unavailable)"
yaffs: Attempting MTD mount on 31.3, "(unavailable)"
block 1 is bad
block 5 is bad
block 8 is bad
block 17 is bad
block 21 is bad
block 24 is bad
block 33 is bad
and so on
[root at Sarva /mnt]#df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock2 31488 24892 6596 79% /
/dev/mtdblock3 65520 12384 53136 19% /mnt/nand
[root at Sarva /mnt]#cat /proc/yaffs
YAFFS built:Aug 19 2005 13:02:27
$Id: yaffs_fs.c,v 1.35 2004/10/20 20:12:43 charles Exp $
$Id: yaffs_guts.c,v 1.37 2004/10/20 20:12:43 charles Exp $
Device yaffs
startBlock......... 1
endBlock........... 4095
chunkGroupBits..... 1
chunkGroupSize..... 2
nErasedBlocks...... 3327
nTnodesCreated..... 0
nFreeTnodes........ 0
nObjectsCreated.... 100
nFreeObjects....... 97
nFreeChunks........ 106464
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 0
nGCCopies.......... 0
garbageCollections. 0
passiveGCs......... 0
nRetriedWrites..... 0
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 3327
cacheHits.......... 0
nDeletedFiles...... 0
nUnlinkedFiles..... 0
nBackgroudDeletions 0
useNANDECC......... 1
Now if i try to copy a file to the partion it does it and i can even view it
[root at Sarva /mnt]#cp /root/exp/nanddump.c nand/
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Writing data without ECC to NAND-FLASH is not recommended
Reading data from NAND FLASH without ECC is not recommended
**>>ecc error fix performed on chunk 64:0
**>>ecc error fix performed on chunk 64:1
**>>Block 2 marked for retirement
Writing data without ECC to NAND-FLASH is not recommended
[root at Sarva nand]#ls -la
drw-rw-rw- 1 root root 512 Jan 1 00:11 .
drwxr-xr-x 5 root root 0 Jan 1 00:04 ..
drw-rw-rw- 1 root root 512 Jan 1 00:11 lost+found
-rw-r--r-- 1 root root 7372 Jan 1 00:12 nanddump.c
and
[root at Sarva nand]#cat /proc/yaffs
YAFFS built:Aug 19 2005 13:02:27
$Id: yaffs_fs.c,v 1.35 2004/10/20 20:12:43 charles Exp $
$Id: yaffs_guts.c,v 1.37 2004/10/20 20:12:43 charles Exp $
Device yaffs
startBlock......... 1
endBlock........... 4095
chunkGroupBits..... 1
chunkGroupSize..... 2
nErasedBlocks...... 3326
nTnodesCreated..... 100
nFreeTnodes........ 99
nObjectsCreated.... 100
nFreeObjects....... 96
nFreeChunks........ 106448
nPageWrites........ 18
nPageReads......... 1
nBlockErasures..... 0
nGCCopies.......... 0
garbageCollections. 0
passiveGCs......... 0
nRetriedWrites..... 0
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 3327
cacheHits.......... 0
nDeletedFiles...... 0
nUnlinkedFiles..... 0
nBackgroudDeletions 0
useNANDECC......... 1
Now after umounting and mounting again
[root at Sarva /mnt]#cd nand/
[root at Sarva nand]#df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock2 31488 24892 6596 79% /
/dev/mtdblock3 65520 12384 53136 19% /mnt/nand
Voila where we started from
My nand driver is
/*
* drivers/mtd/nand/spia.c
*
* Copyright (C) 2000 Steven J. Hill (sjhill at realitydiluted.com)
*
*
* 10-29-2001 TG change to support hardwarespecific access
* to controllines (due to change in nand.c)
* page_cache added
*
* $Id: spia.c,v 1.21 2003/07/11 15:12:29 dwmw2 Exp $
*
* 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 <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/sizes.h>
#include <asm/arch-pxa/pxa-regs.h>
/*
* MTD structure for SPIA board
*/
static struct mtd_info *spia_mtd = NULL;
/*
* Values specific to the SPIA board (used with EP7212 processor)
*/
#define SPIA_IO_BASE 0xd0000000 /* Start of EP7212 IO address space */
#define SPIA_FIO_BASE 0x06000000 /* Address where flash is mapped */
#define SPIA_PEDR 0x0080 /*
* IO offset to Port E data register
* where the CLE, ALE and NCE pins
* are wired to.
*/
#define SPIA_PEDDR 0x00c0 /*
* IO offset to Port E data direction
* register so we can control the IO
* lines.
*/
/*
* Module stuff
*/
//static int spia_io_base = SPIA_IO_BASE;
static int spia_fio_base = SPIA_FIO_BASE;
//static int spia_pedr = SPIA_PEDR;
//static int spia_peddr = SPIA_PEDDR;
//MODULE_PARM(spia_io_base, "i");
//MODULE_PARM(spia_fio_base, "i");
//MODULE_PARM(spia_pedr, "i");
//MODULE_PARM(spia_peddr, "i");
/*
* Define partitions for flash device
*/
const static struct mtd_partition partition_info[] = {
{ name: "Filesystem on nand",
offset: 0,
size: 64 * SZ_1M},
};
#define NUM_PARTITIONS 1
/*
* hardware specific access to control-lines
*/
static void spia_hwcontrol(struct mtd_info *mtd, int cmd){
switch(cmd){
case NAND_CTL_SETCLE: GPSR2 = 0x80000; break;
case NAND_CTL_CLRCLE:GPCR2 = 0x80000; break;
case NAND_CTL_SETALE: GPSR2 = 0x100000; break;
case NAND_CTL_CLRALE: GPCR2 = 0x100000; break;
case NAND_CTL_SETNCE: GPCR2 = 0x20000; break;
case NAND_CTL_CLRNCE: GPSR2 = 0x20000; break;
}
}
/*
* Main initialization routine
*/
int __init spia_init (void)
{
struct nand_chip *this;
GPSR2 = 0x60000;
GPDR2 |= 0x1e0000;
GPCR2 = 0x20000;
/* Allocate memory for MTD device structure and private data */
spia_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct nand_chip),
GFP_KERNEL);
if (!spia_mtd) {
printk ("Unable to allocate SPIA NAND MTD device structure.\n");
return -ENOMEM;
}
/* Get pointer to private data */
this = (struct nand_chip *) (&spia_mtd[1]);
/* Initialize structures */
memset((char *) spia_mtd, 0, sizeof(struct mtd_info));
memset((char *) this, 0, sizeof(struct nand_chip));
spia_fio_base=(unsigned long)ioremap(spia_fio_base,SZ_1K);
/* Link the private data with the MTD structure */
spia_mtd->priv = this;
/*
* Set GPIO Port E control register so that the pins are configured
* to be outputs for controlling the NAND flash.
*/
//(*(volatile unsigned char *) (spia_io_base + spia_peddr)) = 0x07;
/* Set address of NAND IO lines */
this->IO_ADDR_R = spia_fio_base;
this->IO_ADDR_W = spia_fio_base;
/* Set address of hardware control function */
this->hwcontrol = spia_hwcontrol;
/* 15 us command delay time */
this->chip_delay = 20;
this->eccmode = NAND_ECC_NONE;
/* Scan to find existence of the device */
if (nand_scan (spia_mtd, 1)) {
kfree (spia_mtd);
return -ENXIO;
}
/* Allocate memory for internal data buffer */
this->data_buf = kmalloc (sizeof(u_char) * (spia_mtd->oobblock
+ spia_mtd->oobsize), GFP_KERNEL);
if (!this->data_buf) {
printk ("Unable to allocate NAND data buffer for SPIA.\n");
kfree (spia_mtd);
return -ENOMEM;
}
/* Register the partitions */
add_mtd_partitions(spia_mtd, partition_info, NUM_PARTITIONS);
/* Return happy */
return 0;
}
module_init(spia_init);
/*
* Clean up routine
*/
#ifdef MODULE
static void __exit spia_cleanup (void)
{
struct nand_chip *this = (struct nand_chip *) &spia_mtd[1];
/* Unregister the device */
del_mtd_device (spia_mtd);
/* Free internal data buffer */
kfree (this->data_buf);
/* Free the MTD device structure */
kfree (spia_mtd);
}
module_exit(spia_cleanup);
#endif
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Steven J. Hill <sjhill at realitydiluted.com");
MODULE_DESCRIPTION("Board-specific glue layer for NAND flash on SPIA board");
--------------
and my .config of the kernel has these options
#
# File systems
#
CONFIG_YAFFS_FS=y
CONFIG_YAFFS_MTD_ENABLED=y
# CONFIG_YAFFS_RAM_ENABLED is not set
CONFIG_YAFFS_USE_NANDECC=y
# CONFIG_YAFFS_ECC_WRONG_ORDER is not set
CONFIG_YAFFS_USE_GENERIC_RW=y
# CONFIG_YAFFS_USE_HEADER_FILE_SIZE is not set
CONFIG_YAFFS_DISABLE_CHUNK_ERASED_CHECK=y
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
When ever i build the kernel i get to see these errors
fs/yaffs/yaffs_fs.c:169: warning: initialization from incompatible pointer type
fs/yaffs/yaffs_fs.c: At top level:
fs/yaffs/yaffs_fs.c:683: warning: 'yaffs_file_read' defined but not used
fs/yaffs/yaffs_fs.c:1480: warning: 'yaffs_internal_read_super_ram'
defined but not used
fs/yaffs/yaffs_fs.c:1550: warning: 'my_proc_ram_write_entry' defined
but not used
fs/yaffs/yaffs_fs.c:1623: warning: 'yaffs_proc_ram_write' defined but not used
Does anyone have any clues why this might be happening.
Manav
More information about the yaffs
mailing list