* to controllines (due to change in nand.c)
* page_cache added
*
- * $Id: spia.c,v 1.24 2004/11/04 12:53:10 gleixner Exp $
+ * $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
static int spia_pedr = SPIA_PEDR;
static int spia_peddr = SPIA_PEDDR;
-module_param(spia_io_base, int, 0);
-module_param(spia_fio_base, int, 0);
-module_param(spia_pedr, int, 0);
-module_param(spia_peddr, int, 0);
+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
(*(volatile unsigned char *) (spia_io_base + spia_peddr)) = 0x07;
/* Set address of NAND IO lines */
- this->IO_ADDR_R = (void __iomem *) spia_fio_base;
- this->IO_ADDR_W = (void __iomem *) spia_fio_base;
+ 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 */
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);
#ifdef MODULE
static void __exit spia_cleanup (void)
{
- /* Release resources, unregister device */
- nand_release (spia_mtd);
+ 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);