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.

AM335x SDK 06 (linux-3.2.0-psp04.06.00.11) - How to enable i2c0 in kernel Template Board File

Hi, we have a custom board that is unlike the BBB or am335x_evm. We found the best approach for our development is to start with the -Template version of the board port kernel source in SDK 06 and incrementally add support from the -Base for those features we do have in common with the BBB & am335x_evm.

We'd like to enable the i2c0 peripheral for use in user space and have added the following code to /arch/arm/mach-omap2/board-am335xevm.c

#ifdef CONFIG_OMAP_MUX

static struct omap_board_mux board_mux[] __initdata = {
     /*
     * Setting SYSBOOT[5] should set xdma_event_intr0 pin to mode 3 thereby
     * allowing clkout1 to be available on xdma_event_intr0.
     * However, on some boards (like EVM-SK), SYSBOOT[5] isn't properly
     * latched.
     * To be extra cautious, setup the pin-mux manually.
     * If any modules/usecase requries it in different mode, then subsequent
     * module init call will change the mux accordingly.
     */
     /*AM33XX_MUX(XDMA_EVENT_INTR0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT),*/
     AM33XX_MUX(I2C0_SDA, OMAP_MUX_MODE0 | AM33XX_SLEWCTRL_SLOW |
               AM33XX_INPUT_EN | AM33XX_PIN_OUTPUT),
     AM33XX_MUX(I2C0_SCL, OMAP_MUX_MODE0 | AM33XX_SLEWCTRL_SLOW |
               AM33XX_INPUT_EN | AM33XX_PIN_OUTPUT),
     { .reg_offset = OMAP_MUX_TERMINATOR },
};
#else
#define     board_mux     NULL
#endif
As well as in static void __init am335x_evm_init(void) function replaced  am33xx_mux_init(NULL); with am33xx_mux_init(board_mux);
These changes alone don't seem to be enough to make the kernel aware of the i2c0 peripheral. What are we missing?
Thank you.
Phillip
  • Hi,

    I will ask the Linux team to help on this.
  • Hello Phillip,

    It seems the initialization is missing.

    You can use the i2c2 for reference:

    Pinmuxing:

    static struct pinmux_config i2c2_pin_mux[] = {
    {"uart1_ctsn.i2c2_sda", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
    AM33XX_PULL_UP | AM33XX_INPUT_EN},
    {"uart1_rtsn.i2c2_scl", OMAP_MUX_MODE3 | AM33XX_SLEWCTRL_SLOW |
    AM33XX_PULL_UP | AM33XX_INPUT_EN},
    {NULL, 0},
    };


    Initialization:

    static struct i2c_board_info am335x_i2c2_boardinfo[] = {
    };
    
    static void i2c2_init(int evm_id, int profile)
    {
    setup_pin_mux(i2c2_pin_mux);
    omap_register_i2c_bus(3, 100, am335x_i2c2_boardinfo,
    ARRAY_SIZE(am335x_i2c2_boardinfo));
    return;
    }

    i2c2_init invocation:

    /* Beaglebone Black */
    static struct evm_dev_cfg beagleboneblack_dev_cfg[] = {
    {am335x_rtc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {clkout2_enable, DEV_ON_BASEBOARD, PROFILE_NONE},
    {tps65217_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {mmc1_emmc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {i2c2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {sgx_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {NULL, 0, 0},
    };

    Best regards,
    Kemal

  • Hi Kemal,

    Thank you for your response. I had originally posted this under the Linux forum:

    e2e.ti.com/.../1663802

    but copied to Sitara as I thought it might be more relevant here....there is an ongoing discussion in the Linux forum. Can you move this thread to so we're not duplicating efforts?

    Thanks!
    Phillip
  • Okay, I'll close this one as a duplicate of this thread e2e.ti.com/.../463197