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.

u-boot map register access

Hi, I'm trying to read/write some register of am335x, but it is some odd, because some registers I get access and other the read command hangs u-boot. The target is configure i2c-2.

when I access i2c-1 everything works fine.

address range:0x4802_A000 0x4802_AFFF 4KB I2C1 Registers

example: readw(0x4802A000);

but i2c-2 hangs.

0x4819_C000 0x4819_CFFF 4KB I2C2 Registers

example: readw(0x4819C000);

that happens with other registers too. how can I enable to access the i2c-2 registers to proper init i2c-2 with i2c_init() function?

* package version: am335x_6.00

* Datasheet with register map: SPRUH73I – October 2011 – Revised August 2013

  • Hi Daniel,

    The usual cause for being unable to access the registers of a given peripheral is that the clock to that peripheral has not been enabled beforehand.

  • You are right Biser.

    Detail: I need put the code in this way to it works:

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

    i2c_set_bus_num(CONFIG_SYS_I2C_SLAVE_2);
    i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE_2);

    that is: the clock activate a little bit before i2c-2 init, the old code (that does not work) the clock activate was do it much more early.

    thanks Biser!