2 X-Mozilla-Status2: 00000000
3 Return-Path: <linux-omap-owner@vger.kernel.org>
4 X-Spam-Checker-Version: SpamAssassin 3.2.2 (2007-07-23) on
7 X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,DKIM_POLICY_SIGNSOME,
8 DK_POLICY_SIGNSOME,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.2
9 Delivered-To: balister.org-philip@balister.org
10 Received: (qmail 26193 invoked by uid 1003); 18 Jul 2008 01:35:31 -0000
11 Received: from vger.kernel.org (209.132.176.167)
12 by mail.geekisp.com with SMTP; 18 Jul 2008 01:35:31 -0000
13 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
14 id S1752321AbYGRBfb (ORCPT <rfc822;philip@balister.org>);
15 Thu, 17 Jul 2008 21:35:31 -0400
16 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756854AbYGRBfb
17 (ORCPT <rfc822;linux-omap-outgoing>);
18 Thu, 17 Jul 2008 21:35:31 -0400
19 Received: from utopia.booyaka.com ([72.9.107.138]:49367 "EHLO
20 utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
21 with ESMTP id S1756351AbYGRBfZ (ORCPT
22 <rfc822;linux-omap@vger.kernel.org>); Thu, 17 Jul 2008 21:35:25 -0400
23 Received: (qmail 13892 invoked by uid 526); 18 Jul 2008 01:35:23 -0000
24 MBOX-Line: From nobody Thu Jul 17 19:34:54 2008
25 From: Paul Walmsley <paul@pwsan.com>
26 Subject: [PATCH 7/9] TWL4030: move TWL module register defs into separate
28 To: linux-omap@vger.kernel.org
29 Date: Thu, 17 Jul 2008 19:34:54 -0600
30 Message-ID: <20080718013453.18943.69329.stgit@localhost.localdomain>
31 In-Reply-To: <20080718013205.18943.34047.stgit@localhost.localdomain>
32 References: <20080718013205.18943.34047.stgit@localhost.localdomain>
33 User-Agent: StGIT/0.14.3.163.g06f9
35 Content-Type: text/plain; charset="utf-8"
36 Content-Transfer-Encoding: 7bit
37 Sender: linux-omap-owner@vger.kernel.org
39 List-ID: <linux-omap.vger.kernel.org>
40 X-Mailing-List: linux-omap@vger.kernel.org
42 twl_init_irq() accesses TWL module IMR and ISR registers. Currently, it
43 uses "magic numbers" for these register indices, but symbolic constants
44 are definitely preferred. Rather than duplicating already existing
45 symbolic constants in twl4030-gpio.c and twl4030-pwrirq.c, move the
46 existing constants out into include files. This patch should not change
49 Signed-off-by: Paul Walmsley <paul@pwsan.com>
52 drivers/i2c/chips/twl4030-gpio.c | 48 -----------------------
53 drivers/i2c/chips/twl4030-pwrirq.c | 15 +++----
54 include/linux/i2c/twl4030-gpio.h | 76 ++++++++++++++++++++++++++++++++++++
55 include/linux/i2c/twl4030-pwrirq.h | 37 ++++++++++++++++++
56 4 files changed, 121 insertions(+), 55 deletions(-)
57 create mode 100644 include/linux/i2c/twl4030-gpio.h
58 create mode 100644 include/linux/i2c/twl4030-pwrirq.h
60 diff --git a/drivers/i2c/chips/twl4030-gpio.c b/drivers/i2c/chips/twl4030-gpio.c
61 index f16a48b..9d17f45 100644
62 --- a/drivers/i2c/chips/twl4030-gpio.c
63 +++ b/drivers/i2c/chips/twl4030-gpio.c
66 #include <linux/i2c.h>
67 #include <linux/i2c/twl4030.h>
68 +#include <linux/i2c/twl4030-gpio.h>
69 #include <linux/slab.h>
71 #include <asm/arch/irqs.h>
74 #include <linux/device.h>
77 - * GPIO Block Register definitions
80 -#define REG_GPIODATAIN1 0x0
81 -#define REG_GPIODATAIN2 0x1
82 -#define REG_GPIODATAIN3 0x2
83 -#define REG_GPIODATADIR1 0x3
84 -#define REG_GPIODATADIR2 0x4
85 -#define REG_GPIODATADIR3 0x5
86 -#define REG_GPIODATAOUT1 0x6
87 -#define REG_GPIODATAOUT2 0x7
88 -#define REG_GPIODATAOUT3 0x8
89 -#define REG_CLEARGPIODATAOUT1 0x9
90 -#define REG_CLEARGPIODATAOUT2 0xA
91 -#define REG_CLEARGPIODATAOUT3 0xB
92 -#define REG_SETGPIODATAOUT1 0xC
93 -#define REG_SETGPIODATAOUT2 0xD
94 -#define REG_SETGPIODATAOUT3 0xE
95 -#define REG_GPIO_DEBEN1 0xF
96 -#define REG_GPIO_DEBEN2 0x10
97 -#define REG_GPIO_DEBEN3 0x11
98 -#define REG_GPIO_CTRL 0x12
99 -#define REG_GPIOPUPDCTR1 0x13
100 -#define REG_GPIOPUPDCTR2 0x14
101 -#define REG_GPIOPUPDCTR3 0x15
102 -#define REG_GPIOPUPDCTR4 0x16
103 -#define REG_GPIOPUPDCTR5 0x17
104 -#define REG_GPIO_ISR1A 0x19
105 -#define REG_GPIO_ISR2A 0x1A
106 -#define REG_GPIO_ISR3A 0x1B
107 -#define REG_GPIO_IMR1A 0x1C
108 -#define REG_GPIO_IMR2A 0x1D
109 -#define REG_GPIO_IMR3A 0x1E
110 -#define REG_GPIO_ISR1B 0x1F
111 -#define REG_GPIO_ISR2B 0x20
112 -#define REG_GPIO_ISR3B 0x21
113 -#define REG_GPIO_IMR1B 0x22
114 -#define REG_GPIO_IMR2B 0x23
115 -#define REG_GPIO_IMR3B 0x24
116 -#define REG_GPIO_EDR1 0x28
117 -#define REG_GPIO_EDR2 0x29
118 -#define REG_GPIO_EDR3 0x2A
119 -#define REG_GPIO_EDR4 0x2B
120 -#define REG_GPIO_EDR5 0x2C
121 -#define REG_GPIO_SIH_CTRL 0x2D
123 /* BitField Definitions */
125 /* Data banks : 3 banks for 8 gpios each */
126 diff --git a/drivers/i2c/chips/twl4030-pwrirq.c b/drivers/i2c/chips/twl4030-pwrirq.c
127 index a4d2e92..1afdb65 100644
128 --- a/drivers/i2c/chips/twl4030-pwrirq.c
129 +++ b/drivers/i2c/chips/twl4030-pwrirq.c
131 #include <linux/random.h>
132 #include <linux/kthread.h>
133 #include <linux/i2c/twl4030.h>
134 +#include <linux/i2c/twl4030-pwrirq.h>
138 -#define PWR_SIH_CTRL 7
139 #define PWR_SIH_CTRL_COR (1<<2)
141 static u8 twl4030_pwrirq_mask;
142 @@ -93,7 +91,8 @@ static void do_twl4030_pwrmodule_irq(unsigned int irq, irq_desc_t *desc)
143 twl4030_pwrirq_mask |= 1 << (irq - TWL4030_PWR_IRQ_BASE);
145 twl4030_i2c_write_u8(TWL4030_MODULE_INT,
146 - twl4030_pwrirq_mask, PWR_IMR1);
147 + twl4030_pwrirq_mask,
148 + TWL4030_INT_PWR_IMR1);
152 @@ -115,7 +114,7 @@ static void do_twl4030_pwrirq(unsigned int irq, irq_desc_t *desc)
155 ret = twl4030_i2c_read_u8(TWL4030_MODULE_INT, &pwr_isr,
157 + TWL4030_INT_PWR_ISR1);
160 "I2C error %d while reading TWL4030"
161 @@ -151,7 +150,7 @@ static int twl4030_pwrirq_thread(void *data)
162 twl4030_pwrirq_mask &= ~local_unmask;
164 twl4030_i2c_write_u8(TWL4030_MODULE_INT, twl4030_pwrirq_mask,
166 + TWL4030_INT_PWR_IMR1);
169 if (!twl4030_pwrirq_pending_unmask)
170 @@ -172,14 +171,14 @@ static int __init twl4030_pwrirq_init(void)
171 twl4030_pwrirq_pending_unmask = 0;
173 err = twl4030_i2c_write_u8(TWL4030_MODULE_INT, twl4030_pwrirq_mask,
175 + TWL4030_INT_PWR_IMR1);
179 /* Enable clear on read */
181 err = twl4030_i2c_write_u8(TWL4030_MODULE_INT, PWR_SIH_CTRL_COR,
183 + TWL4030_INT_PWR_SIH_CTRL);
187 diff --git a/include/linux/i2c/twl4030-gpio.h b/include/linux/i2c/twl4030-gpio.h
189 index 0000000..7cbf610
191 +++ b/include/linux/i2c/twl4030-gpio.h
194 + * twl4030-gpio.h - header for TWL4030 GPIO module
196 + * Copyright (C) 2005-2006, 2008 Texas Instruments, Inc.
197 + * Copyright (C) 2008 Nokia Corporation
199 + * Based on tlv320aic23.c:
200 + * Copyright (c) by Kai Svahn <kai.svahn@nokia.com>
202 + * This program is free software; you can redistribute it and/or modify
203 + * it under the terms of the GNU General Public License as published by
204 + * the Free Software Foundation; either version 2 of the License, or
205 + * (at your option) any later version.
207 + * This program is distributed in the hope that it will be useful,
208 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
209 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
210 + * GNU General Public License for more details.
212 + * You should have received a copy of the GNU General Public License
213 + * along with this program; if not, write to the Free Software
214 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
218 +#ifndef __TWL4030_GPIO_H_
219 +#define __TWL4030_GPIO_H_
222 + * GPIO Block Register definitions
225 +#define REG_GPIODATAIN1 0x0
226 +#define REG_GPIODATAIN2 0x1
227 +#define REG_GPIODATAIN3 0x2
228 +#define REG_GPIODATADIR1 0x3
229 +#define REG_GPIODATADIR2 0x4
230 +#define REG_GPIODATADIR3 0x5
231 +#define REG_GPIODATAOUT1 0x6
232 +#define REG_GPIODATAOUT2 0x7
233 +#define REG_GPIODATAOUT3 0x8
234 +#define REG_CLEARGPIODATAOUT1 0x9
235 +#define REG_CLEARGPIODATAOUT2 0xA
236 +#define REG_CLEARGPIODATAOUT3 0xB
237 +#define REG_SETGPIODATAOUT1 0xC
238 +#define REG_SETGPIODATAOUT2 0xD
239 +#define REG_SETGPIODATAOUT3 0xE
240 +#define REG_GPIO_DEBEN1 0xF
241 +#define REG_GPIO_DEBEN2 0x10
242 +#define REG_GPIO_DEBEN3 0x11
243 +#define REG_GPIO_CTRL 0x12
244 +#define REG_GPIOPUPDCTR1 0x13
245 +#define REG_GPIOPUPDCTR2 0x14
246 +#define REG_GPIOPUPDCTR3 0x15
247 +#define REG_GPIOPUPDCTR4 0x16
248 +#define REG_GPIOPUPDCTR5 0x17
249 +#define REG_GPIO_ISR1A 0x19
250 +#define REG_GPIO_ISR2A 0x1A
251 +#define REG_GPIO_ISR3A 0x1B
252 +#define REG_GPIO_IMR1A 0x1C
253 +#define REG_GPIO_IMR2A 0x1D
254 +#define REG_GPIO_IMR3A 0x1E
255 +#define REG_GPIO_ISR1B 0x1F
256 +#define REG_GPIO_ISR2B 0x20
257 +#define REG_GPIO_ISR3B 0x21
258 +#define REG_GPIO_IMR1B 0x22
259 +#define REG_GPIO_IMR2B 0x23
260 +#define REG_GPIO_IMR3B 0x24
261 +#define REG_GPIO_EDR1 0x28
262 +#define REG_GPIO_EDR2 0x29
263 +#define REG_GPIO_EDR3 0x2A
264 +#define REG_GPIO_EDR4 0x2B
265 +#define REG_GPIO_EDR5 0x2C
266 +#define REG_GPIO_SIH_CTRL 0x2D
268 +#endif /* End of __TWL4030_GPIO_H */
269 diff --git a/include/linux/i2c/twl4030-pwrirq.h b/include/linux/i2c/twl4030-pwrirq.h
271 index 0000000..7a13368
273 +++ b/include/linux/i2c/twl4030-pwrirq.h
276 + * twl4030-gpio.h - header for TWL4030 GPIO module
278 + * Copyright (C) 2008 Texas Instruments, Inc.
279 + * Copyright (C) 2008 Nokia Corporation
281 + * This program is free software; you can redistribute it and/or modify
282 + * it under the terms of the GNU General Public License as published by
283 + * the Free Software Foundation; either version 2 of the License, or
284 + * (at your option) any later version.
286 + * This program is distributed in the hope that it will be useful,
287 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
288 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
289 + * GNU General Public License for more details.
291 + * You should have received a copy of the GNU General Public License
292 + * along with this program; if not, write to the Free Software
293 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
297 +#ifndef __TWL4030_PWRIRQ_H_
298 +#define __TWL4030_PWRIRQ_H_
301 + * INT Module Register definitions
302 + * (not all registers are defined below)
305 +#define TWL4030_INT_PWR_ISR1 0x0
306 +#define TWL4030_INT_PWR_IMR1 0x1
307 +#define TWL4030_INT_PWR_ISR2 0x2
308 +#define TWL4030_INT_PWR_IMR2 0x3
309 +#define TWL4030_INT_PWR_SIH_CTRL 0x7
311 +#endif /* End of __TWL4030_PWRIRQ_H */
315 To unsubscribe from this list: send the line "unsubscribe linux-omap" in
316 the body of a message to majordomo@vger.kernel.org
317 More majordomo info at http://vger.kernel.org/majordomo-info.html