Commit ad0a4dd6 authored by David Woodhouse's avatar David Woodhouse

MTD: DiskOnChip driver fixes: MODULE_PARAM and __iomem, and fix RS init

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent b03c248a
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* Interface to generic NAND code for M-Systems DiskOnChip devices * Interface to generic NAND code for M-Systems DiskOnChip devices
* *
* $Id: diskonchip.c,v 1.38 2004/10/05 22:11:46 gleixner Exp $ * $Id: diskonchip.c,v 1.41 2004/11/05 16:07:16 kalev Exp $
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -102,17 +102,17 @@ static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd); ...@@ -102,17 +102,17 @@ static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd);
static void doc200x_select_chip(struct mtd_info *mtd, int chip); static void doc200x_select_chip(struct mtd_info *mtd, int chip);
static int debug=0; static int debug=0;
MODULE_PARM(debug, "i"); module_param(debug, int, 0);
static int try_dword=1; static int try_dword=1;
MODULE_PARM(try_dword, "i"); module_param(try_dword, int, 0);
static int no_ecc_failures=0; static int no_ecc_failures=0;
MODULE_PARM(no_ecc_failures, "i"); module_param(no_ecc_failures, int, 0);
#ifdef CONFIG_MTD_PARTITIONS #ifdef CONFIG_MTD_PARTITIONS
static int no_autopart=0; static int no_autopart=0;
MODULE_PARM(no_autopart, "i"); module_param(no_autopart, int, 0);
#endif #endif
#ifdef MTD_NAND_DISKONCHIP_BBTWRITE #ifdef MTD_NAND_DISKONCHIP_BBTWRITE
...@@ -120,10 +120,10 @@ static int inftl_bbt_write=1; ...@@ -120,10 +120,10 @@ static int inftl_bbt_write=1;
#else #else
static int inftl_bbt_write=0; static int inftl_bbt_write=0;
#endif #endif
MODULE_PARM(inftl_bbt_write, "i"); module_param(inftl_bbt_write, int, 0);
static unsigned long doc_config_location = CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS; static unsigned long doc_config_location = CONFIG_MTD_DISKONCHIP_PROBE_ADDRESS;
MODULE_PARM(doc_config_location, "l"); module_param(doc_config_location, ulong, 0);
MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe for DiskOnChip"); MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe for DiskOnChip");
...@@ -1505,7 +1505,7 @@ static inline int __init doc_probe(unsigned long physadr) ...@@ -1505,7 +1505,7 @@ static inline int __init doc_probe(unsigned long physadr)
int reg, len, numchips; int reg, len, numchips;
int ret = 0; int ret = 0;
virtadr = (void __iomem *)ioremap(physadr, DOC_IOREMAP_LEN); virtadr = ioremap(physadr, DOC_IOREMAP_LEN);
if (!virtadr) { if (!virtadr) {
printk(KERN_ERR "Diskonchip ioremap failed: 0x%x bytes at 0x%lx\n", DOC_IOREMAP_LEN, physadr); printk(KERN_ERR "Diskonchip ioremap failed: 0x%x bytes at 0x%lx\n", DOC_IOREMAP_LEN, physadr);
return -EIO; return -EIO;
...@@ -1722,22 +1722,7 @@ static void release_nanddoc(void) ...@@ -1722,22 +1722,7 @@ static void release_nanddoc(void)
int __init init_nanddoc(void) int __init init_nanddoc(void)
{ {
int i; int i, ret = 0;
if (doc_config_location) {
printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
return doc_probe(doc_config_location);
} else {
for (i=0; (doc_locations[i] != 0xffffffff); i++) {
doc_probe(doc_locations[i]);
}
}
/* No banner message any more. Print a message if no DiskOnChip
found, so the user knows we at least tried. */
if (!doclist) {
printk(KERN_INFO "No valid DiskOnChip devices found\n");
return -ENODEV;
}
/* We could create the decoder on demand, if memory is a concern. /* We could create the decoder on demand, if memory is a concern.
* This way we have it handy, if an error happens * This way we have it handy, if an error happens
...@@ -1751,11 +1736,30 @@ int __init init_nanddoc(void) ...@@ -1751,11 +1736,30 @@ int __init init_nanddoc(void)
rs_decoder = init_rs(10, 0x409, FCR, 1, NROOTS); rs_decoder = init_rs(10, 0x409, FCR, 1, NROOTS);
if (!rs_decoder) { if (!rs_decoder) {
printk (KERN_ERR "DiskOnChip: Could not create a RS decoder\n"); printk (KERN_ERR "DiskOnChip: Could not create a RS decoder\n");
release_nanddoc();
return -ENOMEM; return -ENOMEM;
} }
if (doc_config_location) {
printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
ret = doc_probe(doc_config_location);
if (ret < 0)
goto outerr;
} else {
for (i=0; (doc_locations[i] != 0xffffffff); i++) {
doc_probe(doc_locations[i]);
}
}
/* No banner message any more. Print a message if no DiskOnChip
found, so the user knows we at least tried. */
if (!doclist) {
printk(KERN_INFO "No valid DiskOnChip devices found\n");
ret = -ENODEV;
goto outerr;
}
return 0; return 0;
outerr:
free_rs(rs_decoder);
return ret;
} }
void __exit cleanup_nanddoc(void) void __exit cleanup_nanddoc(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment