2 * linux/arch/arm/mach-omap/omap2/board-n800-flash.c
4 * Copyright (C) 2006 Nokia Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
14 #include <asm/mach/flash.h>
15 #include <asm/arch/onenand.h>
16 #include <asm/arch/board.h>
18 static struct mtd_partition n800_partitions[8];
20 static struct omap_onenand_platform_data n800_onenand_data = {
23 .parts = n800_partitions,
24 .nr_parts = 0 /* filled later */
27 static struct platform_device n800_onenand_device = {
28 .name = "omap2-onenand",
31 .platform_data = &n800_onenand_data,
36 void __init n800_flash_init(void)
38 const struct omap_partition_config *part;
41 while ((part = omap_get_nr_config(OMAP_TAG_PARTITION,
42 struct omap_partition_config, i)) != NULL) {
43 struct mtd_partition *mpart;
45 mpart = n800_partitions + i;
46 mpart->name = (char *) part->name;
47 mpart->size = part->size;
48 mpart->offset = part->offset;
49 mpart->mask_flags = part->mask_flags;
51 if (i == ARRAY_SIZE(n800_partitions)) {
52 printk(KERN_ERR "Too many partitions supplied\n");
56 n800_onenand_data.nr_parts = i;
57 if (platform_device_register(&n800_onenand_device) < 0) {
58 printk(KERN_ERR "Unable to register OneNAND device\n");