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