This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using I2C-1 from DM8168

Other Parts Discussed in Thread: TVP5158

We use DM816x DVRRDK 03.00.00.00 and UdWorks platform.
We want to use the second i2c device /dev/i2c-1.

OSA api and linux device api works fine for /dev/i2c-2 but not for /dev/i2c-1.

To enable dev/i2c-1, I have added the following:

    __raw_writel(0x2, CM_ALWON_I2C_1_CLKCTRL);
    while(__raw_readl(CM_ALWON_I2C_1_CLKCTRL) != 0x2);
in uboot-04.04.00.01/board/ti/ti8168_dvr/dvr.c

and #define CM_ALWON_I2C_1_CLKCTRL      (PRCM_BASE + 0x1568)
in uboot-04.04.00.01/arch/arm/include/asm/arch-ti81xx/cpu.h

But after building a new uboot, with this settings uboot is not starting.
No output at console.
What is nessesary to enable /dev/i2c-1 ?



  • Hi,

    A working repository of the i2c functionality in u-boot with multi bus support is shared here:

    http://arago-project.org/git/projects/?p=u-boot-dvr-rdk-dm81xx.git;a=shortlog;h=refs/heads/dvrrdk_uboot_int_branch

    Make sure you have all of these as per below:

    diff --git a/arch/arm/include/asm/arch-ti81xx/cpu.h b/arch/arm/include/asm/arch-ti81xx/cpu.h
    index dba329d..2f6d61c 100644
    --- a/arch/arm/include/asm/arch-ti81xx/cpu.h
    +++ b/arch/arm/include/asm/arch-ti81xx/cpu.h
    @@ -328,6 +328,7 @@
     /* I2C */
     /* Note: In ti814x I2C0 and I2C2 have common clk control */
     #define CM_ALWON_I2C_0_CLKCTRL      (PRCM_BASE + 0x1564)
    +#define CM_ALWON_I2C_1_CLKCTRL      (PRCM_BASE + 0x1568)

     /* HSMMC */
     #ifdef CONFIG_TI816X

    diff --git a/board/ti/ti8168_dvr/dvr.c b/board/ti/ti8168_dvr/dvr.c
    index 9610ac2..d6ab5f1 100644
    --- a/board/ti/ti8168_dvr/dvr.c
    +++ b/board/ti/ti8168_dvr/dvr.c
    @@ -1050,6 +1050,9 @@ static void peripheral_enable(void)
            __raw_writel(0x2, CM_ALWON_I2C_0_CLKCTRL);
            while(__raw_readl(CM_ALWON_I2C_0_CLKCTRL) != 0x2);

    +       __raw_writel(0x2, CM_ALWON_I2C_1_CLKCTRL);
    +       while(__raw_readl(CM_ALWON_I2C_1_CLKCTRL) != 0x2);
    +
            /* Ethernet */
            __raw_writel(0x2, CM_ETHERNET_CLKSTCTRL);
            __raw_writel(0x2, CM_ALWON_ETHERNET_0_CLKCTRL);
    diff --git a/include/configs/ti8168_dvr.h b/include/configs/ti8168_dvr.h
    index 1b296f8..966c8a1 100644
    --- a/include/configs/ti8168_dvr.h
    +++ b/include/configs/ti8168_dvr.h
    @@ -340,6 +340,7 @@ extern unsigned int boot_flash_type;
     # define CONFIG_SYS_I2C_BUS                    0
     # define CONFIG_SYS_I2C_BUS_SELECT     1
     # define CONFIG_DRIVER_TI81XX_I2C      1
    +# define CONFIG_I2C_MULTI_BUS          1
     #endif

     /*----------------------------------------------------------------------------

    After doing the above modifications, you should be able to run this command on u-boot promt

    #i2c dev 1

    Thanks and Regards,

    Vivek

  • Thanks for the patches, it works well, I can access I2C-1 now.
    We also found that DVR_RDK uses 7 bit I2C adressing.
    I try to change to 10 bit mode because we have also devices with adresses > 0x80.
    I set I2C_M_TEN flag in osa_i2c functions but now the access to the other devices
    failed (SII9022, TVP5158).
    Is it possible to set the 10 bit mode globaly ?