* This is a device driver for the NAND flash device found on the
* TI fido board. It supports 32MiB and 64MiB cards
*
- * $Id: toto.c,v 1.2 2003/10/21 10:04:58 dwmw2 Exp $
+ * $Id: toto.c,v 1.5 2005/11/07 11:14:31 gleixner Exp $
*/
#include <linux/slab.h>
*/
static struct mtd_info *toto_mtd = NULL;
-static int toto_io_base = OMAP_FLASH_1_BASE;
+static unsigned long toto_io_base = OMAP_FLASH_1_BASE;
#define CONFIG_NAND_WORKAROUND 1
#endif
#define T_NAND_CTL_SETNCE(iob) gpiosetout(NAND_NCE, 0)
#define T_NAND_CTL_CLRNCE(iob) gpiosetout(NAND_NCE, NAND_NCE)
-
+
/*
* Define partitions for flash devices
*/
#define NUM_PARTITIONS32M 3
#define NUM_PARTITIONS64M 4
-/*
+/*
* hardware specific access to control-lines
*/
this->hwcontrol = toto_hwcontrol;
this->dev_ready = NULL;
/* 25 us command delay time */
- this->chip_delay = 30;
+ this->chip_delay = 30;
this->eccmode = NAND_ECC_SOFT;
/* Scan to find existance of the device */
goto out_mtd;
}
- /* Allocate memory for internal data buffer */
- this->data_buf = kmalloc (sizeof(u_char) * (toto_mtd->oobblock + toto_mtd->oobsize), GFP_KERNEL);
- if (!this->data_buf) {
- printk (KERN_WARNING "Unable to allocate NAND data buffer for toto.\n");
- err = -ENOMEM;
- goto out_mtd;
- }
-
/* Register the partitions */
switch(toto_mtd->size){
- case SZ_64M: add_mtd_partitions(toto_mtd, partition_info64M, NUM_PARTITIONS64M); break;
- case SZ_32M: add_mtd_partitions(toto_mtd, partition_info32M, NUM_PARTITIONS32M); break;
+ case SZ_64M: add_mtd_partitions(toto_mtd, partition_info64M, NUM_PARTITIONS64M); break;
+ case SZ_32M: add_mtd_partitions(toto_mtd, partition_info32M, NUM_PARTITIONS32M); break;
default: {
- printk (KERN_WARNING "Unsupported Nand device\n");
+ printk (KERN_WARNING "Unsupported Nand device\n");
err = -ENXIO;
goto out_buf;
}
archflashwp(0,0); /* open up flash for writing */
goto out;
-
+
out_buf:
- kfree (this->data_buf);
+ kfree (this->data_buf);
out_mtd:
kfree (toto_mtd);
out:
*/
static void __exit toto_cleanup (void)
{
- struct nand_chip *this = (struct nand_chip *) &toto_mtd[1];
-
- /* Unregister partitions */
- del_mtd_partitions(toto_mtd);
-
- /* Unregister the device */
- del_mtd_device (toto_mtd);
-
- /* Free internal data buffers */
- kfree (this->data_buf);
+ /* Release resources, unregister device */
+ nand_release (toto_mtd);
/* Free the MTD device structure */
kfree (toto_mtd);
/* stop flash writes */
archflashwp(0,1);
-
+
/* release gpios to system */
gpiorelease(NAND_MASK);
}