From a6551a76fff15056fde2342d0f7de41ee605264e Mon Sep 17 00:00:00 2001 From: Andrew Bresticker Date: Thu, 18 Sep 2014 17:18:56 +0200 Subject: mfd: cros_ec: stop calling ->cmd_xfer() directly Instead of having users of the ChromeOS EC call the interface-specific cmd_xfer() callback directly, introduce a central cros_ec_cmd_xfer() to use instead. This will allow us to put all the locking and retry logic in one place instead of duplicating it across the different drivers. Signed-off-by: Andrew Bresticker Reviewed-by: Simon Glass Signed-off-by: Javier Martinez Canillas Reviewed-by: Doug Anderson Signed-off-by: Lee Jones --- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/i2c') diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c index 05e033c..43be23d 100644 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c @@ -227,7 +227,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], msg.indata = response; msg.insize = response_len; - result = bus->ec->cmd_xfer(bus->ec, &msg); + result = cros_ec_cmd_xfer(bus->ec, &msg); if (result < 0) goto exit; -- cgit v1.1 From 97720706084dd8c45eecc61d39353c7b62939b8f Mon Sep 17 00:00:00 2001 From: Derek Basehore Date: Thu, 18 Sep 2014 17:18:55 +0200 Subject: i2c: i2c-cros-ec-tunnel: Set retries to 3 Since the i2c bus can get wedged on the EC sometimes, set the number of retries to 3. Since we un-wedge the bus immediately after the wedge happens, this is the correct fix since only one transfer will fail. Signed-off-by: Derek Basehore Reviewed-by: Doug Anderson Acked-by: Wolfram Sang Signed-off-by: Javier Martinez Canillas Signed-off-by: Lee Jones --- drivers/i2c/busses/i2c-cros-ec-tunnel.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/i2c') diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c index 43be23d..8ca5cbb 100644 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c @@ -16,6 +16,8 @@ #include #include +#define I2C_MAX_RETRIES 3 + /** * struct ec_i2c_device - Driver data for I2C tunnel * @@ -290,6 +292,7 @@ static int ec_i2c_probe(struct platform_device *pdev) bus->adap.algo_data = bus; bus->adap.dev.parent = &pdev->dev; bus->adap.dev.of_node = np; + bus->adap.retries = I2C_MAX_RETRIES; err = i2c_add_adapter(&bus->adap); if (err) { -- cgit v1.1