2 * Blackfin On-Chip Two Wire Interface Driver
4 * Copyright 2005-2007 Analog Devices Inc.
6 * Enter bugs at http://blackfin.uclinux.org/
8 * Licensed under the GPL-2 or later.
11 #include <linux/module.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/i2c.h>
15 #include <linux/slab.h>
18 #include <linux/timer.h>
19 #include <linux/spinlock.h>
20 #include <linux/completion.h>
21 #include <linux/interrupt.h>
22 #include <linux/platform_device.h>
23 #include <linux/delay.h>
25 #include <asm/blackfin.h>
26 #include <asm/portmux.h>
28 #include <asm/bfin_twi.h>
31 #define TWI_I2C_MODE_STANDARD 1
32 #define TWI_I2C_MODE_STANDARDSUB 2
33 #define TWI_I2C_MODE_COMBINED 3
34 #define TWI_I2C_MODE_REPEAT 4
36 static void bfin_twi_handle_interrupt(struct bfin_twi_iface
*iface
,
37 unsigned short twi_int_status
)
39 unsigned short mast_stat
= read_MASTER_STAT(iface
);
41 if (twi_int_status
& XMTSERV
) {
42 /* Transmit next data */
43 if (iface
->writeNum
> 0) {
45 write_XMT_DATA8(iface
, *(iface
->transPtr
++));
48 /* start receive immediately after complete sending in
51 else if (iface
->cur_mode
== TWI_I2C_MODE_COMBINED
)
52 write_MASTER_CTL(iface
,
53 read_MASTER_CTL(iface
) | MDIR
);
54 else if (iface
->manual_stop
)
55 write_MASTER_CTL(iface
,
56 read_MASTER_CTL(iface
) | STOP
);
57 else if (iface
->cur_mode
== TWI_I2C_MODE_REPEAT
&&
58 iface
->cur_msg
+ 1 < iface
->msg_num
) {
59 if (iface
->pmsg
[iface
->cur_msg
+ 1].flags
& I2C_M_RD
)
60 write_MASTER_CTL(iface
,
61 read_MASTER_CTL(iface
) | MDIR
);
63 write_MASTER_CTL(iface
,
64 read_MASTER_CTL(iface
) & ~MDIR
);
67 if (twi_int_status
& RCVSERV
) {
68 if (iface
->readNum
> 0) {
69 /* Receive next data */
70 *(iface
->transPtr
) = read_RCV_DATA8(iface
);
71 if (iface
->cur_mode
== TWI_I2C_MODE_COMBINED
) {
72 /* Change combine mode into sub mode after
75 iface
->cur_mode
= TWI_I2C_MODE_STANDARDSUB
;
76 /* Get read number from first byte in block
79 if (iface
->readNum
== 1 && iface
->manual_stop
)
80 iface
->readNum
= *iface
->transPtr
+ 1;
86 if (iface
->readNum
== 0) {
87 if (iface
->manual_stop
) {
88 /* Temporary workaround to avoid possible bus stall -
89 * Flush FIFO before issuing the STOP condition
91 read_RCV_DATA16(iface
);
92 write_MASTER_CTL(iface
,
93 read_MASTER_CTL(iface
) | STOP
);
94 } else if (iface
->cur_mode
== TWI_I2C_MODE_REPEAT
&&
95 iface
->cur_msg
+ 1 < iface
->msg_num
) {
96 if (iface
->pmsg
[iface
->cur_msg
+ 1].flags
& I2C_M_RD
)
97 write_MASTER_CTL(iface
,
98 read_MASTER_CTL(iface
) | MDIR
);
100 write_MASTER_CTL(iface
,
101 read_MASTER_CTL(iface
) & ~MDIR
);
105 if (twi_int_status
& MERR
) {
106 write_INT_MASK(iface
, 0);
107 write_MASTER_STAT(iface
, 0x3e);
108 write_MASTER_CTL(iface
, 0);
109 iface
->result
= -EIO
;
111 if (mast_stat
& LOSTARB
)
112 dev_dbg(&iface
->adap
.dev
, "Lost Arbitration\n");
113 if (mast_stat
& ANAK
)
114 dev_dbg(&iface
->adap
.dev
, "Address Not Acknowledged\n");
115 if (mast_stat
& DNAK
)
116 dev_dbg(&iface
->adap
.dev
, "Data Not Acknowledged\n");
117 if (mast_stat
& BUFRDERR
)
118 dev_dbg(&iface
->adap
.dev
, "Buffer Read Error\n");
119 if (mast_stat
& BUFWRERR
)
120 dev_dbg(&iface
->adap
.dev
, "Buffer Write Error\n");
122 /* Faulty slave devices, may drive SDA low after a transfer
123 * finishes. To release the bus this code generates up to 9
124 * extra clocks until SDA is released.
127 if (read_MASTER_STAT(iface
) & SDASEN
) {
130 write_MASTER_CTL(iface
, SCLOVR
);
132 write_MASTER_CTL(iface
, 0);
134 } while ((read_MASTER_STAT(iface
) & SDASEN
) && cnt
--);
136 write_MASTER_CTL(iface
, SDAOVR
| SCLOVR
);
138 write_MASTER_CTL(iface
, SDAOVR
);
140 write_MASTER_CTL(iface
, 0);
143 /* If it is a quick transfer, only address without data,
144 * not an err, return 1.
146 if (iface
->cur_mode
== TWI_I2C_MODE_STANDARD
&&
147 iface
->transPtr
== NULL
&&
148 (twi_int_status
& MCOMP
) && (mast_stat
& DNAK
))
151 complete(&iface
->complete
);
154 if (twi_int_status
& MCOMP
) {
155 if (twi_int_status
& (XMTSERV
| RCVSERV
) &&
156 (read_MASTER_CTL(iface
) & MEN
) == 0 &&
157 (iface
->cur_mode
== TWI_I2C_MODE_REPEAT
||
158 iface
->cur_mode
== TWI_I2C_MODE_COMBINED
)) {
160 write_INT_MASK(iface
, 0);
161 write_MASTER_CTL(iface
, 0);
162 } else if (iface
->cur_mode
== TWI_I2C_MODE_COMBINED
) {
163 if (iface
->readNum
== 0) {
164 /* set the read number to 1 and ask for manual
165 * stop in block combine mode
168 iface
->manual_stop
= 1;
169 write_MASTER_CTL(iface
,
170 read_MASTER_CTL(iface
) | (0xff << 6));
172 /* set the readd number in other
175 write_MASTER_CTL(iface
,
176 (read_MASTER_CTL(iface
) &
178 (iface
->readNum
<< 6));
180 /* remove restart bit and enable master receive */
181 write_MASTER_CTL(iface
,
182 read_MASTER_CTL(iface
) & ~RSTART
);
183 } else if (iface
->cur_mode
== TWI_I2C_MODE_REPEAT
&&
184 iface
->cur_msg
+ 1 < iface
->msg_num
) {
186 iface
->transPtr
= iface
->pmsg
[iface
->cur_msg
].buf
;
187 iface
->writeNum
= iface
->readNum
=
188 iface
->pmsg
[iface
->cur_msg
].len
;
189 /* Set Transmit device address */
190 write_MASTER_ADDR(iface
,
191 iface
->pmsg
[iface
->cur_msg
].addr
);
192 if (iface
->pmsg
[iface
->cur_msg
].flags
& I2C_M_RD
)
193 iface
->read_write
= I2C_SMBUS_READ
;
195 iface
->read_write
= I2C_SMBUS_WRITE
;
196 /* Transmit first data */
197 if (iface
->writeNum
> 0) {
198 write_XMT_DATA8(iface
,
199 *(iface
->transPtr
++));
204 if (iface
->pmsg
[iface
->cur_msg
].len
<= 255) {
205 write_MASTER_CTL(iface
,
206 (read_MASTER_CTL(iface
) &
208 (iface
->pmsg
[iface
->cur_msg
].len
<< 6));
209 iface
->manual_stop
= 0;
211 write_MASTER_CTL(iface
,
212 (read_MASTER_CTL(iface
) |
214 iface
->manual_stop
= 1;
216 /* remove restart bit before last message */
217 if (iface
->cur_msg
+ 1 == iface
->msg_num
)
218 write_MASTER_CTL(iface
,
219 read_MASTER_CTL(iface
) & ~RSTART
);
222 write_INT_MASK(iface
, 0);
223 write_MASTER_CTL(iface
, 0);
225 complete(&iface
->complete
);
229 /* Interrupt handler */
230 static irqreturn_t
bfin_twi_interrupt_entry(int irq
, void *dev_id
)
232 struct bfin_twi_iface
*iface
= dev_id
;
234 unsigned short twi_int_status
;
236 spin_lock_irqsave(&iface
->lock
, flags
);
238 twi_int_status
= read_INT_STAT(iface
);
241 /* Clear interrupt status */
242 write_INT_STAT(iface
, twi_int_status
);
243 bfin_twi_handle_interrupt(iface
, twi_int_status
);
246 spin_unlock_irqrestore(&iface
->lock
, flags
);
251 * One i2c master transfer
253 static int bfin_twi_do_master_xfer(struct i2c_adapter
*adap
,
254 struct i2c_msg
*msgs
, int num
)
256 struct bfin_twi_iface
*iface
= adap
->algo_data
;
257 struct i2c_msg
*pmsg
;
260 if (!(read_CONTROL(iface
) & TWI_ENA
))
263 if (read_MASTER_STAT(iface
) & BUSBUSY
)
267 iface
->msg_num
= num
;
271 if (pmsg
->flags
& I2C_M_TEN
) {
272 dev_err(&adap
->dev
, "10 bits addr not supported!\n");
276 if (iface
->msg_num
> 1)
277 iface
->cur_mode
= TWI_I2C_MODE_REPEAT
;
278 iface
->manual_stop
= 0;
279 iface
->transPtr
= pmsg
->buf
;
280 iface
->writeNum
= iface
->readNum
= pmsg
->len
;
282 init_completion(&(iface
->complete
));
283 /* Set Transmit device address */
284 write_MASTER_ADDR(iface
, pmsg
->addr
);
286 /* FIFO Initiation. Data in FIFO should be
287 * discarded before start a new operation.
289 write_FIFO_CTL(iface
, 0x3);
291 write_FIFO_CTL(iface
, 0);
294 if (pmsg
->flags
& I2C_M_RD
)
295 iface
->read_write
= I2C_SMBUS_READ
;
297 iface
->read_write
= I2C_SMBUS_WRITE
;
298 /* Transmit first data */
299 if (iface
->writeNum
> 0) {
300 write_XMT_DATA8(iface
, *(iface
->transPtr
++));
307 write_INT_STAT(iface
, MERR
| MCOMP
| XMTSERV
| RCVSERV
);
309 /* Interrupt mask . Enable XMT, RCV interrupt */
310 write_INT_MASK(iface
, MCOMP
| MERR
| RCVSERV
| XMTSERV
);
313 if (pmsg
->len
<= 255)
314 write_MASTER_CTL(iface
, pmsg
->len
<< 6);
316 write_MASTER_CTL(iface
, 0xff << 6);
317 iface
->manual_stop
= 1;
321 write_MASTER_CTL(iface
, read_MASTER_CTL(iface
) | MEN
|
322 (iface
->msg_num
> 1 ? RSTART
: 0) |
323 ((iface
->read_write
== I2C_SMBUS_READ
) ? MDIR
: 0) |
324 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ
> 100) ? FAST
: 0));
327 while (!iface
->result
) {
328 if (!wait_for_completion_timeout(&iface
->complete
,
331 dev_err(&adap
->dev
, "master transfer timeout\n");
335 if (iface
->result
== 1)
336 rc
= iface
->cur_msg
+ 1;
344 * Generic i2c master transfer entrypoint
346 static int bfin_twi_master_xfer(struct i2c_adapter
*adap
,
347 struct i2c_msg
*msgs
, int num
)
349 return bfin_twi_do_master_xfer(adap
, msgs
, num
);
353 * One I2C SMBus transfer
355 int bfin_twi_do_smbus_xfer(struct i2c_adapter
*adap
, u16 addr
,
356 unsigned short flags
, char read_write
,
357 u8 command
, int size
, union i2c_smbus_data
*data
)
359 struct bfin_twi_iface
*iface
= adap
->algo_data
;
362 if (!(read_CONTROL(iface
) & TWI_ENA
))
365 if (read_MASTER_STAT(iface
) & BUSBUSY
)
371 /* Prepare datas & select mode */
373 case I2C_SMBUS_QUICK
:
374 iface
->transPtr
= NULL
;
375 iface
->cur_mode
= TWI_I2C_MODE_STANDARD
;
379 iface
->transPtr
= NULL
;
381 if (read_write
== I2C_SMBUS_READ
)
385 iface
->transPtr
= &data
->byte
;
387 iface
->cur_mode
= TWI_I2C_MODE_STANDARD
;
389 case I2C_SMBUS_BYTE_DATA
:
390 if (read_write
== I2C_SMBUS_READ
) {
392 iface
->cur_mode
= TWI_I2C_MODE_COMBINED
;
395 iface
->cur_mode
= TWI_I2C_MODE_STANDARDSUB
;
397 iface
->transPtr
= &data
->byte
;
399 case I2C_SMBUS_WORD_DATA
:
400 if (read_write
== I2C_SMBUS_READ
) {
402 iface
->cur_mode
= TWI_I2C_MODE_COMBINED
;
405 iface
->cur_mode
= TWI_I2C_MODE_STANDARDSUB
;
407 iface
->transPtr
= (u8
*)&data
->word
;
409 case I2C_SMBUS_PROC_CALL
:
412 iface
->cur_mode
= TWI_I2C_MODE_COMBINED
;
413 iface
->transPtr
= (u8
*)&data
->word
;
415 case I2C_SMBUS_BLOCK_DATA
:
416 if (read_write
== I2C_SMBUS_READ
) {
418 iface
->cur_mode
= TWI_I2C_MODE_COMBINED
;
420 iface
->writeNum
= data
->block
[0] + 1;
421 iface
->cur_mode
= TWI_I2C_MODE_STANDARDSUB
;
423 iface
->transPtr
= data
->block
;
425 case I2C_SMBUS_I2C_BLOCK_DATA
:
426 if (read_write
== I2C_SMBUS_READ
) {
427 iface
->readNum
= data
->block
[0];
428 iface
->cur_mode
= TWI_I2C_MODE_COMBINED
;
430 iface
->writeNum
= data
->block
[0];
431 iface
->cur_mode
= TWI_I2C_MODE_STANDARDSUB
;
433 iface
->transPtr
= (u8
*)&data
->block
[1];
440 iface
->manual_stop
= 0;
441 iface
->read_write
= read_write
;
442 iface
->command
= command
;
443 init_completion(&(iface
->complete
));
445 /* FIFO Initiation. Data in FIFO should be discarded before
446 * start a new operation.
448 write_FIFO_CTL(iface
, 0x3);
450 write_FIFO_CTL(iface
, 0);
453 write_INT_STAT(iface
, MERR
| MCOMP
| XMTSERV
| RCVSERV
);
455 /* Set Transmit device address */
456 write_MASTER_ADDR(iface
, addr
);
459 switch (iface
->cur_mode
) {
460 case TWI_I2C_MODE_STANDARDSUB
:
461 write_XMT_DATA8(iface
, iface
->command
);
462 write_INT_MASK(iface
, MCOMP
| MERR
|
463 ((iface
->read_write
== I2C_SMBUS_READ
) ?
467 if (iface
->writeNum
+ 1 <= 255)
468 write_MASTER_CTL(iface
, (iface
->writeNum
+ 1) << 6);
470 write_MASTER_CTL(iface
, 0xff << 6);
471 iface
->manual_stop
= 1;
474 write_MASTER_CTL(iface
, read_MASTER_CTL(iface
) | MEN
|
475 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ
>100) ? FAST
: 0));
477 case TWI_I2C_MODE_COMBINED
:
478 write_XMT_DATA8(iface
, iface
->command
);
479 write_INT_MASK(iface
, MCOMP
| MERR
| RCVSERV
| XMTSERV
);
482 if (iface
->writeNum
> 0)
483 write_MASTER_CTL(iface
, (iface
->writeNum
+ 1) << 6);
485 write_MASTER_CTL(iface
, 0x1 << 6);
487 write_MASTER_CTL(iface
, read_MASTER_CTL(iface
) | MEN
| RSTART
|
488 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ
>100) ? FAST
: 0));
491 write_MASTER_CTL(iface
, 0);
492 if (size
!= I2C_SMBUS_QUICK
) {
493 /* Don't access xmit data register when this is a
496 if (iface
->read_write
!= I2C_SMBUS_READ
) {
497 if (iface
->writeNum
> 0) {
498 write_XMT_DATA8(iface
,
499 *(iface
->transPtr
++));
500 if (iface
->writeNum
<= 255)
501 write_MASTER_CTL(iface
,
502 iface
->writeNum
<< 6);
504 write_MASTER_CTL(iface
,
506 iface
->manual_stop
= 1;
510 write_XMT_DATA8(iface
, iface
->command
);
511 write_MASTER_CTL(iface
, 1 << 6);
514 if (iface
->readNum
> 0 && iface
->readNum
<= 255)
515 write_MASTER_CTL(iface
,
516 iface
->readNum
<< 6);
517 else if (iface
->readNum
> 255) {
518 write_MASTER_CTL(iface
, 0xff << 6);
519 iface
->manual_stop
= 1;
524 write_INT_MASK(iface
, MCOMP
| MERR
|
525 ((iface
->read_write
== I2C_SMBUS_READ
) ?
530 write_MASTER_CTL(iface
, read_MASTER_CTL(iface
) | MEN
|
531 ((iface
->read_write
== I2C_SMBUS_READ
) ? MDIR
: 0) |
532 ((CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ
> 100) ? FAST
: 0));
537 while (!iface
->result
) {
538 if (!wait_for_completion_timeout(&iface
->complete
,
541 dev_err(&adap
->dev
, "smbus transfer timeout\n");
545 rc
= (iface
->result
>= 0) ? 0 : -1;
551 * Generic I2C SMBus transfer entrypoint
553 int bfin_twi_smbus_xfer(struct i2c_adapter
*adap
, u16 addr
,
554 unsigned short flags
, char read_write
,
555 u8 command
, int size
, union i2c_smbus_data
*data
)
557 return bfin_twi_do_smbus_xfer(adap
, addr
, flags
,
558 read_write
, command
, size
, data
);
562 * Return what the adapter supports
564 static u32
bfin_twi_functionality(struct i2c_adapter
*adap
)
566 return I2C_FUNC_SMBUS_QUICK
| I2C_FUNC_SMBUS_BYTE
|
567 I2C_FUNC_SMBUS_BYTE_DATA
| I2C_FUNC_SMBUS_WORD_DATA
|
568 I2C_FUNC_SMBUS_BLOCK_DATA
| I2C_FUNC_SMBUS_PROC_CALL
|
569 I2C_FUNC_I2C
| I2C_FUNC_SMBUS_I2C_BLOCK
;
572 static struct i2c_algorithm bfin_twi_algorithm
= {
573 .master_xfer
= bfin_twi_master_xfer
,
574 .smbus_xfer
= bfin_twi_smbus_xfer
,
575 .functionality
= bfin_twi_functionality
,
578 static int i2c_bfin_twi_suspend(struct device
*dev
)
580 struct bfin_twi_iface
*iface
= dev_get_drvdata(dev
);
582 iface
->saved_clkdiv
= read_CLKDIV(iface
);
583 iface
->saved_control
= read_CONTROL(iface
);
585 free_irq(iface
->irq
, iface
);
588 write_CONTROL(iface
, iface
->saved_control
& ~TWI_ENA
);
593 static int i2c_bfin_twi_resume(struct device
*dev
)
595 struct bfin_twi_iface
*iface
= dev_get_drvdata(dev
);
597 int rc
= request_irq(iface
->irq
, bfin_twi_interrupt_entry
,
598 0, to_platform_device(dev
)->name
, iface
);
600 dev_err(dev
, "Can't get IRQ %d !\n", iface
->irq
);
604 /* Resume TWI interface clock as specified */
605 write_CLKDIV(iface
, iface
->saved_clkdiv
);
608 write_CONTROL(iface
, iface
->saved_control
);
613 static SIMPLE_DEV_PM_OPS(i2c_bfin_twi_pm
,
614 i2c_bfin_twi_suspend
, i2c_bfin_twi_resume
);
616 static int i2c_bfin_twi_probe(struct platform_device
*pdev
)
618 struct bfin_twi_iface
*iface
;
619 struct i2c_adapter
*p_adap
;
620 struct resource
*res
;
622 unsigned int clkhilow
;
624 iface
= kzalloc(sizeof(struct bfin_twi_iface
), GFP_KERNEL
);
626 dev_err(&pdev
->dev
, "Cannot allocate memory\n");
628 goto out_error_nomem
;
631 spin_lock_init(&(iface
->lock
));
633 /* Find and map our resources */
634 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
636 dev_err(&pdev
->dev
, "Cannot get IORESOURCE_MEM\n");
638 goto out_error_get_res
;
641 iface
->regs_base
= ioremap(res
->start
, resource_size(res
));
642 if (iface
->regs_base
== NULL
) {
643 dev_err(&pdev
->dev
, "Cannot map IO\n");
645 goto out_error_ioremap
;
648 iface
->irq
= platform_get_irq(pdev
, 0);
649 if (iface
->irq
< 0) {
650 dev_err(&pdev
->dev
, "No IRQ specified\n");
652 goto out_error_no_irq
;
655 p_adap
= &iface
->adap
;
656 p_adap
->nr
= pdev
->id
;
657 strlcpy(p_adap
->name
, pdev
->name
, sizeof(p_adap
->name
));
658 p_adap
->algo
= &bfin_twi_algorithm
;
659 p_adap
->algo_data
= iface
;
660 p_adap
->class = I2C_CLASS_HWMON
| I2C_CLASS_SPD
;
661 p_adap
->dev
.parent
= &pdev
->dev
;
662 p_adap
->timeout
= 5 * HZ
;
665 rc
= peripheral_request_list((unsigned short *)pdev
->dev
.platform_data
,
668 dev_err(&pdev
->dev
, "Can't setup pin mux!\n");
669 goto out_error_pin_mux
;
672 rc
= request_irq(iface
->irq
, bfin_twi_interrupt_entry
,
673 0, pdev
->name
, iface
);
675 dev_err(&pdev
->dev
, "Can't get IRQ %d !\n", iface
->irq
);
677 goto out_error_req_irq
;
680 /* Set TWI internal clock as 10MHz */
681 write_CONTROL(iface
, ((get_sclk() / 1000 / 1000 + 5) / 10) & 0x7F);
684 * We will not end up with a CLKDIV=0 because no one will specify
685 * 20kHz SCL or less in Kconfig now. (5 * 1000 / 20 = 250)
687 clkhilow
= ((10 * 1000 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ
) + 1) / 2;
689 /* Set Twi interface clock as specified */
690 write_CLKDIV(iface
, (clkhilow
<< 8) | clkhilow
);
693 write_CONTROL(iface
, read_CONTROL(iface
) | TWI_ENA
);
696 rc
= i2c_add_numbered_adapter(p_adap
);
698 dev_err(&pdev
->dev
, "Can't add i2c adapter!\n");
699 goto out_error_add_adapter
;
702 platform_set_drvdata(pdev
, iface
);
704 dev_info(&pdev
->dev
, "Blackfin BF5xx on-chip I2C TWI Contoller, "
705 "regs_base@%p\n", iface
->regs_base
);
709 out_error_add_adapter
:
710 free_irq(iface
->irq
, iface
);
713 peripheral_free_list((unsigned short *)pdev
->dev
.platform_data
);
715 iounmap(iface
->regs_base
);
723 static int i2c_bfin_twi_remove(struct platform_device
*pdev
)
725 struct bfin_twi_iface
*iface
= platform_get_drvdata(pdev
);
727 i2c_del_adapter(&(iface
->adap
));
728 free_irq(iface
->irq
, iface
);
729 peripheral_free_list((unsigned short *)pdev
->dev
.platform_data
);
730 iounmap(iface
->regs_base
);
736 static struct platform_driver i2c_bfin_twi_driver
= {
737 .probe
= i2c_bfin_twi_probe
,
738 .remove
= i2c_bfin_twi_remove
,
740 .name
= "i2c-bfin-twi",
741 .owner
= THIS_MODULE
,
742 .pm
= &i2c_bfin_twi_pm
,
746 static int __init
i2c_bfin_twi_init(void)
748 return platform_driver_register(&i2c_bfin_twi_driver
);
751 static void __exit
i2c_bfin_twi_exit(void)
753 platform_driver_unregister(&i2c_bfin_twi_driver
);
756 subsys_initcall(i2c_bfin_twi_init
);
757 module_exit(i2c_bfin_twi_exit
);
759 MODULE_AUTHOR("Bryan Wu, Sonic Zhang");
760 MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Contoller Driver");
761 MODULE_LICENSE("GPL");
762 MODULE_ALIAS("platform:i2c-bfin-twi");