Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6: (57 commits)
[MTD] [NAND] subpage read feature as a way to increase performance.
CPUFREQ: S3C24XX NAND driver frequency scaling support.
[MTD][NAND] au1550nd: remove unused variable
[MTD] jedec_probe: Fix SST 16-bit chip detection
[MTD][MTDPART] Fix a division by zero bug
[MTD][MTDPART] Cleanup and document the erase region handling
[MTD][MTDPART] Handle most checkpatch findings
[MTD][MTDPART] Seperate main loop from per-partition code in add_mtd_partition
[MTD] physmap: resume already suspended chips on failure to suspend
[MTD] physmap: Fix suspend/resume/shutdown bugs.
[MTD] [NOR] Fix -ETIMEO errors in CFI driver
[MTD] [NAND] fsl_elbc_nand: fix section mismatch with CONFIG_MTD_OF_PARTS=y
[JFFS2] Use .unlocked_ioctl
[MTD] Fix const assignment in the MTD command line partitioning driver
[MTD] [NOR] gen_probe: No debug message when debugging is disabled
[MTD] [NAND] remove __PPC__ hardcoded address from DiskOnChip drivers
[MTD] [MAPS] Remove the bast-flash driver.
[MTD] [NAND] fsl_elbc_nand: ecclayout cleanups
[MTD] [NAND] fsl_elbc_nand: implement support for flash-based BBT
[MTD] [NAND] fsl_elbc_nand: fix OOB workability for large page NAND chips
...

