]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-n800-flash.c
ARM: OMAP: Merge board specific files from N800 tree
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-n800-flash.c
1 /*
2  * linux/arch/arm/mach-omap/omap2/board-n800-flash.c
3  *
4  * Copyright (C) 2006 Nokia Corporation
5  * Author: Juha Yrjola
6  *
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.
10  */
11
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>
17
18 static struct mtd_partition n800_partitions[8];
19
20 static struct omap_onenand_platform_data n800_onenand_data = {
21         .cs = 0,
22         .gpio_irq = 26,
23         .parts = n800_partitions,
24         .nr_parts = 0 /* filled later */
25 };
26
27 static struct platform_device n800_onenand_device = {
28         .name           = "omap2-onenand",
29         .id             = -1,
30         .dev = {
31                 .platform_data = &n800_onenand_data,
32         },
33 };
34
35
36 void __init n800_flash_init(void)
37 {
38         const struct omap_partition_config *part;
39         int i = 0;
40
41         while ((part = omap_get_nr_config(OMAP_TAG_PARTITION,
42                                           struct omap_partition_config, i)) != NULL) {
43                 struct mtd_partition *mpart;
44
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;
50                 i++;
51                 if (i == ARRAY_SIZE(n800_partitions)) {
52                         printk(KERN_ERR "Too many partitions supplied\n");
53                         return;
54                 }
55         }
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");
59                 return;
60         }
61 }