diff options
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap2-git/beagleboard/TWL4030-07.patch')
-rw-r--r-- | meta/recipes-kernel/linux/linux-omap2-git/beagleboard/TWL4030-07.patch | 274 |
1 files changed, 274 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap2-git/beagleboard/TWL4030-07.patch b/meta/recipes-kernel/linux/linux-omap2-git/beagleboard/TWL4030-07.patch new file mode 100644 index 0000000000..8e4c4d6be4 --- /dev/null +++ b/meta/recipes-kernel/linux/linux-omap2-git/beagleboard/TWL4030-07.patch | |||
@@ -0,0 +1,274 @@ | |||
1 | TWL4030: move TWL module register defs into separate include files | ||
2 | |||
3 | From: Paul Walmsley <paul@pwsan.com> | ||
4 | |||
5 | twl_init_irq() uses "magic numbers" to access TWL module IMR and ISR | ||
6 | registers. Symbolic constants are definitely preferred. | ||
7 | |||
8 | Rather than duplicating already existing symbolic constants in | ||
9 | twl4030-gpio.c and twl4030-pwrirq.c, move the existing constants out | ||
10 | into include files. This patch should not change kernel behavior. | ||
11 | |||
12 | Signed-off-by: Paul Walmsley <paul@pwsan.com> | ||
13 | --- | ||
14 | |||
15 | drivers/i2c/chips/twl4030-gpio.c | 48 ----------------------- | ||
16 | drivers/i2c/chips/twl4030-pwrirq.c | 15 +++---- | ||
17 | include/linux/i2c/twl4030-gpio.h | 76 ++++++++++++++++++++++++++++++++++++ | ||
18 | include/linux/i2c/twl4030-pwrirq.h | 37 ++++++++++++++++++ | ||
19 | 4 files changed, 121 insertions(+), 55 deletions(-) | ||
20 | create mode 100644 include/linux/i2c/twl4030-gpio.h | ||
21 | create mode 100644 include/linux/i2c/twl4030-pwrirq.h | ||
22 | |||
23 | diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c | ||
24 | index f16a48b..9d17f45 100644 | ||
25 | --- a/drivers/i2c/chips/twl4030-gpio.c | ||
26 | +++ b/drivers/i2c/chips/twl4030-gpio.c | ||
27 | @@ -38,6 +38,7 @@ | ||
28 | |||
29 | #include <linux/i2c.h> | ||
30 | #include <linux/i2c/twl4030.h> | ||
31 | +#include <linux/i2c/twl4030-gpio.h> | ||
32 | #include <linux/slab.h> | ||
33 | |||
34 | #include <asm/arch/irqs.h> | ||
35 | @@ -47,53 +48,6 @@ | ||
36 | |||
37 | #include <linux/device.h> | ||
38 | |||
39 | -/* | ||
40 | - * GPIO Block Register definitions | ||
41 | - */ | ||
42 | - | ||
43 | -#define REG_GPIODATAIN1 0x0 | ||
44 | -#define REG_GPIODATAIN2 0x1 | ||
45 | -#define REG_GPIODATAIN3 0x2 | ||
46 | -#define REG_GPIODATADIR1 0x3 | ||
47 | -#define REG_GPIODATADIR2 0x4 | ||
48 | -#define REG_GPIODATADIR3 0x5 | ||
49 | -#define REG_GPIODATAOUT1 0x6 | ||
50 | -#define REG_GPIODATAOUT2 0x7 | ||
51 | -#define REG_GPIODATAOUT3 0x8 | ||
52 | -#define REG_CLEARGPIODATAOUT1 0x9 | ||
53 | -#define REG_CLEARGPIODATAOUT2 0xA | ||
54 | -#define REG_CLEARGPIODATAOUT3 0xB | ||
55 | -#define REG_SETGPIODATAOUT1 0xC | ||
56 | -#define REG_SETGPIODATAOUT2 0xD | ||
57 | -#define REG_SETGPIODATAOUT3 0xE | ||
58 | -#define REG_GPIO_DEBEN1 0xF | ||
59 | -#define REG_GPIO_DEBEN2 0x10 | ||
60 | -#define REG_GPIO_DEBEN3 0x11 | ||
61 | -#define REG_GPIO_CTRL 0x12 | ||
62 | -#define REG_GPIOPUPDCTR1 0x13 | ||
63 | -#define REG_GPIOPUPDCTR2 0x14 | ||
64 | -#define REG_GPIOPUPDCTR3 0x15 | ||
65 | -#define REG_GPIOPUPDCTR4 0x16 | ||
66 | -#define REG_GPIOPUPDCTR5 0x17 | ||
67 | -#define REG_GPIO_ISR1A 0x19 | ||
68 | -#define REG_GPIO_ISR2A 0x1A | ||
69 | -#define REG_GPIO_ISR3A 0x1B | ||
70 | -#define REG_GPIO_IMR1A 0x1C | ||
71 | -#define REG_GPIO_IMR2A 0x1D | ||
72 | -#define REG_GPIO_IMR3A 0x1E | ||
73 | -#define REG_GPIO_ISR1B 0x1F | ||
74 | -#define REG_GPIO_ISR2B 0x20 | ||
75 | -#define REG_GPIO_ISR3B 0x21 | ||
76 | -#define REG_GPIO_IMR1B 0x22 | ||
77 | -#define REG_GPIO_IMR2B 0x23 | ||
78 | -#define REG_GPIO_IMR3B 0x24 | ||
79 | -#define REG_GPIO_EDR1 0x28 | ||
80 | -#define REG_GPIO_EDR2 0x29 | ||
81 | -#define REG_GPIO_EDR3 0x2A | ||
82 | -#define REG_GPIO_EDR4 0x2B | ||
83 | -#define REG_GPIO_EDR5 0x2C | ||
84 | -#define REG_GPIO_SIH_CTRL 0x2D | ||
85 | - | ||
86 | /* BitField Definitions */ | ||
87 | |||
88 | /* Data banks : 3 banks for 8 gpios each */ | ||
89 | diff --git a/drivers/i2c/chips/twl4030-pwrirq.c b/drivers/i2c/chips/twl4030-pwrirq.c | ||
90 | index a4d2e92..1afdb65 100644 | ||
91 | --- a/drivers/i2c/chips/twl4030-pwrirq.c | ||
92 | +++ b/drivers/i2c/chips/twl4030-pwrirq.c | ||
93 | @@ -27,10 +27,8 @@ | ||
94 | #include <linux/random.h> | ||
95 | #include <linux/kthread.h> | ||
96 | #include <linux/i2c/twl4030.h> | ||
97 | +#include <linux/i2c/twl4030-pwrirq.h> | ||
98 | |||
99 | -#define PWR_ISR1 0 | ||
100 | -#define PWR_IMR1 1 | ||
101 | -#define PWR_SIH_CTRL 7 | ||
102 | #define PWR_SIH_CTRL_COR (1<<2) | ||
103 | |||
104 | static u8 twl4030_pwrirq_mask; | ||
105 | @@ -93,7 +91,8 @@ static void do_twl4030_pwrmodule_irq(unsigned int irq, irq_desc_t *desc) | ||
106 | twl4030_pwrirq_mask |= 1 << (irq - TWL4030_PWR_IRQ_BASE); | ||
107 | local_irq_enable(); | ||
108 | twl4030_i2c_write_u8(TWL4030_MODULE_INT, | ||
109 | - twl4030_pwrirq_mask, PWR_IMR1); | ||
110 | + twl4030_pwrirq_mask, | ||
111 | + TWL4030_INT_PWR_IMR1); | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | @@ -115,7 +114,7 @@ static void do_twl4030_pwrirq(unsigned int irq, irq_desc_t *desc) | ||
116 | |||
117 | local_irq_enable(); | ||
118 | ret = twl4030_i2c_read_u8(TWL4030_MODULE_INT, &pwr_isr, | ||
119 | - PWR_ISR1); | ||
120 | + TWL4030_INT_PWR_ISR1); | ||
121 | if (ret) { | ||
122 | printk(KERN_WARNING | ||
123 | "I2C error %d while reading TWL4030" | ||
124 | @@ -151,7 +150,7 @@ static int twl4030_pwrirq_thread(void *data) | ||
125 | twl4030_pwrirq_mask &= ~local_unmask; | ||
126 | |||
127 | twl4030_i2c_write_u8(TWL4030_MODULE_INT, twl4030_pwrirq_mask, | ||
128 | - PWR_IMR1); | ||
129 | + TWL4030_INT_PWR_IMR1); | ||
130 | |||
131 | local_irq_disable(); | ||
132 | if (!twl4030_pwrirq_pending_unmask) | ||
133 | @@ -172,14 +171,14 @@ static int __init twl4030_pwrirq_init(void) | ||
134 | twl4030_pwrirq_pending_unmask = 0; | ||
135 | |||
136 | err = twl4030_i2c_write_u8(TWL4030_MODULE_INT, twl4030_pwrirq_mask, | ||
137 | - PWR_IMR1); | ||
138 | + TWL4030_INT_PWR_IMR1); | ||
139 | if (err) | ||
140 | return err; | ||
141 | |||
142 | /* Enable clear on read */ | ||
143 | |||
144 | err = twl4030_i2c_write_u8(TWL4030_MODULE_INT, PWR_SIH_CTRL_COR, | ||
145 | - PWR_SIH_CTRL); | ||
146 | + TWL4030_INT_PWR_SIH_CTRL); | ||
147 | if (err) | ||
148 | return err; | ||
149 | |||
150 | diff --git a/include/linux/i2c/twl4030-gpio.h b/include/linux/i2c/twl4030-gpio.h | ||
151 | new file mode 100644 | ||
152 | index 0000000..7cbf610 | ||
153 | --- /dev/null | ||
154 | +++ b/include/linux/i2c/twl4030-gpio.h | ||
155 | @@ -0,0 +1,76 @@ | ||
156 | +/* | ||
157 | + * twl4030-gpio.h - header for TWL4030 GPIO module | ||
158 | + * | ||
159 | + * Copyright (C) 2005-2006, 2008 Texas Instruments, Inc. | ||
160 | + * Copyright (C) 2008 Nokia Corporation | ||
161 | + * | ||
162 | + * Based on tlv320aic23.c: | ||
163 | + * Copyright (c) by Kai Svahn <kai.svahn@nokia.com> | ||
164 | + * | ||
165 | + * This program is free software; you can redistribute it and/or modify | ||
166 | + * it under the terms of the GNU General Public License as published by | ||
167 | + * the Free Software Foundation; either version 2 of the License, or | ||
168 | + * (at your option) any later version. | ||
169 | + * | ||
170 | + * This program is distributed in the hope that it will be useful, | ||
171 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
172 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
173 | + * GNU General Public License for more details. | ||
174 | + * | ||
175 | + * You should have received a copy of the GNU General Public License | ||
176 | + * along with this program; if not, write to the Free Software | ||
177 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
178 | + * | ||
179 | + */ | ||
180 | + | ||
181 | +#ifndef __TWL4030_GPIO_H_ | ||
182 | +#define __TWL4030_GPIO_H_ | ||
183 | + | ||
184 | +/* | ||
185 | + * GPIO Block Register definitions | ||
186 | + */ | ||
187 | + | ||
188 | +#define REG_GPIODATAIN1 0x0 | ||
189 | +#define REG_GPIODATAIN2 0x1 | ||
190 | +#define REG_GPIODATAIN3 0x2 | ||
191 | +#define REG_GPIODATADIR1 0x3 | ||
192 | +#define REG_GPIODATADIR2 0x4 | ||
193 | +#define REG_GPIODATADIR3 0x5 | ||
194 | +#define REG_GPIODATAOUT1 0x6 | ||
195 | +#define REG_GPIODATAOUT2 0x7 | ||
196 | +#define REG_GPIODATAOUT3 0x8 | ||
197 | +#define REG_CLEARGPIODATAOUT1 0x9 | ||
198 | +#define REG_CLEARGPIODATAOUT2 0xA | ||
199 | +#define REG_CLEARGPIODATAOUT3 0xB | ||
200 | +#define REG_SETGPIODATAOUT1 0xC | ||
201 | +#define REG_SETGPIODATAOUT2 0xD | ||
202 | +#define REG_SETGPIODATAOUT3 0xE | ||
203 | +#define REG_GPIO_DEBEN1 0xF | ||
204 | +#define REG_GPIO_DEBEN2 0x10 | ||
205 | +#define REG_GPIO_DEBEN3 0x11 | ||
206 | +#define REG_GPIO_CTRL 0x12 | ||
207 | +#define REG_GPIOPUPDCTR1 0x13 | ||
208 | +#define REG_GPIOPUPDCTR2 0x14 | ||
209 | +#define REG_GPIOPUPDCTR3 0x15 | ||
210 | +#define REG_GPIOPUPDCTR4 0x16 | ||
211 | +#define REG_GPIOPUPDCTR5 0x17 | ||
212 | +#define REG_GPIO_ISR1A 0x19 | ||
213 | +#define REG_GPIO_ISR2A 0x1A | ||
214 | +#define REG_GPIO_ISR3A 0x1B | ||
215 | +#define REG_GPIO_IMR1A 0x1C | ||
216 | +#define REG_GPIO_IMR2A 0x1D | ||
217 | +#define REG_GPIO_IMR3A 0x1E | ||
218 | +#define REG_GPIO_ISR1B 0x1F | ||
219 | +#define REG_GPIO_ISR2B 0x20 | ||
220 | +#define REG_GPIO_ISR3B 0x21 | ||
221 | +#define REG_GPIO_IMR1B 0x22 | ||
222 | +#define REG_GPIO_IMR2B 0x23 | ||
223 | +#define REG_GPIO_IMR3B 0x24 | ||
224 | +#define REG_GPIO_EDR1 0x28 | ||
225 | +#define REG_GPIO_EDR2 0x29 | ||
226 | +#define REG_GPIO_EDR3 0x2A | ||
227 | +#define REG_GPIO_EDR4 0x2B | ||
228 | +#define REG_GPIO_EDR5 0x2C | ||
229 | +#define REG_GPIO_SIH_CTRL 0x2D | ||
230 | + | ||
231 | +#endif /* End of __TWL4030_GPIO_H */ | ||
232 | diff --git a/include/linux/i2c/twl4030-pwrirq.h b/include/linux/i2c/twl4030-pwrirq.h | ||
233 | new file mode 100644 | ||
234 | index 0000000..7a13368 | ||
235 | --- /dev/null | ||
236 | +++ b/include/linux/i2c/twl4030-pwrirq.h | ||
237 | @@ -0,0 +1,37 @@ | ||
238 | +/* | ||
239 | + * twl4030-gpio.h - header for TWL4030 GPIO module | ||
240 | + * | ||
241 | + * Copyright (C) 2008 Texas Instruments, Inc. | ||
242 | + * Copyright (C) 2008 Nokia Corporation | ||
243 | + * | ||
244 | + * This program is free software; you can redistribute it and/or modify | ||
245 | + * it under the terms of the GNU General Public License as published by | ||
246 | + * the Free Software Foundation; either version 2 of the License, or | ||
247 | + * (at your option) any later version. | ||
248 | + * | ||
249 | + * This program is distributed in the hope that it will be useful, | ||
250 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
251 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
252 | + * GNU General Public License for more details. | ||
253 | + * | ||
254 | + * You should have received a copy of the GNU General Public License | ||
255 | + * along with this program; if not, write to the Free Software | ||
256 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
257 | + * | ||
258 | + */ | ||
259 | + | ||
260 | +#ifndef __TWL4030_PWRIRQ_H_ | ||
261 | +#define __TWL4030_PWRIRQ_H_ | ||
262 | + | ||
263 | +/* | ||
264 | + * INT Module Register definitions | ||
265 | + * (not all registers are defined below) | ||
266 | + */ | ||
267 | + | ||
268 | +#define TWL4030_INT_PWR_ISR1 0x0 | ||
269 | +#define TWL4030_INT_PWR_IMR1 0x1 | ||
270 | +#define TWL4030_INT_PWR_ISR2 0x2 | ||
271 | +#define TWL4030_INT_PWR_IMR2 0x3 | ||
272 | +#define TWL4030_INT_PWR_SIH_CTRL 0x7 | ||
273 | + | ||
274 | +#endif /* End of __TWL4030_PWRIRQ_H */ | ||