aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/Kconfig115
-rw-r--r--drivers/mtd/maps/Makefile7
-rw-r--r--drivers/mtd/maps/alchemy-flash.c12
-rw-r--r--drivers/mtd/maps/amd76xrom.c20
-rw-r--r--drivers/mtd/maps/arctic-mtd.c6
-rw-r--r--drivers/mtd/maps/autcpu12-nvram.c18
-rw-r--r--drivers/mtd/maps/bast-flash.c22
-rw-r--r--drivers/mtd/maps/beech-mtd.c6
-rw-r--r--drivers/mtd/maps/cdb89712.c34
-rw-r--r--drivers/mtd/maps/ceiva.c3
-rw-r--r--drivers/mtd/maps/cfi_flagadm.c12
-rw-r--r--drivers/mtd/maps/cstm_mips_ixx.c24
-rw-r--r--drivers/mtd/maps/dbox2-flash.c38
-rw-r--r--drivers/mtd/maps/dc21285.c34
-rw-r--r--drivers/mtd/maps/dilnetpc.c32
-rw-r--r--drivers/mtd/maps/dmv182.c8
-rw-r--r--drivers/mtd/maps/ebony.c6
-rw-r--r--drivers/mtd/maps/edb7312.c10
-rw-r--r--drivers/mtd/maps/epxa10db-flash.c12
-rw-r--r--drivers/mtd/maps/fortunet.c4
-rw-r--r--drivers/mtd/maps/h720x-flash.c16
-rw-r--r--drivers/mtd/maps/ichxrom.c21
-rw-r--r--drivers/mtd/maps/impa7.c16
-rw-r--r--drivers/mtd/maps/integrator-flash.c20
-rw-r--r--drivers/mtd/maps/ipaq-flash.c37
-rw-r--r--drivers/mtd/maps/iq80310.c7
-rw-r--r--drivers/mtd/maps/ixp2000.c35
-rw-r--r--drivers/mtd/maps/ixp4xx.c56
-rw-r--r--drivers/mtd/maps/l440gx.c18
-rw-r--r--drivers/mtd/maps/lubbock-flash.c17
-rw-r--r--drivers/mtd/maps/mainstone-flash.c22
-rw-r--r--drivers/mtd/maps/mbx860.c6
-rw-r--r--drivers/mtd/maps/mtx-1_flash.c96
-rw-r--r--drivers/mtd/maps/netsc520.c32
-rw-r--r--drivers/mtd/maps/nettel.c8
-rw-r--r--drivers/mtd/maps/ocelot.c10
-rw-r--r--drivers/mtd/maps/octagon-5066.c36
-rw-r--r--drivers/mtd/maps/omap-toto-flash.c23
-rw-r--r--drivers/mtd/maps/omap_nor.c2
-rw-r--r--drivers/mtd/maps/pci.c6
-rw-r--r--drivers/mtd/maps/pcmciamtd.c30
-rw-r--r--drivers/mtd/maps/physmap.c8
-rw-r--r--drivers/mtd/maps/plat-ram.c13
-rw-r--r--drivers/mtd/maps/pnc2000.c8
-rw-r--r--drivers/mtd/maps/pq2fads.c88
-rw-r--r--drivers/mtd/maps/redwood.c4
-rw-r--r--drivers/mtd/maps/sa1100-flash.c9
-rw-r--r--drivers/mtd/maps/sbc8240.c4
-rw-r--r--drivers/mtd/maps/sbc_gxx.c46
-rw-r--r--drivers/mtd/maps/sc520cdp.c6
-rw-r--r--drivers/mtd/maps/scx200_docflash.c46
-rw-r--r--drivers/mtd/maps/sharpsl-flash.c12
-rw-r--r--drivers/mtd/maps/solutionengine.c4
-rw-r--r--drivers/mtd/maps/sun_uflash.c16
-rw-r--r--drivers/mtd/maps/tqm834x.c291
-rw-r--r--drivers/mtd/maps/tqm8xxl.c26
-rw-r--r--drivers/mtd/maps/ts5500_flash.c44
-rw-r--r--drivers/mtd/maps/tsunami_flash.c6
-rw-r--r--drivers/mtd/maps/uclinux.c4
-rw-r--r--drivers/mtd/maps/vmax301.c24
-rw-r--r--drivers/mtd/maps/walnut.c16
-rw-r--r--drivers/mtd/maps/wr_sbc82xx_flash.c6
62 files changed, 1034 insertions, 584 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 44781a83b2e..48638c8097a 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -1,5 +1,5 @@
1# drivers/mtd/maps/Kconfig 1# drivers/mtd/maps/Kconfig
2# $Id: Kconfig,v 1.55 2005/07/02 01:53:24 tpoynor Exp $ 2# $Id: Kconfig,v 1.61 2005/11/07 11:14:26 gleixner Exp $
3 3
4menu "Mapping drivers for chip access" 4menu "Mapping drivers for chip access"
5 depends on MTD!=n 5 depends on MTD!=n
@@ -64,9 +64,9 @@ config MTD_SUN_UFLASH
64 tristate "Sun Microsystems userflash support" 64 tristate "Sun Microsystems userflash support"
65 depends on (SPARC32 || SPARC64) && MTD_CFI 65 depends on (SPARC32 || SPARC64) && MTD_CFI
66 help 66 help
67 This provides a 'mapping' driver which supports the way in 67 This provides a 'mapping' driver which supports the way in
68 which user-programmable flash chips are connected on various 68 which user-programmable flash chips are connected on various
69 Sun Microsystems boardsets. This driver will require CFI support 69 Sun Microsystems boardsets. This driver will require CFI support
70 in the kernel, so if you did not enable CFI previously, do that now. 70 in the kernel, so if you did not enable CFI previously, do that now.
71 71
72config MTD_PNC2000 72config MTD_PNC2000
@@ -89,22 +89,22 @@ config MTD_NETSC520
89 depends on X86 && MTD_CFI && MTD_PARTITIONS 89 depends on X86 && MTD_CFI && MTD_PARTITIONS
90 help 90 help
91 This enables access routines for the flash chips on the AMD NetSc520 91 This enables access routines for the flash chips on the AMD NetSc520
92 demonstration board. If you have one of these boards and would like 92 demonstration board. If you have one of these boards and would like
93 to use the flash chips on it, say 'Y'. 93 to use the flash chips on it, say 'Y'.
94 94
95config MTD_TS5500 95config MTD_TS5500
96 tristate "JEDEC Flash device mapped on Technologic Systems TS-5500" 96 tristate "JEDEC Flash device mapped on Technologic Systems TS-5500"
97 depends on X86 && MTD_JEDECPROBE && MTD_PARTITIONS 97 depends on ELAN
98 select MTD_PARTITIONS
99 select MTD_JEDECPROBE
100 select MTD_CFI_AMDSTD
98 help 101 help
99 This provides a driver for the on-board flash of the Technologic 102 This provides a driver for the on-board flash of the Technologic
100 System's TS-5500 board. The flash is split into 3 partitions 103 System's TS-5500 board. The 2MB flash is split into 3 partitions
101 which are accessed as separate MTD devices. 104 which are accessed as separate MTD devices.
102 105
103 mtd0 and mtd2 are the two BIOS drives. Unfortunately the BIOS 106 mtd0 and mtd2 are the two BIOS drives, which use the resident
104 uses a proprietary flash translation layer from General Software, 107 flash disk (RFD) flash translation layer.
105 which is not supported (the drives cannot be mounted). You can
106 create your own file system (jffs for example), but the BIOS
107 won't be able to boot from it.
108 108
109 mtd1 allows you to reprogram your BIOS. BE VERY CAREFUL. 109 mtd1 allows you to reprogram your BIOS. BE VERY CAREFUL.
110 110
@@ -212,11 +212,18 @@ config MTD_NETtel
212 Support for flash chips on NETtel/SecureEdge/SnapGear boards. 212 Support for flash chips on NETtel/SecureEdge/SnapGear boards.
213 213
214config MTD_ALCHEMY 214config MTD_ALCHEMY
215 tristate ' AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support' 215 tristate ' AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support'
216 depends on MIPS && SOC_AU1X00 216 depends on SOC_AU1X00
217 help 217 help
218 Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards 218 Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards
219 219
220config MTD_MTX1
221 tristate "4G Systems MTX-1 Flash device"
222 depends on MIPS && MIPS_MTX1
223 help
224 Flash memory access on 4G Systems MTX-1 Board. If you have one of
225 these boards and would like to use the flash chips on it, say 'Y'.
226
220config MTD_DILNETPC 227config MTD_DILNETPC
221 tristate "CFI Flash device mapped on DIL/Net PC" 228 tristate "CFI Flash device mapped on DIL/Net PC"
222 depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT 229 depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
@@ -244,14 +251,14 @@ config MTD_L440GX
244 251
245config MTD_SBC8240 252config MTD_SBC8240
246 tristate "Flash device on SBC8240" 253 tristate "Flash device on SBC8240"
247 depends on PPC32 && MTD_JEDECPROBE && 6xx && 8260 254 depends on MTD_JEDECPROBE && 8260
248 help 255 help
249 Flash access on the SBC8240 board from Wind River. See 256 Flash access on the SBC8240 board from Wind River. See
250 <http://www.windriver.com/products/sbc8240/> 257 <http://www.windriver.com/products/sbc8240/>
251 258
252config MTD_TQM8XXL 259config MTD_TQM8XXL
253 tristate "CFI Flash device mapped on TQM8XXL" 260 tristate "CFI Flash device mapped on TQM8XXL"
254 depends on MTD_CFI && PPC32 && 8xx && TQM8xxL 261 depends on MTD_CFI && TQM8xxL
255 help 262 help
256 The TQM8xxL PowerPC board has up to two banks of CFI-compliant 263 The TQM8xxL PowerPC board has up to two banks of CFI-compliant
257 chips, currently uses AMD one. This 'mapping' driver supports 264 chips, currently uses AMD one. This 'mapping' driver supports
@@ -261,7 +268,7 @@ config MTD_TQM8XXL
261 268
262config MTD_RPXLITE 269config MTD_RPXLITE
263 tristate "CFI Flash device mapped on RPX Lite or CLLF" 270 tristate "CFI Flash device mapped on RPX Lite or CLLF"
264 depends on MTD_CFI && PPC32 && 8xx && (RPXCLASSIC || RPXLITE) 271 depends on MTD_CFI && (RPXCLASSIC || RPXLITE)
265 help 272 help
266 The RPXLite PowerPC board has CFI-compliant chips mapped in 273 The RPXLite PowerPC board has CFI-compliant chips mapped in
267 a strange sparse mapping. This 'mapping' driver supports that 274 a strange sparse mapping. This 'mapping' driver supports that
@@ -271,7 +278,7 @@ config MTD_RPXLITE
271 278
272config MTD_MBX860 279config MTD_MBX860
273 tristate "System flash on MBX860 board" 280 tristate "System flash on MBX860 board"
274 depends on MTD_CFI && PPC32 && 8xx && MBX 281 depends on MTD_CFI && MBX
275 help 282 help
276 This enables access routines for the flash chips on the Motorola 283 This enables access routines for the flash chips on the Motorola
277 MBX860 board. If you have one of these boards and would like 284 MBX860 board. If you have one of these boards and would like
@@ -279,7 +286,7 @@ config MTD_MBX860
279 286
280config MTD_DBOX2 287config MTD_DBOX2
281 tristate "CFI Flash device mapped on D-Box2" 288 tristate "CFI Flash device mapped on D-Box2"
282 depends on PPC32 && 8xx && DBOX2 && MTD_CFI_INTELSTD && MTD_CFI_INTELEXT && MTD_CFI_AMDSTD 289 depends on DBOX2 && MTD_CFI_INTELSTD && MTD_CFI_INTELEXT && MTD_CFI_AMDSTD
283 help 290 help
284 This enables access routines for the flash chips on the Nokia/Sagem 291 This enables access routines for the flash chips on the Nokia/Sagem
285 D-Box 2 board. If you have one of these boards and would like to use 292 D-Box 2 board. If you have one of these boards and would like to use
@@ -287,14 +294,14 @@ config MTD_DBOX2
287 294
288config MTD_CFI_FLAGADM 295config MTD_CFI_FLAGADM
289 tristate "CFI Flash device mapping on FlagaDM" 296 tristate "CFI Flash device mapping on FlagaDM"
290 depends on PPC32 && 8xx && MTD_CFI 297 depends on 8xx && MTD_CFI
291 help 298 help
292 Mapping for the Flaga digital module. If you don't have one, ignore 299 Mapping for the Flaga digital module. If you don't have one, ignore
293 this setting. 300 this setting.
294 301
295config MTD_BEECH 302config MTD_BEECH
296 tristate "CFI Flash device mapped on IBM 405LP Beech" 303 tristate "CFI Flash device mapped on IBM 405LP Beech"
297 depends on MTD_CFI && PPC32 && 40x && BEECH 304 depends on MTD_CFI && BEECH
298 help 305 help
299 This enables access routines for the flash chips on the IBM 306 This enables access routines for the flash chips on the IBM
300 405LP Beech board. If you have one of these boards and would like 307 405LP Beech board. If you have one of these boards and would like
@@ -302,7 +309,7 @@ config MTD_BEECH
302 309
303config MTD_ARCTIC 310config MTD_ARCTIC
304 tristate "CFI Flash device mapped on IBM 405LP Arctic" 311 tristate "CFI Flash device mapped on IBM 405LP Arctic"
305 depends on MTD_CFI && PPC32 && 40x && ARCTIC2 312 depends on MTD_CFI && ARCTIC2
306 help 313 help
307 This enables access routines for the flash chips on the IBM 405LP 314 This enables access routines for the flash chips on the IBM 405LP
308 Arctic board. If you have one of these boards and would like to 315 Arctic board. If you have one of these boards and would like to
@@ -310,7 +317,7 @@ config MTD_ARCTIC
310 317
311config MTD_WALNUT 318config MTD_WALNUT
312 tristate "Flash device mapped on IBM 405GP Walnut" 319 tristate "Flash device mapped on IBM 405GP Walnut"
313 depends on MTD_JEDECPROBE && PPC32 && 40x && WALNUT 320 depends on MTD_JEDECPROBE && WALNUT
314 help 321 help
315 This enables access routines for the flash chips on the IBM 405GP 322 This enables access routines for the flash chips on the IBM 405GP
316 Walnut board. If you have one of these boards and would like to 323 Walnut board. If you have one of these boards and would like to
@@ -318,7 +325,7 @@ config MTD_WALNUT
318 325
319config MTD_EBONY 326config MTD_EBONY
320 tristate "Flash devices mapped on IBM 440GP Ebony" 327 tristate "Flash devices mapped on IBM 440GP Ebony"
321 depends on MTD_JEDECPROBE && PPC32 && 44x && EBONY 328 depends on MTD_JEDECPROBE && EBONY
322 help 329 help
323 This enables access routines for the flash chips on the IBM 440GP 330 This enables access routines for the flash chips on the IBM 440GP
324 Ebony board. If you have one of these boards and would like to 331 Ebony board. If you have one of these boards and would like to
@@ -326,7 +333,7 @@ config MTD_EBONY
326 333
327config MTD_OCOTEA 334config MTD_OCOTEA
328 tristate "Flash devices mapped on IBM 440GX Ocotea" 335 tristate "Flash devices mapped on IBM 440GX Ocotea"
329 depends on MTD_CFI && PPC32 && 44x && OCOTEA 336 depends on MTD_CFI && OCOTEA
330 help 337 help
331 This enables access routines for the flash chips on the IBM 440GX 338 This enables access routines for the flash chips on the IBM 440GX
332 Ocotea board. If you have one of these boards and would like to 339 Ocotea board. If you have one of these boards and would like to
@@ -334,12 +341,20 @@ config MTD_OCOTEA
334 341
335config MTD_REDWOOD 342config MTD_REDWOOD
336 tristate "CFI Flash devices mapped on IBM Redwood" 343 tristate "CFI Flash devices mapped on IBM Redwood"
337 depends on MTD_CFI && PPC32 && 4xx && 40x && ( REDWOOD_4 || REDWOOD_5 || REDWOOD_6 ) 344 depends on MTD_CFI && ( REDWOOD_4 || REDWOOD_5 || REDWOOD_6 )
338 help 345 help
339 This enables access routines for the flash chips on the IBM 346 This enables access routines for the flash chips on the IBM
340 Redwood board. If you have one of these boards and would like to 347 Redwood board. If you have one of these boards and would like to
341 use the flash chips on it, say 'Y'. 348 use the flash chips on it, say 'Y'.
342 349
350config MTD_TQM834x
351 tristate "Flash device mapped on TQ Components TQM834x Boards"
352 depends on MTD_CFI && TQM834x
353 help
354 This enables access routines for the flash chips on the
355 TQ Components TQM834x boards. If you have one of these boards
356 and would like to use the flash chips on it, say 'Y'.
357
343config MTD_CSTM_MIPS_IXX 358config MTD_CSTM_MIPS_IXX
344 tristate "Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board" 359 tristate "Flash chip mapping on ITE QED-4N-S01B, Globespan IVR or custom board"
345 depends on MIPS && MTD_CFI && MTD_JEDECPROBE && MTD_PARTITIONS 360 depends on MIPS && MTD_CFI && MTD_JEDECPROBE && MTD_PARTITIONS
@@ -362,8 +377,8 @@ config MTD_CSTM_MIPS_IXX_START
362 default "0x8000000" 377 default "0x8000000"
363 help 378 help
364 This is the physical memory location that the MTD driver will 379 This is the physical memory location that the MTD driver will
365 use for the flash chips on your particular target board. 380 use for the flash chips on your particular target board.
366 Refer to the memory map which should hopefully be in the 381 Refer to the memory map which should hopefully be in the
367 documentation for your board. 382 documentation for your board.
368 383
369config MTD_CSTM_MIPS_IXX_LEN 384config MTD_CSTM_MIPS_IXX_LEN
@@ -371,7 +386,7 @@ config MTD_CSTM_MIPS_IXX_LEN
371 depends on MTD_CSTM_MIPS_IXX 386 depends on MTD_CSTM_MIPS_IXX
372 default "0x4000000" 387 default "0x4000000"
373 help 388 help
374 This is the total length that the MTD driver will use for the 389 This is the total length that the MTD driver will use for the
375 flash chips on your particular board. Refer to the memory 390 flash chips on your particular board. Refer to the memory
376 map which should hopefully be in the documentation for your 391 map which should hopefully be in the documentation for your
377 board. 392 board.
@@ -405,14 +420,14 @@ config MTD_ARM_INTEGRATOR
405 420
406config MTD_CDB89712 421config MTD_CDB89712
407 tristate "Cirrus CDB89712 evaluation board mappings" 422 tristate "Cirrus CDB89712 evaluation board mappings"
408 depends on ARM && MTD_CFI && ARCH_CDB89712 423 depends on MTD_CFI && ARCH_CDB89712
409 help 424 help
410 This enables access to the flash or ROM chips on the CDB89712 board. 425 This enables access to the flash or ROM chips on the CDB89712 board.
411 If you have such a board, say 'Y'. 426 If you have such a board, say 'Y'.
412 427
413config MTD_SA1100 428config MTD_SA1100
414 tristate "CFI Flash device mapped on StrongARM SA11x0" 429 tristate "CFI Flash device mapped on StrongARM SA11x0"
415 depends on ARM && MTD_CFI && ARCH_SA1100 && MTD_PARTITIONS 430 depends on MTD_CFI && ARCH_SA1100 && MTD_PARTITIONS
416 help 431 help
417 This enables access to the flash chips on most platforms based on 432 This enables access to the flash chips on most platforms based on
418 the SA1100 and SA1110, including the Assabet and the Compaq iPAQ. 433 the SA1100 and SA1110, including the Assabet and the Compaq iPAQ.
@@ -420,13 +435,13 @@ config MTD_SA1100
420 435
421config MTD_IPAQ 436config MTD_IPAQ
422 tristate "CFI Flash device mapped on Compaq/HP iPAQ" 437 tristate "CFI Flash device mapped on Compaq/HP iPAQ"
423 depends on ARM && IPAQ_HANDHELD && MTD_CFI 438 depends on IPAQ_HANDHELD && MTD_CFI
424 help 439 help
425 This provides a driver for the on-board flash of the iPAQ. 440 This provides a driver for the on-board flash of the iPAQ.
426 441
427config MTD_DC21285 442config MTD_DC21285
428 tristate "CFI Flash device mapped on DC21285 Footbridge" 443 tristate "CFI Flash device mapped on DC21285 Footbridge"
429 depends on ARM && MTD_CFI && ARCH_FOOTBRIDGE && MTD_COMPLEX_MAPPINGS 444 depends on MTD_CFI && ARCH_FOOTBRIDGE && MTD_COMPLEX_MAPPINGS
430 help 445 help
431 This provides a driver for the flash accessed using Intel's 446 This provides a driver for the flash accessed using Intel's
432 21285 bridge used with Intel's StrongARM processors. More info at 447 21285 bridge used with Intel's StrongARM processors. More info at
@@ -434,33 +449,33 @@ config MTD_DC21285
434 449
435config MTD_IQ80310 450config MTD_IQ80310
436 tristate "CFI Flash device mapped on the XScale IQ80310 board" 451 tristate "CFI Flash device mapped on the XScale IQ80310 board"
437 depends on ARM && MTD_CFI && ARCH_IQ80310 452 depends on MTD_CFI && ARCH_IQ80310
438 help 453 help
439 This enables access routines for the flash chips on the Intel XScale 454 This enables access routines for the flash chips on the Intel XScale
440 IQ80310 evaluation board. If you have one of these boards and would 455 IQ80310 evaluation board. If you have one of these boards and would
441 like to use the flash chips on it, say 'Y'. 456 like to use the flash chips on it, say 'Y'.
442 457
443config MTD_IXP4XX 458config MTD_IXP4XX
444 tristate "CFI Flash device mapped on Intel IXP4xx based systems" 459 tristate "CFI Flash device mapped on Intel IXP4xx based systems"
445 depends on ARM && MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX 460 depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX
446 help 461 help
447 This enables MTD access to flash devices on platforms based 462 This enables MTD access to flash devices on platforms based
448 on Intel's IXP4xx family of network processors such as the 463 on Intel's IXP4xx family of network processors such as the
449 IXDP425 and Coyote. If you have an IXP4xx based board and 464 IXDP425 and Coyote. If you have an IXP4xx based board and
450 would like to use the flash chips on it, say 'Y'. 465 would like to use the flash chips on it, say 'Y'.
451 466
452config MTD_IXP2000 467config MTD_IXP2000
453 tristate "CFI Flash device mapped on Intel IXP2000 based systems" 468 tristate "CFI Flash device mapped on Intel IXP2000 based systems"
454 depends on ARM && MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000 469 depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000
455 help 470 help
456 This enables MTD access to flash devices on platforms based 471 This enables MTD access to flash devices on platforms based
457 on Intel's IXP2000 family of network processors such as the 472 on Intel's IXP2000 family of network processors such as the
458 IXDP425 and Coyote. If you have an IXP2000 based board and 473 IXDP425 and Coyote. If you have an IXP2000 based board and
459 would like to use the flash chips on it, say 'Y'. 474 would like to use the flash chips on it, say 'Y'.
460 475
461config MTD_EPXA10DB 476config MTD_EPXA10DB
462 tristate "CFI Flash device mapped on Epxa10db" 477 tristate "CFI Flash device mapped on Epxa10db"
463 depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT 478 depends on MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT
464 help 479 help
465 This enables support for the flash devices on the Altera 480 This enables support for the flash devices on the Altera
466 Excalibur XA10 Development Board. If you are building a kernel 481 Excalibur XA10 Development Board. If you are building a kernel
@@ -468,21 +483,21 @@ config MTD_EPXA10DB
468 483
469config MTD_FORTUNET 484config MTD_FORTUNET
470 tristate "CFI Flash device mapped on the FortuNet board" 485 tristate "CFI Flash device mapped on the FortuNet board"
471 depends on ARM && MTD_CFI && MTD_PARTITIONS && SA1100_FORTUNET 486 depends on MTD_CFI && MTD_PARTITIONS && SA1100_FORTUNET
472 help 487 help
473 This enables access to the Flash on the FortuNet board. If you 488 This enables access to the Flash on the FortuNet board. If you
474 have such a board, say 'Y'. 489 have such a board, say 'Y'.
475 490
476config MTD_AUTCPU12 491config MTD_AUTCPU12
477 tristate "NV-RAM mapping AUTCPU12 board" 492 tristate "NV-RAM mapping AUTCPU12 board"
478 depends on ARM && ARCH_AUTCPU12 493 depends on ARCH_AUTCPU12
479 help 494 help
480 This enables access to the NV-RAM on autronix autcpu12 board. 495 This enables access to the NV-RAM on autronix autcpu12 board.
481 If you have such a board, say 'Y'. 496 If you have such a board, say 'Y'.
482 497
483config MTD_EDB7312 498config MTD_EDB7312
484 tristate "CFI Flash device mapped on EDB7312" 499 tristate "CFI Flash device mapped on EDB7312"
485 depends on ARM && MTD_CFI 500 depends on ARCH_EDB7312 && MTD_CFI
486 help 501 help
487 This enables access to the CFI Flash on the Cogent EDB7312 board. 502 This enables access to the CFI Flash on the Cogent EDB7312 board.
488 If you have such a board, say 'Y' here. 503 If you have such a board, say 'Y' here.
@@ -496,7 +511,7 @@ config MTD_IMPA7
496 511
497config MTD_CEIVA 512config MTD_CEIVA
498 tristate "JEDEC Flash device mapped on Ceiva/Polaroid PhotoMax Digital Picture Frame" 513 tristate "JEDEC Flash device mapped on Ceiva/Polaroid PhotoMax Digital Picture Frame"
499 depends on ARM && MTD_JEDECPROBE && ARCH_CEIVA 514 depends on MTD_JEDECPROBE && ARCH_CEIVA
500 help 515 help
501 This enables access to the flash chips on the Ceiva/Polaroid 516 This enables access to the flash chips on the Ceiva/Polaroid
502 PhotoMax Digital Picture Frame. 517 PhotoMax Digital Picture Frame.
@@ -504,25 +519,31 @@ config MTD_CEIVA
504 519
505config MTD_NOR_TOTO 520config MTD_NOR_TOTO
506 tristate "NOR Flash device on TOTO board" 521 tristate "NOR Flash device on TOTO board"
507 depends on ARM && ARCH_OMAP && OMAP_TOTO 522 depends on ARCH_OMAP && OMAP_TOTO
508 help 523 help
509 This enables access to the NOR flash on the Texas Instruments 524 This enables access to the NOR flash on the Texas Instruments
510 TOTO board. 525 TOTO board.
511 526
512config MTD_H720X 527config MTD_H720X
513 tristate "Hynix evaluation board mappings" 528 tristate "Hynix evaluation board mappings"
514 depends on ARM && MTD_CFI && ( ARCH_H7201 || ARCH_H7202 ) 529 depends on MTD_CFI && ( ARCH_H7201 || ARCH_H7202 )
515 help 530 help
516 This enables access to the flash chips on the Hynix evaluation boards. 531 This enables access to the flash chips on the Hynix evaluation boards.
517 If you have such a board, say 'Y'. 532 If you have such a board, say 'Y'.
518 533
519config MTD_MPC1211 534config MTD_MPC1211
520 tristate "CFI Flash device mapped on Interface MPC-1211" 535 tristate "CFI Flash device mapped on Interface MPC-1211"
521 depends on SUPERH && SH_MPC1211 && MTD_CFI 536 depends on SH_MPC1211 && MTD_CFI
522 help 537 help
523 This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02). 538 This enables access to the flash chips on the Interface MPC-1211(CTP/PCI/MPC-SH02).
524 If you have such a board, say 'Y'. 539 If you have such a board, say 'Y'.
525 540
541config MTD_PQ2FADS
542 tristate "JEDEC flash SIMM mapped on PQ2FADS and 8272ADS boards"
543 depends on (ADS8272 || PQ2FADS) && MTD_PARTITIONS && MTD_JEDECPROBE && MTD_PHYSMAP && MTD_CFI_GEOMETRY && MTD_CFI_INTELEXT
544 help
545 This enables access to flash SIMM on PQ2FADS-like boards
546
526config MTD_OMAP_NOR 547config MTD_OMAP_NOR
527 tristate "TI OMAP board mappings" 548 tristate "TI OMAP board mappings"
528 depends on MTD_CFI && ARCH_OMAP 549 depends on MTD_CFI && ARCH_OMAP
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 7bcbc49e329..7d9e940a1dc 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# linux/drivers/maps/Makefile 2# linux/drivers/maps/Makefile
3# 3#
4# $Id: Makefile.common,v 1.30 2005/07/02 01:53:24 tpoynor Exp $ 4# $Id: Makefile.common,v 1.34 2005/11/07 11:14:26 gleixner Exp $
5 5
6ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y) 6ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y)
7obj-$(CONFIG_MTD) += map_funcs.o 7obj-$(CONFIG_MTD) += map_funcs.o
@@ -26,7 +26,7 @@ obj-$(CONFIG_MTD_MAINSTONE) += mainstone-flash.o
26obj-$(CONFIG_MTD_MBX860) += mbx860.o 26obj-$(CONFIG_MTD_MBX860) += mbx860.o
27obj-$(CONFIG_MTD_CEIVA) += ceiva.o 27obj-$(CONFIG_MTD_CEIVA) += ceiva.o
28obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o 28obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o
29obj-$(CONFIG_MTD_PHYSMAP) += physmap.o 29obj-$(CONFIG_MTD_PHYSMAP) += physmap.o
30obj-$(CONFIG_MTD_PNC2000) += pnc2000.o 30obj-$(CONFIG_MTD_PNC2000) += pnc2000.o
31obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o 31obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
32obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o 32obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o
@@ -70,3 +70,6 @@ obj-$(CONFIG_MTD_DMV182) += dmv182.o
70obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o 70obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o
71obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 71obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
72obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o 72obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
73obj-$(CONFIG_MTD_PQ2FADS) += pq2fads.o
74obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
75obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
diff --git a/drivers/mtd/maps/alchemy-flash.c b/drivers/mtd/maps/alchemy-flash.c
index 27fd2a3c3b6..a57791a6ce4 100644
--- a/drivers/mtd/maps/alchemy-flash.c
+++ b/drivers/mtd/maps/alchemy-flash.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * Flash memory access on AMD Alchemy evaluation boards 2 * Flash memory access on AMD Alchemy evaluation boards
3 * 3 *
4 * $Id: alchemy-flash.c,v 1.1 2005/02/27 21:50:21 ppopov Exp $ 4 * $Id: alchemy-flash.c,v 1.2 2005/11/07 11:14:26 gleixner Exp $
5 * 5 *
6 * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com> 6 * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
7 * 7 *
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
@@ -22,7 +22,7 @@
22#ifdef DEBUG_RW 22#ifdef DEBUG_RW
23#define DBG(x...) printk(x) 23#define DBG(x...) printk(x)
24#else 24#else
25#define DBG(x...) 25#define DBG(x...)
26#endif 26#endif
27 27
28#ifdef CONFIG_MIPS_PB1000 28#ifdef CONFIG_MIPS_PB1000
@@ -136,7 +136,7 @@ int __init alchemy_mtd_init(void)
136 int nb_parts = 0; 136 int nb_parts = 0;
137 unsigned long window_addr; 137 unsigned long window_addr;
138 unsigned long window_size; 138 unsigned long window_size;
139 139
140 /* Default flash buswidth */ 140 /* Default flash buswidth */
141 alchemy_map.bankwidth = BOARD_FLASH_WIDTH; 141 alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
142 142
@@ -161,7 +161,7 @@ int __init alchemy_mtd_init(void)
161 * Now let's probe for the actual flash. Do it here since 161 * Now let's probe for the actual flash. Do it here since
162 * specific machine settings might have been set above. 162 * specific machine settings might have been set above.
163 */ 163 */
164 printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n", 164 printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
165 alchemy_map.bankwidth*8); 165 alchemy_map.bankwidth*8);
166 alchemy_map.virt = ioremap(window_addr, window_size); 166 alchemy_map.virt = ioremap(window_addr, window_size);
167 mymtd = do_map_probe("cfi_probe", &alchemy_map); 167 mymtd = do_map_probe("cfi_probe", &alchemy_map);
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index e8a900a7768..c350878d459 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -2,7 +2,7 @@
2 * amd76xrom.c 2 * amd76xrom.c
3 * 3 *
4 * Normal mappings of chips in physical memory 4 * Normal mappings of chips in physical memory
5 * $Id: amd76xrom.c,v 1.20 2005/03/18 14:04:35 gleixner Exp $ 5 * $Id: amd76xrom.c,v 1.21 2005/11/07 11:14:26 gleixner Exp $
6 */ 6 */
7 7
8#include <linux/module.h> 8#include <linux/module.h>
@@ -70,7 +70,7 @@ static void amd76xrom_cleanup(struct amd76xrom_window *window)
70 list_del(&map->list); 70 list_del(&map->list);
71 kfree(map); 71 kfree(map);
72 } 72 }
73 if (window->rsrc.parent) 73 if (window->rsrc.parent)
74 release_resource(&window->rsrc); 74 release_resource(&window->rsrc);
75 75
76 if (window->virt) { 76 if (window->virt) {
@@ -107,7 +107,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
107 window->phys = 0xffff0000; /* 64KiB */ 107 window->phys = 0xffff0000; /* 64KiB */
108 } 108 }
109 window->size = 0xffffffffUL - window->phys + 1UL; 109 window->size = 0xffffffffUL - window->phys + 1UL;
110 110
111 /* 111 /*
112 * Try to reserve the window mem region. If this fails then 112 * Try to reserve the window mem region. If this fails then
113 * it is likely due to a fragment of the window being 113 * it is likely due to a fragment of the window being
@@ -138,7 +138,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
138 /* Enable writes through the rom window */ 138 /* Enable writes through the rom window */
139 pci_read_config_byte(pdev, 0x40, &byte); 139 pci_read_config_byte(pdev, 0x40, &byte);
140 pci_write_config_byte(pdev, 0x40, byte | 1); 140 pci_write_config_byte(pdev, 0x40, byte | 1);
141 141
142 /* FIXME handle registers 0x80 - 0x8C the bios region locks */ 142 /* FIXME handle registers 0x80 - 0x8C the bios region locks */
143 143
144 /* For write accesses caches are useless */ 144 /* For write accesses caches are useless */
@@ -186,7 +186,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
186 MOD_NAME, map->map.phys); 186 MOD_NAME, map->map.phys);
187 187
188 /* There is no generic VPP support */ 188 /* There is no generic VPP support */
189 for(map->map.bankwidth = 32; map->map.bankwidth; 189 for(map->map.bankwidth = 32; map->map.bankwidth;
190 map->map.bankwidth >>= 1) 190 map->map.bankwidth >>= 1)
191 { 191 {
192 char **probe_type; 192 char **probe_type;
@@ -239,7 +239,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
239 for(i = 0; i < cfi->numchips; i++) { 239 for(i = 0; i < cfi->numchips; i++) {
240 cfi->chips[i].start += offset; 240 cfi->chips[i].start += offset;
241 } 241 }
242 242
243 /* Now that the mtd devices is complete claim and export it */ 243 /* Now that the mtd devices is complete claim and export it */
244 map->mtd->owner = THIS_MODULE; 244 map->mtd->owner = THIS_MODULE;
245 if (add_mtd_device(map->mtd)) { 245 if (add_mtd_device(map->mtd)) {
@@ -259,9 +259,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
259 259
260 out: 260 out:
261 /* Free any left over map structures */ 261 /* Free any left over map structures */
262 if (map) { 262 kfree(map);
263 kfree(map);
264 }
265 /* See if I have any map structures */ 263 /* See if I have any map structures */
266 if (list_empty(&window->maps)) { 264 if (list_empty(&window->maps)) {
267 amd76xrom_cleanup(window); 265 amd76xrom_cleanup(window);
@@ -279,9 +277,9 @@ static void __devexit amd76xrom_remove_one (struct pci_dev *pdev)
279} 277}
280 278
281static struct pci_device_id amd76xrom_pci_tbl[] = { 279static struct pci_device_id amd76xrom_pci_tbl[] = {
282 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410, 280 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7410,
283 PCI_ANY_ID, PCI_ANY_ID, }, 281 PCI_ANY_ID, PCI_ANY_ID, },
284 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7440, 282 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_VIPER_7440,
285 PCI_ANY_ID, PCI_ANY_ID, }, 283 PCI_ANY_ID, PCI_ANY_ID, },
286 { PCI_VENDOR_ID_AMD, 0x7468 }, /* amd8111 support */ 284 { PCI_VENDOR_ID_AMD, 0x7468 }, /* amd8111 support */
287 { 0, } 285 { 0, }
diff --git a/drivers/mtd/maps/arctic-mtd.c b/drivers/mtd/maps/arctic-mtd.c
index 777276fd0e1..d95ae582fbe 100644
--- a/drivers/mtd/maps/arctic-mtd.c
+++ b/drivers/mtd/maps/arctic-mtd.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * $Id: arctic-mtd.c,v 1.13 2004/11/04 13:24:14 gleixner Exp $ 2 * $Id: arctic-mtd.c,v 1.14 2005/11/07 11:14:26 gleixner Exp $
3 * 3 *
4 * drivers/mtd/maps/arctic-mtd.c MTD mappings and partition tables for 4 * drivers/mtd/maps/arctic-mtd.c MTD mappings and partition tables for
5 * IBM 405LP Arctic boards. 5 * IBM 405LP Arctic boards.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c
index cf362ccc3c8..7ed3424dd95 100644
--- a/drivers/mtd/maps/autcpu12-nvram.c
+++ b/drivers/mtd/maps/autcpu12-nvram.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * NV-RAM memory access on autcpu12 2 * NV-RAM memory access on autcpu12
3 * (C) 2002 Thomas Gleixner (gleixner@autronix.de) 3 * (C) 2002 Thomas Gleixner (gleixner@autronix.de)
4 * 4 *
5 * $Id: autcpu12-nvram.c,v 1.8 2004/11/04 13:24:14 gleixner Exp $ 5 * $Id: autcpu12-nvram.c,v 1.9 2005/11/07 11:14:26 gleixner Exp $
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -55,10 +55,10 @@ static int __init init_autcpu12_sram (void)
55 } 55 }
56 simple_map_init(&autcpu_sram_map); 56 simple_map_init(&autcpu_sram_map);
57 57
58 /* 58 /*
59 * Check for 32K/128K 59 * Check for 32K/128K
60 * read ofs 0 60 * read ofs 0
61 * read ofs 0x10000 61 * read ofs 0x10000
62 * Write complement to ofs 0x100000 62 * Write complement to ofs 0x100000
63 * Read and check result on ofs 0x0 63 * Read and check result on ofs 0x0
64 * Restore contents 64 * Restore contents
@@ -66,7 +66,7 @@ static int __init init_autcpu12_sram (void)
66 save0 = map_read32(&autcpu12_sram_map,0); 66 save0 = map_read32(&autcpu12_sram_map,0);
67 save1 = map_read32(&autcpu12_sram_map,0x10000); 67 save1 = map_read32(&autcpu12_sram_map,0x10000);
68 map_write32(&autcpu12_sram_map,~save0,0x10000); 68 map_write32(&autcpu12_sram_map,~save0,0x10000);
69 /* if we find this pattern on 0x0, we have 32K size 69 /* if we find this pattern on 0x0, we have 32K size
70 * restore contents and exit 70 * restore contents and exit
71 */ 71 */
72 if ( map_read32(&autcpu12_sram_map,0) != save0) { 72 if ( map_read32(&autcpu12_sram_map,0) != save0) {
@@ -89,7 +89,7 @@ map:
89 89
90 sram_mtd->owner = THIS_MODULE; 90 sram_mtd->owner = THIS_MODULE;
91 sram_mtd->erasesize = 16; 91 sram_mtd->erasesize = 16;
92 92
93 if (add_mtd_device(sram_mtd)) { 93 if (add_mtd_device(sram_mtd)) {
94 printk("NV-RAM device addition failed\n"); 94 printk("NV-RAM device addition failed\n");
95 err = -ENOMEM; 95 err = -ENOMEM;
@@ -97,7 +97,7 @@ map:
97 } 97 }
98 98
99 printk("NV-RAM device size %ldKiB registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K); 99 printk("NV-RAM device size %ldKiB registered on AUTCPU12\n",autcpu12_sram_map.size/SZ_1K);
100 100
101 return 0; 101 return 0;
102 102
103out_probe: 103out_probe:
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c
index bfe994e5926..b7858eb9353 100644
--- a/drivers/mtd/maps/bast-flash.c
+++ b/drivers/mtd/maps/bast-flash.c
@@ -9,7 +9,7 @@
9 * 20-Sep-2004 BJD Initial version 9 * 20-Sep-2004 BJD Initial version
10 * 17-Jan-2005 BJD Add whole device if no partitions found 10 * 17-Jan-2005 BJD Add whole device if no partitions found
11 * 11 *
12 * $Id: bast-flash.c,v 1.2 2005/01/18 11:13:47 bjd Exp $ 12 * $Id: bast-flash.c,v 1.5 2005/11/07 11:14:26 gleixner Exp $
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@ static void bast_flash_setrw(int to)
75 75
76 local_irq_save(flags); 76 local_irq_save(flags);
77 val = __raw_readb(BAST_VA_CTRL3); 77 val = __raw_readb(BAST_VA_CTRL3);
78 78
79 if (to) 79 if (to)
80 val |= BAST_CPLD_CTRL3_ROMWEN; 80 val |= BAST_CPLD_CTRL3_ROMWEN;
81 else 81 else
@@ -93,7 +93,7 @@ static int bast_flash_remove(struct device *dev)
93 93
94 dev_set_drvdata(dev, NULL); 94 dev_set_drvdata(dev, NULL);
95 95
96 if (info == NULL) 96 if (info == NULL)
97 return 0; 97 return 0;
98 98
99 if (info->map.virt != NULL) 99 if (info->map.virt != NULL)
@@ -104,14 +104,13 @@ static int bast_flash_remove(struct device *dev)
104 map_destroy(info->mtd); 104 map_destroy(info->mtd);
105 } 105 }
106 106
107 if (info->partitions) 107 kfree(info->partitions);
108 kfree(info->partitions);
109 108
110 if (info->area) { 109 if (info->area) {
111 release_resource(info->area); 110 release_resource(info->area);
112 kfree(info->area); 111 kfree(info->area);
113 } 112 }
114 113
115 kfree(info); 114 kfree(info);
116 115
117 return 0; 116 return 0;
@@ -138,15 +137,15 @@ static int bast_flash_probe(struct device *dev)
138 137
139 info->map.phys = res->start; 138 info->map.phys = res->start;
140 info->map.size = res->end - res->start + 1; 139 info->map.size = res->end - res->start + 1;
141 info->map.name = dev->bus_id; 140 info->map.name = dev->bus_id;
142 info->map.bankwidth = 2; 141 info->map.bankwidth = 2;
143 142
144 if (info->map.size > AREA_MAXSIZE) 143 if (info->map.size > AREA_MAXSIZE)
145 info->map.size = AREA_MAXSIZE; 144 info->map.size = AREA_MAXSIZE;
146 145
147 pr_debug("%s: area %08lx, size %ld\n", __FUNCTION__, 146 pr_debug("%s: area %08lx, size %ld\n", __FUNCTION__,
148 info->map.phys, info->map.size); 147 info->map.phys, info->map.size);
149 148
150 info->area = request_mem_region(res->start, info->map.size, 149 info->area = request_mem_region(res->start, info->map.size,
151 pdev->name); 150 pdev->name);
152 if (info->area == NULL) { 151 if (info->area == NULL) {
@@ -163,7 +162,7 @@ static int bast_flash_probe(struct device *dev)
163 err = -EIO; 162 err = -EIO;
164 goto exit_error; 163 goto exit_error;
165 } 164 }
166 165
167 simple_map_init(&info->map); 166 simple_map_init(&info->map);
168 167
169 /* enable the write to the flash area */ 168 /* enable the write to the flash area */
@@ -188,7 +187,7 @@ static int bast_flash_probe(struct device *dev)
188 err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); 187 err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0);
189 if (err > 0) { 188 if (err > 0) {
190 err = add_mtd_partitions(info->mtd, info->partitions, err); 189 err = add_mtd_partitions(info->mtd, info->partitions, err);
191 if (err) 190 if (err)
192 printk(KERN_ERR PFX "cannot add/parse partitions\n"); 191 printk(KERN_ERR PFX "cannot add/parse partitions\n");
193 } else { 192 } else {
194 err = add_mtd_device(info->mtd); 193 err = add_mtd_device(info->mtd);
@@ -206,6 +205,7 @@ static int bast_flash_probe(struct device *dev)
206 205
207static struct device_driver bast_flash_driver = { 206static struct device_driver bast_flash_driver = {
208 .name = "bast-nor", 207 .name = "bast-nor",
208 .owner = THIS_MODULE,
209 .bus = &platform_bus_type, 209 .bus = &platform_bus_type,
210 .probe = bast_flash_probe, 210 .probe = bast_flash_probe,
211 .remove = bast_flash_remove, 211 .remove = bast_flash_remove,
diff --git a/drivers/mtd/maps/beech-mtd.c b/drivers/mtd/maps/beech-mtd.c
index 5e79c9d5da2..5df7361d140 100644
--- a/drivers/mtd/maps/beech-mtd.c
+++ b/drivers/mtd/maps/beech-mtd.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * $Id: beech-mtd.c,v 1.10 2004/11/04 13:24:14 gleixner Exp $ 2 * $Id: beech-mtd.c,v 1.11 2005/11/07 11:14:26 gleixner Exp $
3 * 3 *
4 * drivers/mtd/maps/beech-mtd.c MTD mappings and partition tables for 4 * drivers/mtd/maps/beech-mtd.c MTD mappings and partition tables for
5 * IBM 405LP Beech boards. 5 * IBM 405LP Beech boards.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/mtd/maps/cdb89712.c b/drivers/mtd/maps/cdb89712.c
index ab15dac2f93..9f17bb6c5a9 100644
--- a/drivers/mtd/maps/cdb89712.c
+++ b/drivers/mtd/maps/cdb89712.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Flash on Cirrus CDB89712 2 * Flash on Cirrus CDB89712
3 * 3 *
4 * $Id: cdb89712.c,v 1.10 2004/11/04 13:24:14 gleixner Exp $ 4 * $Id: cdb89712.c,v 1.11 2005/11/07 11:14:26 gleixner Exp $
5 */ 5 */
6 6
7#include <linux/module.h> 7#include <linux/module.h>
@@ -37,13 +37,13 @@ struct resource cdb89712_flash_resource = {
37static int __init init_cdb89712_flash (void) 37static int __init init_cdb89712_flash (void)
38{ 38{
39 int err; 39 int err;
40 40
41 if (request_resource (&ioport_resource, &cdb89712_flash_resource)) { 41 if (request_resource (&ioport_resource, &cdb89712_flash_resource)) {
42 printk(KERN_NOTICE "Failed to reserve Cdb89712 FLASH space\n"); 42 printk(KERN_NOTICE "Failed to reserve Cdb89712 FLASH space\n");
43 err = -EBUSY; 43 err = -EBUSY;
44 goto out; 44 goto out;
45 } 45 }
46 46
47 cdb89712_flash_map.virt = ioremap(FLASH_START, FLASH_SIZE); 47 cdb89712_flash_map.virt = ioremap(FLASH_START, FLASH_SIZE);
48 if (!cdb89712_flash_map.virt) { 48 if (!cdb89712_flash_map.virt) {
49 printk(KERN_NOTICE "Failed to ioremap Cdb89712 FLASH space\n"); 49 printk(KERN_NOTICE "Failed to ioremap Cdb89712 FLASH space\n");
@@ -64,13 +64,13 @@ static int __init init_cdb89712_flash (void)
64 } 64 }
65 65
66 flash_mtd->owner = THIS_MODULE; 66 flash_mtd->owner = THIS_MODULE;
67 67
68 if (add_mtd_device(flash_mtd)) { 68 if (add_mtd_device(flash_mtd)) {
69 printk("FLASH device addition failed\n"); 69 printk("FLASH device addition failed\n");
70 err = -ENOMEM; 70 err = -ENOMEM;
71 goto out_probe; 71 goto out_probe;
72 } 72 }
73 73
74 return 0; 74 return 0;
75 75
76out_probe: 76out_probe:
@@ -107,13 +107,13 @@ struct resource cdb89712_sram_resource = {
107static int __init init_cdb89712_sram (void) 107static int __init init_cdb89712_sram (void)
108{ 108{
109 int err; 109 int err;
110 110
111 if (request_resource (&ioport_resource, &cdb89712_sram_resource)) { 111 if (request_resource (&ioport_resource, &cdb89712_sram_resource)) {
112 printk(KERN_NOTICE "Failed to reserve Cdb89712 SRAM space\n"); 112 printk(KERN_NOTICE "Failed to reserve Cdb89712 SRAM space\n");
113 err = -EBUSY; 113 err = -EBUSY;
114 goto out; 114 goto out;
115 } 115 }
116 116
117 cdb89712_sram_map.virt = ioremap(SRAM_START, SRAM_SIZE); 117 cdb89712_sram_map.virt = ioremap(SRAM_START, SRAM_SIZE);
118 if (!cdb89712_sram_map.virt) { 118 if (!cdb89712_sram_map.virt) {
119 printk(KERN_NOTICE "Failed to ioremap Cdb89712 SRAM space\n"); 119 printk(KERN_NOTICE "Failed to ioremap Cdb89712 SRAM space\n");
@@ -130,13 +130,13 @@ static int __init init_cdb89712_sram (void)
130 130
131 sram_mtd->owner = THIS_MODULE; 131 sram_mtd->owner = THIS_MODULE;
132 sram_mtd->erasesize = 16; 132 sram_mtd->erasesize = 16;
133 133
134 if (add_mtd_device(sram_mtd)) { 134 if (add_mtd_device(sram_mtd)) {
135 printk("SRAM device addition failed\n"); 135 printk("SRAM device addition failed\n");
136 err = -ENOMEM; 136 err = -ENOMEM;
137 goto out_probe; 137 goto out_probe;
138 } 138 }
139 139
140 return 0; 140 return 0;
141 141
142out_probe: 142out_probe:
@@ -175,13 +175,13 @@ struct resource cdb89712_bootrom_resource = {
175static int __init init_cdb89712_bootrom (void) 175static int __init init_cdb89712_bootrom (void)
176{ 176{
177 int err; 177 int err;
178 178
179 if (request_resource (&ioport_resource, &cdb89712_bootrom_resource)) { 179 if (request_resource (&ioport_resource, &cdb89712_bootrom_resource)) {
180 printk(KERN_NOTICE "Failed to reserve Cdb89712 BOOTROM space\n"); 180 printk(KERN_NOTICE "Failed to reserve Cdb89712 BOOTROM space\n");
181 err = -EBUSY; 181 err = -EBUSY;
182 goto out; 182 goto out;
183 } 183 }
184 184
185 cdb89712_bootrom_map.virt = ioremap(BOOTROM_START, BOOTROM_SIZE); 185 cdb89712_bootrom_map.virt = ioremap(BOOTROM_START, BOOTROM_SIZE);
186 if (!cdb89712_bootrom_map.virt) { 186 if (!cdb89712_bootrom_map.virt) {
187 printk(KERN_NOTICE "Failed to ioremap Cdb89712 BootROM space\n"); 187 printk(KERN_NOTICE "Failed to ioremap Cdb89712 BootROM space\n");
@@ -198,13 +198,13 @@ static int __init init_cdb89712_bootrom (void)
198 198
199 bootrom_mtd->owner = THIS_MODULE; 199 bootrom_mtd->owner = THIS_MODULE;
200 bootrom_mtd->erasesize = 0x10000; 200 bootrom_mtd->erasesize = 0x10000;
201 201
202 if (add_mtd_device(bootrom_mtd)) { 202 if (add_mtd_device(bootrom_mtd)) {
203 printk("BootROM device addition failed\n"); 203 printk("BootROM device addition failed\n");
204 err = -ENOMEM; 204 err = -ENOMEM;
205 goto out_probe; 205 goto out_probe;
206 } 206 }
207 207
208 return 0; 208 return 0;
209 209
210out_probe: 210out_probe:
@@ -225,16 +225,16 @@ out:
225static int __init init_cdb89712_maps(void) 225static int __init init_cdb89712_maps(void)
226{ 226{
227 227
228 printk(KERN_INFO "Cirrus CDB89712 MTD mappings:\n Flash 0x%x at 0x%x\n SRAM 0x%x at 0x%x\n BootROM 0x%x at 0x%x\n", 228 printk(KERN_INFO "Cirrus CDB89712 MTD mappings:\n Flash 0x%x at 0x%x\n SRAM 0x%x at 0x%x\n BootROM 0x%x at 0x%x\n",
229 FLASH_SIZE, FLASH_START, SRAM_SIZE, SRAM_START, BOOTROM_SIZE, BOOTROM_START); 229 FLASH_SIZE, FLASH_START, SRAM_SIZE, SRAM_START, BOOTROM_SIZE, BOOTROM_START);
230 230
231 init_cdb89712_flash(); 231 init_cdb89712_flash();
232 init_cdb89712_sram(); 232 init_cdb89712_sram();
233 init_cdb89712_bootrom(); 233 init_cdb89712_bootrom();
234 234
235 return 0; 235 return 0;
236} 236}
237 237
238 238
239static void __exit cleanup_cdb89712_maps(void) 239static void __exit cleanup_cdb89712_maps(void)
240{ 240{
@@ -244,7 +244,7 @@ static void __exit cleanup_cdb89712_maps(void)
244 iounmap((void *)cdb89712_sram_map.virt); 244 iounmap((void *)cdb89712_sram_map.virt);
245 release_resource (&cdb89712_sram_resource); 245 release_resource (&cdb89712_sram_resource);
246 } 246 }
247 247
248 if (flash_mtd) { 248 if (flash_mtd) {
249 del_mtd_device(flash_mtd); 249 del_mtd_device(flash_mtd);
250 map_destroy(flash_mtd); 250 map_destroy(flash_mtd);
diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c
index c68b31dc7e6..5a95ab370a9 100644
--- a/drivers/mtd/maps/ceiva.c
+++ b/drivers/mtd/maps/ceiva.c
@@ -313,8 +313,7 @@ static void __init clps_locate_partitions(struct mtd_info *mtd)
313 313
314static void __exit clps_destroy_partitions(void) 314static void __exit clps_destroy_partitions(void)
315{ 315{
316 if (parsed_parts) 316 kfree(parsed_parts);
317 kfree(parsed_parts);
318} 317}
319 318
320static struct mtd_info *mymtd; 319static struct mtd_info *mymtd;
diff --git a/drivers/mtd/maps/cfi_flagadm.c b/drivers/mtd/maps/cfi_flagadm.c
index f72e4f894b3..6a8c0415bde 100644
--- a/drivers/mtd/maps/cfi_flagadm.c
+++ b/drivers/mtd/maps/cfi_flagadm.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * Copyright © 2001 Flaga hf. Medical Devices, Kári Davíðsson <kd@flaga.is> 2 * Copyright © 2001 Flaga hf. Medical Devices, Kári Davíðsson <kd@flaga.is>
3 * 3 *
4 * $Id: cfi_flagadm.c,v 1.14 2004/11/04 13:24:14 gleixner Exp $ 4 * $Id: cfi_flagadm.c,v 1.15 2005/11/07 11:14:26 gleixner Exp $
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your 8 * Free Software Foundation; either version 2 of the License, or (at your
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#define FLASH_PHYS_ADDR 0x40000000 44#define FLASH_PHYS_ADDR 0x40000000
45#define FLASH_SIZE 0x400000 45#define FLASH_SIZE 0x400000
46 46
47#define FLASH_PARTITION0_ADDR 0x00000000 47#define FLASH_PARTITION0_ADDR 0x00000000
48#define FLASH_PARTITION0_SIZE 0x00020000 48#define FLASH_PARTITION0_SIZE 0x00020000
@@ -79,7 +79,7 @@ struct mtd_partition flagadm_parts[] = {
79 .offset = FLASH_PARTITION2_ADDR, 79 .offset = FLASH_PARTITION2_ADDR,
80 .size = FLASH_PARTITION2_SIZE 80 .size = FLASH_PARTITION2_SIZE
81 }, 81 },
82 { 82 {
83 .name = "Persistant storage", 83 .name = "Persistant storage",
84 .offset = FLASH_PARTITION3_ADDR, 84 .offset = FLASH_PARTITION3_ADDR,
85 .size = FLASH_PARTITION3_SIZE 85 .size = FLASH_PARTITION3_SIZE
@@ -91,10 +91,10 @@ struct mtd_partition flagadm_parts[] = {
91static struct mtd_info *mymtd; 91static struct mtd_info *mymtd;
92 92
93int __init init_flagadm(void) 93int __init init_flagadm(void)
94{ 94{
95 printk(KERN_NOTICE "FlagaDM flash device: %x at %x\n", 95 printk(KERN_NOTICE "FlagaDM flash device: %x at %x\n",
96 FLASH_SIZE, FLASH_PHYS_ADDR); 96 FLASH_SIZE, FLASH_PHYS_ADDR);
97 97
98 flagadm_map.phys = FLASH_PHYS_ADDR; 98 flagadm_map.phys = FLASH_PHYS_ADDR;
99 flagadm_map.virt = ioremap(FLASH_PHYS_ADDR, 99 flagadm_map.virt = ioremap(FLASH_PHYS_ADDR,
100 FLASH_SIZE); 100 FLASH_SIZE);
diff --git a/drivers/mtd/maps/cstm_mips_ixx.c b/drivers/mtd/maps/cstm_mips_ixx.c
index ae9252fbf17..a370953c151 100644
--- a/drivers/mtd/maps/cstm_mips_ixx.c
+++ b/drivers/mtd/maps/cstm_mips_ixx.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * $Id: cstm_mips_ixx.c,v 1.12 2004/11/04 13:24:14 gleixner Exp $ 2 * $Id: cstm_mips_ixx.c,v 1.14 2005/11/07 11:14:26 gleixner Exp $
3 * 3 *
4 * Mapping of a custom board with both AMD CFI and JEDEC flash in partitions. 4 * Mapping of a custom board with both AMD CFI and JEDEC flash in partitions.
5 * Config with both CFI and JEDEC device support. 5 * Config with both CFI and JEDEC device support.
6 * 6 *
7 * Basically physmap.c with the addition of partitions and 7 * Basically physmap.c with the addition of partitions and
8 * an array of mapping info to accomodate more than one flash type per board. 8 * an array of mapping info to accomodate more than one flash type per board.
9 * 9 *
10 * Copyright 2000 MontaVista Software Inc. 10 * Copyright 2000 MontaVista Software Inc.
@@ -69,7 +69,7 @@ void cstm_mips_ixx_set_vpp(struct map_info *map,int vpp)
69 __u16 data; 69 __u16 data;
70 __u8 data1; 70 __u8 data1;
71 static u8 first = 1; 71 static u8 first = 1;
72 72
73 // Set GPIO port B pin3 to high 73 // Set GPIO port B pin3 to high
74 data = *(__u16 *)(CC_GPBCR); 74 data = *(__u16 *)(CC_GPBCR);
75 data = (data & 0xff0f) | 0x0040; 75 data = (data & 0xff0f) | 0x0040;
@@ -85,7 +85,7 @@ void cstm_mips_ixx_set_vpp(struct map_info *map,int vpp)
85 } else { 85 } else {
86 if (!--vpp_count) { 86 if (!--vpp_count) {
87 __u16 data; 87 __u16 data;
88 88
89 // Set GPIO port B pin3 to high 89 // Set GPIO port B pin3 to high
90 data = *(__u16 *)(CC_GPBCR); 90 data = *(__u16 *)(CC_GPBCR);
91 data = (data & 0xff3f) | 0x0040; 91 data = (data & 0xff3f) | 0x0040;
@@ -109,8 +109,8 @@ struct cstm_mips_ixx_info {
109}; 109};
110 110
111#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) 111#if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR)
112#define PHYSMAP_NUMBER 1 // number of board desc structs needed, one per contiguous flash type 112#define PHYSMAP_NUMBER 1 // number of board desc structs needed, one per contiguous flash type
113const struct cstm_mips_ixx_info cstm_mips_ixx_board_desc[PHYSMAP_NUMBER] = 113const struct cstm_mips_ixx_info cstm_mips_ixx_board_desc[PHYSMAP_NUMBER] =
114{ 114{
115 { // 28F128J3A in 2x16 configuration 115 { // 28F128J3A in 2x16 configuration
116 "big flash", // name 116 "big flash", // name
@@ -131,10 +131,10 @@ static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP
131}, 131},
132}; 132};
133#else /* defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) */ 133#else /* defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) */
134#define PHYSMAP_NUMBER 1 // number of board desc structs needed, one per contiguous flash type 134#define PHYSMAP_NUMBER 1 // number of board desc structs needed, one per contiguous flash type
135const struct cstm_mips_ixx_info cstm_mips_ixx_board_desc[PHYSMAP_NUMBER] = 135const struct cstm_mips_ixx_info cstm_mips_ixx_board_desc[PHYSMAP_NUMBER] =
136{ 136{
137 { 137 {
138 "MTD flash", // name 138 "MTD flash", // name
139 CONFIG_MTD_CSTM_MIPS_IXX_START, // window_addr 139 CONFIG_MTD_CSTM_MIPS_IXX_START, // window_addr
140 CONFIG_MTD_CSTM_MIPS_IXX_LEN, // window_size 140 CONFIG_MTD_CSTM_MIPS_IXX_LEN, // window_size
@@ -144,7 +144,7 @@ const struct cstm_mips_ixx_info cstm_mips_ixx_board_desc[PHYSMAP_NUMBER] =
144 144
145}; 145};
146static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP_PARTITIONS] = { 146static struct mtd_partition cstm_mips_ixx_partitions[PHYSMAP_NUMBER][MAX_PHYSMAP_PARTITIONS] = {
147{ 147{
148 { 148 {
149 .name = "main partition", 149 .name = "main partition",
150 .size = CONFIG_MTD_CSTM_MIPS_IXX_LEN, 150 .size = CONFIG_MTD_CSTM_MIPS_IXX_LEN,
@@ -165,7 +165,7 @@ int __init init_cstm_mips_ixx(void)
165 165
166 /* Initialize mapping */ 166 /* Initialize mapping */
167 for (i=0;i<PHYSMAP_NUMBER;i++) { 167 for (i=0;i<PHYSMAP_NUMBER;i++) {
168 printk(KERN_NOTICE "cstm_mips_ixx flash device: 0x%lx at 0x%lx\n", 168 printk(KERN_NOTICE "cstm_mips_ixx flash device: 0x%lx at 0x%lx\n",
169 cstm_mips_ixx_board_desc[i].window_size, cstm_mips_ixx_board_desc[i].window_addr); 169 cstm_mips_ixx_board_desc[i].window_size, cstm_mips_ixx_board_desc[i].window_addr);
170 170
171 171
@@ -235,7 +235,7 @@ void PCISetULongByOffset(__u32 DevNumber, __u32 FuncNumber, __u32 Offset, __u32
235 235
236 offset = ( unsigned long )( 0x80000000 | ( DevNumber << 11 ) + ( FuncNumber << 8 ) + Offset) ; 236 offset = ( unsigned long )( 0x80000000 | ( DevNumber << 11 ) + ( FuncNumber << 8 ) + Offset) ;
237 237
238 *(__u32 *)CC_CONFADDR = offset; 238 *(__u32 *)CC_CONFADDR = offset;
239 *(__u32 *)CC_CONFDATA = data; 239 *(__u32 *)CC_CONFDATA = data;
240} 240}
241void setup_ITE_IVR_flash() 241void setup_ITE_IVR_flash()
diff --git a/drivers/mtd/maps/dbox2-flash.c b/drivers/mtd/maps/dbox2-flash.c
index d850a27a4b5..49d90542fc7 100644
--- a/drivers/mtd/maps/dbox2-flash.c
+++ b/drivers/mtd/maps/dbox2-flash.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: dbox2-flash.c,v 1.13 2004/11/04 13:24:14 gleixner Exp $ 2 * $Id: dbox2-flash.c,v 1.14 2005/11/07 11:14:26 gleixner Exp $
3 * 3 *
4 * D-Box 2 flash driver 4 * D-Box 2 flash driver
5 */ 5 */
@@ -21,38 +21,38 @@
21static struct mtd_partition partition_info[]= { 21static struct mtd_partition partition_info[]= {
22 { 22 {
23 .name = "BR bootloader", 23 .name = "BR bootloader",
24 .size = 128 * 1024, 24 .size = 128 * 1024,
25 .offset = 0, 25 .offset = 0,
26 .mask_flags = MTD_WRITEABLE 26 .mask_flags = MTD_WRITEABLE
27 }, 27 },
28 { 28 {
29 .name = "FLFS (U-Boot)", 29 .name = "FLFS (U-Boot)",
30 .size = 128 * 1024, 30 .size = 128 * 1024,
31 .offset = MTDPART_OFS_APPEND, 31 .offset = MTDPART_OFS_APPEND,
32 .mask_flags = 0 32 .mask_flags = 0
33 }, 33 },
34 { 34 {
35 .name = "Root (SquashFS)", 35 .name = "Root (SquashFS)",
36 .size = 7040 * 1024, 36 .size = 7040 * 1024,
37 .offset = MTDPART_OFS_APPEND, 37 .offset = MTDPART_OFS_APPEND,
38 .mask_flags = 0 38 .mask_flags = 0
39 }, 39 },
40 { 40 {
41 .name = "var (JFFS2)", 41 .name = "var (JFFS2)",
42 .size = 896 * 1024, 42 .size = 896 * 1024,
43 .offset = MTDPART_OFS_APPEND, 43 .offset = MTDPART_OFS_APPEND,
44 .mask_flags = 0 44 .mask_flags = 0
45 }, 45 },
46 { 46 {
47 .name = "Flash without bootloader", 47 .name = "Flash without bootloader",
48 .size = MTDPART_SIZ_FULL, 48 .size = MTDPART_SIZ_FULL,
49 .offset = 128 * 1024, 49 .offset = 128 * 1024,
50 .mask_flags = 0 50 .mask_flags = 0
51 }, 51 },
52 { 52 {
53 .name = "Complete Flash", 53 .name = "Complete Flash",
54 .size = MTDPART_SIZ_FULL, 54 .size = MTDPART_SIZ_FULL,
55 .offset = 0, 55 .offset = 0,
56 .mask_flags = MTD_WRITEABLE 56 .mask_flags = MTD_WRITEABLE
57 } 57 }
58}; 58};
@@ -88,16 +88,16 @@ int __init init_dbox2_flash(void)
88 if (!mymtd) { 88 if (!mymtd) {
89 // Probe for single Intel 28F640 89 // Probe for single Intel 28F640
90 dbox2_flash_map.bankwidth = 2; 90 dbox2_flash_map.bankwidth = 2;
91 91
92 mymtd = do_map_probe("cfi_probe", &dbox2_flash_map); 92 mymtd = do_map_probe("cfi_probe", &dbox2_flash_map);
93 } 93 }
94 94
95 if (mymtd) { 95 if (mymtd) {
96 mymtd->owner = THIS_MODULE; 96 mymtd->owner = THIS_MODULE;
97 97
98 /* Create MTD devices for each partition. */ 98 /* Create MTD devices for each partition. */
99 add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS); 99 add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
100 100
101 return 0; 101 return 0;
102 } 102 }
103 103
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c
index e5b74169fde..701620b6bae 100644
--- a/drivers/mtd/maps/dc21285.c
+++ b/drivers/mtd/maps/dc21285.c
@@ -4,8 +4,8 @@
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@cam.org>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 * 7 *
8 * $Id: dc21285.c,v 1.22 2004/11/01 13:39:21 rmk Exp $ 8 * $Id: dc21285.c,v 1.24 2005/11/07 11:14:26 gleixner Exp $
9 */ 9 */
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/module.h> 11#include <linux/module.h>
@@ -27,9 +27,9 @@
27static struct mtd_info *dc21285_mtd; 27static struct mtd_info *dc21285_mtd;
28 28
29#ifdef CONFIG_ARCH_NETWINDER 29#ifdef CONFIG_ARCH_NETWINDER
30/* 30/*
31 * This is really ugly, but it seams to be the only 31 * This is really ugly, but it seams to be the only
32 * realiable way to do it, as the cpld state machine 32 * realiable way to do it, as the cpld state machine
33 * is unpredictible. So we have a 25us penalty per 33 * is unpredictible. So we have a 25us penalty per
34 * write access. 34 * write access.
35 */ 35 */
@@ -150,7 +150,7 @@ static struct map_info dc21285_map = {
150static struct mtd_partition *dc21285_parts; 150static struct mtd_partition *dc21285_parts;
151static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 151static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
152#endif 152#endif
153 153
154static int __init init_dc21285(void) 154static int __init init_dc21285(void)
155{ 155{
156 156
@@ -160,20 +160,20 @@ static int __init init_dc21285(void)
160 160
161 /* Determine bankwidth */ 161 /* Determine bankwidth */
162 switch (*CSR_SA110_CNTL & (3<<14)) { 162 switch (*CSR_SA110_CNTL & (3<<14)) {
163 case SA110_CNTL_ROMWIDTH_8: 163 case SA110_CNTL_ROMWIDTH_8:
164 dc21285_map.bankwidth = 1; 164 dc21285_map.bankwidth = 1;
165 dc21285_map.read = dc21285_read8; 165 dc21285_map.read = dc21285_read8;
166 dc21285_map.write = dc21285_write8; 166 dc21285_map.write = dc21285_write8;
167 dc21285_map.copy_to = dc21285_copy_to_8; 167 dc21285_map.copy_to = dc21285_copy_to_8;
168 break; 168 break;
169 case SA110_CNTL_ROMWIDTH_16: 169 case SA110_CNTL_ROMWIDTH_16:
170 dc21285_map.bankwidth = 2; 170 dc21285_map.bankwidth = 2;
171 dc21285_map.read = dc21285_read16; 171 dc21285_map.read = dc21285_read16;
172 dc21285_map.write = dc21285_write16; 172 dc21285_map.write = dc21285_write16;
173 dc21285_map.copy_to = dc21285_copy_to_16; 173 dc21285_map.copy_to = dc21285_copy_to_16;
174 break; 174 break;
175 case SA110_CNTL_ROMWIDTH_32: 175 case SA110_CNTL_ROMWIDTH_32:
176 dc21285_map.bankwidth = 4; 176 dc21285_map.bankwidth = 4;
177 dc21285_map.read = dc21285_read32; 177 dc21285_map.read = dc21285_read32;
178 dc21285_map.write = dc21285_write32; 178 dc21285_map.write = dc21285_write32;
179 dc21285_map.copy_to = dc21285_copy_to_32; 179 dc21285_map.copy_to = dc21285_copy_to_32;
@@ -201,20 +201,20 @@ static int __init init_dc21285(void)
201 if (!dc21285_mtd) { 201 if (!dc21285_mtd) {
202 iounmap(dc21285_map.virt); 202 iounmap(dc21285_map.virt);
203 return -ENXIO; 203 return -ENXIO;
204 } 204 }
205 205
206 dc21285_mtd->owner = THIS_MODULE; 206 dc21285_mtd->owner = THIS_MODULE;
207 207
208#ifdef CONFIG_MTD_PARTITIONS 208#ifdef CONFIG_MTD_PARTITIONS
209 nrparts = parse_mtd_partitions(dc21285_mtd, probes, &dc21285_parts, 0); 209 nrparts = parse_mtd_partitions(dc21285_mtd, probes, &dc21285_parts, 0);
210 if (nrparts > 0) 210 if (nrparts > 0)
211 add_mtd_partitions(dc21285_mtd, dc21285_parts, nrparts); 211 add_mtd_partitions(dc21285_mtd, dc21285_parts, nrparts);
212 else 212 else
213#endif 213#endif
214 add_mtd_device(dc21285_mtd); 214 add_mtd_device(dc21285_mtd);
215 215
216 if(machine_is_ebsa285()) { 216 if(machine_is_ebsa285()) {
217 /* 217 /*
218 * Flash timing is determined with bits 19-16 of the 218 * Flash timing is determined with bits 19-16 of the
219 * CSR_SA110_CNTL. The value is the number of wait cycles, or 219 * CSR_SA110_CNTL. The value is the number of wait cycles, or
220 * 0 for 16 cycles (the default). Cycles are 20 ns. 220 * 0 for 16 cycles (the default). Cycles are 20 ns.
@@ -227,7 +227,7 @@ static int __init init_dc21285(void)
227 /* tristate time */ 227 /* tristate time */
228 *CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x0f000000) | (7 << 24)); 228 *CSR_SA110_CNTL = ((*CSR_SA110_CNTL & ~0x0f000000) | (7 << 24));
229 } 229 }
230 230
231 return 0; 231 return 0;
232} 232}
233 233
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c
index f99519692cb..b51c757817d 100644
--- a/drivers/mtd/maps/dilnetpc.c
+++ b/drivers/mtd/maps/dilnetpc.c
@@ -14,7 +14,7 @@
14 * along with this program; if not, write to the Free Software 14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
16 * 16 *
17 * $Id: dilnetpc.c,v 1.17 2004/11/28 09:40:39 dwmw2 Exp $ 17 * $Id: dilnetpc.c,v 1.20 2005/11/07 11:14:26 gleixner Exp $
18 * 18 *
19 * The DIL/Net PC is a tiny embedded PC board made by SSV Embedded Systems 19 * The DIL/Net PC is a tiny embedded PC board made by SSV Embedded Systems
20 * featuring the AMD Elan SC410 processor. There are two variants of this 20 * featuring the AMD Elan SC410 processor. There are two variants of this
@@ -272,13 +272,13 @@ static struct map_info dnpc_map = {
272 272
273static struct mtd_partition partition_info[]= 273static struct mtd_partition partition_info[]=
274{ 274{
275 { 275 {
276 .name = "ADNP boot", 276 .name = "ADNP boot",
277 .offset = 0, 277 .offset = 0,
278 .size = 0xf0000, 278 .size = 0xf0000,
279 }, 279 },
280 { 280 {
281 .name = "ADNP system BIOS", 281 .name = "ADNP system BIOS",
282 .offset = MTDPART_OFS_NXTBLK, 282 .offset = MTDPART_OFS_NXTBLK,
283 .size = 0x10000, 283 .size = 0x10000,
284#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED 284#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
@@ -291,7 +291,7 @@ static struct mtd_partition partition_info[]=
291 .size = 0x2f0000, 291 .size = 0x2f0000,
292 }, 292 },
293 { 293 {
294 .name = "ADNP system BIOS entry", 294 .name = "ADNP system BIOS entry",
295 .offset = MTDPART_OFS_NXTBLK, 295 .offset = MTDPART_OFS_NXTBLK,
296 .size = MTDPART_SIZ_FULL, 296 .size = MTDPART_SIZ_FULL,
297#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED 297#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
@@ -325,9 +325,9 @@ static struct mtd_info *merged_mtd;
325 325
326static struct mtd_partition higlvl_partition_info[]= 326static struct mtd_partition higlvl_partition_info[]=
327{ 327{
328 { 328 {
329 .name = "ADNP boot block", 329 .name = "ADNP boot block",
330 .offset = 0, 330 .offset = 0,
331 .size = CONFIG_MTD_DILNETPC_BOOTSIZE, 331 .size = CONFIG_MTD_DILNETPC_BOOTSIZE,
332 }, 332 },
333 { 333 {
@@ -335,8 +335,8 @@ static struct mtd_partition higlvl_partition_info[]=
335 .offset = MTDPART_OFS_NXTBLK, 335 .offset = MTDPART_OFS_NXTBLK,
336 .size = ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000, 336 .size = ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000,
337 }, 337 },
338 { 338 {
339 .name = "ADNP system BIOS + BIOS Entry", 339 .name = "ADNP system BIOS + BIOS Entry",
340 .offset = MTDPART_OFS_NXTBLK, 340 .offset = MTDPART_OFS_NXTBLK,
341 .size = MTDPART_SIZ_FULL, 341 .size = MTDPART_SIZ_FULL,
342#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED 342#ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED
@@ -371,7 +371,7 @@ static int __init init_dnpc(void)
371 371
372 /* 372 /*
373 ** determine hardware (DNP/ADNP/invalid) 373 ** determine hardware (DNP/ADNP/invalid)
374 */ 374 */
375 if((is_dnp = dnp_adnp_probe()) < 0) 375 if((is_dnp = dnp_adnp_probe()) < 0)
376 return -ENXIO; 376 return -ENXIO;
377 377
@@ -397,13 +397,13 @@ static int __init init_dnpc(void)
397 ++dnpc_map.name; 397 ++dnpc_map.name;
398 for(i = 0; i < NUM_PARTITIONS; i++) 398 for(i = 0; i < NUM_PARTITIONS; i++)
399 ++partition_info[i].name; 399 ++partition_info[i].name;
400 higlvl_partition_info[1].size = DNP_WINDOW_SIZE - 400 higlvl_partition_info[1].size = DNP_WINDOW_SIZE -
401 CONFIG_MTD_DILNETPC_BOOTSIZE - 0x20000; 401 CONFIG_MTD_DILNETPC_BOOTSIZE - 0x20000;
402 for(i = 0; i < NUM_HIGHLVL_PARTITIONS; i++) 402 for(i = 0; i < NUM_HIGHLVL_PARTITIONS; i++)
403 ++higlvl_partition_info[i].name; 403 ++higlvl_partition_info[i].name;
404 } 404 }
405 405
406 printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n", 406 printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%lx\n",
407 is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys); 407 is_dnp ? "DNPC" : "ADNP", dnpc_map.size, dnpc_map.phys);
408 408
409 dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); 409 dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size);
@@ -436,7 +436,7 @@ static int __init init_dnpc(void)
436 iounmap(dnpc_map.virt); 436 iounmap(dnpc_map.virt);
437 return -ENXIO; 437 return -ENXIO;
438 } 438 }
439 439
440 mymtd->owner = THIS_MODULE; 440 mymtd->owner = THIS_MODULE;
441 441
442 /* 442 /*
diff --git a/drivers/mtd/maps/dmv182.c b/drivers/mtd/maps/dmv182.c
index b9bc63503e2..b993ac01a9a 100644
--- a/drivers/mtd/maps/dmv182.c
+++ b/drivers/mtd/maps/dmv182.c
@@ -1,10 +1,10 @@
1 1
2/* 2/*
3 * drivers/mtd/maps/svme182.c 3 * drivers/mtd/maps/svme182.c
4 * 4 *
5 * Flash map driver for the Dy4 SVME182 board 5 * Flash map driver for the Dy4 SVME182 board
6 * 6 *
7 * $Id: dmv182.c,v 1.5 2004/11/04 13:24:14 gleixner Exp $ 7 * $Id: dmv182.c,v 1.6 2005/11/07 11:14:26 gleixner Exp $
8 * 8 *
9 * Copyright 2003-2004, TimeSys Corporation 9 * Copyright 2003-2004, TimeSys Corporation
10 * 10 *
@@ -104,7 +104,7 @@ static int __init init_svme182(void)
104 partitions = svme182_partitions; 104 partitions = svme182_partitions;
105 105
106 svme182_map.virt = ioremap(FLASH_BASE_ADDR, svme182_map.size); 106 svme182_map.virt = ioremap(FLASH_BASE_ADDR, svme182_map.size);
107 107
108 if (svme182_map.virt == 0) { 108 if (svme182_map.virt == 0) {
109 printk("Failed to ioremap FLASH memory area.\n"); 109 printk("Failed to ioremap FLASH memory area.\n");
110 return -EIO; 110 return -EIO;
diff --git a/drivers/mtd/maps/ebony.c b/drivers/mtd/maps/ebony.c
index b9d9cf4854b..c0daf58357c 100644
--- a/drivers/mtd/maps/ebony.c
+++ b/drivers/mtd/maps/ebony.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * $Id: ebony.c,v 1.15 2004/12/09 18:39:54 holindho Exp $ 2 * $Id: ebony.c,v 1.16 2005/11/07 11:14:26 gleixner Exp $
3 * 3 *
4 * Mapping for Ebony user flash 4 * Mapping for Ebony user flash
5 * 5 *
6 * Matt Porter <mporter@kernel.crashing.org> 6 * Matt Porter <mporter@kernel.crashing.org>
@@ -85,7 +85,7 @@ int __init init_ebony(void)
85 small_flash_base = EBONY_SMALL_FLASH_LOW2; 85 small_flash_base = EBONY_SMALL_FLASH_LOW2;
86 else 86 else
87 small_flash_base = EBONY_SMALL_FLASH_LOW1; 87 small_flash_base = EBONY_SMALL_FLASH_LOW1;
88 88
89 if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) && 89 if (EBONY_BOOT_SMALL_FLASH(fpga0_reg) &&
90 !EBONY_ONBRD_FLASH_EN(fpga0_reg)) 90 !EBONY_ONBRD_FLASH_EN(fpga0_reg))
91 large_flash_base = EBONY_LARGE_FLASH_LOW; 91 large_flash_base = EBONY_LARGE_FLASH_LOW;
diff --git a/drivers/mtd/maps/edb7312.c b/drivers/mtd/maps/edb7312.c
index 8b0da394f3f..b48a3473ffc 100644
--- a/drivers/mtd/maps/edb7312.c
+++ b/drivers/mtd/maps/edb7312.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * $Id: edb7312.c,v 1.13 2004/11/04 13:24:14 gleixner Exp $ 2 * $Id: edb7312.c,v 1.14 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * Handle mapping of the NOR flash on Cogent EDB7312 boards 4 * Handle mapping of the NOR flash on Cogent EDB7312 boards
5 * 5 *
6 * Copyright 2002 SYSGO Real-Time Solutions GmbH 6 * Copyright 2002 SYSGO Real-Time Solutions GmbH
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
@@ -46,7 +46,7 @@ struct map_info edb7312nor_map = {
46#ifdef CONFIG_MTD_PARTITIONS 46#ifdef CONFIG_MTD_PARTITIONS
47 47
48/* 48/*
49 * MTD partitioning stuff 49 * MTD partitioning stuff
50 */ 50 */
51static struct mtd_partition static_partitions[3] = 51static struct mtd_partition static_partitions[3] =
52{ 52{
@@ -80,7 +80,7 @@ int __init init_edb7312nor(void)
80 const char **type; 80 const char **type;
81 const char *part_type = 0; 81 const char *part_type = 0;
82 82
83 printk(KERN_NOTICE MSG_PREFIX "0x%08x at 0x%08x\n", 83 printk(KERN_NOTICE MSG_PREFIX "0x%08x at 0x%08x\n",
84 WINDOW_SIZE, WINDOW_ADDR); 84 WINDOW_SIZE, WINDOW_ADDR);
85 edb7312nor_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); 85 edb7312nor_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
86 86
@@ -88,7 +88,7 @@ int __init init_edb7312nor(void)
88 printk(MSG_PREFIX "failed to ioremap\n"); 88 printk(MSG_PREFIX "failed to ioremap\n");
89 return -EIO; 89 return -EIO;
90 } 90 }
91 91
92 simple_map_init(&edb7312nor_map); 92 simple_map_init(&edb7312nor_map);
93 93
94 mymtd = 0; 94 mymtd = 0;
diff --git a/drivers/mtd/maps/epxa10db-flash.c b/drivers/mtd/maps/epxa10db-flash.c
index 1df6188926b..265b079fe93 100644
--- a/drivers/mtd/maps/epxa10db-flash.c
+++ b/drivers/mtd/maps/epxa10db-flash.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2001 Altera Corporation 5 * Copyright (C) 2001 Altera Corporation
6 * Copyright (C) 2001 Red Hat, Inc. 6 * Copyright (C) 2001 Red Hat, Inc.
7 * 7 *
8 * $Id: epxa10db-flash.c,v 1.13 2004/11/04 13:24:14 gleixner Exp $ 8 * $Id: epxa10db-flash.c,v 1.15 2005/11/07 11:14:27 gleixner Exp $
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ static const char *probes[] = { "RedBoot", "afs", NULL };
62static int __init epxa_mtd_init(void) 62static int __init epxa_mtd_init(void)
63{ 63{
64 int i; 64 int i;
65 65
66 printk(KERN_NOTICE "%s flash device: 0x%x at 0x%x\n", BOARD_NAME, FLASH_SIZE, FLASH_START); 66 printk(KERN_NOTICE "%s flash device: 0x%x at 0x%x\n", BOARD_NAME, FLASH_SIZE, FLASH_START);
67 67
68 epxa_map.virt = ioremap(FLASH_START, FLASH_SIZE); 68 epxa_map.virt = ioremap(FLASH_START, FLASH_SIZE);
@@ -126,8 +126,8 @@ static void __exit epxa_mtd_cleanup(void)
126} 126}
127 127
128 128
129/* 129/*
130 * This will do for now, once we decide which bootldr we're finally 130 * This will do for now, once we decide which bootldr we're finally
131 * going to use then we'll remove this function and do it properly 131 * going to use then we'll remove this function and do it properly
132 * 132 *
133 * Partions are currently (as offsets from base of flash): 133 * Partions are currently (as offsets from base of flash):
@@ -140,7 +140,7 @@ static int __init epxa_default_partitions(struct mtd_info *master, struct mtd_pa
140 struct mtd_partition *parts; 140 struct mtd_partition *parts;
141 int ret, i; 141 int ret, i;
142 int npartitions = 0; 142 int npartitions = 0;
143 char *names; 143 char *names;
144 const char *name = "jffs"; 144 const char *name = "jffs";
145 145
146 printk("Using default partitions for %s\n",BOARD_NAME); 146 printk("Using default partitions for %s\n",BOARD_NAME);
@@ -152,7 +152,7 @@ static int __init epxa_default_partitions(struct mtd_info *master, struct mtd_pa
152 goto out; 152 goto out;
153 } 153 }
154 i=0; 154 i=0;
155 names = (char *)&parts[npartitions]; 155 names = (char *)&parts[npartitions];
156 parts[i].name = names; 156 parts[i].name = names;
157 names += strlen(name) + 1; 157 names += strlen(name) + 1;
158 strcpy(parts[i].name, name); 158 strcpy(parts[i].name, name);
diff --git a/drivers/mtd/maps/fortunet.c b/drivers/mtd/maps/fortunet.c
index 00f7bbe5479..c6bf4e1219e 100644
--- a/drivers/mtd/maps/fortunet.c
+++ b/drivers/mtd/maps/fortunet.c
@@ -1,6 +1,6 @@
1/* fortunet.c memory map 1/* fortunet.c memory map
2 * 2 *
3 * $Id: fortunet.c,v 1.9 2004/11/04 13:24:14 gleixner Exp $ 3 * $Id: fortunet.c,v 1.11 2005/11/07 11:14:27 gleixner Exp $
4 */ 4 */
5 5
6#include <linux/module.h> 6#include <linux/module.h>
@@ -212,7 +212,7 @@ int __init init_fortunet(void)
212 212
213 map_regions[ix].map_info.phys = map_regions[ix].window_addr_physical, 213 map_regions[ix].map_info.phys = map_regions[ix].window_addr_physical,
214 214
215 map_regions[ix].map_info.virt = 215 map_regions[ix].map_info.virt =
216 ioremap_nocache( 216 ioremap_nocache(
217 map_regions[ix].window_addr_physical, 217 map_regions[ix].window_addr_physical,
218 map_regions[ix].map_info.size); 218 map_regions[ix].map_info.size);
diff --git a/drivers/mtd/maps/h720x-flash.c b/drivers/mtd/maps/h720x-flash.c
index c73828171d9..31909482110 100644
--- a/drivers/mtd/maps/h720x-flash.c
+++ b/drivers/mtd/maps/h720x-flash.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * Flash memory access on Hynix GMS30C7201/HMS30C7202 based 2 * Flash memory access on Hynix GMS30C7201/HMS30C7202 based
3 * evaluation boards 3 * evaluation boards
4 * 4 *
5 * $Id: h720x-flash.c,v 1.11 2004/11/04 13:24:14 gleixner Exp $ 5 * $Id: h720x-flash.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $
6 * 6 *
7 * (C) 2002 Jungjun Kim <jungjun.kim@hynix.com> 7 * (C) 2002 Jungjun Kim <jungjun.kim@hynix.com>
8 * 2003 Thomas Gleixner <tglx@linutronix.de> 8 * 2003 Thomas Gleixner <tglx@linutronix.de>
9 */ 9 */
10 10
11#include <linux/config.h> 11#include <linux/config.h>
@@ -72,7 +72,7 @@ int __init h720x_mtd_init(void)
72{ 72{
73 73
74 char *part_type = NULL; 74 char *part_type = NULL;
75 75
76 h720x_map.virt = ioremap(FLASH_PHYS, FLASH_SIZE); 76 h720x_map.virt = ioremap(FLASH_PHYS, FLASH_SIZE);
77 77
78 if (!h720x_map.virt) { 78 if (!h720x_map.virt) {
@@ -91,7 +91,7 @@ int __init h720x_mtd_init(void)
91 h720x_map.bankwidth = 2; 91 h720x_map.bankwidth = 2;
92 mymtd = do_map_probe("cfi_probe", &h720x_map); 92 mymtd = do_map_probe("cfi_probe", &h720x_map);
93 } 93 }
94 94
95 if (mymtd) { 95 if (mymtd) {
96 mymtd->owner = THIS_MODULE; 96 mymtd->owner = THIS_MODULE;
97 97
@@ -124,11 +124,11 @@ static void __exit h720x_mtd_cleanup(void)
124 del_mtd_partitions(mymtd); 124 del_mtd_partitions(mymtd);
125 map_destroy(mymtd); 125 map_destroy(mymtd);
126 } 126 }
127 127
128 /* Free partition info, if commandline partition was used */ 128 /* Free partition info, if commandline partition was used */
129 if (mtd_parts && (mtd_parts != h720x_partitions)) 129 if (mtd_parts && (mtd_parts != h720x_partitions))
130 kfree (mtd_parts); 130 kfree (mtd_parts);
131 131
132 if (h720x_map.virt) { 132 if (h720x_map.virt) {
133 iounmap((void *)h720x_map.virt); 133 iounmap((void *)h720x_map.virt);
134 h720x_map.virt = 0; 134 h720x_map.virt = 0;
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index e505207cd48..ea5073781b3 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -2,7 +2,7 @@
2 * ichxrom.c 2 * ichxrom.c
3 * 3 *
4 * Normal mappings of chips in physical memory 4 * Normal mappings of chips in physical memory
5 * $Id: ichxrom.c,v 1.18 2005/07/07 10:26:20 dwmw2 Exp $ 5 * $Id: ichxrom.c,v 1.19 2005/11/07 11:14:27 gleixner Exp $
6 */ 6 */
7 7
8#include <linux/module.h> 8#include <linux/module.h>
@@ -101,7 +101,7 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev,
101 * you can only really attach a FWH to an ICHX there 101 * you can only really attach a FWH to an ICHX there
102 * a number of simplifications you can make. 102 * a number of simplifications you can make.
103 * 103 *
104 * Also you can page firmware hubs if an 8MB window isn't enough 104 * Also you can page firmware hubs if an 8MB window isn't enough
105 * but don't currently handle that case either. 105 * but don't currently handle that case either.
106 */ 106 */
107 window->pdev = pdev; 107 window->pdev = pdev;
@@ -144,7 +144,7 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev,
144 window->phys = 0xfff00000; 144 window->phys = 0xfff00000;
145 } 145 }
146 else if ((byte & 0x80) == 0x80) { 146 else if ((byte & 0x80) == 0x80) {
147 window->phys = 0xfff80000; 147 window->phys = 0xfff80000;
148 } 148 }
149 149
150 if (window->phys == 0) { 150 if (window->phys == 0) {
@@ -233,7 +233,7 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev,
233 * in a factory setting. So in-place programming 233 * in a factory setting. So in-place programming
234 * needs to use a different method. 234 * needs to use a different method.
235 */ 235 */
236 for(map->map.bankwidth = 32; map->map.bankwidth; 236 for(map->map.bankwidth = 32; map->map.bankwidth;
237 map->map.bankwidth >>= 1) 237 map->map.bankwidth >>= 1)
238 { 238 {
239 char **probe_type; 239 char **probe_type;
@@ -286,7 +286,7 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev,
286 for(i = 0; i < cfi->numchips; i++) { 286 for(i = 0; i < cfi->numchips; i++) {
287 cfi->chips[i].start += offset; 287 cfi->chips[i].start += offset;
288 } 288 }
289 289
290 /* Now that the mtd devices is complete claim and export it */ 290 /* Now that the mtd devices is complete claim and export it */
291 map->mtd->owner = THIS_MODULE; 291 map->mtd->owner = THIS_MODULE;
292 if (add_mtd_device(map->mtd)) { 292 if (add_mtd_device(map->mtd)) {
@@ -306,9 +306,8 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev,
306 306
307 out: 307 out:
308 /* Free any left over map structures */ 308 /* Free any left over map structures */
309 if (map) { 309 kfree(map);
310 kfree(map); 310
311 }
312 /* See if I have any map structures */ 311 /* See if I have any map structures */
313 if (list_empty(&window->maps)) { 312 if (list_empty(&window->maps)) {
314 ichxrom_cleanup(window); 313 ichxrom_cleanup(window);
@@ -325,11 +324,11 @@ static void __devexit ichxrom_remove_one (struct pci_dev *pdev)
325} 324}
326 325
327static struct pci_device_id ichxrom_pci_tbl[] __devinitdata = { 326static struct pci_device_id ichxrom_pci_tbl[] __devinitdata = {
328 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, 327 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0,
329 PCI_ANY_ID, PCI_ANY_ID, }, 328 PCI_ANY_ID, PCI_ANY_ID, },
330 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, 329 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
331 PCI_ANY_ID, PCI_ANY_ID, }, 330 PCI_ANY_ID, PCI_ANY_ID, },
332 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, 331 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
333 PCI_ANY_ID, PCI_ANY_ID, }, 332 PCI_ANY_ID, PCI_ANY_ID, },
334 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, 333 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
335 PCI_ANY_ID, PCI_ANY_ID, }, 334 PCI_ANY_ID, PCI_ANY_ID, },
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c
index cb39172c81d..ba7f40311a7 100644
--- a/drivers/mtd/maps/impa7.c
+++ b/drivers/mtd/maps/impa7.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * $Id: impa7.c,v 1.13 2004/11/04 13:24:14 gleixner Exp $ 2 * $Id: impa7.c,v 1.14 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * Handle mapping of the NOR flash on implementa A7 boards 4 * Handle mapping of the NOR flash on implementa A7 boards
5 * 5 *
6 * Copyright 2002 SYSGO Real-Time Solutions GmbH 6 * Copyright 2002 SYSGO Real-Time Solutions GmbH
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
@@ -55,7 +55,7 @@ static struct map_info impa7_map[NUM_FLASHBANKS] = {
55#ifdef CONFIG_MTD_PARTITIONS 55#ifdef CONFIG_MTD_PARTITIONS
56 56
57/* 57/*
58 * MTD partitioning stuff 58 * MTD partitioning stuff
59 */ 59 */
60static struct mtd_partition static_partitions[] = 60static struct mtd_partition static_partitions[] =
61{ 61{
@@ -108,9 +108,9 @@ int __init init_impa7(void)
108 impa7_mtd[i]->owner = THIS_MODULE; 108 impa7_mtd[i]->owner = THIS_MODULE;
109 devicesfound++; 109 devicesfound++;
110#ifdef CONFIG_MTD_PARTITIONS 110#ifdef CONFIG_MTD_PARTITIONS
111 mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i], 111 mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i],
112 probes, 112 probes,
113 &mtd_parts[i], 113 &mtd_parts[i],
114 0); 114 0);
115 if (mtd_parts_nb[i] > 0) { 115 if (mtd_parts_nb[i] > 0) {
116 part_type = "command line"; 116 part_type = "command line";
@@ -121,16 +121,16 @@ int __init init_impa7(void)
121 } 121 }
122 122
123 printk(KERN_NOTICE MSG_PREFIX 123 printk(KERN_NOTICE MSG_PREFIX
124 "using %s partition definition\n", 124 "using %s partition definition\n",
125 part_type); 125 part_type);
126 add_mtd_partitions(impa7_mtd[i], 126 add_mtd_partitions(impa7_mtd[i],
127 mtd_parts[i], mtd_parts_nb[i]); 127 mtd_parts[i], mtd_parts_nb[i]);
128#else 128#else
129 add_mtd_device(impa7_mtd[i]); 129 add_mtd_device(impa7_mtd[i]);
130 130
131#endif 131#endif
132 } 132 }
133 else 133 else
134 iounmap((void *)impa7_map[i].virt); 134 iounmap((void *)impa7_map[i].virt);
135 } 135 }
136 return devicesfound == 0 ? -ENXIO : 0; 136 return devicesfound == 0 ? -ENXIO : 0;
diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c
index d14a0185b8f..fe738fd8d6f 100644
--- a/drivers/mtd/maps/integrator-flash.c
+++ b/drivers/mtd/maps/integrator-flash.c
@@ -1,28 +1,28 @@
1/*====================================================================== 1/*======================================================================
2 2
3 drivers/mtd/maps/integrator-flash.c: ARM Integrator flash map driver 3 drivers/mtd/maps/integrator-flash.c: ARM Integrator flash map driver
4 4
5 Copyright (C) 2000 ARM Limited 5 Copyright (C) 2000 ARM Limited
6 Copyright (C) 2003 Deep Blue Solutions Ltd. 6 Copyright (C) 2003 Deep Blue Solutions Ltd.
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 21
22 This is access code for flashes using ARM's flash partitioning 22 This is access code for flashes using ARM's flash partitioning
23 standards. 23 standards.
24 24
25 $Id: integrator-flash.c,v 1.18 2004/11/01 13:26:15 rmk Exp $ 25 $Id: integrator-flash.c,v 1.20 2005/11/07 11:14:27 gleixner Exp $
26 26
27======================================================================*/ 27======================================================================*/
28 28
@@ -148,8 +148,7 @@ static int armflash_probe(struct device *_dev)
148 del_mtd_partitions(info->mtd); 148 del_mtd_partitions(info->mtd);
149 map_destroy(info->mtd); 149 map_destroy(info->mtd);
150 } 150 }
151 if (info->parts) 151 kfree(info->parts);
152 kfree(info->parts);
153 152
154 no_device: 153 no_device:
155 iounmap(base); 154 iounmap(base);
@@ -176,8 +175,7 @@ static int armflash_remove(struct device *_dev)
176 del_mtd_partitions(info->mtd); 175 del_mtd_partitions(info->mtd);
177 map_destroy(info->mtd); 176 map_destroy(info->mtd);
178 } 177 }
179 if (info->parts) 178 kfree(info->parts);
180 kfree(info->parts);
181 179
182 iounmap(info->map.virt); 180 iounmap(info->map.virt);
183 release_resource(info->res); 181 release_resource(info->res);
diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c
index 71240181084..35097c9bbf5 100644
--- a/drivers/mtd/maps/ipaq-flash.c
+++ b/drivers/mtd/maps/ipaq-flash.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * Flash memory access on iPAQ Handhelds (either SA1100 or PXA250 based) 2 * Flash memory access on iPAQ Handhelds (either SA1100 or PXA250 based)
3 * 3 *
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@cam.org>
5 * (C) 2002 Hewlett-Packard Company <jamey.hicks@hp.com> 5 * (C) 2002 Hewlett-Packard Company <jamey.hicks@hp.com>
6 * (C) 2003 Christian Pellegrin <chri@ascensit.com>, <chri@infis.univ.ts.it>: concatenation of multiple flashes 6 * (C) 2003 Christian Pellegrin <chri@ascensit.com>, <chri@infis.univ.ts.it>: concatenation of multiple flashes
7 * 7 *
8 * $Id: ipaq-flash.c,v 1.3 2004/11/04 13:24:15 gleixner Exp $ 8 * $Id: ipaq-flash.c,v 1.5 2005/11/07 11:14:27 gleixner Exp $
9 */ 9 */
10 10
11#include <linux/config.h> 11#include <linux/config.h>
@@ -107,7 +107,7 @@ static struct mtd_partition h3xxx_partitions[] = {
107#ifndef CONFIG_LAB 107#ifndef CONFIG_LAB
108 mask_flags: MTD_WRITEABLE, /* force read-only */ 108 mask_flags: MTD_WRITEABLE, /* force read-only */
109#endif 109#endif
110 }, 110 },
111 { 111 {
112 name: "H3XXX root jffs2", 112 name: "H3XXX root jffs2",
113#ifndef CONFIG_LAB 113#ifndef CONFIG_LAB
@@ -148,7 +148,7 @@ static DEFINE_SPINLOCK(ipaq_vpp_lock);
148static void h3xxx_set_vpp(struct map_info *map, int vpp) 148static void h3xxx_set_vpp(struct map_info *map, int vpp)
149{ 149{
150 static int nest = 0; 150 static int nest = 0;
151 151
152 spin_lock(&ipaq_vpp_lock); 152 spin_lock(&ipaq_vpp_lock);
153 if (vpp) 153 if (vpp)
154 nest++; 154 nest++;
@@ -191,7 +191,7 @@ static unsigned long cs_phys[] = {
191 SA1100_CS3_PHYS, 191 SA1100_CS3_PHYS,
192 SA1100_CS4_PHYS, 192 SA1100_CS4_PHYS,
193 SA1100_CS5_PHYS, 193 SA1100_CS5_PHYS,
194#else 194#else
195 PXA_CS0_PHYS, 195 PXA_CS0_PHYS,
196 PXA_CS1_PHYS, 196 PXA_CS1_PHYS,
197 PXA_CS2_PHYS, 197 PXA_CS2_PHYS,
@@ -216,7 +216,7 @@ int __init ipaq_mtd_init(void)
216 216
217 /* Default flash bankwidth */ 217 /* Default flash bankwidth */
218 // ipaq_map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4; 218 // ipaq_map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4;
219 219
220 if (machine_is_h1900()) 220 if (machine_is_h1900())
221 { 221 {
222 /* For our intents, the h1900 is not a real iPAQ, so we special-case it. */ 222 /* For our intents, the h1900 is not a real iPAQ, so we special-case it. */
@@ -229,7 +229,7 @@ int __init ipaq_mtd_init(void)
229 else 229 else
230 for(i=0; i<MAX_IPAQ_CS; i++) 230 for(i=0; i<MAX_IPAQ_CS; i++)
231 ipaq_map[i].bankwidth = 4; 231 ipaq_map[i].bankwidth = 4;
232 232
233 /* 233 /*
234 * Static partition definition selection 234 * Static partition definition selection
235 */ 235 */
@@ -309,7 +309,7 @@ int __init ipaq_mtd_init(void)
309 return -ENXIO; 309 return -ENXIO;
310 } else 310 } else
311 printk(KERN_NOTICE "iPAQ flash: found %d bytes\n", my_sub_mtd[i]->size); 311 printk(KERN_NOTICE "iPAQ flash: found %d bytes\n", my_sub_mtd[i]->size);
312 312
313 /* do we really need this debugging? --joshua 20030703 */ 313 /* do we really need this debugging? --joshua 20030703 */
314 // printk("my_sub_mtd[%d]=%p\n", i, my_sub_mtd[i]); 314 // printk("my_sub_mtd[%d]=%p\n", i, my_sub_mtd[i]);
315 my_sub_mtd[i]->owner = THIS_MODULE; 315 my_sub_mtd[i]->owner = THIS_MODULE;
@@ -333,11 +333,11 @@ int __init ipaq_mtd_init(void)
333#else 333#else
334 mymtd = my_sub_mtd[0]; 334 mymtd = my_sub_mtd[0];
335 335
336 /* 336 /*
337 *In the very near future, command line partition parsing 337 *In the very near future, command line partition parsing
338 * will use the device name as 'mtd-id' instead of a value 338 * will use the device name as 'mtd-id' instead of a value
339 * passed to the parse_cmdline_partitions() routine. Since 339 * passed to the parse_cmdline_partitions() routine. Since
340 * the bootldr says 'ipaq', make sure it continues to work. 340 * the bootldr says 'ipaq', make sure it continues to work.
341 */ 341 */
342 mymtd->name = "ipaq"; 342 mymtd->name = "ipaq";
343 343
@@ -385,7 +385,7 @@ int __init ipaq_mtd_init(void)
385 */ 385 */
386 386
387 i = parse_mtd_partitions(mymtd, part_probes, &parsed_parts, 0); 387 i = parse_mtd_partitions(mymtd, part_probes, &parsed_parts, 0);
388 388
389 if (i > 0) { 389 if (i > 0) {
390 nb_parts = parsed_nr_parts = i; 390 nb_parts = parsed_nr_parts = i;
391 parts = parsed_parts; 391 parts = parsed_parts;
@@ -423,16 +423,15 @@ static void __exit ipaq_mtd_cleanup(void)
423#endif 423#endif
424 map_destroy(mymtd); 424 map_destroy(mymtd);
425#ifdef CONFIG_MTD_CONCAT 425#ifdef CONFIG_MTD_CONCAT
426 for(i=0; i<MAX_IPAQ_CS; i++) 426 for(i=0; i<MAX_IPAQ_CS; i++)
427#else 427#else
428 for(i=1; i<MAX_IPAQ_CS; i++) 428 for(i=1; i<MAX_IPAQ_CS; i++)
429#endif 429#endif
430 { 430 {
431 if (my_sub_mtd[i]) 431 if (my_sub_mtd[i])
432 map_destroy(my_sub_mtd[i]); 432 map_destroy(my_sub_mtd[i]);
433 } 433 }
434 if (parsed_parts) 434 kfree(parsed_parts);
435 kfree(parsed_parts);
436 } 435 }
437} 436}
438 437
@@ -445,14 +444,14 @@ static int __init h1900_special_case(void)
445 ipaq_map[0].phys = 0x0; 444 ipaq_map[0].phys = 0x0;
446 ipaq_map[0].virt = __ioremap(0x0, 0x04000000, 0, 1); 445 ipaq_map[0].virt = __ioremap(0x0, 0x04000000, 0, 1);
447 ipaq_map[0].bankwidth = 2; 446 ipaq_map[0].bankwidth = 2;
448 447
449 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); 448 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt);
450 mymtd = do_map_probe("jedec_probe", &ipaq_map[0]); 449 mymtd = do_map_probe("jedec_probe", &ipaq_map[0]);
451 if (!mymtd) 450 if (!mymtd)
452 return -ENODEV; 451 return -ENODEV;
453 add_mtd_device(mymtd); 452 add_mtd_device(mymtd);
454 printk(KERN_NOTICE "iPAQ flash: registered h1910 flash\n"); 453 printk(KERN_NOTICE "iPAQ flash: registered h1910 flash\n");
455 454
456 return 0; 455 return 0;
457} 456}
458 457
diff --git a/drivers/mtd/maps/iq80310.c b/drivers/mtd/maps/iq80310.c
index 558d014e7ac..62d9e87d84e 100644
--- a/drivers/mtd/maps/iq80310.c
+++ b/drivers/mtd/maps/iq80310.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * $Id: iq80310.c,v 1.20 2004/11/04 13:24:15 gleixner Exp $ 2 * $Id: iq80310.c,v 1.21 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * Mapping for the Intel XScale IQ80310 evaluation board 4 * Mapping for the Intel XScale IQ80310 evaluation board
5 * 5 *
6 * Author: Nicolas Pitre 6 * Author: Nicolas Pitre
7 * Copyright: (C) 2001 MontaVista Software Inc. 7 * Copyright: (C) 2001 MontaVista Software Inc.
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
@@ -103,8 +103,7 @@ static void __exit cleanup_iq80310(void)
103 if (mymtd) { 103 if (mymtd) {
104 del_mtd_partitions(mymtd); 104 del_mtd_partitions(mymtd);
105 map_destroy(mymtd); 105 map_destroy(mymtd);
106 if (parsed_parts) 106 kfree(parsed_parts);
107 kfree(parsed_parts);
108 } 107 }
109 if (iq80310_map.virt) 108 if (iq80310_map.virt)
110 iounmap((void *)iq80310_map.virt); 109 iounmap((void *)iq80310_map.virt);
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index 00b9f67580f..641eb2b55e9 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ixp2000.c,v 1.6 2005/03/18 14:07:46 gleixner Exp $ 2 * $Id: ixp2000.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * drivers/mtd/maps/ixp2000.c 4 * drivers/mtd/maps/ixp2000.c
5 * 5 *
@@ -14,7 +14,7 @@
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 * 17 *
18 */ 18 */
19 19
20#include <linux/module.h> 20#include <linux/module.h>
@@ -46,8 +46,8 @@ struct ixp2000_flash_info {
46}; 46};
47 47
48static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs) 48static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs)
49{ 49{
50 unsigned long (*set_bank)(unsigned long) = 50 unsigned long (*set_bank)(unsigned long) =
51 (unsigned long(*)(unsigned long))map->map_priv_2; 51 (unsigned long(*)(unsigned long))map->map_priv_2;
52 52
53 return (set_bank ? set_bank(ofs) : ofs); 53 return (set_bank ? set_bank(ofs) : ofs);
@@ -55,8 +55,8 @@ static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long
55 55
56#ifdef __ARMEB__ 56#ifdef __ARMEB__
57/* 57/*
58 * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which 58 * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which
59 * causes the lower address bits to be XORed with 0x11 on 8 bit accesses 59 * causes the lower address bits to be XORed with 0x11 on 8 bit accesses
60 * and XORed with 0x10 on 16 bit accesses. See the spec update, erratum 44. 60 * and XORed with 0x10 on 16 bit accesses. See the spec update, erratum 44.
61 */ 61 */
62static int erratum44_workaround = 0; 62static int erratum44_workaround = 0;
@@ -90,7 +90,7 @@ static void ixp2000_flash_copy_from(struct map_info *map, void *to,
90 unsigned long from, ssize_t len) 90 unsigned long from, ssize_t len)
91{ 91{
92 from = flash_bank_setup(map, from); 92 from = flash_bank_setup(map, from);
93 while(len--) 93 while(len--)
94 *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++); 94 *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++);
95} 95}
96 96
@@ -129,8 +129,7 @@ static int ixp2000_flash_remove(struct device *_dev)
129 if (info->map.map_priv_1) 129 if (info->map.map_priv_1)
130 iounmap((void *) info->map.map_priv_1); 130 iounmap((void *) info->map.map_priv_1);
131 131
132 if (info->partitions) { 132 kfree(info->partitions);
133 kfree(info->partitions); }
134 133
135 if (info->res) { 134 if (info->res) {
136 release_resource(info->res); 135 release_resource(info->res);
@@ -149,11 +148,11 @@ static int ixp2000_flash_probe(struct device *_dev)
149 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 148 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
150 struct platform_device *dev = to_platform_device(_dev); 149 struct platform_device *dev = to_platform_device(_dev);
151 struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; 150 struct ixp2000_flash_data *ixp_data = dev->dev.platform_data;
152 struct flash_platform_data *plat; 151 struct flash_platform_data *plat;
153 struct ixp2000_flash_info *info; 152 struct ixp2000_flash_info *info;
154 unsigned long window_size; 153 unsigned long window_size;
155 int err = -1; 154 int err = -1;
156 155
157 if (!ixp_data) 156 if (!ixp_data)
158 return -ENODEV; 157 return -ENODEV;
159 158
@@ -162,7 +161,7 @@ static int ixp2000_flash_probe(struct device *_dev)
162 return -ENODEV; 161 return -ENODEV;
163 162
164 window_size = dev->resource->end - dev->resource->start + 1; 163 window_size = dev->resource->end - dev->resource->start + 1;
165 dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", 164 dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n",
166 ixp_data->nr_banks, ((u32)window_size >> 20)); 165 ixp_data->nr_banks, ((u32)window_size >> 20));
167 166
168 if (plat->width != 1) { 167 if (plat->width != 1) {
@@ -175,7 +174,7 @@ static int ixp2000_flash_probe(struct device *_dev)
175 if(!info) { 174 if(!info) {
176 err = -ENOMEM; 175 err = -ENOMEM;
177 goto Error; 176 goto Error;
178 } 177 }
179 memzero(info, sizeof(struct ixp2000_flash_info)); 178 memzero(info, sizeof(struct ixp2000_flash_info));
180 179
181 dev_set_drvdata(&dev->dev, info); 180 dev_set_drvdata(&dev->dev, info);
@@ -185,7 +184,7 @@ static int ixp2000_flash_probe(struct device *_dev)
185 * not attempt to do a direct access on us. 184 * not attempt to do a direct access on us.
186 */ 185 */
187 info->map.phys = NO_XIP; 186 info->map.phys = NO_XIP;
188 187
189 info->nr_banks = ixp_data->nr_banks; 188 info->nr_banks = ixp_data->nr_banks;
190 info->map.size = ixp_data->nr_banks * window_size; 189 info->map.size = ixp_data->nr_banks * window_size;
191 info->map.bankwidth = 1; 190 info->map.bankwidth = 1;
@@ -193,7 +192,7 @@ static int ixp2000_flash_probe(struct device *_dev)
193 /* 192 /*
194 * map_priv_2 is used to store a ptr to to the bank_setup routine 193 * map_priv_2 is used to store a ptr to to the bank_setup routine
195 */ 194 */
196 info->map.map_priv_2 = (void __iomem *) ixp_data->bank_setup; 195 info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup;
197 196
198 info->map.name = dev->dev.bus_id; 197 info->map.name = dev->dev.bus_id;
199 info->map.read = ixp2000_flash_read8; 198 info->map.read = ixp2000_flash_read8;
@@ -201,8 +200,8 @@ static int ixp2000_flash_probe(struct device *_dev)
201 info->map.copy_from = ixp2000_flash_copy_from; 200 info->map.copy_from = ixp2000_flash_copy_from;
202 info->map.copy_to = ixp2000_flash_copy_to; 201 info->map.copy_to = ixp2000_flash_copy_to;
203 202
204 info->res = request_mem_region(dev->resource->start, 203 info->res = request_mem_region(dev->resource->start,
205 dev->resource->end - dev->resource->start + 1, 204 dev->resource->end - dev->resource->start + 1,
206 dev->dev.bus_id); 205 dev->dev.bus_id);
207 if (!info->res) { 206 if (!info->res) {
208 dev_err(_dev, "Could not reserve memory region\n"); 207 dev_err(_dev, "Could not reserve memory region\n");
@@ -210,7 +209,7 @@ static int ixp2000_flash_probe(struct device *_dev)
210 goto Error; 209 goto Error;
211 } 210 }
212 211
213 info->map.map_priv_1 = ioremap(dev->resource->start, 212 info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start,
214 dev->resource->end - dev->resource->start + 1); 213 dev->resource->end - dev->resource->start + 1);
215 if (!info->map.map_priv_1) { 214 if (!info->map.map_priv_1) {
216 dev_err(_dev, "Failed to ioremap flash region\n"); 215 dev_err(_dev, "Failed to ioremap flash region\n");
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 733a9297a56..56b3a355bf7 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ixp4xx.c,v 1.7 2004/11/04 13:24:15 gleixner Exp $ 2 * $Id: ixp4xx.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * drivers/mtd/maps/ixp4xx.c 4 * drivers/mtd/maps/ixp4xx.c
5 * 5 *
@@ -45,7 +45,7 @@
45static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) 45static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
46{ 46{
47 map_word val; 47 map_word val;
48 val.x[0] = *(__u16 *) (map->map_priv_1 + ofs); 48 val.x[0] = le16_to_cpu(readw(map->virt + ofs));
49 return val; 49 return val;
50} 50}
51 51
@@ -59,35 +59,35 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
59{ 59{
60 int i; 60 int i;
61 u8 *dest = (u8 *) to; 61 u8 *dest = (u8 *) to;
62 u16 *src = (u16 *) (map->map_priv_1 + from); 62 void __iomem *src = map->virt + from;
63 u16 data; 63 u16 data;
64 64
65 for (i = 0; i < (len / 2); i++) { 65 for (i = 0; i < (len / 2); i++) {
66 data = src[i]; 66 data = le16_to_cpu(readw(src + 2*i));
67 dest[i * 2] = BYTE0(data); 67 dest[i * 2] = BYTE0(data);
68 dest[i * 2 + 1] = BYTE1(data); 68 dest[i * 2 + 1] = BYTE1(data);
69 } 69 }
70 70
71 if (len & 1) 71 if (len & 1)
72 dest[len - 1] = BYTE0(src[i]); 72 dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i)));
73} 73}
74 74
75/* 75/*
76 * Unaligned writes are ignored, causing the 8-bit 76 * Unaligned writes are ignored, causing the 8-bit
77 * probe to fail and proceed to the 16-bit probe (which succeeds). 77 * probe to fail and proceed to the 16-bit probe (which succeeds).
78 */ 78 */
79static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) 79static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
80{ 80{
81 if (!(adr & 1)) 81 if (!(adr & 1))
82 *(__u16 *) (map->map_priv_1 + adr) = d.x[0]; 82 writew(cpu_to_le16(d.x[0]), map->virt + adr);
83} 83}
84 84
85/* 85/*
86 * Fast write16 function without the probing check above 86 * Fast write16 function without the probing check above
87 */ 87 */
88static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) 88static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
89{ 89{
90 *(__u16 *) (map->map_priv_1 + adr) = d.x[0]; 90 writew(cpu_to_le16(d.x[0]), map->virt + adr);
91} 91}
92 92
93struct ixp4xx_flash_info { 93struct ixp4xx_flash_info {
@@ -104,28 +104,20 @@ static int ixp4xx_flash_remove(struct device *_dev)
104 struct platform_device *dev = to_platform_device(_dev); 104 struct platform_device *dev = to_platform_device(_dev);
105 struct flash_platform_data *plat = dev->dev.platform_data; 105 struct flash_platform_data *plat = dev->dev.platform_data;
106 struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); 106 struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
107 map_word d;
108 107
109 dev_set_drvdata(&dev->dev, NULL); 108 dev_set_drvdata(&dev->dev, NULL);
110 109
111 if(!info) 110 if(!info)
112 return 0; 111 return 0;
113 112
114 /*
115 * This is required for a soft reboot to work.
116 */
117 d.x[0] = 0xff;
118 ixp4xx_write16(&info->map, d, 0x55 * 0x2);
119
120 if (info->mtd) { 113 if (info->mtd) {
121 del_mtd_partitions(info->mtd); 114 del_mtd_partitions(info->mtd);
122 map_destroy(info->mtd); 115 map_destroy(info->mtd);
123 } 116 }
124 if (info->map.map_priv_1) 117 if (info->map.virt)
125 iounmap((void *) info->map.map_priv_1); 118 iounmap(info->map.virt);
126 119
127 if (info->partitions) 120 kfree(info->partitions);
128 kfree(info->partitions);
129 121
130 if (info->res) { 122 if (info->res) {
131 release_resource(info->res); 123 release_resource(info->res);
@@ -135,9 +127,6 @@ static int ixp4xx_flash_remove(struct device *_dev)
135 if (plat->exit) 127 if (plat->exit)
136 plat->exit(); 128 plat->exit();
137 129
138 /* Disable flash write */
139 *IXP4XX_EXP_CS0 &= ~IXP4XX_FLASH_WRITABLE;
140
141 return 0; 130 return 0;
142} 131}
143 132
@@ -161,17 +150,11 @@ static int ixp4xx_flash_probe(struct device *_dev)
161 if(!info) { 150 if(!info) {
162 err = -ENOMEM; 151 err = -ENOMEM;
163 goto Error; 152 goto Error;
164 } 153 }
165 memzero(info, sizeof(struct ixp4xx_flash_info)); 154 memzero(info, sizeof(struct ixp4xx_flash_info));
166 155
167 dev_set_drvdata(&dev->dev, info); 156 dev_set_drvdata(&dev->dev, info);
168 157
169 /*
170 * Enable flash write
171 * TODO: Move this out to board specific code
172 */
173 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
174
175 /* 158 /*
176 * Tell the MTD layer we're not 1:1 mapped so that it does 159 * Tell the MTD layer we're not 1:1 mapped so that it does
177 * not attempt to do a direct access on us. 160 * not attempt to do a direct access on us.
@@ -190,8 +173,8 @@ static int ixp4xx_flash_probe(struct device *_dev)
190 info->map.write = ixp4xx_probe_write16, 173 info->map.write = ixp4xx_probe_write16,
191 info->map.copy_from = ixp4xx_copy_from, 174 info->map.copy_from = ixp4xx_copy_from,
192 175
193 info->res = request_mem_region(dev->resource->start, 176 info->res = request_mem_region(dev->resource->start,
194 dev->resource->end - dev->resource->start + 1, 177 dev->resource->end - dev->resource->start + 1,
195 "IXP4XXFlash"); 178 "IXP4XXFlash");
196 if (!info->res) { 179 if (!info->res) {
197 printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n"); 180 printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
@@ -199,9 +182,9 @@ static int ixp4xx_flash_probe(struct device *_dev)
199 goto Error; 182 goto Error;
200 } 183 }
201 184
202 info->map.map_priv_1 = ioremap(dev->resource->start, 185 info->map.virt = ioremap(dev->resource->start,
203 dev->resource->end - dev->resource->start + 1); 186 dev->resource->end - dev->resource->start + 1);
204 if (!info->map.map_priv_1) { 187 if (!info->map.virt) {
205 printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); 188 printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
206 err = -EIO; 189 err = -EIO;
207 goto Error; 190 goto Error;
@@ -214,7 +197,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
214 goto Error; 197 goto Error;
215 } 198 }
216 info->mtd->owner = THIS_MODULE; 199 info->mtd->owner = THIS_MODULE;
217 200
218 /* Use the fast version */ 201 /* Use the fast version */
219 info->map.write = ixp4xx_write16, 202 info->map.write = ixp4xx_write16,
220 203
@@ -259,4 +242,3 @@ module_exit(ixp4xx_flash_exit);
259MODULE_LICENSE("GPL"); 242MODULE_LICENSE("GPL");
260MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems"); 243MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
261MODULE_AUTHOR("Deepak Saxena"); 244MODULE_AUTHOR("Deepak Saxena");
262
diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c
index b08668212ab..851bf957605 100644
--- a/drivers/mtd/maps/l440gx.c
+++ b/drivers/mtd/maps/l440gx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: l440gx.c,v 1.17 2004/11/28 09:40:39 dwmw2 Exp $ 2 * $Id: l440gx.c,v 1.18 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * BIOS Flash chip on Intel 440GX board. 4 * BIOS Flash chip on Intel 440GX board.
5 * 5 *
@@ -49,7 +49,7 @@ static struct map_info l440gx_map = {
49 .bankwidth = BUSWIDTH, 49 .bankwidth = BUSWIDTH,
50 .phys = WINDOW_ADDR, 50 .phys = WINDOW_ADDR,
51#if 0 51#if 0
52 /* FIXME verify that this is the 52 /* FIXME verify that this is the
53 * appripriate code for vpp enable/disable 53 * appripriate code for vpp enable/disable
54 */ 54 */
55 .set_vpp = l440gx_set_vpp 55 .set_vpp = l440gx_set_vpp
@@ -62,10 +62,10 @@ static int __init init_l440gx(void)
62 struct resource *pm_iobase; 62 struct resource *pm_iobase;
63 __u16 word; 63 __u16 word;
64 64
65 dev = pci_find_device(PCI_VENDOR_ID_INTEL, 65 dev = pci_find_device(PCI_VENDOR_ID_INTEL,
66 PCI_DEVICE_ID_INTEL_82371AB_0, NULL); 66 PCI_DEVICE_ID_INTEL_82371AB_0, NULL);
67 67
68 pm_dev = pci_find_device(PCI_VENDOR_ID_INTEL, 68 pm_dev = pci_find_device(PCI_VENDOR_ID_INTEL,
69 PCI_DEVICE_ID_INTEL_82371AB_3, NULL); 69 PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
70 70
71 if (!dev || !pm_dev) { 71 if (!dev || !pm_dev) {
@@ -82,10 +82,10 @@ static int __init init_l440gx(void)
82 simple_map_init(&l440gx_map); 82 simple_map_init(&l440gx_map);
83 printk(KERN_NOTICE "window_addr = 0x%08lx\n", (unsigned long)l440gx_map.virt); 83 printk(KERN_NOTICE "window_addr = 0x%08lx\n", (unsigned long)l440gx_map.virt);
84 84
85 /* Setup the pm iobase resource 85 /* Setup the pm iobase resource
86 * This code should move into some kind of generic bridge 86 * This code should move into some kind of generic bridge
87 * driver but for the moment I'm content with getting the 87 * driver but for the moment I'm content with getting the
88 * allocation correct. 88 * allocation correct.
89 */ 89 */
90 pm_iobase = &pm_dev->resource[PIIXE_IOBASE_RESOURCE]; 90 pm_iobase = &pm_dev->resource[PIIXE_IOBASE_RESOURCE];
91 if (!(pm_iobase->flags & IORESOURCE_IO)) { 91 if (!(pm_iobase->flags & IORESOURCE_IO)) {
@@ -110,7 +110,7 @@ static int __init init_l440gx(void)
110 /* Set the iobase */ 110 /* Set the iobase */
111 iobase = pm_iobase->start; 111 iobase = pm_iobase->start;
112 pci_write_config_dword(pm_dev, 0x40, iobase | 1); 112 pci_write_config_dword(pm_dev, 0x40, iobase | 1);
113 113
114 114
115 /* Set XBCS# */ 115 /* Set XBCS# */
116 pci_read_config_word(dev, 0x4e, &word); 116 pci_read_config_word(dev, 0x4e, &word);
@@ -122,7 +122,7 @@ static int __init init_l440gx(void)
122 122
123 /* Enable the gate on the WE line */ 123 /* Enable the gate on the WE line */
124 outb(inb(TRIBUF_PORT) & ~1, TRIBUF_PORT); 124 outb(inb(TRIBUF_PORT) & ~1, TRIBUF_PORT);
125 125
126 printk(KERN_NOTICE "Enabled WE line to L440GX BIOS flash chip.\n"); 126 printk(KERN_NOTICE "Enabled WE line to L440GX BIOS flash chip.\n");
127 127
128 mymtd = do_map_probe("jedec_probe", &l440gx_map); 128 mymtd = do_map_probe("jedec_probe", &l440gx_map);
@@ -145,7 +145,7 @@ static void __exit cleanup_l440gx(void)
145{ 145{
146 del_mtd_device(mymtd); 146 del_mtd_device(mymtd);
147 map_destroy(mymtd); 147 map_destroy(mymtd);
148 148
149 iounmap(l440gx_map.virt); 149 iounmap(l440gx_map.virt);
150} 150}
151 151
diff --git a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c
index 2337e0c4675..1aa0447c5e6 100644
--- a/drivers/mtd/maps/lubbock-flash.c
+++ b/drivers/mtd/maps/lubbock-flash.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * $Id: lubbock-flash.c,v 1.19 2004/11/04 13:24:15 gleixner Exp $ 2 * $Id: lubbock-flash.c,v 1.21 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * Map driver for the Lubbock developer platform. 4 * Map driver for the Lubbock developer platform.
5 * 5 *
6 * Author: Nicolas Pitre 6 * Author: Nicolas Pitre
7 * Copyright: (C) 2001 MontaVista Software Inc. 7 * Copyright: (C) 2001 MontaVista Software Inc.
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
@@ -76,7 +76,7 @@ static int __init init_lubbock(void)
76 int flashboot = (LUB_CONF_SWITCHES & 1); 76 int flashboot = (LUB_CONF_SWITCHES & 1);
77 int ret = 0, i; 77 int ret = 0, i;
78 78
79 lubbock_maps[0].bankwidth = lubbock_maps[1].bankwidth = 79 lubbock_maps[0].bankwidth = lubbock_maps[1].bankwidth =
80 (BOOT_DEF & 1) ? 2 : 4; 80 (BOOT_DEF & 1) ? 2 : 4;
81 81
82 /* Compensate for the nROMBT switch which swaps the flash banks */ 82 /* Compensate for the nROMBT switch which swaps the flash banks */
@@ -100,11 +100,11 @@ static int __init init_lubbock(void)
100 simple_map_init(&lubbock_maps[i]); 100 simple_map_init(&lubbock_maps[i]);
101 101
102 printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit bankwidth)\n", 102 printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit bankwidth)\n",
103 lubbock_maps[i].name, lubbock_maps[i].phys, 103 lubbock_maps[i].name, lubbock_maps[i].phys,
104 lubbock_maps[i].bankwidth * 8); 104 lubbock_maps[i].bankwidth * 8);
105 105
106 mymtds[i] = do_map_probe("cfi_probe", &lubbock_maps[i]); 106 mymtds[i] = do_map_probe("cfi_probe", &lubbock_maps[i]);
107 107
108 if (!mymtds[i]) { 108 if (!mymtds[i]) {
109 iounmap((void *)lubbock_maps[i].virt); 109 iounmap((void *)lubbock_maps[i].virt);
110 if (lubbock_maps[i].cached) 110 if (lubbock_maps[i].cached)
@@ -124,7 +124,7 @@ static int __init init_lubbock(void)
124 124
125 if (!mymtds[0] && !mymtds[1]) 125 if (!mymtds[0] && !mymtds[1])
126 return ret; 126 return ret;
127 127
128 for (i = 0; i < 2; i++) { 128 for (i = 0; i < 2; i++) {
129 if (!mymtds[i]) { 129 if (!mymtds[i]) {
130 printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name); 130 printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name);
@@ -151,15 +151,14 @@ static void __exit cleanup_lubbock(void)
151 if (nr_parsed_parts[i] || !i) 151 if (nr_parsed_parts[i] || !i)
152 del_mtd_partitions(mymtds[i]); 152 del_mtd_partitions(mymtds[i]);
153 else 153 else
154 del_mtd_device(mymtds[i]); 154 del_mtd_device(mymtds[i]);
155 155
156 map_destroy(mymtds[i]); 156 map_destroy(mymtds[i]);
157 iounmap((void *)lubbock_maps[i].virt); 157 iounmap((void *)lubbock_maps[i].virt);
158 if (lubbock_maps[i].cached) 158 if (lubbock_maps[i].cached)
159 iounmap(lubbock_maps[i].cached); 159 iounmap(lubbock_maps[i].cached);
160 160
161 if (parsed_parts[i]) 161 kfree(parsed_parts[i]);
162 kfree(parsed_parts[i]);
163 } 162 }
164} 163}
165 164
diff --git a/drivers/mtd/maps/mainstone-flash.c b/drivers/mtd/maps/mainstone-flash.c
index da0f8a69262..eaa4bbb868a 100644
--- a/drivers/mtd/maps/mainstone-flash.c
+++ b/drivers/mtd/maps/mainstone-flash.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Author: Nicolas Pitre 6 * Author: Nicolas Pitre
7 * Copyright: (C) 2001 MontaVista Software Inc. 7 * Copyright: (C) 2001 MontaVista Software Inc.
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
@@ -91,27 +91,27 @@ static int __init init_mainstone(void)
91 mainstone_maps[i].virt = ioremap(mainstone_maps[i].phys, 91 mainstone_maps[i].virt = ioremap(mainstone_maps[i].phys,
92 WINDOW_SIZE); 92 WINDOW_SIZE);
93 if (!mainstone_maps[i].virt) { 93 if (!mainstone_maps[i].virt) {
94 printk(KERN_WARNING "Failed to ioremap %s\n", 94 printk(KERN_WARNING "Failed to ioremap %s\n",
95 mainstone_maps[i].name); 95 mainstone_maps[i].name);
96 if (!ret) 96 if (!ret)
97 ret = -ENOMEM; 97 ret = -ENOMEM;
98 continue; 98 continue;
99 } 99 }
100 mainstone_maps[i].cached = 100 mainstone_maps[i].cached =
101 ioremap_cached(mainstone_maps[i].phys, WINDOW_SIZE); 101 ioremap_cached(mainstone_maps[i].phys, WINDOW_SIZE);
102 if (!mainstone_maps[i].cached) 102 if (!mainstone_maps[i].cached)
103 printk(KERN_WARNING "Failed to ioremap cached %s\n", 103 printk(KERN_WARNING "Failed to ioremap cached %s\n",
104 mainstone_maps[i].name); 104 mainstone_maps[i].name);
105 simple_map_init(&mainstone_maps[i]); 105 simple_map_init(&mainstone_maps[i]);
106 106
107 printk(KERN_NOTICE 107 printk(KERN_NOTICE
108 "Probing %s at physical address 0x%08lx" 108 "Probing %s at physical address 0x%08lx"
109 " (%d-bit bankwidth)\n", 109 " (%d-bit bankwidth)\n",
110 mainstone_maps[i].name, mainstone_maps[i].phys, 110 mainstone_maps[i].name, mainstone_maps[i].phys,
111 mainstone_maps[i].bankwidth * 8); 111 mainstone_maps[i].bankwidth * 8);
112 112
113 mymtds[i] = do_map_probe("cfi_probe", &mainstone_maps[i]); 113 mymtds[i] = do_map_probe("cfi_probe", &mainstone_maps[i]);
114 114
115 if (!mymtds[i]) { 115 if (!mymtds[i]) {
116 iounmap((void *)mainstone_maps[i].virt); 116 iounmap((void *)mainstone_maps[i].virt);
117 if (mainstone_maps[i].cached) 117 if (mainstone_maps[i].cached)
@@ -131,21 +131,21 @@ static int __init init_mainstone(void)
131 131
132 if (!mymtds[0] && !mymtds[1]) 132 if (!mymtds[0] && !mymtds[1])
133 return ret; 133 return ret;
134 134
135 for (i = 0; i < 2; i++) { 135 for (i = 0; i < 2; i++) {
136 if (!mymtds[i]) { 136 if (!mymtds[i]) {
137 printk(KERN_WARNING "%s is absent. Skipping\n", 137 printk(KERN_WARNING "%s is absent. Skipping\n",
138 mainstone_maps[i].name); 138 mainstone_maps[i].name);
139 } else if (nr_parsed_parts[i]) { 139 } else if (nr_parsed_parts[i]) {
140 add_mtd_partitions(mymtds[i], parsed_parts[i], 140 add_mtd_partitions(mymtds[i], parsed_parts[i],
141 nr_parsed_parts[i]); 141 nr_parsed_parts[i]);
142 } else if (!i) { 142 } else if (!i) {
143 printk("Using static partitions on %s\n", 143 printk("Using static partitions on %s\n",
144 mainstone_maps[i].name); 144 mainstone_maps[i].name);
145 add_mtd_partitions(mymtds[i], mainstone_partitions, 145 add_mtd_partitions(mymtds[i], mainstone_partitions,
146 ARRAY_SIZE(mainstone_partitions)); 146 ARRAY_SIZE(mainstone_partitions));
147 } else { 147 } else {
148 printk("Registering %s as whole device\n", 148 printk("Registering %s as whole device\n",
149 mainstone_maps[i].name); 149 mainstone_maps[i].name);
150 add_mtd_device(mymtds[i]); 150 add_mtd_device(mymtds[i]);
151 } 151 }
diff --git a/drivers/mtd/maps/mbx860.c b/drivers/mtd/maps/mbx860.c
index c5c6901a476..06b11872784 100644
--- a/drivers/mtd/maps/mbx860.c
+++ b/drivers/mtd/maps/mbx860.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * $Id: mbx860.c,v 1.8 2004/11/04 13:24:15 gleixner Exp $ 2 * $Id: mbx860.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * Handle mapping of the flash on MBX860 boards 4 * Handle mapping of the flash on MBX860 boards
5 * 5 *
6 * Author: Anton Todorov 6 * Author: Anton Todorov
7 * Copyright: (C) 2001 Emness Technology 7 * Copyright: (C) 2001 Emness Technology
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
@@ -46,7 +46,7 @@ static struct mtd_partition partition_info[]={
46 { .name = "MBX flash APPLICATION partition", 46 { .name = "MBX flash APPLICATION partition",
47 .offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 } 47 .offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
48}; 48};
49 49
50 50
51static struct mtd_info *mymtd; 51static struct mtd_info *mymtd;
52 52
diff --git a/drivers/mtd/maps/mtx-1_flash.c b/drivers/mtd/maps/mtx-1_flash.c
new file mode 100644
index 00000000000..d1e66e18674
--- /dev/null
+++ b/drivers/mtd/maps/mtx-1_flash.c
@@ -0,0 +1,96 @@
1/*
2 * Flash memory access on 4G Systems MTX-1 boards
3 *
4 * $Id: mtx-1_flash.c,v 1.2 2005/11/07 11:14:27 gleixner Exp $
5 *
6 * (C) 2005 Bruno Randolf <bruno.randolf@4g-systems.biz>
7 * (C) 2005 Jörn Engel <joern@wohnheim.fh-wedel.de>
8 *
9 */
10
11#include <linux/config.h>
12#include <linux/module.h>
13#include <linux/types.h>
14#include <linux/init.h>
15#include <linux/kernel.h>
16
17#include <linux/mtd/mtd.h>
18#include <linux/mtd/map.h>
19#include <linux/mtd/partitions.h>
20
21#include <asm/io.h>
22
23static struct map_info mtx1_map = {
24 .name = "MTX-1 flash",
25 .bankwidth = 4,
26 .size = 0x2000000,
27 .phys = 0x1E000000,
28};
29
30static struct mtd_partition mtx1_partitions[] = {
31 {
32 .name = "filesystem",
33 .size = 0x01C00000,
34 .offset = 0,
35 },{
36 .name = "yamon",
37 .size = 0x00100000,
38 .offset = MTDPART_OFS_APPEND,
39 .mask_flags = MTD_WRITEABLE,
40 },{
41 .name = "kernel",
42 .size = 0x002c0000,
43 .offset = MTDPART_OFS_APPEND,
44 },{
45 .name = "yamon env",
46 .size = 0x00040000,
47 .offset = MTDPART_OFS_APPEND,
48 }
49};
50
51static struct mtd_info *mtx1_mtd;
52
53int __init mtx1_mtd_init(void)
54{
55 int ret = -ENXIO;
56
57 simple_map_init(&mtx1_map);
58
59 mtx1_map.virt = ioremap(mtx1_map.phys, mtx1_map.size);
60 if (!mtx1_map.virt)
61 return -EIO;
62
63 mtx1_mtd = do_map_probe("cfi_probe", &mtx1_map);
64 if (!mtx1_mtd)
65 goto err;
66
67 mtx1_mtd->owner = THIS_MODULE;
68
69 ret = add_mtd_partitions(mtx1_mtd, mtx1_partitions,
70 ARRAY_SIZE(mtx1_partitions));
71 if (ret)
72 goto err;
73
74 return 0;
75
76err:
77 iounmap(mtx1_map.virt);
78 return ret;
79}
80
81static void __exit mtx1_mtd_cleanup(void)
82{
83 if (mtx1_mtd) {
84 del_mtd_partitions(mtx1_mtd);
85 map_destroy(mtx1_mtd);
86 }
87 if (mtx1_map.virt)
88 iounmap(mtx1_map.virt);
89}
90
91module_init(mtx1_mtd_init);
92module_exit(mtx1_mtd_cleanup);
93
94MODULE_AUTHOR("Bruno Randolf <bruno.randolf@4g-systems.biz>");
95MODULE_DESCRIPTION("MTX-1 flash map");
96MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/maps/netsc520.c b/drivers/mtd/maps/netsc520.c
index ab7e6358d28..33060a31572 100644
--- a/drivers/mtd/maps/netsc520.c
+++ b/drivers/mtd/maps/netsc520.c
@@ -3,7 +3,7 @@
3 * Copyright (C) 2001 Mark Langsdorf (mark.langsdorf@amd.com) 3 * Copyright (C) 2001 Mark Langsdorf (mark.langsdorf@amd.com)
4 * based on sc520cdp.c by Sysgo Real-Time Solutions GmbH 4 * based on sc520cdp.c by Sysgo Real-Time Solutions GmbH
5 * 5 *
6 * $Id: netsc520.c,v 1.13 2004/11/28 09:40:40 dwmw2 Exp $ 6 * $Id: netsc520.c,v 1.14 2005/11/07 11:14:27 gleixner Exp $
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@
38** The single, 16 megabyte flash bank is divided into four virtual 38** The single, 16 megabyte flash bank is divided into four virtual
39** partitions. The first partition is 768 KiB and is intended to 39** partitions. The first partition is 768 KiB and is intended to
40** store the kernel image loaded by the bootstrap loader. The second 40** store the kernel image loaded by the bootstrap loader. The second
41** partition is 256 KiB and holds the BIOS image. The third 41** partition is 256 KiB and holds the BIOS image. The third
42** partition is 14.5 MiB and is intended for the flash file system 42** partition is 14.5 MiB and is intended for the flash file system
43** image. The last partition is 512 KiB and contains another copy 43** image. The last partition is 512 KiB and contains another copy
44** of the BIOS image and the reset vector. 44** of the BIOS image and the reset vector.
@@ -51,28 +51,28 @@
51** recoverable afterwards. 51** recoverable afterwards.
52*/ 52*/
53 53
54/* partition_info gives details on the logical partitions that the split the 54/* partition_info gives details on the logical partitions that the split the
55 * single flash device into. If the size if zero we use up to the end of the 55 * single flash device into. If the size if zero we use up to the end of the
56 * device. */ 56 * device. */
57static struct mtd_partition partition_info[]={ 57static struct mtd_partition partition_info[]={
58 { 58 {
59 .name = "NetSc520 boot kernel", 59 .name = "NetSc520 boot kernel",
60 .offset = 0, 60 .offset = 0,
61 .size = 0xc0000 61 .size = 0xc0000
62 }, 62 },
63 { 63 {
64 .name = "NetSc520 Low BIOS", 64 .name = "NetSc520 Low BIOS",
65 .offset = 0xc0000, 65 .offset = 0xc0000,
66 .size = 0x40000 66 .size = 0x40000
67 }, 67 },
68 { 68 {
69 .name = "NetSc520 file system", 69 .name = "NetSc520 file system",
70 .offset = 0x100000, 70 .offset = 0x100000,
71 .size = 0xe80000 71 .size = 0xe80000
72 }, 72 },
73 { 73 {
74 .name = "NetSc520 High BIOS", 74 .name = "NetSc520 High BIOS",
75 .offset = 0xf80000, 75 .offset = 0xf80000,
76 .size = 0x80000 76 .size = 0x80000
77 }, 77 },
78}; 78};
@@ -114,7 +114,7 @@ static int __init init_netsc520(void)
114 iounmap(netsc520_map.virt); 114 iounmap(netsc520_map.virt);
115 return -ENXIO; 115 return -ENXIO;
116 } 116 }
117 117
118 mymtd->owner = THIS_MODULE; 118 mymtd->owner = THIS_MODULE;
119 add_mtd_partitions( mymtd, partition_info, NUM_PARTITIONS ); 119 add_mtd_partitions( mymtd, partition_info, NUM_PARTITIONS );
120 return 0; 120 return 0;
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c
index 61be5a4148c..f00ee7e54db 100644
--- a/drivers/mtd/maps/nettel.c
+++ b/drivers/mtd/maps/nettel.c
@@ -6,7 +6,7 @@
6 * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com)
7 * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) 7 * (C) Copyright 2001-2002, SnapGear (www.snapgear.com)
8 * 8 *
9 * $Id: nettel.c,v 1.10 2005/01/05 17:11:29 dwmw2 Exp $ 9 * $Id: nettel.c,v 1.11 2005/11/07 11:14:27 gleixner Exp $
10 */ 10 */
11 11
12/****************************************************************************/ 12/****************************************************************************/
@@ -143,7 +143,7 @@ static int nettel_reboot_notifier(struct notifier_block *nb, unsigned long val,
143{ 143{
144 struct cfi_private *cfi = nettel_intel_map.fldrv_priv; 144 struct cfi_private *cfi = nettel_intel_map.fldrv_priv;
145 unsigned long b; 145 unsigned long b;
146 146
147 /* Make sure all FLASH chips are put back into read mode */ 147 /* Make sure all FLASH chips are put back into read mode */
148 for (b = 0; (b < nettel_intel_partitions[3].size); b += 0x100000) { 148 for (b = 0; (b < nettel_intel_partitions[3].size); b += 0x100000) {
149 cfi_send_gen_cmd(0xff, 0x55, b, &nettel_intel_map, cfi, 149 cfi_send_gen_cmd(0xff, 0x55, b, &nettel_intel_map, cfi,
@@ -199,7 +199,7 @@ int nettel_eraseconfig(void)
199 199
200 schedule(); /* Wait for erase to finish. */ 200 schedule(); /* Wait for erase to finish. */
201 remove_wait_queue(&wait_q, &wait); 201 remove_wait_queue(&wait_q, &wait);
202 202
203 put_mtd_device(mtd); 203 put_mtd_device(mtd);
204 } 204 }
205 205
@@ -430,7 +430,7 @@ int __init nettel_init(void)
430 nettel_intel_partitions[1].size = (intel0size + intel1size) - 430 nettel_intel_partitions[1].size = (intel0size + intel1size) -
431 (1024*1024 + intel_mtd->erasesize); 431 (1024*1024 + intel_mtd->erasesize);
432 nettel_intel_partitions[3].size = intel0size + intel1size; 432 nettel_intel_partitions[3].size = intel0size + intel1size;
433 nettel_intel_partitions[4].offset = 433 nettel_intel_partitions[4].offset =
434 (intel0size + intel1size) - intel_mtd->erasesize; 434 (intel0size + intel1size) - intel_mtd->erasesize;
435 nettel_intel_partitions[4].size = intel_mtd->erasesize; 435 nettel_intel_partitions[4].size = intel_mtd->erasesize;
436 nettel_intel_partitions[5].offset = 436 nettel_intel_partitions[5].offset =
diff --git a/drivers/mtd/maps/ocelot.c b/drivers/mtd/maps/ocelot.c
index 82c3070678c..6977963d789 100644
--- a/drivers/mtd/maps/ocelot.c
+++ b/drivers/mtd/maps/ocelot.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ocelot.c,v 1.16 2005/01/05 18:05:13 dwmw2 Exp $ 2 * $Id: ocelot.c,v 1.17 2005/11/07 11:14:27 gleixner Exp $
3 * 3 *
4 * Flash on Momenco Ocelot 4 * Flash on Momenco Ocelot
5 */ 5 */
@@ -31,7 +31,7 @@ static void ocelot_ram_write(struct mtd_info *mtd, loff_t to, size_t len, size_t
31 struct map_info *map = mtd->priv; 31 struct map_info *map = mtd->priv;
32 size_t done = 0; 32 size_t done = 0;
33 33
34 /* If we use memcpy, it does word-wide writes. Even though we told the 34 /* If we use memcpy, it does word-wide writes. Even though we told the
35 GT64120A that it's an 8-bit wide region, word-wide writes don't work. 35 GT64120A that it's an 8-bit wide region, word-wide writes don't work.
36 We end up just writing the first byte of the four to all four bytes. 36 We end up just writing the first byte of the four to all four bytes.
37 So we have this loop instead */ 37 So we have this loop instead */
@@ -68,7 +68,7 @@ static int __init init_ocelot_maps(void)
68 int nr_parts; 68 int nr_parts;
69 unsigned char brd_status; 69 unsigned char brd_status;
70 70
71 printk(KERN_INFO "Momenco Ocelot MTD mappings: Flash 0x%x at 0x%x, NVRAM 0x%x at 0x%x\n", 71 printk(KERN_INFO "Momenco Ocelot MTD mappings: Flash 0x%x at 0x%x, NVRAM 0x%x at 0x%x\n",
72 FLASH_WINDOW_SIZE, FLASH_WINDOW_ADDR, NVRAM_WINDOW_SIZE, NVRAM_WINDOW_ADDR); 72 FLASH_WINDOW_SIZE, FLASH_WINDOW_ADDR, NVRAM_WINDOW_SIZE, NVRAM_WINDOW_ADDR);
73 73
74 /* First check whether the flash jumper is present */ 74 /* First check whether the flash jumper is present */
@@ -138,8 +138,8 @@ static int __init init_ocelot_maps(void)
138 add_mtd_device(flash_mtd); 138 add_mtd_device(flash_mtd);
139 139
140 return 0; 140 return 0;
141 141
142 fail3: 142 fail3:
143 iounmap((void *)ocelot_flash_map.virt); 143 iounmap((void *)ocelot_flash_map.virt);
144 if (ocelot_flash_map.cached) 144 if (ocelot_flash_map.cached)
145 iounmap((void *)ocelot_flash_map.cached); 145 iounmap((void *)ocelot_flash_map.cached);
diff --git a/drivers/mtd/maps/octagon-5066.c b/drivers/mtd/maps/octagon-5066.c
index e5ff83de420..a6642db3d32 100644
--- a/drivers/mtd/maps/octagon-5066.c
+++ b/drivers/mtd/maps/octagon-5066.c
@@ -1,12 +1,12 @@
1// $Id: octagon-5066.c,v 1.26 2004/07/12 22:38:29 dwmw2 Exp $ 1// $Id: octagon-5066.c,v 1.28 2005/11/07 11:14:27 gleixner Exp $
2/* ###################################################################### 2/* ######################################################################
3 3
4 Octagon 5066 MTD Driver. 4 Octagon 5066 MTD Driver.
5 5
6 The Octagon 5066 is a SBC based on AMD's 586-WB running at 133 MHZ. It 6 The Octagon 5066 is a SBC based on AMD's 586-WB running at 133 MHZ. It
7 comes with a builtin AMD 29F016 flash chip and a socketed EEPROM that 7 comes with a builtin AMD 29F016 flash chip and a socketed EEPROM that
8 is replacable by flash. Both units are mapped through a multiplexer 8 is replacable by flash. Both units are mapped through a multiplexer
9 into a 32k memory window at 0xe8000. The control register for the 9 into a 32k memory window at 0xe8000. The control register for the
10 multiplexing unit is located at IO 0x208 with a bit map of 10 multiplexing unit is located at IO 0x208 with a bit map of
11 0-5 Page Selection in 32k increments 11 0-5 Page Selection in 32k increments
12 6-7 Device selection: 12 6-7 Device selection:
@@ -14,14 +14,14 @@
14 01 SSD 0 (Socket) 14 01 SSD 0 (Socket)
15 10 SSD 1 (Flash chip) 15 10 SSD 1 (Flash chip)
16 11 undefined 16 11 undefined
17 17
18 On each SSD, the first 128k is reserved for use by the bios 18 On each SSD, the first 128k is reserved for use by the bios
19 (actually it IS the bios..) This only matters if you are booting off the 19 (actually it IS the bios..) This only matters if you are booting off the
20 flash, you must not put a file system starting there. 20 flash, you must not put a file system starting there.
21 21
22 The driver tries to do a detection algorithm to guess what sort of devices 22 The driver tries to do a detection algorithm to guess what sort of devices
23 are plugged into the sockets. 23 are plugged into the sockets.
24 24
25 ##################################################################### */ 25 ##################################################################### */
26 26
27#include <linux/module.h> 27#include <linux/module.h>
@@ -56,7 +56,7 @@ static void __oct5066_page(struct map_info *map, __u8 byte)
56static inline void oct5066_page(struct map_info *map, unsigned long ofs) 56static inline void oct5066_page(struct map_info *map, unsigned long ofs)
57{ 57{
58 __u8 byte = map->map_priv_1 | (ofs >> WINDOW_SHIFT); 58 __u8 byte = map->map_priv_1 | (ofs >> WINDOW_SHIFT);
59 59
60 if (page_n_dev != byte) 60 if (page_n_dev != byte)
61 __oct5066_page(map, byte); 61 __oct5066_page(map, byte);
62} 62}
@@ -78,7 +78,7 @@ static void oct5066_copy_from(struct map_info *map, void *to, unsigned long from
78 unsigned long thislen = len; 78 unsigned long thislen = len;
79 if (len > (WINDOW_LENGTH - (from & WINDOW_MASK))) 79 if (len > (WINDOW_LENGTH - (from & WINDOW_MASK)))
80 thislen = WINDOW_LENGTH-(from & WINDOW_MASK); 80 thislen = WINDOW_LENGTH-(from & WINDOW_MASK);
81 81
82 spin_lock(&oct5066_spin); 82 spin_lock(&oct5066_spin);
83 oct5066_page(map, from); 83 oct5066_page(map, from);
84 memcpy_fromio(to, iomapadr + from, thislen); 84 memcpy_fromio(to, iomapadr + from, thislen);
@@ -103,7 +103,7 @@ static void oct5066_copy_to(struct map_info *map, unsigned long to, const void *
103 unsigned long thislen = len; 103 unsigned long thislen = len;
104 if (len > (WINDOW_LENGTH - (to & WINDOW_MASK))) 104 if (len > (WINDOW_LENGTH - (to & WINDOW_MASK)))
105 thislen = WINDOW_LENGTH-(to & WINDOW_MASK); 105 thislen = WINDOW_LENGTH-(to & WINDOW_MASK);
106 106
107 spin_lock(&oct5066_spin); 107 spin_lock(&oct5066_spin);
108 oct5066_page(map, to); 108 oct5066_page(map, to);
109 memcpy_toio(iomapadr + to, from, thislen); 109 memcpy_toio(iomapadr + to, from, thislen);
@@ -144,7 +144,7 @@ static struct mtd_info *oct5066_mtd[2] = {NULL, NULL};
144// OctProbe - Sense if this is an octagon card 144// OctProbe - Sense if this is an octagon card
145// --------------------------------------------------------------------- 145// ---------------------------------------------------------------------
146/* Perform a simple validity test, we map the window select SSD0 and 146/* Perform a simple validity test, we map the window select SSD0 and
147 change pages while monitoring the window. A change in the window, 147 change pages while monitoring the window. A change in the window,
148 controlled by the PAGE_IO port is a functioning 5066 board. This will 148 controlled by the PAGE_IO port is a functioning 5066 board. This will
149 fail if the thing in the socket is set to a uniform value. */ 149 fail if the thing in the socket is set to a uniform value. */
150static int __init OctProbe(void) 150static int __init OctProbe(void)
@@ -161,13 +161,13 @@ static int __init OctProbe(void)
161 Values[I%10] = readl(iomapadr); 161 Values[I%10] = readl(iomapadr);
162 if (I > 0 && Values[I%10] == Values[0]) 162 if (I > 0 && Values[I%10] == Values[0])
163 return -EAGAIN; 163 return -EAGAIN;
164 } 164 }
165 else 165 else
166 { 166 {
167 // Make sure we get the same values on the second pass 167 // Make sure we get the same values on the second pass
168 if (Values[I%10] != readl(iomapadr)) 168 if (Values[I%10] != readl(iomapadr))
169 return -EAGAIN; 169 return -EAGAIN;
170 } 170 }
171 } 171 }
172 return 0; 172 return 0;
173} 173}
@@ -207,11 +207,11 @@ int __init init_oct5066(void)
207 ret = -EAGAIN; 207 ret = -EAGAIN;
208 goto out_unmap; 208 goto out_unmap;
209 } 209 }
210 210
211 // Print out our little header.. 211 // Print out our little header..
212 printk("Octagon 5066 SSD IO:0x%x MEM:0x%x-0x%x\n",PAGE_IO,WINDOW_START, 212 printk("Octagon 5066 SSD IO:0x%x MEM:0x%x-0x%x\n",PAGE_IO,WINDOW_START,
213 WINDOW_START+WINDOW_LENGTH); 213 WINDOW_START+WINDOW_LENGTH);
214 214
215 for (i=0; i<2; i++) { 215 for (i=0; i<2; i++) {
216 oct5066_mtd[i] = do_map_probe("cfi_probe", &oct5066_map[i]); 216 oct5066_mtd[i] = do_map_probe("cfi_probe", &oct5066_map[i]);
217 if (!oct5066_mtd[i]) 217 if (!oct5066_mtd[i])
@@ -225,11 +225,11 @@ int __init init_oct5066(void)
225 add_mtd_device(oct5066_mtd[i]); 225 add_mtd_device(oct5066_mtd[i]);
226 } 226 }
227 } 227 }
228 228
229 if (!oct5066_mtd[0] && !oct5066_mtd[1]) { 229 if (!oct5066_mtd[0] && !oct5066_mtd[1]) {
230 cleanup_oct5066(); 230 cleanup_oct5066();
231 return -ENXIO; 231 return -ENXIO;
232 } 232 }
233 233
234 return 0; 234 return 0;
235 235
diff --git a/drivers/mtd/maps/omap-toto-flash.c b/drivers/mtd/maps/omap-toto-flash.c
index da36e8dddd1..dc376527005 100644
--- a/drivers/mtd/maps/omap-toto-flash.c
+++ b/drivers/mtd/maps/omap-toto-flash.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * (C) 2002 MontVista Software, Inc. 6 * (C) 2002 MontVista Software, Inc.
7 * 7 *
8 * $Id: omap-toto-flash.c,v 1.3 2004/09/16 23:27:13 gleixner Exp $ 8 * $Id: omap-toto-flash.c,v 1.5 2005/11/07 11:14:27 gleixner Exp $
9 */ 9 */
10 10
11#include <linux/config.h> 11#include <linux/config.h>
@@ -38,7 +38,7 @@ static struct map_info omap_toto_map_flash = {
38 .virt = (void __iomem *)OMAP_TOTO_FLASH_BASE, 38 .virt = (void __iomem *)OMAP_TOTO_FLASH_BASE,
39}; 39};
40 40
41 41
42static struct mtd_partition toto_flash_partitions[] = { 42static struct mtd_partition toto_flash_partitions[] = {
43 { 43 {
44 .name = "BootLoader", 44 .name = "BootLoader",
@@ -54,21 +54,21 @@ static struct mtd_partition toto_flash_partitions[] = {
54 .name = "EnvArea", /* bottom 64KiB for env vars */ 54 .name = "EnvArea", /* bottom 64KiB for env vars */
55 .size = MTDPART_SIZ_FULL, 55 .size = MTDPART_SIZ_FULL,
56 .offset = MTDPART_OFS_APPEND, 56 .offset = MTDPART_OFS_APPEND,
57 } 57 }
58}; 58};
59 59
60static struct mtd_partition *parsed_parts; 60static struct mtd_partition *parsed_parts;
61 61
62static struct mtd_info *flash_mtd; 62static struct mtd_info *flash_mtd;
63 63
64static int __init init_flash (void) 64static int __init init_flash (void)
65{ 65{
66 66
67 struct mtd_partition *parts; 67 struct mtd_partition *parts;
68 int nb_parts = 0; 68 int nb_parts = 0;
69 int parsed_nr_parts = 0; 69 int parsed_nr_parts = 0;
70 const char *part_type; 70 const char *part_type;
71 71
72 /* 72 /*
73 * Static partition definition selection 73 * Static partition definition selection
74 */ 74 */
@@ -89,7 +89,7 @@ static int __init init_flash (void)
89 flash_mtd = do_map_probe("jedec_probe", &omap_toto_map_flash); 89 flash_mtd = do_map_probe("jedec_probe", &omap_toto_map_flash);
90 if (!flash_mtd) 90 if (!flash_mtd)
91 return -ENXIO; 91 return -ENXIO;
92 92
93 if (parsed_nr_parts > 0) { 93 if (parsed_nr_parts > 0) {
94 parts = parsed_parts; 94 parts = parsed_parts;
95 nb_parts = parsed_nr_parts; 95 nb_parts = parsed_nr_parts;
@@ -108,8 +108,8 @@ static int __init init_flash (void)
108 } 108 }
109 return 0; 109 return 0;
110} 110}
111 111
112int __init omap_toto_mtd_init(void) 112int __init omap_toto_mtd_init(void)
113{ 113{
114 int status; 114 int status;
115 115
@@ -119,13 +119,12 @@ int __init omap_toto_mtd_init(void)
119 return status; 119 return status;
120} 120}
121 121
122static void __exit omap_toto_mtd_cleanup(void) 122static void __exit omap_toto_mtd_cleanup(void)
123{ 123{
124 if (flash_mtd) { 124 if (flash_mtd) {
125 del_mtd_partitions(flash_mtd); 125 del_mtd_partitions(flash_mtd);
126 map_destroy(flash_mtd); 126 map_destroy(flash_mtd);
127 if (parsed_parts) 127 kfree(parsed_parts);
128 kfree(parsed_parts);
129 } 128 }
130} 129}
131 130
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index 7f370bb794f..fd3b4a5fc20 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc. 4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Copyright (C) 2003-2004 Texas Instruments 5 * Copyright (C) 2003-2004 Texas Instruments
6 * Copyright (C) 2004 Nokia Corporation 6 * Copyright (C) 2004 Nokia Corporation
7 * 7 *
8 * Assembled using driver code copyright the companies above 8 * Assembled using driver code copyright the companies above
9 * and written by David Brownell, Jian Zhang <jzhang@ti.com>, 9 * and written by David Brownell, Jian Zhang <jzhang@ti.com>,
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c
index d9c64e99ee3..8b3570b0909 100644
--- a/drivers/mtd/maps/pci.c
+++ b/drivers/mtd/maps/pci.c
@@ -7,8 +7,8 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 * 9 *
10 * $Id: pci.c,v 1.10 2005/03/18 14:04:35 gleixner Exp $ 10 * $Id: pci.c,v 1.13 2005/11/07 11:14:27 gleixner Exp $
11 * 11 *
12 * Generic PCI memory map driver. We support the following boards: 12 * Generic PCI memory map driver. We support the following boards:
13 * - Intel IQ80310 ATU. 13 * - Intel IQ80310 ATU.
14 * - Intel EBSA285 (blank rom programming mode). Tested working 27/09/2001 14 * - Intel EBSA285 (blank rom programming mode). Tested working 27/09/2001
@@ -38,7 +38,7 @@ struct map_pci_info {
38 void (*exit)(struct pci_dev *dev, struct map_pci_info *map); 38 void (*exit)(struct pci_dev *dev, struct map_pci_info *map);
39 unsigned long (*translate)(struct map_pci_info *map, unsigned long ofs); 39 unsigned long (*translate)(struct map_pci_info *map, unsigned long ofs);
40 struct pci_dev *dev; 40 struct pci_dev *dev;
41}; 41};
42 42
43static map_word mtd_pci_read8(struct map_info *_map, unsigned long ofs) 43static map_word mtd_pci_read8(struct map_info *_map, unsigned long ofs)
44{ 44{
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index ff7c50d1018..af24216a062 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: pcmciamtd.c,v 1.51 2004/07/12 22:38:29 dwmw2 Exp $ 2 * $Id: pcmciamtd.c,v 1.55 2005/11/07 11:14:28 gleixner Exp $
3 * 3 *
4 * pcmciamtd.c - MTD driver for PCMCIA flash memory cards 4 * pcmciamtd.c - MTD driver for PCMCIA flash memory cards
5 * 5 *
@@ -48,7 +48,7 @@ static const int debug = 0;
48 48
49 49
50#define DRIVER_DESC "PCMCIA Flash memory card driver" 50#define DRIVER_DESC "PCMCIA Flash memory card driver"
51#define DRIVER_VERSION "$Revision: 1.51 $" 51#define DRIVER_VERSION "$Revision: 1.55 $"
52 52
53/* Size of the PCMCIA address space: 26 bits = 64 MB */ 53/* Size of the PCMCIA address space: 26 bits = 64 MB */
54#define MAX_PCMCIA_ADDR 0x4000000 54#define MAX_PCMCIA_ADDR 0x4000000
@@ -176,7 +176,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long
176 176
177 if(toread > len) 177 if(toread > len)
178 toread = len; 178 toread = len;
179 179
180 addr = remap_window(map, from); 180 addr = remap_window(map, from);
181 if(!addr) 181 if(!addr)
182 return; 182 return;
@@ -386,7 +386,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
386 cs_error(link->handle, ParseTuple, rc); 386 cs_error(link->handle, ParseTuple, rc);
387 break; 387 break;
388 } 388 }
389 389
390 switch(tuple.TupleCode) { 390 switch(tuple.TupleCode) {
391 case CISTPL_FORMAT: { 391 case CISTPL_FORMAT: {
392 cistpl_format_t *t = &parse.format; 392 cistpl_format_t *t = &parse.format;
@@ -394,9 +394,9 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
394 DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", 394 DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u",
395 t->type, t->edc, t->offset, t->length); 395 t->type, t->edc, t->offset, t->length);
396 break; 396 break;
397 397
398 } 398 }
399 399
400 case CISTPL_DEVICE: { 400 case CISTPL_DEVICE: {
401 cistpl_device_t *t = &parse.device; 401 cistpl_device_t *t = &parse.device;
402 int i; 402 int i;
@@ -410,7 +410,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
410 } 410 }
411 break; 411 break;
412 } 412 }
413 413
414 case CISTPL_VERS_1: { 414 case CISTPL_VERS_1: {
415 cistpl_vers_1_t *t = &parse.version_1; 415 cistpl_vers_1_t *t = &parse.version_1;
416 int i; 416 int i;
@@ -425,7 +425,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
425 DEBUG(2, "Found name: %s", dev->mtd_name); 425 DEBUG(2, "Found name: %s", dev->mtd_name);
426 break; 426 break;
427 } 427 }
428 428
429 case CISTPL_JEDEC_C: { 429 case CISTPL_JEDEC_C: {
430 cistpl_jedec_t *t = &parse.jedec; 430 cistpl_jedec_t *t = &parse.jedec;
431 int i; 431 int i;
@@ -434,7 +434,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
434 } 434 }
435 break; 435 break;
436 } 436 }
437 437
438 case CISTPL_DEVICE_GEO: { 438 case CISTPL_DEVICE_GEO: {
439 cistpl_device_geo_t *t = &parse.device_geo; 439 cistpl_device_geo_t *t = &parse.device_geo;
440 int i; 440 int i;
@@ -449,11 +449,11 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
449 } 449 }
450 break; 450 break;
451 } 451 }
452 452
453 default: 453 default:
454 DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); 454 DEBUG(2, "Unknown tuple code %d", tuple.TupleCode);
455 } 455 }
456 456
457 rc = pcmcia_get_next_tuple(link->handle, &tuple); 457 rc = pcmcia_get_next_tuple(link->handle, &tuple);
458 } 458 }
459 if(!dev->pcmcia_map.size) 459 if(!dev->pcmcia_map.size)
@@ -470,7 +470,7 @@ static void card_settings(struct pcmciamtd_dev *dev, dev_link_t *link, int *new_
470 if(bankwidth) { 470 if(bankwidth) {
471 dev->pcmcia_map.bankwidth = bankwidth; 471 dev->pcmcia_map.bankwidth = bankwidth;
472 DEBUG(2, "bankwidth forced to %d", bankwidth); 472 DEBUG(2, "bankwidth forced to %d", bankwidth);
473 } 473 }
474 474
475 dev->pcmcia_map.name = dev->mtd_name; 475 dev->pcmcia_map.name = dev->mtd_name;
476 if(!dev->mtd_name[0]) { 476 if(!dev->mtd_name[0]) {
@@ -568,7 +568,7 @@ static void pcmciamtd_config(dev_link_t *link)
568 return; 568 return;
569 } 569 }
570 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); 570 DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10);
571 571
572 /* Get write protect status */ 572 /* Get write protect status */
573 CS_CHECK(GetStatus, pcmcia_get_status(link->handle, &status)); 573 CS_CHECK(GetStatus, pcmcia_get_status(link->handle, &status));
574 DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", 574 DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx",
@@ -624,11 +624,11 @@ static void pcmciamtd_config(dev_link_t *link)
624 mtd = do_map_probe(probes[i], &dev->pcmcia_map); 624 mtd = do_map_probe(probes[i], &dev->pcmcia_map);
625 if(mtd) 625 if(mtd)
626 break; 626 break;
627 627
628 DEBUG(1, "FAILED: %s", probes[i]); 628 DEBUG(1, "FAILED: %s", probes[i]);
629 } 629 }
630 } 630 }
631 631
632 if(!mtd) { 632 if(!mtd) {
633 DEBUG(1, "Cant find an MTD"); 633 DEBUG(1, "Cant find an MTD");
634 pcmciamtd_release(link); 634 pcmciamtd_release(link);
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index b853670bfb8..9ee760f97bc 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: physmap.c,v 1.37 2004/11/28 09:40:40 dwmw2 Exp $ 2 * $Id: physmap.c,v 1.38 2005/11/07 11:14:28 gleixner Exp $
3 * 3 *
4 * Normal mappings of chips in physical memory 4 * Normal mappings of chips in physical memory
5 * 5 *
@@ -69,7 +69,7 @@ static int __init init_physmap(void)
69 mymtd->owner = THIS_MODULE; 69 mymtd->owner = THIS_MODULE;
70 70
71#ifdef CONFIG_MTD_PARTITIONS 71#ifdef CONFIG_MTD_PARTITIONS
72 mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes, 72 mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes,
73 &mtd_parts, 0); 73 &mtd_parts, 0);
74 74
75 if (mtd_parts_nb > 0) 75 if (mtd_parts_nb > 0)
@@ -78,9 +78,9 @@ static int __init init_physmap(void)
78 return 0; 78 return 0;
79 } 79 }
80 80
81 if (num_physmap_partitions != 0) 81 if (num_physmap_partitions != 0)
82 { 82 {
83 printk(KERN_NOTICE 83 printk(KERN_NOTICE
84 "Using physmap partition definition\n"); 84 "Using physmap partition definition\n");
85 add_mtd_partitions (mymtd, physmap_partitions, num_physmap_partitions); 85 add_mtd_partitions (mymtd, physmap_partitions, num_physmap_partitions);
86 return 0; 86 return 0;
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index 104576b5be3..a02eed94a23 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Generic platfrom device based RAM map 7 * Generic platfrom device based RAM map
8 * 8 *
9 * $Id: plat-ram.c,v 1.3 2005/03/19 22:41:27 gleixner Exp $ 9 * $Id: plat-ram.c,v 1.7 2005/11/07 11:14:28 gleixner Exp $
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -91,7 +91,7 @@ static int platram_remove(struct device *dev)
91 91
92 dev_dbg(dev, "removing device\n"); 92 dev_dbg(dev, "removing device\n");
93 93
94 if (info == NULL) 94 if (info == NULL)
95 return 0; 95 return 0;
96 96
97 if (info->mtd) { 97 if (info->mtd) {
@@ -118,7 +118,7 @@ static int platram_remove(struct device *dev)
118 118
119 if (info->map.virt != NULL) 119 if (info->map.virt != NULL)
120 iounmap(info->map.virt); 120 iounmap(info->map.virt);
121 121
122 kfree(info); 122 kfree(info);
123 123
124 return 0; 124 return 0;
@@ -139,7 +139,7 @@ static int platram_probe(struct device *dev)
139 int err = 0; 139 int err = 0;
140 140
141 dev_dbg(dev, "probe entered\n"); 141 dev_dbg(dev, "probe entered\n");
142 142
143 if (dev->platform_data == NULL) { 143 if (dev->platform_data == NULL) {
144 dev_err(dev, "no platform data supplied\n"); 144 dev_err(dev, "no platform data supplied\n");
145 err = -ENOENT; 145 err = -ENOENT;
@@ -177,7 +177,7 @@ static int platram_probe(struct device *dev)
177 177
178 info->map.phys = res->start; 178 info->map.phys = res->start;
179 info->map.size = (res->end - res->start) + 1; 179 info->map.size = (res->end - res->start) + 1;
180 info->map.name = pdata->mapname != NULL ? pdata->mapname : pd->name; 180 info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name;
181 info->map.bankwidth = pdata->bankwidth; 181 info->map.bankwidth = pdata->bankwidth;
182 182
183 /* register our usage of the memory area */ 183 /* register our usage of the memory area */
@@ -240,7 +240,7 @@ static int platram_probe(struct device *dev)
240 dev_err(dev, "add_mtd_device() failed\n"); 240 dev_err(dev, "add_mtd_device() failed\n");
241 err = -ENOMEM; 241 err = -ENOMEM;
242 } 242 }
243 243
244 dev_info(dev, "registered mtd device\n"); 244 dev_info(dev, "registered mtd device\n");
245 return err; 245 return err;
246 246
@@ -254,6 +254,7 @@ static int platram_probe(struct device *dev)
254 254
255static struct device_driver platram_driver = { 255static struct device_driver platram_driver = {
256 .name = "mtd-ram", 256 .name = "mtd-ram",
257 .owner = THIS_MODULE,
257 .bus = &platform_bus_type, 258 .bus = &platform_bus_type,
258 .probe = platram_probe, 259 .probe = platram_probe,
259 .remove = platram_remove, 260 .remove = platram_remove,
diff --git a/drivers/mtd/maps/pnc2000.c b/drivers/mtd/maps/pnc2000.c
index a0f43dad898..d7e16c2d5c4 100644
--- a/drivers/mtd/maps/pnc2000.c
+++ b/drivers/mtd/maps/pnc2000.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 * 7 *
8 * $Id: pnc2000.c,v 1.17 2004/11/16 18:29:02 dwmw2 Exp $ 8 * $Id: pnc2000.c,v 1.18 2005/11/07 11:14:28 gleixner Exp $
9 */ 9 */
10 10
11#include <linux/module.h> 11#include <linux/module.h>
@@ -21,7 +21,7 @@
21#define WINDOW_ADDR 0xbf000000 21#define WINDOW_ADDR 0xbf000000
22#define WINDOW_SIZE 0x00400000 22#define WINDOW_SIZE 0x00400000
23 23
24/* 24/*
25 * MAP DRIVER STUFF 25 * MAP DRIVER STUFF
26 */ 26 */
27 27
@@ -36,7 +36,7 @@ static struct map_info pnc_map = {
36 36
37 37
38/* 38/*
39 * MTD 'PARTITIONING' STUFF 39 * MTD 'PARTITIONING' STUFF
40 */ 40 */
41static struct mtd_partition pnc_partitions[3] = { 41static struct mtd_partition pnc_partitions[3] = {
42 { 42 {
@@ -56,7 +56,7 @@ static struct mtd_partition pnc_partitions[3] = {
56 } 56 }
57}; 57};
58 58
59/* 59/*
60 * This is the master MTD device for which all the others are just 60 * This is the master MTD device for which all the others are just
61 * auto-relocating aliases. 61 * auto-relocating aliases.
62 */ 62 */
diff --git a/drivers/mtd/maps/pq2fads.c b/drivers/mtd/maps/pq2fads.c
new file mode 100644
index 00000000000..fb78d87cc13
--- /dev/null
+++ b/drivers/mtd/maps/pq2fads.c
@@ -0,0 +1,88 @@
1/*
2 * drivers/mtd/maps/pq2fads.c
3 *
4 * Mapping for the flash SIMM on 8272ADS and PQ2FADS board
5 *
6 * Author: Vitaly Bordug <vbordug@ru.mvista.com>
7 *
8 * 2005 (c) MontaVista Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 */
13
14#include <linux/module.h>
15#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <asm/io.h>
19#include <asm/ppcboot.h>
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/partitions.h>
23#include <linux/mtd/physmap.h>
24
25/*
26 NOTE: bank width and interleave relative to the installed flash
27 should have been chosen within MTD_CFI_GEOMETRY options.
28 */
29#define PQ2FADS_BANK_WIDTH 4
30
31static struct mtd_partition pq2fads_partitions[] = {
32 {
33#ifdef CONFIG_ADS8272
34 .name = "HRCW",
35 .size = 0x40000,
36 .offset = 0,
37 .mask_flags = MTD_WRITEABLE, /* force read-only */
38 }, {
39 .name = "User FS",
40 .size = 0x5c0000,
41 .offset = 0x40000,
42#else
43 .name = "User FS",
44 .size = 0x600000,
45 .offset = 0,
46#endif
47 }, {
48 .name = "uImage",
49 .size = 0x100000,
50 .offset = 0x600000,
51 .mask_flags = MTD_WRITEABLE, /* force read-only */
52 }, {
53 .name = "bootloader",
54 .size = 0x40000,
55 .offset = 0x700000,
56 .mask_flags = MTD_WRITEABLE, /* force read-only */
57 }, {
58 .name = "bootloader env",
59 .size = 0x40000,
60 .offset = 0x740000,
61 .mask_flags = MTD_WRITEABLE, /* force read-only */
62 }
63};
64
65
66/* pointer to MPC885ADS board info data */
67extern unsigned char __res[];
68
69static int __init init_pq2fads_mtd(void)
70{
71 bd_t *bd = (bd_t *)__res;
72 physmap_configure(bd->bi_flashstart, bd->bi_flashsize, PQ2FADS_BANK_WIDTH, NULL);
73
74 physmap_set_partitions(pq2fads_partitions,
75 sizeof (pq2fads_partitions) /
76 sizeof (pq2fads_partitions[0]));
77 return 0;
78}
79
80static void __exit cleanup_pq2fads_mtd(void)
81{
82}
83
84module_init(init_pq2fads_mtd);
85module_exit(cleanup_pq2fads_mtd);
86
87MODULE_LICENSE("GPL");
88MODULE_DESCRIPTION("MTD map and partitions for MPC8272ADS boards");
diff --git a/drivers/mtd/maps/redwood.c b/drivers/mtd/maps/redwood.c
index edd01ee4f90..5b76ed88618 100644
--- a/drivers/mtd/maps/redwood.c
+++ b/drivers/mtd/maps/redwood.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: redwood.c,v 1.10 2004/11/04 13:24:15 gleixner Exp $ 2 * $Id: redwood.c,v 1.11 2005/11/07 11:14:28 gleixner Exp $
3 * 3 *
4 * drivers/mtd/maps/redwood.c 4 * drivers/mtd/maps/redwood.c
5 * 5 *
@@ -79,7 +79,7 @@ static struct mtd_partition redwood_flash_partitions[] = {
79 79
80#define RW_PART0_OF 0 80#define RW_PART0_OF 0
81#define RW_PART0_SZ 0x400000 /* 4 MiB data */ 81#define RW_PART0_SZ 0x400000 /* 4 MiB data */
82#define RW_PART1_OF RW_PART0_OF + RW_PART0_SZ 82#define RW_PART1_OF RW_PART0_OF + RW_PART0_SZ
83#define RW_PART1_SZ 0x10000 /* 64K VPD */ 83#define RW_PART1_SZ 0x10000 /* 64K VPD */
84#define RW_PART2_OF RW_PART1_OF + RW_PART1_SZ 84#define RW_PART2_OF RW_PART1_OF + RW_PART1_SZ
85#define RW_PART2_SZ 0x400000 - (0x10000 + 0x20000) 85#define RW_PART2_SZ 0x400000 - (0x10000 + 0x20000)
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index c8d0da19d89..9e8bb1782be 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * Flash memory access on SA11x0 based devices 2 * Flash memory access on SA11x0 based devices
3 * 3 *
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@cam.org>
5 * 5 *
6 * $Id: sa1100-flash.c,v 1.47 2004/11/01 13:44:36 rmk Exp $ 6 * $Id: sa1100-flash.c,v 1.51 2005/11/07 11:14:28 gleixner Exp $
7 */ 7 */
8#include <linux/config.h> 8#include <linux/config.h>
9#include <linux/module.h> 9#include <linux/module.h>
@@ -241,8 +241,7 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla
241#endif 241#endif
242 } 242 }
243 243
244 if (info->parts) 244 kfree(info->parts);
245 kfree(info->parts);
246 245
247 for (i = info->num_subdev - 1; i >= 0; i--) 246 for (i = info->num_subdev - 1; i >= 0; i--)
248 sa1100_destroy_subdev(&info->subdev[i]); 247 sa1100_destroy_subdev(&info->subdev[i]);
diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c
index da684d3384e..225cdd9ba5b 100644
--- a/drivers/mtd/maps/sbc8240.c
+++ b/drivers/mtd/maps/sbc8240.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * This code is GPLed 6 * This code is GPLed
7 * 7 *
8 * $Id: sbc8240.c,v 1.4 2004/07/12 22:38:29 dwmw2 Exp $ 8 * $Id: sbc8240.c,v 1.5 2005/11/07 11:14:28 gleixner Exp $
9 * 9 *
10 */ 10 */
11 11
@@ -205,7 +205,7 @@ int __init init_sbc8240_mtd (void)
205 } else { 205 } else {
206 printk (KERN_NOTICE MSG_PREFIX 206 printk (KERN_NOTICE MSG_PREFIX
207 "Using %s partition definition\n", sbc8240_part_banks[i].mtd_part->name); 207 "Using %s partition definition\n", sbc8240_part_banks[i].mtd_part->name);
208 add_mtd_partitions (sbc8240_mtd[i], 208 add_mtd_partitions (sbc8240_mtd[i],
209 sbc8240_part_banks[i].mtd_part, 209 sbc8240_part_banks[i].mtd_part,
210 sbc8240_part_banks[i].nums); 210 sbc8240_part_banks[i].nums);
211 } 211 }
diff --git a/drivers/mtd/maps/sbc_gxx.c b/drivers/mtd/maps/sbc_gxx.c
index 65add28bde1..7cc4041d096 100644
--- a/drivers/mtd/maps/sbc_gxx.c
+++ b/drivers/mtd/maps/sbc_gxx.c
@@ -1,35 +1,35 @@
1/* sbc_gxx.c -- MTD map driver for Arcom Control Systems SBC-MediaGX, 1/* sbc_gxx.c -- MTD map driver for Arcom Control Systems SBC-MediaGX,
2 SBC-GXm and SBC-GX1 series boards. 2 SBC-GXm and SBC-GX1 series boards.
3 3
4 Copyright (C) 2001 Arcom Control System Ltd 4 Copyright (C) 2001 Arcom Control System Ltd
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 19
20 $Id: sbc_gxx.c,v 1.33 2004/11/28 09:40:40 dwmw2 Exp $ 20 $Id: sbc_gxx.c,v 1.35 2005/11/07 11:14:28 gleixner Exp $
21 21
22The SBC-MediaGX / SBC-GXx has up to 16 MiB of 22The SBC-MediaGX / SBC-GXx has up to 16 MiB of
23Intel StrataFlash (28F320/28F640) in x8 mode. 23Intel StrataFlash (28F320/28F640) in x8 mode.
24 24
25This driver uses the CFI probe and Intel Extended Command Set drivers. 25This driver uses the CFI probe and Intel Extended Command Set drivers.
26 26
27The flash is accessed as follows: 27The flash is accessed as follows:
28 28
29 16 KiB memory window at 0xdc000-0xdffff 29 16 KiB memory window at 0xdc000-0xdffff
30 30
31 Two IO address locations for paging 31 Two IO address locations for paging
32 32
33 0x258 33 0x258
34 bit 0-7: address bit 14-21 34 bit 0-7: address bit 14-21
35 0x259 35 0x259
@@ -37,7 +37,7 @@ The flash is accessed as follows:
37 bit 7: 0 - reset/powered down 37 bit 7: 0 - reset/powered down
38 1 - device enabled 38 1 - device enabled
39 39
40The single flash device is divided into 3 partition which appear as 40The single flash device is divided into 3 partition which appear as
41separate MTD devices. 41separate MTD devices.
42 42
4325/04/2001 AJL (Arcom) Modified signon strings and partition sizes 4325/04/2001 AJL (Arcom) Modified signon strings and partition sizes
@@ -87,17 +87,17 @@ static volatile int page_in_window = -1; // Current page in window.
87static void __iomem *iomapadr; 87static void __iomem *iomapadr;
88static DEFINE_SPINLOCK(sbc_gxx_spin); 88static DEFINE_SPINLOCK(sbc_gxx_spin);
89 89
90/* partition_info gives details on the logical partitions that the split the 90/* partition_info gives details on the logical partitions that the split the
91 * single flash device into. If the size if zero we use up to the end of the 91 * single flash device into. If the size if zero we use up to the end of the
92 * device. */ 92 * device. */
93static struct mtd_partition partition_info[]={ 93static struct mtd_partition partition_info[]={
94 { .name = "SBC-GXx flash boot partition", 94 { .name = "SBC-GXx flash boot partition",
95 .offset = 0, 95 .offset = 0,
96 .size = BOOT_PARTITION_SIZE_KiB*1024 }, 96 .size = BOOT_PARTITION_SIZE_KiB*1024 },
97 { .name = "SBC-GXx flash data partition", 97 { .name = "SBC-GXx flash data partition",
98 .offset = BOOT_PARTITION_SIZE_KiB*1024, 98 .offset = BOOT_PARTITION_SIZE_KiB*1024,
99 .size = (DATA_PARTITION_SIZE_KiB)*1024 }, 99 .size = (DATA_PARTITION_SIZE_KiB)*1024 },
100 { .name = "SBC-GXx flash application partition", 100 { .name = "SBC-GXx flash application partition",
101 .offset = (BOOT_PARTITION_SIZE_KiB+DATA_PARTITION_SIZE_KiB)*1024 } 101 .offset = (BOOT_PARTITION_SIZE_KiB+DATA_PARTITION_SIZE_KiB)*1024 }
102}; 102};
103 103
@@ -130,7 +130,7 @@ static void sbc_gxx_copy_from(struct map_info *map, void *to, unsigned long from
130 unsigned long thislen = len; 130 unsigned long thislen = len;
131 if (len > (WINDOW_LENGTH - (from & WINDOW_MASK))) 131 if (len > (WINDOW_LENGTH - (from & WINDOW_MASK)))
132 thislen = WINDOW_LENGTH-(from & WINDOW_MASK); 132 thislen = WINDOW_LENGTH-(from & WINDOW_MASK);
133 133
134 spin_lock(&sbc_gxx_spin); 134 spin_lock(&sbc_gxx_spin);
135 sbc_gxx_page(map, from); 135 sbc_gxx_page(map, from);
136 memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen); 136 memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen);
@@ -150,12 +150,12 @@ static void sbc_gxx_write8(struct map_info *map, map_word d, unsigned long adr)
150} 150}
151 151
152static void sbc_gxx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) 152static void sbc_gxx_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
153{ 153{
154 while(len) { 154 while(len) {
155 unsigned long thislen = len; 155 unsigned long thislen = len;
156 if (len > (WINDOW_LENGTH - (to & WINDOW_MASK))) 156 if (len > (WINDOW_LENGTH - (to & WINDOW_MASK)))
157 thislen = WINDOW_LENGTH-(to & WINDOW_MASK); 157 thislen = WINDOW_LENGTH-(to & WINDOW_MASK);
158 158
159 spin_lock(&sbc_gxx_spin); 159 spin_lock(&sbc_gxx_spin);
160 sbc_gxx_page(map, to); 160 sbc_gxx_page(map, to);
161 memcpy_toio(iomapadr + (to & WINDOW_MASK), from, thislen); 161 memcpy_toio(iomapadr + (to & WINDOW_MASK), from, thislen);
@@ -201,7 +201,7 @@ static int __init init_sbc_gxx(void)
201 sbc_gxx_map.name ); 201 sbc_gxx_map.name );
202 return -EIO; 202 return -EIO;
203 } 203 }
204 204
205 if (!request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash")) { 205 if (!request_region( PAGE_IO, PAGE_IO_SIZE, "SBC-GXx flash")) {
206 printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n", 206 printk( KERN_ERR"%s: IO ports 0x%x-0x%x in use\n",
207 sbc_gxx_map.name, 207 sbc_gxx_map.name,
@@ -209,8 +209,8 @@ static int __init init_sbc_gxx(void)
209 iounmap(iomapadr); 209 iounmap(iomapadr);
210 return -EAGAIN; 210 return -EAGAIN;
211 } 211 }
212 212
213 213
214 printk( KERN_INFO"%s: IO:0x%x-0x%x MEM:0x%x-0x%x\n", 214 printk( KERN_INFO"%s: IO:0x%x-0x%x MEM:0x%x-0x%x\n",
215 sbc_gxx_map.name, 215 sbc_gxx_map.name,
216 PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1, 216 PAGE_IO, PAGE_IO+PAGE_IO_SIZE-1,
@@ -222,7 +222,7 @@ static int __init init_sbc_gxx(void)
222 cleanup_sbc_gxx(); 222 cleanup_sbc_gxx();
223 return -ENXIO; 223 return -ENXIO;
224 } 224 }
225 225
226 all_mtd->owner = THIS_MODULE; 226 all_mtd->owner = THIS_MODULE;
227 227
228 /* Create MTD devices for each partition. */ 228 /* Create MTD devices for each partition. */
diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c
index a06ed21e7ed..6fb9f3c57aa 100644
--- a/drivers/mtd/maps/sc520cdp.c
+++ b/drivers/mtd/maps/sc520cdp.c
@@ -16,7 +16,7 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 * 18 *
19 * $Id: sc520cdp.c,v 1.21 2004/12/13 10:27:08 dedekind Exp $ 19 * $Id: sc520cdp.c,v 1.22 2005/11/07 11:14:28 gleixner Exp $
20 * 20 *
21 * 21 *
22 * The SC520CDP is an evaluation board for the Elan SC520 processor available 22 * The SC520CDP is an evaluation board for the Elan SC520 processor available
@@ -231,7 +231,7 @@ static void sc520cdp_setup_par(void)
231static int __init init_sc520cdp(void) 231static int __init init_sc520cdp(void)
232{ 232{
233 int i, devices_found = 0; 233 int i, devices_found = 0;
234 234
235#ifdef REPROGRAM_PAR 235#ifdef REPROGRAM_PAR
236 /* reprogram PAR registers so flash appears at the desired addresses */ 236 /* reprogram PAR registers so flash appears at the desired addresses */
237 sc520cdp_setup_par(); 237 sc520cdp_setup_par();
@@ -278,7 +278,7 @@ static int __init init_sc520cdp(void)
278static void __exit cleanup_sc520cdp(void) 278static void __exit cleanup_sc520cdp(void)
279{ 279{
280 int i; 280 int i;
281 281
282 if (merged_mtd) { 282 if (merged_mtd) {
283 del_mtd_device(merged_mtd); 283 del_mtd_device(merged_mtd);
284 mtd_concat_destroy(merged_mtd); 284 mtd_concat_destroy(merged_mtd);
diff --git a/drivers/mtd/maps/scx200_docflash.c b/drivers/mtd/maps/scx200_docflash.c
index 0ece3786d6e..2c91dff8bb6 100644
--- a/drivers/mtd/maps/scx200_docflash.c
+++ b/drivers/mtd/maps/scx200_docflash.c
@@ -1,8 +1,8 @@
1/* linux/drivers/mtd/maps/scx200_docflash.c 1/* linux/drivers/mtd/maps/scx200_docflash.c
2 2
3 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> 3 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
4 4
5 $Id: scx200_docflash.c,v 1.10 2004/11/28 09:40:40 dwmw2 Exp $ 5 $Id: scx200_docflash.c,v 1.12 2005/11/07 11:14:28 gleixner Exp $
6 6
7 National Semiconductor SCx200 flash mapped with DOCCS 7 National Semiconductor SCx200 flash mapped with DOCCS
8*/ 8*/
@@ -49,23 +49,23 @@ static struct mtd_info *mymtd;
49 49
50#ifdef CONFIG_MTD_PARTITIONS 50#ifdef CONFIG_MTD_PARTITIONS
51static struct mtd_partition partition_info[] = { 51static struct mtd_partition partition_info[] = {
52 { 52 {
53 .name = "DOCCS Boot kernel", 53 .name = "DOCCS Boot kernel",
54 .offset = 0, 54 .offset = 0,
55 .size = 0xc0000 55 .size = 0xc0000
56 }, 56 },
57 { 57 {
58 .name = "DOCCS Low BIOS", 58 .name = "DOCCS Low BIOS",
59 .offset = 0xc0000, 59 .offset = 0xc0000,
60 .size = 0x40000 60 .size = 0x40000
61 }, 61 },
62 { 62 {
63 .name = "DOCCS File system", 63 .name = "DOCCS File system",
64 .offset = 0x100000, 64 .offset = 0x100000,
65 .size = ~0 /* calculate from flash size */ 65 .size = ~0 /* calculate from flash size */
66 }, 66 },
67 { 67 {
68 .name = "DOCCS High BIOS", 68 .name = "DOCCS High BIOS",
69 .offset = ~0, /* calculate from flash size */ 69 .offset = ~0, /* calculate from flash size */
70 .size = 0x80000 70 .size = 0x80000
71 }, 71 },
@@ -88,7 +88,7 @@ static int __init init_scx200_docflash(void)
88 88
89 printk(KERN_DEBUG NAME ": NatSemi SCx200 DOCCS Flash Driver\n"); 89 printk(KERN_DEBUG NAME ": NatSemi SCx200 DOCCS Flash Driver\n");
90 90
91 if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, 91 if ((bridge = pci_find_device(PCI_VENDOR_ID_NS,
92 PCI_DEVICE_ID_NS_SCx200_BRIDGE, 92 PCI_DEVICE_ID_NS_SCx200_BRIDGE,
93 NULL)) == NULL) 93 NULL)) == NULL)
94 return -ENODEV; 94 return -ENODEV;
@@ -134,28 +134,28 @@ static int __init init_scx200_docflash(void)
134 printk(KERN_ERR NAME ": invalid size for flash mapping\n"); 134 printk(KERN_ERR NAME ": invalid size for flash mapping\n");
135 return -EINVAL; 135 return -EINVAL;
136 } 136 }
137 137
138 if (width != 8 && width != 16) { 138 if (width != 8 && width != 16) {
139 printk(KERN_ERR NAME ": invalid bus width for flash mapping\n"); 139 printk(KERN_ERR NAME ": invalid bus width for flash mapping\n");
140 return -EINVAL; 140 return -EINVAL;
141 } 141 }
142 142
143 if (allocate_resource(&iomem_resource, &docmem, 143 if (allocate_resource(&iomem_resource, &docmem,
144 size, 144 size,
145 0xc0000000, 0xffffffff, 145 0xc0000000, 0xffffffff,
146 size, NULL, NULL)) { 146 size, NULL, NULL)) {
147 printk(KERN_ERR NAME ": unable to allocate memory for flash mapping\n"); 147 printk(KERN_ERR NAME ": unable to allocate memory for flash mapping\n");
148 return -ENOMEM; 148 return -ENOMEM;
149 } 149 }
150 150
151 ctrl = 0x07000000 | ((size-1) >> 13); 151 ctrl = 0x07000000 | ((size-1) >> 13);
152 152
153 printk(KERN_INFO "DOCCS BASE=0x%08lx, CTRL=0x%08lx\n", (long)docmem.start, (long)ctrl); 153 printk(KERN_INFO "DOCCS BASE=0x%08lx, CTRL=0x%08lx\n", (long)docmem.start, (long)ctrl);
154 154
155 pci_write_config_dword(bridge, SCx200_DOCCS_BASE, docmem.start); 155 pci_write_config_dword(bridge, SCx200_DOCCS_BASE, docmem.start);
156 pci_write_config_dword(bridge, SCx200_DOCCS_CTRL, ctrl); 156 pci_write_config_dword(bridge, SCx200_DOCCS_CTRL, ctrl);
157 pmr = inl(scx200_cb_base + SCx200_PMR); 157 pmr = inl(scx200_cb_base + SCx200_PMR);
158 158
159 if (width == 8) { 159 if (width == 8) {
160 pmr &= ~(1<<6); 160 pmr &= ~(1<<6);
161 } else { 161 } else {
@@ -163,8 +163,8 @@ static int __init init_scx200_docflash(void)
163 } 163 }
164 outl(pmr, scx200_cb_base + SCx200_PMR); 164 outl(pmr, scx200_cb_base + SCx200_PMR);
165 } 165 }
166 166
167 printk(KERN_INFO NAME ": DOCCS mapped at 0x%lx-0x%lx, width %d\n", 167 printk(KERN_INFO NAME ": DOCCS mapped at 0x%lx-0x%lx, width %d\n",
168 docmem.start, docmem.end, width); 168 docmem.start, docmem.end, width);
169 169
170 scx200_docflash_map.size = size; 170 scx200_docflash_map.size = size;
diff --git a/drivers/mtd/maps/sharpsl-flash.c b/drivers/mtd/maps/sharpsl-flash.c
index b7f093fbf9b..999f4bb3d84 100644
--- a/drivers/mtd/maps/sharpsl-flash.c
+++ b/drivers/mtd/maps/sharpsl-flash.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * sharpsl-flash.c 2 * sharpsl-flash.c
3 * 3 *
4 * Copyright (C) 2001 Lineo Japan, Inc. 4 * Copyright (C) 2001 Lineo Japan, Inc.
5 * Copyright (C) 2002 SHARP 5 * Copyright (C) 2002 SHARP
6 * 6 *
7 * $Id: sharpsl-flash.c,v 1.5 2005/03/21 08:42:11 rpurdie Exp $ 7 * $Id: sharpsl-flash.c,v 1.7 2005/11/07 11:14:28 gleixner Exp $
8 * 8 *
9 * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp 9 * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp
10 * Handle mapping of the flash on the RPX Lite and CLLF boards 10 * Handle mapping of the flash on the RPX Lite and CLLF boards
@@ -57,7 +57,7 @@ int __init init_sharpsl(void)
57 int nb_parts = 0; 57 int nb_parts = 0;
58 char *part_type = "static"; 58 char *part_type = "static";
59 59
60 printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n", 60 printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n",
61 WINDOW_SIZE, WINDOW_ADDR); 61 WINDOW_SIZE, WINDOW_ADDR);
62 sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); 62 sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
63 if (!sharpsl_map.virt) { 63 if (!sharpsl_map.virt) {
@@ -75,7 +75,7 @@ int __init init_sharpsl(void)
75 75
76 mymtd->owner = THIS_MODULE; 76 mymtd->owner = THIS_MODULE;
77 77
78 if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky() 78 if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()
79 || machine_is_poodle()) { 79 || machine_is_poodle()) {
80 sharpsl_partitions[0].size=0x006d0000; 80 sharpsl_partitions[0].size=0x006d0000;
81 sharpsl_partitions[0].offset=0x00120000; 81 sharpsl_partitions[0].offset=0x00120000;
@@ -87,10 +87,10 @@ int __init init_sharpsl(void)
87 sharpsl_partitions[0].offset=0x00140000; 87 sharpsl_partitions[0].offset=0x00140000;
88 } else { 88 } else {
89 map_destroy(mymtd); 89 map_destroy(mymtd);
90 iounmap(sharpsl_map.virt); 90 iounmap(sharpsl_map.virt);
91 return -ENODEV; 91 return -ENODEV;
92 } 92 }
93 93
94 parts = sharpsl_partitions; 94 parts = sharpsl_partitions;
95 nb_parts = NB_OF(sharpsl_partitions); 95 nb_parts = NB_OF(sharpsl_partitions);
96 96
diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c
index 8ce5d897645..c53c2c369c9 100644
--- a/drivers/mtd/maps/solutionengine.c
+++ b/drivers/mtd/maps/solutionengine.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: solutionengine.c,v 1.14 2004/09/16 23:27:14 gleixner Exp $ 2 * $Id: solutionengine.c,v 1.15 2005/11/07 11:14:28 gleixner Exp $
3 * 3 *
4 * Flash and EPROM on Hitachi Solution Engine and similar boards. 4 * Flash and EPROM on Hitachi Solution Engine and similar boards.
5 * 5 *
@@ -67,7 +67,7 @@ static int __init init_soleng_maps(void)
67 soleng_eprom_map.virt = (void __iomem *)P1SEGADDR(0x01000000); 67 soleng_eprom_map.virt = (void __iomem *)P1SEGADDR(0x01000000);
68 simple_map_init(&soleng_eprom_map); 68 simple_map_init(&soleng_eprom_map);
69 simple_map_init(&soleng_flash_map); 69 simple_map_init(&soleng_flash_map);
70 70
71 printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n"); 71 printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n");
72 flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map); 72 flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
73 if (!flash_mtd) { 73 if (!flash_mtd) {
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 29091d10030..0758cb1d010 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -1,4 +1,4 @@
1/* $Id: sun_uflash.c,v 1.11 2004/11/04 13:24:15 gleixner Exp $ 1/* $Id: sun_uflash.c,v 1.13 2005/11/07 11:14:28 gleixner Exp $
2 * 2 *
3 * sun_uflash - Driver implementation for user-programmable flash 3 * sun_uflash - Driver implementation for user-programmable flash
4 * present on many Sun Microsystems SME boardsets. 4 * present on many Sun Microsystems SME boardsets.
@@ -63,7 +63,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
63 iTmp = prom_getproperty( 63 iTmp = prom_getproperty(
64 edev->prom_node, "reg", (void *)regs, sizeof(regs)); 64 edev->prom_node, "reg", (void *)regs, sizeof(regs));
65 if ((iTmp % sizeof(regs[0])) != 0) { 65 if ((iTmp % sizeof(regs[0])) != 0) {
66 printk("%s: Strange reg property size %d\n", 66 printk("%s: Strange reg property size %d\n",
67 UFLASH_DEVNAME, iTmp); 67 UFLASH_DEVNAME, iTmp);
68 return -ENODEV; 68 return -ENODEV;
69 } 69 }
@@ -75,7 +75,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
75 * can work on supporting it. 75 * can work on supporting it.
76 */ 76 */
77 printk("%s: unsupported device at 0x%lx (%d regs): " \ 77 printk("%s: unsupported device at 0x%lx (%d regs): " \
78 "email ebrower@usa.net\n", 78 "email ebrower@usa.net\n",
79 UFLASH_DEVNAME, edev->resource[0].start, nregs); 79 UFLASH_DEVNAME, edev->resource[0].start, nregs);
80 return -ENODEV; 80 return -ENODEV;
81 } 81 }
@@ -84,7 +84,7 @@ int uflash_devinit(struct linux_ebus_device* edev)
84 printk("%s: unable to kmalloc new device\n", UFLASH_DEVNAME); 84 printk("%s: unable to kmalloc new device\n", UFLASH_DEVNAME);
85 return(-ENOMEM); 85 return(-ENOMEM);
86 } 86 }
87 87
88 /* copy defaults and tweak parameters */ 88 /* copy defaults and tweak parameters */
89 memcpy(&pdev->map, &uflash_map_templ, sizeof(uflash_map_templ)); 89 memcpy(&pdev->map, &uflash_map_templ, sizeof(uflash_map_templ));
90 pdev->map.size = regs[0].reg_size; 90 pdev->map.size = regs[0].reg_size;
@@ -155,7 +155,7 @@ static void __exit uflash_cleanup(void)
155 155
156 list_for_each(udevlist, &device_list) { 156 list_for_each(udevlist, &device_list) {
157 udev = list_entry(udevlist, struct uflash_dev, list); 157 udev = list_entry(udevlist, struct uflash_dev, list);
158 DEBUG(2, "%s: removing device %s\n", 158 DEBUG(2, "%s: removing device %s\n",
159 UFLASH_DEVNAME, udev->name); 159 UFLASH_DEVNAME, udev->name);
160 160
161 if(0 != udev->mtd) { 161 if(0 != udev->mtd) {
@@ -166,11 +166,9 @@ static void __exit uflash_cleanup(void)
166 iounmap(udev->map.virt); 166 iounmap(udev->map.virt);
167 udev->map.virt = NULL; 167 udev->map.virt = NULL;
168 } 168 }
169 if(0 != udev->name) { 169 kfree(udev->name);
170 kfree(udev->name);
171 }
172 kfree(udev); 170 kfree(udev);
173 } 171 }
174} 172}
175 173
176module_init(uflash_init); 174module_init(uflash_init);
diff --git a/drivers/mtd/maps/tqm834x.c b/drivers/mtd/maps/tqm834x.c
new file mode 100644
index 00000000000..c7ae9a515c1
--- /dev/null
+++ b/drivers/mtd/maps/tqm834x.c
@@ -0,0 +1,291 @@
1/*
2 * drivers/mtd/maps/tqm834x.c
3 *
4 * MTD mapping driver for TQM834x boards
5 *
6 * Copyright 2005 Wolfgang Denk, DENX Software Engineering, <wd@denx.de>.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 *
12 */
13
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/types.h>
18#include <linux/kernel.h>
19#include <linux/slab.h>
20#include <asm/io.h>
21#include <asm/ppcboot.h>
22
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/map.h>
25#include <linux/mtd/partitions.h>
26
27#define FLASH_BANK_MAX 2
28
29extern unsigned char __res[];
30
31/* trivial struct to describe partition information */
32struct mtd_part_def
33{
34 int nums;
35 unsigned char *type;
36 struct mtd_partition* mtd_part;
37};
38
39static struct mtd_info* mtd_banks[FLASH_BANK_MAX];
40static struct map_info* map_banks[FLASH_BANK_MAX];
41static struct mtd_part_def part_banks[FLASH_BANK_MAX];
42
43static unsigned long num_banks;
44static unsigned long start_scan_addr;
45
46#ifdef CONFIG_MTD_PARTITIONS
47/*
48 * The following defines the partition layout of TQM834x boards.
49 *
50 * See include/linux/mtd/partitions.h for definition of the
51 * mtd_partition structure.
52 *
53 * Assume minimal initial size of 4 MiB per bank, will be updated
54 * later in init_tqm834x_mtd() routine.
55 */
56
57/* Partition definition for the first flash bank which is always present. */
58static struct mtd_partition tqm834x_partitions_bank1[] = {
59 {
60 .name = "u-boot", /* u-boot firmware */
61 .offset = 0x00000000,
62 .size = 0x00040000, /* 256 KiB */
63 /*mask_flags: MTD_WRITEABLE, * force read-only */
64 },
65 {
66 .name = "env", /* u-boot environment */
67 .offset = 0x00040000,
68 .size = 0x00020000, /* 128 KiB */
69 /*mask_flags: MTD_WRITEABLE, * force read-only */
70 },
71 {
72 .name = "kernel", /* linux kernel image */
73 .offset = 0x00060000,
74 .size = 0x00100000, /* 1 MiB */
75 /*mask_flags: MTD_WRITEABLE, * force read-only */
76 },
77 {
78 .name = "initrd", /* ramdisk image */
79 .offset = 0x00160000,
80 .size = 0x00200000, /* 2 MiB */
81 },
82 {
83 .name = "user", /* user data */
84 .offset = 0x00360000,
85 .size = 0x000a0000, /* remaining space */
86 /* NOTE: this parttion size is re-calcated in */
87 /* init_tqm834x_mtd() to cover actual remaining space. */
88 },
89};
90
91/* Partition definition for the second flash bank which may be present on some
92 * TQM834x boards.
93 */
94static struct mtd_partition tqm834x_partitions_bank2[] = {
95 {
96 .name = "jffs2", /* jffs2 filesystem */
97 .offset = 0x00000000,
98 .size = 0x00400000, /* whole device */
99 /* NOTE: this parttion size is re-calcated in */
100 /* init_tqm834x_mtd() to cover actual device size. */
101 },
102};
103
104#endif /* CONFIG_MTD_PARTITIONS */
105
106static int __init init_tqm834x_mtd(void)
107{
108 int idx = 0, ret = 0;
109 unsigned long flash_addr, flash_size, mtd_size = 0;
110
111 /* pointer to TQM834x board info data */
112 bd_t *bd = (bd_t *)__res;
113#ifdef CONFIG_MTD_CMDLINE_PARTS
114 int n;
115 char mtdid[4];
116 const char *part_probes[] = { "cmdlinepart", NULL };
117#endif
118
119 flash_addr = bd->bi_flashstart;
120 flash_size = bd->bi_flashsize;
121
122 /* request maximum flash size address space */
123 start_scan_addr = (unsigned long)ioremap(flash_addr, flash_size);
124 if (!start_scan_addr) {
125 printk("%s: Failed to ioremap address: 0x%lx\n",
126 __FUNCTION__, flash_addr);
127 return -EIO;
128 }
129
130 for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
131 if (mtd_size >= flash_size)
132 break;
133
134 pr_debug("%s: chip probing count %d\n", __FUNCTION__, idx);
135
136 map_banks[idx] =
137 (struct map_info *)kmalloc(sizeof(struct map_info),
138 GFP_KERNEL);
139 if (map_banks[idx] == NULL) {
140 ret = -ENOMEM;
141 goto error_mem;
142 }
143 memset((void *)map_banks[idx], 0, sizeof(struct map_info));
144 map_banks[idx]->name = (char *)kmalloc(16, GFP_KERNEL);
145 if (map_banks[idx]->name == NULL) {
146 ret = -ENOMEM;
147 goto error_mem;
148 }
149 memset((void *)map_banks[idx]->name, 0, 16);
150
151 sprintf(map_banks[idx]->name, "TQM834x-%d", idx);
152 map_banks[idx]->size = flash_size;
153 map_banks[idx]->bankwidth = 4;
154
155 simple_map_init(map_banks[idx]);
156
157 map_banks[idx]->virt = (void __iomem *)
158 (start_scan_addr + ((idx > 0) ?
159 (mtd_banks[idx-1] ? mtd_banks[idx-1]->size : 0) : 0));
160 map_banks[idx]->phys =
161 flash_addr + ((idx > 0) ?
162 (mtd_banks[idx-1] ? mtd_banks[idx-1]->size : 0) : 0);
163
164 /* start to probe flash chips */
165 mtd_banks[idx] = do_map_probe("cfi_probe", map_banks[idx]);
166 if (mtd_banks[idx]) {
167 mtd_banks[idx]->owner = THIS_MODULE;
168 mtd_size += mtd_banks[idx]->size;
169 num_banks++;
170 pr_debug("%s: bank %ld, name: %s, size: %d bytes \n",
171 __FUNCTION__, num_banks,
172 mtd_banks[idx]->name, mtd_banks[idx]->size);
173 }
174 }
175
176 /* no supported flash chips found */
177 if (!num_banks) {
178 printk("TQM834x: No supported flash chips found!\n");
179 ret = -ENXIO;
180 goto error_mem;
181 }
182
183#ifdef CONFIG_MTD_PARTITIONS
184 /*
185 * Select static partition definitions
186 */
187 n = ARRAY_SIZE(tqm834x_partitions_bank1);
188 part_banks[0].mtd_part = tqm834x_partitions_bank1;
189 part_banks[0].type = "static image bank1";
190 part_banks[0].nums = n;
191
192 /* update last partition size to cover actual remaining space */
193 tqm834x_partitions_bank1[n - 1].size =
194 mtd_banks[0]->size -
195 tqm834x_partitions_bank1[n - 1].offset;
196
197 /* check if we have second bank? */
198 if (num_banks == 2) {
199 n = ARRAY_SIZE(tqm834x_partitions_bank2);
200 part_banks[1].mtd_part = tqm834x_partitions_bank2;
201 part_banks[1].type = "static image bank2";
202 part_banks[1].nums = n;
203
204 /* update last partition size to cover actual remaining space */
205 tqm834x_partitions_bank2[n - 1].size =
206 mtd_banks[1]->size -
207 tqm834x_partitions_bank2[n - 1].offset;
208 }
209
210 for(idx = 0; idx < num_banks ; idx++) {
211#ifdef CONFIG_MTD_CMDLINE_PARTS
212 sprintf(mtdid, "%d", idx);
213 n = parse_mtd_partitions(mtd_banks[idx],
214 part_probes,
215 &part_banks[idx].mtd_part,
216 0);
217 pr_debug("%s: %d command line partitions on bank %s\n",
218 __FUNCTION__, n, mtdid);
219 if (n > 0) {
220 part_banks[idx].type = "command line";
221 part_banks[idx].nums = n;
222 }
223#endif /* CONFIG_MTD_CMDLINE_PARTS */
224 if (part_banks[idx].nums == 0) {
225 printk(KERN_NOTICE
226 "TQM834x flash bank %d: no partition info "
227 "available, registering whole device\n", idx);
228 add_mtd_device(mtd_banks[idx]);
229 } else {
230 printk(KERN_NOTICE
231 "TQM834x flash bank %d: Using %s partition "
232 "definition\n", idx, part_banks[idx].type);
233 add_mtd_partitions(mtd_banks[idx],
234 part_banks[idx].mtd_part,
235 part_banks[idx].nums);
236 }
237 }
238#else /* ! CONFIG_MTD_PARTITIONS */
239 printk(KERN_NOTICE "TQM834x flash: registering %d flash banks "
240 "at once\n", num_banks);
241
242 for(idx = 0 ; idx < num_banks ; idx++)
243 add_mtd_device(mtd_banks[idx]);
244
245#endif /* CONFIG_MTD_PARTITIONS */
246
247 return 0;
248error_mem:
249 for (idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
250 if (map_banks[idx] != NULL) {
251 if (map_banks[idx]->name != NULL) {
252 kfree(map_banks[idx]->name);
253 map_banks[idx]->name = NULL;
254 }
255 kfree(map_banks[idx]);
256 map_banks[idx] = NULL;
257 }
258 }
259
260 iounmap((void *)start_scan_addr);
261
262 return ret;
263}
264
265static void __exit cleanup_tqm834x_mtd(void)
266{
267 unsigned int idx = 0;
268 for(idx = 0 ; idx < num_banks ; idx++) {
269 /* destroy mtd_info previously allocated */
270 if (mtd_banks[idx]) {
271 del_mtd_partitions(mtd_banks[idx]);
272 map_destroy(mtd_banks[idx]);
273 }
274
275 /* release map_info not used anymore */
276 kfree(map_banks[idx]->name);
277 kfree(map_banks[idx]);
278 }
279
280 if (start_scan_addr) {
281 iounmap((void *)start_scan_addr);
282 start_scan_addr = 0;
283 }
284}
285
286module_init(init_tqm834x_mtd);
287module_exit(cleanup_tqm834x_mtd);
288
289MODULE_LICENSE("GPL");
290MODULE_AUTHOR("Wolfgang Denk <wd@denx.de>");
291MODULE_DESCRIPTION("MTD map driver for TQM834x boards");
diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c
index 4e28b977f22..a43517053e7 100644
--- a/drivers/mtd/maps/tqm8xxl.c
+++ b/drivers/mtd/maps/tqm8xxl.c
@@ -1,15 +1,15 @@
1/* 1/*
2 * Handle mapping of the flash memory access routines 2 * Handle mapping of the flash memory access routines
3 * on TQM8xxL based devices. 3 * on TQM8xxL based devices.
4 * 4 *
5 * $Id: tqm8xxl.c,v 1.13 2004/10/20 22:21:53 dwmw2 Exp $ 5 * $Id: tqm8xxl.c,v 1.15 2005/11/07 11:14:28 gleixner Exp $
6 * 6 *
7 * based on rpxlite.c 7 * based on rpxlite.c
8 * 8 *
9 * Copyright(C) 2001 Kirk Lee <kirk@hpc.ee.ntu.edu.tw> 9 * Copyright(C) 2001 Kirk Lee <kirk@hpc.ee.ntu.edu.tw>
10 * 10 *
11 * This code is GPLed 11 * This code is GPLed
12 * 12 *
13 */ 13 */
14 14
15/* 15/*
@@ -19,7 +19,7 @@
19 * 2MiB 512Kx16 2MiB 0 19 * 2MiB 512Kx16 2MiB 0
20 * 4MiB 1Mx16 4MiB 0 20 * 4MiB 1Mx16 4MiB 0
21 * 8MiB 1Mx16 4MiB 4MiB 21 * 8MiB 1Mx16 4MiB 4MiB
22 * Thus, we choose CONFIG_MTD_CFI_I2 & CONFIG_MTD_CFI_B4 at 22 * Thus, we choose CONFIG_MTD_CFI_I2 & CONFIG_MTD_CFI_B4 at
23 * kernel configuration. 23 * kernel configuration.
24 */ 24 */
25#include <linux/config.h> 25#include <linux/config.h>
@@ -58,9 +58,9 @@ static void __iomem *start_scan_addr;
58 * Here are partition information for all known TQM8xxL series devices. 58 * Here are partition information for all known TQM8xxL series devices.
59 * See include/linux/mtd/partitions.h for definition of the mtd_partition 59 * See include/linux/mtd/partitions.h for definition of the mtd_partition
60 * structure. 60 * structure.
61 * 61 *
62 * The *_max_flash_size is the maximum possible mapped flash size which 62 * The *_max_flash_size is the maximum possible mapped flash size which
63 * is not necessarily the actual flash size. It must correspond to the 63 * is not necessarily the actual flash size. It must correspond to the
64 * value specified in the mapping definition defined by the 64 * value specified in the mapping definition defined by the
65 * "struct map_desc *_io_desc" for the corresponding machine. 65 * "struct map_desc *_io_desc" for the corresponding machine.
66 */ 66 */
@@ -132,9 +132,9 @@ int __init init_tqm_mtd(void)
132 for (idx = 0 ; idx < FLASH_BANK_MAX ; idx++) { 132 for (idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
133 if(mtd_size >= flash_size) 133 if(mtd_size >= flash_size)
134 break; 134 break;
135 135
136 printk(KERN_INFO "%s: chip probing count %d\n", __FUNCTION__, idx); 136 printk(KERN_INFO "%s: chip probing count %d\n", __FUNCTION__, idx);
137 137
138 map_banks[idx] = (struct map_info *)kmalloc(sizeof(struct map_info), GFP_KERNEL); 138 map_banks[idx] = (struct map_info *)kmalloc(sizeof(struct map_info), GFP_KERNEL);
139 if(map_banks[idx] == NULL) { 139 if(map_banks[idx] == NULL) {
140 ret = -ENOMEM; 140 ret = -ENOMEM;
@@ -180,7 +180,7 @@ int __init init_tqm_mtd(void)
180 mtd_size += mtd_banks[idx]->size; 180 mtd_size += mtd_banks[idx]->size;
181 num_banks++; 181 num_banks++;
182 182
183 printk(KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n", __FUNCTION__, num_banks, 183 printk(KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n", __FUNCTION__, num_banks,
184 mtd_banks[idx]->name, mtd_banks[idx]->size); 184 mtd_banks[idx]->name, mtd_banks[idx]->size);
185 } 185 }
186 } 186 }
@@ -211,7 +211,7 @@ int __init init_tqm_mtd(void)
211 } else { 211 } else {
212 printk(KERN_NOTICE "TQM flash%d: Using %s partition definition\n", 212 printk(KERN_NOTICE "TQM flash%d: Using %s partition definition\n",
213 idx, part_banks[idx].type); 213 idx, part_banks[idx].type);
214 add_mtd_partitions(mtd_banks[idx], part_banks[idx].mtd_part, 214 add_mtd_partitions(mtd_banks[idx], part_banks[idx].mtd_part,
215 part_banks[idx].nums); 215 part_banks[idx].nums);
216 } 216 }
217 } 217 }
@@ -224,10 +224,8 @@ int __init init_tqm_mtd(void)
224error_mem: 224error_mem:
225 for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) { 225 for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
226 if(map_banks[idx] != NULL) { 226 if(map_banks[idx] != NULL) {
227 if(map_banks[idx]->name != NULL) { 227 kfree(map_banks[idx]->name);
228 kfree(map_banks[idx]->name); 228 map_banks[idx]->name = NULL;
229 map_banks[idx]->name = NULL;
230 }
231 kfree(map_banks[idx]); 229 kfree(map_banks[idx]);
232 map_banks[idx] = NULL; 230 map_banks[idx] = NULL;
233 } 231 }
diff --git a/drivers/mtd/maps/ts5500_flash.c b/drivers/mtd/maps/ts5500_flash.c
index 3ebd90f5650..4b372bcb17f 100644
--- a/drivers/mtd/maps/ts5500_flash.c
+++ b/drivers/mtd/maps/ts5500_flash.c
@@ -19,26 +19,22 @@
19 * 19 *
20 * Note: 20 * Note:
21 * - In order for detection to work, jumper 3 must be set. 21 * - In order for detection to work, jumper 3 must be set.
22 * - Drive A and B use a proprietary FTL from General Software which isn't 22 * - Drive A and B use the resident flash disk (RFD) flash translation layer.
23 * supported as of yet so standard drives can't be mounted; you can create 23 * - If you have created your own jffs file system and the bios overwrites
24 * your own (e.g. jffs) file system.
25 * - If you have created your own jffs file system and the bios overwrites
26 * it during boot, try disabling Drive A: and B: in the boot order. 24 * it during boot, try disabling Drive A: and B: in the boot order.
27 * 25 *
28 * $Id: ts5500_flash.c,v 1.2 2004/11/28 09:40:40 dwmw2 Exp $ 26 * $Id: ts5500_flash.c,v 1.5 2005/11/07 11:14:28 gleixner Exp $
29 */ 27 */
30 28
31#include <linux/config.h> 29#include <linux/config.h>
30#include <linux/init.h>
32#include <linux/module.h> 31#include <linux/module.h>
33#include <linux/types.h>
34#include <linux/kernel.h> 32#include <linux/kernel.h>
35#include <linux/init.h>
36#include <linux/mtd/mtd.h>
37#include <linux/mtd/map.h> 33#include <linux/mtd/map.h>
38 34#include <linux/mtd/mtd.h>
39#ifdef CONFIG_MTD_PARTITIONS
40#include <linux/mtd/partitions.h> 35#include <linux/mtd/partitions.h>
41#endif 36#include <linux/types.h>
37
42 38
43#define WINDOW_ADDR 0x09400000 39#define WINDOW_ADDR 0x09400000
44#define WINDOW_SIZE 0x00200000 40#define WINDOW_SIZE 0x00200000
@@ -50,7 +46,6 @@ static struct map_info ts5500_map = {
50 .phys = WINDOW_ADDR 46 .phys = WINDOW_ADDR
51}; 47};
52 48
53#ifdef CONFIG_MTD_PARTITIONS
54static struct mtd_partition ts5500_partitions[] = { 49static struct mtd_partition ts5500_partitions[] = {
55 { 50 {
56 .name = "Drive A", 51 .name = "Drive A",
@@ -71,8 +66,6 @@ static struct mtd_partition ts5500_partitions[] = {
71 66
72#define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition)) 67#define NUM_PARTITIONS (sizeof(ts5500_partitions)/sizeof(struct mtd_partition))
73 68
74#endif
75
76static struct mtd_info *mymtd; 69static struct mtd_info *mymtd;
77 70
78static int __init init_ts5500_map(void) 71static int __init init_ts5500_map(void)
@@ -81,48 +74,39 @@ static int __init init_ts5500_map(void)
81 74
82 ts5500_map.virt = ioremap_nocache(ts5500_map.phys, ts5500_map.size); 75 ts5500_map.virt = ioremap_nocache(ts5500_map.phys, ts5500_map.size);
83 76
84 if(!ts5500_map.virt) { 77 if (!ts5500_map.virt) {
85 printk(KERN_ERR "Failed to ioremap_nocache\n"); 78 printk(KERN_ERR "Failed to ioremap_nocache\n");
86 rc = -EIO; 79 rc = -EIO;
87 goto err_out_ioremap; 80 goto err2;
88 } 81 }
89 82
90 simple_map_init(&ts5500_map); 83 simple_map_init(&ts5500_map);
91 84
92 mymtd = do_map_probe("jedec_probe", &ts5500_map); 85 mymtd = do_map_probe("jedec_probe", &ts5500_map);
93 if(!mymtd) 86 if (!mymtd)
94 mymtd = do_map_probe("map_rom", &ts5500_map); 87 mymtd = do_map_probe("map_rom", &ts5500_map);
95 88
96 if(!mymtd) { 89 if (!mymtd) {
97 rc = -ENXIO; 90 rc = -ENXIO;
98 goto err_out_map; 91 goto err1;
99 } 92 }
100 93
101 mymtd->owner = THIS_MODULE; 94 mymtd->owner = THIS_MODULE;
102#ifdef CONFIG_MTD_PARTITIONS
103 add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS); 95 add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS);
104#else
105 add_mtd_device(mymtd);
106#endif
107 96
108 return 0; 97 return 0;
109 98
110err_out_map: 99err1:
111 map_destroy(mymtd); 100 map_destroy(mymtd);
112err_out_ioremap:
113 iounmap(ts5500_map.virt); 101 iounmap(ts5500_map.virt);
114 102err2:
115 return rc; 103 return rc;
116} 104}
117 105
118static void __exit cleanup_ts5500_map(void) 106static void __exit cleanup_ts5500_map(void)
119{ 107{
120 if (mymtd) { 108 if (mymtd) {
121#ifdef CONFIG_MTD_PARTITIONS
122 del_mtd_partitions(mymtd); 109 del_mtd_partitions(mymtd);
123#else
124 del_mtd_device(mymtd);
125#endif
126 map_destroy(mymtd); 110 map_destroy(mymtd);
127 } 111 }
128 112
diff --git a/drivers/mtd/maps/tsunami_flash.c b/drivers/mtd/maps/tsunami_flash.c
index 170d71239e5..9e21e6c02f8 100644
--- a/drivers/mtd/maps/tsunami_flash.c
+++ b/drivers/mtd/maps/tsunami_flash.c
@@ -2,7 +2,7 @@
2 * tsunami_flash.c 2 * tsunami_flash.c
3 * 3 *
4 * flash chip on alpha ds10... 4 * flash chip on alpha ds10...
5 * $Id: tsunami_flash.c,v 1.9 2004/07/14 09:52:55 dwmw2 Exp $ 5 * $Id: tsunami_flash.c,v 1.10 2005/11/07 11:14:29 gleixner Exp $
6 */ 6 */
7#include <asm/io.h> 7#include <asm/io.h>
8#include <asm/core_tsunami.h> 8#include <asm/core_tsunami.h>
@@ -41,7 +41,7 @@ static void tsunami_flash_copy_from(
41} 41}
42 42
43static void tsunami_flash_copy_to( 43static void tsunami_flash_copy_to(
44 struct map_info *map, unsigned long offset, 44 struct map_info *map, unsigned long offset,
45 const void *addr, ssize_t len) 45 const void *addr, ssize_t len)
46{ 46{
47 const unsigned char *src; 47 const unsigned char *src;
@@ -90,7 +90,7 @@ static int __init init_tsunami_flash(void)
90 char **type; 90 char **type;
91 91
92 tsunami_tig_writeb(FLASH_ENABLE_BYTE, FLASH_ENABLE_PORT); 92 tsunami_tig_writeb(FLASH_ENABLE_BYTE, FLASH_ENABLE_PORT);
93 93
94 tsunami_flash_mtd = 0; 94 tsunami_flash_mtd = 0;
95 type = rom_probe_types; 95 type = rom_probe_types;
96 for(; !tsunami_flash_mtd && *type; type++) { 96 for(; !tsunami_flash_mtd && *type; type++) {
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index cc372136e85..79d92808b76 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
7 * 7 *
8 * $Id: uclinux.c,v 1.10 2005/01/05 18:05:13 dwmw2 Exp $ 8 * $Id: uclinux.c,v 1.12 2005/11/07 11:14:29 gleixner Exp $
9 */ 9 */
10 10
11/****************************************************************************/ 11/****************************************************************************/
@@ -82,7 +82,7 @@ int __init uclinux_mtd_init(void)
82 iounmap(mapp->virt); 82 iounmap(mapp->virt);
83 return(-ENXIO); 83 return(-ENXIO);
84 } 84 }
85 85
86 mtd->owner = THIS_MODULE; 86 mtd->owner = THIS_MODULE;
87 mtd->point = uclinux_point; 87 mtd->point = uclinux_point;
88 mtd->priv = mapp; 88 mtd->priv = mapp;
diff --git a/drivers/mtd/maps/vmax301.c b/drivers/mtd/maps/vmax301.c
index c8c74110ed1..e0063941c0d 100644
--- a/drivers/mtd/maps/vmax301.c
+++ b/drivers/mtd/maps/vmax301.c
@@ -1,19 +1,19 @@
1// $Id: vmax301.c,v 1.30 2004/07/12 22:38:29 dwmw2 Exp $ 1// $Id: vmax301.c,v 1.32 2005/11/07 11:14:29 gleixner Exp $
2/* ###################################################################### 2/* ######################################################################
3 3
4 Tempustech VMAX SBC301 MTD Driver. 4 Tempustech VMAX SBC301 MTD Driver.
5 5
6 The VMAx 301 is a SBC based on . It 6 The VMAx 301 is a SBC based on . It
7 comes with three builtin AMD 29F016B flash chips and a socket for SRAM or 7 comes with three builtin AMD 29F016B flash chips and a socket for SRAM or
8 more flash. Each unit has it's own 8k mapping into a settable region 8 more flash. Each unit has it's own 8k mapping into a settable region
9 (0xD8000). There are two 8k mappings for each MTD, the first is always set 9 (0xD8000). There are two 8k mappings for each MTD, the first is always set
10 to the lower 8k of the device the second is paged. Writing a 16 bit page 10 to the lower 8k of the device the second is paged. Writing a 16 bit page
11 value to anywhere in the first 8k will cause the second 8k to page around. 11 value to anywhere in the first 8k will cause the second 8k to page around.
12 12
13 To boot the device a bios extension must be installed into the first 8k 13 To boot the device a bios extension must be installed into the first 8k
14 of flash that is smart enough to copy itself down, page in the rest of 14 of flash that is smart enough to copy itself down, page in the rest of
15 itself and begin executing. 15 itself and begin executing.
16 16
17 ##################################################################### */ 17 ##################################################################### */
18 18
19#include <linux/module.h> 19#include <linux/module.h>
@@ -35,7 +35,7 @@
35/* Actually we could use two spinlocks, but we'd have to have 35/* Actually we could use two spinlocks, but we'd have to have
36 more private space in the struct map_info. We lose a little 36 more private space in the struct map_info. We lose a little
37 performance like this, but we'd probably lose more by having 37 performance like this, but we'd probably lose more by having
38 the extra indirection from having one of the map->map_priv 38 the extra indirection from having one of the map->map_priv
39 fields pointing to yet another private struct. 39 fields pointing to yet another private struct.
40*/ 40*/
41static DEFINE_SPINLOCK(vmax301_spin); 41static DEFINE_SPINLOCK(vmax301_spin);
@@ -98,7 +98,7 @@ static void vmax301_copy_to(struct map_info *map, unsigned long to, const void *
98 spin_lock(&vmax301_spin); 98 spin_lock(&vmax301_spin);
99 vmax301_page(map, to); 99 vmax301_page(map, to);
100 memcpy_toio(map->map_priv_2 + to, from, thislen); 100 memcpy_toio(map->map_priv_2 + to, from, thislen);
101 spin_unlock(&vmax301_spin); 101 spin_unlock(&vmax301_spin);
102 to += thislen; 102 to += thislen;
103 from += thislen; 103 from += thislen;
104 len -= thislen; 104 len -= thislen;
@@ -137,7 +137,7 @@ static struct mtd_info *vmax_mtd[2] = {NULL, NULL};
137static void __exit cleanup_vmax301(void) 137static void __exit cleanup_vmax301(void)
138{ 138{
139 int i; 139 int i;
140 140
141 for (i=0; i<2; i++) { 141 for (i=0; i<2; i++) {
142 if (vmax_mtd[i]) { 142 if (vmax_mtd[i]) {
143 del_mtd_device(vmax_mtd[i]); 143 del_mtd_device(vmax_mtd[i]);
@@ -161,13 +161,13 @@ int __init init_vmax301(void)
161 return -EIO; 161 return -EIO;
162 } 162 }
163 /* Put the address in the map's private data area. 163 /* Put the address in the map's private data area.
164 We store the actual MTD IO address rather than the 164 We store the actual MTD IO address rather than the
165 address of the first half, because it's used more 165 address of the first half, because it's used more
166 often. 166 often.
167 */ 167 */
168 vmax_map[0].map_priv_2 = iomapadr + WINDOW_START; 168 vmax_map[0].map_priv_2 = iomapadr + WINDOW_START;
169 vmax_map[1].map_priv_2 = iomapadr + (3*WINDOW_START); 169 vmax_map[1].map_priv_2 = iomapadr + (3*WINDOW_START);
170 170
171 for (i=0; i<2; i++) { 171 for (i=0; i<2; i++) {
172 vmax_mtd[i] = do_map_probe("cfi_probe", &vmax_map[i]); 172 vmax_mtd[i] = do_map_probe("cfi_probe", &vmax_map[i]);
173 if (!vmax_mtd[i]) 173 if (!vmax_mtd[i])
diff --git a/drivers/mtd/maps/walnut.c b/drivers/mtd/maps/walnut.c
index d6137b1b567..5c17bca3a37 100644
--- a/drivers/mtd/maps/walnut.c
+++ b/drivers/mtd/maps/walnut.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * $Id: walnut.c,v 1.2 2004/12/10 12:07:42 holindho Exp $ 2 * $Id: walnut.c,v 1.3 2005/11/07 11:14:29 gleixner Exp $
3 * 3 *
4 * Mapping for Walnut flash 4 * Mapping for Walnut flash
5 * (used ebony.c as a "framework") 5 * (used ebony.c as a "framework")
6 * 6 *
7 * Heikki Lindholm <holindho@infradead.org> 7 * Heikki Lindholm <holindho@infradead.org>
8 * 8 *
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it 10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the 11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your 12 * Free Software Foundation; either version 2 of the License, or (at your
@@ -48,7 +48,7 @@ static struct mtd_partition walnut_partitions[] = {
48 .name = "OpenBIOS", 48 .name = "OpenBIOS",
49 .offset = 0x0, 49 .offset = 0x0,
50 .size = WALNUT_FLASH_SIZE, 50 .size = WALNUT_FLASH_SIZE,
51 /*.mask_flags = MTD_WRITEABLE, */ /* force read-only */ 51 /*.mask_flags = MTD_WRITEABLE, */ /* force read-only */
52 } 52 }
53}; 53};
54 54
@@ -72,11 +72,11 @@ int __init init_walnut(void)
72 printk("The on-board flash is disabled (U79 sw 5)!"); 72 printk("The on-board flash is disabled (U79 sw 5)!");
73 return -EIO; 73 return -EIO;
74 } 74 }
75 if (WALNUT_FLASH_SRAM_SEL(fpga_brds1)) 75 if (WALNUT_FLASH_SRAM_SEL(fpga_brds1))
76 flash_base = WALNUT_FLASH_LOW; 76 flash_base = WALNUT_FLASH_LOW;
77 else 77 else
78 flash_base = WALNUT_FLASH_HIGH; 78 flash_base = WALNUT_FLASH_HIGH;
79 79
80 walnut_map.phys = flash_base; 80 walnut_map.phys = flash_base;
81 walnut_map.virt = 81 walnut_map.virt =
82 (void __iomem *)ioremap(flash_base, walnut_map.size); 82 (void __iomem *)ioremap(flash_base, walnut_map.size);
diff --git a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c
index 82b887b0570..60c197ec455 100644
--- a/drivers/mtd/maps/wr_sbc82xx_flash.c
+++ b/drivers/mtd/maps/wr_sbc82xx_flash.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: wr_sbc82xx_flash.c,v 1.7 2004/11/04 13:24:15 gleixner Exp $ 2 * $Id: wr_sbc82xx_flash.c,v 1.8 2005/11/07 11:14:29 gleixner Exp $
3 * 3 *
4 * Map for flash chips on Wind River PowerQUICC II SBC82xx board. 4 * Map for flash chips on Wind River PowerQUICC II SBC82xx board.
5 * 5 *
@@ -163,10 +163,10 @@ static void __exit cleanup_sbc82xx_flash(void)
163 del_mtd_partitions(sbcmtd[i]); 163 del_mtd_partitions(sbcmtd[i]);
164 else 164 else
165 del_mtd_device(sbcmtd[i]); 165 del_mtd_device(sbcmtd[i]);
166 166
167 kfree(sbcmtd_parts[i]); 167 kfree(sbcmtd_parts[i]);
168 map_destroy(sbcmtd[i]); 168 map_destroy(sbcmtd[i]);
169 169
170 iounmap((void *)sbc82xx_flash_map[i].virt); 170 iounmap((void *)sbc82xx_flash_map[i].virt);
171 sbc82xx_flash_map[i].virt = 0; 171 sbc82xx_flash_map[i].virt = 0;
172 } 172 }