brcm2708: add linux 4.1 support
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0093-i2c-bcm2708-Increase-timeouts-to-allow-larger-transf.patch
1 From 11667799f99dca096d4d92e63b7823db2a8f8779 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 30 Jun 2015 10:28:59 +0100
4 Subject: [PATCH 093/121] i2c-bcm2708: Increase timeouts to allow larger
5 transfers
6
7 Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting
8 for completion. The default timeout is 1 second.
9
10 See: https://github.com/raspberrypi/linux/issues/260
11 ---
12 drivers/i2c/busses/i2c-bcm2708.c | 7 +++----
13 1 file changed, 3 insertions(+), 4 deletions(-)
14
15 --- a/drivers/i2c/busses/i2c-bcm2708.c
16 +++ b/drivers/i2c/busses/i2c-bcm2708.c
17 @@ -67,10 +67,9 @@
18 #define BSC_S_DONE 0x00000002
19 #define BSC_S_TA 0x00000001
20
21 -#define I2C_TIMEOUT_MS 150
22 -#define I2C_WAIT_LOOP_COUNT 40
23 +#define I2C_WAIT_LOOP_COUNT 200
24
25 -#define DRV_NAME "bcm2708_i2c"
26 +#define DRV_NAME "bcm2708_i2c"
27
28 static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE;
29 module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
30 @@ -305,7 +304,7 @@ static int bcm2708_i2c_master_xfer(struc
31 goto error_timeout;
32 }
33
34 - ret = wait_for_completion_timeout(&bi->done, msecs_to_jiffies(I2C_TIMEOUT_MS));
35 + ret = wait_for_completion_timeout(&bi->done, adap->timeout);
36 if (ret == 0) {
37 dev_err(&adap->dev, "transfer timed out\n");
38 goto error_timeout;