blob: 14e83d0aac8c8fcc94372710f53067bd5a4ddad9 [file] [log] [blame]
Russell Kingb652b432005-06-15 12:38:14 +01001/*
2 * i2c_adap_pxa.c
3 *
4 * I2C adapter for the PXA I2C bus access.
5 *
6 * Copyright (C) 2002 Intrinsyc Software Inc.
7 * Copyright (C) 2004-2005 Deep Blue Solutions Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * History:
14 * Apr 2002: Initial version [CS]
15 * Jun 2002: Properly seperated algo/adap [FB]
16 * Jan 2003: Fixed several bugs concerning interrupt handling [Kai-Uwe Bloem]
17 * Jan 2003: added limited signal handling [Kai-Uwe Bloem]
18 * Sep 2004: Major rework to ensure efficient bus handling [RMK]
19 * Dec 2004: Added support for PXA27x and slave device probing [Liam Girdwood]
20 * Feb 2005: Rework slave mode handling [RMK]
21 */
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/i2c.h>
25#include <linux/i2c-id.h>
26#include <linux/init.h>
27#include <linux/time.h>
28#include <linux/sched.h>
29#include <linux/delay.h>
30#include <linux/errno.h>
31#include <linux/interrupt.h>
32#include <linux/i2c-pxa.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010033#include <linux/platform_device.h>
Russell Kingb652b432005-06-15 12:38:14 +010034
35#include <asm/hardware.h>
36#include <asm/irq.h>
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +010037#include <asm/io.h>
Russell Kingb652b432005-06-15 12:38:14 +010038#include <asm/arch/i2c.h>
39#include <asm/arch/pxa-regs.h>
40
41struct pxa_i2c {
42 spinlock_t lock;
43 wait_queue_head_t wait;
44 struct i2c_msg *msg;
45 unsigned int msg_num;
46 unsigned int msg_idx;
47 unsigned int msg_ptr;
48 unsigned int slave_addr;
49
50 struct i2c_adapter adap;
51#ifdef CONFIG_I2C_PXA_SLAVE
52 struct i2c_slave_client *slave;
53#endif
54
55 unsigned int irqlogidx;
56 u32 isrlog[32];
57 u32 icrlog[32];
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +010058
59 void __iomem *reg_base;
60
61 unsigned long iobase;
62 unsigned long iosize;
63
64 int irq;
Russell Kingb652b432005-06-15 12:38:14 +010065};
66
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +010067#define _IBMR(i2c) ((i2c)->reg_base + 0)
68#define _IDBR(i2c) ((i2c)->reg_base + 8)
69#define _ICR(i2c) ((i2c)->reg_base + 0x10)
70#define _ISR(i2c) ((i2c)->reg_base + 0x18)
71#define _ISAR(i2c) ((i2c)->reg_base + 0x20)
72
Russell Kingb652b432005-06-15 12:38:14 +010073/*
74 * I2C Slave mode address
75 */
76#define I2C_PXA_SLAVE_ADDR 0x1
77
Russell Kingb652b432005-06-15 12:38:14 +010078#ifdef DEBUG
79
80struct bits {
81 u32 mask;
82 const char *set;
83 const char *unset;
84};
85#define BIT(m, s, u) { .mask = m, .set = s, .unset = u }
86
87static inline void
88decode_bits(const char *prefix, const struct bits *bits, int num, u32 val)
89{
90 printk("%s %08x: ", prefix, val);
91 while (num--) {
92 const char *str = val & bits->mask ? bits->set : bits->unset;
93 if (str)
94 printk("%s ", str);
95 bits++;
96 }
97}
98
99static const struct bits isr_bits[] = {
100 BIT(ISR_RWM, "RX", "TX"),
101 BIT(ISR_ACKNAK, "NAK", "ACK"),
102 BIT(ISR_UB, "Bsy", "Rdy"),
103 BIT(ISR_IBB, "BusBsy", "BusRdy"),
104 BIT(ISR_SSD, "SlaveStop", NULL),
105 BIT(ISR_ALD, "ALD", NULL),
106 BIT(ISR_ITE, "TxEmpty", NULL),
107 BIT(ISR_IRF, "RxFull", NULL),
108 BIT(ISR_GCAD, "GenCall", NULL),
109 BIT(ISR_SAD, "SlaveAddr", NULL),
110 BIT(ISR_BED, "BusErr", NULL),
111};
112
113static void decode_ISR(unsigned int val)
114{
Russell King6fd60fa2005-09-08 21:04:58 +0100115 decode_bits(KERN_DEBUG "ISR", isr_bits, ARRAY_SIZE(isr_bits), val);
Russell Kingb652b432005-06-15 12:38:14 +0100116 printk("\n");
117}
118
119static const struct bits icr_bits[] = {
120 BIT(ICR_START, "START", NULL),
121 BIT(ICR_STOP, "STOP", NULL),
122 BIT(ICR_ACKNAK, "ACKNAK", NULL),
123 BIT(ICR_TB, "TB", NULL),
124 BIT(ICR_MA, "MA", NULL),
125 BIT(ICR_SCLE, "SCLE", "scle"),
126 BIT(ICR_IUE, "IUE", "iue"),
127 BIT(ICR_GCD, "GCD", NULL),
128 BIT(ICR_ITEIE, "ITEIE", NULL),
129 BIT(ICR_IRFIE, "IRFIE", NULL),
130 BIT(ICR_BEIE, "BEIE", NULL),
131 BIT(ICR_SSDIE, "SSDIE", NULL),
132 BIT(ICR_ALDIE, "ALDIE", NULL),
133 BIT(ICR_SADIE, "SADIE", NULL),
134 BIT(ICR_UR, "UR", "ur"),
135};
136
137static void decode_ICR(unsigned int val)
138{
Russell King6fd60fa2005-09-08 21:04:58 +0100139 decode_bits(KERN_DEBUG "ICR", icr_bits, ARRAY_SIZE(icr_bits), val);
Russell Kingb652b432005-06-15 12:38:14 +0100140 printk("\n");
141}
142
143static unsigned int i2c_debug = DEBUG;
144
145static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname)
146{
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100147 dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno,
148 readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c)));
Russell Kingb652b432005-06-15 12:38:14 +0100149}
150
151#define show_state(i2c) i2c_pxa_show_state(i2c, __LINE__, __FUNCTION__)
152#else
153#define i2c_debug 0
154
155#define show_state(i2c) do { } while (0)
156#define decode_ISR(val) do { } while (0)
157#define decode_ICR(val) do { } while (0)
158#endif
159
Russell King6fd60fa2005-09-08 21:04:58 +0100160#define eedbg(lvl, x...) do { if ((lvl) < 1) { printk(KERN_DEBUG "" x); } } while(0)
Russell Kingb652b432005-06-15 12:38:14 +0100161
162static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret);
163
164static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
165{
166 unsigned int i;
167 printk("i2c: error: %s\n", why);
168 printk("i2c: msg_num: %d msg_idx: %d msg_ptr: %d\n",
169 i2c->msg_num, i2c->msg_idx, i2c->msg_ptr);
Russell King6fd60fa2005-09-08 21:04:58 +0100170 printk("i2c: ICR: %08x ISR: %08x\n"
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100171 "i2c: log: ", readl(_ICR(i2c)), readl(_ISR(i2c)));
Russell Kingb652b432005-06-15 12:38:14 +0100172 for (i = 0; i < i2c->irqlogidx; i++)
173 printk("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
174 printk("\n");
175}
176
177static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c)
178{
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100179 return !(readl(_ICR(i2c)) & ICR_SCLE);
Russell Kingb652b432005-06-15 12:38:14 +0100180}
181
182static void i2c_pxa_abort(struct pxa_i2c *i2c)
183{
184 unsigned long timeout = jiffies + HZ/4;
185
186 if (i2c_pxa_is_slavemode(i2c)) {
Russell King6fd60fa2005-09-08 21:04:58 +0100187 dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100188 return;
189 }
190
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100191 while (time_before(jiffies, timeout) && (readl(_IBMR(i2c)) & 0x1) == 0) {
192 unsigned long icr = readl(_ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100193
194 icr &= ~ICR_START;
195 icr |= ICR_ACKNAK | ICR_STOP | ICR_TB;
196
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100197 writel(icr, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100198
199 show_state(i2c);
200
201 msleep(1);
202 }
203
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100204 writel(readl(_ICR(i2c)) & ~(ICR_MA | ICR_START | ICR_STOP),
205 _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100206}
207
208static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
209{
210 int timeout = DEF_TIMEOUT;
211
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100212 while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB)) {
213 if ((readl(_ISR(i2c)) & ISR_SAD) != 0)
Russell Kingb652b432005-06-15 12:38:14 +0100214 timeout += 4;
215
216 msleep(2);
217 show_state(i2c);
218 }
219
220 if (timeout <= 0)
221 show_state(i2c);
222
223 return timeout <= 0 ? I2C_RETRY : 0;
224}
225
226static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
227{
228 unsigned long timeout = jiffies + HZ*4;
229
230 while (time_before(jiffies, timeout)) {
231 if (i2c_debug > 1)
Russell King6fd60fa2005-09-08 21:04:58 +0100232 dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100233 __func__, (long)jiffies, readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c)));
Russell Kingb652b432005-06-15 12:38:14 +0100234
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100235 if (readl(_ISR(i2c)) & ISR_SAD) {
Russell Kingb652b432005-06-15 12:38:14 +0100236 if (i2c_debug > 0)
Russell King6fd60fa2005-09-08 21:04:58 +0100237 dev_dbg(&i2c->adap.dev, "%s: Slave detected\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100238 goto out;
239 }
240
241 /* wait for unit and bus being not busy, and we also do a
242 * quick check of the i2c lines themselves to ensure they've
243 * gone high...
244 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100245 if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) == 0 && readl(_IBMR(i2c)) == 3) {
Russell Kingb652b432005-06-15 12:38:14 +0100246 if (i2c_debug > 0)
Russell King6fd60fa2005-09-08 21:04:58 +0100247 dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100248 return 1;
249 }
250
251 msleep(1);
252 }
253
254 if (i2c_debug > 0)
Russell King6fd60fa2005-09-08 21:04:58 +0100255 dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100256 out:
257 return 0;
258}
259
260static int i2c_pxa_set_master(struct pxa_i2c *i2c)
261{
262 if (i2c_debug)
Russell King6fd60fa2005-09-08 21:04:58 +0100263 dev_dbg(&i2c->adap.dev, "setting to bus master\n");
Russell Kingb652b432005-06-15 12:38:14 +0100264
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100265 if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) != 0) {
Russell King6fd60fa2005-09-08 21:04:58 +0100266 dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100267 if (!i2c_pxa_wait_master(i2c)) {
Russell King6fd60fa2005-09-08 21:04:58 +0100268 dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100269 return I2C_RETRY;
270 }
271 }
272
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100273 writel(readl(_ICR(i2c)) | ICR_SCLE, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100274 return 0;
275}
276
277#ifdef CONFIG_I2C_PXA_SLAVE
278static int i2c_pxa_wait_slave(struct pxa_i2c *i2c)
279{
280 unsigned long timeout = jiffies + HZ*1;
281
282 /* wait for stop */
283
284 show_state(i2c);
285
286 while (time_before(jiffies, timeout)) {
287 if (i2c_debug > 1)
Russell King6fd60fa2005-09-08 21:04:58 +0100288 dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100289 __func__, (long)jiffies, readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c)));
Russell Kingb652b432005-06-15 12:38:14 +0100290
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100291 if ((readl(_ISR(i2c)) & (ISR_UB|ISR_IBB)) == 0 ||
292 (readl(_ISR(i2c)) & ISR_SAD) != 0 ||
293 (readl(_ICR(i2c)) & ICR_SCLE) == 0) {
Russell Kingb652b432005-06-15 12:38:14 +0100294 if (i2c_debug > 1)
Russell King6fd60fa2005-09-08 21:04:58 +0100295 dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100296 return 1;
297 }
298
299 msleep(1);
300 }
301
302 if (i2c_debug > 0)
Russell King6fd60fa2005-09-08 21:04:58 +0100303 dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100304 return 0;
305}
306
307/*
308 * clear the hold on the bus, and take of anything else
309 * that has been configured
310 */
311static void i2c_pxa_set_slave(struct pxa_i2c *i2c, int errcode)
312{
313 show_state(i2c);
314
315 if (errcode < 0) {
316 udelay(100); /* simple delay */
317 } else {
318 /* we need to wait for the stop condition to end */
319
320 /* if we where in stop, then clear... */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100321 if (readl(_ICR(i2c)) & ICR_STOP) {
Russell Kingb652b432005-06-15 12:38:14 +0100322 udelay(100);
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100323 writel(readl(_ICR(i2c)) & ~ICR_STOP, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100324 }
325
326 if (!i2c_pxa_wait_slave(i2c)) {
Russell King6fd60fa2005-09-08 21:04:58 +0100327 dev_err(&i2c->adap.dev, "%s: wait timedout\n",
328 __func__);
Russell Kingb652b432005-06-15 12:38:14 +0100329 return;
330 }
331 }
332
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100333 writel(readl(_ICR(i2c)) & ~(ICR_STOP|ICR_ACKNAK|ICR_MA), _ICR(i2c));
334 writel(readl(_ICR(i2c)) & ~ICR_SCLE, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100335
336 if (i2c_debug) {
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100337 dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", readl(_ICR(i2c)), readl(_ISR(i2c)));
338 decode_ICR(readl(_ICR(i2c)));
Russell Kingb652b432005-06-15 12:38:14 +0100339 }
340}
341#else
342#define i2c_pxa_set_slave(i2c, err) do { } while (0)
343#endif
344
345static void i2c_pxa_reset(struct pxa_i2c *i2c)
346{
347 pr_debug("Resetting I2C Controller Unit\n");
348
349 /* abort any transfer currently under way */
350 i2c_pxa_abort(i2c);
351
352 /* reset according to 9.8 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100353 writel(ICR_UR, _ICR(i2c));
354 writel(I2C_ISR_INIT, _ISR(i2c));
355 writel(readl(_ICR(i2c)) & ~ICR_UR, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100356
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100357 writel(i2c->slave_addr, _ISAR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100358
359 /* set control register values */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100360 writel(I2C_ICR_INIT, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100361
362#ifdef CONFIG_I2C_PXA_SLAVE
Russell King6fd60fa2005-09-08 21:04:58 +0100363 dev_info(&i2c->adap.dev, "Enabling slave mode\n");
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100364 writel(readl(_ICR(i2c)) | ICR_SADIE | ICR_ALDIE | ICR_SSDIE, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100365#endif
366
367 i2c_pxa_set_slave(i2c, 0);
368
369 /* enable unit */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100370 writel(readl(_ICR(i2c)) | ICR_IUE, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100371 udelay(100);
372}
373
374
375#ifdef CONFIG_I2C_PXA_SLAVE
376/*
Russell Kingb652b432005-06-15 12:38:14 +0100377 * PXA I2C Slave mode
378 */
379
380static void i2c_pxa_slave_txempty(struct pxa_i2c *i2c, u32 isr)
381{
382 if (isr & ISR_BED) {
383 /* what should we do here? */
384 } else {
Russell King84b5abe2006-10-28 22:30:17 +0100385 int ret = 0;
386
387 if (i2c->slave != NULL)
388 ret = i2c->slave->read(i2c->slave->data);
Russell Kingb652b432005-06-15 12:38:14 +0100389
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100390 writel(ret, _IDBR(i2c));
391 writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c)); /* allow next byte */
Russell Kingb652b432005-06-15 12:38:14 +0100392 }
393}
394
395static void i2c_pxa_slave_rxfull(struct pxa_i2c *i2c, u32 isr)
396{
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100397 unsigned int byte = readl(_IDBR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100398
399 if (i2c->slave != NULL)
400 i2c->slave->write(i2c->slave->data, byte);
401
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100402 writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100403}
404
405static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr)
406{
407 int timeout;
408
409 if (i2c_debug > 0)
Russell King6fd60fa2005-09-08 21:04:58 +0100410 dev_dbg(&i2c->adap.dev, "SAD, mode is slave-%cx\n",
Russell Kingb652b432005-06-15 12:38:14 +0100411 (isr & ISR_RWM) ? 'r' : 't');
412
413 if (i2c->slave != NULL)
414 i2c->slave->event(i2c->slave->data,
415 (isr & ISR_RWM) ? I2C_SLAVE_EVENT_START_READ : I2C_SLAVE_EVENT_START_WRITE);
416
417 /*
418 * slave could interrupt in the middle of us generating a
419 * start condition... if this happens, we'd better back off
420 * and stop holding the poor thing up
421 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100422 writel(readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP), _ICR(i2c));
423 writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100424
425 timeout = 0x10000;
426
427 while (1) {
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100428 if ((readl(_IBMR(i2c)) & 2) == 2)
Russell Kingb652b432005-06-15 12:38:14 +0100429 break;
430
431 timeout--;
432
433 if (timeout <= 0) {
Russell King6fd60fa2005-09-08 21:04:58 +0100434 dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n");
Russell Kingb652b432005-06-15 12:38:14 +0100435 break;
436 }
437 }
438
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100439 writel(readl(_ICR(i2c)) & ~ICR_SCLE, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100440}
441
442static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
443{
444 if (i2c_debug > 2)
Russell King6fd60fa2005-09-08 21:04:58 +0100445 dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop)\n");
Russell Kingb652b432005-06-15 12:38:14 +0100446
447 if (i2c->slave != NULL)
448 i2c->slave->event(i2c->slave->data, I2C_SLAVE_EVENT_STOP);
449
450 if (i2c_debug > 2)
Russell King6fd60fa2005-09-08 21:04:58 +0100451 dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop) acked\n");
Russell Kingb652b432005-06-15 12:38:14 +0100452
453 /*
454 * If we have a master-mode message waiting,
455 * kick it off now that the slave has completed.
456 */
457 if (i2c->msg)
458 i2c_pxa_master_complete(i2c, I2C_RETRY);
459}
460#else
461static void i2c_pxa_slave_txempty(struct pxa_i2c *i2c, u32 isr)
462{
463 if (isr & ISR_BED) {
464 /* what should we do here? */
465 } else {
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100466 writel(0, _IDBR(i2c));
467 writel(readl(_ICR(i2c)) | ICR_TB, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100468 }
469}
470
471static void i2c_pxa_slave_rxfull(struct pxa_i2c *i2c, u32 isr)
472{
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100473 writel(readl(_ICR(i2c)) | ICR_TB | ICR_ACKNAK, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100474}
475
476static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr)
477{
478 int timeout;
479
480 /*
481 * slave could interrupt in the middle of us generating a
482 * start condition... if this happens, we'd better back off
483 * and stop holding the poor thing up
484 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100485 writel(readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP), _ICR(i2c));
486 writel(readl(_ICR(i2c)) | ICR_TB | ICR_ACKNAK, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100487
488 timeout = 0x10000;
489
490 while (1) {
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100491 if ((readl(_IBMR(i2c)) & 2) == 2)
Russell Kingb652b432005-06-15 12:38:14 +0100492 break;
493
494 timeout--;
495
496 if (timeout <= 0) {
Russell King6fd60fa2005-09-08 21:04:58 +0100497 dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n");
Russell Kingb652b432005-06-15 12:38:14 +0100498 break;
499 }
500 }
501
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100502 writel(readl(_ICR(i2c)) & ~ICR_SCLE, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100503}
504
505static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
506{
507 if (i2c->msg)
508 i2c_pxa_master_complete(i2c, I2C_RETRY);
509}
510#endif
511
512/*
513 * PXA I2C Master mode
514 */
515
516static inline unsigned int i2c_pxa_addr_byte(struct i2c_msg *msg)
517{
518 unsigned int addr = (msg->addr & 0x7f) << 1;
519
520 if (msg->flags & I2C_M_RD)
521 addr |= 1;
522
523 return addr;
524}
525
526static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
527{
528 u32 icr;
529
530 /*
531 * Step 1: target slave address into IDBR
532 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100533 writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100534
535 /*
536 * Step 2: initiate the write.
537 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100538 icr = readl(_ICR(i2c)) & ~(ICR_STOP | ICR_ALDIE);
539 writel(icr | ICR_START | ICR_TB, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100540}
541
542/*
Jean Delvare3fb9a652006-01-18 23:17:01 +0100543 * We are protected by the adapter bus mutex.
Russell Kingb652b432005-06-15 12:38:14 +0100544 */
545static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
546{
547 long timeout;
548 int ret;
549
550 /*
551 * Wait for the bus to become free.
552 */
553 ret = i2c_pxa_wait_bus_not_busy(i2c);
554 if (ret) {
Russell King6fd60fa2005-09-08 21:04:58 +0100555 dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n");
Russell Kingb652b432005-06-15 12:38:14 +0100556 goto out;
557 }
558
559 /*
560 * Set master mode.
561 */
562 ret = i2c_pxa_set_master(i2c);
563 if (ret) {
Russell King6fd60fa2005-09-08 21:04:58 +0100564 dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret);
Russell Kingb652b432005-06-15 12:38:14 +0100565 goto out;
566 }
567
568 spin_lock_irq(&i2c->lock);
569
570 i2c->msg = msg;
571 i2c->msg_num = num;
572 i2c->msg_idx = 0;
573 i2c->msg_ptr = 0;
574 i2c->irqlogidx = 0;
575
576 i2c_pxa_start_message(i2c);
577
578 spin_unlock_irq(&i2c->lock);
579
580 /*
581 * The rest of the processing occurs in the interrupt handler.
582 */
583 timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
584
585 /*
586 * We place the return code in i2c->msg_idx.
587 */
588 ret = i2c->msg_idx;
589
590 if (timeout == 0)
591 i2c_pxa_scream_blue_murder(i2c, "timeout");
592
593 out:
594 return ret;
595}
596
597/*
598 * i2c_pxa_master_complete - complete the message and wake up.
599 */
600static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret)
601{
602 i2c->msg_ptr = 0;
603 i2c->msg = NULL;
604 i2c->msg_idx ++;
605 i2c->msg_num = 0;
606 if (ret)
607 i2c->msg_idx = ret;
608 wake_up(&i2c->wait);
609}
610
611static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
612{
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100613 u32 icr = readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB);
Russell Kingb652b432005-06-15 12:38:14 +0100614
615 again:
616 /*
617 * If ISR_ALD is set, we lost arbitration.
618 */
619 if (isr & ISR_ALD) {
620 /*
621 * Do we need to do anything here? The PXA docs
622 * are vague about what happens.
623 */
624 i2c_pxa_scream_blue_murder(i2c, "ALD set");
625
626 /*
627 * We ignore this error. We seem to see spurious ALDs
628 * for seemingly no reason. If we handle them as I think
629 * they should, we end up causing an I2C error, which
630 * is painful for some systems.
631 */
632 return; /* ignore */
633 }
634
635 if (isr & ISR_BED) {
636 int ret = BUS_ERROR;
637
638 /*
639 * I2C bus error - either the device NAK'd us, or
640 * something more serious happened. If we were NAK'd
641 * on the initial address phase, we can retry.
642 */
643 if (isr & ISR_ACKNAK) {
644 if (i2c->msg_ptr == 0 && i2c->msg_idx == 0)
645 ret = I2C_RETRY;
646 else
647 ret = XFER_NAKED;
648 }
649 i2c_pxa_master_complete(i2c, ret);
650 } else if (isr & ISR_RWM) {
651 /*
652 * Read mode. We have just sent the address byte, and
653 * now we must initiate the transfer.
654 */
655 if (i2c->msg_ptr == i2c->msg->len - 1 &&
656 i2c->msg_idx == i2c->msg_num - 1)
657 icr |= ICR_STOP | ICR_ACKNAK;
658
659 icr |= ICR_ALDIE | ICR_TB;
660 } else if (i2c->msg_ptr < i2c->msg->len) {
661 /*
662 * Write mode. Write the next data byte.
663 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100664 writel(i2c->msg->buf[i2c->msg_ptr++], _IDBR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100665
666 icr |= ICR_ALDIE | ICR_TB;
667
668 /*
669 * If this is the last byte of the last message, send
670 * a STOP.
671 */
672 if (i2c->msg_ptr == i2c->msg->len &&
673 i2c->msg_idx == i2c->msg_num - 1)
674 icr |= ICR_STOP;
675 } else if (i2c->msg_idx < i2c->msg_num - 1) {
676 /*
677 * Next segment of the message.
678 */
679 i2c->msg_ptr = 0;
680 i2c->msg_idx ++;
681 i2c->msg++;
682
683 /*
684 * If we aren't doing a repeated start and address,
685 * go back and try to send the next byte. Note that
686 * we do not support switching the R/W direction here.
687 */
688 if (i2c->msg->flags & I2C_M_NOSTART)
689 goto again;
690
691 /*
692 * Write the next address.
693 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100694 writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100695
696 /*
697 * And trigger a repeated start, and send the byte.
698 */
699 icr &= ~ICR_ALDIE;
700 icr |= ICR_START | ICR_TB;
701 } else {
702 if (i2c->msg->len == 0) {
703 /*
704 * Device probes have a message length of zero
705 * and need the bus to be reset before it can
706 * be used again.
707 */
708 i2c_pxa_reset(i2c);
709 }
710 i2c_pxa_master_complete(i2c, 0);
711 }
712
713 i2c->icrlog[i2c->irqlogidx-1] = icr;
714
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100715 writel(icr, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100716 show_state(i2c);
717}
718
719static void i2c_pxa_irq_rxfull(struct pxa_i2c *i2c, u32 isr)
720{
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100721 u32 icr = readl(_ICR(i2c)) & ~(ICR_START|ICR_STOP|ICR_ACKNAK|ICR_TB);
Russell Kingb652b432005-06-15 12:38:14 +0100722
723 /*
724 * Read the byte.
725 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100726 i2c->msg->buf[i2c->msg_ptr++] = readl(_IDBR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100727
728 if (i2c->msg_ptr < i2c->msg->len) {
729 /*
730 * If this is the last byte of the last
731 * message, send a STOP.
732 */
733 if (i2c->msg_ptr == i2c->msg->len - 1)
734 icr |= ICR_STOP | ICR_ACKNAK;
735
736 icr |= ICR_ALDIE | ICR_TB;
737 } else {
738 i2c_pxa_master_complete(i2c, 0);
739 }
740
741 i2c->icrlog[i2c->irqlogidx-1] = icr;
742
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100743 writel(icr, _ICR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100744}
745
David Howells7d12e782006-10-05 14:55:46 +0100746static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id)
Russell Kingb652b432005-06-15 12:38:14 +0100747{
748 struct pxa_i2c *i2c = dev_id;
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100749 u32 isr = readl(_ISR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100750
751 if (i2c_debug > 2 && 0) {
Russell King6fd60fa2005-09-08 21:04:58 +0100752 dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n",
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100753 __func__, isr, readl(_ICR(i2c)), readl(_IBMR(i2c)));
Russell Kingb652b432005-06-15 12:38:14 +0100754 decode_ISR(isr);
755 }
756
Tobias Klauser7e3d7db2006-01-09 23:19:51 +0100757 if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog))
Russell Kingb652b432005-06-15 12:38:14 +0100758 i2c->isrlog[i2c->irqlogidx++] = isr;
759
760 show_state(i2c);
761
762 /*
763 * Always clear all pending IRQs.
764 */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100765 writel(isr & (ISR_SSD|ISR_ALD|ISR_ITE|ISR_IRF|ISR_SAD|ISR_BED), _ISR(i2c));
Russell Kingb652b432005-06-15 12:38:14 +0100766
767 if (isr & ISR_SAD)
768 i2c_pxa_slave_start(i2c, isr);
769 if (isr & ISR_SSD)
770 i2c_pxa_slave_stop(i2c);
771
772 if (i2c_pxa_is_slavemode(i2c)) {
773 if (isr & ISR_ITE)
774 i2c_pxa_slave_txempty(i2c, isr);
775 if (isr & ISR_IRF)
776 i2c_pxa_slave_rxfull(i2c, isr);
777 } else if (i2c->msg) {
778 if (isr & ISR_ITE)
779 i2c_pxa_irq_txempty(i2c, isr);
780 if (isr & ISR_IRF)
781 i2c_pxa_irq_rxfull(i2c, isr);
782 } else {
783 i2c_pxa_scream_blue_murder(i2c, "spurious irq");
784 }
785
786 return IRQ_HANDLED;
787}
788
789
790static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
791{
792 struct pxa_i2c *i2c = adap->algo_data;
793 int ret, i;
794
Richard Purdieece5f7b2006-01-12 16:30:23 +0000795 /* If the I2C controller is disabled we need to reset it (probably due
796 to a suspend/resume destroying state). We do this here as we can then
797 avoid worrying about resuming the controller before its users. */
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100798 if (!(readl(_ICR(i2c)) & ICR_IUE))
Richard Purdieece5f7b2006-01-12 16:30:23 +0000799 i2c_pxa_reset(i2c);
800
Russell Kingb652b432005-06-15 12:38:14 +0100801 for (i = adap->retries; i >= 0; i--) {
802 ret = i2c_pxa_do_xfer(i2c, msgs, num);
803 if (ret != I2C_RETRY)
804 goto out;
805
806 if (i2c_debug)
Russell King6fd60fa2005-09-08 21:04:58 +0100807 dev_dbg(&adap->dev, "Retrying transmission\n");
Russell Kingb652b432005-06-15 12:38:14 +0100808 udelay(100);
809 }
810 i2c_pxa_scream_blue_murder(i2c, "exhausted retries");
811 ret = -EREMOTEIO;
812 out:
813 i2c_pxa_set_slave(i2c, ret);
814 return ret;
815}
816
Russell Kingda16e322005-09-14 22:54:45 +0100817static u32 i2c_pxa_functionality(struct i2c_adapter *adap)
818{
819 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
820}
821
Jean Delvare8f9082c2006-09-03 22:39:46 +0200822static const struct i2c_algorithm i2c_pxa_algorithm = {
Russell Kingb652b432005-06-15 12:38:14 +0100823 .master_xfer = i2c_pxa_xfer,
Russell Kingda16e322005-09-14 22:54:45 +0100824 .functionality = i2c_pxa_functionality,
Russell Kingb652b432005-06-15 12:38:14 +0100825};
826
827static struct pxa_i2c i2c_pxa = {
828 .lock = SPIN_LOCK_UNLOCKED,
Russell Kingb652b432005-06-15 12:38:14 +0100829 .adap = {
Russell Kingda16e322005-09-14 22:54:45 +0100830 .owner = THIS_MODULE,
Russell Kingb652b432005-06-15 12:38:14 +0100831 .algo = &i2c_pxa_algorithm,
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100832 .name = "pxa2xx-i2c.0",
Russell Kingb652b432005-06-15 12:38:14 +0100833 .retries = 5,
834 },
835};
836
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100837#define res_len(r) ((r)->end - (r)->start + 1)
Russell King3ae5eae2005-11-09 22:32:44 +0000838static int i2c_pxa_probe(struct platform_device *dev)
Russell Kingb652b432005-06-15 12:38:14 +0100839{
840 struct pxa_i2c *i2c = &i2c_pxa;
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100841 struct resource *res;
Richard Purdieece5f7b2006-01-12 16:30:23 +0000842#ifdef CONFIG_I2C_PXA_SLAVE
Russell King3ae5eae2005-11-09 22:32:44 +0000843 struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
Richard Purdieece5f7b2006-01-12 16:30:23 +0000844#endif
Russell Kingb652b432005-06-15 12:38:14 +0100845 int ret;
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100846 int irq;
Russell Kingb652b432005-06-15 12:38:14 +0100847
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100848 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
849 irq = platform_get_irq(dev, 0);
850 if (res == NULL || irq < 0)
851 return -ENODEV;
852
853 if (!request_mem_region(res->start, res_len(res), res->name))
854 return -ENOMEM;
855
856 i2c = kmalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
857 if (!i2c) {
858 ret = -ENOMEM;
859 goto emalloc;
860 }
861
862 memcpy(i2c, &i2c_pxa, sizeof(struct pxa_i2c));
863 init_waitqueue_head(&i2c->wait);
864 i2c->adap.name[strlen(i2c->adap.name) - 1] = '0' + dev->id % 10;
865
866 i2c->reg_base = ioremap(res->start, res_len(res));
867 if (!i2c->reg_base) {
868 ret = -EIO;
869 goto eremap;
870 }
871
872 i2c->iobase = res->start;
873 i2c->iosize = res_len(res);
874
875 i2c->irq = irq;
Russell Kingb652b432005-06-15 12:38:14 +0100876
877 i2c->slave_addr = I2C_PXA_SLAVE_ADDR;
878
879#ifdef CONFIG_I2C_PXA_SLAVE
Russell Kingb652b432005-06-15 12:38:14 +0100880 if (plat) {
881 i2c->slave_addr = plat->slave_addr;
Russell Kingbeea4942006-11-07 21:03:20 +0000882 i2c->slave = plat->slave;
Russell Kingb652b432005-06-15 12:38:14 +0100883 }
884#endif
885
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100886 switch (dev->id) {
887 case 0:
888#ifdef CONFIG_PXA27x
889 pxa_gpio_mode(GPIO117_I2CSCL_MD);
890 pxa_gpio_mode(GPIO118_I2CSDA_MD);
891#endif
892 pxa_set_cken(CKEN14_I2C, 1);
893 break;
894#ifdef CONFIG_PXA27x
895 case 1:
896 local_irq_disable();
897 PCFR |= PCFR_PI2CEN;
898 local_irq_enable();
899 pxa_set_cken(CKEN15_PWRI2C, 1);
900#endif
901 }
902
903 ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED,
904 i2c->adap.name, i2c);
Russell Kingb652b432005-06-15 12:38:14 +0100905 if (ret)
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100906 goto ereqirq;
907
Russell Kingb652b432005-06-15 12:38:14 +0100908
909 i2c_pxa_reset(i2c);
910
911 i2c->adap.algo_data = i2c;
Russell King3ae5eae2005-11-09 22:32:44 +0000912 i2c->adap.dev.parent = &dev->dev;
Russell Kingb652b432005-06-15 12:38:14 +0100913
914 ret = i2c_add_adapter(&i2c->adap);
915 if (ret < 0) {
916 printk(KERN_INFO "I2C: Failed to add bus\n");
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100917 goto eadapt;
Russell Kingb652b432005-06-15 12:38:14 +0100918 }
919
Russell King3ae5eae2005-11-09 22:32:44 +0000920 platform_set_drvdata(dev, i2c);
Russell Kingb652b432005-06-15 12:38:14 +0100921
922#ifdef CONFIG_I2C_PXA_SLAVE
923 printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
924 i2c->adap.dev.bus_id, i2c->slave_addr);
925#else
926 printk(KERN_INFO "I2C: %s: PXA I2C adapter\n",
927 i2c->adap.dev.bus_id);
928#endif
929 return 0;
930
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100931eadapt:
932 free_irq(irq, i2c);
933ereqirq:
934 switch (dev->id) {
935 case 0:
936 pxa_set_cken(CKEN14_I2C, 0);
937 break;
938#ifdef CONFIG_PXA27x
939 case 1:
940 pxa_set_cken(CKEN15_PWRI2C, 0);
941 local_irq_disable();
942 PCFR &= ~PCFR_PI2CEN;
943 local_irq_enable();
944#endif
945 }
946eremap:
947 kfree(i2c);
948emalloc:
949 release_mem_region(res->start, res_len(res));
Russell Kingb652b432005-06-15 12:38:14 +0100950 return ret;
951}
952
Russell King3ae5eae2005-11-09 22:32:44 +0000953static int i2c_pxa_remove(struct platform_device *dev)
Russell Kingb652b432005-06-15 12:38:14 +0100954{
Russell King3ae5eae2005-11-09 22:32:44 +0000955 struct pxa_i2c *i2c = platform_get_drvdata(dev);
Russell Kingb652b432005-06-15 12:38:14 +0100956
Russell King3ae5eae2005-11-09 22:32:44 +0000957 platform_set_drvdata(dev, NULL);
Russell Kingb652b432005-06-15 12:38:14 +0100958
959 i2c_del_adapter(&i2c->adap);
Guennadi Liakhovetskia7b4e552007-02-08 09:43:26 +0100960 free_irq(i2c->irq, i2c);
961 switch (dev->id) {
962 case 0:
963 pxa_set_cken(CKEN14_I2C, 0);
964 break;
965#ifdef CONFIG_PXA27x
966 case 1:
967 pxa_set_cken(CKEN15_PWRI2C, 0);
968 local_irq_disable();
969 PCFR &= ~PCFR_PI2CEN;
970 local_irq_enable();
971#endif
972 }
973 release_mem_region(i2c->iobase, i2c->iosize);
974 kfree(i2c);
Russell Kingb652b432005-06-15 12:38:14 +0100975
976 return 0;
977}
978
Russell King3ae5eae2005-11-09 22:32:44 +0000979static struct platform_driver i2c_pxa_driver = {
Russell Kingb652b432005-06-15 12:38:14 +0100980 .probe = i2c_pxa_probe,
981 .remove = i2c_pxa_remove,
Russell King3ae5eae2005-11-09 22:32:44 +0000982 .driver = {
983 .name = "pxa2xx-i2c",
984 },
Russell Kingb652b432005-06-15 12:38:14 +0100985};
986
987static int __init i2c_adap_pxa_init(void)
988{
Russell King3ae5eae2005-11-09 22:32:44 +0000989 return platform_driver_register(&i2c_pxa_driver);
Russell Kingb652b432005-06-15 12:38:14 +0100990}
991
992static void i2c_adap_pxa_exit(void)
993{
Russell King3ae5eae2005-11-09 22:32:44 +0000994 return platform_driver_unregister(&i2c_pxa_driver);
Russell Kingb652b432005-06-15 12:38:14 +0100995}
996
Richard Purdieece5f7b2006-01-12 16:30:23 +0000997MODULE_LICENSE("GPL");
998
Russell Kingb652b432005-06-15 12:38:14 +0100999module_init(i2c_adap_pxa_init);
1000module_exit(i2c_adap_pxa_exit);