24
24
#include <asm/mach-types.h>
25
25
#include <asm/mach/arch.h>
26
26
#include <asm/mach/irq.h>
27
+ #include <asm/mach/flash.h>
27
28
#include <mach/setup.h>
28
29
#include <mach/nand.h>
29
30
#include <mach/fsmc.h>
@@ -112,6 +113,66 @@ static struct platform_device nhk8815_nand_device = {
112
113
.num_resources = ARRAY_SIZE (nhk8815_nand_resources ),
113
114
};
114
115
116
+ /* These are the partitions for the OneNand device, different from above */
117
+ static struct mtd_partition nhk8815_onenand_partitions [] = {
118
+ {
119
+ .name = "X-Loader(OneNAND)" ,
120
+ .offset = 0 ,
121
+ .size = SZ_256K ,
122
+ }, {
123
+ .name = "MemInit(OneNAND)" ,
124
+ .offset = MTDPART_OFS_APPEND ,
125
+ .size = SZ_256K ,
126
+ }, {
127
+ .name = "BootLoader(OneNAND)" ,
128
+ .offset = MTDPART_OFS_APPEND ,
129
+ .size = SZ_2M - SZ_256K ,
130
+ }, {
131
+ .name = "SysImage(OneNAND)" ,
132
+ .offset = MTDPART_OFS_APPEND ,
133
+ .size = 4 * SZ_1M ,
134
+ }, {
135
+ .name = "Root Filesystem(OneNAND)" ,
136
+ .offset = MTDPART_OFS_APPEND ,
137
+ .size = 22 * SZ_1M ,
138
+ }, {
139
+ .name = "User Filesystem(OneNAND)" ,
140
+ .offset = MTDPART_OFS_APPEND ,
141
+ .size = MTDPART_SIZ_FULL ,
142
+ }
143
+ };
144
+
145
+ static struct flash_platform_data nhk8815_onenand_data = {
146
+ .parts = nhk8815_onenand_partitions ,
147
+ .nr_parts = ARRAY_SIZE (nhk8815_onenand_partitions ),
148
+ };
149
+
150
+ static struct resource nhk8815_onenand_resource [] = {
151
+ {
152
+ .start = 0x30000000 ,
153
+ .end = 0x30000000 + SZ_128K - 1 ,
154
+ .flags = IORESOURCE_MEM ,
155
+ },
156
+ };
157
+
158
+ static struct platform_device nhk8815_onenand_device = {
159
+ .name = "onenand" ,
160
+ .id = -1 ,
161
+ .dev = {
162
+ .platform_data = & nhk8815_onenand_data ,
163
+ },
164
+ .resource = nhk8815_onenand_resource ,
165
+ .num_resources = ARRAY_SIZE (nhk8815_onenand_resource ),
166
+ };
167
+
168
+ static void __init nhk8815_onenand_init (void )
169
+ {
170
+ #ifdef CONFIG_ONENAND
171
+ /* Set up SMCS0 for OneNand */
172
+ writel (0x000030db , FSMC_BCR0 );
173
+ writel (0x02100551 , FSMC_BTR0 );
174
+ #endif
175
+ }
115
176
116
177
#define __MEM_4K_RESOURCE (x ) \
117
178
.res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
@@ -173,6 +234,7 @@ device_initcall(nhk8815_eth_init);
173
234
174
235
static struct platform_device * nhk8815_platform_devices [] __initdata = {
175
236
& nhk8815_nand_device ,
237
+ & nhk8815_onenand_device ,
176
238
& nhk8815_eth_device ,
177
239
/* will add more devices */
178
240
};
@@ -182,6 +244,7 @@ static void __init nhk8815_platform_init(void)
182
244
int i ;
183
245
184
246
cpu8815_platform_init ();
247
+ nhk8815_onenand_init ();
185
248
platform_add_devices (nhk8815_platform_devices ,
186
249
ARRAY_SIZE (nhk8815_platform_devices ));
187
250
0 commit comments