sh: Fix up headers_check regression.
[linux-2.6] / arch / sh / boards / board-rsk7203.c
1 /*
2  * Renesas Technology Europe RSK+ 7203 Support.
3  *
4  * Copyright (C) 2008 Paul Mundt
5  *
6  * This file is subject to the terms and conditions of the GNU General Public
7  * License.  See the file "COPYING" in the main directory of this archive
8  * for more details.
9  */
10 #include <linux/init.h>
11 #include <linux/types.h>
12 #include <linux/platform_device.h>
13 #include <linux/interrupt.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/mtd/map.h>
18 #include <linux/smc911x.h>
19 #include <asm/machvec.h>
20 #include <asm/io.h>
21
22 static struct smc911x_platdata smc911x_info = {
23         .flags          = SMC911X_USE_16BIT,
24         .irq_flags      = IRQF_TRIGGER_LOW,
25 };
26
27 static struct resource smc911x_resources[] = {
28         [0] = {
29                 .start          = 0x24000000,
30                 .end            = 0x24000000 + 0x100,
31                 .flags          = IORESOURCE_MEM,
32         },
33         [1] = {
34                 .start          = 64,
35                 .end            = 64,
36                 .flags          = IORESOURCE_IRQ,
37         },
38 };
39
40 static struct platform_device smc911x_device = {
41         .name           = "smc911x",
42         .id             = -1,
43         .num_resources  = ARRAY_SIZE(smc911x_resources),
44         .resource       = smc911x_resources,
45         .dev            = {
46                 .platform_data = &smc911x_info,
47         },
48 };
49
50 static const char *probes[] = { "cmdlinepart", NULL };
51
52 static struct mtd_partition *parsed_partitions;
53
54 static struct mtd_partition rsk7203_partitions[] = {
55         {
56                 .name           = "Bootloader",
57                 .offset         = 0x00000000,
58                 .size           = 0x00040000,
59                 .mask_flags     = MTD_WRITEABLE,
60         }, {
61                 .name           = "Kernel",
62                 .offset         = MTDPART_OFS_NXTBLK,
63                 .size           = 0x001c0000,
64         }, {
65                 .name           = "Flash_FS",
66                 .offset         = MTDPART_OFS_NXTBLK,
67                 .size           = MTDPART_SIZ_FULL,
68         }
69 };
70
71 static struct physmap_flash_data flash_data = {
72         .width          = 2,
73 };
74
75 static struct resource flash_resource = {
76         .start          = 0x20000000,
77         .end            = 0x20400000,
78         .flags          = IORESOURCE_MEM,
79 };
80
81 static struct platform_device flash_device = {
82         .name           = "physmap-flash",
83         .id             = -1,
84         .resource       = &flash_resource,
85         .num_resources  = 1,
86         .dev            = {
87                 .platform_data = &flash_data,
88         },
89 };
90
91 static struct mtd_info *flash_mtd;
92
93 static struct map_info rsk7203_flash_map = {
94         .name           = "RSK+ Flash",
95         .size           = 0x400000,
96         .bankwidth      = 2,
97 };
98
99 static void __init set_mtd_partitions(void)
100 {
101         int nr_parts = 0;
102
103         simple_map_init(&rsk7203_flash_map);
104         flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
105         nr_parts = parse_mtd_partitions(flash_mtd, probes,
106                                         &parsed_partitions, 0);
107         /* If there is no partition table, used the hard coded table */
108         if (nr_parts <= 0) {
109                 flash_data.parts = rsk7203_partitions;
110                 flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
111         } else {
112                 flash_data.nr_parts = nr_parts;
113                 flash_data.parts = parsed_partitions;
114         }
115 }
116
117
118 static struct platform_device *rsk7203_devices[] __initdata = {
119         &smc911x_device,
120         &flash_device,
121 };
122
123 static int __init rsk7203_devices_setup(void)
124 {
125         set_mtd_partitions();
126         return platform_add_devices(rsk7203_devices,
127                                     ARRAY_SIZE(rsk7203_devices));
128 }
129 device_initcall(rsk7203_devices_setup);
130
131 /*
132  * The Machine Vector
133  */
134 static struct sh_machine_vector mv_rsk7203 __initmv = {
135         .mv_name        = "RSK+7203",
136 };