aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-nforce2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-nforce2.c')
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 74eb89aa9350..e0b7a913431e 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -110,8 +110,6 @@ static u32 nforce2_func(struct i2c_adapter *adapter);
110 110
111 111
112static struct i2c_algorithm smbus_algorithm = { 112static struct i2c_algorithm smbus_algorithm = {
113 .name = "Non-I2C SMBus adapter",
114 .id = I2C_ALGO_SMBUS,
115 .smbus_xfer = nforce2_access, 113 .smbus_xfer = nforce2_access,
116 .functionality = nforce2_func, 114 .functionality = nforce2_func,
117}; 115};
@@ -131,7 +129,6 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
131 struct nforce2_smbus *smbus = adap->algo_data; 129 struct nforce2_smbus *smbus = adap->algo_data;
132 unsigned char protocol, pec, temp; 130 unsigned char protocol, pec, temp;
133 unsigned char len = 0; /* to keep the compiler quiet */ 131 unsigned char len = 0; /* to keep the compiler quiet */
134 int timeout = 0;
135 int i; 132 int i;
136 133
137 protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ : 134 protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ :
@@ -191,29 +188,10 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
191 case I2C_SMBUS_PROC_CALL: 188 case I2C_SMBUS_PROC_CALL:
192 dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n"); 189 dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
193 return -1; 190 return -1;
194 /*
195 outb_p(command, NVIDIA_SMB_CMD);
196 outb_p(data->word, NVIDIA_SMB_DATA);
197 outb_p(data->word >> 8, NVIDIA_SMB_DATA + 1);
198 protocol = NVIDIA_SMB_PRTCL_PROC_CALL | pec;
199 read_write = I2C_SMBUS_READ;
200 break;
201 */
202 191
203 case I2C_SMBUS_BLOCK_PROC_CALL: 192 case I2C_SMBUS_BLOCK_PROC_CALL:
204 dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n"); 193 dev_err(&adap->dev, "I2C_SMBUS_BLOCK_PROC_CALL not supported!\n");
205 return -1; 194 return -1;
206 /*
207 protocol |= pec;
208 len = min_t(u8, data->block[0], 31);
209 outb_p(command, NVIDIA_SMB_CMD);
210 outb_p(len, NVIDIA_SMB_BCNT);
211 for (i = 0; i < len; i++)
212 outb_p(data->block[i + 1], NVIDIA_SMB_DATA + i);
213 protocol = NVIDIA_SMB_PRTCL_BLOCK_PROC_CALL | pec;
214 read_write = I2C_SMBUS_READ;
215 break;
216 */
217 195
218 case I2C_SMBUS_WORD_DATA_PEC: 196 case I2C_SMBUS_WORD_DATA_PEC:
219 case I2C_SMBUS_BLOCK_DATA_PEC: 197 case I2C_SMBUS_BLOCK_DATA_PEC:
@@ -232,12 +210,6 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
232 210
233 temp = inb_p(NVIDIA_SMB_STS); 211 temp = inb_p(NVIDIA_SMB_STS);
234 212
235#if 0
236 do {
237 i2c_do_pause(1);
238 temp = inb_p(NVIDIA_SMB_STS);
239 } while (((temp & NVIDIA_SMB_STS_DONE) == 0) && (timeout++ < MAX_TIMEOUT));
240#endif
241 if (~temp & NVIDIA_SMB_STS_DONE) { 213 if (~temp & NVIDIA_SMB_STS_DONE) {
242 udelay(500); 214 udelay(500);
243 temp = inb_p(NVIDIA_SMB_STS); 215 temp = inb_p(NVIDIA_SMB_STS);
@@ -247,9 +219,10 @@ static s32 nforce2_access(struct i2c_adapter * adap, u16 addr,
247 temp = inb_p(NVIDIA_SMB_STS); 219 temp = inb_p(NVIDIA_SMB_STS);
248 } 220 }
249 221
250 if ((timeout >= MAX_TIMEOUT) || (~temp & NVIDIA_SMB_STS_DONE) 222 if ((~temp & NVIDIA_SMB_STS_DONE) || (temp & NVIDIA_SMB_STS_STATUS)) {
251 || (temp & NVIDIA_SMB_STS_STATUS)) 223 dev_dbg(&adap->dev, "SMBus Timeout! (0x%02x)\n", temp);
252 return -1; 224 return -1;
225 }
253 226
254 if (read_write == I2C_SMBUS_WRITE) 227 if (read_write == I2C_SMBUS_WRITE)
255 return 0; 228 return 0;