diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-01-06 19:30:44 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 23:47:16 -0500 |
commit | 730745a5c45093982112ddc94cee6a9973455641 (patch) | |
tree | 1c36bd96c28d08e2b5d839ba3f4e37588aad2328 /drivers/i2c/busses | |
parent | 002ec58eb57bac2380f0ed5a4e88121b4bdb32ec (diff) |
[PATCH] 1/5 powerpc: Rework PowerMac i2c part 1
This is the first part of a rework of the PowerMac i2c code. It
completely reworks the "low_i2c" layer. It is now more flexible,
supports KeyWest, SMU and PMU i2c busses, and provides functions to
match device nodes to i2c busses and adapters.
This patch also extends & fix some bugs in the SMU driver related to i2c
support and removes the clock spreading hacks from the pmac feature code
rather than adapting them to the new API since they'll be replaced by
the platform function code completely in patch 3/5
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-pmac-smu.c | 17 |
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) | |||
273 | static int create_iface_of_platform(struct of_device* dev, | 273 | static 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 | }; |
293 | static struct of_platform_driver i2c_smu_of_platform_driver = | 302 | static struct of_platform_driver i2c_smu_of_platform_driver = |