3 * linux/drivers/i2c/i2c-frodo.c
5 * Author: Abraham van der Merwe <abraham@2d3d.co.za>
7 * An I2C adapter driver for the 2d3D, Inc. StrongARM SA-1110
8 * Development board (Frodo).
10 * This source code is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
15 #include <linux/config.h>
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/init.h>
19 #include <linux/delay.h>
20 #include <linux/i2c.h>
21 #include <linux/i2c-algo-bit.h>
22 #include <asm/hardware.h>
25 static void frodo_setsda (void *data
,int state
)
28 FRODO_CPLD_I2C
|= FRODO_I2C_SDA_OUT
;
30 FRODO_CPLD_I2C
&= ~FRODO_I2C_SDA_OUT
;
33 static void frodo_setscl (void *data
,int state
)
36 FRODO_CPLD_I2C
|= FRODO_I2C_SCL_OUT
;
38 FRODO_CPLD_I2C
&= ~FRODO_I2C_SCL_OUT
;
41 static int frodo_getsda (void *data
)
43 return ((FRODO_CPLD_I2C
& FRODO_I2C_SDA_IN
) != 0);
46 static int frodo_getscl (void *data
)
48 return ((FRODO_CPLD_I2C
& FRODO_I2C_SCL_IN
) != 0);
51 static struct i2c_algo_bit_data bit_frodo_data
= {
52 .setsda
= frodo_setsda
,
53 .setscl
= frodo_setscl
,
54 .getsda
= frodo_getsda
,
55 .getscl
= frodo_getscl
,
61 static struct i2c_adapter frodo_ops
= {
64 .algo_data
= &bit_frodo_data
,
66 .name
= "Frodo adapter driver",
70 static int __init
i2c_frodo_init (void)
72 return i2c_bit_add_bus(&frodo_ops
);
75 static void __exit
i2c_frodo_exit (void)
77 i2c_bit_del_bus(&frodo_ops
);
80 MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
81 MODULE_DESCRIPTION ("I2C-Bus adapter routines for Frodo");
82 MODULE_LICENSE ("GPL");
84 module_init (i2c_frodo_init
);
85 module_exit (i2c_frodo_exit
);