aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2015-01-07 06:24:10 -0500
committerWolfram Sang <wsa@the-dreams.de>2015-03-13 10:10:53 -0400
commita531afdf93489e9357c4207c7bdec9b921ddfe9e (patch)
tree63db4617b00d9a80af8d9a72c34d738ede36fe74
parenta7405844da1c8064500f0741cc8876c7f887dd85 (diff)
i2c: opal: make use of the new infrastructure for quirks
Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
-rw-r--r--drivers/i2c/busses/i2c-opal.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-opal.c b/drivers/i2c/busses/i2c-opal.c
index 16f90b1a7508..b2788ecad5b3 100644
--- a/drivers/i2c/busses/i2c-opal.c
+++ b/drivers/i2c/busses/i2c-opal.c
@@ -104,17 +104,6 @@ static int i2c_opal_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
104 req.buffer_ra = cpu_to_be64(__pa(msgs[0].buf)); 104 req.buffer_ra = cpu_to_be64(__pa(msgs[0].buf));
105 break; 105 break;
106 case 2: 106 case 2:
107 /* For two messages, we basically support only simple
108 * smbus transactions of a write plus a read. We might
109 * want to allow also two writes but we'd have to bounce
110 * the data into a single buffer.
111 */
112 if ((msgs[0].flags & I2C_M_RD) || !(msgs[1].flags & I2C_M_RD))
113 return -EOPNOTSUPP;
114 if (msgs[0].len > 4)
115 return -EOPNOTSUPP;
116 if (msgs[0].addr != msgs[1].addr)
117 return -EOPNOTSUPP;
118 req.type = OPAL_I2C_SM_READ; 107 req.type = OPAL_I2C_SM_READ;
119 req.addr = cpu_to_be16(msgs[0].addr); 108 req.addr = cpu_to_be16(msgs[0].addr);
120 req.subaddr_sz = msgs[0].len; 109 req.subaddr_sz = msgs[0].len;
@@ -210,6 +199,16 @@ static const struct i2c_algorithm i2c_opal_algo = {
210 .functionality = i2c_opal_func, 199 .functionality = i2c_opal_func,
211}; 200};
212 201
202/* For two messages, we basically support only simple
203 * smbus transactions of a write plus a read. We might
204 * want to allow also two writes but we'd have to bounce
205 * the data into a single buffer.
206 */
207static struct i2c_adapter_quirks i2c_opal_quirks = {
208 .flags = I2C_AQ_COMB_WRITE_THEN_READ,
209 .max_comb_1st_msg_len = 4,
210};
211
213static int i2c_opal_probe(struct platform_device *pdev) 212static int i2c_opal_probe(struct platform_device *pdev)
214{ 213{
215 struct i2c_adapter *adapter; 214 struct i2c_adapter *adapter;
@@ -232,6 +231,7 @@ static int i2c_opal_probe(struct platform_device *pdev)
232 231
233 adapter->algo = &i2c_opal_algo; 232 adapter->algo = &i2c_opal_algo;
234 adapter->algo_data = (void *)(unsigned long)opal_id; 233 adapter->algo_data = (void *)(unsigned long)opal_id;
234 adapter->quirks = &i2c_opal_quirks;
235 adapter->dev.parent = &pdev->dev; 235 adapter->dev.parent = &pdev->dev;
236 adapter->dev.of_node = of_node_get(pdev->dev.of_node); 236 adapter->dev.of_node = of_node_get(pdev->dev.of_node);
237 pname = of_get_property(pdev->dev.of_node, "ibm,port-name", NULL); 237 pname = of_get_property(pdev->dev.of_node, "ibm,port-name", NULL);