Skip to content

Commit 8b85e7c

Browse files
Alessandro RubiniDavid Woodhouse
authored andcommitted
mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board)
Signed-off-by: Alessandro Rubini <rubini@unipv.it> Acked-by: Andrea Gallo <andrea.gallo@stericsson.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 6323471 commit 8b85e7c

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

arch/arm/mach-nomadik/board-nhk8815.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <asm/mach-types.h>
2525
#include <asm/mach/arch.h>
2626
#include <asm/mach/irq.h>
27+
#include <asm/mach/flash.h>
2728
#include <mach/setup.h>
2829
#include <mach/nand.h>
2930
#include <mach/fsmc.h>
@@ -112,6 +113,66 @@ static struct platform_device nhk8815_nand_device = {
112113
.num_resources = ARRAY_SIZE(nhk8815_nand_resources),
113114
};
114115

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+
}
115176

116177
#define __MEM_4K_RESOURCE(x) \
117178
.res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
@@ -173,6 +234,7 @@ device_initcall(nhk8815_eth_init);
173234

174235
static struct platform_device *nhk8815_platform_devices[] __initdata = {
175236
&nhk8815_nand_device,
237+
&nhk8815_onenand_device,
176238
&nhk8815_eth_device,
177239
/* will add more devices */
178240
};
@@ -182,6 +244,7 @@ static void __init nhk8815_platform_init(void)
182244
int i;
183245

184246
cpu8815_platform_init();
247+
nhk8815_onenand_init();
185248
platform_add_devices(nhk8815_platform_devices,
186249
ARRAY_SIZE(nhk8815_platform_devices));
187250

0 commit comments

Comments
 (0)