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.

How to set i2c value at u-boot ( not from u-bood cmd)

Hello,

I want to switch an LED is connected to i2c IO Exander at address 0x20 and on i2c0 as soon as u-boot starts before booting the kernel.

I have tried to add i2c_write() function in evm.c but I always get undefined reference to `i2c_write' when I try to compile. I added the <i2c.h> to the evm.c file but no luck.

Any suggestions?

Thanks in advance.

Best,


Hazar

  • Hi Hazar,

    Are you using EZSDK5.05.02.00 / PSP04.04.00.01?

    In u-boot-2010.06-psp04.04.00.01/board/ti/ti8148/evm.c we have only I2C0 clock enable, nothing more:

    __raw_writel(0x2, CM_ALWON_I2C_0_CLKCTRL);
    while(__raw_readl(CM_ALWON_I2C_0_CLKCTRL) != 0x2);

    As you noticed, I2C0 registers are described in the <i2c.h> file:

    u-boot-2010.06-psp04.04.00.01/arch/arm/include/asm/arch-ti81xx/i2c.h

    But in this i2c.h file we do not have I2C related functions, like i2c_write(). We have only base addresses, registers addresses and bits definitions.

    The I2C functions, like i2c_write(), are defined in the u-boot-2010.06-psp04.04.00.01/drivers/i2c/omap24xx_i2c.c file. So you should use the functions from this omap24xx_i2c.c file, note the CONFIG_TI81XX reference from this file.

    Regards,
    Pavel

  • Guessing from your other thread that you are using DM8148. No experience with the DM8148. From reading the wiki, that processor uses two stages of u-boot. The 1st stage does not have I2C support enabled to keep the size down. The 2nd stage should have I2C support enabled. I assume you are modifying the 1st stage. Your might be able to add I2C support to the 1st stage but the image might grow too big. See the CONFIG_I2C define in your config header file in u-boot for your board.

  • Thank you for the replies,

    Indeed what I wanted to do is to be done in 1st stage, and I2C support wasn't enabled. I set CONFIG_I2C 1 in 1st stage and my code compiles now. Lets see how it goes with the u-boot size and functionality.

  • I also want to add support of I2C_write in first stage uboot.

    I enable CONFIG_I2C in first stage uboot. but this make uboot min size over 110kb.

    Is there any other way to add i2c write support??

  • Vaibhav Dhingani said:

    I enable CONFIG_I2C in first stage uboot. but this make uboot min size over 110kb.

    Is there any other way to add i2c write support??

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/378635/1332902.aspx#1332902

    BR
    Pavel