diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-04-21 15:23:59 +0100 |
|---|---|---|
| committer | Andrei Gherzan <andrei@gherzan.ro> | 2013-06-23 23:07:28 +0300 |
| commit | 7b6aa02efec437d62f418e126cb0f4b124f5d689 (patch) | |
| tree | 52b036b1829d86bd751bc2986e7b75e56b4f235d | |
| parent | 808f5e54f8c9799de39436601b9b8474de3bb323 (diff) | |
| download | meta-raspberrypi-7b6aa02efec437d62f418e126cb0f4b124f5d689.tar.gz | |
linux-raspberrypi: Fix i2c issues
I was having intermittent i2c issues on the device until I applied this kernel patch
which I found online.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
3 files changed, 34 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-raspberrypi/sl030raspberrypii2ckernel.patch b/recipes-kernel/linux/linux-raspberrypi/sl030raspberrypii2ckernel.patch new file mode 100644 index 0000000..8534ecb --- /dev/null +++ b/recipes-kernel/linux/linux-raspberrypi/sl030raspberrypii2ckernel.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | Fix i2c timing errors. | ||
| 2 | |||
| 3 | When Transmitting: Make SDA valid quarter of a cycle after the falling edge of SCL. | ||
| 4 | When Receiving: Sample SDA Quarter of a cycle after the rising edge of SCL. | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | RP 2013/04/21 | ||
| 9 | |||
| 10 | Index: git/drivers/i2c/busses/i2c-bcm2708.c | ||
| 11 | =================================================================== | ||
| 12 | --- git.orig/drivers/i2c/busses/i2c-bcm2708.c 2013-01-06 17:15:00.754954587 +0000 | ||
| 13 | +++ git/drivers/i2c/busses/i2c-bcm2708.c 2013-01-06 17:50:09.794905741 +0000 | ||
| 14 | @@ -150,6 +150,7 @@ | ||
| 15 | unsigned long bus_hz; | ||
| 16 | u32 cdiv; | ||
| 17 | u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; | ||
| 18 | + u32 cdel; | ||
| 19 | |||
| 20 | bus_hz = clk_get_rate(bi->clk); | ||
| 21 | cdiv = bus_hz / baudrate; | ||
| 22 | @@ -163,6 +164,10 @@ | ||
| 23 | bcm2708_wr(bi, BSC_A, bi->msg->addr); | ||
| 24 | bcm2708_wr(bi, BSC_DLEN, bi->msg->len); | ||
| 25 | bcm2708_wr(bi, BSC_C, c); | ||
| 26 | + | ||
| 27 | + cdel = (cdiv / 4) & 0xffff; | ||
| 28 | + cdel = cdel << 16 | cdel; | ||
| 29 | + bcm2708_wr(bi, BSC_DEL, cdel); | ||
| 30 | } | ||
| 31 | |||
| 32 | static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id) | ||
diff --git a/recipes-kernel/linux/linux-raspberrypi_3.2.27.bb b/recipes-kernel/linux/linux-raspberrypi_3.2.27.bb index c7a12e6..a68186b 100644 --- a/recipes-kernel/linux/linux-raspberrypi_3.2.27.bb +++ b/recipes-kernel/linux/linux-raspberrypi_3.2.27.bb | |||
| @@ -8,6 +8,7 @@ PV_append = "+git${SRCREV}" | |||
| 8 | 8 | ||
| 9 | SRCREV = "10182a3bc434b27740f81c2b836a1af943060241" | 9 | SRCREV = "10182a3bc434b27740f81c2b836a1af943060241" |
| 10 | SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.2.27 \ | 10 | SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.2.27 \ |
| 11 | file://sl030raspberrypii2ckernel.patch \ | ||
| 11 | " | 12 | " |
| 12 | S = "${WORKDIR}/git" | 13 | S = "${WORKDIR}/git" |
| 13 | 14 | ||
diff --git a/recipes-kernel/linux/linux-raspberrypi_3.6.11.bb b/recipes-kernel/linux/linux-raspberrypi_3.6.11.bb index caee7f2..07b0ae8 100644 --- a/recipes-kernel/linux/linux-raspberrypi_3.6.11.bb +++ b/recipes-kernel/linux/linux-raspberrypi_3.6.11.bb | |||
| @@ -8,6 +8,7 @@ PV_append = "+git${SRCREV}" | |||
| 8 | 8 | ||
| 9 | SRCREV = "31a951046155b27361127d9cf85a1f58719fe9b3" | 9 | SRCREV = "31a951046155b27361127d9cf85a1f58719fe9b3" |
| 10 | SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.6.y \ | 10 | SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.6.y \ |
| 11 | file://sl030raspberrypii2ckernel.patch \ | ||
| 11 | " | 12 | " |
| 12 | S = "${WORKDIR}/git" | 13 | S = "${WORKDIR}/git" |
| 13 | 14 | ||
