ar71xx: create even more network configs from the uci-defaults script
[openwrt.git] / target / linux / omap24xx / patches-3.1 / 300-cbus-platform.patch
1 Index: linux-3.1/arch/arm/mach-omap2/board-n8x0.c
2 ===================================================================
3 --- linux-3.1.orig/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 21:04:56.008818251 +0100
4 +++ linux-3.1/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 21:14:31.600257909 +0100
5 @@ -15,8 +15,11 @@
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/platform_data/cbus.h>
14 #include <linux/i2c.h>
15 #include <linux/spi/spi.h>
16 #include <linux/usb/musb.h>
17 @@ -193,6 +196,110 @@ static struct omap_onenand_platform_data
18 };
19 #endif
20
21 +#if defined(CONFIG_CBUS) || defined(CONFIG_CBUS_MODULE)
22 +
23 +static struct cbus_host_platform_data n8x0_cbus_data = {
24 + .clk_gpio = 66,
25 + .dat_gpio = 65,
26 + .sel_gpio = 64,
27 +};
28 +
29 +static struct platform_device n8x0_cbus_device = {
30 + .name = "cbus",
31 + .id = -1,
32 + .dev = {
33 + .platform_data = &n8x0_cbus_data,
34 + },
35 +};
36 +
37 +static struct resource retu_resource[] = {
38 + {
39 + .start = -EINVAL, /* set later */
40 + .flags = IORESOURCE_IRQ,
41 + },
42 +};
43 +
44 +static struct cbus_retu_platform_data n8x0_retu_data = {
45 + .devid = CBUS_RETU_DEVICE_ID,
46 +};
47 +
48 +static struct platform_device retu_device = {
49 + .name = "retu",
50 + .id = -1,
51 + .resource = retu_resource,
52 + .num_resources = ARRAY_SIZE(retu_resource),
53 + .dev = {
54 + .platform_data = &n8x0_retu_data,
55 + .parent = &n8x0_cbus_device.dev,
56 + },
57 +};
58 +
59 +static struct resource tahvo_resource[] = {
60 + {
61 + .start = -EINVAL, /* set later */
62 + .flags = IORESOURCE_IRQ,
63 + }
64 +};
65 +
66 +static struct platform_device tahvo_device = {
67 + .name = "tahvo",
68 + .id = -1,
69 + .resource = tahvo_resource,
70 + .num_resources = ARRAY_SIZE(tahvo_resource),
71 + .dev = {
72 + .parent = &n8x0_cbus_device.dev,
73 + },
74 +};
75 +
76 +static void __init n8x0_cbus_init(void)
77 +{
78 + int ret;
79 +
80 + platform_device_register(&n8x0_cbus_device);
81 +
82 + ret = gpio_request(108, "RETU irq");
83 + if (ret < 0) {
84 + pr_err("retu: Unable to reserve IRQ GPIO\n");
85 + return;
86 + }
87 +
88 + ret = gpio_direction_input(108);
89 + if (ret < 0) {
90 + pr_err("retu: Unable to change gpio direction\n");
91 + gpio_free(108);
92 + return;
93 + }
94 +
95 + irq_set_irq_type(gpio_to_irq(108), IRQ_TYPE_EDGE_RISING);
96 + retu_resource[0].start = gpio_to_irq(108);
97 + platform_device_register(&retu_device);
98 +
99 + ret = gpio_request(111, "TAHVO irq");
100 + if (ret) {
101 + pr_err("tahvo: Unable to reserve IRQ GPIO\n");
102 + gpio_free(108);
103 + return;
104 + }
105 +
106 + /* Set the pin as input */
107 + ret = gpio_direction_input(111);
108 + if (ret) {
109 + pr_err("tahvo: Unable to change direction\n");
110 + gpio_free(108);
111 + gpio_free(111);
112 + return;
113 + }
114 +
115 + tahvo_resource[0].start = gpio_to_irq(111);
116 + platform_device_register(&tahvo_device);
117 +}
118 +
119 +#else
120 +static inline void __init n8x0_cbus_init(void)
121 +{
122 +}
123 +#endif
124 +
125 #if defined(CONFIG_MENELAUS) && \
126 (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE))
127
128 @@ -679,6 +786,8 @@ static inline void board_serial_init(voi
129 static void __init n8x0_init_machine(void)
130 {
131 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
132 + n8x0_cbus_init();
133 +
134 /* FIXME: add n810 spi devices */
135 spi_register_board_info(n800_spi_board_info,
136 ARRAY_SIZE(n800_spi_board_info));
137 Index: linux-3.1/include/linux/platform_data/cbus.h
138 ===================================================================
139 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
140 +++ linux-3.1/include/linux/platform_data/cbus.h 2011-10-30 21:05:07.540709042 +0100
141 @@ -0,0 +1,38 @@
142 +/*
143 + * cbus.h - CBUS platform_data definition
144 + *
145 + * Copyright (C) 2004 - 2009 Nokia Corporation
146 + *
147 + * Written by Felipe Balbi <felipe.balbi@nokia.com>
148 + *
149 + * This file is subject to the terms and conditions of the GNU General
150 + * Public License. See the file "COPYING" in the main directory of this
151 + * archive for more details.
152 + *
153 + * This program is distributed in the hope that it will be useful,
154 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
155 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
156 + * GNU General Public License for more details.
157 + *
158 + * You should have received a copy of the GNU General Public License
159 + * along with this program; if not, write to the Free Software
160 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
161 + */
162 +
163 +#ifndef __INCLUDE_LINUX_CBUS_H
164 +#define __INCLUDE_LINUX_CBUS_H
165 +
166 +#define CBUS_RETU_DEVICE_ID 0x01
167 +#define CBUS_TAHVO_DEVICE_ID 0x02
168 +
169 +struct cbus_host_platform_data {
170 + int dat_gpio;
171 + int clk_gpio;
172 + int sel_gpio;
173 +};
174 +
175 +struct cbus_retu_platform_data {
176 + int devid;
177 +};
178 +
179 +#endif /* __INCLUDE_LINUX_CBUS_H */
This page took 0.050215 seconds and 5 git commands to generate.