diff options
author | Prakash Mortha <pmortha@escient.com> | 2008-10-14 11:30:06 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-10-14 11:30:06 -0400 |
commit | a05f2c5a2735ee1d68770137fbbfc334d3b9cda9 (patch) | |
tree | 350d2919a1886a6c510662365d53762d799630a1 | |
parent | 596c88f4601e6245a15ea7619527674abbfdcf92 (diff) |
i2c-viapro: Add support for SMBus Process Call transactions
Add support for SMBus Process Call transactions. These are combined
word write, word read transactions.
Signed-off-by: Prakash Mortha <pmortha@escient.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | drivers/i2c/busses/i2c-viapro.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 1345da97b23b..73dc52e114eb 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -83,6 +83,7 @@ static unsigned short SMBHSTCFG = 0xD2; | |||
83 | #define VT596_BYTE 0x04 | 83 | #define VT596_BYTE 0x04 |
84 | #define VT596_BYTE_DATA 0x08 | 84 | #define VT596_BYTE_DATA 0x08 |
85 | #define VT596_WORD_DATA 0x0C | 85 | #define VT596_WORD_DATA 0x0C |
86 | #define VT596_PROC_CALL 0x10 | ||
86 | #define VT596_BLOCK_DATA 0x14 | 87 | #define VT596_BLOCK_DATA 0x14 |
87 | #define VT596_I2C_BLOCK_DATA 0x34 | 88 | #define VT596_I2C_BLOCK_DATA 0x34 |
88 | 89 | ||
@@ -233,6 +234,12 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | |||
233 | } | 234 | } |
234 | size = VT596_WORD_DATA; | 235 | size = VT596_WORD_DATA; |
235 | break; | 236 | break; |
237 | case I2C_SMBUS_PROC_CALL: | ||
238 | outb_p(command, SMBHSTCMD); | ||
239 | outb_p(data->word & 0xff, SMBHSTDAT0); | ||
240 | outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); | ||
241 | size = VT596_PROC_CALL; | ||
242 | break; | ||
236 | case I2C_SMBUS_I2C_BLOCK_DATA: | 243 | case I2C_SMBUS_I2C_BLOCK_DATA: |
237 | if (!(vt596_features & FEATURE_I2CBLOCK)) | 244 | if (!(vt596_features & FEATURE_I2CBLOCK)) |
238 | goto exit_unsupported; | 245 | goto exit_unsupported; |
@@ -263,6 +270,9 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | |||
263 | if (status) | 270 | if (status) |
264 | return status; | 271 | return status; |
265 | 272 | ||
273 | if (size == VT596_PROC_CALL) | ||
274 | read_write = I2C_SMBUS_READ; | ||
275 | |||
266 | if ((read_write == I2C_SMBUS_WRITE) || (size == VT596_QUICK)) | 276 | if ((read_write == I2C_SMBUS_WRITE) || (size == VT596_QUICK)) |
267 | return 0; | 277 | return 0; |
268 | 278 | ||
@@ -272,6 +282,7 @@ static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | |||
272 | data->byte = inb_p(SMBHSTDAT0); | 282 | data->byte = inb_p(SMBHSTDAT0); |
273 | break; | 283 | break; |
274 | case VT596_WORD_DATA: | 284 | case VT596_WORD_DATA: |
285 | case VT596_PROC_CALL: | ||
275 | data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); | 286 | data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); |
276 | break; | 287 | break; |
277 | case VT596_I2C_BLOCK_DATA: | 288 | case VT596_I2C_BLOCK_DATA: |
@@ -296,7 +307,7 @@ static u32 vt596_func(struct i2c_adapter *adapter) | |||
296 | { | 307 | { |
297 | u32 func = I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 308 | u32 func = I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
298 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 309 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
299 | I2C_FUNC_SMBUS_BLOCK_DATA; | 310 | I2C_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_DATA; |
300 | 311 | ||
301 | if (vt596_features & FEATURE_I2CBLOCK) | 312 | if (vt596_features & FEATURE_I2CBLOCK) |
302 | func |= I2C_FUNC_SMBUS_I2C_BLOCK; | 313 | func |= I2C_FUNC_SMBUS_I2C_BLOCK; |