diff options
author | Alessandro Rubini <rubini@unipv.it> | 2009-07-29 12:51:56 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-09-20 08:59:42 -0400 |
commit | 63234717d170d39ee9cc873f29930b0fb142a114 (patch) | |
tree | 8a47072187027064f3e0b0ecdb6c65baf7ad0455 /arch/arm/mach-nomadik | |
parent | 6469f540ea37d53db089c8fea9c0c77a3d9353d4 (diff) |
mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board)
Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'arch/arm/mach-nomadik')
-rw-r--r-- | arch/arm/mach-nomadik/board-nhk8815.c | 92 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/include/mach/fsmc.h | 29 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/include/mach/nand.h | 16 |
3 files changed, 137 insertions, 0 deletions
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index 79bdea943eb4..59c1dbb686c9 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c | |||
@@ -16,12 +16,103 @@ | |||
16 | #include <linux/amba/bus.h> | 16 | #include <linux/amba/bus.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/mtd/mtd.h> | ||
20 | #include <linux/mtd/nand.h> | ||
21 | #include <linux/mtd/partitions.h> | ||
22 | #include <linux/io.h> | ||
23 | #include <asm/sizes.h> | ||
19 | #include <asm/mach-types.h> | 24 | #include <asm/mach-types.h> |
20 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
21 | #include <asm/mach/irq.h> | 26 | #include <asm/mach/irq.h> |
22 | #include <mach/setup.h> | 27 | #include <mach/setup.h> |
28 | #include <mach/nand.h> | ||
29 | #include <mach/fsmc.h> | ||
23 | #include "clock.h" | 30 | #include "clock.h" |
24 | 31 | ||
32 | /* These adresses span 16MB, so use three individual pages */ | ||
33 | static struct resource nhk8815_nand_resources[] = { | ||
34 | { | ||
35 | .name = "nand_addr", | ||
36 | .start = NAND_IO_ADDR, | ||
37 | .end = NAND_IO_ADDR + 0xfff, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, { | ||
40 | .name = "nand_cmd", | ||
41 | .start = NAND_IO_CMD, | ||
42 | .end = NAND_IO_CMD + 0xfff, | ||
43 | .flags = IORESOURCE_MEM, | ||
44 | }, { | ||
45 | .name = "nand_data", | ||
46 | .start = NAND_IO_DATA, | ||
47 | .end = NAND_IO_DATA + 0xfff, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | } | ||
50 | }; | ||
51 | |||
52 | static int nhk8815_nand_init(void) | ||
53 | { | ||
54 | /* FSMC setup for nand chip select (8-bit nand in 8815NHK) */ | ||
55 | writel(0x0000000E, FSMC_PCR(0)); | ||
56 | writel(0x000D0A00, FSMC_PMEM(0)); | ||
57 | writel(0x00100A00, FSMC_PATT(0)); | ||
58 | |||
59 | /* enable access to the chip select area */ | ||
60 | writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0)); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * These partitions are the same as those used in the 2.6.20 release | ||
67 | * shipped by the vendor; the first two partitions are mandated | ||
68 | * by the boot ROM, and the bootloader area is somehow oversized... | ||
69 | */ | ||
70 | static struct mtd_partition nhk8815_partitions[] = { | ||
71 | { | ||
72 | .name = "X-Loader(NAND)", | ||
73 | .offset = 0, | ||
74 | .size = SZ_256K, | ||
75 | }, { | ||
76 | .name = "MemInit(NAND)", | ||
77 | .offset = MTDPART_OFS_APPEND, | ||
78 | .size = SZ_256K, | ||
79 | }, { | ||
80 | .name = "BootLoader(NAND)", | ||
81 | .offset = MTDPART_OFS_APPEND, | ||
82 | .size = SZ_2M, | ||
83 | }, { | ||
84 | .name = "Kernel zImage(NAND)", | ||
85 | .offset = MTDPART_OFS_APPEND, | ||
86 | .size = 3 * SZ_1M, | ||
87 | }, { | ||
88 | .name = "Root Filesystem(NAND)", | ||
89 | .offset = MTDPART_OFS_APPEND, | ||
90 | .size = 22 * SZ_1M, | ||
91 | }, { | ||
92 | .name = "User Filesystem(NAND)", | ||
93 | .offset = MTDPART_OFS_APPEND, | ||
94 | .size = MTDPART_SIZ_FULL, | ||
95 | } | ||
96 | }; | ||
97 | |||
98 | static struct nomadik_nand_platform_data nhk8815_nand_data = { | ||
99 | .parts = nhk8815_partitions, | ||
100 | .nparts = ARRAY_SIZE(nhk8815_partitions), | ||
101 | .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \ | ||
102 | | NAND_NO_READRDY | NAND_NO_AUTOINCR, | ||
103 | .init = nhk8815_nand_init, | ||
104 | }; | ||
105 | |||
106 | static struct platform_device nhk8815_nand_device = { | ||
107 | .name = "nomadik_nand", | ||
108 | .dev = { | ||
109 | .platform_data = &nhk8815_nand_data, | ||
110 | }, | ||
111 | .resource = nhk8815_nand_resources, | ||
112 | .num_resources = ARRAY_SIZE(nhk8815_nand_resources), | ||
113 | }; | ||
114 | |||
115 | |||
25 | #define __MEM_4K_RESOURCE(x) \ | 116 | #define __MEM_4K_RESOURCE(x) \ |
26 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} | 117 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} |
27 | 118 | ||
@@ -81,6 +172,7 @@ static int __init nhk8815_eth_init(void) | |||
81 | device_initcall(nhk8815_eth_init); | 172 | device_initcall(nhk8815_eth_init); |
82 | 173 | ||
83 | static struct platform_device *nhk8815_platform_devices[] __initdata = { | 174 | static struct platform_device *nhk8815_platform_devices[] __initdata = { |
175 | &nhk8815_nand_device, | ||
84 | &nhk8815_eth_device, | 176 | &nhk8815_eth_device, |
85 | /* will add more devices */ | 177 | /* will add more devices */ |
86 | }; | 178 | }; |
diff --git a/arch/arm/mach-nomadik/include/mach/fsmc.h b/arch/arm/mach-nomadik/include/mach/fsmc.h new file mode 100644 index 000000000000..8c2c05183685 --- /dev/null +++ b/arch/arm/mach-nomadik/include/mach/fsmc.h | |||
@@ -0,0 +1,29 @@ | |||
1 | |||
2 | /* Definitions for the Nomadik FSMC "Flexible Static Memory controller" */ | ||
3 | |||
4 | #ifndef __ASM_ARCH_FSMC_H | ||
5 | #define __ASM_ARCH_FSMC_H | ||
6 | |||
7 | #include <mach/hardware.h> | ||
8 | /* | ||
9 | * Register list | ||
10 | */ | ||
11 | |||
12 | /* bus control reg. and bus timing reg. for CS0..CS3 */ | ||
13 | #define FSMC_BCR(x) (NOMADIK_FSMC_VA + (x << 3)) | ||
14 | #define FSMC_BTR(x) (NOMADIK_FSMC_VA + (x << 3) + 0x04) | ||
15 | |||
16 | /* PC-card and NAND: | ||
17 | * PCR = control register | ||
18 | * PMEM = memory timing | ||
19 | * PATT = attribute timing | ||
20 | * PIO = I/O timing | ||
21 | * PECCR = ECC result | ||
22 | */ | ||
23 | #define FSMC_PCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x00) | ||
24 | #define FSMC_PMEM(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x08) | ||
25 | #define FSMC_PATT(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x0c) | ||
26 | #define FSMC_PIO(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x10) | ||
27 | #define FSMC_PECCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x14) | ||
28 | |||
29 | #endif /* __ASM_ARCH_FSMC_H */ | ||
diff --git a/arch/arm/mach-nomadik/include/mach/nand.h b/arch/arm/mach-nomadik/include/mach/nand.h new file mode 100644 index 000000000000..c3c8254c22a5 --- /dev/null +++ b/arch/arm/mach-nomadik/include/mach/nand.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef __ASM_ARCH_NAND_H | ||
2 | #define __ASM_ARCH_NAND_H | ||
3 | |||
4 | struct nomadik_nand_platform_data { | ||
5 | struct mtd_partition *parts; | ||
6 | int nparts; | ||
7 | int options; | ||
8 | int (*init) (void); | ||
9 | int (*exit) (void); | ||
10 | }; | ||
11 | |||
12 | #define NAND_IO_DATA 0x40000000 | ||
13 | #define NAND_IO_CMD 0x40800000 | ||
14 | #define NAND_IO_ADDR 0x41000000 | ||
15 | |||
16 | #endif /* __ASM_ARCH_NAND_H */ | ||