X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmtd%2Fnand%2Fedb7312.c;h=79779406910317b635502e982a3cc7e4f492d269;hb=3ec04f3d2903fdf6d9849a8633af59b8628164a5;hp=5549681ccdce12b7597e34d125bbd8a524e168ef;hpb=8d40237c730b8be87c1b80a5d96b9c603fefa829;p=linux-2.6.git diff --git a/drivers/mtd/nand/edb7312.c b/drivers/mtd/nand/edb7312.c index 5549681cc..797794069 100644 --- a/drivers/mtd/nand/edb7312.c +++ b/drivers/mtd/nand/edb7312.c @@ -6,7 +6,7 @@ * Derived from drivers/mtd/nand/autcpu12.c * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) * - * $Id: edb7312.c,v 1.11 2004/11/04 12:53:10 gleixner Exp $ + * $Id: edb7312.c,v 1.8 2004/07/12 15:03:26 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 @@ -53,9 +53,19 @@ static struct mtd_info *ep7312_mtd = NULL; * Module stuff */ -static unsigned long ep7312_fio_pbase = EP7312_FIO_PBASE; -static void __iomem * ep7312_pxdr = (void __iomem *) EP7312_PXDR; -static void __iomem * ep7312_pxddr = (void __iomem *) EP7312_PXDDR; +static int ep7312_fio_pbase = EP7312_FIO_PBASE; +static int ep7312_pxdr = EP7312_PXDR; +static int ep7312_pxddr = EP7312_PXDDR; + +#ifdef MODULE +MODULE_PARM(ep7312_fio_pbase, "i"); +MODULE_PARM(ep7312_pxdr, "i"); +MODULE_PARM(ep7312_pxddr, "i"); + +__setup("ep7312_fio_pbase=",ep7312_fio_pbase); +__setup("ep7312_pxdr=",ep7312_pxdr); +__setup("ep7312_pxddr=",ep7312_pxddr); +#endif #ifdef CONFIG_MTD_PARTITIONS /* @@ -121,7 +131,7 @@ static int __init ep7312_init (void) const char *part_type = 0; int mtd_parts_nb = 0; struct mtd_partition *mtd_parts = 0; - void __iomem * ep7312_fio_base; + int ep7312_fio_base; /* Allocate memory for MTD device structure and private data */ ep7312_mtd = kmalloc(sizeof(struct mtd_info) + @@ -133,7 +143,7 @@ static int __init ep7312_init (void) } /* map physical adress */ - ep7312_fio_base = ioremap(ep7312_fio_pbase, SZ_1K); + ep7312_fio_base = (unsigned long)ioremap(ep7312_fio_pbase, SZ_1K); if(!ep7312_fio_base) { printk("ioremap EDB7312 NAND flash failed\n"); kfree(ep7312_mtd); @@ -171,7 +181,16 @@ static int __init ep7312_init (void) return -ENXIO; } -#ifdef CONFIG_MTD_PARTITIONS + /* Allocate memory for internal data buffer */ + this->data_buf = kmalloc (sizeof(u_char) * (ep7312_mtd->oobblock + ep7312_mtd->oobsize), GFP_KERNEL); + if (!this->data_buf) { + printk("Unable to allocate NAND data buffer for EDB7312.\n"); + iounmap((void *)ep7312_fio_base); + kfree (ep7312_mtd); + return -ENOMEM; + } + +#ifdef CONFIG_PARTITIONS ep7312_mtd->name = "edb7312-nand"; mtd_parts_nb = parse_mtd_partitions(ep7312_mtd, part_probes, &mtd_parts, 0); @@ -202,8 +221,8 @@ static void __exit ep7312_cleanup (void) { struct nand_chip *this = (struct nand_chip *) &ep7312_mtd[1]; - /* Release resources, unregister device */ - nand_release (ap7312_mtd); + /* Unregister the device */ + del_mtd_device (ep7312_mtd); /* Free internal data buffer */ kfree (this->data_buf);