23 #include <linux/pci.h>
24 #include <linux/i2c.h>
45 for (i = 0; i < msg->
len; i++) {
46 rxd = (msg->
addr << 25) | (1 << 24)
51 if (i == (msg->
len - 1))
58 for (trials = 0; trials <
TRIALS; trials++) {
67 for (trials = 0; trials <
TRIALS; trials++) {
76 msg->
buf[
i] = (
u8)((rxd >> 8) & 0xFF);
92 for (i = 0; i < msg->
len; i++) {
94 txd = (msg->
addr << 25) | (msg->
buf[i] << 8)
99 if (i == (msg->
len - 1))
106 for (trials = 0; trials <
TRIALS; trials++) {
115 for (trials = 0; trials <
TRIALS; trials++) {
130 int ret = 0, i = 0, trials;
135 mantis = i2c_get_adapdata(adapter);
148 (msgs[i + 1].
len < 2) &&
154 txd = msgs[
i].
addr << 25 | (0x1 << 24)
155 | (msgs[i].
buf[0] << 16)
160 for (trials = 0; trials <
TRIALS; trials++) {
171 msgs[i + 1].
buf[0] = (data >> 8) & 0xff;
190 ret = mantis_i2c_read(mantis, &msgs[i]);
192 ret = mantis_i2c_write(mantis, &msgs[i]);
216 .master_xfer = mantis_i2c_xfer,
217 .functionality = mantis_i2c_func,
222 u32 intstat, intmask;
229 i2c_set_adapdata(i2c_adapter, mantis);
232 i2c_adapter->
algo = &mantis_algo;
236 i2c_adapter->
dev.parent = &pdev->
dev;