38 #define DOC_SINGLE_DRIVER
40 #include <linux/kernel.h>
41 #include <linux/module.h>
42 #include <asm/errno.h>
45 #include <linux/slab.h>
47 #include <linux/types.h>
54 static unsigned long doc_config_location = CONFIG_MTD_DOCPROBE_ADDRESS;
56 MODULE_PARM_DESC(doc_config_location,
"Physical memory address at which to probe for DiskOnChip");
58 static unsigned long __initdata doc_locations[] = {
59 #if defined (__alpha__) || defined(__i386__) || defined(__x86_64__)
60 #ifdef CONFIG_MTD_DOCPROBE_HIGH
61 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000,
62 0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000,
63 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000,
64 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000,
65 0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000,
67 0xc8000, 0xca000, 0xcc000, 0xce000,
68 0xd0000, 0xd2000, 0xd4000, 0xd6000,
69 0xd8000, 0xda000, 0xdc000, 0xde000,
70 0xe0000, 0xe2000, 0xe4000, 0xe6000,
71 0xe8000, 0xea000, 0xec000, 0xee000,
74 #warning Unknown architecture for DiskOnChip. No default probe locations defined
80 static inline int __init doccheck(
void __iomem *potential,
unsigned long physadr)
83 unsigned char tmp, tmpb, tmpc, ChipID;
84 #ifndef DOC_PASSIVE_PROBE
90 #ifdef CONFIG_MTD_DOCPROBE_55AA
93 if (
ReadDOC(window, Sig1) != 0x55 ||
ReadDOC(window, Sig2) != 0xaa)
97 #ifndef DOC_PASSIVE_PROBE
106 tmp2 =
ReadDOC(window, DOCControl);
124 ChipID =
ReadDOC(window, ChipID);
132 if (tmp != tmpb && tmp == tmpc)
147 if (tmp != tmpb && tmp == tmpc)
155 #ifndef DOC_PASSIVE_PROBE
157 for (tmp = 0; (tmp < 4); tmp++)
163 WriteDOC(tmp, window, Mplus_DOCControl);
164 WriteDOC(~tmp, window, Mplus_CtrlConfirm);
170 WriteDOC(tmp, window, Mplus_DOCControl);
171 WriteDOC(~tmp, window, Mplus_CtrlConfirm);
175 ChipID =
ReadDOC(window, ChipID);
184 if (tmp != tmpb && tmp == tmpc)
193 #ifdef CONFIG_MTD_DOCPROBE_55AA
194 printk(
KERN_DEBUG "Possible DiskOnChip with unknown ChipID %2.2X found at 0x%lx\n",
197 #ifndef DOC_PASSIVE_PROBE
208 #ifndef DOC_PASSIVE_PROBE
221 static void __init DoC_Probe(
unsigned long physadr)
228 char *
name = namebuf;
236 if ((ChipID = doccheck(docptr, physadr))) {
239 printk(
KERN_NOTICE "Refusing to drive DiskOnChip 2000 TSOP until Bad Block Table is correctly supported by INFTL\n");
256 sprintf(namebuf,
"with ChipID %2.2X", ChipID);
271 #ifdef DOC_SINGLE_DRIVER
280 name=
"MillenniumPlus";
290 printk(
KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr);
303 static int __init init_doc(
void)
307 if (doc_config_location) {
308 printk(
KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location);
309 DoC_Probe(doc_config_location);
311 for (i=0; (doc_locations[
i] != 0xffffffff); i++) {
312 DoC_Probe(doc_locations[i]);