[yocto] [PATCH] linux-raspberrypi: Fix i2c issues

Andrei Gherzan andrei at gherzan.ro
Sun Jun 23 13:13:29 PDT 2013


On Sun, Apr 21, 2013 at 5:23 PM, Richard Purdie <
richard.purdie at linuxfoundation.org> wrote:

> 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 at linuxfoundation.org>
> ---
>  .../sl030raspberrypii2ckernel.patch                |   32
> ++++++++++++++++++++
>  recipes-kernel/linux/linux-raspberrypi_3.2.27.bb   |    1 +
>  recipes-kernel/linux/linux-raspberrypi_3.6.11.bb   |    1 +
>  3 files changed, 34 insertions(+)
>  create mode 100644
> recipes-kernel/linux/linux-raspberrypi/sl030raspberrypii2ckernel.patch
>
> 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 @@
> +Fix i2c timing errors.
> +
> +When Transmitting: Make SDA valid quarter of a cycle after the falling
> edge of SCL.
> +When Receiving: Sample SDA Quarter of a cycle after the rising edge of
> SCL.
> +
> +Upstream-Status: Pending
> +
> +RP 2013/04/21
> +
> +Index: git/drivers/i2c/busses/i2c-bcm2708.c
> +===================================================================
> +--- git.orig/drivers/i2c/busses/i2c-bcm2708.c  2013-01-06
> 17:15:00.754954587 +0000
> ++++ git/drivers/i2c/busses/i2c-bcm2708.c       2013-01-06
> 17:50:09.794905741 +0000
> +@@ -150,6 +150,7 @@
> +       unsigned long bus_hz;
> +       u32 cdiv;
> +       u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1;
> ++      u32 cdel;
> +
> +       bus_hz = clk_get_rate(bi->clk);
> +       cdiv = bus_hz / baudrate;
> +@@ -163,6 +164,10 @@
> +       bcm2708_wr(bi, BSC_A, bi->msg->addr);
> +       bcm2708_wr(bi, BSC_DLEN, bi->msg->len);
> +       bcm2708_wr(bi, BSC_C, c);
> ++
> ++      cdel = (cdiv / 4) & 0xffff;
> ++      cdel = cdel << 16 | cdel;
> ++      bcm2708_wr(bi, BSC_DEL, cdel);
> + }
> +
> + static irqreturn_t bcm2708_i2c_interrupt(int irq, void *dev_id)
> diff --git a/recipes-kernel/linux/linux-raspberrypi_3.2.27.bbb/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}"
>
>  SRCREV = "10182a3bc434b27740f81c2b836a1af943060241"
>  SRC_URI = "git://
> github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.2.27 \
> +          file://sl030raspberrypii2ckernel.patch \
>            "
>  S = "${WORKDIR}/git"
>
> diff --git a/recipes-kernel/linux/linux-raspberrypi_3.6.11.bbb/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}"
>
>  SRCREV = "31a951046155b27361127d9cf85a1f58719fe9b3"
>  SRC_URI = "git://
> github.com/raspberrypi/linux.git;protocol=git;branch=rpi-3.6.y \
> +           file://sl030raspberrypii2ckernel.patch \
>            "
>  S = "${WORKDIR}/git"
>
> --
> 1.7.10.4
>
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>

Thank you. Patch merged.

-- 
*Andrei Gherzan*
m: +40.744.478.414 |  f: +40.31.816.28.12
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20130623/a9953960/attachment.html>


More information about the yocto mailing list