sh: Fix up the SH7203 build.
[deliverable/linux.git] / 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 <linux/gpio.h>
20 #include <asm/machvec.h>
21 #include <asm/io.h>
22 #include <cpu/sh7203.h>
23
24 static struct smc911x_platdata smc911x_info = {
25 .flags = SMC911X_USE_16BIT,
26 .irq_flags = IRQF_TRIGGER_LOW,
27 };
28
29 static struct resource smc911x_resources[] = {
30 [0] = {
31 .start = 0x24000000,
32 .end = 0x24000000 + 0x100,
33 .flags = IORESOURCE_MEM,
34 },
35 [1] = {
36 .start = 64,
37 .end = 64,
38 .flags = IORESOURCE_IRQ,
39 },
40 };
41
42 static struct platform_device smc911x_device = {
43 .name = "smc911x",
44 .id = -1,
45 .num_resources = ARRAY_SIZE(smc911x_resources),
46 .resource = smc911x_resources,
47 .dev = {
48 .platform_data = &smc911x_info,
49 },
50 };
51
52 static const char *probes[] = { "cmdlinepart", NULL };
53
54 static struct mtd_partition *parsed_partitions;
55
56 static struct mtd_partition rsk7203_partitions[] = {
57 {
58 .name = "Bootloader",
59 .offset = 0x00000000,
60 .size = 0x00040000,
61 .mask_flags = MTD_WRITEABLE,
62 }, {
63 .name = "Kernel",
64 .offset = MTDPART_OFS_NXTBLK,
65 .size = 0x001c0000,
66 }, {
67 .name = "Flash_FS",
68 .offset = MTDPART_OFS_NXTBLK,
69 .size = MTDPART_SIZ_FULL,
70 }
71 };
72
73 static struct physmap_flash_data flash_data = {
74 .width = 2,
75 };
76
77 static struct resource flash_resource = {
78 .start = 0x20000000,
79 .end = 0x20400000,
80 .flags = IORESOURCE_MEM,
81 };
82
83 static struct platform_device flash_device = {
84 .name = "physmap-flash",
85 .id = -1,
86 .resource = &flash_resource,
87 .num_resources = 1,
88 .dev = {
89 .platform_data = &flash_data,
90 },
91 };
92
93 static struct mtd_info *flash_mtd;
94
95 static struct map_info rsk7203_flash_map = {
96 .name = "RSK+ Flash",
97 .size = 0x400000,
98 .bankwidth = 2,
99 };
100
101 static void __init set_mtd_partitions(void)
102 {
103 int nr_parts = 0;
104
105 simple_map_init(&rsk7203_flash_map);
106 flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
107 nr_parts = parse_mtd_partitions(flash_mtd, probes,
108 &parsed_partitions, 0);
109 /* If there is no partition table, used the hard coded table */
110 if (nr_parts <= 0) {
111 flash_data.parts = rsk7203_partitions;
112 flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
113 } else {
114 flash_data.nr_parts = nr_parts;
115 flash_data.parts = parsed_partitions;
116 }
117 }
118
119
120 static struct platform_device *rsk7203_devices[] __initdata = {
121 &smc911x_device,
122 &flash_device,
123 };
124
125 static int __init rsk7203_devices_setup(void)
126 {
127 /* Select pins for SCIF0 */
128 gpio_request(GPIO_FN_TXD0, NULL);
129 gpio_request(GPIO_FN_RXD0, NULL);
130
131 /* Lit LED0 */
132 gpio_request(GPIO_PE10, NULL);
133 gpio_direction_output(GPIO_PE10, 0);
134 gpio_export(GPIO_PE10, 0);
135
136 set_mtd_partitions();
137 return platform_add_devices(rsk7203_devices,
138 ARRAY_SIZE(rsk7203_devices));
139 }
140 device_initcall(rsk7203_devices_setup);
141
142 /*
143 * The Machine Vector
144 */
145 static struct sh_machine_vector mv_rsk7203 __initmv = {
146 .mv_name = "RSK+7203",
147 };
This page took 0.046454 seconds and 5 git commands to generate.