0a28c0d4506225b01813eab64fed5269f840d764
[openwrt.git] / target / linux / omap24xx / patches-2.6.38 / 300-nokia-board.patch
1 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0.c
2 ===================================================================
3 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/board-n8x0.c 2011-02-24 12:09:31.427080051 +0100
4 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0.c 2011-02-24 12:09:59.754956253 +0100
5 @@ -15,8 +15,10 @@
6 #include <linux/delay.h>
7 #include <linux/gpio.h>
8 #include <linux/init.h>
9 +#include <linux/irq.h>
10 #include <linux/io.h>
11 #include <linux/stddef.h>
12 +#include <linux/platform_device.h>
13 #include <linux/i2c.h>
14 #include <linux/spi/spi.h>
15 #include <linux/usb/musb.h>
16 @@ -33,6 +35,7 @@
17 #include <plat/onenand.h>
18 #include <plat/mmc.h>
19 #include <plat/serial.h>
20 +#include <plat/cbus.h>
21
22 #include "mux.h"
23
24 @@ -194,6 +197,114 @@
25 };
26 #endif
27
28 +#if defined(CONFIG_CBUS) || defined(CONFIG_CBUS_MODULE)
29 +
30 +static struct cbus_host_platform_data n8x0_cbus_data = {
31 + .clk_gpio = 66,
32 + .dat_gpio = 65,
33 + .sel_gpio = 64,
34 +};
35 +
36 +static struct platform_device n8x0_cbus_device = {
37 + .name = "cbus",
38 + .id = -1,
39 + .dev = {
40 + .platform_data = &n8x0_cbus_data,
41 + },
42 +};
43 +
44 +static struct resource retu_resource[] = {
45 + {
46 + .start = -EINVAL, /* set later */
47 + .flags = IORESOURCE_IRQ,
48 + },
49 +};
50 +
51 +static struct cbus_retu_platform_data n8x0_retu_data = {
52 + .irq_base = CBUS_RETU_IRQ_BASE,
53 + .irq_end = CBUS_RETU_IRQ_END,
54 + .devid = CBUS_RETU_DEVICE_ID,
55 +};
56 +
57 +static struct platform_device retu_device = {
58 + .name = "retu",
59 + .id = -1,
60 + .resource = retu_resource,
61 + .num_resources = ARRAY_SIZE(retu_resource),
62 + .dev = {
63 + .platform_data = &n8x0_retu_data,
64 + },
65 +};
66 +
67 +static struct resource tahvo_resource[] = {
68 + {
69 + .start = -EINVAL, /* set later */
70 + .flags = IORESOURCE_IRQ,
71 + }
72 +};
73 +
74 +static struct platform_device tahvo_device = {
75 + .name = "tahvo",
76 + .id = -1,
77 + .resource = tahvo_resource,
78 + .num_resources = ARRAY_SIZE(tahvo_resource),
79 +};
80 +
81 +static struct platform_device tahvo_usb_device = {
82 + .name = "tahvo-usb",
83 + .id = -1,
84 +};
85 +
86 +static void __init n8x0_cbus_init(void)
87 +{
88 + int ret;
89 +
90 + platform_device_register(&n8x0_cbus_device);
91 +
92 + ret = gpio_request(108, "RETU irq");
93 + if (ret < 0) {
94 + pr_err("retu: Unable to reserve IRQ GPIO\n");
95 + return;
96 + }
97 +
98 + ret = gpio_direction_input(108);
99 + if (ret < 0) {
100 + pr_err("retu: Unable to change gpio direction\n");
101 + gpio_free(108);
102 + return;
103 + }
104 +
105 + set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
106 + retu_resource[0].start = gpio_to_irq(108);
107 + platform_device_register(&retu_device);
108 +
109 + ret = gpio_request(111, "TAHVO irq");
110 + if (ret) {
111 + pr_err("tahvo: Unable to reserve IRQ GPIO\n");
112 + gpio_free(108);
113 + return;
114 + }
115 +
116 + /* Set the pin as input */
117 + ret = gpio_direction_input(111);
118 + if (ret) {
119 + pr_err("tahvo: Unable to change direction\n");
120 + gpio_free(108);
121 + gpio_free(111);
122 + return;
123 + }
124 +
125 + tahvo_resource[0].start = gpio_to_irq(111);
126 + platform_device_register(&tahvo_device);
127 + platform_device_register(&tahvo_usb_device);
128 +}
129 +
130 +#else
131 +static inline void __init n8x0_cbus_init(void)
132 +{
133 +}
134 +#endif
135 +
136 #if defined(CONFIG_MENELAUS) && \
137 (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
138
139 @@ -628,11 +739,10 @@
140 omap242x_map_common_io();
141 }
142
143 -static void __init n8x0_init_irq(void)
144 +static void __init n8x0_init_early(void)
145 {
146 omap2_init_common_infrastructure();
147 omap2_init_common_devices(NULL, NULL);
148 - omap_init_irq();
149 }
150
151 #ifdef CONFIG_OMAP_MUX
152 @@ -686,6 +796,8 @@
153 static void __init n8x0_init_machine(void)
154 {
155 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
156 + n8x0_cbus_init();
157 +
158 /* FIXME: add n810 spi devices */
159 spi_register_board_info(n800_spi_board_info,
160 ARRAY_SIZE(n800_spi_board_info));
161 @@ -703,27 +815,30 @@
162
163 MACHINE_START(NOKIA_N800, "Nokia N800")
164 .boot_params = 0x80000100,
165 - .map_io = n8x0_map_io,
166 .reserve = omap_reserve,
167 - .init_irq = n8x0_init_irq,
168 + .map_io = n8x0_map_io,
169 + .init_early = n8x0_init_early,
170 + .init_irq = omap_init_irq,
171 .init_machine = n8x0_init_machine,
172 .timer = &omap_timer,
173 MACHINE_END
174
175 MACHINE_START(NOKIA_N810, "Nokia N810")
176 .boot_params = 0x80000100,
177 - .map_io = n8x0_map_io,
178 .reserve = omap_reserve,
179 - .init_irq = n8x0_init_irq,
180 + .map_io = n8x0_map_io,
181 + .init_early = n8x0_init_early,
182 + .init_irq = omap_init_irq,
183 .init_machine = n8x0_init_machine,
184 .timer = &omap_timer,
185 MACHINE_END
186
187 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
188 .boot_params = 0x80000100,
189 - .map_io = n8x0_map_io,
190 .reserve = omap_reserve,
191 - .init_irq = n8x0_init_irq,
192 + .map_io = n8x0_map_io,
193 + .init_early = n8x0_init_early,
194 + .init_irq = omap_init_irq,
195 .init_machine = n8x0_init_machine,
196 .timer = &omap_timer,
197 MACHINE_END
This page took 0.05294 seconds and 3 git commands to generate.