diff options
Diffstat (limited to 'drivers/mtd/devices/docprobe.c')
-rw-r--r-- | drivers/mtd/devices/docprobe.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c index 197d67045e1e..13178b9dd00a 100644 --- a/drivers/mtd/devices/docprobe.c +++ b/drivers/mtd/devices/docprobe.c | |||
@@ -4,22 +4,22 @@ | |||
4 | /* (C) 1999 Machine Vision Holdings, Inc. */ | 4 | /* (C) 1999 Machine Vision Holdings, Inc. */ |
5 | /* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ | 5 | /* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ |
6 | 6 | ||
7 | /* $Id: docprobe.c,v 1.44 2005/01/05 12:40:36 dwmw2 Exp $ */ | 7 | /* $Id: docprobe.c,v 1.46 2005/11/07 11:14:25 gleixner Exp $ */ |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | /* DOC_PASSIVE_PROBE: | 11 | /* DOC_PASSIVE_PROBE: |
12 | In order to ensure that the BIOS checksum is correct at boot time, and | 12 | In order to ensure that the BIOS checksum is correct at boot time, and |
13 | hence that the onboard BIOS extension gets executed, the DiskOnChip | 13 | hence that the onboard BIOS extension gets executed, the DiskOnChip |
14 | goes into reset mode when it is read sequentially: all registers | 14 | goes into reset mode when it is read sequentially: all registers |
15 | return 0xff until the chip is woken up again by writing to the | 15 | return 0xff until the chip is woken up again by writing to the |
16 | DOCControl register. | 16 | DOCControl register. |
17 | 17 | ||
18 | Unfortunately, this means that the probe for the DiskOnChip is unsafe, | 18 | Unfortunately, this means that the probe for the DiskOnChip is unsafe, |
19 | because one of the first things it does is write to where it thinks | 19 | because one of the first things it does is write to where it thinks |
20 | the DOCControl register should be - which may well be shared memory | 20 | the DOCControl register should be - which may well be shared memory |
21 | for another device. I've had machines which lock up when this is | 21 | for another device. I've had machines which lock up when this is |
22 | attempted. Hence the possibility to do a passive probe, which will fail | 22 | attempted. Hence the possibility to do a passive probe, which will fail |
23 | to detect a chip in reset mode, but is at least guaranteed not to lock | 23 | to detect a chip in reset mode, but is at least guaranteed not to lock |
24 | the machine. | 24 | the machine. |
25 | 25 | ||
@@ -33,9 +33,9 @@ | |||
33 | 33 | ||
34 | The old Millennium-only driver has been retained just in case there | 34 | The old Millennium-only driver has been retained just in case there |
35 | are problems with the new code. If the combined driver doesn't work | 35 | are problems with the new code. If the combined driver doesn't work |
36 | for you, you can try the old one by undefining DOC_SINGLE_DRIVER | 36 | for you, you can try the old one by undefining DOC_SINGLE_DRIVER |
37 | below and also enabling it in your configuration. If this fixes the | 37 | below and also enabling it in your configuration. If this fixes the |
38 | problems, please send a report to the MTD mailing list at | 38 | problems, please send a report to the MTD mailing list at |
39 | <linux-mtd@lists.infradead.org>. | 39 | <linux-mtd@lists.infradead.org>. |
40 | */ | 40 | */ |
41 | #define DOC_SINGLE_DRIVER | 41 | #define DOC_SINGLE_DRIVER |
@@ -68,16 +68,16 @@ MODULE_PARM_DESC(doc_config_location, "Physical memory address at which to probe | |||
68 | static unsigned long __initdata doc_locations[] = { | 68 | static unsigned long __initdata doc_locations[] = { |
69 | #if defined (__alpha__) || defined(__i386__) || defined(__x86_64__) | 69 | #if defined (__alpha__) || defined(__i386__) || defined(__x86_64__) |
70 | #ifdef CONFIG_MTD_DOCPROBE_HIGH | 70 | #ifdef CONFIG_MTD_DOCPROBE_HIGH |
71 | 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000, | 71 | 0xfffc8000, 0xfffca000, 0xfffcc000, 0xfffce000, |
72 | 0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000, | 72 | 0xfffd0000, 0xfffd2000, 0xfffd4000, 0xfffd6000, |
73 | 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000, | 73 | 0xfffd8000, 0xfffda000, 0xfffdc000, 0xfffde000, |
74 | 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000, | 74 | 0xfffe0000, 0xfffe2000, 0xfffe4000, 0xfffe6000, |
75 | 0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000, | 75 | 0xfffe8000, 0xfffea000, 0xfffec000, 0xfffee000, |
76 | #else /* CONFIG_MTD_DOCPROBE_HIGH */ | 76 | #else /* CONFIG_MTD_DOCPROBE_HIGH */ |
77 | 0xc8000, 0xca000, 0xcc000, 0xce000, | 77 | 0xc8000, 0xca000, 0xcc000, 0xce000, |
78 | 0xd0000, 0xd2000, 0xd4000, 0xd6000, | 78 | 0xd0000, 0xd2000, 0xd4000, 0xd6000, |
79 | 0xd8000, 0xda000, 0xdc000, 0xde000, | 79 | 0xd8000, 0xda000, 0xdc000, 0xde000, |
80 | 0xe0000, 0xe2000, 0xe4000, 0xe6000, | 80 | 0xe0000, 0xe2000, 0xe4000, 0xe6000, |
81 | 0xe8000, 0xea000, 0xec000, 0xee000, | 81 | 0xe8000, 0xea000, 0xec000, 0xee000, |
82 | #endif /* CONFIG_MTD_DOCPROBE_HIGH */ | 82 | #endif /* CONFIG_MTD_DOCPROBE_HIGH */ |
83 | #elif defined(__PPC__) | 83 | #elif defined(__PPC__) |
@@ -111,35 +111,35 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
111 | return 0; | 111 | return 0; |
112 | #endif /* CONFIG_MTD_DOCPROBE_55AA */ | 112 | #endif /* CONFIG_MTD_DOCPROBE_55AA */ |
113 | 113 | ||
114 | #ifndef DOC_PASSIVE_PROBE | 114 | #ifndef DOC_PASSIVE_PROBE |
115 | /* It's not possible to cleanly detect the DiskOnChip - the | 115 | /* It's not possible to cleanly detect the DiskOnChip - the |
116 | * bootup procedure will put the device into reset mode, and | 116 | * bootup procedure will put the device into reset mode, and |
117 | * it's not possible to talk to it without actually writing | 117 | * it's not possible to talk to it without actually writing |
118 | * to the DOCControl register. So we store the current contents | 118 | * to the DOCControl register. So we store the current contents |
119 | * of the DOCControl register's location, in case we later decide | 119 | * of the DOCControl register's location, in case we later decide |
120 | * that it's not a DiskOnChip, and want to put it back how we | 120 | * that it's not a DiskOnChip, and want to put it back how we |
121 | * found it. | 121 | * found it. |
122 | */ | 122 | */ |
123 | tmp2 = ReadDOC(window, DOCControl); | 123 | tmp2 = ReadDOC(window, DOCControl); |
124 | 124 | ||
125 | /* Reset the DiskOnChip ASIC */ | 125 | /* Reset the DiskOnChip ASIC */ |
126 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, | 126 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, |
127 | window, DOCControl); | 127 | window, DOCControl); |
128 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, | 128 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_RESET, |
129 | window, DOCControl); | 129 | window, DOCControl); |
130 | 130 | ||
131 | /* Enable the DiskOnChip ASIC */ | 131 | /* Enable the DiskOnChip ASIC */ |
132 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, | 132 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, |
133 | window, DOCControl); | 133 | window, DOCControl); |
134 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, | 134 | WriteDOC(DOC_MODE_CLR_ERR | DOC_MODE_MDWREN | DOC_MODE_NORMAL, |
135 | window, DOCControl); | 135 | window, DOCControl); |
136 | #endif /* !DOC_PASSIVE_PROBE */ | 136 | #endif /* !DOC_PASSIVE_PROBE */ |
137 | 137 | ||
138 | /* We need to read the ChipID register four times. For some | 138 | /* We need to read the ChipID register four times. For some |
139 | newer DiskOnChip 2000 units, the first three reads will | 139 | newer DiskOnChip 2000 units, the first three reads will |
140 | return the DiskOnChip Millennium ident. Don't ask. */ | 140 | return the DiskOnChip Millennium ident. Don't ask. */ |
141 | ChipID = ReadDOC(window, ChipID); | 141 | ChipID = ReadDOC(window, ChipID); |
142 | 142 | ||
143 | switch (ChipID) { | 143 | switch (ChipID) { |
144 | case DOC_ChipID_Doc2k: | 144 | case DOC_ChipID_Doc2k: |
145 | /* Check the TOGGLE bit in the ECC register */ | 145 | /* Check the TOGGLE bit in the ECC register */ |
@@ -149,7 +149,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
149 | if (tmp != tmpb && tmp == tmpc) | 149 | if (tmp != tmpb && tmp == tmpc) |
150 | return ChipID; | 150 | return ChipID; |
151 | break; | 151 | break; |
152 | 152 | ||
153 | case DOC_ChipID_DocMil: | 153 | case DOC_ChipID_DocMil: |
154 | /* Check for the new 2000 with Millennium ASIC */ | 154 | /* Check for the new 2000 with Millennium ASIC */ |
155 | ReadDOC(window, ChipID); | 155 | ReadDOC(window, ChipID); |
@@ -164,7 +164,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
164 | if (tmp != tmpb && tmp == tmpc) | 164 | if (tmp != tmpb && tmp == tmpc) |
165 | return ChipID; | 165 | return ChipID; |
166 | break; | 166 | break; |
167 | 167 | ||
168 | case DOC_ChipID_DocMilPlus16: | 168 | case DOC_ChipID_DocMilPlus16: |
169 | case DOC_ChipID_DocMilPlus32: | 169 | case DOC_ChipID_DocMilPlus32: |
170 | case 0: | 170 | case 0: |
@@ -179,7 +179,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
179 | DOC_MODE_BDECT; | 179 | DOC_MODE_BDECT; |
180 | WriteDOC(tmp, window, Mplus_DOCControl); | 180 | WriteDOC(tmp, window, Mplus_DOCControl); |
181 | WriteDOC(~tmp, window, Mplus_CtrlConfirm); | 181 | WriteDOC(~tmp, window, Mplus_CtrlConfirm); |
182 | 182 | ||
183 | mdelay(1); | 183 | mdelay(1); |
184 | /* Enable the DiskOnChip ASIC */ | 184 | /* Enable the DiskOnChip ASIC */ |
185 | tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT | | 185 | tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT | |
@@ -187,7 +187,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
187 | WriteDOC(tmp, window, Mplus_DOCControl); | 187 | WriteDOC(tmp, window, Mplus_DOCControl); |
188 | WriteDOC(~tmp, window, Mplus_CtrlConfirm); | 188 | WriteDOC(~tmp, window, Mplus_CtrlConfirm); |
189 | mdelay(1); | 189 | mdelay(1); |
190 | #endif /* !DOC_PASSIVE_PROBE */ | 190 | #endif /* !DOC_PASSIVE_PROBE */ |
191 | 191 | ||
192 | ChipID = ReadDOC(window, ChipID); | 192 | ChipID = ReadDOC(window, ChipID); |
193 | 193 | ||
@@ -227,7 +227,7 @@ static inline int __init doccheck(void __iomem *potential, unsigned long physadr | |||
227 | WriteDOC(tmp2, window, DOCControl); | 227 | WriteDOC(tmp2, window, DOCControl); |
228 | #endif | 228 | #endif |
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | static int docfound; | 232 | static int docfound; |
233 | 233 | ||
@@ -244,10 +244,10 @@ static void __init DoC_Probe(unsigned long physadr) | |||
244 | void (*initroutine)(struct mtd_info *) = NULL; | 244 | void (*initroutine)(struct mtd_info *) = NULL; |
245 | 245 | ||
246 | docptr = ioremap(physadr, DOC_IOREMAP_LEN); | 246 | docptr = ioremap(physadr, DOC_IOREMAP_LEN); |
247 | 247 | ||
248 | if (!docptr) | 248 | if (!docptr) |
249 | return; | 249 | return; |
250 | 250 | ||
251 | if ((ChipID = doccheck(docptr, physadr))) { | 251 | if ((ChipID = doccheck(docptr, physadr))) { |
252 | if (ChipID == DOC_ChipID_Doc2kTSOP) { | 252 | if (ChipID == DOC_ChipID_Doc2kTSOP) { |
253 | /* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */ | 253 | /* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */ |
@@ -263,9 +263,9 @@ static void __init DoC_Probe(unsigned long physadr) | |||
263 | iounmap(docptr); | 263 | iounmap(docptr); |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | 266 | ||
267 | this = (struct DiskOnChip *)(&mtd[1]); | 267 | this = (struct DiskOnChip *)(&mtd[1]); |
268 | 268 | ||
269 | memset((char *)mtd,0, sizeof(struct mtd_info)); | 269 | memset((char *)mtd,0, sizeof(struct mtd_info)); |
270 | memset((char *)this, 0, sizeof(struct DiskOnChip)); | 270 | memset((char *)this, 0, sizeof(struct DiskOnChip)); |
271 | 271 | ||
@@ -281,13 +281,13 @@ static void __init DoC_Probe(unsigned long physadr) | |||
281 | im_funcname = "DoC2k_init"; | 281 | im_funcname = "DoC2k_init"; |
282 | im_modname = "doc2000"; | 282 | im_modname = "doc2000"; |
283 | break; | 283 | break; |
284 | 284 | ||
285 | case DOC_ChipID_Doc2k: | 285 | case DOC_ChipID_Doc2k: |
286 | name="2000"; | 286 | name="2000"; |
287 | im_funcname = "DoC2k_init"; | 287 | im_funcname = "DoC2k_init"; |
288 | im_modname = "doc2000"; | 288 | im_modname = "doc2000"; |
289 | break; | 289 | break; |
290 | 290 | ||
291 | case DOC_ChipID_DocMil: | 291 | case DOC_ChipID_DocMil: |
292 | name="Millennium"; | 292 | name="Millennium"; |
293 | #ifdef DOC_SINGLE_DRIVER | 293 | #ifdef DOC_SINGLE_DRIVER |
@@ -331,7 +331,7 @@ static void __init DoC_Probe(unsigned long physadr) | |||
331 | static int __init init_doc(void) | 331 | static int __init init_doc(void) |
332 | { | 332 | { |
333 | int i; | 333 | int i; |
334 | 334 | ||
335 | if (doc_config_location) { | 335 | if (doc_config_location) { |
336 | printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location); | 336 | printk(KERN_INFO "Using configured DiskOnChip probe address 0x%lx\n", doc_config_location); |
337 | DoC_Probe(doc_config_location); | 337 | DoC_Probe(doc_config_location); |