aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-pmac-smu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-pmac-smu.c')
-rw-r--r--drivers/i2c/busses/i2c-pmac-smu.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-pmac-smu.c b/drivers/i2c/busses/i2c-pmac-smu.c
index bfefe7f7a53d..7d925be3fd4b 100644
--- a/drivers/i2c/busses/i2c-pmac-smu.c
+++ b/drivers/i2c/busses/i2c-pmac-smu.c
@@ -103,8 +103,8 @@ static s32 smu_smbus_xfer( struct i2c_adapter* adap,
103 cmd.info.subaddr[1] = 0; 103 cmd.info.subaddr[1] = 0;
104 cmd.info.subaddr[2] = 0; 104 cmd.info.subaddr[2] = 0;
105 if (!read) { 105 if (!read) {
106 cmd.info.data[0] = data->byte & 0xff; 106 cmd.info.data[0] = data->word & 0xff;
107 cmd.info.data[1] = (data->byte >> 8) & 0xff; 107 cmd.info.data[1] = (data->word >> 8) & 0xff;
108 } 108 }
109 break; 109 break;
110 /* Note that these are broken vs. the expected smbus API where 110 /* Note that these are broken vs. the expected smbus API where
@@ -116,7 +116,7 @@ static s32 smu_smbus_xfer( struct i2c_adapter* adap,
116 case I2C_SMBUS_BLOCK_DATA: 116 case I2C_SMBUS_BLOCK_DATA:
117 cmd.info.type = SMU_I2C_TRANSFER_STDSUB; 117 cmd.info.type = SMU_I2C_TRANSFER_STDSUB;
118 cmd.info.datalen = data->block[0] + 1; 118 cmd.info.datalen = data->block[0] + 1;
119 if (cmd.info.datalen > 6) 119 if (cmd.info.datalen > (SMU_I2C_WRITE_MAX + 1))
120 return -EINVAL; 120 return -EINVAL;
121 if (!read) 121 if (!read)
122 memcpy(cmd.info.data, data->block, cmd.info.datalen); 122 memcpy(cmd.info.data, data->block, cmd.info.datalen);
@@ -273,7 +273,13 @@ static int dispose_iface(struct device *dev)
273static int create_iface_of_platform(struct of_device* dev, 273static int create_iface_of_platform(struct of_device* dev,
274 const struct of_device_id *match) 274 const struct of_device_id *match)
275{ 275{
276 return create_iface(dev->node, &dev->dev); 276 struct device_node *node = dev->node;
277
278 if (device_is_compatible(node, "smu-i2c") ||
279 (node->parent != NULL &&
280 device_is_compatible(node->parent, "smu-i2c-control")))
281 return create_iface(node, &dev->dev);
282 return -ENODEV;
277} 283}
278 284
279 285
@@ -288,6 +294,9 @@ static struct of_device_id i2c_smu_match[] =
288 { 294 {
289 .compatible = "smu-i2c", 295 .compatible = "smu-i2c",
290 }, 296 },
297 {
298 .compatible = "i2c-bus",
299 },
291 {}, 300 {},
292}; 301};
293static struct of_platform_driver i2c_smu_of_platform_driver = 302static struct of_platform_driver i2c_smu_of_platform_driver =