diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2009-03-04 15:01:31 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-03-20 14:07:39 -0400 |
commit | a591f5d35e89be90c04830d7de01c276af68aeb7 (patch) | |
tree | 25ed19b0423f7035e340ff7b6fea3352971d0a83 /arch/mips | |
parent | fc371a25eab8816d49c2d322d91b48a11e206018 (diff) |
[MTD] [NAND] TXx9: add NDFMC support
Add platform support for NAND Flash Memory Controller of TXx9 SoCs.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-By: Ralf Bächle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/txx9/ndfmc.h | 30 | ||||
-rw-r--r-- | arch/mips/include/asm/txx9/tx4938.h | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/txx9/tx4939.h | 2 | ||||
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 21 | ||||
-rw-r--r-- | arch/mips/txx9/generic/setup_tx4938.c | 21 | ||||
-rw-r--r-- | arch/mips/txx9/generic/setup_tx4939.c | 17 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4938/setup.c | 2 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4939/setup.c | 4 |
8 files changed, 98 insertions, 0 deletions
diff --git a/arch/mips/include/asm/txx9/ndfmc.h b/arch/mips/include/asm/txx9/ndfmc.h new file mode 100644 index 000000000000..fa67f3df78fc --- /dev/null +++ b/arch/mips/include/asm/txx9/ndfmc.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * (C) Copyright TOSHIBA CORPORATION 2007 | ||
7 | */ | ||
8 | #ifndef __ASM_TXX9_NDFMC_H | ||
9 | #define __ASM_TXX9_NDFMC_H | ||
10 | |||
11 | #define NDFMC_PLAT_FLAG_USE_BSPRT 0x01 | ||
12 | #define NDFMC_PLAT_FLAG_NO_RSTR 0x02 | ||
13 | #define NDFMC_PLAT_FLAG_HOLDADD 0x04 | ||
14 | #define NDFMC_PLAT_FLAG_DUMMYWRITE 0x08 | ||
15 | |||
16 | struct txx9ndfmc_platform_data { | ||
17 | unsigned int shift; | ||
18 | unsigned int gbus_clock; | ||
19 | unsigned int hold; /* hold time in nanosecond */ | ||
20 | unsigned int spw; /* strobe pulse width in nanosecond */ | ||
21 | unsigned int flags; | ||
22 | unsigned char ch_mask; /* available channel bitmask */ | ||
23 | unsigned char wp_mask; /* write-protect bitmask */ | ||
24 | unsigned char wide_mask; /* 16bit-nand bitmask */ | ||
25 | }; | ||
26 | |||
27 | void txx9_ndfmc_init(unsigned long baseaddr, | ||
28 | const struct txx9ndfmc_platform_data *plat_data); | ||
29 | |||
30 | #endif /* __ASM_TXX9_NDFMC_H */ | ||
diff --git a/arch/mips/include/asm/txx9/tx4938.h b/arch/mips/include/asm/txx9/tx4938.h index 0b068154054c..cd8bc2021755 100644 --- a/arch/mips/include/asm/txx9/tx4938.h +++ b/arch/mips/include/asm/txx9/tx4938.h | |||
@@ -291,6 +291,7 @@ int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot); | |||
291 | void tx4938_setup_pcierr_irq(void); | 291 | void tx4938_setup_pcierr_irq(void); |
292 | void tx4938_irq_init(void); | 292 | void tx4938_irq_init(void); |
293 | void tx4938_mtd_init(int ch); | 293 | void tx4938_mtd_init(int ch); |
294 | void tx4938_ndfmc_init(unsigned int hold, unsigned int spw); | ||
294 | 295 | ||
295 | struct tx4938ide_platform_info { | 296 | struct tx4938ide_platform_info { |
296 | /* | 297 | /* |
diff --git a/arch/mips/include/asm/txx9/tx4939.h b/arch/mips/include/asm/txx9/tx4939.h index 964ef7ede268..f02c50b3abfb 100644 --- a/arch/mips/include/asm/txx9/tx4939.h +++ b/arch/mips/include/asm/txx9/tx4939.h | |||
@@ -542,5 +542,7 @@ int tx4939_irq(void); | |||
542 | void tx4939_mtd_init(int ch); | 542 | void tx4939_mtd_init(int ch); |
543 | void tx4939_ata_init(void); | 543 | void tx4939_ata_init(void); |
544 | void tx4939_rtc_init(void); | 544 | void tx4939_rtc_init(void); |
545 | void tx4939_ndfmc_init(unsigned int hold, unsigned int spw, | ||
546 | unsigned char ch_mask, unsigned char wide_mask); | ||
545 | 547 | ||
546 | #endif /* __ASM_TXX9_TX4939_H */ | 548 | #endif /* __ASM_TXX9_TX4939_H */ |
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index a13a08b8c9ec..8a266c6a3f58 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <asm/txx9/generic.h> | 32 | #include <asm/txx9/generic.h> |
33 | #include <asm/txx9/pci.h> | 33 | #include <asm/txx9/pci.h> |
34 | #include <asm/txx9tmr.h> | 34 | #include <asm/txx9tmr.h> |
35 | #include <asm/txx9/ndfmc.h> | ||
35 | #ifdef CONFIG_CPU_TX49XX | 36 | #ifdef CONFIG_CPU_TX49XX |
36 | #include <asm/txx9/tx4938.h> | 37 | #include <asm/txx9/tx4938.h> |
37 | #endif | 38 | #endif |
@@ -691,6 +692,26 @@ void __init txx9_physmap_flash_init(int no, unsigned long addr, | |||
691 | #endif | 692 | #endif |
692 | } | 693 | } |
693 | 694 | ||
695 | void __init txx9_ndfmc_init(unsigned long baseaddr, | ||
696 | const struct txx9ndfmc_platform_data *pdata) | ||
697 | { | ||
698 | #if defined(CONFIG_MTD_NAND_TXX9NDFMC) || \ | ||
699 | defined(CONFIG_MTD_NAND_TXX9NDFMC_MODULE) | ||
700 | struct resource res = { | ||
701 | .start = baseaddr, | ||
702 | .end = baseaddr + 0x1000 - 1, | ||
703 | .flags = IORESOURCE_MEM, | ||
704 | }; | ||
705 | struct platform_device *pdev = platform_device_alloc("txx9ndfmc", -1); | ||
706 | |||
707 | if (!pdev || | ||
708 | platform_device_add_resources(pdev, &res, 1) || | ||
709 | platform_device_add_data(pdev, pdata, sizeof(*pdata)) || | ||
710 | platform_device_add(pdev)) | ||
711 | platform_device_put(pdev); | ||
712 | #endif | ||
713 | } | ||
714 | |||
694 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | 715 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
695 | static DEFINE_SPINLOCK(txx9_iocled_lock); | 716 | static DEFINE_SPINLOCK(txx9_iocled_lock); |
696 | 717 | ||
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c index 25819ff1c350..f0844f891f0b 100644 --- a/arch/mips/txx9/generic/setup_tx4938.c +++ b/arch/mips/txx9/generic/setup_tx4938.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/txx9tmr.h> | 23 | #include <asm/txx9tmr.h> |
24 | #include <asm/txx9pio.h> | 24 | #include <asm/txx9pio.h> |
25 | #include <asm/txx9/generic.h> | 25 | #include <asm/txx9/generic.h> |
26 | #include <asm/txx9/ndfmc.h> | ||
26 | #include <asm/txx9/tx4938.h> | 27 | #include <asm/txx9/tx4938.h> |
27 | 28 | ||
28 | static void __init tx4938_wdr_init(void) | 29 | static void __init tx4938_wdr_init(void) |
@@ -382,6 +383,26 @@ void __init tx4938_ata_init(unsigned int irq, unsigned int shift, int tune) | |||
382 | platform_device_put(pdev); | 383 | platform_device_put(pdev); |
383 | } | 384 | } |
384 | 385 | ||
386 | void __init tx4938_ndfmc_init(unsigned int hold, unsigned int spw) | ||
387 | { | ||
388 | struct txx9ndfmc_platform_data plat_data = { | ||
389 | .shift = 1, | ||
390 | .gbus_clock = txx9_gbus_clock, | ||
391 | .hold = hold, | ||
392 | .spw = spw, | ||
393 | .ch_mask = 1, | ||
394 | }; | ||
395 | unsigned long baseaddr = TX4938_NDFMC_REG & 0xfffffffffULL; | ||
396 | |||
397 | #ifdef __BIG_ENDIAN | ||
398 | baseaddr += 4; | ||
399 | #endif | ||
400 | if ((__raw_readq(&tx4938_ccfgptr->pcfg) & | ||
401 | (TX4938_PCFG_ATA_SEL|TX4938_PCFG_ISA_SEL|TX4938_PCFG_NDF_SEL)) == | ||
402 | TX4938_PCFG_NDF_SEL) | ||
403 | txx9_ndfmc_init(baseaddr, &plat_data); | ||
404 | } | ||
405 | |||
385 | static void __init tx4938_stop_unused_modules(void) | 406 | static void __init tx4938_stop_unused_modules(void) |
386 | { | 407 | { |
387 | __u64 pcfg, rst = 0, ckd = 0; | 408 | __u64 pcfg, rst = 0, ckd = 0; |
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c index 55440967b3a8..7a25b573e9b0 100644 --- a/arch/mips/txx9/generic/setup_tx4939.c +++ b/arch/mips/txx9/generic/setup_tx4939.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/txx9irq.h> | 27 | #include <asm/txx9irq.h> |
28 | #include <asm/txx9tmr.h> | 28 | #include <asm/txx9tmr.h> |
29 | #include <asm/txx9/generic.h> | 29 | #include <asm/txx9/generic.h> |
30 | #include <asm/txx9/ndfmc.h> | ||
30 | #include <asm/txx9/tx4939.h> | 31 | #include <asm/txx9/tx4939.h> |
31 | 32 | ||
32 | static void __init tx4939_wdr_init(void) | 33 | static void __init tx4939_wdr_init(void) |
@@ -457,6 +458,22 @@ void __init tx4939_rtc_init(void) | |||
457 | platform_device_register(&rtc_dev); | 458 | platform_device_register(&rtc_dev); |
458 | } | 459 | } |
459 | 460 | ||
461 | void __init tx4939_ndfmc_init(unsigned int hold, unsigned int spw, | ||
462 | unsigned char ch_mask, unsigned char wide_mask) | ||
463 | { | ||
464 | struct txx9ndfmc_platform_data plat_data = { | ||
465 | .shift = 1, | ||
466 | .gbus_clock = txx9_gbus_clock, | ||
467 | .hold = hold, | ||
468 | .spw = spw, | ||
469 | .flags = NDFMC_PLAT_FLAG_NO_RSTR | NDFMC_PLAT_FLAG_HOLDADD | | ||
470 | NDFMC_PLAT_FLAG_DUMMYWRITE, | ||
471 | .ch_mask = ch_mask, | ||
472 | .wide_mask = wide_mask, | ||
473 | }; | ||
474 | txx9_ndfmc_init(TX4939_NDFMC_REG & 0xfffffffffULL, &plat_data); | ||
475 | } | ||
476 | |||
460 | static void __init tx4939_stop_unused_modules(void) | 477 | static void __init tx4939_stop_unused_modules(void) |
461 | { | 478 | { |
462 | __u64 pcfg, rst = 0, ckd = 0; | 479 | __u64 pcfg, rst = 0, ckd = 0; |
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c index 547ff2920bf0..65d13df8878a 100644 --- a/arch/mips/txx9/rbtx4938/setup.c +++ b/arch/mips/txx9/rbtx4938/setup.c | |||
@@ -352,6 +352,8 @@ static void __init rbtx4938_device_init(void) | |||
352 | rbtx4938_ne_init(); | 352 | rbtx4938_ne_init(); |
353 | tx4938_wdt_init(); | 353 | tx4938_wdt_init(); |
354 | rbtx4938_mtd_init(); | 354 | rbtx4938_mtd_init(); |
355 | /* TC58DVM82A1FT: tDH=10ns, tWP=tRP=tREADID=35ns */ | ||
356 | tx4938_ndfmc_init(10, 35); | ||
355 | tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1); | 357 | tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1); |
356 | txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL); | 358 | txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL); |
357 | } | 359 | } |
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c index 656603b85b71..74839f2a111e 100644 --- a/arch/mips/txx9/rbtx4939/setup.c +++ b/arch/mips/txx9/rbtx4939/setup.c | |||
@@ -333,6 +333,10 @@ static void __init rbtx4939_device_init(void) | |||
333 | platform_device_add_data(pdev, &smc_pdata, sizeof(smc_pdata)) || | 333 | platform_device_add_data(pdev, &smc_pdata, sizeof(smc_pdata)) || |
334 | platform_device_add(pdev)) | 334 | platform_device_add(pdev)) |
335 | platform_device_put(pdev); | 335 | platform_device_put(pdev); |
336 | /* TC58DVM82A1FT: tDH=10ns, tWP=tRP=tREADID=35ns */ | ||
337 | tx4939_ndfmc_init(10, 35, | ||
338 | (1 << 1) | (1 << 2), | ||
339 | (1 << 2)); /* ch1:8bit, ch2:16bit */ | ||
336 | rbtx4939_led_setup(); | 340 | rbtx4939_led_setup(); |
337 | tx4939_wdt_init(); | 341 | tx4939_wdt_init(); |
338 | tx4939_ata_init(); | 342 | tx4939_ata_init(); |