+1521 -1125
+4 -4
arch/arm/mach-at91/at91cap9_devices.c
··· 377 * -------------------------------------------------------------------- */ 378 379 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 380 - static struct at91_nand_data nand_data; 381 382 #define NAND_BASE AT91_CHIPSELECT_3 383 ··· 395 }; 396 397 static struct platform_device at91cap9_nand_device = { 398 - .name = "at91_nand", 399 .id = -1, 400 .dev = { 401 .platform_data = &nand_data, ··· 404 .num_resources = ARRAY_SIZE(nand_resources), 405 }; 406 407 - void __init at91_add_device_nand(struct at91_nand_data *data) 408 { 409 unsigned long csa, mode; 410 ··· 445 platform_device_register(&at91cap9_nand_device); 446 } 447 #else 448 - void __init at91_add_device_nand(struct at91_nand_data *data) {} 449 #endif 450 451
··· 377 * -------------------------------------------------------------------- */ 378 379 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 380 + static struct atmel_nand_data nand_data; 381 382 #define NAND_BASE AT91_CHIPSELECT_3 383 ··· 395 }; 396 397 static struct platform_device at91cap9_nand_device = { 398 + .name = "atmel_nand", 399 .id = -1, 400 .dev = { 401 .platform_data = &nand_data, ··· 404 .num_resources = ARRAY_SIZE(nand_resources), 405 }; 406 407 + void __init at91_add_device_nand(struct atmel_nand_data *data) 408 { 409 unsigned long csa, mode; 410 ··· 445 platform_device_register(&at91cap9_nand_device); 446 } 447 #else 448 + void __init at91_add_device_nand(struct atmel_nand_data *data) {} 449 #endif 450 451
+4 -4
arch/arm/mach-at91/at91rm9200_devices.c
··· 369 * -------------------------------------------------------------------- */ 370 371 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 372 - static struct at91_nand_data nand_data; 373 374 #define NAND_BASE AT91_CHIPSELECT_3 375 ··· 382 }; 383 384 static struct platform_device at91rm9200_nand_device = { 385 - .name = "at91_nand", 386 .id = -1, 387 .dev = { 388 .platform_data = &nand_data, ··· 391 .num_resources = ARRAY_SIZE(nand_resources), 392 }; 393 394 - void __init at91_add_device_nand(struct at91_nand_data *data) 395 { 396 unsigned int csa; 397 ··· 429 platform_device_register(&at91rm9200_nand_device); 430 } 431 #else 432 - void __init at91_add_device_nand(struct at91_nand_data *data) {} 433 #endif 434 435
··· 369 * -------------------------------------------------------------------- */ 370 371 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 372 + static struct atmel_nand_data nand_data; 373 374 #define NAND_BASE AT91_CHIPSELECT_3 375 ··· 382 }; 383 384 static struct platform_device at91rm9200_nand_device = { 385 + .name = "atmel_nand", 386 .id = -1, 387 .dev = { 388 .platform_data = &nand_data, ··· 391 .num_resources = ARRAY_SIZE(nand_resources), 392 }; 393 394 + void __init at91_add_device_nand(struct atmel_nand_data *data) 395 { 396 unsigned int csa; 397 ··· 429 platform_device_register(&at91rm9200_nand_device); 430 } 431 #else 432 + void __init at91_add_device_nand(struct atmel_nand_data *data) {} 433 #endif 434 435
+4 -4
arch/arm/mach-at91/at91sam9260_devices.c
··· 284 * -------------------------------------------------------------------- */ 285 286 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 287 - static struct at91_nand_data nand_data; 288 289 #define NAND_BASE AT91_CHIPSELECT_3 290 ··· 302 }; 303 304 static struct platform_device at91sam9260_nand_device = { 305 - .name = "at91_nand", 306 .id = -1, 307 .dev = { 308 .platform_data = &nand_data, ··· 311 .num_resources = ARRAY_SIZE(nand_resources), 312 }; 313 314 - void __init at91_add_device_nand(struct at91_nand_data *data) 315 { 316 unsigned long csa, mode; 317 ··· 373 platform_device_register(&at91sam9260_nand_device); 374 } 375 #else 376 - void __init at91_add_device_nand(struct at91_nand_data *data) {} 377 #endif 378 379
··· 284 * -------------------------------------------------------------------- */ 285 286 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 287 + static struct atmel_nand_data nand_data; 288 289 #define NAND_BASE AT91_CHIPSELECT_3 290 ··· 302 }; 303 304 static struct platform_device at91sam9260_nand_device = { 305 + .name = "atmel_nand", 306 .id = -1, 307 .dev = { 308 .platform_data = &nand_data, ··· 311 .num_resources = ARRAY_SIZE(nand_resources), 312 }; 313 314 + void __init at91_add_device_nand(struct atmel_nand_data *data) 315 { 316 unsigned long csa, mode; 317 ··· 373 platform_device_register(&at91sam9260_nand_device); 374 } 375 #else 376 + void __init at91_add_device_nand(struct atmel_nand_data *data) {} 377 #endif 378 379
+6 -6
arch/arm/mach-at91/at91sam9261_devices.c
··· 199 * -------------------------------------------------------------------- */ 200 201 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 202 - static struct at91_nand_data nand_data; 203 204 #define NAND_BASE AT91_CHIPSELECT_3 205 ··· 211 } 212 }; 213 214 - static struct platform_device at91_nand_device = { 215 - .name = "at91_nand", 216 .id = -1, 217 .dev = { 218 .platform_data = &nand_data, ··· 221 .num_resources = ARRAY_SIZE(nand_resources), 222 }; 223 224 - void __init at91_add_device_nand(struct at91_nand_data *data) 225 { 226 unsigned long csa, mode; 227 ··· 262 at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */ 263 264 nand_data = *data; 265 - platform_device_register(&at91_nand_device); 266 } 267 268 #else 269 - void __init at91_add_device_nand(struct at91_nand_data *data) {} 270 #endif 271 272
··· 199 * -------------------------------------------------------------------- */ 200 201 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 202 + static struct atmel_nand_data nand_data; 203 204 #define NAND_BASE AT91_CHIPSELECT_3 205 ··· 211 } 212 }; 213 214 + static struct platform_device atmel_nand_device = { 215 + .name = "atmel_nand", 216 .id = -1, 217 .dev = { 218 .platform_data = &nand_data, ··· 221 .num_resources = ARRAY_SIZE(nand_resources), 222 }; 223 224 + void __init at91_add_device_nand(struct atmel_nand_data *data) 225 { 226 unsigned long csa, mode; 227 ··· 262 at91_set_A_periph(AT91_PIN_PC1, 0); /* NANDWE */ 263 264 nand_data = *data; 265 + platform_device_register(&atmel_nand_device); 266 } 267 268 #else 269 + void __init at91_add_device_nand(struct atmel_nand_data *data) {} 270 #endif 271 272
+4 -4
arch/arm/mach-at91/at91sam9263_devices.c
··· 353 * -------------------------------------------------------------------- */ 354 355 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 356 - static struct at91_nand_data nand_data; 357 358 #define NAND_BASE AT91_CHIPSELECT_3 359 ··· 371 }; 372 373 static struct platform_device at91sam9263_nand_device = { 374 - .name = "at91_nand", 375 .id = -1, 376 .dev = { 377 .platform_data = &nand_data, ··· 380 .num_resources = ARRAY_SIZE(nand_resources), 381 }; 382 383 - void __init at91_add_device_nand(struct at91_nand_data *data) 384 { 385 unsigned long csa, mode; 386 ··· 421 platform_device_register(&at91sam9263_nand_device); 422 } 423 #else 424 - void __init at91_add_device_nand(struct at91_nand_data *data) {} 425 #endif 426 427
··· 353 * -------------------------------------------------------------------- */ 354 355 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 356 + static struct atmel_nand_data nand_data; 357 358 #define NAND_BASE AT91_CHIPSELECT_3 359 ··· 371 }; 372 373 static struct platform_device at91sam9263_nand_device = { 374 + .name = "atmel_nand", 375 .id = -1, 376 .dev = { 377 .platform_data = &nand_data, ··· 380 .num_resources = ARRAY_SIZE(nand_resources), 381 }; 382 383 + void __init at91_add_device_nand(struct atmel_nand_data *data) 384 { 385 unsigned long csa, mode; 386 ··· 421 platform_device_register(&at91sam9263_nand_device); 422 } 423 #else 424 + void __init at91_add_device_nand(struct atmel_nand_data *data) {} 425 #endif 426 427
+6 -6
arch/arm/mach-at91/at91sam9rl_devices.c
··· 195 * -------------------------------------------------------------------- */ 196 197 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 198 - static struct at91_nand_data nand_data; 199 200 #define NAND_BASE AT91_CHIPSELECT_3 201 ··· 212 } 213 }; 214 215 - static struct platform_device at91_nand_device = { 216 - .name = "at91_nand", 217 .id = -1, 218 .dev = { 219 .platform_data = &nand_data, ··· 222 .num_resources = ARRAY_SIZE(nand_resources), 223 }; 224 225 - void __init at91_add_device_nand(struct at91_nand_data *data) 226 { 227 unsigned long csa; 228 ··· 259 at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */ 260 261 nand_data = *data; 262 - platform_device_register(&at91_nand_device); 263 } 264 265 #else 266 - void __init at91_add_device_nand(struct at91_nand_data *data) {} 267 #endif 268 269
··· 195 * -------------------------------------------------------------------- */ 196 197 #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 198 + static struct atmel_nand_data nand_data; 199 200 #define NAND_BASE AT91_CHIPSELECT_3 201 ··· 212 } 213 }; 214 215 + static struct platform_device atmel_nand_device = { 216 + .name = "atmel_nand", 217 .id = -1, 218 .dev = { 219 .platform_data = &nand_data, ··· 222 .num_resources = ARRAY_SIZE(nand_resources), 223 }; 224 225 + void __init at91_add_device_nand(struct atmel_nand_data *data) 226 { 227 unsigned long csa; 228 ··· 259 at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */ 260 261 nand_data = *data; 262 + platform_device_register(&atmel_nand_device); 263 } 264 265 #else 266 + void __init at91_add_device_nand(struct atmel_nand_data *data) {} 267 #endif 268 269
+1 -1
arch/arm/mach-at91/board-cam60.c
··· 142 return cam60_nand_partition; 143 } 144 145 - static struct at91_nand_data __initdata cam60_nand_data = { 146 .ale = 21, 147 .cle = 22, 148 // .det_pin = ... not there
··· 142 return cam60_nand_partition; 143 } 144 145 + static struct atmel_nand_data __initdata cam60_nand_data = { 146 .ale = 21, 147 .cle = 22, 148 // .det_pin = ... not there
+1 -1
arch/arm/mach-at91/board-cap9adk.c
··· 181 return cap9adk_nand_partitions; 182 } 183 184 - static struct at91_nand_data __initdata cap9adk_nand_data = { 185 .ale = 21, 186 .cle = 22, 187 // .det_pin = ... not connected
··· 181 return cap9adk_nand_partitions; 182 } 183 184 + static struct atmel_nand_data __initdata cap9adk_nand_data = { 185 .ale = 21, 186 .cle = 22, 187 // .det_pin = ... not connected
+1 -1
arch/arm/mach-at91/board-dk.c
··· 147 return dk_nand_partition; 148 } 149 150 - static struct at91_nand_data __initdata dk_nand_data = { 151 .ale = 22, 152 .cle = 21, 153 .det_pin = AT91_PIN_PB1,
··· 147 return dk_nand_partition; 148 } 149 150 + static struct atmel_nand_data __initdata dk_nand_data = { 151 .ale = 22, 152 .cle = 21, 153 .det_pin = AT91_PIN_PB1,
+1 -1
arch/arm/mach-at91/board-kb9202.c
··· 105 return kb9202_nand_partition; 106 } 107 108 - static struct at91_nand_data __initdata kb9202_nand_data = { 109 .ale = 22, 110 .cle = 21, 111 // .det_pin = ... not there
··· 105 return kb9202_nand_partition; 106 } 107 108 + static struct atmel_nand_data __initdata kb9202_nand_data = { 109 .ale = 22, 110 .cle = 21, 111 // .det_pin = ... not there
+1 -1
arch/arm/mach-at91/board-sam9-l9260.c
··· 141 return ek_nand_partition; 142 } 143 144 - static struct at91_nand_data __initdata ek_nand_data = { 145 .ale = 21, 146 .cle = 22, 147 // .det_pin = ... not connected
··· 141 return ek_nand_partition; 142 } 143 144 + static struct atmel_nand_data __initdata ek_nand_data = { 145 .ale = 21, 146 .cle = 22, 147 // .det_pin = ... not connected
+1 -1
arch/arm/mach-at91/board-sam9260ek.c
··· 178 return ek_nand_partition; 179 } 180 181 - static struct at91_nand_data __initdata ek_nand_data = { 182 .ale = 21, 183 .cle = 22, 184 // .det_pin = ... not connected
··· 178 return ek_nand_partition; 179 } 180 181 + static struct atmel_nand_data __initdata ek_nand_data = { 182 .ale = 21, 183 .cle = 22, 184 // .det_pin = ... not connected
+1 -1
arch/arm/mach-at91/board-sam9261ek.c
··· 183 return ek_nand_partition; 184 } 185 186 - static struct at91_nand_data __initdata ek_nand_data = { 187 .ale = 22, 188 .cle = 21, 189 // .det_pin = ... not connected
··· 183 return ek_nand_partition; 184 } 185 186 + static struct atmel_nand_data __initdata ek_nand_data = { 187 .ale = 22, 188 .cle = 21, 189 // .det_pin = ... not connected
+1 -1
arch/arm/mach-at91/board-sam9263ek.c
··· 187 return ek_nand_partition; 188 } 189 190 - static struct at91_nand_data __initdata ek_nand_data = { 191 .ale = 21, 192 .cle = 22, 193 // .det_pin = ... not connected
··· 187 return ek_nand_partition; 188 } 189 190 + static struct atmel_nand_data __initdata ek_nand_data = { 191 .ale = 21, 192 .cle = 22, 193 // .det_pin = ... not connected
+1 -1
arch/arm/mach-at91/board-sam9rlek.c
··· 96 return ek_nand_partition; 97 } 98 99 - static struct at91_nand_data __initdata ek_nand_data = { 100 .ale = 21, 101 .cle = 22, 102 // .det_pin = ... not connected
··· 96 return ek_nand_partition; 97 } 98 99 + static struct atmel_nand_data __initdata ek_nand_data = { 100 .ale = 21, 101 .cle = 22, 102 // .det_pin = ... not connected
+1 -1
arch/arm/mach-at91/board-yl-9200.c
··· 180 return yl9200_nand_partition; 181 } 182 183 - static struct at91_nand_data __initdata yl9200_nand_data = { 184 .ale = 6, 185 .cle = 7, 186 // .det_pin = ... not connected
··· 180 return yl9200_nand_partition; 181 } 182 183 + static struct atmel_nand_data __initdata yl9200_nand_data = { 184 .ale = 6, 185 .cle = 7, 186 // .det_pin = ... not connected
+4
arch/avr32/boards/atstk1000/Kconfig
··· 18 bool "ATSTK1004" 19 select CPU_AT32AP7002 20 21 endchoice 22 23
··· 18 bool "ATSTK1004" 19 select CPU_AT32AP7002 20 21 + config BOARD_ATSTK1006 22 + bool "ATSTK1006" 23 + select CPU_AT32AP7000 24 + 25 endchoice 26 27
+1
arch/avr32/boards/atstk1000/Makefile
··· 2 obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o 3 obj-$(CONFIG_BOARD_ATSTK1003) += atstk1003.o 4 obj-$(CONFIG_BOARD_ATSTK1004) += atstk1004.o
··· 2 obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o 3 obj-$(CONFIG_BOARD_ATSTK1003) += atstk1003.o 4 obj-$(CONFIG_BOARD_ATSTK1004) += atstk1004.o 5 + obj-$(CONFIG_BOARD_ATSTK1006) += atstk1002.o
+76 -2
arch/avr32/boards/atstk1000/atstk1002.c
··· 1 /* 2 - * ATSTK1002 daughterboard-specific init code 3 * 4 - * Copyright (C) 2005-2006 Atmel Corporation 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as ··· 34 [1] = 20000000, /* 20 MHz on osc0 */ 35 [2] = 12000000, /* 12 MHz on osc1 */ 36 }; 37 38 struct eth_addr { 39 u8 addr[6]; ··· 285 at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */ 286 287 at32_add_system_devices(); 288 289 #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 290 at32_add_device_usart(1);
··· 1 /* 2 + * ATSTK1002/ATSTK1006 daughterboard-specific init code 3 * 4 + * Copyright (C) 2005-2007 Atmel Corporation 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as ··· 34 [1] = 20000000, /* 20 MHz on osc0 */ 35 [2] = 12000000, /* 12 MHz on osc1 */ 36 }; 37 + 38 + /* 39 + * The ATSTK1006 daughterboard is very similar to the ATSTK1002. Both 40 + * have the AT32AP7000 chip on board; the difference is that the 41 + * STK1006 has 128 MB SDRAM (the STK1002 uses the 8 MB SDRAM chip on 42 + * the STK1000 motherboard) and 256 MB NAND flash (the STK1002 has 43 + * none.) 44 + * 45 + * The RAM difference is handled by the boot loader, so the only 46 + * difference we end up handling here is the NAND flash. 47 + */ 48 + #ifdef CONFIG_BOARD_ATSTK1006 49 + #include <linux/mtd/partitions.h> 50 + #include <asm/arch/smc.h> 51 + 52 + static struct smc_timing nand_timing __initdata = { 53 + .ncs_read_setup = 0, 54 + .nrd_setup = 10, 55 + .ncs_write_setup = 0, 56 + .nwe_setup = 10, 57 + 58 + .ncs_read_pulse = 30, 59 + .nrd_pulse = 15, 60 + .ncs_write_pulse = 30, 61 + .nwe_pulse = 15, 62 + 63 + .read_cycle = 30, 64 + .write_cycle = 30, 65 + 66 + .ncs_read_recover = 0, 67 + .nrd_recover = 15, 68 + .ncs_write_recover = 0, 69 + /* WE# high -> RE# low min 60 ns */ 70 + .nwe_recover = 50, 71 + }; 72 + 73 + static struct smc_config nand_config __initdata = { 74 + .bus_width = 1, 75 + .nrd_controlled = 1, 76 + .nwe_controlled = 1, 77 + .nwait_mode = 0, 78 + .byte_write = 0, 79 + .tdf_cycles = 2, 80 + .tdf_mode = 0, 81 + }; 82 + 83 + static struct mtd_partition nand_partitions[] = { 84 + { 85 + .name = "main", 86 + .offset = 0x00000000, 87 + .size = MTDPART_SIZ_FULL, 88 + }, 89 + }; 90 + 91 + static struct mtd_partition *nand_part_info(int size, int *num_partitions) 92 + { 93 + *num_partitions = ARRAY_SIZE(nand_partitions); 94 + return nand_partitions; 95 + } 96 + 97 + struct atmel_nand_data atstk1006_nand_data __initdata = { 98 + .cle = 21, 99 + .ale = 22, 100 + .rdy_pin = GPIO_PIN_PB(30), 101 + .enable_pin = GPIO_PIN_PB(29), 102 + .partition_info = nand_part_info, 103 + }; 104 + #endif 105 106 struct eth_addr { 107 u8 addr[6]; ··· 217 at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */ 218 219 at32_add_system_devices(); 220 + 221 + #ifdef CONFIG_BOARD_ATSTK1006 222 + smc_set_timing(&nand_config, &nand_timing); 223 + smc_set_configuration(3, &nand_config); 224 + at32_add_device_nand(0, &atstk1006_nand_data); 225 + #endif 226 227 #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM 228 at32_add_device_usart(1);
+52
arch/avr32/mach-at32ap/at32ap700x.c
··· 1871 #endif 1872 1873 /* -------------------------------------------------------------------- 1874 * AC97C 1875 * -------------------------------------------------------------------- */ 1876 static struct resource atmel_ac97c0_resource[] __initdata = {
··· 1871 #endif 1872 1873 /* -------------------------------------------------------------------- 1874 + * NAND Flash / SmartMedia 1875 + * -------------------------------------------------------------------- */ 1876 + static struct resource smc_cs3_resource[] __initdata = { 1877 + { 1878 + .start = 0x0c000000, 1879 + .end = 0x0fffffff, 1880 + .flags = IORESOURCE_MEM, 1881 + }, { 1882 + .start = 0xfff03c00, 1883 + .end = 0xfff03fff, 1884 + .flags = IORESOURCE_MEM, 1885 + }, 1886 + }; 1887 + 1888 + struct platform_device *__init 1889 + at32_add_device_nand(unsigned int id, struct atmel_nand_data *data) 1890 + { 1891 + struct platform_device *pdev; 1892 + 1893 + if (id != 0 || !data) 1894 + return NULL; 1895 + 1896 + pdev = platform_device_alloc("atmel_nand", id); 1897 + if (!pdev) 1898 + goto fail; 1899 + 1900 + if (platform_device_add_resources(pdev, smc_cs3_resource, 1901 + ARRAY_SIZE(smc_cs3_resource))) 1902 + goto fail; 1903 + 1904 + if (platform_device_add_data(pdev, data, 1905 + sizeof(struct atmel_nand_data))) 1906 + goto fail; 1907 + 1908 + set_ebi_sfr_bits(HMATRIX_BIT(CS3A)); 1909 + if (data->enable_pin) 1910 + at32_select_gpio(data->enable_pin, 1911 + AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); 1912 + if (data->rdy_pin) 1913 + at32_select_gpio(data->rdy_pin, 0); 1914 + if (data->det_pin) 1915 + at32_select_gpio(data->det_pin, 0); 1916 + 1917 + platform_device_add(pdev); 1918 + return pdev; 1919 + 1920 + fail: 1921 + platform_device_put(pdev); 1922 + return NULL; 1923 + } 1924 + 1925 + /* -------------------------------------------------------------------- 1926 * AC97C 1927 * -------------------------------------------------------------------- */ 1928 static struct resource atmel_ac97c0_resource[] __initdata = {
+1 -1
arch/avr32/mach-at32ap/hsmc.c
··· 278 { 279 return platform_driver_register(&hsmc_driver); 280 } 281 - arch_initcall(hsmc_init);
··· 278 { 279 return platform_driver_register(&hsmc_driver); 280 } 281 + core_initcall(hsmc_init);
-2
drivers/mtd/Kconfig
··· 1 - # $Id: Kconfig,v 1.11 2005/11/07 11:14:19 gleixner Exp $ 2 - 3 menuconfig MTD 4 tristate "Memory Technology Device (MTD) support" 5 depends on HAS_IOMEM
··· 1 menuconfig MTD 2 tristate "Memory Technology Device (MTD) support" 3 depends on HAS_IOMEM
-2
drivers/mtd/afs.c
··· 21 This is access code for flashes using ARM's flash partitioning 22 standards. 23 24 - $Id: afs.c,v 1.15 2005/11/07 11:14:19 gleixner Exp $ 25 - 26 ======================================================================*/ 27 28 #include <linux/module.h>
··· 21 This is access code for flashes using ARM's flash partitioning 22 standards. 23 24 ======================================================================*/ 25 26 #include <linux/module.h>
+13 -4
drivers/mtd/chips/cfi_cmdset_0001.c
··· 4 * 5 * (C) 2000 Red Hat. GPL'd 6 * 7 - * $Id: cfi_cmdset_0001.c,v 1.186 2005/11/23 22:07:52 nico Exp $ 8 - * 9 * 10 * 10/10/2000 Nicolas Pitre <nico@cam.org> 11 * - completely revamped method functions so they are aware and ··· 48 #define I82802AC 0x00ac 49 #define MANUFACTURER_ST 0x0020 50 #define M50LPW080 0x002F 51 #define AT49BV640D 0x02de 52 53 static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); ··· 204 { 205 struct map_info *map = mtd->priv; 206 struct cfi_private *cfi = map->fldrv_priv; 207 - struct cfi_pri_amdstd *extp = cfi->cmdset_priv; 208 209 printk(KERN_WARNING "cfi_cmdset_0001: Suspend " 210 "erase on write disabled.\n"); ··· 301 { MANUFACTURER_INTEL, I82802AB, fixup_use_fwh_lock, NULL, }, 302 { MANUFACTURER_INTEL, I82802AC, fixup_use_fwh_lock, NULL, }, 303 { MANUFACTURER_ST, M50LPW080, fixup_use_fwh_lock, NULL, }, 304 { 0, 0, NULL, NULL } 305 }; 306 static struct cfi_fixup fixup_table[] = { ··· 1149 struct cfi_private *cfi = map->fldrv_priv; 1150 map_word status, status_OK = CMD(0x80); 1151 int chip_state = chip->state; 1152 - unsigned int timeo, sleep_time; 1153 1154 spin_unlock(chip->mutex); 1155 if (inval_len) ··· 1160 timeo = chip_op_time * 8; 1161 if (!timeo) 1162 timeo = 500000; 1163 sleep_time = chip_op_time / 2; 1164 1165 for (;;) { ··· 1201 schedule(); 1202 remove_wait_queue(&chip->wq, &wait); 1203 spin_lock(chip->mutex); 1204 } 1205 } 1206
··· 4 * 5 * (C) 2000 Red Hat. GPL'd 6 * 7 * 8 * 10/10/2000 Nicolas Pitre <nico@cam.org> 9 * - completely revamped method functions so they are aware and ··· 50 #define I82802AC 0x00ac 51 #define MANUFACTURER_ST 0x0020 52 #define M50LPW080 0x002F 53 + #define M50FLW080A 0x0080 54 + #define M50FLW080B 0x0081 55 #define AT49BV640D 0x02de 56 57 static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); ··· 204 { 205 struct map_info *map = mtd->priv; 206 struct cfi_private *cfi = map->fldrv_priv; 207 + struct cfi_pri_intelext *extp = cfi->cmdset_priv; 208 209 printk(KERN_WARNING "cfi_cmdset_0001: Suspend " 210 "erase on write disabled.\n"); ··· 301 { MANUFACTURER_INTEL, I82802AB, fixup_use_fwh_lock, NULL, }, 302 { MANUFACTURER_INTEL, I82802AC, fixup_use_fwh_lock, NULL, }, 303 { MANUFACTURER_ST, M50LPW080, fixup_use_fwh_lock, NULL, }, 304 + { MANUFACTURER_ST, M50FLW080A, fixup_use_fwh_lock, NULL, }, 305 + { MANUFACTURER_ST, M50FLW080B, fixup_use_fwh_lock, NULL, }, 306 { 0, 0, NULL, NULL } 307 }; 308 static struct cfi_fixup fixup_table[] = { ··· 1147 struct cfi_private *cfi = map->fldrv_priv; 1148 map_word status, status_OK = CMD(0x80); 1149 int chip_state = chip->state; 1150 + unsigned int timeo, sleep_time, reset_timeo; 1151 1152 spin_unlock(chip->mutex); 1153 if (inval_len) ··· 1158 timeo = chip_op_time * 8; 1159 if (!timeo) 1160 timeo = 500000; 1161 + reset_timeo = timeo; 1162 sleep_time = chip_op_time / 2; 1163 1164 for (;;) { ··· 1198 schedule(); 1199 remove_wait_queue(&chip->wq, &wait); 1200 spin_lock(chip->mutex); 1201 + } 1202 + if (chip->erase_suspended || chip->write_suspended) { 1203 + /* Suspend has occured while sleep: reset timeout */ 1204 + timeo = reset_timeo; 1205 + chip->erase_suspended = 0; 1206 + chip->write_suspended = 0; 1207 } 1208 } 1209
-3
drivers/mtd/chips/cfi_cmdset_0002.c
··· 16 * Occasionally maintained by Thayne Harbaugh tharbaugh at lnxi dot com 17 * 18 * This code is GPL 19 - * 20 - * $Id: cfi_cmdset_0002.c,v 1.122 2005/11/07 11:14:22 gleixner Exp $ 21 - * 22 */ 23 24 #include <linux/module.h>
··· 16 * Occasionally maintained by Thayne Harbaugh tharbaugh at lnxi dot com 17 * 18 * This code is GPL 19 */ 20 21 #include <linux/module.h>
-2
drivers/mtd/chips/cfi_cmdset_0020.c
··· 4 * 5 * (C) 2000 Red Hat. GPL'd 6 * 7 - * $Id: cfi_cmdset_0020.c,v 1.22 2005/11/07 11:14:22 gleixner Exp $ 8 - * 9 * 10/10/2000 Nicolas Pitre <nico@cam.org> 10 * - completely revamped method functions so they are aware and 11 * independent of the flash geometry (buswidth, interleave, etc.)
··· 4 * 5 * (C) 2000 Red Hat. GPL'd 6 * 7 * 10/10/2000 Nicolas Pitre <nico@cam.org> 8 * - completely revamped method functions so they are aware and 9 * independent of the flash geometry (buswidth, interleave, etc.)
-1
drivers/mtd/chips/cfi_probe.c
··· 1 /* 2 Common Flash Interface probe code. 3 (C) 2000 Red Hat. GPL'd. 4 - $Id: cfi_probe.c,v 1.86 2005/11/29 14:48:31 gleixner Exp $ 5 */ 6 7 #include <linux/module.h>
··· 1 /* 2 Common Flash Interface probe code. 3 (C) 2000 Red Hat. GPL'd. 4 */ 5 6 #include <linux/module.h>
-3
drivers/mtd/chips/cfi_util.c
··· 6 * Copyright (C) 2003 STMicroelectronics Limited 7 * 8 * This code is covered by the GPL. 9 - * 10 - * $Id: cfi_util.c,v 1.10 2005/11/07 11:14:23 gleixner Exp $ 11 - * 12 */ 13 14 #include <linux/module.h>
··· 6 * Copyright (C) 2003 STMicroelectronics Limited 7 * 8 * This code is covered by the GPL. 9 */ 10 11 #include <linux/module.h>
-2
drivers/mtd/chips/chipreg.c
··· 1 /* 2 - * $Id: chipreg.c,v 1.17 2004/11/16 18:29:00 dwmw2 Exp $ 3 - * 4 * Registration for chip drivers 5 * 6 */
··· 1 /* 2 * Registration for chip drivers 3 * 4 */
+2 -3
drivers/mtd/chips/gen_probe.c
··· 2 * Routines common to all CFI-type probes. 3 * (C) 2001-2003 Red Hat, Inc. 4 * GPL'd 5 - * $Id: gen_probe.c,v 1.24 2005/11/07 11:14:23 gleixner Exp $ 6 */ 7 8 #include <linux/kernel.h> ··· 70 interleave and device type, etc. */ 71 if (!genprobe_new_chip(map, cp, &cfi)) { 72 /* The probe didn't like it */ 73 - printk(KERN_DEBUG "%s: Found no %s device at location zero\n", 74 - cp->name, map->name); 75 return NULL; 76 } 77
··· 2 * Routines common to all CFI-type probes. 3 * (C) 2001-2003 Red Hat, Inc. 4 * GPL'd 5 */ 6 7 #include <linux/kernel.h> ··· 71 interleave and device type, etc. */ 72 if (!genprobe_new_chip(map, cp, &cfi)) { 73 /* The probe didn't like it */ 74 + pr_debug("%s: Found no %s device at location zero\n", 75 + cp->name, map->name); 76 return NULL; 77 } 78
+125 -8
drivers/mtd/chips/jedec_probe.c
··· 1 /* 2 Common Flash Interface probe code. 3 (C) 2000 Red Hat. GPL'd. 4 - $Id: jedec_probe.c,v 1.66 2005/11/07 11:14:23 gleixner Exp $ 5 See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5) 6 for the standard this probe goes back to. 7 ··· 25 /* Manufacturers */ 26 #define MANUFACTURER_AMD 0x0001 27 #define MANUFACTURER_ATMEL 0x001f 28 #define MANUFACTURER_FUJITSU 0x0004 29 #define MANUFACTURER_HYUNDAI 0x00AD 30 #define MANUFACTURER_INTEL 0x0089 ··· 37 #define MANUFACTURER_ST 0x0020 38 #define MANUFACTURER_TOSHIBA 0x0098 39 #define MANUFACTURER_WINBOND 0x00da 40 41 42 /* AMD */ ··· 59 #define AM29LV040B 0x004F 60 #define AM29F032B 0x0041 61 #define AM29F002T 0x00B0 62 63 /* Atmel */ 64 #define AT49BV512 0x0003 ··· 69 #define AT49BV16XT 0x00C2 70 #define AT49BV32X 0x00C8 71 #define AT49BV32XT 0x00C9 72 73 /* Fujitsu */ 74 #define MBM29F040C 0x00A4 ··· 148 #define M50FW080 0x002D 149 #define M50FW016 0x002E 150 #define M50LPW080 0x002F 151 152 /* SST */ 153 #define SST29EE020 0x0010 ··· 200 MTD_UADDR_0x0555_0x0AAA, 201 MTD_UADDR_0x5555_0x2AAA, 202 MTD_UADDR_0x0AAA_0x0555, 203 MTD_UADDR_DONT_CARE, /* Requires an arbitrary address */ 204 MTD_UADDR_UNNECESSARY, /* Does not require any address */ 205 }; ··· 246 [MTD_UADDR_0x0AAA_0x0555] = { 247 .addr1 = 0x0AAA, 248 .addr2 = 0x0555 249 }, 250 251 [MTD_UADDR_DONT_CARE] = { ··· 537 ERASEINFO(0x04000,1), 538 } 539 }, { 540 .mfr_id = MANUFACTURER_ATMEL, 541 .dev_id = AT49BV512, 542 .name = "Atmel AT49BV512", ··· 642 .regions = { 643 ERASEINFO(0x10000,63), 644 ERASEINFO(0x02000,8) 645 } 646 }, { 647 .mfr_id = MANUFACTURER_FUJITSU, ··· 1467 .mfr_id = MANUFACTURER_SST, /* should be CFI */ 1468 .dev_id = SST39LF160, 1469 .name = "SST 39LF160", 1470 - .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8, 1471 - .uaddr = MTD_UADDR_0x5555_0x2AAA, /* ???? */ 1472 .dev_size = SIZE_2MiB, 1473 .cmd_set = P_ID_AMD_STD, 1474 .nr_regions = 2, ··· 1480 .mfr_id = MANUFACTURER_SST, /* should be CFI */ 1481 .dev_id = SST39VF1601, 1482 .name = "SST 39VF1601", 1483 - .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8, 1484 - .uaddr = MTD_UADDR_0x5555_0x2AAA, /* ???? */ 1485 .dev_size = SIZE_2MiB, 1486 .cmd_set = P_ID_AMD_STD, 1487 .nr_regions = 2, ··· 1665 .nr_regions = 1, 1666 .regions = { 1667 ERASEINFO(0x10000,16), 1668 } 1669 }, { 1670 .mfr_id = MANUFACTURER_TOSHIBA, ··· 1801 { 1802 map_word result; 1803 unsigned long mask; 1804 - u32 ofs = cfi_build_cmd_addr(0, cfi_interleave(cfi), cfi->device_type); 1805 - mask = (1 << (cfi->device_type * 8)) -1; 1806 - result = map_read(map, base + ofs); 1807 return result.x[0] & mask; 1808 } 1809
··· 1 /* 2 Common Flash Interface probe code. 3 (C) 2000 Red Hat. GPL'd. 4 See JEDEC (http://www.jedec.org/) standard JESD21C (section 3.5) 5 for the standard this probe goes back to. 6 ··· 26 /* Manufacturers */ 27 #define MANUFACTURER_AMD 0x0001 28 #define MANUFACTURER_ATMEL 0x001f 29 + #define MANUFACTURER_EON 0x001c 30 #define MANUFACTURER_FUJITSU 0x0004 31 #define MANUFACTURER_HYUNDAI 0x00AD 32 #define MANUFACTURER_INTEL 0x0089 ··· 37 #define MANUFACTURER_ST 0x0020 38 #define MANUFACTURER_TOSHIBA 0x0098 39 #define MANUFACTURER_WINBOND 0x00da 40 + #define CONTINUATION_CODE 0x007f 41 42 43 /* AMD */ ··· 58 #define AM29LV040B 0x004F 59 #define AM29F032B 0x0041 60 #define AM29F002T 0x00B0 61 + #define AM29SL800DB 0x226B 62 + #define AM29SL800DT 0x22EA 63 64 /* Atmel */ 65 #define AT49BV512 0x0003 ··· 66 #define AT49BV16XT 0x00C2 67 #define AT49BV32X 0x00C8 68 #define AT49BV32XT 0x00C9 69 + 70 + /* Eon */ 71 + #define EN29SL800BB 0x226B 72 + #define EN29SL800BT 0x22EA 73 74 /* Fujitsu */ 75 #define MBM29F040C 0x00A4 ··· 141 #define M50FW080 0x002D 142 #define M50FW016 0x002E 143 #define M50LPW080 0x002F 144 + #define M50FLW080A 0x0080 145 + #define M50FLW080B 0x0081 146 147 /* SST */ 148 #define SST29EE020 0x0010 ··· 191 MTD_UADDR_0x0555_0x0AAA, 192 MTD_UADDR_0x5555_0x2AAA, 193 MTD_UADDR_0x0AAA_0x0555, 194 + MTD_UADDR_0xAAAA_0x5555, 195 MTD_UADDR_DONT_CARE, /* Requires an arbitrary address */ 196 MTD_UADDR_UNNECESSARY, /* Does not require any address */ 197 }; ··· 236 [MTD_UADDR_0x0AAA_0x0555] = { 237 .addr1 = 0x0AAA, 238 .addr2 = 0x0555 239 + }, 240 + 241 + [MTD_UADDR_0xAAAA_0x5555] = { 242 + .addr1 = 0xaaaa, 243 + .addr2 = 0x5555 244 }, 245 246 [MTD_UADDR_DONT_CARE] = { ··· 522 ERASEINFO(0x04000,1), 523 } 524 }, { 525 + .mfr_id = MANUFACTURER_AMD, 526 + .dev_id = AM29SL800DT, 527 + .name = "AMD AM29SL800DT", 528 + .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8, 529 + .uaddr = MTD_UADDR_0x0AAA_0x0555, 530 + .dev_size = SIZE_1MiB, 531 + .cmd_set = P_ID_AMD_STD, 532 + .nr_regions = 4, 533 + .regions = { 534 + ERASEINFO(0x10000,15), 535 + ERASEINFO(0x08000,1), 536 + ERASEINFO(0x02000,2), 537 + ERASEINFO(0x04000,1), 538 + } 539 + }, { 540 + .mfr_id = MANUFACTURER_AMD, 541 + .dev_id = AM29SL800DB, 542 + .name = "AMD AM29SL800DB", 543 + .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8, 544 + .uaddr = MTD_UADDR_0x0AAA_0x0555, 545 + .dev_size = SIZE_1MiB, 546 + .cmd_set = P_ID_AMD_STD, 547 + .nr_regions = 4, 548 + .regions = { 549 + ERASEINFO(0x04000,1), 550 + ERASEINFO(0x02000,2), 551 + ERASEINFO(0x08000,1), 552 + ERASEINFO(0x10000,15), 553 + } 554 + }, { 555 .mfr_id = MANUFACTURER_ATMEL, 556 .dev_id = AT49BV512, 557 .name = "Atmel AT49BV512", ··· 597 .regions = { 598 ERASEINFO(0x10000,63), 599 ERASEINFO(0x02000,8) 600 + } 601 + }, { 602 + .mfr_id = MANUFACTURER_EON, 603 + .dev_id = EN29SL800BT, 604 + .name = "Eon EN29SL800BT", 605 + .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8, 606 + .uaddr = MTD_UADDR_0x0AAA_0x0555, 607 + .dev_size = SIZE_1MiB, 608 + .cmd_set = P_ID_AMD_STD, 609 + .nr_regions = 4, 610 + .regions = { 611 + ERASEINFO(0x10000,15), 612 + ERASEINFO(0x08000,1), 613 + ERASEINFO(0x02000,2), 614 + ERASEINFO(0x04000,1), 615 + } 616 + }, { 617 + .mfr_id = MANUFACTURER_EON, 618 + .dev_id = EN29SL800BB, 619 + .name = "Eon EN29SL800BB", 620 + .devtypes = CFI_DEVICETYPE_X16|CFI_DEVICETYPE_X8, 621 + .uaddr = MTD_UADDR_0x0AAA_0x0555, 622 + .dev_size = SIZE_1MiB, 623 + .cmd_set = P_ID_AMD_STD, 624 + .nr_regions = 4, 625 + .regions = { 626 + ERASEINFO(0x04000,1), 627 + ERASEINFO(0x02000,2), 628 + ERASEINFO(0x08000,1), 629 + ERASEINFO(0x10000,15), 630 } 631 }, { 632 .mfr_id = MANUFACTURER_FUJITSU, ··· 1392 .mfr_id = MANUFACTURER_SST, /* should be CFI */ 1393 .dev_id = SST39LF160, 1394 .name = "SST 39LF160", 1395 + .devtypes = CFI_DEVICETYPE_X16, 1396 + .uaddr = MTD_UADDR_0xAAAA_0x5555, 1397 .dev_size = SIZE_2MiB, 1398 .cmd_set = P_ID_AMD_STD, 1399 .nr_regions = 2, ··· 1405 .mfr_id = MANUFACTURER_SST, /* should be CFI */ 1406 .dev_id = SST39VF1601, 1407 .name = "SST 39VF1601", 1408 + .devtypes = CFI_DEVICETYPE_X16, 1409 + .uaddr = MTD_UADDR_0xAAAA_0x5555, 1410 .dev_size = SIZE_2MiB, 1411 .cmd_set = P_ID_AMD_STD, 1412 .nr_regions = 2, ··· 1590 .nr_regions = 1, 1591 .regions = { 1592 ERASEINFO(0x10000,16), 1593 + }, 1594 + }, { 1595 + .mfr_id = MANUFACTURER_ST, 1596 + .dev_id = M50FLW080A, 1597 + .name = "ST M50FLW080A", 1598 + .devtypes = CFI_DEVICETYPE_X8, 1599 + .uaddr = MTD_UADDR_UNNECESSARY, 1600 + .dev_size = SIZE_1MiB, 1601 + .cmd_set = P_ID_INTEL_EXT, 1602 + .nr_regions = 4, 1603 + .regions = { 1604 + ERASEINFO(0x1000,16), 1605 + ERASEINFO(0x10000,13), 1606 + ERASEINFO(0x1000,16), 1607 + ERASEINFO(0x1000,16), 1608 + } 1609 + }, { 1610 + .mfr_id = MANUFACTURER_ST, 1611 + .dev_id = M50FLW080B, 1612 + .name = "ST M50FLW080B", 1613 + .devtypes = CFI_DEVICETYPE_X8, 1614 + .uaddr = MTD_UADDR_UNNECESSARY, 1615 + .dev_size = SIZE_1MiB, 1616 + .cmd_set = P_ID_INTEL_EXT, 1617 + .nr_regions = 4, 1618 + .regions = { 1619 + ERASEINFO(0x1000,16), 1620 + ERASEINFO(0x1000,16), 1621 + ERASEINFO(0x10000,13), 1622 + ERASEINFO(0x1000,16), 1623 } 1624 }, { 1625 .mfr_id = MANUFACTURER_TOSHIBA, ··· 1696 { 1697 map_word result; 1698 unsigned long mask; 1699 + int bank = 0; 1700 + 1701 + /* According to JEDEC "Standard Manufacturer's Identification Code" 1702 + * (http://www.jedec.org/download/search/jep106W.pdf) 1703 + * several first banks can contain 0x7f instead of actual ID 1704 + */ 1705 + do { 1706 + uint32_t ofs = cfi_build_cmd_addr(0 + (bank << 8), 1707 + cfi_interleave(cfi), 1708 + cfi->device_type); 1709 + mask = (1 << (cfi->device_type * 8)) - 1; 1710 + result = map_read(map, base + ofs); 1711 + bank++; 1712 + } while ((result.x[0] & mask) == CONTINUATION_CODE); 1713 + 1714 return result.x[0] & mask; 1715 } 1716
-1
drivers/mtd/chips/map_absent.c
··· 1 /* 2 * Common code to handle absent "placeholder" devices 3 * Copyright 2001 Resilience Corporation <ebrower@resilience.com> 4 - * $Id: map_absent.c,v 1.6 2005/11/07 11:14:23 gleixner Exp $ 5 * 6 * This map driver is used to allocate "placeholder" MTD 7 * devices on systems that have socketed/removable media.
··· 1 /* 2 * Common code to handle absent "placeholder" devices 3 * Copyright 2001 Resilience Corporation <ebrower@resilience.com> 4 * 5 * This map driver is used to allocate "placeholder" MTD 6 * devices on systems that have socketed/removable media.
-1
drivers/mtd/chips/map_ram.c
··· 1 /* 2 * Common code to handle map devices which are simple RAM 3 * (C) 2000 Red Hat. GPL'd. 4 - * $Id: map_ram.c,v 1.22 2005/01/05 18:05:12 dwmw2 Exp $ 5 */ 6 7 #include <linux/module.h>
··· 1 /* 2 * Common code to handle map devices which are simple RAM 3 * (C) 2000 Red Hat. GPL'd. 4 */ 5 6 #include <linux/module.h>
-1
drivers/mtd/chips/map_rom.c
··· 1 /* 2 * Common code to handle map devices which are simple ROM 3 * (C) 2000 Red Hat. GPL'd. 4 - * $Id: map_rom.c,v 1.23 2005/01/05 18:05:12 dwmw2 Exp $ 5 */ 6 7 #include <linux/module.h>
··· 1 /* 2 * Common code to handle map devices which are simple ROM 3 * (C) 2000 Red Hat. GPL'd. 4 */ 5 6 #include <linux/module.h>
+1 -3
drivers/mtd/cmdlinepart.c
··· 1 /* 2 - * $Id: cmdlinepart.c,v 1.19 2005/11/07 11:14:19 gleixner Exp $ 3 - * 4 * Read flash partition table from command line 5 * 6 * Copyright 2002 SYSGO Real-Time Solutions GmbH ··· 306 unsigned long offset; 307 int i; 308 struct cmdline_mtd_partition *part; 309 - char *mtd_id = master->name; 310 311 /* parse command line */ 312 if (!cmdline_parsed)
··· 1 /* 2 * Read flash partition table from command line 3 * 4 * Copyright 2002 SYSGO Real-Time Solutions GmbH ··· 308 unsigned long offset; 309 int i; 310 struct cmdline_mtd_partition *part; 311 + const char *mtd_id = master->name; 312 313 /* parse command line */ 314 if (!cmdline_parsed)
-1
drivers/mtd/devices/Kconfig
··· 1 # drivers/mtd/maps/Kconfig 2 - # $Id: Kconfig,v 1.18 2005/11/07 11:14:24 gleixner Exp $ 3 4 menu "Self-contained MTD device drivers" 5 depends on MTD!=n
··· 1 # drivers/mtd/maps/Kconfig 2 3 menu "Self-contained MTD device drivers" 4 depends on MTD!=n
-1
drivers/mtd/devices/Makefile
··· 1 # 2 # linux/drivers/devices/Makefile 3 # 4 - # $Id: Makefile.common,v 1.7 2004/12/22 17:51:15 joern Exp $ 5 6 obj-$(CONFIG_MTD_DOC2000) += doc2000.o 7 obj-$(CONFIG_MTD_DOC2001) += doc2001.o
··· 1 # 2 # linux/drivers/devices/Makefile 3 # 4 5 obj-$(CONFIG_MTD_DOC2000) += doc2000.o 6 obj-$(CONFIG_MTD_DOC2001) += doc2001.o
-6
drivers/mtd/devices/block2mtd.c
··· 1 /* 2 - * $Id: block2mtd.c,v 1.30 2005/11/29 14:48:32 gleixner Exp $ 3 - * 4 * block2mtd.c - create an mtd from a block device 5 * 6 * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> ··· 17 #include <linux/buffer_head.h> 18 #include <linux/mutex.h> 19 #include <linux/mount.h> 20 - 21 - #define VERSION "$Revision: 1.30 $" 22 - 23 24 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) 25 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args) ··· 448 static int __init block2mtd_init(void) 449 { 450 int ret = 0; 451 - INFO("version " VERSION); 452 453 #ifndef MODULE 454 if (strlen(block2mtd_paramline))
··· 1 /* 2 * block2mtd.c - create an mtd from a block device 3 * 4 * Copyright (C) 2001,2002 Simon Evans <spse@secret.org.uk> ··· 19 #include <linux/buffer_head.h> 20 #include <linux/mutex.h> 21 #include <linux/mount.h> 22 23 #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args) 24 #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args) ··· 453 static int __init block2mtd_init(void) 454 { 455 int ret = 0; 456 457 #ifndef MODULE 458 if (strlen(block2mtd_paramline))
-2
drivers/mtd/devices/doc2000.c
··· 3 * Linux driver for Disk-On-Chip 2000 and Millennium 4 * (c) 1999 Machine Vision Holdings, Inc. 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 6 - * 7 - * $Id: doc2000.c,v 1.67 2005/11/07 11:14:24 gleixner Exp $ 8 */ 9 10 #include <linux/kernel.h>
··· 3 * Linux driver for Disk-On-Chip 2000 and Millennium 4 * (c) 1999 Machine Vision Holdings, Inc. 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 6 */ 7 8 #include <linux/kernel.h>
-2
drivers/mtd/devices/doc2001.c
··· 3 * Linux driver for Disk-On-Chip Millennium 4 * (c) 1999 Machine Vision Holdings, Inc. 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 6 - * 7 - * $Id: doc2001.c,v 1.49 2005/11/07 11:14:24 gleixner Exp $ 8 */ 9 10 #include <linux/kernel.h>
··· 3 * Linux driver for Disk-On-Chip Millennium 4 * (c) 1999 Machine Vision Holdings, Inc. 5 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 6 */ 7 8 #include <linux/kernel.h>
-2
drivers/mtd/devices/doc2001plus.c
··· 6 * (c) 1999 Machine Vision Holdings, Inc. 7 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 8 * 9 - * $Id: doc2001plus.c,v 1.14 2005/11/07 11:14:24 gleixner Exp $ 10 - * 11 * Released under GPL 12 */ 13
··· 6 * (c) 1999 Machine Vision Holdings, Inc. 7 * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org> 8 * 9 * Released under GPL 10 */ 11
-2
drivers/mtd/devices/docecc.c
··· 7 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 8 * Copyright (C) 2000 Netgem S.A. 9 * 10 - * $Id: docecc.c,v 1.7 2005/11/07 11:14:25 gleixner Exp $ 11 - * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or
··· 7 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 8 * Copyright (C) 2000 Netgem S.A. 9 * 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 12 * the Free Software Foundation; either version 2 of the License, or
-5
drivers/mtd/devices/docprobe.c
··· 4 /* (C) 1999 Machine Vision Holdings, Inc. */ 5 /* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ 6 7 - /* $Id: docprobe.c,v 1.46 2005/11/07 11:14:25 gleixner Exp $ */ 8 - 9 - 10 11 /* DOC_PASSIVE_PROBE: 12 In order to ensure that the BIOS checksum is correct at boot time, and ··· 76 0xe0000, 0xe2000, 0xe4000, 0xe6000, 77 0xe8000, 0xea000, 0xec000, 0xee000, 78 #endif /* CONFIG_MTD_DOCPROBE_HIGH */ 79 - #elif defined(__PPC__) 80 - 0xe4000000, 81 #else 82 #warning Unknown architecture for DiskOnChip. No default probe locations defined 83 #endif
··· 4 /* (C) 1999 Machine Vision Holdings, Inc. */ 5 /* (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ 6 7 8 /* DOC_PASSIVE_PROBE: 9 In order to ensure that the BIOS checksum is correct at boot time, and ··· 79 0xe0000, 0xe2000, 0xe4000, 0xe6000, 80 0xe8000, 0xea000, 0xec000, 0xee000, 81 #endif /* CONFIG_MTD_DOCPROBE_HIGH */ 82 #else 83 #warning Unknown architecture for DiskOnChip. No default probe locations defined 84 #endif
-2
drivers/mtd/devices/lart.c
··· 2 /* 3 * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART. 4 * 5 - * $Id: lart.c,v 1.9 2005/11/07 11:14:25 gleixner Exp $ 6 - * 7 * Author: Abraham vd Merwe <abraham@2d3d.co.za> 8 * 9 * Copyright (c) 2001, 2d3D, Inc.
··· 2 /* 3 * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART. 4 * 5 * Author: Abraham vd Merwe <abraham@2d3d.co.za> 6 * 7 * Copyright (c) 2001, 2d3D, Inc.
+22
drivers/mtd/devices/m25p80.c
··· 33 /* Flash opcodes. */ 34 #define OPCODE_WREN 0x06 /* Write enable */ 35 #define OPCODE_RDSR 0x05 /* Read status register */ 36 #define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ 37 #define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ 38 #define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ ··· 113 return val; 114 } 115 116 117 /* 118 * Set write enable latch with Write Enable command. ··· 600 flash->spi = spi; 601 mutex_init(&flash->lock); 602 dev_set_drvdata(&spi->dev, flash); 603 604 if (data && data->name) 605 flash->mtd.name = data->name;
··· 33 /* Flash opcodes. */ 34 #define OPCODE_WREN 0x06 /* Write enable */ 35 #define OPCODE_RDSR 0x05 /* Read status register */ 36 + #define OPCODE_WRSR 0x01 /* Write status register 1 byte */ 37 #define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */ 38 #define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */ 39 #define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */ ··· 112 return val; 113 } 114 115 + /* 116 + * Write status register 1 byte 117 + * Returns negative if error occurred. 118 + */ 119 + static int write_sr(struct m25p *flash, u8 val) 120 + { 121 + flash->command[0] = OPCODE_WRSR; 122 + flash->command[1] = val; 123 + 124 + return spi_write(flash->spi, flash->command, 2); 125 + } 126 127 /* 128 * Set write enable latch with Write Enable command. ··· 588 flash->spi = spi; 589 mutex_init(&flash->lock); 590 dev_set_drvdata(&spi->dev, flash); 591 + 592 + /* 593 + * Atmel serial flash tend to power up 594 + * with the software protection bits set 595 + */ 596 + 597 + if (info->jedec_id >> 16 == 0x1f) { 598 + write_enable(flash); 599 + write_sr(flash, 0); 600 + } 601 602 if (data && data->name) 603 flash->mtd.name = data->name;
-2
drivers/mtd/devices/ms02-nv.c
··· 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 - * 9 - * $Id: ms02-nv.c,v 1.11 2005/11/14 13:41:47 macro Exp $ 10 */ 11 12 #include <linux/init.h>
··· 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 */ 9 10 #include <linux/init.h>
-2
drivers/mtd/devices/ms02-nv.h
··· 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 11 * 2 of the License, or (at your option) any later version. 12 - * 13 - * $Id: ms02-nv.h,v 1.3 2003/08/19 09:25:36 dwmw2 Exp $ 14 */ 15 16 #include <linux/ioport.h>
··· 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 11 * 2 of the License, or (at your option) any later version. 12 */ 13 14 #include <linux/ioport.h>
+121 -14
drivers/mtd/devices/mtd_dataflash.c
··· 82 83 84 struct dataflash { 85 - u8 command[4]; 86 char name[24]; 87 88 unsigned partitioned:1; ··· 150 struct spi_transfer x = { .tx_dma = 0, }; 151 struct spi_message msg; 152 unsigned blocksize = priv->page_size << 3; 153 - u8 *command; 154 155 DEBUG(MTD_DEBUG_LEVEL2, "%s: erase addr=0x%x len 0x%x\n", 156 spi->dev.bus_id, ··· 182 pageaddr = pageaddr << priv->page_offset; 183 184 command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE; 185 - command[1] = (u8)(pageaddr >> 16); 186 - command[2] = (u8)(pageaddr >> 8); 187 command[3] = 0; 188 189 DEBUG(MTD_DEBUG_LEVEL3, "ERASE %s: (%x) %x %x %x [%i]\n", ··· 234 struct spi_transfer x[2] = { { .tx_dma = 0, }, }; 235 struct spi_message msg; 236 unsigned int addr; 237 - u8 *command; 238 int status; 239 240 DEBUG(MTD_DEBUG_LEVEL2, "%s: read 0x%x..0x%x\n", ··· 274 * fewer "don't care" bytes. Both buffers stay unchanged. 275 */ 276 command[0] = OP_READ_CONTINUOUS; 277 - command[1] = (u8)(addr >> 16); 278 - command[2] = (u8)(addr >> 8); 279 - command[3] = (u8)(addr >> 0); 280 /* plus 4 "don't care" bytes */ 281 282 status = spi_sync(priv->spi, &msg); ··· 311 size_t remaining = len; 312 u_char *writebuf = (u_char *) buf; 313 int status = -EINVAL; 314 - u8 *command; 315 316 DEBUG(MTD_DEBUG_LEVEL2, "%s: write 0x%x..0x%x\n", 317 spi->dev.bus_id, (unsigned)to, (unsigned)(to + len)); ··· 487 device->write = dataflash_write; 488 device->priv = priv; 489 490 - dev_info(&spi->dev, "%s (%d KBytes)\n", name, device->size/1024); 491 dev_set_drvdata(&spi->dev, priv); 492 493 if (mtd_has_partitions()) { ··· 523 * 524 * Device Density ID code #Pages PageSize Offset 525 * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9 526 - * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1025 264 9 527 * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9 528 * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9 529 * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10 ··· 531 * AT45DB0642 64Mbit (8M) xx111xxx (0x3c) 8192 1056 11 532 * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11 533 */ 534 static int __devinit dataflash_probe(struct spi_device *spi) 535 { 536 int status; 537 538 status = dataflash_status(spi); 539 if (status <= 0 || status == 0xff) { ··· 658 status = add_dataflash(spi, "AT45DB011B", 512, 264, 9); 659 break; 660 case 0x14: /* 0 1 0 1 x x */ 661 - status = add_dataflash(spi, "AT45DB021B", 1025, 264, 9); 662 break; 663 case 0x1c: /* 0 1 1 1 x x */ 664 - status = add_dataflash(spi, "AT45DB041x", 2048, 264, 9); 665 break; 666 case 0x24: /* 1 0 0 1 x x */ 667 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9); 668 break; 669 case 0x2c: /* 1 0 1 1 x x */ 670 - status = add_dataflash(spi, "AT45DB161x", 4096, 528, 10); 671 break; 672 case 0x34: /* 1 1 0 1 x x */ 673 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10);
··· 82 83 84 struct dataflash { 85 + uint8_t command[4]; 86 char name[24]; 87 88 unsigned partitioned:1; ··· 150 struct spi_transfer x = { .tx_dma = 0, }; 151 struct spi_message msg; 152 unsigned blocksize = priv->page_size << 3; 153 + uint8_t *command; 154 155 DEBUG(MTD_DEBUG_LEVEL2, "%s: erase addr=0x%x len 0x%x\n", 156 spi->dev.bus_id, ··· 182 pageaddr = pageaddr << priv->page_offset; 183 184 command[0] = do_block ? OP_ERASE_BLOCK : OP_ERASE_PAGE; 185 + command[1] = (uint8_t)(pageaddr >> 16); 186 + command[2] = (uint8_t)(pageaddr >> 8); 187 command[3] = 0; 188 189 DEBUG(MTD_DEBUG_LEVEL3, "ERASE %s: (%x) %x %x %x [%i]\n", ··· 234 struct spi_transfer x[2] = { { .tx_dma = 0, }, }; 235 struct spi_message msg; 236 unsigned int addr; 237 + uint8_t *command; 238 int status; 239 240 DEBUG(MTD_DEBUG_LEVEL2, "%s: read 0x%x..0x%x\n", ··· 274 * fewer "don't care" bytes. Both buffers stay unchanged. 275 */ 276 command[0] = OP_READ_CONTINUOUS; 277 + command[1] = (uint8_t)(addr >> 16); 278 + command[2] = (uint8_t)(addr >> 8); 279 + command[3] = (uint8_t)(addr >> 0); 280 /* plus 4 "don't care" bytes */ 281 282 status = spi_sync(priv->spi, &msg); ··· 311 size_t remaining = len; 312 u_char *writebuf = (u_char *) buf; 313 int status = -EINVAL; 314 + uint8_t *command; 315 316 DEBUG(MTD_DEBUG_LEVEL2, "%s: write 0x%x..0x%x\n", 317 spi->dev.bus_id, (unsigned)to, (unsigned)(to + len)); ··· 487 device->write = dataflash_write; 488 device->priv = priv; 489 490 + dev_info(&spi->dev, "%s (%d KBytes) pagesize %d bytes, " 491 + "erasesize %d bytes\n", name, device->size/1024, 492 + pagesize, pagesize * 8); /* 8 pages = 1 block */ 493 dev_set_drvdata(&spi->dev, priv); 494 495 if (mtd_has_partitions()) { ··· 521 * 522 * Device Density ID code #Pages PageSize Offset 523 * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9 524 + * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1024 264 9 525 * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9 526 * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9 527 * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10 ··· 529 * AT45DB0642 64Mbit (8M) xx111xxx (0x3c) 8192 1056 11 530 * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11 531 */ 532 + 533 + struct flash_info { 534 + char *name; 535 + 536 + /* JEDEC id zero means "no ID" (most older chips); otherwise it has 537 + * a high byte of zero plus three data bytes: the manufacturer id, 538 + * then a two byte device id. 539 + */ 540 + uint32_t jedec_id; 541 + 542 + /* The size listed here is what works with OPCODE_SE, which isn't 543 + * necessarily called a "sector" by the vendor. 544 + */ 545 + unsigned nr_pages; 546 + uint16_t pagesize; 547 + uint16_t pageoffset; 548 + 549 + uint16_t flags; 550 + #define SUP_POW2PS 0x02 551 + #define IS_POW2PS 0x01 552 + }; 553 + 554 + static struct flash_info __devinitdata dataflash_data [] = { 555 + 556 + { "at45db011d", 0x1f2200, 512, 264, 9, SUP_POW2PS}, 557 + { "at45db011d", 0x1f2200, 512, 256, 8, SUP_POW2PS | IS_POW2PS}, 558 + 559 + { "at45db021d", 0x1f2300, 1024, 264, 9, SUP_POW2PS}, 560 + { "at45db021d", 0x1f2300, 1024, 256, 8, SUP_POW2PS | IS_POW2PS}, 561 + 562 + { "at45db041d", 0x1f2400, 2048, 264, 9, SUP_POW2PS}, 563 + { "at45db041d", 0x1f2400, 2048, 256, 8, SUP_POW2PS | IS_POW2PS}, 564 + 565 + { "at45db081d", 0x1f2500, 4096, 264, 9, SUP_POW2PS}, 566 + { "at45db081d", 0x1f2500, 4096, 256, 8, SUP_POW2PS | IS_POW2PS}, 567 + 568 + { "at45db161d", 0x1f2600, 4096, 528, 10, SUP_POW2PS}, 569 + { "at45db161d", 0x1f2600, 4096, 512, 9, SUP_POW2PS | IS_POW2PS}, 570 + 571 + { "at45db321c", 0x1f2700, 8192, 528, 10, }, 572 + 573 + { "at45db321d", 0x1f2701, 8192, 528, 10, SUP_POW2PS}, 574 + { "at45db321d", 0x1f2701, 8192, 512, 9, SUP_POW2PS | IS_POW2PS}, 575 + 576 + { "at45db641d", 0x1f2800, 8192, 1056, 11, SUP_POW2PS}, 577 + { "at45db641d", 0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS}, 578 + }; 579 + 580 + static struct flash_info *__devinit jedec_probe(struct spi_device *spi) 581 + { 582 + int tmp; 583 + uint8_t code = OP_READ_ID; 584 + uint8_t id[3]; 585 + uint32_t jedec; 586 + struct flash_info *info; 587 + int status; 588 + 589 + 590 + /* JEDEC also defines an optional "extended device information" 591 + * string for after vendor-specific data, after the three bytes 592 + * we use here. Supporting some chips might require using it. 593 + */ 594 + tmp = spi_write_then_read(spi, &code, 1, id, 3); 595 + if (tmp < 0) { 596 + DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n", 597 + spi->dev.bus_id, tmp); 598 + return NULL; 599 + } 600 + jedec = id[0]; 601 + jedec = jedec << 8; 602 + jedec |= id[1]; 603 + jedec = jedec << 8; 604 + jedec |= id[2]; 605 + 606 + for (tmp = 0, info = dataflash_data; 607 + tmp < ARRAY_SIZE(dataflash_data); 608 + tmp++, info++) { 609 + if (info->jedec_id == jedec) { 610 + if (info->flags & SUP_POW2PS) { 611 + status = dataflash_status(spi); 612 + if (status & 0x1) 613 + /* return power of 2 pagesize */ 614 + return ++info; 615 + else 616 + return info; 617 + } 618 + } 619 + } 620 + return NULL; 621 + } 622 + 623 static int __devinit dataflash_probe(struct spi_device *spi) 624 { 625 int status; 626 + struct flash_info *info; 627 + 628 + /* 629 + * Try to detect dataflash by JEDEC ID. 630 + * If it succeeds we know we have either a C or D part. 631 + * D will support power of 2 pagesize option. 632 + */ 633 + 634 + info = jedec_probe(spi); 635 + 636 + if (info != NULL) 637 + return add_dataflash(spi, info->name, info->nr_pages, 638 + info->pagesize, info->pageoffset); 639 + 640 641 status = dataflash_status(spi); 642 if (status <= 0 || status == 0xff) { ··· 551 status = add_dataflash(spi, "AT45DB011B", 512, 264, 9); 552 break; 553 case 0x14: /* 0 1 0 1 x x */ 554 + status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9); 555 break; 556 case 0x1c: /* 0 1 1 1 x x */ 557 + status = add_dataflash(spi, "AT45DB041B", 2048, 264, 9); 558 break; 559 case 0x24: /* 1 0 0 1 x x */ 560 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9); 561 break; 562 case 0x2c: /* 1 0 1 1 x x */ 563 + status = add_dataflash(spi, "AT45DB161B", 4096, 528, 10); 564 break; 565 case 0x34: /* 1 1 0 1 x x */ 566 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10);
-1
drivers/mtd/devices/mtdram.c
··· 1 /* 2 * mtdram - a test mtd device 3 - * $Id: mtdram.c,v 1.37 2005/04/21 03:42:11 joern Exp $ 4 * Author: Alexander Larsson <alex@cendio.se> 5 * 6 * Copyright (c) 1999 Alexander Larsson <alex@cendio.se>
··· 1 /* 2 * mtdram - a test mtd device 3 * Author: Alexander Larsson <alex@cendio.se> 4 * 5 * Copyright (c) 1999 Alexander Larsson <alex@cendio.se>
-2
drivers/mtd/devices/phram.c
··· 1 /** 2 - * $Id: phram.c,v 1.16 2005/11/07 11:14:25 gleixner Exp $ 3 - * 4 * Copyright (c) ???? Jochen Schäuble <psionic@psionic.de> 5 * Copyright (c) 2003-2004 Joern Engel <joern@wh.fh-wedel.de> 6 *
··· 1 /** 2 * Copyright (c) ???? Jochen Schäuble <psionic@psionic.de> 3 * Copyright (c) 2003-2004 Joern Engel <joern@wh.fh-wedel.de> 4 *
-2
drivers/mtd/devices/pmc551.c
··· 1 /* 2 - * $Id: pmc551.c,v 1.32 2005/11/07 11:14:25 gleixner Exp $ 3 - * 4 * PMC551 PCI Mezzanine Ram Device 5 * 6 * Author:
··· 1 /* 2 * PMC551 PCI Mezzanine Ram Device 3 * 4 * Author:
-2
drivers/mtd/devices/slram.c
··· 1 /*====================================================================== 2 3 - $Id: slram.c,v 1.36 2005/11/07 11:14:25 gleixner Exp $ 4 - 5 This driver provides a method to access memory not used by the kernel 6 itself (i.e. if the kernel commandline mem=xxx is used). To actually 7 use slram at least mtdblock or mtdchar is required (for block or
··· 1 /*====================================================================== 2 3 This driver provides a method to access memory not used by the kernel 4 itself (i.e. if the kernel commandline mem=xxx is used). To actually 5 use slram at least mtdblock or mtdchar is required (for block or
-3
drivers/mtd/ftl.c
··· 1 /* This version ported to the Linux-MTD system by dwmw2@infradead.org 2 - * $Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $ 3 * 4 * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 5 * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups ··· 1077 1078 static int init_ftl(void) 1079 { 1080 - DEBUG(0, "$Id: ftl.c,v 1.59 2005/11/29 14:48:31 gleixner Exp $\n"); 1081 - 1082 return register_mtd_blktrans(&ftl_tr); 1083 } 1084
··· 1 /* This version ported to the Linux-MTD system by dwmw2@infradead.org 2 * 3 * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 4 * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups ··· 1078 1079 static int init_ftl(void) 1080 { 1081 return register_mtd_blktrans(&ftl_tr); 1082 } 1083
-5
drivers/mtd/inftlcore.c
··· 7 * (c) 1999 Machine Vision Holdings, Inc. 8 * Author: David Woodhouse <dwmw2@infradead.org> 9 * 10 - * $Id: inftlcore.c,v 1.19 2005/11/07 11:14:20 gleixner Exp $ 11 - * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or ··· 951 952 static int __init init_inftl(void) 953 { 954 - printk(KERN_INFO "INFTL: inftlcore.c $Revision: 1.19 $, " 955 - "inftlmount.c %s\n", inftlmountrev); 956 - 957 return register_mtd_blktrans(&inftl_tr); 958 } 959
··· 7 * (c) 1999 Machine Vision Holdings, Inc. 8 * Author: David Woodhouse <dwmw2@infradead.org> 9 * 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 12 * the Free Software Foundation; either version 2 of the License, or ··· 953 954 static int __init init_inftl(void) 955 { 956 return register_mtd_blktrans(&inftl_tr); 957 } 958
-4
drivers/mtd/inftlmount.c
··· 8 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 9 * Copyright (C) 2000 Netgem S.A. 10 * 11 - * $Id: inftlmount.c,v 1.18 2005/11/07 11:14:20 gleixner Exp $ 12 - * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by 15 * the Free Software Foundation; either version 2 of the License, or ··· 36 #include <linux/mtd/nftl.h> 37 #include <linux/mtd/inftl.h> 38 #include <linux/mtd/compatmac.h> 39 - 40 - char inftlmountrev[]="$Revision: 1.18 $"; 41 42 /* 43 * find_boot_record: Find the INFTL Media Header and its Spare copy which
··· 8 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 9 * Copyright (C) 2000 Netgem S.A. 10 * 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 13 * the Free Software Foundation; either version 2 of the License, or ··· 38 #include <linux/mtd/nftl.h> 39 #include <linux/mtd/inftl.h> 40 #include <linux/mtd/compatmac.h> 41 42 /* 43 * find_boot_record: Find the INFTL Media Header and its Spare copy which
+11 -19
drivers/mtd/maps/Kconfig
··· 1 # drivers/mtd/maps/Kconfig 2 - # $Id: Kconfig,v 1.61 2005/11/07 11:14:26 gleixner Exp $ 3 4 menu "Mapping drivers for chip access" 5 depends on MTD!=n ··· 509 510 If unsure, say N. 511 512 config MTD_UCLINUX 513 tristate "Generic uClinux RAM/ROM filesystem support" 514 depends on MTD_PARTITIONS && !MMU ··· 548 select MTD_CFI_AMDSTD 549 help 550 Map driver for Dy-4 SVME/DMV-182 board. 551 - 552 - config MTD_BAST 553 - tristate "Map driver for Simtec BAST (EB2410ITX) or Thorcom VR1000" 554 - depends on ARCH_BAST || MACH_VR1000 555 - select MTD_PARTITIONS 556 - select MTD_MAP_BANK_WIDTH_16 557 - select MTD_JEDECPROBE 558 - help 559 - Map driver for NOR flash on the Simtec BAST (EB2410ITX), or the 560 - Thorcom VR1000 561 - 562 - Note, this driver *cannot* over-ride the WP link on the 563 - board, or currently detect the state of the link. 564 - 565 - config MTD_BAST_MAXSIZE 566 - int "Maximum size for BAST flash area (MiB)" 567 - depends on MTD_BAST 568 - default "4" 569 570 config MTD_SHARP_SL 571 tristate "ROM mapped on Sharp SL Series"
··· 1 # drivers/mtd/maps/Kconfig 2 3 menu "Mapping drivers for chip access" 4 depends on MTD!=n ··· 510 511 If unsure, say N. 512 513 + config MTD_BFIN_ASYNC 514 + tristate "Blackfin BF533-STAMP Flash Chip Support" 515 + depends on BFIN533_STAMP && MTD_CFI 516 + select MTD_PARTITIONS 517 + default y 518 + help 519 + Map driver which allows for simultaneous utilization of 520 + ethernet and CFI parallel flash. 521 + 522 + If compiled as a module, it will be called bfin-async-flash. 523 + 524 config MTD_UCLINUX 525 tristate "Generic uClinux RAM/ROM filesystem support" 526 depends on MTD_PARTITIONS && !MMU ··· 538 select MTD_CFI_AMDSTD 539 help 540 Map driver for Dy-4 SVME/DMV-182 board. 541 542 config MTD_SHARP_SL 543 tristate "ROM mapped on Sharp SL Series"
+1 -2
drivers/mtd/maps/Makefile
··· 1 # 2 # linux/drivers/maps/Makefile 3 # 4 - # $Id: Makefile.common,v 1.34 2005/11/07 11:14:26 gleixner Exp $ 5 6 ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y) 7 obj-$(CONFIG_MTD) += map_funcs.o ··· 9 # Chip mappings 10 obj-$(CONFIG_MTD_CDB89712) += cdb89712.o 11 obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o 12 - obj-$(CONFIG_MTD_BAST) += bast-flash.o 13 obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o 14 obj-$(CONFIG_MTD_DC21285) += dc21285.o 15 obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o ··· 64 obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 65 obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o 66 obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o
··· 1 # 2 # linux/drivers/maps/Makefile 3 # 4 5 ifeq ($(CONFIG_MTD_COMPLEX_MAPPINGS),y) 6 obj-$(CONFIG_MTD) += map_funcs.o ··· 10 # Chip mappings 11 obj-$(CONFIG_MTD_CDB89712) += cdb89712.o 12 obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o 13 obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o 14 obj-$(CONFIG_MTD_DC21285) += dc21285.o 15 obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o ··· 66 obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 67 obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o 68 obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o 69 + obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o
-1
drivers/mtd/maps/amd76xrom.c
··· 2 * amd76xrom.c 3 * 4 * Normal mappings of chips in physical memory 5 - * $Id: amd76xrom.c,v 1.21 2005/11/07 11:14:26 gleixner Exp $ 6 */ 7 8 #include <linux/module.h>
··· 2 * amd76xrom.c 3 * 4 * Normal mappings of chips in physical memory 5 */ 6 7 #include <linux/module.h>
-2
drivers/mtd/maps/autcpu12-nvram.c
··· 2 * NV-RAM memory access on autcpu12 3 * (C) 2002 Thomas Gleixner (gleixner@autronix.de) 4 * 5 - * $Id: autcpu12-nvram.c,v 1.9 2005/11/07 11:14:26 gleixner Exp $ 6 - * 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 9 * the Free Software Foundation; either version 2 of the License, or
··· 2 * NV-RAM memory access on autcpu12 3 * (C) 2002 Thomas Gleixner (gleixner@autronix.de) 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or
-226
drivers/mtd/maps/bast-flash.c
··· 1 - /* linux/drivers/mtd/maps/bast-flash.c 2 - * 3 - * Copyright (c) 2004-2005 Simtec Electronics 4 - * Ben Dooks <ben@simtec.co.uk> 5 - * 6 - * Simtec Bast (EB2410ITX) NOR MTD Mapping driver 7 - * 8 - * Changelog: 9 - * 20-Sep-2004 BJD Initial version 10 - * 17-Jan-2005 BJD Add whole device if no partitions found 11 - * 12 - * $Id: bast-flash.c,v 1.5 2005/11/07 11:14:26 gleixner Exp $ 13 - * 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 16 - * the Free Software Foundation; either version 2 of the License, or 17 - * (at your option) any later version. 18 - * 19 - * This program is distributed in the hope that it will be useful, 20 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 - * GNU General Public License for more details. 23 - * 24 - * You should have received a copy of the GNU General Public License 25 - * along with this program; if not, write to the Free Software 26 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 - */ 28 - 29 - #include <linux/module.h> 30 - #include <linux/types.h> 31 - #include <linux/init.h> 32 - #include <linux/kernel.h> 33 - #include <linux/string.h> 34 - #include <linux/ioport.h> 35 - #include <linux/device.h> 36 - #include <linux/slab.h> 37 - #include <linux/platform_device.h> 38 - #include <linux/mtd/mtd.h> 39 - #include <linux/mtd/map.h> 40 - #include <linux/mtd/partitions.h> 41 - 42 - #include <asm/io.h> 43 - #include <asm/mach/flash.h> 44 - 45 - #include <asm/arch/map.h> 46 - #include <asm/arch/bast-map.h> 47 - #include <asm/arch/bast-cpld.h> 48 - 49 - #ifdef CONFIG_MTD_BAST_MAXSIZE 50 - #define AREA_MAXSIZE (CONFIG_MTD_BAST_MAXSIZE * SZ_1M) 51 - #else 52 - #define AREA_MAXSIZE (32 * SZ_1M) 53 - #endif 54 - 55 - #define PFX "bast-flash: " 56 - 57 - struct bast_flash_info { 58 - struct mtd_info *mtd; 59 - struct map_info map; 60 - struct mtd_partition *partitions; 61 - struct resource *area; 62 - }; 63 - 64 - static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; 65 - 66 - static void bast_flash_setrw(int to) 67 - { 68 - unsigned int val; 69 - unsigned long flags; 70 - 71 - local_irq_save(flags); 72 - val = __raw_readb(BAST_VA_CTRL3); 73 - 74 - if (to) 75 - val |= BAST_CPLD_CTRL3_ROMWEN; 76 - else 77 - val &= ~BAST_CPLD_CTRL3_ROMWEN; 78 - 79 - pr_debug("new cpld ctrl3=%02x\n", val); 80 - 81 - __raw_writeb(val, BAST_VA_CTRL3); 82 - local_irq_restore(flags); 83 - } 84 - 85 - static int bast_flash_remove(struct platform_device *pdev) 86 - { 87 - struct bast_flash_info *info = platform_get_drvdata(pdev); 88 - 89 - platform_set_drvdata(pdev, NULL); 90 - 91 - if (info == NULL) 92 - return 0; 93 - 94 - if (info->map.virt != NULL) 95 - iounmap(info->map.virt); 96 - 97 - if (info->mtd) { 98 - del_mtd_partitions(info->mtd); 99 - map_destroy(info->mtd); 100 - } 101 - 102 - kfree(info->partitions); 103 - 104 - if (info->area) { 105 - release_resource(info->area); 106 - kfree(info->area); 107 - } 108 - 109 - kfree(info); 110 - 111 - return 0; 112 - } 113 - 114 - static int bast_flash_probe(struct platform_device *pdev) 115 - { 116 - struct bast_flash_info *info; 117 - struct resource *res; 118 - int err = 0; 119 - 120 - info = kmalloc(sizeof(*info), GFP_KERNEL); 121 - if (info == NULL) { 122 - printk(KERN_ERR PFX "no memory for flash info\n"); 123 - err = -ENOMEM; 124 - goto exit_error; 125 - } 126 - 127 - memzero(info, sizeof(*info)); 128 - platform_set_drvdata(pdev, info); 129 - 130 - res = pdev->resource; /* assume that the flash has one resource */ 131 - 132 - info->map.phys = res->start; 133 - info->map.size = res->end - res->start + 1; 134 - info->map.name = pdev->dev.bus_id; 135 - info->map.bankwidth = 2; 136 - 137 - if (info->map.size > AREA_MAXSIZE) 138 - info->map.size = AREA_MAXSIZE; 139 - 140 - pr_debug("%s: area %08lx, size %ld\n", __func__, 141 - info->map.phys, info->map.size); 142 - 143 - info->area = request_mem_region(res->start, info->map.size, 144 - pdev->name); 145 - if (info->area == NULL) { 146 - printk(KERN_ERR PFX "cannot reserve flash memory region\n"); 147 - err = -ENOENT; 148 - goto exit_error; 149 - } 150 - 151 - info->map.virt = ioremap(res->start, info->map.size); 152 - pr_debug("%s: virt at %08x\n", __func__, (int)info->map.virt); 153 - 154 - if (info->map.virt == 0) { 155 - printk(KERN_ERR PFX "failed to ioremap() region\n"); 156 - err = -EIO; 157 - goto exit_error; 158 - } 159 - 160 - simple_map_init(&info->map); 161 - 162 - /* enable the write to the flash area */ 163 - 164 - bast_flash_setrw(1); 165 - 166 - /* probe for the device(s) */ 167 - 168 - info->mtd = do_map_probe("jedec_probe", &info->map); 169 - if (info->mtd == NULL) 170 - info->mtd = do_map_probe("cfi_probe", &info->map); 171 - 172 - if (info->mtd == NULL) { 173 - printk(KERN_ERR PFX "map_probe() failed\n"); 174 - err = -ENXIO; 175 - goto exit_error; 176 - } 177 - 178 - /* mark ourselves as the owner */ 179 - info->mtd->owner = THIS_MODULE; 180 - 181 - err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); 182 - if (err > 0) { 183 - err = add_mtd_partitions(info->mtd, info->partitions, err); 184 - if (err) 185 - printk(KERN_ERR PFX "cannot add/parse partitions\n"); 186 - } else { 187 - err = add_mtd_device(info->mtd); 188 - } 189 - 190 - if (err == 0) 191 - return 0; 192 - 193 - /* fall through to exit error */ 194 - 195 - exit_error: 196 - bast_flash_remove(pdev); 197 - return err; 198 - } 199 - 200 - static struct platform_driver bast_flash_driver = { 201 - .probe = bast_flash_probe, 202 - .remove = bast_flash_remove, 203 - .driver = { 204 - .name = "bast-nor", 205 - .owner = THIS_MODULE, 206 - }, 207 - }; 208 - 209 - static int __init bast_flash_init(void) 210 - { 211 - printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); 212 - return platform_driver_register(&bast_flash_driver); 213 - } 214 - 215 - static void __exit bast_flash_exit(void) 216 - { 217 - platform_driver_unregister(&bast_flash_driver); 218 - } 219 - 220 - module_init(bast_flash_init); 221 - module_exit(bast_flash_exit); 222 - 223 - MODULE_LICENSE("GPL"); 224 - MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 225 - MODULE_DESCRIPTION("BAST MTD Map driver"); 226 - MODULE_ALIAS("platform:bast-nor");
···
+219
drivers/mtd/maps/bfin-async-flash.c
···
··· 1 + /* 2 + * drivers/mtd/maps/bfin-async-flash.c 3 + * 4 + * Handle the case where flash memory and ethernet mac/phy are 5 + * mapped onto the same async bank. The BF533-STAMP does this 6 + * for example. All board-specific configuration goes in your 7 + * board resources file. 8 + * 9 + * Copyright 2000 Nicolas Pitre <nico@cam.org> 10 + * Copyright 2005-2008 Analog Devices Inc. 11 + * 12 + * Enter bugs at http://blackfin.uclinux.org/ 13 + * 14 + * Licensed under the GPL-2 or later. 15 + */ 16 + 17 + #include <linux/init.h> 18 + #include <linux/kernel.h> 19 + #include <linux/module.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 + #include <linux/platform_device.h> 25 + #include <linux/types.h> 26 + 27 + #include <asm/blackfin.h> 28 + #include <linux/gpio.h> 29 + #include <linux/io.h> 30 + #include <asm/unaligned.h> 31 + 32 + #define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) 33 + 34 + #define DRIVER_NAME "bfin-async-flash" 35 + 36 + struct async_state { 37 + struct mtd_info *mtd; 38 + struct map_info map; 39 + int enet_flash_pin; 40 + uint32_t flash_ambctl0, flash_ambctl1; 41 + uint32_t save_ambctl0, save_ambctl1; 42 + unsigned long irq_flags; 43 + }; 44 + 45 + static void switch_to_flash(struct async_state *state) 46 + { 47 + local_irq_save(state->irq_flags); 48 + 49 + gpio_set_value(state->enet_flash_pin, 0); 50 + 51 + state->save_ambctl0 = bfin_read_EBIU_AMBCTL0(); 52 + state->save_ambctl1 = bfin_read_EBIU_AMBCTL1(); 53 + bfin_write_EBIU_AMBCTL0(state->flash_ambctl0); 54 + bfin_write_EBIU_AMBCTL1(state->flash_ambctl1); 55 + SSYNC(); 56 + } 57 + 58 + static void switch_back(struct async_state *state) 59 + { 60 + bfin_write_EBIU_AMBCTL0(state->save_ambctl0); 61 + bfin_write_EBIU_AMBCTL1(state->save_ambctl1); 62 + SSYNC(); 63 + 64 + gpio_set_value(state->enet_flash_pin, 1); 65 + 66 + local_irq_restore(state->irq_flags); 67 + } 68 + 69 + static map_word bfin_read(struct map_info *map, unsigned long ofs) 70 + { 71 + struct async_state *state = (struct async_state *)map->map_priv_1; 72 + uint16_t word; 73 + map_word test; 74 + 75 + switch_to_flash(state); 76 + 77 + word = readw(map->virt + ofs); 78 + 79 + switch_back(state); 80 + 81 + test.x[0] = word; 82 + return test; 83 + } 84 + 85 + static void bfin_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) 86 + { 87 + struct async_state *state = (struct async_state *)map->map_priv_1; 88 + 89 + switch_to_flash(state); 90 + 91 + memcpy(to, map->virt + from, len); 92 + 93 + switch_back(state); 94 + } 95 + 96 + static void bfin_write(struct map_info *map, map_word d1, unsigned long ofs) 97 + { 98 + struct async_state *state = (struct async_state *)map->map_priv_1; 99 + uint16_t d; 100 + 101 + d = d1.x[0]; 102 + 103 + switch_to_flash(state); 104 + 105 + writew(d, map->virt + ofs); 106 + SSYNC(); 107 + 108 + switch_back(state); 109 + } 110 + 111 + static void bfin_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) 112 + { 113 + struct async_state *state = (struct async_state *)map->map_priv_1; 114 + 115 + switch_to_flash(state); 116 + 117 + memcpy(map->virt + to, from, len); 118 + SSYNC(); 119 + 120 + switch_back(state); 121 + } 122 + 123 + #ifdef CONFIG_MTD_PARTITIONS 124 + static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; 125 + #endif 126 + 127 + static int __devinit bfin_flash_probe(struct platform_device *pdev) 128 + { 129 + int ret; 130 + struct physmap_flash_data *pdata = pdev->dev.platform_data; 131 + struct resource *memory = platform_get_resource(pdev, IORESOURCE_MEM, 0); 132 + struct resource *flash_ambctl = platform_get_resource(pdev, IORESOURCE_MEM, 1); 133 + struct async_state *state; 134 + 135 + state = kzalloc(sizeof(*state), GFP_KERNEL); 136 + if (!state) 137 + return -ENOMEM; 138 + 139 + state->map.name = DRIVER_NAME; 140 + state->map.read = bfin_read; 141 + state->map.copy_from = bfin_copy_from; 142 + state->map.write = bfin_write; 143 + state->map.copy_to = bfin_copy_to; 144 + state->map.bankwidth = pdata->width; 145 + state->map.size = memory->end - memory->start + 1; 146 + state->map.virt = (void __iomem *)memory->start; 147 + state->map.phys = memory->start; 148 + state->map.map_priv_1 = (unsigned long)state; 149 + state->enet_flash_pin = platform_get_irq(pdev, 0); 150 + state->flash_ambctl0 = flash_ambctl->start; 151 + state->flash_ambctl1 = flash_ambctl->end; 152 + 153 + if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) { 154 + pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin); 155 + return -EBUSY; 156 + } 157 + gpio_direction_output(state->enet_flash_pin, 1); 158 + 159 + pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8); 160 + state->mtd = do_map_probe(memory->name, &state->map); 161 + if (!state->mtd) 162 + return -ENXIO; 163 + 164 + #ifdef CONFIG_MTD_PARTITIONS 165 + ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); 166 + if (ret > 0) { 167 + pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); 168 + add_mtd_partitions(state->mtd, pdata->parts, ret); 169 + 170 + } else if (pdata->nr_parts) { 171 + pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); 172 + add_mtd_partitions(state->mtd, pdata->parts, pdata->nr_parts); 173 + 174 + } else 175 + #endif 176 + { 177 + pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n"); 178 + add_mtd_device(state->mtd); 179 + } 180 + 181 + platform_set_drvdata(pdev, state); 182 + 183 + return 0; 184 + } 185 + 186 + static int __devexit bfin_flash_remove(struct platform_device *pdev) 187 + { 188 + struct async_state *state = platform_get_drvdata(pdev); 189 + gpio_free(state->enet_flash_pin); 190 + #ifdef CONFIG_MTD_PARTITIONS 191 + del_mtd_partitions(state->mtd); 192 + #endif 193 + map_destroy(state->mtd); 194 + kfree(state); 195 + return 0; 196 + } 197 + 198 + static struct platform_driver bfin_flash_driver = { 199 + .probe = bfin_flash_probe, 200 + .remove = __devexit_p(bfin_flash_remove), 201 + .driver = { 202 + .name = DRIVER_NAME, 203 + }, 204 + }; 205 + 206 + static int __init bfin_flash_init(void) 207 + { 208 + return platform_driver_register(&bfin_flash_driver); 209 + } 210 + module_init(bfin_flash_init); 211 + 212 + static void __exit bfin_flash_exit(void) 213 + { 214 + platform_driver_unregister(&bfin_flash_driver); 215 + } 216 + module_exit(bfin_flash_exit); 217 + 218 + MODULE_LICENSE("GPL"); 219 + MODULE_DESCRIPTION("MTD map driver for Blackfins with flash/ethernet on same async bank");
-1
drivers/mtd/maps/cdb89712.c
··· 1 /* 2 * Flash on Cirrus CDB89712 3 * 4 - * $Id: cdb89712.c,v 1.11 2005/11/07 11:14:26 gleixner Exp $ 5 */ 6 7 #include <linux/module.h>
··· 1 /* 2 * Flash on Cirrus CDB89712 3 * 4 */ 5 6 #include <linux/module.h>
-1
drivers/mtd/maps/ceiva.c
··· 11 * 12 * (C) 2000 Nicolas Pitre <nico@cam.org> 13 * 14 - * $Id: ceiva.c,v 1.11 2004/09/16 23:27:12 gleixner Exp $ 15 */ 16 17 #include <linux/module.h>
··· 11 * 12 * (C) 2000 Nicolas Pitre <nico@cam.org> 13 * 14 */ 15 16 #include <linux/module.h>
-2
drivers/mtd/maps/cfi_flagadm.c
··· 1 /* 2 * Copyright © 2001 Flaga hf. Medical Devices, Kári Davíðsson <kd@flaga.is> 3 * 4 - * $Id: cfi_flagadm.c,v 1.15 2005/11/07 11:14:26 gleixner Exp $ 5 - * 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 8 * Free Software Foundation; either version 2 of the License, or (at your
··· 1 /* 2 * Copyright © 2001 Flaga hf. Medical Devices, Kári Davíðsson <kd@flaga.is> 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License as published by the 6 * Free Software Foundation; either version 2 of the License, or (at your
-2
drivers/mtd/maps/dbox2-flash.c
··· 1 /* 2 - * $Id: dbox2-flash.c,v 1.14 2005/11/07 11:14:26 gleixner Exp $ 3 - * 4 * D-Box 2 flash driver 5 */ 6
··· 1 /* 2 * D-Box 2 flash driver 3 */ 4
-2
drivers/mtd/maps/dc21285.c
··· 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 5 * 6 * This code is GPL 7 - * 8 - * $Id: dc21285.c,v 1.24 2005/11/07 11:14:26 gleixner Exp $ 9 */ 10 #include <linux/module.h> 11 #include <linux/types.h>
··· 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 5 * 6 * This code is GPL 7 */ 8 #include <linux/module.h> 9 #include <linux/types.h>
-2
drivers/mtd/maps/dilnetpc.c
··· 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 16 * 17 - * $Id: dilnetpc.c,v 1.20 2005/11/07 11:14:26 gleixner Exp $ 18 - * 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 21 * board: DNP/1486 and ADNP/1486. The DNP version has 2 megs of flash
··· 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 16 * 17 * The DIL/Net PC is a tiny embedded PC board made by SSV Embedded Systems 18 * featuring the AMD Elan SC410 processor. There are two variants of this 19 * board: DNP/1486 and ADNP/1486. The DNP version has 2 megs of flash
-2
drivers/mtd/maps/dmv182.c
··· 4 * 5 * Flash map driver for the Dy4 SVME182 board 6 * 7 - * $Id: dmv182.c,v 1.6 2005/11/07 11:14:26 gleixner Exp $ 8 - * 9 * Copyright 2003-2004, TimeSys Corporation 10 * 11 * Based on the SVME181 flash map, by Tom Nelson, Dot4, Inc. for TimeSys Corp.
··· 4 * 5 * Flash map driver for the Dy4 SVME182 board 6 * 7 * Copyright 2003-2004, TimeSys Corporation 8 * 9 * Based on the SVME181 flash map, by Tom Nelson, Dot4, Inc. for TimeSys Corp.
-2
drivers/mtd/maps/ebony.c
··· 1 /* 2 - * $Id: ebony.c,v 1.16 2005/11/07 11:14:26 gleixner Exp $ 3 - * 4 * Mapping for Ebony user flash 5 * 6 * Matt Porter <mporter@kernel.crashing.org>
··· 1 /* 2 * Mapping for Ebony user flash 3 * 4 * Matt Porter <mporter@kernel.crashing.org>
-2
drivers/mtd/maps/edb7312.c
··· 1 /* 2 - * $Id: edb7312.c,v 1.14 2005/11/07 11:14:27 gleixner Exp $ 3 - * 4 * Handle mapping of the NOR flash on Cogent EDB7312 boards 5 * 6 * Copyright 2002 SYSGO Real-Time Solutions GmbH
··· 1 /* 2 * Handle mapping of the NOR flash on Cogent EDB7312 boards 3 * 4 * Copyright 2002 SYSGO Real-Time Solutions GmbH
-1
drivers/mtd/maps/fortunet.c
··· 1 /* fortunet.c memory map 2 * 3 - * $Id: fortunet.c,v 1.11 2005/11/07 11:14:27 gleixner Exp $ 4 */ 5 6 #include <linux/module.h>
··· 1 /* fortunet.c memory map 2 * 3 */ 4 5 #include <linux/module.h>
-2
drivers/mtd/maps/h720x-flash.c
··· 2 * Flash memory access on Hynix GMS30C7201/HMS30C7202 based 3 * evaluation boards 4 * 5 - * $Id: h720x-flash.c,v 1.12 2005/11/07 11:14:27 gleixner Exp $ 6 - * 7 * (C) 2002 Jungjun Kim <jungjun.kim@hynix.com> 8 * 2003 Thomas Gleixner <tglx@linutronix.de> 9 */
··· 2 * Flash memory access on Hynix GMS30C7201/HMS30C7202 based 3 * evaluation boards 4 * 5 * (C) 2002 Jungjun Kim <jungjun.kim@hynix.com> 6 * 2003 Thomas Gleixner <tglx@linutronix.de> 7 */
-1
drivers/mtd/maps/ichxrom.c
··· 2 * ichxrom.c 3 * 4 * Normal mappings of chips in physical memory 5 - * $Id: ichxrom.c,v 1.19 2005/11/07 11:14:27 gleixner Exp $ 6 */ 7 8 #include <linux/module.h>
··· 2 * ichxrom.c 3 * 4 * Normal mappings of chips in physical memory 5 */ 6 7 #include <linux/module.h>
-2
drivers/mtd/maps/impa7.c
··· 1 /* 2 - * $Id: impa7.c,v 1.14 2005/11/07 11:14:27 gleixner Exp $ 3 - * 4 * Handle mapping of the NOR flash on implementa A7 boards 5 * 6 * Copyright 2002 SYSGO Real-Time Solutions GmbH
··· 1 /* 2 * Handle mapping of the NOR flash on implementa A7 boards 3 * 4 * Copyright 2002 SYSGO Real-Time Solutions GmbH
-2
drivers/mtd/maps/integrator-flash.c
··· 22 This is access code for flashes using ARM's flash partitioning 23 standards. 24 25 - $Id: integrator-flash.c,v 1.20 2005/11/07 11:14:27 gleixner Exp $ 26 - 27 ======================================================================*/ 28 29 #include <linux/module.h>
··· 22 This is access code for flashes using ARM's flash partitioning 23 standards. 24 25 ======================================================================*/ 26 27 #include <linux/module.h>
-2
drivers/mtd/maps/ipaq-flash.c
··· 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 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 7 - * 8 - * $Id: ipaq-flash.c,v 1.5 2005/11/07 11:14:27 gleixner Exp $ 9 */ 10 11 #include <linux/module.h>
··· 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 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 7 */ 8 9 #include <linux/module.h>
-2
drivers/mtd/maps/ixp2000.c
··· 1 /* 2 - * $Id: ixp2000.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $ 3 - * 4 * drivers/mtd/maps/ixp2000.c 5 * 6 * Mapping for the Intel XScale IXP2000 based systems
··· 1 /* 2 * drivers/mtd/maps/ixp2000.c 3 * 4 * Mapping for the Intel XScale IXP2000 based systems
-2
drivers/mtd/maps/ixp4xx.c
··· 1 /* 2 - * $Id: ixp4xx.c,v 1.13 2005/11/16 16:23:21 dvrabel Exp $ 3 - * 4 * drivers/mtd/maps/ixp4xx.c 5 * 6 * MTD Map file for IXP4XX based systems. Please do not make per-board
··· 1 /* 2 * drivers/mtd/maps/ixp4xx.c 3 * 4 * MTD Map file for IXP4XX based systems. Please do not make per-board
-2
drivers/mtd/maps/l440gx.c
··· 1 /* 2 - * $Id: l440gx.c,v 1.18 2005/11/07 11:14:27 gleixner Exp $ 3 - * 4 * BIOS Flash chip on Intel 440GX board. 5 * 6 * Bugs this currently does not work under linuxBIOS.
··· 1 /* 2 * BIOS Flash chip on Intel 440GX board. 3 * 4 * Bugs this currently does not work under linuxBIOS.
-2
drivers/mtd/maps/map_funcs.c
··· 1 /* 2 - * $Id: map_funcs.c,v 1.10 2005/06/06 23:04:36 tpoynor Exp $ 3 - * 4 * Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS 5 * is enabled. 6 */
··· 1 /* 2 * Out-of-line map I/O functions for simple maps when CONFIG_COMPLEX_MAPPINGS 3 * is enabled. 4 */
-2
drivers/mtd/maps/mbx860.c
··· 1 /* 2 - * $Id: mbx860.c,v 1.9 2005/11/07 11:14:27 gleixner Exp $ 3 - * 4 * Handle mapping of the flash on MBX860 boards 5 * 6 * Author: Anton Todorov
··· 1 /* 2 * Handle mapping of the flash on MBX860 boards 3 * 4 * Author: Anton Todorov
-2
drivers/mtd/maps/netsc520.c
··· 3 * Copyright (C) 2001 Mark Langsdorf (mark.langsdorf@amd.com) 4 * based on sc520cdp.c by Sysgo Real-Time Solutions GmbH 5 * 6 - * $Id: netsc520.c,v 1.14 2005/11/07 11:14:27 gleixner Exp $ 7 - * 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 10 * the Free Software Foundation; either version 2 of the License, or
··· 3 * Copyright (C) 2001 Mark Langsdorf (mark.langsdorf@amd.com) 4 * based on sc520cdp.c by Sysgo Real-Time Solutions GmbH 5 * 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 8 * the Free Software Foundation; either version 2 of the License, or
-2
drivers/mtd/maps/nettel.c
··· 5 * 6 * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) 7 * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) 8 - * 9 - * $Id: nettel.c,v 1.12 2005/11/29 14:30:00 gleixner Exp $ 10 */ 11 12 /****************************************************************************/
··· 5 * 6 * (C) Copyright 2000-2001, Greg Ungerer (gerg@snapgear.com) 7 * (C) Copyright 2001-2002, SnapGear (www.snapgear.com) 8 */ 9 10 /****************************************************************************/
-1
drivers/mtd/maps/octagon-5066.c
··· 1 - // $Id: octagon-5066.c,v 1.28 2005/11/07 11:14:27 gleixner Exp $ 2 /* ###################################################################### 3 4 Octagon 5066 MTD Driver.
··· 1 /* ###################################################################### 2 3 Octagon 5066 MTD Driver.
-2
drivers/mtd/maps/omap-toto-flash.c
··· 4 * jzhang@ti.com (C) 2003 Texas Instruments. 5 * 6 * (C) 2002 MontVista Software, Inc. 7 - * 8 - * $Id: omap-toto-flash.c,v 1.5 2005/11/07 11:14:27 gleixner Exp $ 9 */ 10 11 #include <linux/module.h>
··· 4 * jzhang@ti.com (C) 2003 Texas Instruments. 5 * 6 * (C) 2002 MontVista Software, Inc. 7 */ 8 9 #include <linux/module.h>
-2
drivers/mtd/maps/pci.c
··· 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. 9 * 10 - * $Id: pci.c,v 1.14 2005/11/17 08:20:27 dwmw2 Exp $ 11 - * 12 * Generic PCI memory map driver. We support the following boards: 13 * - Intel IQ80310 ATU. 14 * - Intel EBSA285 (blank rom programming mode). Tested working 27/09/2001
··· 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. 9 * 10 * Generic PCI memory map driver. We support the following boards: 11 * - Intel IQ80310 ATU. 12 * - Intel EBSA285 (blank rom programming mode). Tested working 27/09/2001
+1 -4
drivers/mtd/maps/pcmciamtd.c
··· 1 /* 2 - * $Id: pcmciamtd.c,v 1.55 2005/11/07 11:14:28 gleixner Exp $ 3 - * 4 * pcmciamtd.c - MTD driver for PCMCIA flash memory cards 5 * 6 * Author: Simon Evans <spse@secret.org.uk> ··· 46 47 48 #define DRIVER_DESC "PCMCIA Flash memory card driver" 49 - #define DRIVER_VERSION "$Revision: 1.55 $" 50 51 /* Size of the PCMCIA address space: 26 bits = 64 MB */ 52 #define MAX_PCMCIA_ADDR 0x4000000 ··· 782 783 static int __init init_pcmciamtd(void) 784 { 785 - info(DRIVER_DESC " " DRIVER_VERSION); 786 787 if(bankwidth && bankwidth != 1 && bankwidth != 2) { 788 info("bad bankwidth (%d), using default", bankwidth);
··· 1 /* 2 * pcmciamtd.c - MTD driver for PCMCIA flash memory cards 3 * 4 * Author: Simon Evans <spse@secret.org.uk> ··· 48 49 50 #define DRIVER_DESC "PCMCIA Flash memory card driver" 51 52 /* Size of the PCMCIA address space: 26 bits = 64 MB */ 53 #define MAX_PCMCIA_ADDR 0x4000000 ··· 785 786 static int __init init_pcmciamtd(void) 787 { 788 + info(DRIVER_DESC); 789 790 if(bankwidth && bankwidth != 1 && bankwidth != 2) { 791 info("bad bankwidth (%d), using default", bankwidth);
+18 -6
drivers/mtd/maps/physmap.c
··· 1 /* 2 - * $Id: physmap.c,v 1.39 2005/11/29 14:49:36 gleixner Exp $ 3 - * 4 * Normal mappings of chips in physical memory 5 * 6 * Copyright (C) 2003 MontaVista Software Inc. ··· 201 int i; 202 203 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 204 - ret |= info->mtd[i]->suspend(info->mtd[i]); 205 206 return ret; 207 } ··· 224 int i; 225 226 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 227 - info->mtd[i]->resume(info->mtd[i]); 228 229 return 0; 230 } ··· 236 int i; 237 238 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 239 - if (info->mtd[i]->suspend(info->mtd[i]) == 0) 240 - info->mtd[i]->resume(info->mtd[i]); 241 } 242 #else 243 #define physmap_flash_suspend NULL
··· 1 /* 2 * Normal mappings of chips in physical memory 3 * 4 * Copyright (C) 2003 MontaVista Software Inc. ··· 203 int i; 204 205 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 206 + if (info->mtd[i]->suspend) { 207 + ret = info->mtd[i]->suspend(info->mtd[i]); 208 + if (ret) 209 + goto fail; 210 + } 211 + 212 + return 0; 213 + fail: 214 + for (--i; i >= 0; --i) 215 + if (info->mtd[i]->suspend) { 216 + BUG_ON(!info->mtd[i]->resume); 217 + info->mtd[i]->resume(info->mtd[i]); 218 + } 219 220 return ret; 221 } ··· 214 int i; 215 216 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 217 + if (info->mtd[i]->resume) 218 + info->mtd[i]->resume(info->mtd[i]); 219 220 return 0; 221 } ··· 225 int i; 226 227 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) 228 + if (info->mtd[i]->suspend && info->mtd[i]->resume) 229 + if (info->mtd[i]->suspend(info->mtd[i]) == 0) 230 + info->mtd[i]->resume(info->mtd[i]); 231 } 232 #else 233 #define physmap_flash_suspend NULL
-2
drivers/mtd/maps/plat-ram.c
··· 6 * 7 * Generic platfrom device based RAM map 8 * 9 - * $Id: plat-ram.c,v 1.7 2005/11/07 11:14:28 gleixner Exp $ 10 - * 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 13 * the Free Software Foundation; either version 2 of the License, or
··· 6 * 7 * Generic platfrom device based RAM map 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or
-2
drivers/mtd/maps/redwood.c
··· 1 /* 2 - * $Id: redwood.c,v 1.11 2005/11/07 11:14:28 gleixner Exp $ 3 - * 4 * drivers/mtd/maps/redwood.c 5 * 6 * FLASH map for the IBM Redwood 4/5/6 boards.
··· 1 /* 2 * drivers/mtd/maps/redwood.c 3 * 4 * FLASH map for the IBM Redwood 4/5/6 boards.
-2
drivers/mtd/maps/rpxlite.c
··· 1 /* 2 - * $Id: rpxlite.c,v 1.22 2004/11/04 13:24:15 gleixner Exp $ 3 - * 4 * Handle mapping of the flash on the RPX Lite and CLLF boards 5 */ 6
··· 1 /* 2 * Handle mapping of the flash on the RPX Lite and CLLF boards 3 */ 4
-2
drivers/mtd/maps/sa1100-flash.c
··· 2 * Flash memory access on SA11x0 based devices 3 * 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 5 - * 6 - * $Id: sa1100-flash.c,v 1.51 2005/11/07 11:14:28 gleixner Exp $ 7 */ 8 #include <linux/module.h> 9 #include <linux/types.h>
··· 2 * Flash memory access on SA11x0 based devices 3 * 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 5 */ 6 #include <linux/module.h> 7 #include <linux/types.h>
-3
drivers/mtd/maps/sbc8240.c
··· 4 * Carolyn Smith, Tektronix, Inc. 5 * 6 * This code is GPLed 7 - * 8 - * $Id: sbc8240.c,v 1.5 2005/11/07 11:14:28 gleixner Exp $ 9 - * 10 */ 11 12 /*
··· 4 * Carolyn Smith, Tektronix, Inc. 5 * 6 * This code is GPLed 7 */ 8 9 /*
-2
drivers/mtd/maps/sbc_gxx.c
··· 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 19 20 - $Id: sbc_gxx.c,v 1.35 2005/11/07 11:14:28 gleixner Exp $ 21 - 22 The SBC-MediaGX / SBC-GXx has up to 16 MiB of 23 Intel StrataFlash (28F320/28F640) in x8 mode. 24
··· 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 19 20 The SBC-MediaGX / SBC-GXx has up to 16 MiB of 21 Intel StrataFlash (28F320/28F640) in x8 mode. 22
-2
drivers/mtd/maps/sc520cdp.c
··· 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 18 * 19 - * $Id: sc520cdp.c,v 1.23 2005/11/17 08:20:27 dwmw2 Exp $ 20 - * 21 * 22 * The SC520CDP is an evaluation board for the Elan SC520 processor available 23 * from AMD. It has two banks of 32-bit Flash ROM, each 8 Megabytes in size,
··· 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 18 * 19 * 20 * The SC520CDP is an evaluation board for the Elan SC520 processor available 21 * from AMD. It has two banks of 32-bit Flash ROM, each 8 Megabytes in size,
-1
drivers/mtd/maps/scb2_flash.c
··· 1 /* 2 * MTD map driver for BIOS Flash on Intel SCB2 boards 3 - * $Id: scb2_flash.c,v 1.12 2005/03/18 14:04:35 gleixner Exp $ 4 * Copyright (C) 2002 Sun Microsystems, Inc. 5 * Tim Hockin <thockin@sun.com> 6 *
··· 1 /* 2 * MTD map driver for BIOS Flash on Intel SCB2 boards 3 * Copyright (C) 2002 Sun Microsystems, Inc. 4 * Tim Hockin <thockin@sun.com> 5 *
-2
drivers/mtd/maps/scx200_docflash.c
··· 2 3 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> 4 5 - $Id: scx200_docflash.c,v 1.12 2005/11/07 11:14:28 gleixner Exp $ 6 - 7 National Semiconductor SCx200 flash mapped with DOCCS 8 */ 9
··· 2 3 Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> 4 5 National Semiconductor SCx200 flash mapped with DOCCS 6 */ 7
-2
drivers/mtd/maps/sharpsl-flash.c
··· 4 * Copyright (C) 2001 Lineo Japan, Inc. 5 * Copyright (C) 2002 SHARP 6 * 7 - * $Id: sharpsl-flash.c,v 1.7 2005/11/07 11:14:28 gleixner Exp $ 8 - * 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 11 *
··· 4 * Copyright (C) 2001 Lineo Japan, Inc. 5 * Copyright (C) 2002 SHARP 6 * 7 * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp 8 * Handle mapping of the flash on the RPX Lite and CLLF boards 9 *
-2
drivers/mtd/maps/solutionengine.c
··· 1 /* 2 - * $Id: solutionengine.c,v 1.15 2005/11/07 11:14:28 gleixner Exp $ 3 - * 4 * Flash and EPROM on Hitachi Solution Engine and similar boards. 5 * 6 * (C) 2001 Red Hat, Inc.
··· 1 /* 2 * Flash and EPROM on Hitachi Solution Engine and similar boards. 3 * 4 * (C) 2001 Red Hat, Inc.
+1 -1
drivers/mtd/maps/sun_uflash.c
··· 1 - /* $Id: sun_uflash.c,v 1.13 2005/11/07 11:14:28 gleixner Exp $ 2 * 3 * sun_uflash - Driver implementation for user-programmable flash 4 * present on many Sun Microsystems SME boardsets.
··· 1 + /* 2 * 3 * sun_uflash - Driver implementation for user-programmable flash 4 * present on many Sun Microsystems SME boardsets.
-2
drivers/mtd/maps/tqm8xxl.c
··· 2 * Handle mapping of the flash memory access routines 3 * on TQM8xxL based devices. 4 * 5 - * $Id: tqm8xxl.c,v 1.15 2005/11/07 11:14:28 gleixner Exp $ 6 - * 7 * based on rpxlite.c 8 * 9 * Copyright(C) 2001 Kirk Lee <kirk@hpc.ee.ntu.edu.tw>
··· 2 * Handle mapping of the flash memory access routines 3 * on TQM8xxL based devices. 4 * 5 * based on rpxlite.c 6 * 7 * Copyright(C) 2001 Kirk Lee <kirk@hpc.ee.ntu.edu.tw>
-2
drivers/mtd/maps/ts5500_flash.c
··· 22 * - Drive A and B use the resident flash disk (RFD) flash translation layer. 23 * - If you have created your own jffs file system and the bios overwrites 24 * it during boot, try disabling Drive A: and B: in the boot order. 25 - * 26 - * $Id: ts5500_flash.c,v 1.5 2005/11/07 11:14:28 gleixner Exp $ 27 */ 28 29 #include <linux/init.h>
··· 22 * - Drive A and B use the resident flash disk (RFD) flash translation layer. 23 * - If you have created your own jffs file system and the bios overwrites 24 * it during boot, try disabling Drive A: and B: in the boot order. 25 */ 26 27 #include <linux/init.h>
-1
drivers/mtd/maps/tsunami_flash.c
··· 2 * tsunami_flash.c 3 * 4 * flash chip on alpha ds10... 5 - * $Id: tsunami_flash.c,v 1.10 2005/11/07 11:14:29 gleixner Exp $ 6 */ 7 #include <asm/io.h> 8 #include <asm/core_tsunami.h>
··· 2 * tsunami_flash.c 3 * 4 * flash chip on alpha ds10... 5 */ 6 #include <asm/io.h> 7 #include <asm/core_tsunami.h>
-2
drivers/mtd/maps/uclinux.c
··· 4 * uclinux.c -- generic memory mapped MTD driver for uclinux 5 * 6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 7 - * 8 - * $Id: uclinux.c,v 1.12 2005/11/07 11:14:29 gleixner Exp $ 9 */ 10 11 /****************************************************************************/
··· 4 * uclinux.c -- generic memory mapped MTD driver for uclinux 5 * 6 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 7 */ 8 9 /****************************************************************************/
-1
drivers/mtd/maps/vmax301.c
··· 1 - // $Id: vmax301.c,v 1.32 2005/11/07 11:14:29 gleixner Exp $ 2 /* ###################################################################### 3 4 Tempustech VMAX SBC301 MTD Driver.
··· 1 /* ###################################################################### 2 3 Tempustech VMAX SBC301 MTD Driver.
-2
drivers/mtd/maps/walnut.c
··· 1 /* 2 - * $Id: walnut.c,v 1.3 2005/11/07 11:14:29 gleixner Exp $ 3 - * 4 * Mapping for Walnut flash 5 * (used ebony.c as a "framework") 6 *
··· 1 /* 2 * Mapping for Walnut flash 3 * (used ebony.c as a "framework") 4 *
-2
drivers/mtd/maps/wr_sbc82xx_flash.c
··· 1 /* 2 - * $Id: wr_sbc82xx_flash.c,v 1.8 2005/11/07 11:14:29 gleixner Exp $ 3 - * 4 * Map for flash chips on Wind River PowerQUICC II SBC82xx board. 5 * 6 * Copyright (C) 2004 Red Hat, Inc.
··· 1 /* 2 * Map for flash chips on Wind River PowerQUICC II SBC82xx board. 3 * 4 * Copyright (C) 2004 Red Hat, Inc.
+10 -24
drivers/mtd/mtd_blkdevs.c
··· 1 /* 2 - * $Id: mtd_blkdevs.c,v 1.27 2005/11/07 11:14:20 gleixner Exp $ 3 - * 4 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 5 * 6 * Interface to Linux 2.5 block layer for MTD 'translation layers'. ··· 210 int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) 211 { 212 struct mtd_blktrans_ops *tr = new->tr; 213 - struct list_head *this; 214 int last_devnum = -1; 215 struct gendisk *gd; 216 ··· 219 BUG(); 220 } 221 222 - list_for_each(this, &tr->devs) { 223 - struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list); 224 if (new->devnum == -1) { 225 /* Use first free number */ 226 if (d->devnum != last_devnum+1) { ··· 306 307 static void blktrans_notify_remove(struct mtd_info *mtd) 308 { 309 - struct list_head *this, *this2, *next; 310 311 - list_for_each(this, &blktrans_majors) { 312 - struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list); 313 - 314 - list_for_each_safe(this2, next, &tr->devs) { 315 - struct mtd_blktrans_dev *dev = list_entry(this2, struct mtd_blktrans_dev, list); 316 - 317 if (dev->mtd == mtd) 318 tr->remove_dev(dev); 319 - } 320 - } 321 } 322 323 static void blktrans_notify_add(struct mtd_info *mtd) 324 { 325 - struct list_head *this; 326 327 if (mtd->type == MTD_ABSENT) 328 return; 329 330 - list_for_each(this, &blktrans_majors) { 331 - struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list); 332 - 333 tr->add_mtd(tr, mtd); 334 - } 335 - 336 } 337 338 static struct mtd_notifier blktrans_notifier = { ··· 394 395 int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) 396 { 397 - struct list_head *this, *next; 398 399 mutex_lock(&mtd_table_mutex); 400 ··· 404 /* Remove it from the list of active majors */ 405 list_del(&tr->list); 406 407 - list_for_each_safe(this, next, &tr->devs) { 408 - struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list); 409 tr->remove_dev(dev); 410 - } 411 412 blk_cleanup_queue(tr->blkcore_priv->rq); 413 unregister_blkdev(tr->major, tr->name);
··· 1 /* 2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 3 * 4 * Interface to Linux 2.5 block layer for MTD 'translation layers'. ··· 212 int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) 213 { 214 struct mtd_blktrans_ops *tr = new->tr; 215 + struct mtd_blktrans_dev *d; 216 int last_devnum = -1; 217 struct gendisk *gd; 218 ··· 221 BUG(); 222 } 223 224 + list_for_each_entry(d, &tr->devs, list) { 225 if (new->devnum == -1) { 226 /* Use first free number */ 227 if (d->devnum != last_devnum+1) { ··· 309 310 static void blktrans_notify_remove(struct mtd_info *mtd) 311 { 312 + struct mtd_blktrans_ops *tr; 313 + struct mtd_blktrans_dev *dev, *next; 314 315 + list_for_each_entry(tr, &blktrans_majors, list) 316 + list_for_each_entry_safe(dev, next, &tr->devs, list) 317 if (dev->mtd == mtd) 318 tr->remove_dev(dev); 319 } 320 321 static void blktrans_notify_add(struct mtd_info *mtd) 322 { 323 + struct mtd_blktrans_ops *tr; 324 325 if (mtd->type == MTD_ABSENT) 326 return; 327 328 + list_for_each_entry(tr, &blktrans_majors, list) 329 tr->add_mtd(tr, mtd); 330 } 331 332 static struct mtd_notifier blktrans_notifier = { ··· 406 407 int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr) 408 { 409 + struct mtd_blktrans_dev *dev, *next; 410 411 mutex_lock(&mtd_table_mutex); 412 ··· 416 /* Remove it from the list of active majors */ 417 list_del(&tr->list); 418 419 + list_for_each_entry_safe(dev, next, &tr->devs, list) 420 tr->remove_dev(dev); 421 422 blk_cleanup_queue(tr->blkcore_priv->rq); 423 unregister_blkdev(tr->major, tr->name);
-2
drivers/mtd/mtdblock.c
··· 1 /* 2 * Direct MTD block device access 3 * 4 - * $Id: mtdblock.c,v 1.68 2005/11/07 11:14:20 gleixner Exp $ 5 - * 6 * (C) 2000-2003 Nicolas Pitre <nico@cam.org> 7 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 8 */
··· 1 /* 2 * Direct MTD block device access 3 * 4 * (C) 2000-2003 Nicolas Pitre <nico@cam.org> 5 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 6 */
-2
drivers/mtd/mtdblock_ro.c
··· 1 /* 2 - * $Id: mtdblock_ro.c,v 1.19 2004/11/16 18:28:59 dwmw2 Exp $ 3 - * 4 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 5 * 6 * Simple read-only (writable only for RAM) mtdblock driver
··· 1 /* 2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 3 * 4 * Simple read-only (writable only for RAM) mtdblock driver
+11 -13
drivers/mtd/mtdchar.c
··· 1 /* 2 - * $Id: mtdchar.c,v 1.76 2005/11/07 11:14:20 gleixner Exp $ 3 - * 4 * Character-device access to raw MTD devices. 5 * 6 */ ··· 492 { 493 struct mtd_oob_buf buf; 494 struct mtd_oob_ops ops; 495 uint32_t retlen; 496 497 if(!(file->f_mode & 2)) ··· 536 if (ops.oobretlen > 0xFFFFFFFFU) 537 ret = -EOVERFLOW; 538 retlen = ops.oobretlen; 539 - if (copy_to_user(&((struct mtd_oob_buf *)argp)->length, 540 - &retlen, sizeof(buf.length))) 541 ret = -EFAULT; 542 543 kfree(ops.oobbuf); ··· 590 591 case MEMLOCK: 592 { 593 - struct erase_info_user info; 594 595 - if (copy_from_user(&info, argp, sizeof(info))) 596 return -EFAULT; 597 598 if (!mtd->lock) 599 ret = -EOPNOTSUPP; 600 else 601 - ret = mtd->lock(mtd, info.start, info.length); 602 break; 603 } 604 605 case MEMUNLOCK: 606 { 607 - struct erase_info_user info; 608 609 - if (copy_from_user(&info, argp, sizeof(info))) 610 return -EFAULT; 611 612 if (!mtd->unlock) 613 ret = -EOPNOTSUPP; 614 else 615 - ret = mtd->unlock(mtd, info.start, info.length); 616 break; 617 } 618 ··· 712 713 case OTPLOCK: 714 { 715 - struct otp_info info; 716 717 if (mfi->mode != MTD_MODE_OTP_USER) 718 return -EINVAL; 719 - if (copy_from_user(&info, argp, sizeof(info))) 720 return -EFAULT; 721 if (!mtd->lock_user_prot_reg) 722 return -EOPNOTSUPP; 723 - ret = mtd->lock_user_prot_reg(mtd, info.start, info.length); 724 break; 725 } 726 #endif
··· 1 /* 2 * Character-device access to raw MTD devices. 3 * 4 */ ··· 494 { 495 struct mtd_oob_buf buf; 496 struct mtd_oob_ops ops; 497 + struct mtd_oob_buf __user *user_buf = argp; 498 uint32_t retlen; 499 500 if(!(file->f_mode & 2)) ··· 537 if (ops.oobretlen > 0xFFFFFFFFU) 538 ret = -EOVERFLOW; 539 retlen = ops.oobretlen; 540 + if (copy_to_user(&user_buf->length, &retlen, sizeof(buf.length))) 541 ret = -EFAULT; 542 543 kfree(ops.oobbuf); ··· 592 593 case MEMLOCK: 594 { 595 + struct erase_info_user einfo; 596 597 + if (copy_from_user(&einfo, argp, sizeof(einfo))) 598 return -EFAULT; 599 600 if (!mtd->lock) 601 ret = -EOPNOTSUPP; 602 else 603 + ret = mtd->lock(mtd, einfo.start, einfo.length); 604 break; 605 } 606 607 case MEMUNLOCK: 608 { 609 + struct erase_info_user einfo; 610 611 + if (copy_from_user(&einfo, argp, sizeof(einfo))) 612 return -EFAULT; 613 614 if (!mtd->unlock) 615 ret = -EOPNOTSUPP; 616 else 617 + ret = mtd->unlock(mtd, einfo.start, einfo.length); 618 break; 619 } 620 ··· 714 715 case OTPLOCK: 716 { 717 + struct otp_info oinfo; 718 719 if (mfi->mode != MTD_MODE_OTP_USER) 720 return -EINVAL; 721 + if (copy_from_user(&oinfo, argp, sizeof(oinfo))) 722 return -EFAULT; 723 if (!mtd->lock_user_prot_reg) 724 return -EOPNOTSUPP; 725 + ret = mtd->lock_user_prot_reg(mtd, oinfo.start, oinfo.length); 726 break; 727 } 728 #endif
-2
drivers/mtd/mtdconcat.c
··· 6 * NAND support by Christian Gan <cgan@iders.ca> 7 * 8 * This code is GPL 9 - * 10 - * $Id: mtdconcat.c,v 1.11 2005/11/07 11:14:20 gleixner Exp $ 11 */ 12 13 #include <linux/kernel.h>
··· 6 * NAND support by Christian Gan <cgan@iders.ca> 7 * 8 * This code is GPL 9 */ 10 11 #include <linux/kernel.h>
+4 -10
drivers/mtd/mtdcore.c
··· 1 /* 2 - * $Id: mtdcore.c,v 1.47 2005/11/07 11:14:20 gleixner Exp $ 3 - * 4 * Core registration and callback routines for MTD 5 * drivers and users. 6 * ··· 51 52 for (i=0; i < MAX_MTD_DEVICES; i++) 53 if (!mtd_table[i]) { 54 - struct list_head *this; 55 56 mtd_table[i] = mtd; 57 mtd->index = i; ··· 70 DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name); 71 /* No need to get a refcount on the module containing 72 the notifier, since we hold the mtd_table_mutex */ 73 - list_for_each(this, &mtd_notifiers) { 74 - struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list); 75 not->add(mtd); 76 - } 77 78 mutex_unlock(&mtd_table_mutex); 79 /* We _know_ we aren't being removed, because ··· 109 mtd->index, mtd->name, mtd->usecount); 110 ret = -EBUSY; 111 } else { 112 - struct list_head *this; 113 114 /* No need to get a refcount on the module containing 115 the notifier, since we hold the mtd_table_mutex */ 116 - list_for_each(this, &mtd_notifiers) { 117 - struct mtd_notifier *not = list_entry(this, struct mtd_notifier, list); 118 not->remove(mtd); 119 - } 120 121 mtd_table[mtd->index] = NULL; 122
··· 1 /* 2 * Core registration and callback routines for MTD 3 * drivers and users. 4 * ··· 53 54 for (i=0; i < MAX_MTD_DEVICES; i++) 55 if (!mtd_table[i]) { 56 + struct mtd_notifier *not; 57 58 mtd_table[i] = mtd; 59 mtd->index = i; ··· 72 DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name); 73 /* No need to get a refcount on the module containing 74 the notifier, since we hold the mtd_table_mutex */ 75 + list_for_each_entry(not, &mtd_notifiers, list) 76 not->add(mtd); 77 78 mutex_unlock(&mtd_table_mutex); 79 /* We _know_ we aren't being removed, because ··· 113 mtd->index, mtd->name, mtd->usecount); 114 ret = -EBUSY; 115 } else { 116 + struct mtd_notifier *not; 117 118 /* No need to get a refcount on the module containing 119 the notifier, since we hold the mtd_table_mutex */ 120 + list_for_each_entry(not, &mtd_notifiers, list) 121 not->remove(mtd); 122 123 mtd_table[mtd->index] = NULL; 124
+227 -221
drivers/mtd/mtdpart.c
··· 5 * 6 * This code is GPL 7 * 8 - * $Id: mtdpart.c,v 1.55 2005/11/07 11:14:20 gleixner Exp $ 9 - * 10 * 02-21-2002 Thomas Gleixner <gleixner@autronix.de> 11 * added support for read_oob, write_oob 12 */ ··· 44 * to the _real_ device. 45 */ 46 47 - static int part_read (struct mtd_info *mtd, loff_t from, size_t len, 48 - size_t *retlen, u_char *buf) 49 { 50 struct mtd_part *part = PART(mtd); 51 int res; ··· 54 len = 0; 55 else if (from + len > mtd->size) 56 len = mtd->size - from; 57 - res = part->master->read (part->master, from + part->offset, 58 len, retlen, buf); 59 if (unlikely(res)) { 60 if (res == -EUCLEAN) ··· 65 return res; 66 } 67 68 - static int part_point (struct mtd_info *mtd, loff_t from, size_t len, 69 - size_t *retlen, void **virt, resource_size_t *phys) 70 { 71 struct mtd_part *part = PART(mtd); 72 if (from >= mtd->size) ··· 85 } 86 87 static int part_read_oob(struct mtd_info *mtd, loff_t from, 88 - struct mtd_oob_ops *ops) 89 { 90 struct mtd_part *part = PART(mtd); 91 int res; ··· 105 return res; 106 } 107 108 - static int part_read_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t len, 109 - size_t *retlen, u_char *buf) 110 { 111 struct mtd_part *part = PART(mtd); 112 - return part->master->read_user_prot_reg (part->master, from, 113 len, retlen, buf); 114 } 115 116 - static int part_get_user_prot_info (struct mtd_info *mtd, 117 - struct otp_info *buf, size_t len) 118 { 119 struct mtd_part *part = PART(mtd); 120 - return part->master->get_user_prot_info (part->master, buf, len); 121 } 122 123 - static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, size_t len, 124 - size_t *retlen, u_char *buf) 125 { 126 struct mtd_part *part = PART(mtd); 127 - return part->master->read_fact_prot_reg (part->master, from, 128 len, retlen, buf); 129 } 130 131 - static int part_get_fact_prot_info (struct mtd_info *mtd, 132 - struct otp_info *buf, size_t len) 133 { 134 struct mtd_part *part = PART(mtd); 135 - return part->master->get_fact_prot_info (part->master, buf, len); 136 } 137 138 - static int part_write (struct mtd_info *mtd, loff_t to, size_t len, 139 - size_t *retlen, const u_char *buf) 140 { 141 struct mtd_part *part = PART(mtd); 142 if (!(mtd->flags & MTD_WRITEABLE)) ··· 145 len = 0; 146 else if (to + len > mtd->size) 147 len = mtd->size - to; 148 - return part->master->write (part->master, to + part->offset, 149 len, retlen, buf); 150 } 151 152 - static int part_panic_write (struct mtd_info *mtd, loff_t to, size_t len, 153 - size_t *retlen, const u_char *buf) 154 { 155 struct mtd_part *part = PART(mtd); 156 if (!(mtd->flags & MTD_WRITEABLE)) ··· 159 len = 0; 160 else if (to + len > mtd->size) 161 len = mtd->size - to; 162 - return part->master->panic_write (part->master, to + part->offset, 163 len, retlen, buf); 164 } 165 166 static int part_write_oob(struct mtd_info *mtd, loff_t to, 167 - struct mtd_oob_ops *ops) 168 { 169 struct mtd_part *part = PART(mtd); 170 ··· 178 return part->master->write_oob(part->master, to + part->offset, ops); 179 } 180 181 - static int part_write_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t len, 182 - size_t *retlen, u_char *buf) 183 { 184 struct mtd_part *part = PART(mtd); 185 - return part->master->write_user_prot_reg (part->master, from, 186 len, retlen, buf); 187 } 188 189 - static int part_lock_user_prot_reg (struct mtd_info *mtd, loff_t from, size_t len) 190 { 191 struct mtd_part *part = PART(mtd); 192 - return part->master->lock_user_prot_reg (part->master, from, len); 193 } 194 195 - static int part_writev (struct mtd_info *mtd, const struct kvec *vecs, 196 - unsigned long count, loff_t to, size_t *retlen) 197 { 198 struct mtd_part *part = PART(mtd); 199 if (!(mtd->flags & MTD_WRITEABLE)) 200 return -EROFS; 201 - return part->master->writev (part->master, vecs, count, 202 to + part->offset, retlen); 203 } 204 205 - static int part_erase (struct mtd_info *mtd, struct erase_info *instr) 206 { 207 struct mtd_part *part = PART(mtd); 208 int ret; ··· 235 } 236 EXPORT_SYMBOL_GPL(mtd_erase_callback); 237 238 - static int part_lock (struct mtd_info *mtd, loff_t ofs, size_t len) 239 { 240 struct mtd_part *part = PART(mtd); 241 if ((len + ofs) > mtd->size) ··· 243 return part->master->lock(part->master, ofs + part->offset, len); 244 } 245 246 - static int part_unlock (struct mtd_info *mtd, loff_t ofs, size_t len) 247 { 248 struct mtd_part *part = PART(mtd); 249 if ((len + ofs) > mtd->size) ··· 269 part->master->resume(part->master); 270 } 271 272 - static int part_block_isbad (struct mtd_info *mtd, loff_t ofs) 273 { 274 struct mtd_part *part = PART(mtd); 275 if (ofs >= mtd->size) ··· 278 return part->master->block_isbad(part->master, ofs); 279 } 280 281 - static int part_block_markbad (struct mtd_info *mtd, loff_t ofs) 282 { 283 struct mtd_part *part = PART(mtd); 284 int res; ··· 301 302 int del_mtd_partitions(struct mtd_info *master) 303 { 304 - struct list_head *node; 305 - struct mtd_part *slave; 306 307 - for (node = mtd_partitions.next; 308 - node != &mtd_partitions; 309 - node = node->next) { 310 - slave = list_entry(node, struct mtd_part, list); 311 if (slave->master == master) { 312 - struct list_head *prev = node->prev; 313 - __list_del(prev, node->next); 314 - if(slave->registered) 315 del_mtd_device(&slave->mtd); 316 kfree(slave); 317 - node = prev; 318 } 319 } 320 321 - return 0; 322 } 323 324 /* ··· 504 u_int32_t cur_offset = 0; 505 int i; 506 507 - printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); 508 509 for (i = 0; i < nbparts; i++) { 510 - 511 - /* allocate the partition structure */ 512 - slave = kzalloc (sizeof(*slave), GFP_KERNEL); 513 - if (!slave) { 514 - printk ("memory allocation error while creating partitions for \"%s\"\n", 515 - master->name); 516 - del_mtd_partitions(master); 517 return -ENOMEM; 518 - } 519 - list_add(&slave->list, &mtd_partitions); 520 - 521 - /* set up the MTD object for this partition */ 522 - slave->mtd.type = master->type; 523 - slave->mtd.flags = master->flags & ~parts[i].mask_flags; 524 - slave->mtd.size = parts[i].size; 525 - slave->mtd.writesize = master->writesize; 526 - slave->mtd.oobsize = master->oobsize; 527 - slave->mtd.oobavail = master->oobavail; 528 - slave->mtd.subpage_sft = master->subpage_sft; 529 - 530 - slave->mtd.name = parts[i].name; 531 - slave->mtd.owner = master->owner; 532 - 533 - slave->mtd.read = part_read; 534 - slave->mtd.write = part_write; 535 - 536 - if (master->panic_write) 537 - slave->mtd.panic_write = part_panic_write; 538 - 539 - if(master->point && master->unpoint){ 540 - slave->mtd.point = part_point; 541 - slave->mtd.unpoint = part_unpoint; 542 - } 543 - 544 - if (master->read_oob) 545 - slave->mtd.read_oob = part_read_oob; 546 - if (master->write_oob) 547 - slave->mtd.write_oob = part_write_oob; 548 - if(master->read_user_prot_reg) 549 - slave->mtd.read_user_prot_reg = part_read_user_prot_reg; 550 - if(master->read_fact_prot_reg) 551 - slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg; 552 - if(master->write_user_prot_reg) 553 - slave->mtd.write_user_prot_reg = part_write_user_prot_reg; 554 - if(master->lock_user_prot_reg) 555 - slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg; 556 - if(master->get_user_prot_info) 557 - slave->mtd.get_user_prot_info = part_get_user_prot_info; 558 - if(master->get_fact_prot_info) 559 - slave->mtd.get_fact_prot_info = part_get_fact_prot_info; 560 - if (master->sync) 561 - slave->mtd.sync = part_sync; 562 - if (!i && master->suspend && master->resume) { 563 - slave->mtd.suspend = part_suspend; 564 - slave->mtd.resume = part_resume; 565 - } 566 - if (master->writev) 567 - slave->mtd.writev = part_writev; 568 - if (master->lock) 569 - slave->mtd.lock = part_lock; 570 - if (master->unlock) 571 - slave->mtd.unlock = part_unlock; 572 - if (master->block_isbad) 573 - slave->mtd.block_isbad = part_block_isbad; 574 - if (master->block_markbad) 575 - slave->mtd.block_markbad = part_block_markbad; 576 - slave->mtd.erase = part_erase; 577 - slave->master = master; 578 - slave->offset = parts[i].offset; 579 - slave->index = i; 580 - 581 - if (slave->offset == MTDPART_OFS_APPEND) 582 - slave->offset = cur_offset; 583 - if (slave->offset == MTDPART_OFS_NXTBLK) { 584 - slave->offset = cur_offset; 585 - if ((cur_offset % master->erasesize) != 0) { 586 - /* Round up to next erasesize */ 587 - slave->offset = ((cur_offset / master->erasesize) + 1) * master->erasesize; 588 - printk(KERN_NOTICE "Moving partition %d: " 589 - "0x%08x -> 0x%08x\n", i, 590 - cur_offset, slave->offset); 591 - } 592 - } 593 - if (slave->mtd.size == MTDPART_SIZ_FULL) 594 - slave->mtd.size = master->size - slave->offset; 595 cur_offset = slave->offset + slave->mtd.size; 596 - 597 - printk (KERN_NOTICE "0x%08x-0x%08x : \"%s\"\n", slave->offset, 598 - slave->offset + slave->mtd.size, slave->mtd.name); 599 - 600 - /* let's do some sanity checks */ 601 - if (slave->offset >= master->size) { 602 - /* let's register it anyway to preserve ordering */ 603 - slave->offset = 0; 604 - slave->mtd.size = 0; 605 - printk ("mtd: partition \"%s\" is out of reach -- disabled\n", 606 - parts[i].name); 607 - } 608 - if (slave->offset + slave->mtd.size > master->size) { 609 - slave->mtd.size = master->size - slave->offset; 610 - printk ("mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#x\n", 611 - parts[i].name, master->name, slave->mtd.size); 612 - } 613 - if (master->numeraseregions>1) { 614 - /* Deal with variable erase size stuff */ 615 - int i; 616 - struct mtd_erase_region_info *regions = master->eraseregions; 617 - 618 - /* Find the first erase regions which is part of this partition. */ 619 - for (i=0; i < master->numeraseregions && slave->offset >= regions[i].offset; i++) 620 - ; 621 - 622 - for (i--; i < master->numeraseregions && slave->offset + slave->mtd.size > regions[i].offset; i++) { 623 - if (slave->mtd.erasesize < regions[i].erasesize) { 624 - slave->mtd.erasesize = regions[i].erasesize; 625 - } 626 - } 627 - } else { 628 - /* Single erase size */ 629 - slave->mtd.erasesize = master->erasesize; 630 - } 631 - 632 - if ((slave->mtd.flags & MTD_WRITEABLE) && 633 - (slave->offset % slave->mtd.erasesize)) { 634 - /* Doesn't start on a boundary of major erase size */ 635 - /* FIXME: Let it be writable if it is on a boundary of _minor_ erase size though */ 636 - slave->mtd.flags &= ~MTD_WRITEABLE; 637 - printk ("mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", 638 - parts[i].name); 639 - } 640 - if ((slave->mtd.flags & MTD_WRITEABLE) && 641 - (slave->mtd.size % slave->mtd.erasesize)) { 642 - slave->mtd.flags &= ~MTD_WRITEABLE; 643 - printk ("mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", 644 - parts[i].name); 645 - } 646 - 647 - slave->mtd.ecclayout = master->ecclayout; 648 - if (master->block_isbad) { 649 - uint32_t offs = 0; 650 - 651 - while(offs < slave->mtd.size) { 652 - if (master->block_isbad(master, 653 - offs + slave->offset)) 654 - slave->mtd.ecc_stats.badblocks++; 655 - offs += slave->mtd.erasesize; 656 - } 657 - } 658 - 659 - if(parts[i].mtdp) 660 - { /* store the object pointer (caller may or may not register it */ 661 - *parts[i].mtdp = &slave->mtd; 662 - slave->registered = 0; 663 - } 664 - else 665 - { 666 - /* register our partition */ 667 - add_mtd_device(&slave->mtd); 668 - slave->registered = 1; 669 - } 670 } 671 672 return 0; 673 } 674 - 675 EXPORT_SYMBOL(add_mtd_partitions); 676 - EXPORT_SYMBOL(del_mtd_partitions); 677 678 static DEFINE_SPINLOCK(part_parser_lock); 679 static LIST_HEAD(part_parsers); 680 681 static struct mtd_part_parser *get_partition_parser(const char *name) 682 { 683 - struct list_head *this; 684 - void *ret = NULL; 685 spin_lock(&part_parser_lock); 686 687 - list_for_each(this, &part_parsers) { 688 - struct mtd_part_parser *p = list_entry(this, struct mtd_part_parser, list); 689 - 690 if (!strcmp(p->name, name) && try_module_get(p->owner)) { 691 ret = p; 692 break; 693 } 694 - } 695 spin_unlock(&part_parser_lock); 696 697 return ret; ··· 545 546 return 0; 547 } 548 549 int deregister_mtd_parser(struct mtd_part_parser *p) 550 { ··· 554 spin_unlock(&part_parser_lock); 555 return 0; 556 } 557 558 int parse_mtd_partitions(struct mtd_info *master, const char **types, 559 struct mtd_partition **pparts, unsigned long origin) ··· 582 } 583 return ret; 584 } 585 - 586 EXPORT_SYMBOL_GPL(parse_mtd_partitions); 587 - EXPORT_SYMBOL_GPL(register_mtd_parser); 588 - EXPORT_SYMBOL_GPL(deregister_mtd_parser);
··· 5 * 6 * This code is GPL 7 * 8 * 02-21-2002 Thomas Gleixner <gleixner@autronix.de> 9 * added support for read_oob, write_oob 10 */ ··· 46 * to the _real_ device. 47 */ 48 49 + static int part_read(struct mtd_info *mtd, loff_t from, size_t len, 50 + size_t *retlen, u_char *buf) 51 { 52 struct mtd_part *part = PART(mtd); 53 int res; ··· 56 len = 0; 57 else if (from + len > mtd->size) 58 len = mtd->size - from; 59 + res = part->master->read(part->master, from + part->offset, 60 len, retlen, buf); 61 if (unlikely(res)) { 62 if (res == -EUCLEAN) ··· 67 return res; 68 } 69 70 + static int part_point(struct mtd_info *mtd, loff_t from, size_t len, 71 + size_t *retlen, void **virt, resource_size_t *phys) 72 { 73 struct mtd_part *part = PART(mtd); 74 if (from >= mtd->size) ··· 87 } 88 89 static int part_read_oob(struct mtd_info *mtd, loff_t from, 90 + struct mtd_oob_ops *ops) 91 { 92 struct mtd_part *part = PART(mtd); 93 int res; ··· 107 return res; 108 } 109 110 + static int part_read_user_prot_reg(struct mtd_info *mtd, loff_t from, 111 + size_t len, size_t *retlen, u_char *buf) 112 { 113 struct mtd_part *part = PART(mtd); 114 + return part->master->read_user_prot_reg(part->master, from, 115 len, retlen, buf); 116 } 117 118 + static int part_get_user_prot_info(struct mtd_info *mtd, 119 + struct otp_info *buf, size_t len) 120 { 121 struct mtd_part *part = PART(mtd); 122 + return part->master->get_user_prot_info(part->master, buf, len); 123 } 124 125 + static int part_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, 126 + size_t len, size_t *retlen, u_char *buf) 127 { 128 struct mtd_part *part = PART(mtd); 129 + return part->master->read_fact_prot_reg(part->master, from, 130 len, retlen, buf); 131 } 132 133 + static int part_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, 134 + size_t len) 135 { 136 struct mtd_part *part = PART(mtd); 137 + return part->master->get_fact_prot_info(part->master, buf, len); 138 } 139 140 + static int part_write(struct mtd_info *mtd, loff_t to, size_t len, 141 + size_t *retlen, const u_char *buf) 142 { 143 struct mtd_part *part = PART(mtd); 144 if (!(mtd->flags & MTD_WRITEABLE)) ··· 147 len = 0; 148 else if (to + len > mtd->size) 149 len = mtd->size - to; 150 + return part->master->write(part->master, to + part->offset, 151 len, retlen, buf); 152 } 153 154 + static int part_panic_write(struct mtd_info *mtd, loff_t to, size_t len, 155 + size_t *retlen, const u_char *buf) 156 { 157 struct mtd_part *part = PART(mtd); 158 if (!(mtd->flags & MTD_WRITEABLE)) ··· 161 len = 0; 162 else if (to + len > mtd->size) 163 len = mtd->size - to; 164 + return part->master->panic_write(part->master, to + part->offset, 165 len, retlen, buf); 166 } 167 168 static int part_write_oob(struct mtd_info *mtd, loff_t to, 169 + struct mtd_oob_ops *ops) 170 { 171 struct mtd_part *part = PART(mtd); 172 ··· 180 return part->master->write_oob(part->master, to + part->offset, ops); 181 } 182 183 + static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from, 184 + size_t len, size_t *retlen, u_char *buf) 185 { 186 struct mtd_part *part = PART(mtd); 187 + return part->master->write_user_prot_reg(part->master, from, 188 len, retlen, buf); 189 } 190 191 + static int part_lock_user_prot_reg(struct mtd_info *mtd, loff_t from, 192 + size_t len) 193 { 194 struct mtd_part *part = PART(mtd); 195 + return part->master->lock_user_prot_reg(part->master, from, len); 196 } 197 198 + static int part_writev(struct mtd_info *mtd, const struct kvec *vecs, 199 + unsigned long count, loff_t to, size_t *retlen) 200 { 201 struct mtd_part *part = PART(mtd); 202 if (!(mtd->flags & MTD_WRITEABLE)) 203 return -EROFS; 204 + return part->master->writev(part->master, vecs, count, 205 to + part->offset, retlen); 206 } 207 208 + static int part_erase(struct mtd_info *mtd, struct erase_info *instr) 209 { 210 struct mtd_part *part = PART(mtd); 211 int ret; ··· 236 } 237 EXPORT_SYMBOL_GPL(mtd_erase_callback); 238 239 + static int part_lock(struct mtd_info *mtd, loff_t ofs, size_t len) 240 { 241 struct mtd_part *part = PART(mtd); 242 if ((len + ofs) > mtd->size) ··· 244 return part->master->lock(part->master, ofs + part->offset, len); 245 } 246 247 + static int part_unlock(struct mtd_info *mtd, loff_t ofs, size_t len) 248 { 249 struct mtd_part *part = PART(mtd); 250 if ((len + ofs) > mtd->size) ··· 270 part->master->resume(part->master); 271 } 272 273 + static int part_block_isbad(struct mtd_info *mtd, loff_t ofs) 274 { 275 struct mtd_part *part = PART(mtd); 276 if (ofs >= mtd->size) ··· 279 return part->master->block_isbad(part->master, ofs); 280 } 281 282 + static int part_block_markbad(struct mtd_info *mtd, loff_t ofs) 283 { 284 struct mtd_part *part = PART(mtd); 285 int res; ··· 302 303 int del_mtd_partitions(struct mtd_info *master) 304 { 305 + struct mtd_part *slave, *next; 306 307 + list_for_each_entry_safe(slave, next, &mtd_partitions, list) 308 if (slave->master == master) { 309 + list_del(&slave->list); 310 + if (slave->registered) 311 del_mtd_device(&slave->mtd); 312 kfree(slave); 313 + } 314 + 315 + return 0; 316 + } 317 + EXPORT_SYMBOL(del_mtd_partitions); 318 + 319 + static struct mtd_part *add_one_partition(struct mtd_info *master, 320 + const struct mtd_partition *part, int partno, 321 + u_int32_t cur_offset) 322 + { 323 + struct mtd_part *slave; 324 + 325 + /* allocate the partition structure */ 326 + slave = kzalloc(sizeof(*slave), GFP_KERNEL); 327 + if (!slave) { 328 + printk(KERN_ERR"memory allocation error while creating partitions for \"%s\"\n", 329 + master->name); 330 + del_mtd_partitions(master); 331 + return NULL; 332 + } 333 + list_add(&slave->list, &mtd_partitions); 334 + 335 + /* set up the MTD object for this partition */ 336 + slave->mtd.type = master->type; 337 + slave->mtd.flags = master->flags & ~part->mask_flags; 338 + slave->mtd.size = part->size; 339 + slave->mtd.writesize = master->writesize; 340 + slave->mtd.oobsize = master->oobsize; 341 + slave->mtd.oobavail = master->oobavail; 342 + slave->mtd.subpage_sft = master->subpage_sft; 343 + 344 + slave->mtd.name = part->name; 345 + slave->mtd.owner = master->owner; 346 + 347 + slave->mtd.read = part_read; 348 + slave->mtd.write = part_write; 349 + 350 + if (master->panic_write) 351 + slave->mtd.panic_write = part_panic_write; 352 + 353 + if (master->point && master->unpoint) { 354 + slave->mtd.point = part_point; 355 + slave->mtd.unpoint = part_unpoint; 356 + } 357 + 358 + if (master->read_oob) 359 + slave->mtd.read_oob = part_read_oob; 360 + if (master->write_oob) 361 + slave->mtd.write_oob = part_write_oob; 362 + if (master->read_user_prot_reg) 363 + slave->mtd.read_user_prot_reg = part_read_user_prot_reg; 364 + if (master->read_fact_prot_reg) 365 + slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg; 366 + if (master->write_user_prot_reg) 367 + slave->mtd.write_user_prot_reg = part_write_user_prot_reg; 368 + if (master->lock_user_prot_reg) 369 + slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg; 370 + if (master->get_user_prot_info) 371 + slave->mtd.get_user_prot_info = part_get_user_prot_info; 372 + if (master->get_fact_prot_info) 373 + slave->mtd.get_fact_prot_info = part_get_fact_prot_info; 374 + if (master->sync) 375 + slave->mtd.sync = part_sync; 376 + if (!partno && master->suspend && master->resume) { 377 + slave->mtd.suspend = part_suspend; 378 + slave->mtd.resume = part_resume; 379 + } 380 + if (master->writev) 381 + slave->mtd.writev = part_writev; 382 + if (master->lock) 383 + slave->mtd.lock = part_lock; 384 + if (master->unlock) 385 + slave->mtd.unlock = part_unlock; 386 + if (master->block_isbad) 387 + slave->mtd.block_isbad = part_block_isbad; 388 + if (master->block_markbad) 389 + slave->mtd.block_markbad = part_block_markbad; 390 + slave->mtd.erase = part_erase; 391 + slave->master = master; 392 + slave->offset = part->offset; 393 + slave->index = partno; 394 + 395 + if (slave->offset == MTDPART_OFS_APPEND) 396 + slave->offset = cur_offset; 397 + if (slave->offset == MTDPART_OFS_NXTBLK) { 398 + slave->offset = cur_offset; 399 + if ((cur_offset % master->erasesize) != 0) { 400 + /* Round up to next erasesize */ 401 + slave->offset = ((cur_offset / master->erasesize) + 1) * master->erasesize; 402 + printk(KERN_NOTICE "Moving partition %d: " 403 + "0x%08x -> 0x%08x\n", partno, 404 + cur_offset, slave->offset); 405 + } 406 + } 407 + if (slave->mtd.size == MTDPART_SIZ_FULL) 408 + slave->mtd.size = master->size - slave->offset; 409 + 410 + printk(KERN_NOTICE "0x%08x-0x%08x : \"%s\"\n", slave->offset, 411 + slave->offset + slave->mtd.size, slave->mtd.name); 412 + 413 + /* let's do some sanity checks */ 414 + if (slave->offset >= master->size) { 415 + /* let's register it anyway to preserve ordering */ 416 + slave->offset = 0; 417 + slave->mtd.size = 0; 418 + printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", 419 + part->name); 420 + goto out_register; 421 + } 422 + if (slave->offset + slave->mtd.size > master->size) { 423 + slave->mtd.size = master->size - slave->offset; 424 + printk(KERN_WARNING"mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#x\n", 425 + part->name, master->name, slave->mtd.size); 426 + } 427 + if (master->numeraseregions > 1) { 428 + /* Deal with variable erase size stuff */ 429 + int i, max = master->numeraseregions; 430 + u32 end = slave->offset + slave->mtd.size; 431 + struct mtd_erase_region_info *regions = master->eraseregions; 432 + 433 + /* Find the first erase regions which is part of this 434 + * partition. */ 435 + for (i = 0; i < max && regions[i].offset <= slave->offset; i++) 436 + ; 437 + /* The loop searched for the region _behind_ the first one */ 438 + i--; 439 + 440 + /* Pick biggest erasesize */ 441 + for (; i < max && regions[i].offset < end; i++) { 442 + if (slave->mtd.erasesize < regions[i].erasesize) { 443 + slave->mtd.erasesize = regions[i].erasesize; 444 + } 445 + } 446 + BUG_ON(slave->mtd.erasesize == 0); 447 + } else { 448 + /* Single erase size */ 449 + slave->mtd.erasesize = master->erasesize; 450 + } 451 + 452 + if ((slave->mtd.flags & MTD_WRITEABLE) && 453 + (slave->offset % slave->mtd.erasesize)) { 454 + /* Doesn't start on a boundary of major erase size */ 455 + /* FIXME: Let it be writable if it is on a boundary of 456 + * _minor_ erase size though */ 457 + slave->mtd.flags &= ~MTD_WRITEABLE; 458 + printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n", 459 + part->name); 460 + } 461 + if ((slave->mtd.flags & MTD_WRITEABLE) && 462 + (slave->mtd.size % slave->mtd.erasesize)) { 463 + slave->mtd.flags &= ~MTD_WRITEABLE; 464 + printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n", 465 + part->name); 466 + } 467 + 468 + slave->mtd.ecclayout = master->ecclayout; 469 + if (master->block_isbad) { 470 + uint32_t offs = 0; 471 + 472 + while (offs < slave->mtd.size) { 473 + if (master->block_isbad(master, 474 + offs + slave->offset)) 475 + slave->mtd.ecc_stats.badblocks++; 476 + offs += slave->mtd.erasesize; 477 } 478 } 479 480 + out_register: 481 + if (part->mtdp) { 482 + /* store the object pointer (caller may or may not register it*/ 483 + *part->mtdp = &slave->mtd; 484 + slave->registered = 0; 485 + } else { 486 + /* register our partition */ 487 + add_mtd_device(&slave->mtd); 488 + slave->registered = 1; 489 + } 490 + return slave; 491 } 492 493 /* ··· 337 u_int32_t cur_offset = 0; 338 int i; 339 340 + printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); 341 342 for (i = 0; i < nbparts; i++) { 343 + slave = add_one_partition(master, parts + i, i, cur_offset); 344 + if (!slave) 345 return -ENOMEM; 346 cur_offset = slave->offset + slave->mtd.size; 347 } 348 349 return 0; 350 } 351 EXPORT_SYMBOL(add_mtd_partitions); 352 353 static DEFINE_SPINLOCK(part_parser_lock); 354 static LIST_HEAD(part_parsers); 355 356 static struct mtd_part_parser *get_partition_parser(const char *name) 357 { 358 + struct mtd_part_parser *p, *ret = NULL; 359 + 360 spin_lock(&part_parser_lock); 361 362 + list_for_each_entry(p, &part_parsers, list) 363 if (!strcmp(p->name, name) && try_module_get(p->owner)) { 364 ret = p; 365 break; 366 } 367 + 368 spin_unlock(&part_parser_lock); 369 370 return ret; ··· 538 539 return 0; 540 } 541 + EXPORT_SYMBOL_GPL(register_mtd_parser); 542 543 int deregister_mtd_parser(struct mtd_part_parser *p) 544 { ··· 546 spin_unlock(&part_parser_lock); 547 return 0; 548 } 549 + EXPORT_SYMBOL_GPL(deregister_mtd_parser); 550 551 int parse_mtd_partitions(struct mtd_info *master, const char **types, 552 struct mtd_partition **pparts, unsigned long origin) ··· 573 } 574 return ret; 575 } 576 EXPORT_SYMBOL_GPL(parse_mtd_partitions);
+14 -14
drivers/mtd/nand/Kconfig
··· 1 # drivers/mtd/nand/Kconfig 2 - # $Id: Kconfig,v 1.35 2005/11/07 11:14:30 gleixner Exp $ 3 4 menuconfig MTD_NAND 5 tristate "NAND Device Support" ··· 271 272 If you say "m", the module will be called "cs553x_nand.ko". 273 274 - config MTD_NAND_AT91 275 - bool "Support for NAND Flash / SmartMedia on AT91" 276 - depends on ARCH_AT91 277 help 278 Enables support for NAND Flash / Smart Media Card interface 279 - on Atmel AT91 processors. 280 choice 281 - prompt "ECC management for NAND Flash / SmartMedia on AT91" 282 - depends on MTD_NAND_AT91 283 284 - config MTD_NAND_AT91_ECC_HW 285 bool "Hardware ECC" 286 - depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9260 287 help 288 - Uses hardware ECC provided by the at91sam9260/at91sam9263 chip 289 - instead of software ECC. 290 The hardware ECC controller is capable of single bit error 291 correction and 2-bit random detection per page. 292 ··· 297 298 If unsure, say Y 299 300 - config MTD_NAND_AT91_ECC_SOFT 301 bool "Software ECC" 302 help 303 - Uses software ECC. 304 305 NB : hardware and software ECC schemes are incompatible. 306 If you switch from one to another, you'll have to erase your 307 mtd partition. 308 309 - config MTD_NAND_AT91_ECC_NONE 310 bool "No ECC (testing only, DANGEROUS)" 311 depends on DEBUG_KERNEL 312 help
··· 1 # drivers/mtd/nand/Kconfig 2 3 menuconfig MTD_NAND 4 tristate "NAND Device Support" ··· 272 273 If you say "m", the module will be called "cs553x_nand.ko". 274 275 + config MTD_NAND_ATMEL 276 + tristate "Support for NAND Flash / SmartMedia on AT91 and AVR32" 277 + depends on ARCH_AT91 || AVR32 278 help 279 Enables support for NAND Flash / Smart Media Card interface 280 + on Atmel AT91 and AVR32 processors. 281 choice 282 + prompt "ECC management for NAND Flash / SmartMedia on AT91 / AVR32" 283 + depends on MTD_NAND_ATMEL 284 285 + config MTD_NAND_ATMEL_ECC_HW 286 bool "Hardware ECC" 287 + depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9260 || AVR32 288 help 289 + Use hardware ECC instead of software ECC when the chip 290 + supports it. 291 + 292 The hardware ECC controller is capable of single bit error 293 correction and 2-bit random detection per page. 294 ··· 297 298 If unsure, say Y 299 300 + config MTD_NAND_ATMEL_ECC_SOFT 301 bool "Software ECC" 302 help 303 + Use software ECC. 304 305 NB : hardware and software ECC schemes are incompatible. 306 If you switch from one to another, you'll have to erase your 307 mtd partition. 308 309 + config MTD_NAND_ATMEL_ECC_NONE 310 bool "No ECC (testing only, DANGEROUS)" 311 depends on DEBUG_KERNEL 312 help
+1 -2
drivers/mtd/nand/Makefile
··· 1 # 2 # linux/drivers/nand/Makefile 3 # 4 - # $Id: Makefile.common,v 1.15 2004/11/26 12:28:22 dedekind Exp $ 5 6 obj-$(CONFIG_MTD_NAND) += nand.o nand_ecc.o 7 obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o ··· 23 obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o 24 obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o 25 obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o 26 - obj-$(CONFIG_MTD_NAND_AT91) += at91_nand.o 27 obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o 28 obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o 29 obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o
··· 1 # 2 # linux/drivers/nand/Makefile 3 # 4 5 obj-$(CONFIG_MTD_NAND) += nand.o nand_ecc.o 6 obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o ··· 24 obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o 25 obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o 26 obj-$(CONFIG_MTD_NAND_NDFC) += ndfc.o 27 + obj-$(CONFIG_MTD_NAND_ATMEL) += atmel_nand.o 28 obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o 29 obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o 30 obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o
+167 -111
drivers/mtd/nand/at91_nand.c drivers/mtd/nand/atmel_nand.c
··· 1 /* 2 - * drivers/mtd/nand/at91_nand.c 3 - * 4 * Copyright (C) 2003 Rick Bronson 5 * 6 * Derived from drivers/mtd/nand/autcpu12.c ··· 29 #include <linux/mtd/nand.h> 30 #include <linux/mtd/partitions.h> 31 32 - #include <asm/io.h> 33 - #include <asm/sizes.h> 34 35 - #include <asm/hardware.h> 36 #include <asm/arch/board.h> 37 - #include <asm/arch/gpio.h> 38 39 - #ifdef CONFIG_MTD_NAND_AT91_ECC_HW 40 #define hard_ecc 1 41 #else 42 #define hard_ecc 0 43 #endif 44 45 - #ifdef CONFIG_MTD_NAND_AT91_ECC_NONE 46 #define no_ecc 1 47 #else 48 #define no_ecc 0 ··· 49 50 /* Register access macros */ 51 #define ecc_readl(add, reg) \ 52 - __raw_readl(add + AT91_ECC_##reg) 53 #define ecc_writel(add, reg, value) \ 54 - __raw_writel((value), add + AT91_ECC_##reg) 55 56 - #include <asm/arch/at91_ecc.h> /* AT91SAM9260/3 ECC registers */ 57 58 /* oob layout for large page size 59 * bad block info is on bytes 0 and 1 60 * the bytes have to be consecutives to avoid 61 * several NAND_CMD_RNDOUT during read 62 */ 63 - static struct nand_ecclayout at91_oobinfo_large = { 64 .eccbytes = 4, 65 .eccpos = {60, 61, 62, 63}, 66 .oobfree = { ··· 73 * the bytes have to be consecutives to avoid 74 * several NAND_CMD_RNDOUT during read 75 */ 76 - static struct nand_ecclayout at91_oobinfo_small = { 77 .eccbytes = 4, 78 .eccpos = {0, 1, 2, 3}, 79 .oobfree = { ··· 81 }, 82 }; 83 84 - struct at91_nand_host { 85 struct nand_chip nand_chip; 86 struct mtd_info mtd; 87 void __iomem *io_base; 88 - struct at91_nand_data *board; 89 struct device *dev; 90 void __iomem *ecc; 91 }; ··· 93 /* 94 * Enable NAND. 95 */ 96 - static void at91_nand_enable(struct at91_nand_host *host) 97 { 98 if (host->board->enable_pin) 99 - at91_set_gpio_value(host->board->enable_pin, 0); 100 } 101 102 /* 103 * Disable NAND. 104 */ 105 - static void at91_nand_disable(struct at91_nand_host *host) 106 { 107 if (host->board->enable_pin) 108 - at91_set_gpio_value(host->board->enable_pin, 1); 109 } 110 111 /* 112 * Hardware specific access to control-lines 113 */ 114 - static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) 115 { 116 struct nand_chip *nand_chip = mtd->priv; 117 - struct at91_nand_host *host = nand_chip->priv; 118 119 if (ctrl & NAND_CTRL_CHANGE) { 120 if (ctrl & NAND_NCE) 121 - at91_nand_enable(host); 122 else 123 - at91_nand_disable(host); 124 } 125 if (cmd == NAND_CMD_NONE) 126 return; ··· 134 /* 135 * Read the Device Ready pin. 136 */ 137 - static int at91_nand_device_ready(struct mtd_info *mtd) 138 { 139 struct nand_chip *nand_chip = mtd->priv; 140 - struct at91_nand_host *host = nand_chip->priv; 141 142 - return at91_get_gpio_value(host->board->rdy_pin); 143 } 144 145 /* 146 * write oob for small pages 147 */ 148 - static int at91_nand_write_oob_512(struct mtd_info *mtd, 149 struct nand_chip *chip, int page) 150 { 151 int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad; ··· 204 /* 205 * read oob for small pages 206 */ 207 - static int at91_nand_read_oob_512(struct mtd_info *mtd, 208 struct nand_chip *chip, int page, int sndcmd) 209 { 210 if (sndcmd) { ··· 224 * dat: raw data (unused) 225 * ecc_code: buffer for ECC 226 */ 227 - static int at91_nand_calculate(struct mtd_info *mtd, 228 const u_char *dat, unsigned char *ecc_code) 229 { 230 struct nand_chip *nand_chip = mtd->priv; 231 - struct at91_nand_host *host = nand_chip->priv; 232 uint32_t *eccpos = nand_chip->ecc.layout->eccpos; 233 unsigned int ecc_value; 234 ··· 239 ecc_code[eccpos[1]] = (ecc_value >> 8) & 0xFF; 240 241 /* get the last 2 ECC bytes */ 242 - ecc_value = ecc_readl(host->ecc, NPR) & AT91_ECC_NPARITY; 243 244 ecc_code[eccpos[2]] = ecc_value & 0xFF; 245 ecc_code[eccpos[3]] = (ecc_value >> 8) & 0xFF; ··· 254 * chip: nand chip info structure 255 * buf: buffer to store read data 256 */ 257 - static int at91_nand_read_page(struct mtd_info *mtd, 258 struct nand_chip *chip, uint8_t *buf) 259 { 260 int eccsize = chip->ecc.size; ··· 264 uint8_t *oob = chip->oob_poi; 265 uint8_t *ecc_pos; 266 int stat; 267 268 /* read the page */ 269 chip->read_buf(mtd, p, eccsize); ··· 326 * 327 * Detect and correct a 1 bit error for a page 328 */ 329 - static int at91_nand_correct(struct mtd_info *mtd, u_char *dat, 330 u_char *read_ecc, u_char *isnull) 331 { 332 struct nand_chip *nand_chip = mtd->priv; 333 - struct at91_nand_host *host = nand_chip->priv; 334 unsigned int ecc_status; 335 unsigned int ecc_word, ecc_bit; 336 ··· 338 ecc_status = ecc_readl(host->ecc, SR); 339 340 /* if there's no error */ 341 - if (likely(!(ecc_status & AT91_ECC_RECERR))) 342 return 0; 343 344 /* get error bit offset (4 bits) */ 345 - ecc_bit = ecc_readl(host->ecc, PR) & AT91_ECC_BITADDR; 346 /* get word address (12 bits) */ 347 - ecc_word = ecc_readl(host->ecc, PR) & AT91_ECC_WORDADDR; 348 ecc_word >>= 4; 349 350 /* if there are multiple errors */ 351 - if (ecc_status & AT91_ECC_MULERR) { 352 /* check if it is a freshly erased block 353 * (filled with 0xff) */ 354 - if ((ecc_bit == AT91_ECC_BITADDR) 355 - && (ecc_word == (AT91_ECC_WORDADDR >> 4))) { 356 /* the block has just been erased, return OK */ 357 return 0; 358 } 359 /* it doesn't seems to be a freshly 360 * erased block. 361 * We can't correct so many errors */ 362 - dev_dbg(host->dev, "at91_nand : multiple errors detected." 363 " Unable to correct.\n"); 364 return -EIO; 365 } 366 367 /* if there's a single bit error : we can correct it */ 368 - if (ecc_status & AT91_ECC_ECCERR) { 369 /* there's nothing much to do here. 370 * the bit error is on the ECC itself. 371 */ 372 - dev_dbg(host->dev, "at91_nand : one bit error on ECC code." 373 " Nothing to correct\n"); 374 return 0; 375 } 376 377 - dev_dbg(host->dev, "at91_nand : one bit error on data." 378 " (word offset in the page :" 379 " 0x%x bit offset : 0x%x)\n", 380 ecc_word, ecc_bit); ··· 386 /* 8 bits words */ 387 dat[ecc_word] ^= (1 << ecc_bit); 388 } 389 - dev_dbg(host->dev, "at91_nand : error corrected\n"); 390 return 1; 391 } 392 393 /* 394 - * Enable HW ECC : unsused 395 */ 396 - static void at91_nand_hwctl(struct mtd_info *mtd, int mode) { ; } 397 398 #ifdef CONFIG_MTD_PARTITIONS 399 static const char *part_probes[] = { "cmdlinepart", NULL }; ··· 409 /* 410 * Probe for the NAND device. 411 */ 412 - static int __init at91_nand_probe(struct platform_device *pdev) 413 { 414 - struct at91_nand_host *host; 415 struct mtd_info *mtd; 416 struct nand_chip *nand_chip; 417 struct resource *regs; ··· 423 int num_partitions = 0; 424 #endif 425 426 - /* Allocate memory for the device structure (and zero it) */ 427 - host = kzalloc(sizeof(struct at91_nand_host), GFP_KERNEL); 428 - if (!host) { 429 - printk(KERN_ERR "at91_nand: failed to allocate device structure.\n"); 430 - return -ENOMEM; 431 - } 432 - 433 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 434 if (!mem) { 435 - printk(KERN_ERR "at91_nand: can't get I/O resource mem\n"); 436 return -ENXIO; 437 } 438 439 host->io_base = ioremap(mem->start, mem->end - mem->start + 1); 440 if (host->io_base == NULL) { 441 - printk(KERN_ERR "at91_nand: ioremap failed\n"); 442 - kfree(host); 443 - return -EIO; 444 } 445 446 mtd = &host->mtd; ··· 455 /* Set address of NAND IO lines */ 456 nand_chip->IO_ADDR_R = host->io_base; 457 nand_chip->IO_ADDR_W = host->io_base; 458 - nand_chip->cmd_ctrl = at91_nand_cmd_ctrl; 459 460 if (host->board->rdy_pin) 461 - nand_chip->dev_ready = at91_nand_device_ready; 462 463 regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); 464 if (!regs && hard_ecc) { 465 - printk(KERN_ERR "at91_nand: can't get I/O resource " 466 "regs\nFalling back on software ECC\n"); 467 } 468 ··· 472 if (hard_ecc && regs) { 473 host->ecc = ioremap(regs->start, regs->end - regs->start + 1); 474 if (host->ecc == NULL) { 475 - printk(KERN_ERR "at91_nand: ioremap failed\n"); 476 res = -EIO; 477 goto err_ecc_ioremap; 478 } 479 nand_chip->ecc.mode = NAND_ECC_HW_SYNDROME; 480 - nand_chip->ecc.calculate = at91_nand_calculate; 481 - nand_chip->ecc.correct = at91_nand_correct; 482 - nand_chip->ecc.hwctl = at91_nand_hwctl; 483 - nand_chip->ecc.read_page = at91_nand_read_page; 484 nand_chip->ecc.bytes = 4; 485 nand_chip->ecc.prepad = 0; 486 nand_chip->ecc.postpad = 0; ··· 488 489 nand_chip->chip_delay = 20; /* 20us command delay time */ 490 491 - if (host->board->bus_width_16) /* 16-bit bus width */ 492 nand_chip->options |= NAND_BUSWIDTH_16; 493 494 platform_set_drvdata(pdev, host); 495 - at91_nand_enable(host); 496 497 if (host->board->det_pin) { 498 - if (at91_get_gpio_value(host->board->det_pin)) { 499 - printk ("No SmartMedia card inserted.\n"); 500 res = ENXIO; 501 - goto out; 502 } 503 } 504 505 /* first scan to find the device and get the page size */ 506 if (nand_scan_ident(mtd, 1)) { 507 res = -ENXIO; 508 - goto out; 509 } 510 511 if (nand_chip->ecc.mode == NAND_ECC_HW_SYNDROME) { ··· 521 /* set ECC page size and oob layout */ 522 switch (mtd->writesize) { 523 case 512: 524 - nand_chip->ecc.layout = &at91_oobinfo_small; 525 - nand_chip->ecc.read_oob = at91_nand_read_oob_512; 526 - nand_chip->ecc.write_oob = at91_nand_write_oob_512; 527 - ecc_writel(host->ecc, MR, AT91_ECC_PAGESIZE_528); 528 break; 529 case 1024: 530 - nand_chip->ecc.layout = &at91_oobinfo_large; 531 - ecc_writel(host->ecc, MR, AT91_ECC_PAGESIZE_1056); 532 break; 533 case 2048: 534 - nand_chip->ecc.layout = &at91_oobinfo_large; 535 - ecc_writel(host->ecc, MR, AT91_ECC_PAGESIZE_2112); 536 break; 537 case 4096: 538 - nand_chip->ecc.layout = &at91_oobinfo_large; 539 - ecc_writel(host->ecc, MR, AT91_ECC_PAGESIZE_4224); 540 break; 541 default: 542 /* page size not handled by HW ECC */ ··· 556 /* second phase scan */ 557 if (nand_scan_tail(mtd)) { 558 res = -ENXIO; 559 - goto out; 560 } 561 562 #ifdef CONFIG_MTD_PARTITIONS 563 #ifdef CONFIG_MTD_CMDLINE_PARTS 564 - mtd->name = "at91_nand"; 565 num_partitions = parse_mtd_partitions(mtd, part_probes, 566 &partitions, 0); 567 #endif ··· 570 &num_partitions); 571 572 if ((!partitions) || (num_partitions == 0)) { 573 - printk(KERN_ERR "at91_nand: No parititions defined, or unsupported device.\n"); 574 res = ENXIO; 575 - goto release; 576 } 577 578 res = add_mtd_partitions(mtd, partitions, num_partitions); ··· 584 return res; 585 586 #ifdef CONFIG_MTD_PARTITIONS 587 - release: 588 #endif 589 nand_release(mtd); 590 - 591 - out: 592 - iounmap(host->ecc); 593 - 594 - err_ecc_ioremap: 595 - at91_nand_disable(host); 596 platform_set_drvdata(pdev, NULL); 597 iounmap(host->io_base); 598 kfree(host); 599 return res; 600 } ··· 604 /* 605 * Remove a NAND device. 606 */ 607 - static int __devexit at91_nand_remove(struct platform_device *pdev) 608 { 609 - struct at91_nand_host *host = platform_get_drvdata(pdev); 610 struct mtd_info *mtd = &host->mtd; 611 612 nand_release(mtd); 613 614 - at91_nand_disable(host); 615 616 iounmap(host->io_base); 617 - iounmap(host->ecc); 618 kfree(host); 619 620 return 0; 621 } 622 623 - static struct platform_driver at91_nand_driver = { 624 - .probe = at91_nand_probe, 625 - .remove = at91_nand_remove, 626 .driver = { 627 - .name = "at91_nand", 628 .owner = THIS_MODULE, 629 }, 630 }; 631 632 - static int __init at91_nand_init(void) 633 { 634 - return platform_driver_register(&at91_nand_driver); 635 } 636 637 638 - static void __exit at91_nand_exit(void) 639 { 640 - platform_driver_unregister(&at91_nand_driver); 641 } 642 643 644 - module_init(at91_nand_init); 645 - module_exit(at91_nand_exit); 646 647 MODULE_LICENSE("GPL"); 648 MODULE_AUTHOR("Rick Bronson"); 649 - MODULE_DESCRIPTION("NAND/SmartMedia driver for AT91RM9200 / AT91SAM9"); 650 - MODULE_ALIAS("platform:at91_nand");
··· 1 /* 2 * Copyright (C) 2003 Rick Bronson 3 * 4 * Derived from drivers/mtd/nand/autcpu12.c ··· 31 #include <linux/mtd/nand.h> 32 #include <linux/mtd/partitions.h> 33 34 + #include <linux/gpio.h> 35 + #include <linux/io.h> 36 37 #include <asm/arch/board.h> 38 + #include <asm/arch/cpu.h> 39 40 + #ifdef CONFIG_MTD_NAND_ATMEL_ECC_HW 41 #define hard_ecc 1 42 #else 43 #define hard_ecc 0 44 #endif 45 46 + #ifdef CONFIG_MTD_NAND_ATMEL_ECC_NONE 47 #define no_ecc 1 48 #else 49 #define no_ecc 0 ··· 52 53 /* Register access macros */ 54 #define ecc_readl(add, reg) \ 55 + __raw_readl(add + ATMEL_ECC_##reg) 56 #define ecc_writel(add, reg, value) \ 57 + __raw_writel((value), add + ATMEL_ECC_##reg) 58 59 + #include "atmel_nand_ecc.h" /* Hardware ECC registers */ 60 61 /* oob layout for large page size 62 * bad block info is on bytes 0 and 1 63 * the bytes have to be consecutives to avoid 64 * several NAND_CMD_RNDOUT during read 65 */ 66 + static struct nand_ecclayout atmel_oobinfo_large = { 67 .eccbytes = 4, 68 .eccpos = {60, 61, 62, 63}, 69 .oobfree = { ··· 76 * the bytes have to be consecutives to avoid 77 * several NAND_CMD_RNDOUT during read 78 */ 79 + static struct nand_ecclayout atmel_oobinfo_small = { 80 .eccbytes = 4, 81 .eccpos = {0, 1, 2, 3}, 82 .oobfree = { ··· 84 }, 85 }; 86 87 + struct atmel_nand_host { 88 struct nand_chip nand_chip; 89 struct mtd_info mtd; 90 void __iomem *io_base; 91 + struct atmel_nand_data *board; 92 struct device *dev; 93 void __iomem *ecc; 94 }; ··· 96 /* 97 * Enable NAND. 98 */ 99 + static void atmel_nand_enable(struct atmel_nand_host *host) 100 { 101 if (host->board->enable_pin) 102 + gpio_set_value(host->board->enable_pin, 0); 103 } 104 105 /* 106 * Disable NAND. 107 */ 108 + static void atmel_nand_disable(struct atmel_nand_host *host) 109 { 110 if (host->board->enable_pin) 111 + gpio_set_value(host->board->enable_pin, 1); 112 } 113 114 /* 115 * Hardware specific access to control-lines 116 */ 117 + static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) 118 { 119 struct nand_chip *nand_chip = mtd->priv; 120 + struct atmel_nand_host *host = nand_chip->priv; 121 122 if (ctrl & NAND_CTRL_CHANGE) { 123 if (ctrl & NAND_NCE) 124 + atmel_nand_enable(host); 125 else 126 + atmel_nand_disable(host); 127 } 128 if (cmd == NAND_CMD_NONE) 129 return; ··· 137 /* 138 * Read the Device Ready pin. 139 */ 140 + static int atmel_nand_device_ready(struct mtd_info *mtd) 141 { 142 struct nand_chip *nand_chip = mtd->priv; 143 + struct atmel_nand_host *host = nand_chip->priv; 144 145 + return gpio_get_value(host->board->rdy_pin); 146 + } 147 + 148 + /* 149 + * Minimal-overhead PIO for data access. 150 + */ 151 + static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) 152 + { 153 + struct nand_chip *nand_chip = mtd->priv; 154 + 155 + __raw_readsb(nand_chip->IO_ADDR_R, buf, len); 156 + } 157 + 158 + static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len) 159 + { 160 + struct nand_chip *nand_chip = mtd->priv; 161 + 162 + __raw_readsw(nand_chip->IO_ADDR_R, buf, len / 2); 163 + } 164 + 165 + static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) 166 + { 167 + struct nand_chip *nand_chip = mtd->priv; 168 + 169 + __raw_writesb(nand_chip->IO_ADDR_W, buf, len); 170 + } 171 + 172 + static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len) 173 + { 174 + struct nand_chip *nand_chip = mtd->priv; 175 + 176 + __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2); 177 } 178 179 /* 180 * write oob for small pages 181 */ 182 + static int atmel_nand_write_oob_512(struct mtd_info *mtd, 183 struct nand_chip *chip, int page) 184 { 185 int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad; ··· 176 /* 177 * read oob for small pages 178 */ 179 + static int atmel_nand_read_oob_512(struct mtd_info *mtd, 180 struct nand_chip *chip, int page, int sndcmd) 181 { 182 if (sndcmd) { ··· 196 * dat: raw data (unused) 197 * ecc_code: buffer for ECC 198 */ 199 + static int atmel_nand_calculate(struct mtd_info *mtd, 200 const u_char *dat, unsigned char *ecc_code) 201 { 202 struct nand_chip *nand_chip = mtd->priv; 203 + struct atmel_nand_host *host = nand_chip->priv; 204 uint32_t *eccpos = nand_chip->ecc.layout->eccpos; 205 unsigned int ecc_value; 206 ··· 211 ecc_code[eccpos[1]] = (ecc_value >> 8) & 0xFF; 212 213 /* get the last 2 ECC bytes */ 214 + ecc_value = ecc_readl(host->ecc, NPR) & ATMEL_ECC_NPARITY; 215 216 ecc_code[eccpos[2]] = ecc_value & 0xFF; 217 ecc_code[eccpos[3]] = (ecc_value >> 8) & 0xFF; ··· 226 * chip: nand chip info structure 227 * buf: buffer to store read data 228 */ 229 + static int atmel_nand_read_page(struct mtd_info *mtd, 230 struct nand_chip *chip, uint8_t *buf) 231 { 232 int eccsize = chip->ecc.size; ··· 236 uint8_t *oob = chip->oob_poi; 237 uint8_t *ecc_pos; 238 int stat; 239 + 240 + /* 241 + * Errata: ALE is incorrectly wired up to the ECC controller 242 + * on the AP7000, so it will include the address cycles in the 243 + * ECC calculation. 244 + * 245 + * Workaround: Reset the parity registers before reading the 246 + * actual data. 247 + */ 248 + if (cpu_is_at32ap7000()) { 249 + struct atmel_nand_host *host = chip->priv; 250 + ecc_writel(host->ecc, CR, ATMEL_ECC_RST); 251 + } 252 253 /* read the page */ 254 chip->read_buf(mtd, p, eccsize); ··· 285 * 286 * Detect and correct a 1 bit error for a page 287 */ 288 + static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat, 289 u_char *read_ecc, u_char *isnull) 290 { 291 struct nand_chip *nand_chip = mtd->priv; 292 + struct atmel_nand_host *host = nand_chip->priv; 293 unsigned int ecc_status; 294 unsigned int ecc_word, ecc_bit; 295 ··· 297 ecc_status = ecc_readl(host->ecc, SR); 298 299 /* if there's no error */ 300 + if (likely(!(ecc_status & ATMEL_ECC_RECERR))) 301 return 0; 302 303 /* get error bit offset (4 bits) */ 304 + ecc_bit = ecc_readl(host->ecc, PR) & ATMEL_ECC_BITADDR; 305 /* get word address (12 bits) */ 306 + ecc_word = ecc_readl(host->ecc, PR) & ATMEL_ECC_WORDADDR; 307 ecc_word >>= 4; 308 309 /* if there are multiple errors */ 310 + if (ecc_status & ATMEL_ECC_MULERR) { 311 /* check if it is a freshly erased block 312 * (filled with 0xff) */ 313 + if ((ecc_bit == ATMEL_ECC_BITADDR) 314 + && (ecc_word == (ATMEL_ECC_WORDADDR >> 4))) { 315 /* the block has just been erased, return OK */ 316 return 0; 317 } 318 /* it doesn't seems to be a freshly 319 * erased block. 320 * We can't correct so many errors */ 321 + dev_dbg(host->dev, "atmel_nand : multiple errors detected." 322 " Unable to correct.\n"); 323 return -EIO; 324 } 325 326 /* if there's a single bit error : we can correct it */ 327 + if (ecc_status & ATMEL_ECC_ECCERR) { 328 /* there's nothing much to do here. 329 * the bit error is on the ECC itself. 330 */ 331 + dev_dbg(host->dev, "atmel_nand : one bit error on ECC code." 332 " Nothing to correct\n"); 333 return 0; 334 } 335 336 + dev_dbg(host->dev, "atmel_nand : one bit error on data." 337 " (word offset in the page :" 338 " 0x%x bit offset : 0x%x)\n", 339 ecc_word, ecc_bit); ··· 345 /* 8 bits words */ 346 dat[ecc_word] ^= (1 << ecc_bit); 347 } 348 + dev_dbg(host->dev, "atmel_nand : error corrected\n"); 349 return 1; 350 } 351 352 /* 353 + * Enable HW ECC : unused on most chips 354 */ 355 + static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) 356 + { 357 + if (cpu_is_at32ap7000()) { 358 + struct nand_chip *nand_chip = mtd->priv; 359 + struct atmel_nand_host *host = nand_chip->priv; 360 + ecc_writel(host->ecc, CR, ATMEL_ECC_RST); 361 + } 362 + } 363 364 #ifdef CONFIG_MTD_PARTITIONS 365 static const char *part_probes[] = { "cmdlinepart", NULL }; ··· 361 /* 362 * Probe for the NAND device. 363 */ 364 + static int __init atmel_nand_probe(struct platform_device *pdev) 365 { 366 + struct atmel_nand_host *host; 367 struct mtd_info *mtd; 368 struct nand_chip *nand_chip; 369 struct resource *regs; ··· 375 int num_partitions = 0; 376 #endif 377 378 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 379 if (!mem) { 380 + printk(KERN_ERR "atmel_nand: can't get I/O resource mem\n"); 381 return -ENXIO; 382 + } 383 + 384 + /* Allocate memory for the device structure (and zero it) */ 385 + host = kzalloc(sizeof(struct atmel_nand_host), GFP_KERNEL); 386 + if (!host) { 387 + printk(KERN_ERR "atmel_nand: failed to allocate device structure.\n"); 388 + return -ENOMEM; 389 } 390 391 host->io_base = ioremap(mem->start, mem->end - mem->start + 1); 392 if (host->io_base == NULL) { 393 + printk(KERN_ERR "atmel_nand: ioremap failed\n"); 394 + res = -EIO; 395 + goto err_nand_ioremap; 396 } 397 398 mtd = &host->mtd; ··· 407 /* Set address of NAND IO lines */ 408 nand_chip->IO_ADDR_R = host->io_base; 409 nand_chip->IO_ADDR_W = host->io_base; 410 + nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl; 411 412 if (host->board->rdy_pin) 413 + nand_chip->dev_ready = atmel_nand_device_ready; 414 415 regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); 416 if (!regs && hard_ecc) { 417 + printk(KERN_ERR "atmel_nand: can't get I/O resource " 418 "regs\nFalling back on software ECC\n"); 419 } 420 ··· 424 if (hard_ecc && regs) { 425 host->ecc = ioremap(regs->start, regs->end - regs->start + 1); 426 if (host->ecc == NULL) { 427 + printk(KERN_ERR "atmel_nand: ioremap failed\n"); 428 res = -EIO; 429 goto err_ecc_ioremap; 430 } 431 nand_chip->ecc.mode = NAND_ECC_HW_SYNDROME; 432 + nand_chip->ecc.calculate = atmel_nand_calculate; 433 + nand_chip->ecc.correct = atmel_nand_correct; 434 + nand_chip->ecc.hwctl = atmel_nand_hwctl; 435 + nand_chip->ecc.read_page = atmel_nand_read_page; 436 nand_chip->ecc.bytes = 4; 437 nand_chip->ecc.prepad = 0; 438 nand_chip->ecc.postpad = 0; ··· 440 441 nand_chip->chip_delay = 20; /* 20us command delay time */ 442 443 + if (host->board->bus_width_16) { /* 16-bit bus width */ 444 nand_chip->options |= NAND_BUSWIDTH_16; 445 + nand_chip->read_buf = atmel_read_buf16; 446 + nand_chip->write_buf = atmel_write_buf16; 447 + } else { 448 + nand_chip->read_buf = atmel_read_buf; 449 + nand_chip->write_buf = atmel_write_buf; 450 + } 451 452 platform_set_drvdata(pdev, host); 453 + atmel_nand_enable(host); 454 455 if (host->board->det_pin) { 456 + if (gpio_get_value(host->board->det_pin)) { 457 + printk("No SmartMedia card inserted.\n"); 458 res = ENXIO; 459 + goto err_no_card; 460 } 461 } 462 463 /* first scan to find the device and get the page size */ 464 if (nand_scan_ident(mtd, 1)) { 465 res = -ENXIO; 466 + goto err_scan_ident; 467 } 468 469 if (nand_chip->ecc.mode == NAND_ECC_HW_SYNDROME) { ··· 467 /* set ECC page size and oob layout */ 468 switch (mtd->writesize) { 469 case 512: 470 + nand_chip->ecc.layout = &atmel_oobinfo_small; 471 + nand_chip->ecc.read_oob = atmel_nand_read_oob_512; 472 + nand_chip->ecc.write_oob = atmel_nand_write_oob_512; 473 + ecc_writel(host->ecc, MR, ATMEL_ECC_PAGESIZE_528); 474 break; 475 case 1024: 476 + nand_chip->ecc.layout = &atmel_oobinfo_large; 477 + ecc_writel(host->ecc, MR, ATMEL_ECC_PAGESIZE_1056); 478 break; 479 case 2048: 480 + nand_chip->ecc.layout = &atmel_oobinfo_large; 481 + ecc_writel(host->ecc, MR, ATMEL_ECC_PAGESIZE_2112); 482 break; 483 case 4096: 484 + nand_chip->ecc.layout = &atmel_oobinfo_large; 485 + ecc_writel(host->ecc, MR, ATMEL_ECC_PAGESIZE_4224); 486 break; 487 default: 488 /* page size not handled by HW ECC */ ··· 502 /* second phase scan */ 503 if (nand_scan_tail(mtd)) { 504 res = -ENXIO; 505 + goto err_scan_tail; 506 } 507 508 #ifdef CONFIG_MTD_PARTITIONS 509 #ifdef CONFIG_MTD_CMDLINE_PARTS 510 + mtd->name = "atmel_nand"; 511 num_partitions = parse_mtd_partitions(mtd, part_probes, 512 &partitions, 0); 513 #endif ··· 516 &num_partitions); 517 518 if ((!partitions) || (num_partitions == 0)) { 519 + printk(KERN_ERR "atmel_nand: No parititions defined, or unsupported device.\n"); 520 res = ENXIO; 521 + goto err_no_partitions; 522 } 523 524 res = add_mtd_partitions(mtd, partitions, num_partitions); ··· 530 return res; 531 532 #ifdef CONFIG_MTD_PARTITIONS 533 + err_no_partitions: 534 #endif 535 nand_release(mtd); 536 + err_scan_tail: 537 + err_scan_ident: 538 + err_no_card: 539 + atmel_nand_disable(host); 540 platform_set_drvdata(pdev, NULL); 541 + if (host->ecc) 542 + iounmap(host->ecc); 543 + err_ecc_ioremap: 544 iounmap(host->io_base); 545 + err_nand_ioremap: 546 kfree(host); 547 return res; 548 } ··· 548 /* 549 * Remove a NAND device. 550 */ 551 + static int __exit atmel_nand_remove(struct platform_device *pdev) 552 { 553 + struct atmel_nand_host *host = platform_get_drvdata(pdev); 554 struct mtd_info *mtd = &host->mtd; 555 556 nand_release(mtd); 557 558 + atmel_nand_disable(host); 559 560 + if (host->ecc) 561 + iounmap(host->ecc); 562 iounmap(host->io_base); 563 kfree(host); 564 565 return 0; 566 } 567 568 + static struct platform_driver atmel_nand_driver = { 569 + .remove = __exit_p(atmel_nand_remove), 570 .driver = { 571 + .name = "atmel_nand", 572 .owner = THIS_MODULE, 573 }, 574 }; 575 576 + static int __init atmel_nand_init(void) 577 { 578 + return platform_driver_probe(&atmel_nand_driver, atmel_nand_probe); 579 } 580 581 582 + static void __exit atmel_nand_exit(void) 583 { 584 + platform_driver_unregister(&atmel_nand_driver); 585 } 586 587 588 + module_init(atmel_nand_init); 589 + module_exit(atmel_nand_exit); 590 591 MODULE_LICENSE("GPL"); 592 MODULE_AUTHOR("Rick Bronson"); 593 + MODULE_DESCRIPTION("NAND/SmartMedia driver for AT91 / AVR32"); 594 + MODULE_ALIAS("platform:atmel_nand");
+36
drivers/mtd/nand/atmel_nand_ecc.h
···
··· 1 + /* 2 + * Error Corrected Code Controller (ECC) - System peripherals regsters. 3 + * Based on AT91SAM9260 datasheet revision B. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms of the GNU General Public License as published by the 7 + * Free Software Foundation; either version 2 of the License, or (at your 8 + * option) any later version. 9 + */ 10 + 11 + #ifndef ATMEL_NAND_ECC_H 12 + #define ATMEL_NAND_ECC_H 13 + 14 + #define ATMEL_ECC_CR 0x00 /* Control register */ 15 + #define ATMEL_ECC_RST (1 << 0) /* Reset parity */ 16 + 17 + #define ATMEL_ECC_MR 0x04 /* Mode register */ 18 + #define ATMEL_ECC_PAGESIZE (3 << 0) /* Page Size */ 19 + #define ATMEL_ECC_PAGESIZE_528 (0) 20 + #define ATMEL_ECC_PAGESIZE_1056 (1) 21 + #define ATMEL_ECC_PAGESIZE_2112 (2) 22 + #define ATMEL_ECC_PAGESIZE_4224 (3) 23 + 24 + #define ATMEL_ECC_SR 0x08 /* Status register */ 25 + #define ATMEL_ECC_RECERR (1 << 0) /* Recoverable Error */ 26 + #define ATMEL_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */ 27 + #define ATMEL_ECC_MULERR (1 << 2) /* Multiple Errors */ 28 + 29 + #define ATMEL_ECC_PR 0x0c /* Parity register */ 30 + #define ATMEL_ECC_BITADDR (0xf << 0) /* Bit Error Address */ 31 + #define ATMEL_ECC_WORDADDR (0xfff << 4) /* Word Error Address */ 32 + 33 + #define ATMEL_ECC_NPR 0x10 /* NParity register */ 34 + #define ATMEL_ECC_NPARITY (0xffff << 0) /* NParity */ 35 + 36 + #endif
-4
drivers/mtd/nand/au1550nd.c
··· 3 * 4 * Copyright (C) 2004 Embedded Edge, LLC 5 * 6 - * $Id: au1550nd.c,v 1.13 2005/11/07 11:14:30 gleixner Exp $ 7 - * 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 10 * published by the Free Software Foundation. ··· 602 */ 603 static void __exit au1550_cleanup(void) 604 { 605 - struct nand_chip *this = (struct nand_chip *)&au1550_mtd[1]; 606 - 607 /* Release resources, unregister device */ 608 nand_release(au1550_mtd); 609
··· 3 * 4 * Copyright (C) 2004 Embedded Edge, LLC 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. ··· 604 */ 605 static void __exit au1550_cleanup(void) 606 { 607 /* Release resources, unregister device */ 608 nand_release(au1550_mtd); 609
-2
drivers/mtd/nand/autcpu12.c
··· 6 * Derived from drivers/mtd/spia.c 7 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 8 * 9 - * $Id: autcpu12.c,v 1.23 2005/11/07 11:14:30 gleixner Exp $ 10 - * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
··· 6 * Derived from drivers/mtd/spia.c 7 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 8 * 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 11 * published by the Free Software Foundation.
+4 -2
drivers/mtd/nand/cafe_nand.c
··· 626 { 627 struct mtd_info *mtd; 628 struct cafe_priv *cafe; 629 - struct mtd_partition *parts; 630 uint32_t ctrl; 631 - int nr_parts; 632 int err = 0; 633 634 /* Very old versions shared the same PCI ident for all three 635 functions on the chip. Verify the class too... */
··· 626 { 627 struct mtd_info *mtd; 628 struct cafe_priv *cafe; 629 uint32_t ctrl; 630 int err = 0; 631 + #ifdef CONFIG_MTD_PARTITIONS 632 + struct mtd_partition *parts; 633 + int nr_parts; 634 + #endif 635 636 /* Very old versions shared the same PCI ident for all three 637 functions on the chip. Verify the class too... */
-4
drivers/mtd/nand/diskonchip.c
··· 15 * converted to the generic Reed-Solomon library by Thomas Gleixner <tglx@linutronix.de> 16 * 17 * Interface to generic NAND code for M-Systems DiskOnChip devices 18 - * 19 - * $Id: diskonchip.c,v 1.55 2005/11/07 11:14:30 gleixner Exp $ 20 */ 21 22 #include <linux/kernel.h> ··· 52 0xe0000, 0xe2000, 0xe4000, 0xe6000, 53 0xe8000, 0xea000, 0xec000, 0xee000, 54 #endif /* CONFIG_MTD_DOCPROBE_HIGH */ 55 - #elif defined(__PPC__) 56 - 0xe4000000, 57 #else 58 #warning Unknown architecture for DiskOnChip. No default probe locations defined 59 #endif
··· 15 * converted to the generic Reed-Solomon library by Thomas Gleixner <tglx@linutronix.de> 16 * 17 * Interface to generic NAND code for M-Systems DiskOnChip devices 18 */ 19 20 #include <linux/kernel.h> ··· 54 0xe0000, 0xe2000, 0xe4000, 0xe6000, 55 0xe8000, 0xea000, 0xec000, 0xee000, 56 #endif /* CONFIG_MTD_DOCPROBE_HIGH */ 57 #else 58 #warning Unknown architecture for DiskOnChip. No default probe locations defined 59 #endif
-2
drivers/mtd/nand/edb7312.c
··· 6 * Derived from drivers/mtd/nand/autcpu12.c 7 * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) 8 * 9 - * $Id: edb7312.c,v 1.12 2005/11/07 11:14:30 gleixner Exp $ 10 - * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
··· 6 * Derived from drivers/mtd/nand/autcpu12.c 7 * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) 8 * 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 11 * published by the Free Software Foundation.
+1 -1
drivers/mtd/nand/excite_nandflash.c
··· 209 if (likely(!scan_res)) { 210 DEBUG(MTD_DEBUG_LEVEL2, "%s: register partitions\n", module_id); 211 add_mtd_partitions(&drvdata->board_mtd, partition_info, 212 - sizeof partition_info / sizeof partition_info[0]); 213 } else { 214 iounmap(drvdata->regs); 215 kfree(drvdata);
··· 209 if (likely(!scan_res)) { 210 DEBUG(MTD_DEBUG_LEVEL2, "%s: register partitions\n", module_id); 211 add_mtd_partitions(&drvdata->board_mtd, partition_info, 212 + ARRAY_SIZE(partition_info)); 213 } else { 214 iounmap(drvdata->regs); 215 kfree(drvdata);
+52 -11
drivers/mtd/nand/fsl_elbc_nand.c
··· 89 .eccbytes = 3, 90 .eccpos = {6, 7, 8}, 91 .oobfree = { {0, 5}, {9, 7} }, 92 - .oobavail = 12, 93 }; 94 95 /* Small Page FLASH with FMR[ECCM] = 1 */ ··· 96 .eccbytes = 3, 97 .eccpos = {8, 9, 10}, 98 .oobfree = { {0, 5}, {6, 2}, {11, 5} }, 99 - .oobavail = 12, 100 }; 101 102 /* Large Page FLASH with FMR[ECCM] = 0 */ ··· 103 .eccbytes = 12, 104 .eccpos = {6, 7, 8, 22, 23, 24, 38, 39, 40, 54, 55, 56}, 105 .oobfree = { {1, 5}, {9, 13}, {25, 13}, {41, 13}, {57, 7} }, 106 - .oobavail = 48, 107 }; 108 109 /* Large Page FLASH with FMR[ECCM] = 1 */ ··· 110 .eccbytes = 12, 111 .eccpos = {8, 9, 10, 24, 25, 26, 40, 41, 42, 56, 57, 58}, 112 .oobfree = { {1, 7}, {11, 13}, {27, 13}, {43, 13}, {59, 5} }, 113 - .oobavail = 48, 114 }; 115 116 /*=================================*/ ··· 725 chip->ecc.layout = (priv->fmr & FMR_ECCM) ? 726 &fsl_elbc_oob_lp_eccm1 : 727 &fsl_elbc_oob_lp_eccm0; 728 - mtd->ecclayout = chip->ecc.layout; 729 - mtd->oobavail = chip->ecc.layout->oobavail; 730 } 731 } else { 732 dev_err(ctrl->dev, ··· 789 chip->cmdfunc = fsl_elbc_cmdfunc; 790 chip->waitfunc = fsl_elbc_wait; 791 792 /* set up nand options */ 793 - chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR; 794 795 chip->controller = &ctrl->controller; 796 chip->priv = priv; ··· 836 return 0; 837 } 838 839 - static int fsl_elbc_chip_probe(struct fsl_elbc_ctrl *ctrl, 840 - struct device_node *node) 841 { 842 struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 843 struct fsl_elbc_mtd *priv; ··· 958 return 0; 959 } 960 961 - static int __devexit fsl_elbc_ctrl_remove(struct of_device *ofdev) 962 { 963 struct fsl_elbc_ctrl *ctrl = dev_get_drvdata(&ofdev->dev); 964 int i; ··· 1082 }, 1083 .match_table = fsl_elbc_match, 1084 .probe = fsl_elbc_ctrl_probe, 1085 - .remove = __devexit_p(fsl_elbc_ctrl_remove), 1086 }; 1087 1088 static int __init fsl_elbc_init(void)
··· 89 .eccbytes = 3, 90 .eccpos = {6, 7, 8}, 91 .oobfree = { {0, 5}, {9, 7} }, 92 }; 93 94 /* Small Page FLASH with FMR[ECCM] = 1 */ ··· 97 .eccbytes = 3, 98 .eccpos = {8, 9, 10}, 99 .oobfree = { {0, 5}, {6, 2}, {11, 5} }, 100 }; 101 102 /* Large Page FLASH with FMR[ECCM] = 0 */ ··· 105 .eccbytes = 12, 106 .eccpos = {6, 7, 8, 22, 23, 24, 38, 39, 40, 54, 55, 56}, 107 .oobfree = { {1, 5}, {9, 13}, {25, 13}, {41, 13}, {57, 7} }, 108 }; 109 110 /* Large Page FLASH with FMR[ECCM] = 1 */ ··· 113 .eccbytes = 12, 114 .eccpos = {8, 9, 10, 24, 25, 26, 40, 41, 42, 56, 57, 58}, 115 .oobfree = { {1, 7}, {11, 13}, {27, 13}, {43, 13}, {59, 5} }, 116 + }; 117 + 118 + /* 119 + * fsl_elbc_oob_lp_eccm* specify that LP NAND's OOB free area starts at offset 120 + * 1, so we have to adjust bad block pattern. This pattern should be used for 121 + * x8 chips only. So far hardware does not support x16 chips anyway. 122 + */ 123 + static u8 scan_ff_pattern[] = { 0xff, }; 124 + 125 + static struct nand_bbt_descr largepage_memorybased = { 126 + .options = 0, 127 + .offs = 0, 128 + .len = 1, 129 + .pattern = scan_ff_pattern, 130 + }; 131 + 132 + /* 133 + * ELBC may use HW ECC, so that OOB offsets, that NAND core uses for bbt, 134 + * interfere with ECC positions, that's why we implement our own descriptors. 135 + * OOB {11, 5}, works for both SP and LP chips, with ECCM = 1 and ECCM = 0. 136 + */ 137 + static u8 bbt_pattern[] = {'B', 'b', 't', '0' }; 138 + static u8 mirror_pattern[] = {'1', 't', 'b', 'B' }; 139 + 140 + static struct nand_bbt_descr bbt_main_descr = { 141 + .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | 142 + NAND_BBT_2BIT | NAND_BBT_VERSION, 143 + .offs = 11, 144 + .len = 4, 145 + .veroffs = 15, 146 + .maxblocks = 4, 147 + .pattern = bbt_pattern, 148 + }; 149 + 150 + static struct nand_bbt_descr bbt_mirror_descr = { 151 + .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE | NAND_BBT_WRITE | 152 + NAND_BBT_2BIT | NAND_BBT_VERSION, 153 + .offs = 11, 154 + .len = 4, 155 + .veroffs = 15, 156 + .maxblocks = 4, 157 + .pattern = mirror_pattern, 158 }; 159 160 /*=================================*/ ··· 687 chip->ecc.layout = (priv->fmr & FMR_ECCM) ? 688 &fsl_elbc_oob_lp_eccm1 : 689 &fsl_elbc_oob_lp_eccm0; 690 + chip->badblock_pattern = &largepage_memorybased; 691 } 692 } else { 693 dev_err(ctrl->dev, ··· 752 chip->cmdfunc = fsl_elbc_cmdfunc; 753 chip->waitfunc = fsl_elbc_wait; 754 755 + chip->bbt_td = &bbt_main_descr; 756 + chip->bbt_md = &bbt_mirror_descr; 757 + 758 /* set up nand options */ 759 + chip->options = NAND_NO_READRDY | NAND_NO_AUTOINCR | 760 + NAND_USE_FLASH_BBT; 761 762 chip->controller = &ctrl->controller; 763 chip->priv = priv; ··· 795 return 0; 796 } 797 798 + static int __devinit fsl_elbc_chip_probe(struct fsl_elbc_ctrl *ctrl, 799 + struct device_node *node) 800 { 801 struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 802 struct fsl_elbc_mtd *priv; ··· 917 return 0; 918 } 919 920 + static int fsl_elbc_ctrl_remove(struct of_device *ofdev) 921 { 922 struct fsl_elbc_ctrl *ctrl = dev_get_drvdata(&ofdev->dev); 923 int i; ··· 1041 }, 1042 .match_table = fsl_elbc_match, 1043 .probe = fsl_elbc_ctrl_probe, 1044 + .remove = fsl_elbc_ctrl_remove, 1045 }; 1046 1047 static int __init fsl_elbc_init(void)
-2
drivers/mtd/nand/h1910.c
··· 7 * Copyright (C) 2002 Marius Gröger (mag@sysgo.de) 8 * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) 9 * 10 - * $Id: h1910.c,v 1.6 2005/11/07 11:14:30 gleixner Exp $ 11 - * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License version 2 as 14 * published by the Free Software Foundation.
··· 7 * Copyright (C) 2002 Marius Gröger (mag@sysgo.de) 8 * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation.
+86 -1
drivers/mtd/nand/nand_base.c
··· 798 } 799 800 /** 801 * nand_read_page_hwecc - [REPLACABLE] hardware ecc based page read function 802 * @mtd: mtd info structure 803 * @chip: nand chip info structure ··· 1075 /* Now read the page into the buffer */ 1076 if (unlikely(ops->mode == MTD_OOB_RAW)) 1077 ret = chip->ecc.read_page_raw(mtd, chip, bufpoi); 1078 else 1079 ret = chip->ecc.read_page(mtd, chip, bufpoi); 1080 if (ret < 0) ··· 1084 1085 /* Transfer not aligned data */ 1086 if (!aligned) { 1087 - chip->pagebuf = realpage; 1088 memcpy(buf, chip->buffers->databuf + col, bytes); 1089 } 1090 ··· 2605 chip->ecc.calculate = nand_calculate_ecc; 2606 chip->ecc.correct = nand_correct_data; 2607 chip->ecc.read_page = nand_read_page_swecc; 2608 chip->ecc.write_page = nand_write_page_swecc; 2609 chip->ecc.read_oob = nand_read_oob_std; 2610 chip->ecc.write_oob = nand_write_oob_std;
··· 798 } 799 800 /** 801 + * nand_read_subpage - [REPLACABLE] software ecc based sub-page read function 802 + * @mtd: mtd info structure 803 + * @chip: nand chip info structure 804 + * @dataofs offset of requested data within the page 805 + * @readlen data length 806 + * @buf: buffer to store read data 807 + */ 808 + static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi) 809 + { 810 + int start_step, end_step, num_steps; 811 + uint32_t *eccpos = chip->ecc.layout->eccpos; 812 + uint8_t *p; 813 + int data_col_addr, i, gaps = 0; 814 + int datafrag_len, eccfrag_len, aligned_len, aligned_pos; 815 + int busw = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1; 816 + 817 + /* Column address wihin the page aligned to ECC size (256bytes). */ 818 + start_step = data_offs / chip->ecc.size; 819 + end_step = (data_offs + readlen - 1) / chip->ecc.size; 820 + num_steps = end_step - start_step + 1; 821 + 822 + /* Data size aligned to ECC ecc.size*/ 823 + datafrag_len = num_steps * chip->ecc.size; 824 + eccfrag_len = num_steps * chip->ecc.bytes; 825 + 826 + data_col_addr = start_step * chip->ecc.size; 827 + /* If we read not a page aligned data */ 828 + if (data_col_addr != 0) 829 + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1); 830 + 831 + p = bufpoi + data_col_addr; 832 + chip->read_buf(mtd, p, datafrag_len); 833 + 834 + /* Calculate ECC */ 835 + for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) 836 + chip->ecc.calculate(mtd, p, &chip->buffers->ecccalc[i]); 837 + 838 + /* The performance is faster if to position offsets 839 + according to ecc.pos. Let make sure here that 840 + there are no gaps in ecc positions */ 841 + for (i = 0; i < eccfrag_len - 1; i++) { 842 + if (eccpos[i + start_step * chip->ecc.bytes] + 1 != 843 + eccpos[i + start_step * chip->ecc.bytes + 1]) { 844 + gaps = 1; 845 + break; 846 + } 847 + } 848 + if (gaps) { 849 + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1); 850 + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); 851 + } else { 852 + /* send the command to read the particular ecc bytes */ 853 + /* take care about buswidth alignment in read_buf */ 854 + aligned_pos = eccpos[start_step * chip->ecc.bytes] & ~(busw - 1); 855 + aligned_len = eccfrag_len; 856 + if (eccpos[start_step * chip->ecc.bytes] & (busw - 1)) 857 + aligned_len++; 858 + if (eccpos[(start_step + num_steps) * chip->ecc.bytes] & (busw - 1)) 859 + aligned_len++; 860 + 861 + chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + aligned_pos, -1); 862 + chip->read_buf(mtd, &chip->oob_poi[aligned_pos], aligned_len); 863 + } 864 + 865 + for (i = 0; i < eccfrag_len; i++) 866 + chip->buffers->ecccode[i] = chip->oob_poi[eccpos[i + start_step * chip->ecc.bytes]]; 867 + 868 + p = bufpoi + data_col_addr; 869 + for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) { 870 + int stat; 871 + 872 + stat = chip->ecc.correct(mtd, p, &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]); 873 + if (stat == -1) 874 + mtd->ecc_stats.failed++; 875 + else 876 + mtd->ecc_stats.corrected += stat; 877 + } 878 + return 0; 879 + } 880 + 881 + /** 882 * nand_read_page_hwecc - [REPLACABLE] hardware ecc based page read function 883 * @mtd: mtd info structure 884 * @chip: nand chip info structure ··· 994 /* Now read the page into the buffer */ 995 if (unlikely(ops->mode == MTD_OOB_RAW)) 996 ret = chip->ecc.read_page_raw(mtd, chip, bufpoi); 997 + else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob) 998 + ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi); 999 else 1000 ret = chip->ecc.read_page(mtd, chip, bufpoi); 1001 if (ret < 0) ··· 1001 1002 /* Transfer not aligned data */ 1003 if (!aligned) { 1004 + if (!NAND_SUBPAGE_READ(chip) && !oob) 1005 + chip->pagebuf = realpage; 1006 memcpy(buf, chip->buffers->databuf + col, bytes); 1007 } 1008 ··· 2521 chip->ecc.calculate = nand_calculate_ecc; 2522 chip->ecc.correct = nand_correct_data; 2523 chip->ecc.read_page = nand_read_page_swecc; 2524 + chip->ecc.read_subpage = nand_read_subpage; 2525 chip->ecc.write_page = nand_write_page_swecc; 2526 chip->ecc.read_oob = nand_read_oob_std; 2527 chip->ecc.write_oob = nand_write_oob_std;
-2
drivers/mtd/nand/nand_bbt.c
··· 6 * 7 * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de) 8 * 9 - * $Id: nand_bbt.c,v 1.36 2005/11/07 11:14:30 gleixner Exp $ 10 - * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
··· 6 * 7 * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de) 8 * 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 11 * published by the Free Software Foundation.
-2
drivers/mtd/nand/nand_ecc.c
··· 9 * 10 * Copyright (C) 2006 Thomas Gleixner <tglx@linutronix.de> 11 * 12 - * $Id: nand_ecc.c,v 1.15 2005/11/07 11:14:30 gleixner Exp $ 13 - * 14 * This file is free software; you can redistribute it and/or modify it 15 * under the terms of the GNU General Public License as published by the 16 * Free Software Foundation; either version 2 or (at your option) any
··· 9 * 10 * Copyright (C) 2006 Thomas Gleixner <tglx@linutronix.de> 11 * 12 * This file is free software; you can redistribute it and/or modify it 13 * under the terms of the GNU General Public License as published by the 14 * Free Software Foundation; either version 2 or (at your option) any
-2
drivers/mtd/nand/nand_ids.c
··· 3 * 4 * Copyright (C) 2002 Thomas Gleixner (tglx@linutronix.de) 5 * 6 - * $Id: nand_ids.c,v 1.16 2005/11/07 11:14:31 gleixner Exp $ 7 - * 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 10 * published by the Free Software Foundation.
··· 3 * 4 * Copyright (C) 2002 Thomas Gleixner (tglx@linutronix.de) 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation.
+24 -17
drivers/mtd/nand/nandsim.c
··· 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 24 - * 25 - * $Id: nandsim.c,v 1.8 2005/03/19 15:33:56 dedekind Exp $ 26 */ 27 28 #include <linux/init.h> ··· 37 #include <linux/delay.h> 38 #include <linux/list.h> 39 #include <linux/random.h> 40 41 /* Default simulator parameters values */ 42 #if !defined(CONFIG_NANDSIM_FIRST_ID_BYTE) || \ ··· 297 298 /* NAND flash "geometry" */ 299 struct nandsin_geometry { 300 - uint32_t totsz; /* total flash size, bytes */ 301 uint32_t secsz; /* flash sector (erase block) size, bytes */ 302 uint pgsz; /* NAND flash page size, bytes */ 303 uint oobsz; /* page OOB area size, bytes */ 304 - uint32_t totszoob; /* total flash size including OOB, bytes */ 305 uint pgszoob; /* page size including OOB , bytes*/ 306 uint secszoob; /* sector size including OOB, bytes */ 307 uint pgnum; /* total number of pages */ ··· 458 return kstrdup(buf, GFP_KERNEL); 459 } 460 461 /* 462 * Initialize the nandsim structure. 463 * ··· 474 struct nand_chip *chip = (struct nand_chip *)mtd->priv; 475 struct nandsim *ns = (struct nandsim *)(chip->priv); 476 int i, ret = 0; 477 - u_int32_t remains; 478 - u_int32_t next_offset; 479 480 if (NS_IS_INITIALIZED(ns)) { 481 NS_ERR("init_nandsim: nandsim is already initialized\n"); ··· 492 ns->geom.oobsz = mtd->oobsize; 493 ns->geom.secsz = mtd->erasesize; 494 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; 495 - ns->geom.pgnum = ns->geom.totsz / ns->geom.pgsz; 496 - ns->geom.totszoob = ns->geom.totsz + ns->geom.pgnum * ns->geom.oobsz; 497 ns->geom.secshift = ffs(ns->geom.secsz) - 1; 498 ns->geom.pgshift = chip->page_shift; 499 ns->geom.oobshift = ffs(ns->geom.oobsz) - 1; ··· 516 } 517 518 if (ns->options & OPT_SMALLPAGE) { 519 - if (ns->geom.totsz < (32 << 20)) { 520 ns->geom.pgaddrbytes = 3; 521 ns->geom.secaddrbytes = 2; 522 } else { ··· 542 remains = ns->geom.totsz; 543 next_offset = 0; 544 for (i = 0; i < parts_num; ++i) { 545 - unsigned long part = parts[i]; 546 - if (!part || part > remains / ns->geom.secsz) { 547 NS_ERR("bad partition size.\n"); 548 ret = -EINVAL; 549 goto error; 550 } 551 ns->partitions[i].name = get_partition_name(i); 552 ns->partitions[i].offset = next_offset; 553 - ns->partitions[i].size = part * ns->geom.secsz; 554 next_offset += ns->partitions[i].size; 555 remains -= ns->partitions[i].size; 556 } ··· 579 if (ns->busw == 16) 580 NS_WARN("16-bit flashes support wasn't tested\n"); 581 582 - printk("flash size: %u MiB\n", ns->geom.totsz >> 20); 583 printk("page size: %u bytes\n", ns->geom.pgsz); 584 printk("OOB area size: %u bytes\n", ns->geom.oobsz); 585 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); ··· 589 printk("bits in sector size: %u\n", ns->geom.secshift); 590 printk("bits in page size: %u\n", ns->geom.pgshift); 591 printk("bits in OOB size: %u\n", ns->geom.oobshift); 592 - printk("flash size with OOB: %u KiB\n", ns->geom.totszoob >> 10); 593 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); 594 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); 595 printk("options: %#x\n", ns->options); ··· 831 832 if (!rptwear) 833 return 0; 834 - wear_eb_count = mtd->size / mtd->erasesize; 835 mem = wear_eb_count * sizeof(unsigned long); 836 if (mem / sizeof(unsigned long) != wear_eb_count) { 837 NS_ERR("Too many erase blocks for wear reporting\n"); ··· 2019 } 2020 2021 if (overridesize) { 2022 - u_int32_t new_size = nsmtd->erasesize << overridesize; 2023 if (new_size >> overridesize != nsmtd->erasesize) { 2024 NS_ERR("overridesize is too big\n"); 2025 goto err_exit; ··· 2027 /* N.B. This relies on nand_scan not doing anything with the size before we change it */ 2028 nsmtd->size = new_size; 2029 chip->chipsize = new_size; 2030 - chip->chip_shift = ffs(new_size) - 1; 2031 } 2032 2033 if ((retval = setup_wear_reporting(nsmtd)) != 0)
··· 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA 24 */ 25 26 #include <linux/init.h> ··· 39 #include <linux/delay.h> 40 #include <linux/list.h> 41 #include <linux/random.h> 42 + #include <asm/div64.h> 43 44 /* Default simulator parameters values */ 45 #if !defined(CONFIG_NANDSIM_FIRST_ID_BYTE) || \ ··· 298 299 /* NAND flash "geometry" */ 300 struct nandsin_geometry { 301 + uint64_t totsz; /* total flash size, bytes */ 302 uint32_t secsz; /* flash sector (erase block) size, bytes */ 303 uint pgsz; /* NAND flash page size, bytes */ 304 uint oobsz; /* page OOB area size, bytes */ 305 + uint64_t totszoob; /* total flash size including OOB, bytes */ 306 uint pgszoob; /* page size including OOB , bytes*/ 307 uint secszoob; /* sector size including OOB, bytes */ 308 uint pgnum; /* total number of pages */ ··· 459 return kstrdup(buf, GFP_KERNEL); 460 } 461 462 + static u_int64_t divide(u_int64_t n, u_int32_t d) 463 + { 464 + do_div(n, d); 465 + return n; 466 + } 467 + 468 /* 469 * Initialize the nandsim structure. 470 * ··· 469 struct nand_chip *chip = (struct nand_chip *)mtd->priv; 470 struct nandsim *ns = (struct nandsim *)(chip->priv); 471 int i, ret = 0; 472 + u_int64_t remains; 473 + u_int64_t next_offset; 474 475 if (NS_IS_INITIALIZED(ns)) { 476 NS_ERR("init_nandsim: nandsim is already initialized\n"); ··· 487 ns->geom.oobsz = mtd->oobsize; 488 ns->geom.secsz = mtd->erasesize; 489 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; 490 + ns->geom.pgnum = divide(ns->geom.totsz, ns->geom.pgsz); 491 + ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; 492 ns->geom.secshift = ffs(ns->geom.secsz) - 1; 493 ns->geom.pgshift = chip->page_shift; 494 ns->geom.oobshift = ffs(ns->geom.oobsz) - 1; ··· 511 } 512 513 if (ns->options & OPT_SMALLPAGE) { 514 + if (ns->geom.totsz <= (32 << 20)) { 515 ns->geom.pgaddrbytes = 3; 516 ns->geom.secaddrbytes = 2; 517 } else { ··· 537 remains = ns->geom.totsz; 538 next_offset = 0; 539 for (i = 0; i < parts_num; ++i) { 540 + u_int64_t part_sz = (u_int64_t)parts[i] * ns->geom.secsz; 541 + 542 + if (!part_sz || part_sz > remains) { 543 NS_ERR("bad partition size.\n"); 544 ret = -EINVAL; 545 goto error; 546 } 547 ns->partitions[i].name = get_partition_name(i); 548 ns->partitions[i].offset = next_offset; 549 + ns->partitions[i].size = part_sz; 550 next_offset += ns->partitions[i].size; 551 remains -= ns->partitions[i].size; 552 } ··· 573 if (ns->busw == 16) 574 NS_WARN("16-bit flashes support wasn't tested\n"); 575 576 + printk("flash size: %llu MiB\n", ns->geom.totsz >> 20); 577 printk("page size: %u bytes\n", ns->geom.pgsz); 578 printk("OOB area size: %u bytes\n", ns->geom.oobsz); 579 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); ··· 583 printk("bits in sector size: %u\n", ns->geom.secshift); 584 printk("bits in page size: %u\n", ns->geom.pgshift); 585 printk("bits in OOB size: %u\n", ns->geom.oobshift); 586 + printk("flash size with OOB: %llu KiB\n", ns->geom.totszoob >> 10); 587 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); 588 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); 589 printk("options: %#x\n", ns->options); ··· 825 826 if (!rptwear) 827 return 0; 828 + wear_eb_count = divide(mtd->size, mtd->erasesize); 829 mem = wear_eb_count * sizeof(unsigned long); 830 if (mem / sizeof(unsigned long) != wear_eb_count) { 831 NS_ERR("Too many erase blocks for wear reporting\n"); ··· 2013 } 2014 2015 if (overridesize) { 2016 + u_int64_t new_size = (u_int64_t)nsmtd->erasesize << overridesize; 2017 if (new_size >> overridesize != nsmtd->erasesize) { 2018 NS_ERR("overridesize is too big\n"); 2019 goto err_exit; ··· 2021 /* N.B. This relies on nand_scan not doing anything with the size before we change it */ 2022 nsmtd->size = new_size; 2023 chip->chipsize = new_size; 2024 + chip->chip_shift = ffs(nsmtd->erasesize) + overridesize - 1; 2025 + chip->pagemask = (chip->chipsize >> chip->page_shift) - 1; 2026 } 2027 2028 if ((retval = setup_wear_reporting(nsmtd)) != 0)
-2
drivers/mtd/nand/ppchameleonevb.c
··· 6 * Derived from drivers/mtd/nand/edb7312.c 7 * 8 * 9 - * $Id: ppchameleonevb.c,v 1.7 2005/11/07 11:14:31 gleixner Exp $ 10 - * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
··· 6 * Derived from drivers/mtd/nand/edb7312.c 7 * 8 * 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 11 * published by the Free Software Foundation.
-2
drivers/mtd/nand/rtc_from4.c
··· 6 * Derived from drivers/mtd/nand/spia.c 7 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 8 * 9 - * $Id: rtc_from4.c,v 1.10 2005/11/07 11:14:31 gleixner Exp $ 10 - * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
··· 6 * Derived from drivers/mtd/nand/spia.c 7 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 8 * 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 11 * published by the Free Software Foundation.
+127 -41
drivers/mtd/nand/s3c2410.c
··· 1 /* linux/drivers/mtd/nand/s3c2410.c 2 * 3 - * Copyright (c) 2004,2005 Simtec Electronics 4 - * http://www.simtec.co.uk/products/SWLINUX/ 5 * Ben Dooks <ben@simtec.co.uk> 6 * 7 - * Samsung S3C2410/S3C240 NAND driver 8 - * 9 - * Changelog: 10 - * 21-Sep-2004 BJD Initial version 11 - * 23-Sep-2004 BJD Multiple device support 12 - * 28-Sep-2004 BJD Fixed ECC placement for Hardware mode 13 - * 12-Oct-2004 BJD Fixed errors in use of platform data 14 - * 18-Feb-2005 BJD Fix sparse errors 15 - * 14-Mar-2005 BJD Applied tglx's code reduction patch 16 - * 02-May-2005 BJD Fixed s3c2440 support 17 - * 02-May-2005 BJD Reduced hwcontrol decode 18 - * 20-Jun-2005 BJD Updated s3c2440 support, fixed timing bug 19 - * 08-Jul-2005 BJD Fix OOPS when no platform data supplied 20 - * 20-Oct-2005 BJD Fix timing calculation bug 21 - * 14-Jan-2006 BJD Allow clock to be stopped when idle 22 - * 23 - * $Id: s3c2410.c,v 1.23 2006/04/01 18:06:29 bjd Exp $ 24 * 25 * This program is free software; you can redistribute it and/or modify 26 * it under the terms of the GNU General Public License as published by ··· 36 #include <linux/err.h> 37 #include <linux/slab.h> 38 #include <linux/clk.h> 39 40 #include <linux/mtd/mtd.h> 41 #include <linux/mtd/nand.h> ··· 105 int sel_bit; 106 int mtd_count; 107 unsigned long save_sel; 108 109 enum s3c_cpu_type cpu_type; 110 }; 111 112 /* conversion functions */ ··· 169 170 /* controller setup */ 171 172 - static int s3c2410_nand_inithw(struct s3c2410_nand_info *info, 173 - struct platform_device *pdev) 174 { 175 - struct s3c2410_platform_nand *plat = to_nand_plat(pdev); 176 - unsigned long clkrate = clk_get_rate(info->clk); 177 int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4; 178 int tacls, twrph0, twrph1; 179 - unsigned long cfg = 0; 180 181 /* calculate the timing information for the controller */ 182 183 clkrate /= 1000; /* turn clock into kHz for ease of use */ 184 185 if (plat != NULL) { ··· 202 dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n", 203 tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate)); 204 205 switch (info->cpu_type) { 206 case TYPE_S3C2410: 207 - cfg = S3C2410_NFCONF_EN; 208 - cfg |= S3C2410_NFCONF_TACLS(tacls - 1); 209 - cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1); 210 - cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1); 211 break; 212 213 case TYPE_S3C2440: 214 case TYPE_S3C2412: 215 - cfg = S3C2440_NFCONF_TACLS(tacls - 1); 216 - cfg |= S3C2440_NFCONF_TWRPH0(twrph0 - 1); 217 - cfg |= S3C2440_NFCONF_TWRPH1(twrph1 - 1); 218 - 219 /* enable the controller and de-assert nFCE */ 220 221 writel(S3C2440_NFCONT_ENABLE, info->regs + S3C2440_NFCONT); 222 } 223 224 - dev_dbg(info->device, "NF_CONF is 0x%lx\n", cfg); 225 - 226 - writel(cfg, info->regs + S3C2410_NFCONF); 227 return 0; 228 } 229 ··· 545 writesl(info->regs + S3C2440_NFDATA, buf, len / 4); 546 } 547 548 /* device management functions */ 549 550 static int s3c2410_nand_remove(struct platform_device *pdev) ··· 602 if (info == NULL) 603 return 0; 604 605 - /* first thing we need to do is release all our mtds 606 - * and their partitions, then go through freeing the 607 - * resources used 608 */ 609 610 if (info->mtds != NULL) { ··· 770 { 771 struct nand_chip *chip = &nmtd->chip; 772 773 - printk("%s: chip %p: %d\n", __func__, chip, chip->page_shift); 774 775 if (hardware_ecc) { 776 /* change the behaviour depending on wether we are using ··· 864 865 /* initialise the hardware */ 866 867 - err = s3c2410_nand_inithw(info, pdev); 868 if (err != 0) 869 goto exit_error; 870 ··· 905 906 if (sets != NULL) 907 sets++; 908 } 909 910 if (allow_clk_stop(info)) { ··· 960 961 if (info) { 962 clk_enable(info->clk); 963 - s3c2410_nand_inithw(info, dev); 964 965 /* Restore the state of the nFCE line. */ 966
··· 1 /* linux/drivers/mtd/nand/s3c2410.c 2 * 3 + * Copyright © 2004-2008 Simtec Electronics 4 + * http://armlinux.simtec.co.uk/ 5 * Ben Dooks <ben@simtec.co.uk> 6 * 7 + * Samsung S3C2410/S3C2440/S3C2412 NAND driver 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by ··· 52 #include <linux/err.h> 53 #include <linux/slab.h> 54 #include <linux/clk.h> 55 + #include <linux/cpufreq.h> 56 57 #include <linux/mtd/mtd.h> 58 #include <linux/mtd/nand.h> ··· 120 int sel_bit; 121 int mtd_count; 122 unsigned long save_sel; 123 + unsigned long clk_rate; 124 125 enum s3c_cpu_type cpu_type; 126 + 127 + #ifdef CONFIG_CPU_FREQ 128 + struct notifier_block freq_transition; 129 + #endif 130 }; 131 132 /* conversion functions */ ··· 179 180 /* controller setup */ 181 182 + static int s3c2410_nand_setrate(struct s3c2410_nand_info *info) 183 { 184 + struct s3c2410_platform_nand *plat = info->platform; 185 int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4; 186 int tacls, twrph0, twrph1; 187 + unsigned long clkrate = clk_get_rate(info->clk); 188 + unsigned long set, cfg, mask; 189 + unsigned long flags; 190 191 /* calculate the timing information for the controller */ 192 193 + info->clk_rate = clkrate; 194 clkrate /= 1000; /* turn clock into kHz for ease of use */ 195 196 if (plat != NULL) { ··· 211 dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n", 212 tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate)); 213 214 + switch (info->cpu_type) { 215 + case TYPE_S3C2410: 216 + mask = (S3C2410_NFCONF_TACLS(3) | 217 + S3C2410_NFCONF_TWRPH0(7) | 218 + S3C2410_NFCONF_TWRPH1(7)); 219 + set = S3C2410_NFCONF_EN; 220 + set |= S3C2410_NFCONF_TACLS(tacls - 1); 221 + set |= S3C2410_NFCONF_TWRPH0(twrph0 - 1); 222 + set |= S3C2410_NFCONF_TWRPH1(twrph1 - 1); 223 + break; 224 + 225 + case TYPE_S3C2440: 226 + case TYPE_S3C2412: 227 + mask = (S3C2410_NFCONF_TACLS(tacls_max - 1) | 228 + S3C2410_NFCONF_TWRPH0(7) | 229 + S3C2410_NFCONF_TWRPH1(7)); 230 + 231 + set = S3C2440_NFCONF_TACLS(tacls - 1); 232 + set |= S3C2440_NFCONF_TWRPH0(twrph0 - 1); 233 + set |= S3C2440_NFCONF_TWRPH1(twrph1 - 1); 234 + break; 235 + 236 + default: 237 + /* keep compiler happy */ 238 + mask = 0; 239 + set = 0; 240 + BUG(); 241 + } 242 + 243 + dev_dbg(info->device, "NF_CONF is 0x%lx\n", cfg); 244 + 245 + local_irq_save(flags); 246 + 247 + cfg = readl(info->regs + S3C2410_NFCONF); 248 + cfg &= ~mask; 249 + cfg |= set; 250 + writel(cfg, info->regs + S3C2410_NFCONF); 251 + 252 + local_irq_restore(flags); 253 + 254 + return 0; 255 + } 256 + 257 + static int s3c2410_nand_inithw(struct s3c2410_nand_info *info) 258 + { 259 + int ret; 260 + 261 + ret = s3c2410_nand_setrate(info); 262 + if (ret < 0) 263 + return ret; 264 + 265 switch (info->cpu_type) { 266 case TYPE_S3C2410: 267 + default: 268 break; 269 270 case TYPE_S3C2440: 271 case TYPE_S3C2412: 272 /* enable the controller and de-assert nFCE */ 273 274 writel(S3C2440_NFCONT_ENABLE, info->regs + S3C2440_NFCONT); 275 } 276 277 return 0; 278 } 279 ··· 513 writesl(info->regs + S3C2440_NFDATA, buf, len / 4); 514 } 515 516 + /* cpufreq driver support */ 517 + 518 + #ifdef CONFIG_CPU_FREQ 519 + 520 + static int s3c2410_nand_cpufreq_transition(struct notifier_block *nb, 521 + unsigned long val, void *data) 522 + { 523 + struct s3c2410_nand_info *info; 524 + unsigned long newclk; 525 + 526 + info = container_of(nb, struct s3c2410_nand_info, freq_transition); 527 + newclk = clk_get_rate(info->clk); 528 + 529 + if ((val == CPUFREQ_POSTCHANGE && newclk < info->clk_rate) || 530 + (val == CPUFREQ_PRECHANGE && newclk > info->clk_rate)) { 531 + s3c2410_nand_setrate(info); 532 + } 533 + 534 + return 0; 535 + } 536 + 537 + static inline int s3c2410_nand_cpufreq_register(struct s3c2410_nand_info *info) 538 + { 539 + info->freq_transition.notifier_call = s3c2410_nand_cpufreq_transition; 540 + 541 + return cpufreq_register_notifier(&info->freq_transition, 542 + CPUFREQ_TRANSITION_NOTIFIER); 543 + } 544 + 545 + static inline void s3c2410_nand_cpufreq_deregister(struct s3c2410_nand_info *info) 546 + { 547 + cpufreq_unregister_notifier(&info->freq_transition, 548 + CPUFREQ_TRANSITION_NOTIFIER); 549 + } 550 + 551 + #else 552 + static inline int s3c2410_nand_cpufreq_register(struct s3c2410_nand_info *info) 553 + { 554 + return 0; 555 + } 556 + 557 + static inline void s3c2410_nand_cpufreq_deregister(struct s3c2410_nand_info *info) 558 + { 559 + } 560 + #endif 561 + 562 /* device management functions */ 563 564 static int s3c2410_nand_remove(struct platform_device *pdev) ··· 524 if (info == NULL) 525 return 0; 526 527 + s3c2410_nand_cpufreq_deregister(info); 528 + 529 + /* Release all our mtds and their partitions, then go through 530 + * freeing the resources used 531 */ 532 533 if (info->mtds != NULL) { ··· 691 { 692 struct nand_chip *chip = &nmtd->chip; 693 694 + dev_dbg(info->device, "chip %p => page shift %d\n", 695 + chip, chip->page_shift); 696 697 if (hardware_ecc) { 698 /* change the behaviour depending on wether we are using ··· 784 785 /* initialise the hardware */ 786 787 + err = s3c2410_nand_inithw(info); 788 if (err != 0) 789 goto exit_error; 790 ··· 825 826 if (sets != NULL) 827 sets++; 828 + } 829 + 830 + err = s3c2410_nand_cpufreq_register(info); 831 + if (err < 0) { 832 + dev_err(&pdev->dev, "failed to init cpufreq support\n"); 833 + goto exit_error; 834 } 835 836 if (allow_clk_stop(info)) { ··· 874 875 if (info) { 876 clk_enable(info->clk); 877 + s3c2410_nand_inithw(info); 878 879 /* Restore the state of the nFCE line. */ 880
-2
drivers/mtd/nand/sharpsl.c
··· 3 * 4 * Copyright (C) 2004 Richard Purdie 5 * 6 - * $Id: sharpsl.c,v 1.7 2005/11/07 11:14:31 gleixner Exp $ 7 - * 8 * Based on Sharp's NAND driver sharp_sl.c 9 * 10 * This program is free software; you can redistribute it and/or modify
··· 3 * 4 * Copyright (C) 2004 Richard Purdie 5 * 6 * Based on Sharp's NAND driver sharp_sl.c 7 * 8 * This program is free software; you can redistribute it and/or modify
-2
drivers/mtd/nand/spia.c
··· 8 * to controllines (due to change in nand.c) 9 * page_cache added 10 * 11 - * $Id: spia.c,v 1.25 2005/11/07 11:14:31 gleixner Exp $ 12 - * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License version 2 as 15 * published by the Free Software Foundation.
··· 8 * to controllines (due to change in nand.c) 9 * page_cache added 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
-2
drivers/mtd/nand/toto.c
··· 14 * Overview: 15 * This is a device driver for the NAND flash device found on the 16 * TI fido board. It supports 32MiB and 64MiB cards 17 - * 18 - * $Id: toto.c,v 1.5 2005/11/07 11:14:31 gleixner Exp $ 19 */ 20 21 #include <linux/slab.h>
··· 14 * Overview: 15 * This is a device driver for the NAND flash device found on the 16 * TI fido board. It supports 32MiB and 64MiB cards 17 */ 18 19 #include <linux/slab.h>
-2
drivers/mtd/nand/ts7250.c
··· 9 * Derived from drivers/mtd/nand/autcpu12.c 10 * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) 11 * 12 - * $Id: ts7250.c,v 1.4 2004/12/30 22:02:07 joff Exp $ 13 - * 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 16 * published by the Free Software Foundation.
··· 9 * Derived from drivers/mtd/nand/autcpu12.c 10 * Copyright (c) 2001 Thomas Gleixner (gleixner@autronix.de) 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License version 2 as 14 * published by the Free Software Foundation.
-5
drivers/mtd/nftlcore.c
··· 1 /* Linux driver for NAND Flash Translation Layer */ 2 /* (c) 1999 Machine Vision Holdings, Inc. */ 3 /* Author: David Woodhouse <dwmw2@infradead.org> */ 4 - /* $Id: nftlcore.c,v 1.98 2005/11/07 11:14:21 gleixner Exp $ */ 5 6 /* 7 The contents of this file are distributed under the GNU General ··· 802 .owner = THIS_MODULE, 803 }; 804 805 - extern char nftlmountrev[]; 806 - 807 static int __init init_nftl(void) 808 { 809 - printk(KERN_INFO "NFTL driver: nftlcore.c $Revision: 1.98 $, nftlmount.c %s\n", nftlmountrev); 810 - 811 return register_mtd_blktrans(&nftl_tr); 812 } 813
··· 1 /* Linux driver for NAND Flash Translation Layer */ 2 /* (c) 1999 Machine Vision Holdings, Inc. */ 3 /* Author: David Woodhouse <dwmw2@infradead.org> */ 4 5 /* 6 The contents of this file are distributed under the GNU General ··· 803 .owner = THIS_MODULE, 804 }; 805 806 static int __init init_nftl(void) 807 { 808 return register_mtd_blktrans(&nftl_tr); 809 } 810
-4
drivers/mtd/nftlmount.c
··· 4 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 5 * Copyright (C) 2000 Netgem S.A. 6 * 7 - * $Id: nftlmount.c,v 1.41 2005/11/07 11:14:21 gleixner Exp $ 8 - * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or ··· 28 #include <linux/mtd/nftl.h> 29 30 #define SECTORSIZE 512 31 - 32 - char nftlmountrev[]="$Revision: 1.41 $"; 33 34 /* find_boot_record: Find the NFTL Media Header and its Spare copy which contains the 35 * various device information of the NFTL partition and Bad Unit Table. Update
··· 4 * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 5 * Copyright (C) 2000 Netgem S.A. 6 * 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 9 * the Free Software Foundation; either version 2 of the License, or ··· 30 #include <linux/mtd/nftl.h> 31 32 #define SECTORSIZE 512 33 34 /* find_boot_record: Find the NFTL Media Header and its Spare copy which contains the 35 * various device information of the NFTL partition and Bad Unit Table. Update
+25 -29
drivers/mtd/onenand/onenand_base.c
··· 325 326 ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS); 327 328 - if (ctrl & ONENAND_CTRL_ERROR) { 329 - printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl); 330 - if (ctrl & ONENAND_CTRL_LOCK) 331 - printk(KERN_ERR "onenand_wait: it's locked error.\n"); 332 - if (state == FL_READING) { 333 - /* 334 - * A power loss while writing can result in a page 335 - * becoming unreadable. When the device is mounted 336 - * again, reading that page gives controller errors. 337 - * Upper level software like JFFS2 treat -EIO as fatal, 338 - * refusing to mount at all. That means it is necessary 339 - * to treat the error as an ECC error to allow recovery. 340 - * Note that typically in this case, the eraseblock can 341 - * still be erased and rewritten i.e. it has not become 342 - * a bad block. 343 - */ 344 - mtd->ecc_stats.failed++; 345 - return -EBADMSG; 346 - } 347 - return -EIO; 348 - } 349 - 350 if (interrupt & ONENAND_INT_READ) { 351 int ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS); 352 if (ecc) { ··· 344 } 345 } else if (state == FL_READING) { 346 printk(KERN_ERR "onenand_wait: read timeout! ctrl=0x%04x intr=0x%04x\n", ctrl, interrupt); 347 return -EIO; 348 } 349 ··· 1127 interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT); 1128 ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS); 1129 1130 - /* Initial bad block case: 0x2400 or 0x0400 */ 1131 - if (ctrl & ONENAND_CTRL_ERROR) { 1132 - printk(KERN_DEBUG "onenand_bbt_wait: controller error = 0x%04x\n", ctrl); 1133 - return ONENAND_BBT_READ_ERROR; 1134 - } 1135 - 1136 if (interrupt & ONENAND_INT_READ) { 1137 int ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS); 1138 - if (ecc & ONENAND_ECC_2BIT_ALL) 1139 return ONENAND_BBT_READ_ERROR; 1140 } else { 1141 printk(KERN_ERR "onenand_bbt_wait: read timeout!" 1142 "ctrl=0x%04x intr=0x%04x\n", ctrl, interrupt); 1143 return ONENAND_BBT_READ_FATAL_ERROR; 1144 } 1145 1146 return 0;
··· 325 326 ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS); 327 328 + /* 329 + * In the Spec. it checks the controller status first 330 + * However if you get the correct information in case of 331 + * power off recovery (POR) test, it should read ECC status first 332 + */ 333 if (interrupt & ONENAND_INT_READ) { 334 int ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS); 335 if (ecc) { ··· 361 } 362 } else if (state == FL_READING) { 363 printk(KERN_ERR "onenand_wait: read timeout! ctrl=0x%04x intr=0x%04x\n", ctrl, interrupt); 364 + return -EIO; 365 + } 366 + 367 + /* If there's controller error, it's a real error */ 368 + if (ctrl & ONENAND_CTRL_ERROR) { 369 + printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", 370 + ctrl); 371 + if (ctrl & ONENAND_CTRL_LOCK) 372 + printk(KERN_ERR "onenand_wait: it's locked error.\n"); 373 return -EIO; 374 } 375 ··· 1135 interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT); 1136 ctrl = this->read_word(this->base + ONENAND_REG_CTRL_STATUS); 1137 1138 if (interrupt & ONENAND_INT_READ) { 1139 int ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS); 1140 + if (ecc & ONENAND_ECC_2BIT_ALL) { 1141 + printk(KERN_INFO "onenand_bbt_wait: ecc error = 0x%04x" 1142 + ", controller error 0x%04x\n", ecc, ctrl); 1143 return ONENAND_BBT_READ_ERROR; 1144 + } 1145 } else { 1146 printk(KERN_ERR "onenand_bbt_wait: read timeout!" 1147 "ctrl=0x%04x intr=0x%04x\n", ctrl, interrupt); 1148 return ONENAND_BBT_READ_FATAL_ERROR; 1149 + } 1150 + 1151 + /* Initial bad block case: 0x2400 or 0x0400 */ 1152 + if (ctrl & ONENAND_CTRL_ERROR) { 1153 + printk(KERN_DEBUG "onenand_bbt_wait: " 1154 + "controller error = 0x%04x\n", ctrl); 1155 + return ONENAND_BBT_READ_ERROR; 1156 } 1157 1158 return 0;
-2
drivers/mtd/redboot.c
··· 1 /* 2 - * $Id: redboot.c,v 1.21 2006/03/30 18:34:37 bjd Exp $ 3 - * 4 * Parse RedBoot-style Flash Image System (FIS) tables and 5 * produce a Linux partition array to match. 6 */
··· 1 /* 2 * Parse RedBoot-style Flash Image System (FIS) tables and 3 * produce a Linux partition array to match. 4 */
-2
drivers/mtd/rfd_ftl.c
··· 3 * 4 * Copyright (C) 2005 Sean Young <sean@mess.org> 5 * 6 - * $Id: rfd_ftl.c,v 1.8 2006/01/15 12:51:44 sean Exp $ 7 - * 8 * This type of flash translation layer (FTL) is used by the Embedded BIOS 9 * by General Software. It is known as the Resident Flash Disk (RFD), see: 10 *
··· 3 * 4 * Copyright (C) 2005 Sean Young <sean@mess.org> 5 * 6 * This type of flash translation layer (FTL) is used by the Embedded BIOS 7 * by General Software. It is known as the Resident Flash Disk (RFD), see: 8 *
+1 -1
fs/jffs2/dir.c
··· 38 { 39 .read = generic_read_dir, 40 .readdir = jffs2_readdir, 41 - .ioctl = jffs2_ioctl, 42 .fsync = jffs2_fsync 43 }; 44
··· 38 { 39 .read = generic_read_dir, 40 .readdir = jffs2_readdir, 41 + .unlocked_ioctl=jffs2_ioctl, 42 .fsync = jffs2_fsync 43 }; 44
+1 -1
fs/jffs2/file.c
··· 46 .aio_read = generic_file_aio_read, 47 .write = do_sync_write, 48 .aio_write = generic_file_aio_write, 49 - .ioctl = jffs2_ioctl, 50 .mmap = generic_file_readonly_mmap, 51 .fsync = jffs2_fsync, 52 .splice_read = generic_file_splice_read,
··· 46 .aio_read = generic_file_aio_read, 47 .write = do_sync_write, 48 .aio_write = generic_file_aio_write, 49 + .unlocked_ioctl=jffs2_ioctl, 50 .mmap = generic_file_readonly_mmap, 51 .fsync = jffs2_fsync, 52 .splice_read = generic_file_splice_read,
+1 -2
fs/jffs2/ioctl.c
··· 12 #include <linux/fs.h> 13 #include "nodelist.h" 14 15 - int jffs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 16 - unsigned long arg) 17 { 18 /* Later, this will provide for lsattr.jffs2 and chattr.jffs2, which 19 will include compression support etc. */
··· 12 #include <linux/fs.h> 13 #include "nodelist.h" 14 15 + long jffs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 16 { 17 /* Later, this will provide for lsattr.jffs2 and chattr.jffs2, which 18 will include compression support etc. */
+1 -1
fs/jffs2/os-linux.h
··· 167 int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); 168 169 /* ioctl.c */ 170 - int jffs2_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 171 172 /* symlink.c */ 173 extern const struct inode_operations jffs2_symlink_inode_operations;
··· 167 int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); 168 169 /* ioctl.c */ 170 + long jffs2_ioctl(struct file *, unsigned int, unsigned long); 171 172 /* symlink.c */ 173 extern const struct inode_operations jffs2_symlink_inode_operations;
-38
include/asm-arm/arch-at91/at91_ecc.h
··· 1 - /* 2 - * include/asm-arm/arch-at91/at91_ecc.h 3 - * 4 - * Error Corrected Code Controller (ECC) - System peripherals regsters. 5 - * Based on AT91SAM9260 datasheet revision B. 6 - * 7 - * This program is free software; you can redistribute it and/or modify it 8 - * under the terms of the GNU General Public License as published by the 9 - * Free Software Foundation; either version 2 of the License, or (at your 10 - * option) any later version. 11 - */ 12 - 13 - #ifndef AT91_ECC_H 14 - #define AT91_ECC_H 15 - 16 - #define AT91_ECC_CR 0x00 /* Control register */ 17 - #define AT91_ECC_RST (1 << 0) /* Reset parity */ 18 - 19 - #define AT91_ECC_MR 0x04 /* Mode register */ 20 - #define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */ 21 - #define AT91_ECC_PAGESIZE_528 (0) 22 - #define AT91_ECC_PAGESIZE_1056 (1) 23 - #define AT91_ECC_PAGESIZE_2112 (2) 24 - #define AT91_ECC_PAGESIZE_4224 (3) 25 - 26 - #define AT91_ECC_SR 0x08 /* Status register */ 27 - #define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */ 28 - #define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */ 29 - #define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */ 30 - 31 - #define AT91_ECC_PR 0x0c /* Parity register */ 32 - #define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */ 33 - #define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */ 34 - 35 - #define AT91_ECC_NPR 0x10 /* NParity register */ 36 - #define AT91_ECC_NPARITY (0xffff << 0) /* NParity */ 37 - 38 - #endif
···
+2 -2
include/asm-arm/arch-at91/board.h
··· 89 extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 90 91 /* NAND / SmartMedia */ 92 - struct at91_nand_data { 93 u8 enable_pin; /* chip enable */ 94 u8 det_pin; /* card detect */ 95 u8 rdy_pin; /* ready/busy */ ··· 98 u8 bus_width_16; /* buswidth is 16 bit */ 99 struct mtd_partition* (*partition_info)(int, int*); 100 }; 101 - extern void __init at91_add_device_nand(struct at91_nand_data *data); 102 103 /* I2C*/ 104 extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
··· 89 extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 90 91 /* NAND / SmartMedia */ 92 + struct atmel_nand_data { 93 u8 enable_pin; /* chip enable */ 94 u8 det_pin; /* card detect */ 95 u8 rdy_pin; /* ready/busy */ ··· 98 u8 bus_width_16; /* buswidth is 16 bit */ 99 struct mtd_partition* (*partition_info)(int, int*); 100 }; 101 + extern void __init at91_add_device_nand(struct atmel_nand_data *data); 102 103 /* I2C*/ 104 extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
+13
include/asm-avr32/arch-at32ap/board.h
··· 97 at32_add_device_cf(unsigned int id, unsigned int extint, 98 struct cf_platform_data *data); 99 100 #endif /* __ASM_ARCH_BOARD_H */
··· 97 at32_add_device_cf(unsigned int id, unsigned int extint, 98 struct cf_platform_data *data); 99 100 + /* NAND / SmartMedia */ 101 + struct atmel_nand_data { 102 + int enable_pin; /* chip enable */ 103 + int det_pin; /* card detect */ 104 + int rdy_pin; /* ready/busy */ 105 + u8 ale; /* address line number connected to ALE */ 106 + u8 cle; /* address line number connected to CLE */ 107 + u8 bus_width_16; /* buswidth is 16 bit */ 108 + struct mtd_partition *(*partition_info)(int size, int *num_partitions); 109 + }; 110 + struct platform_device * 111 + at32_add_device_nand(unsigned int id, struct atmel_nand_data *data); 112 + 113 #endif /* __ASM_ARCH_BOARD_H */
-3
include/linux/jffs2.h
··· 7 * 8 * For licensing information, see the file 'LICENCE' in the 9 * jffs2 directory. 10 - * 11 - * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $ 12 - * 13 */ 14 15 #ifndef __LINUX_JFFS2_H__
··· 7 * 8 * For licensing information, see the file 'LICENCE' in the 9 * jffs2 directory. 10 */ 11 12 #ifndef __LINUX_JFFS2_H__
-2
include/linux/mtd/blktrans.h
··· 1 /* 2 - * $Id: blktrans.h,v 1.6 2005/11/07 11:14:54 gleixner Exp $ 3 - * 4 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 5 * 6 * Interface to Linux block layer for MTD 'translation layers'.
··· 1 /* 2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 3 * 4 * Interface to Linux block layer for MTD 'translation layers'.
-1
include/linux/mtd/cfi.h
··· 1 2 /* Common Flash Interface structures 3 * See http://support.intel.com/design/flash/technote/index.htm 4 - * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $ 5 */ 6 7 #ifndef __MTD_CFI_H__
··· 1 2 /* Common Flash Interface structures 3 * See http://support.intel.com/design/flash/technote/index.htm 4 */ 5 6 #ifndef __MTD_CFI_H__
-5
include/linux/mtd/cfi_endian.h
··· 1 - /* 2 - * $Id: cfi_endian.h,v 1.11 2002/01/30 23:20:48 awozniak Exp $ 3 - * 4 - */ 5 - 6 #include <asm/byteorder.h> 7 8 #ifndef CONFIG_MTD_CFI_ADV_OPTIONS
··· 1 #include <asm/byteorder.h> 2 3 #ifndef CONFIG_MTD_CFI_ADV_OPTIONS
-2
include/linux/mtd/concat.h
··· 4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 5 * 6 * This code is GPL 7 - * 8 - * $Id: concat.h,v 1.1 2002/03/08 16:34:36 rkaiser Exp $ 9 */ 10 11 #ifndef MTD_CONCAT_H
··· 4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 5 * 6 * This code is GPL 7 */ 8 9 #ifndef MTD_CONCAT_H
-2
include/linux/mtd/doc2000.h
··· 6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 7 * Copyright (C) 2002-2003 SnapGear Inc 8 * 9 - * $Id: doc2000.h,v 1.25 2005/11/07 11:14:54 gleixner Exp $ 10 - * 11 * Released under GPL 12 */ 13
··· 6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 7 * Copyright (C) 2002-2003 SnapGear Inc 8 * 9 * Released under GPL 10 */ 11
-3
include/linux/mtd/flashchip.h
··· 5 * Contains information about the location and state of a given flash device 6 * 7 * (C) 2000 Red Hat. GPLd. 8 - * 9 - * $Id: flashchip.h,v 1.18 2005/11/07 11:14:54 gleixner Exp $ 10 - * 11 */ 12 13 #ifndef __MTD_FLASHCHIP_H__
··· 5 * Contains information about the location and state of a given flash device 6 * 7 * (C) 2000 Red Hat. GPLd. 8 */ 9 10 #ifndef __MTD_FLASHCHIP_H__
-2
include/linux/mtd/ftl.h
··· 1 /* 2 - * $Id: ftl.h,v 1.7 2005/11/07 11:14:54 gleixner Exp $ 3 - * 4 * Derived from (and probably identical to): 5 * ftl.h 1.7 1999/10/25 20:23:17 6 *
··· 1 /* 2 * Derived from (and probably identical to): 3 * ftl.h 1.7 1999/10/25 20:23:17 4 *
-1
include/linux/mtd/gen_probe.h
··· 1 /* 2 * (C) 2001, 2001 Red Hat, Inc. 3 * GPL'd 4 - * $Id: gen_probe.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ 5 */ 6 7 #ifndef __LINUX_MTD_GEN_PROBE_H__
··· 1 /* 2 * (C) 2001, 2001 Red Hat, Inc. 3 * GPL'd 4 */ 5 6 #ifndef __LINUX_MTD_GEN_PROBE_H__
-4
include/linux/mtd/inftl.h
··· 2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer 3 * 4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 5 - * 6 - * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $ 7 */ 8 9 #ifndef __MTD_INFTL_H__ ··· 49 50 int INFTL_mount(struct INFTLrecord *s); 51 int INFTL_formatblock(struct INFTLrecord *s, int block); 52 - 53 - extern char inftlmountrev[]; 54 55 void INFTL_dumptables(struct INFTLrecord *s); 56 void INFTL_dumpVUchains(struct INFTLrecord *s);
··· 2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer 3 * 4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 5 */ 6 7 #ifndef __MTD_INFTL_H__ ··· 51 52 int INFTL_mount(struct INFTLrecord *s); 53 int INFTL_formatblock(struct INFTLrecord *s, int block); 54 55 void INFTL_dumptables(struct INFTLrecord *s); 56 void INFTL_dumpVUchains(struct INFTLrecord *s);
-1
include/linux/mtd/map.h
··· 1 2 /* Overhauled routines for dealing with different mmap regions of flash */ 3 - /* $Id: map.h,v 1.54 2005/11/07 11:14:54 gleixner Exp $ */ 4 5 #ifndef __LINUX_MTD_MAP_H__ 6 #define __LINUX_MTD_MAP_H__
··· 1 2 /* Overhauled routines for dealing with different mmap regions of flash */ 3 4 #ifndef __LINUX_MTD_MAP_H__ 5 #define __LINUX_MTD_MAP_H__
-2
include/linux/mtd/mtd.h
··· 1 /* 2 - * $Id: mtd.h,v 1.61 2005/11/07 11:14:54 gleixner Exp $ 3 - * 4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 5 * 6 * Released under GPL
··· 1 /* 2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 3 * 4 * Released under GPL
+5 -2
include/linux/mtd/nand.h
··· 5 * Steven J. Hill <sjhill@realitydiluted.com> 6 * Thomas Gleixner <tglx@linutronix.de> 7 * 8 - * $Id: nand.h,v 1.74 2005/09/15 13:58:50 vwool Exp $ 9 - * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. ··· 177 #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) 178 #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 179 #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) 180 181 /* Mask to zero out the chip options, which come from the id table */ 182 #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) ··· 274 const uint8_t *buf); 275 int (*read_page)(struct mtd_info *mtd, 276 struct nand_chip *chip, 277 uint8_t *buf); 278 void (*write_page)(struct mtd_info *mtd, 279 struct nand_chip *chip,
··· 5 * Steven J. Hill <sjhill@realitydiluted.com> 6 * Thomas Gleixner <tglx@linutronix.de> 7 * 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 10 * published by the Free Software Foundation. ··· 179 #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) 180 #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 181 #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) 182 + #define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT)) 183 184 /* Mask to zero out the chip options, which come from the id table */ 185 #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) ··· 275 const uint8_t *buf); 276 int (*read_page)(struct mtd_info *mtd, 277 struct nand_chip *chip, 278 + uint8_t *buf); 279 + int (*read_subpage)(struct mtd_info *mtd, 280 + struct nand_chip *chip, 281 + uint32_t offs, uint32_t len, 282 uint8_t *buf); 283 void (*write_page)(struct mtd_info *mtd, 284 struct nand_chip *chip,
-2
include/linux/mtd/nand_ecc.h
··· 3 * 4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 5 * 6 - * $Id: nand_ecc.h,v 1.4 2004/06/17 02:35:02 dbrown Exp $ 7 - * 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 10 * published by the Free Software Foundation.
··· 3 * 4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation.
-2
include/linux/mtd/nftl.h
··· 1 /* 2 - * $Id: nftl.h,v 1.16 2004/06/30 14:49:00 dbrown Exp $ 3 - * 4 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 5 */ 6
··· 1 /* 2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 3 */ 4
-2
include/linux/mtd/partitions.h
··· 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 5 * 6 * This code is GPL 7 - * 8 - * $Id: partitions.h,v 1.17 2005/11/07 11:14:55 gleixner Exp $ 9 */ 10 11 #ifndef MTD_PARTITIONS_H
··· 4 * (C) 2000 Nicolas Pitre <nico@cam.org> 5 * 6 * This code is GPL 7 */ 8 9 #ifndef MTD_PARTITIONS_H
-2
include/linux/mtd/physmap.h
··· 2 * For boards with physically mapped flash and using 3 * drivers/mtd/maps/physmap.c mapping driver. 4 * 5 - * $Id: physmap.h,v 1.4 2005/11/07 11:14:55 gleixner Exp $ 6 - * 7 * Copyright (C) 2003 MontaVista Software Inc. 8 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 9 *
··· 2 * For boards with physically mapped flash and using 3 * drivers/mtd/maps/physmap.c mapping driver. 4 * 5 * Copyright (C) 2003 MontaVista Software Inc. 6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 7 *
-2
include/linux/mtd/plat-ram.h
··· 6 * 7 * Generic platform device based RAM map 8 * 9 - * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $ 10 - * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation.
··· 6 * 7 * Generic platform device based RAM map 8 * 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 11 * published by the Free Software Foundation.
+1 -3
include/linux/mtd/pmc551.h
··· 1 /* 2 - * $Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $ 3 - * 4 * PMC551 PCI Mezzanine Ram Device 5 * 6 * Author: ··· 15 16 #include <linux/mtd/mtd.h> 17 18 - #define PMC551_VERSION "$Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $\n"\ 19 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" 20 21 /*
··· 1 /* 2 * PMC551 PCI Mezzanine Ram Device 3 * 4 * Author: ··· 17 18 #include <linux/mtd/mtd.h> 19 20 + #define PMC551_VERSION \ 21 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" 22 23 /*
-2
include/linux/mtd/xip.h
··· 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation. 14 - * 15 - * $Id: xip.h,v 1.5 2005/11/07 11:14:55 gleixner Exp $ 16 */ 17 18 #ifndef __LINUX_MTD_XIP_H__
··· 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License version 2 as 13 * published by the Free Software Foundation. 14 */ 15 16 #ifndef __LINUX_MTD_XIP_H__
-2
include/mtd/inftl-user.h
··· 1 /* 2 - * $Id: inftl-user.h,v 1.2 2005/11/07 11:14:56 gleixner Exp $ 3 - * 4 * Parts of INFTL headers shared with userspace 5 * 6 */
··· 1 /* 2 * Parts of INFTL headers shared with userspace 3 * 4 */
-2
include/mtd/jffs2-user.h
··· 1 /* 2 - * $Id: jffs2-user.h,v 1.1 2004/05/05 11:57:54 dwmw2 Exp $ 3 - * 4 * JFFS2 definitions for use in user space only 5 */ 6
··· 1 /* 2 * JFFS2 definitions for use in user space only 3 */ 4
-2
include/mtd/mtd-abi.h
··· 1 /* 2 - * $Id: mtd-abi.h,v 1.13 2005/11/07 11:14:56 gleixner Exp $ 3 - * 4 * Portions of MTD ABI definition which are shared by kernel and user space 5 */ 6
··· 1 /* 2 * Portions of MTD ABI definition which are shared by kernel and user space 3 */ 4
-2
include/mtd/mtd-user.h
··· 1 /* 2 - * $Id: mtd-user.h,v 1.2 2004/05/05 14:44:57 dwmw2 Exp $ 3 - * 4 * MTD ABI header for use by user space only. 5 */ 6
··· 1 /* 2 * MTD ABI header for use by user space only. 3 */ 4
-2
include/mtd/nftl-user.h
··· 1 /* 2 - * $Id: nftl-user.h,v 1.2 2005/11/07 11:14:56 gleixner Exp $ 3 - * 4 * Parts of NFTL headers shared with userspace 5 * 6 */
··· 1 /* 2 * Parts of NFTL headers shared with userspace 3 * 4 */