aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-pxa/corgi.c54
-rw-r--r--arch/arm/mach-pxa/poodle.c51
-rw-r--r--arch/arm/mach-pxa/spitz.c77
-rw-r--r--drivers/mtd/nand/sharpsl.c86
4 files changed, 182 insertions, 86 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 65558d6aa22..b65be8e7792 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -26,6 +26,7 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/ads7846.h> 27#include <linux/spi/ads7846.h>
28#include <linux/spi/corgi_lcd.h> 28#include <linux/spi/corgi_lcd.h>
29#include <linux/mtd/sharpsl.h>
29#include <video/w100fb.h> 30#include <video/w100fb.h>
30 31
31#include <asm/setup.h> 32#include <asm/setup.h>
@@ -541,11 +542,61 @@ err_free_1:
541static inline void corgi_init_spi(void) {} 542static inline void corgi_init_spi(void) {}
542#endif 543#endif
543 544
545static struct mtd_partition sharpsl_nand_partitions[] = {
546 {
547 .name = "System Area",
548 .offset = 0,
549 .size = 7 * 1024 * 1024,
550 },
551 {
552 .name = "Root Filesystem",
553 .offset = 7 * 1024 * 1024,
554 .size = 25 * 1024 * 1024,
555 },
556 {
557 .name = "Home Filesystem",
558 .offset = MTDPART_OFS_APPEND,
559 .size = MTDPART_SIZ_FULL,
560 },
561};
562
563static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
564
565static struct nand_bbt_descr sharpsl_bbt = {
566 .options = 0,
567 .offs = 4,
568 .len = 2,
569 .pattern = scan_ff_pattern
570};
571
572static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
573 .badblock_pattern = &sharpsl_bbt,
574 .partitions = sharpsl_nand_partitions,
575 .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions),
576};
577
578static struct resource sharpsl_nand_resources[] = {
579 {
580 .start = 0x0C000000,
581 .end = 0x0C000FFF,
582 .flags = IORESOURCE_MEM,
583 },
584};
585
586static struct platform_device sharpsl_nand_device = {
587 .name = "sharpsl-nand",
588 .id = -1,
589 .resource = sharpsl_nand_resources,
590 .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
591 .dev.platform_data = &sharpsl_nand_platform_data,
592};
593
544static struct platform_device *devices[] __initdata = { 594static struct platform_device *devices[] __initdata = {
545 &corgiscoop_device, 595 &corgiscoop_device,
546 &corgifb_device, 596 &corgifb_device,
547 &corgikbd_device, 597 &corgikbd_device,
548 &corgiled_device, 598 &corgiled_device,
599 &sharpsl_nand_device,
549}; 600};
550 601
551static void corgi_poweroff(void) 602static void corgi_poweroff(void)
@@ -585,6 +636,9 @@ static void __init corgi_init(void)
585 636
586 platform_scoop_config = &corgi_pcmcia_config; 637 platform_scoop_config = &corgi_pcmcia_config;
587 638
639 if (machine_is_husky())
640 sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
641
588 platform_add_devices(devices, ARRAY_SIZE(devices)); 642 platform_add_devices(devices, ARRAY_SIZE(devices));
589} 643}
590 644
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 2e3bd8b1523..a45afdf2520 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -23,6 +23,7 @@
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h> 25#include <linux/spi/ads7846.h>
26#include <linux/mtd/sharpsl.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -413,9 +414,59 @@ static struct pxafb_mach_info poodle_fb_info = {
413 .lcd_conn = LCD_COLOR_TFT_16BPP, 414 .lcd_conn = LCD_COLOR_TFT_16BPP,
414}; 415};
415 416
417static struct mtd_partition sharpsl_nand_partitions[] = {
418 {
419 .name = "System Area",
420 .offset = 0,
421 .size = 7 * 1024 * 1024,
422 },
423 {
424 .name = "Root Filesystem",
425 .offset = 7 * 1024 * 1024,
426 .size = 22 * 1024 * 1024,
427 },
428 {
429 .name = "Home Filesystem",
430 .offset = MTDPART_OFS_APPEND,
431 .size = MTDPART_SIZ_FULL,
432 },
433};
434
435static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
436
437static struct nand_bbt_descr sharpsl_bbt = {
438 .options = 0,
439 .offs = 4,
440 .len = 2,
441 .pattern = scan_ff_pattern
442};
443
444static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
445 .badblock_pattern = &sharpsl_bbt,
446 .partitions = sharpsl_nand_partitions,
447 .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions),
448};
449
450static struct resource sharpsl_nand_resources[] = {
451 {
452 .start = 0x0C000000,
453 .end = 0x0C000FFF,
454 .flags = IORESOURCE_MEM,
455 },
456};
457
458static struct platform_device sharpsl_nand_device = {
459 .name = "sharpsl-nand",
460 .id = -1,
461 .resource = sharpsl_nand_resources,
462 .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
463 .dev.platform_data = &sharpsl_nand_platform_data,
464};
465
416static struct platform_device *devices[] __initdata = { 466static struct platform_device *devices[] __initdata = {
417 &poodle_locomo_device, 467 &poodle_locomo_device,
418 &poodle_scoop_device, 468 &poodle_scoop_device,
469 &sharpsl_nand_device,
419}; 470};
420 471
421static void poodle_poweroff(void) 472static void poodle_poweroff(void)
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 524f656dc56..6ffa6134e10 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -30,6 +30,7 @@
30#include <linux/spi/spi.h> 30#include <linux/spi/spi.h>
31#include <linux/spi/ads7846.h> 31#include <linux/spi/ads7846.h>
32#include <linux/spi/corgi_lcd.h> 32#include <linux/spi/corgi_lcd.h>
33#include <linux/mtd/sharpsl.h>
33 34
34#include <asm/setup.h> 35#include <asm/setup.h>
35#include <asm/memory.h> 36#include <asm/memory.h>
@@ -595,11 +596,60 @@ static struct pxafb_mach_info spitz_pxafb_info = {
595 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING, 596 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
596}; 597};
597 598
599static struct mtd_partition sharpsl_nand_partitions[] = {
600 {
601 .name = "System Area",
602 .offset = 0,
603 .size = 7 * 1024 * 1024,
604 },
605 {
606 .name = "Root Filesystem",
607 .offset = 7 * 1024 * 1024,
608 },
609 {
610 .name = "Home Filesystem",
611 .offset = MTDPART_OFS_APPEND,
612 .size = MTDPART_SIZ_FULL,
613 },
614};
615
616static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
617
618static struct nand_bbt_descr sharpsl_bbt = {
619 .options = 0,
620 .offs = 4,
621 .len = 2,
622 .pattern = scan_ff_pattern
623};
624
625static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
626 .badblock_pattern = &sharpsl_bbt,
627 .partitions = sharpsl_nand_partitions,
628 .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions),
629};
630
631static struct resource sharpsl_nand_resources[] = {
632 {
633 .start = 0x0C000000,
634 .end = 0x0C000FFF,
635 .flags = IORESOURCE_MEM,
636 },
637};
638
639static struct platform_device sharpsl_nand_device = {
640 .name = "sharpsl-nand",
641 .id = -1,
642 .resource = sharpsl_nand_resources,
643 .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
644 .dev.platform_data = &sharpsl_nand_platform_data,
645};
646
598 647
599static struct platform_device *devices[] __initdata = { 648static struct platform_device *devices[] __initdata = {
600 &spitzscoop_device, 649 &spitzscoop_device,
601 &spitzkbd_device, 650 &spitzkbd_device,
602 &spitzled_device, 651 &spitzled_device,
652 &sharpsl_nand_device,
603}; 653};
604 654
605static void spitz_poweroff(void) 655static void spitz_poweroff(void)
@@ -622,6 +672,14 @@ static void __init common_init(void)
622 pm_power_off = spitz_poweroff; 672 pm_power_off = spitz_poweroff;
623 arm_pm_restart = spitz_restart; 673 arm_pm_restart = spitz_restart;
624 674
675 if (machine_is_spitz()) {
676 sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
677 } else if (machine_is_akita()) {
678 sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
679 } else if (machine_is_borzoi()) {
680 sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
681 }
682
625 PMCR = 0x00; 683 PMCR = 0x00;
626 684
627 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ 685 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
@@ -666,10 +724,29 @@ static struct i2c_board_info akita_i2c_board_info[] = {
666 }, 724 },
667}; 725};
668 726
727static struct nand_bbt_descr sharpsl_akita_bbt = {
728 .options = 0,
729 .offs = 4,
730 .len = 1,
731 .pattern = scan_ff_pattern
732};
733
734static struct nand_ecclayout akita_oobinfo = {
735 .eccbytes = 24,
736 .eccpos = {
737 0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
738 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
739 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
740 .oobfree = {{0x08, 0x09}}
741};
742
669static void __init akita_init(void) 743static void __init akita_init(void)
670{ 744{
671 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; 745 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
672 746
747 sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
748 sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
749
673 /* We just pretend the second element of the array doesn't exist */ 750 /* We just pretend the second element of the array doesn't exist */
674 spitz_pcmcia_config.num_devs = 1; 751 spitz_pcmcia_config.num_devs = 1;
675 platform_scoop_config = &spitz_pcmcia_config; 752 platform_scoop_config = &spitz_pcmcia_config;
diff --git a/drivers/mtd/nand/sharpsl.c b/drivers/mtd/nand/sharpsl.c
index 698378ca8e0..54ec7542a7b 100644
--- a/drivers/mtd/nand/sharpsl.c
+++ b/drivers/mtd/nand/sharpsl.c
@@ -247,93 +247,8 @@ static struct platform_driver sharpsl_nand_driver = {
247 .remove = __devexit_p(sharpsl_nand_remove), 247 .remove = __devexit_p(sharpsl_nand_remove),
248}; 248};
249 249
250/*
251 * Define partitions for flash device
252 */
253static struct mtd_partition sharpsl_nand_partitions[] = {
254 {
255 .name = "System Area",
256 .offset = 0,
257 .size = 7 * 1024 * 1024,
258 },
259 {
260 .name = "Root Filesystem",
261 .offset = 7 * 1024 * 1024,
262 .size = 30 * 1024 * 1024,
263 },
264 {
265 .name = "Home Filesystem",
266 .offset = MTDPART_OFS_APPEND,
267 .size = MTDPART_SIZ_FULL,
268 },
269};
270
271static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
272
273static struct nand_bbt_descr sharpsl_bbt = {
274 .options = 0,
275 .offs = 4,
276 .len = 2,
277 .pattern = scan_ff_pattern
278};
279
280static struct nand_bbt_descr sharpsl_akita_bbt = {
281 .options = 0,
282 .offs = 4,
283 .len = 1,
284 .pattern = scan_ff_pattern
285};
286
287static struct nand_ecclayout akita_oobinfo = {
288 .eccbytes = 24,
289 .eccpos = {
290 0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
291 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
292 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
293 .oobfree = {{0x08, 0x09}}
294};
295
296static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
297 .badblock_pattern = &sharpsl_bbt,
298 .partitions = sharpsl_nand_partitions,
299 .nr_partitions = ARRAY_SIZE(sharpsl_nand_partitions),
300};
301
302static struct resource sharpsl_nand_resources[] = {
303 {
304 .start = 0x0C000000,
305 .end = 0x0C000FFF,
306 .flags = IORESOURCE_MEM,
307 },
308};
309
310static struct platform_device sharpsl_nand_device = {
311 .name = "sharpsl-nand",
312 .id = -1,
313 .resource = sharpsl_nand_resources,
314 .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
315 .dev.platform_data = &sharpsl_nand_platform_data,
316};
317
318static int __init sharpsl_nand_init(void) 250static int __init sharpsl_nand_init(void)
319{ 251{
320 if (machine_is_poodle()) {
321 sharpsl_nand_partitions[1].size = 22 * 1024 * 1024;
322 } else if (machine_is_corgi() || machine_is_shepherd()) {
323 sharpsl_nand_partitions[1].size = 25 * 1024 * 1024;
324 } else if (machine_is_husky()) {
325 sharpsl_nand_partitions[1].size = 53 * 1024 * 1024;
326 } else if (machine_is_spitz()) {
327 sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
328 } else if (machine_is_akita()) {
329 sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
330 sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
331 sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
332 } else if (machine_is_borzoi()) {
333 sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
334 }
335
336 platform_device_register(&sharpsl_nand_device);
337 return platform_driver_register(&sharpsl_nand_driver); 252 return platform_driver_register(&sharpsl_nand_driver);
338} 253}
339module_init(sharpsl_nand_init); 254module_init(sharpsl_nand_init);
@@ -341,7 +256,6 @@ module_init(sharpsl_nand_init);
341static void __exit sharpsl_nand_exit(void) 256static void __exit sharpsl_nand_exit(void)
342{ 257{
343 platform_driver_unregister(&sharpsl_nand_driver); 258 platform_driver_unregister(&sharpsl_nand_driver);
344 platform_device_unregister(&sharpsl_nand_device);
345} 259}
346module_exit(sharpsl_nand_exit); 260module_exit(sharpsl_nand_exit);
347 261