7049b4d486452a4ff1fe95b7cd3415110900c9e0
[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 00:48:29.505056863 +0200
4 +++ linux-3.1/arch/arm/mach-omap2/board-n8x0.c 2011-10-30 00:48:47.357044479 +0200
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 @@ -193,6 +196,114 @@ static struct omap_onenand_platform_data
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 + irq_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 @@ -679,6 +790,8 @@ static inline void board_serial_init(voi
140 static void __init n8x0_init_machine(void)
141 {
142 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
143 + n8x0_cbus_init();
144 +
145 /* FIXME: add n810 spi devices */
146 spi_register_board_info(n800_spi_board_info,
147 ARRAY_SIZE(n800_spi_board_info));
148 Index: linux-3.1/arch/arm/plat-omap/include/plat/irqs.h
149 ===================================================================
150 --- linux-3.1.orig/arch/arm/plat-omap/include/plat/irqs.h 2011-10-30 00:48:29.517056855 +0200
151 +++ linux-3.1/arch/arm/plat-omap/include/plat/irqs.h 2011-10-30 00:48:47.357044479 +0200
152 @@ -428,8 +428,16 @@
153 #define OMAP_GPMC_NR_IRQS 8
154 #define OMAP_GPMC_IRQ_END (OMAP_GPMC_IRQ_BASE + OMAP_GPMC_NR_IRQS)
155
156 +/* CBUS */
157 +#define CBUS_RETU_IRQ_BASE OMAP_GPMC_IRQ_END
158 +#ifdef CONFIG_CBUS_RETU
159 +#define CBUS_RETU_NR_IRQS 16
160 +#else
161 +#define CBUS_RETU_NR_IRQS 0
162 +#endif
163 +#define CBUS_RETU_IRQ_END (CBUS_RETU_IRQ_BASE + CBUS_RETU_NR_IRQS)
164
165 -#define NR_IRQS OMAP_GPMC_IRQ_END
166 +#define NR_IRQS CBUS_RETU_IRQ_END
167
168 #define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
169
This page took 0.05183 seconds and 3 git commands to generate.