I2C command in 2014.01 u-boot on sabresd

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I2C command in 2014.01 u-boot on sabresd

Jump to solution
7,577 Views
jaiganesh
Contributor III

Hello all,

I am using sabresd with 2014.01 u-boot ("mx6qsabresd_config" configuration) and I got the u-boot prompt on the board. But there is no "i2c" command by default. And I tried to bring up the "i2c" command. For this, I added these lines in "include/configs/mx6sabresd.h" file (I referred LTIB BSP u-boot code which is 2009.08 version )

   /* I2C configs */

  #define CONFIG_CMD_I2C

  #define CONFIG_SYS_I2C         1

  #define CONFIG_I2C_MXC          1

  #define CONFIG_SYS_I2C_PORT             I2C2_BASE_ADDR

  #define CONFIG_SYS_I2C_SPEED            100000

  #define CONFIG_SYS_I2C_SLAVE            0x8

And with this settings, I got the u-boot prompt with i2c command but it is not working properly. Below is the attached boot log message:

U-Boot 2014.01 (Apr 23 2014 - 17:03:14)

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz

Reset cause: POR

Board: MX6-SabreSD

I2C:   Error, wrong i2c adapter 0 max 0 possible

ready

DRAM:  1 GiB

MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2

*** Warning - bad CRC, using default environment

Error, wrong i2c adapter 0 max 0 possible

Error, wrong i2c adapter 0 max 0 possible

auto-detected panel HDMI

Display: HDMI (1024x768)

In:    serial

Out:   serial

Err:   serial

Net:   FEC [PRIME]

Hit any key to stop autoboot:  0

=> i2c probe

Valid chip addresses:Error, wrong i2c adapter 0 max 0 possible

Error, wrong i2c adapter 0 max 0 possible

data abort

    MAYBE you should read doc/README.arm-unaligned-accesses

pc : [<4ffa0bf4>]          lr : [<4ff8d220>]

sp : 4f570dd8  ip : 00000034     fp : 00000000

r10: 00000002  r9 : 4f570f30     r8 : 4f876cc8

r7 : 00000000  r6 : ffffffff     r5 : 00000000  r4 : 4ffa0bd0

r3 : 00000083  r2 : 00000060     r1 : 00000000  r0 : 00000000

Flags: nZCv  IRQs off  FIQs off  Mode SVC_32

Resetting CPU ...

resetting ...

U-Boot 2014.01 (Apr 23 2014 - 17:03:14)

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz

Reset cause: WDOG

Board: MX6-SabreSD

I2C:   Error, wrong i2c adapter 0 max 0 possible

ready

DRAM:  1 GiB

MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2

*** Warning - bad CRC, using default environment

Error, wrong i2c adapter 0 max 0 possible

Error, wrong i2c adapter 0 max 0 possible

auto-detected panel HDMI

Display: HDMI (1024x768)

In:    serial

Out:   serial

Err:   serial

Net:   FEC [PRIME]

Hit any key to stop autoboot:  0

=>

As you can see, when I try for "i2c probe", the board is reset with "Error, wrong i2c adapter 0 max 0 possible" error message. Do I need any other configuration for "i2c" command to work properly?

Thanks in advance.

Labels (2)
Tags (2)
0 Kudos
1 Solution
2,206 Views
fabio_estevam
NXP Employee
NXP Employee

Niklas,

I have just tested with U-boot 2014.04 and the i2c commands work fine. You can apply this patch that adds pfuze100 pmic which is connected via i2c:

[U-Boot] [PATCH v3] mx6sabred: Add PFUZE100 PMIC support

View solution in original post

0 Kudos
9 Replies
2,206 Views
niklasmolin
Senior Contributor I

Hi Jai.

Did you manage to solve this problem?

I also have the same problem (right now using 2013.10).

When I tried to set something (speed) or do a probe, u-boot restarts.

U-Boot > i2c speed 100000

Setting bus speed to 100000 Hz

data abort

    MAYBE you should read doc/README.arm-unaligned-accesses

pc : [<4ff9ad30>]   lr : [<4ff9a75c>]

sp : 4f584e00  ip : 00000000 fp : 4f585860

r10: 4ffba700  r9 : 4f584f38 r8 : 00000003

r7 : 00000002  r6 : 4f5858a4 r5 : 4ffb983c  r4 : 00000000

r3 : 00000039  r2 : 00000300 r1 : 4ffae44c  r0 : 4ffae4dc

Flags: nzCv  IRQs off  FIQs off  Mode SVC_32

Resetting CPU ...

resetting ...

Thanks,

Niklas

0 Kudos
2,206 Views
jaiganesh
Contributor III

Hi Nilkas,

             For the post I made above, I made a small mistake in adding a line in ""include/configs/mx6sabresd.h". I added " #define CONFIG_I2C_MXC " but it must be "#define CONFIG_SYS_I2C_MXC". After changing this line i2c command works but "i2c probe" does not show any devices connected to it even after probing all the buses.

               But it works fine in 2014.04 u-boot with the patch posted by Fabio.[[U-Boot] [PATCH v3] mx6sabred: Add PFUZE100 PMIC support]. Please do try this.

0 Kudos
2,206 Views
fabio_estevam
NXP Employee
NXP Employee

Jai and  Niklas,

Glad to know that this issue has been resolved. Could you please mark my reply as 'Correct Answer'?

0 Kudos
2,207 Views
fabio_estevam
NXP Employee
NXP Employee

Niklas,

I have just tested with U-boot 2014.04 and the i2c commands work fine. You can apply this patch that adds pfuze100 pmic which is connected via i2c:

[U-Boot] [PATCH v3] mx6sabred: Add PFUZE100 PMIC support

0 Kudos
2,206 Views
niklasmolin
Senior Contributor I

Thanks Fabio.

I have a working version now that handles both I2C1 and I2C3 busses.

Regards,

Niklas

0 Kudos
2,206 Views
jaiganesh
Contributor III

Thanks Fabio.It works fine in 2014.04 u-boot with the above patch.

And for the post I made above, I made a small mistake in adding a line in ""include/configs/mx6sabresd.h". I added " #define CONFIG_I2C_MXC " but it must be "#define CONFIG_SYS_I2C_MXC". After changing this line i2c command works but "i2c probe" does not show any devices connected to it even after probing all the buses.

0 Kudos
2,206 Views
fabio_estevam
NXP Employee
NXP Employee

Take a look at mx6qsabreauto board in U-boot 2014.04 for a working reference.

0 Kudos
2,206 Views
jaiganesh
Contributor III

Hi Fabio,

I took mx6qsabrelite in 2014.01 as reference (where i2c is working fine in sabrelite baord) and looked at it. And i guess that the error we saw in the boot log is thrown from the file "drivers/i2c/i2c_core.c", in the function "i2c_set_bus_num()",  line

       

max = ll_entry_count(struct i2c_adapter, i2c);

if (I2C_ADAPTER(bus) >= max) {

  printf("Error, wrong i2c adapter %d max %d possible\n",

        I2C_ADAPTER(bus), max);

  return -2;

  }

I put some debug messages there and found that the variable "max" is set to 0 in case of sabresd, but in the case of sabrelite it is 3. This function is called from "arch/arm/lib/board.c" which is common to both sabrelite and sabresd and I guess no board specific confgiuration with respect to i2c is made before that function call. So I wonder how the "max" variable differs in these two cases. Meanwhile I googeled for "ll_entry_count" which specifies " returns the number of elements in the linker generated array" and I am not sure what is linker generated array.

And so I cannot guess what is the cause of this error. Can you guide me in this issue?

Thanks

0 Kudos
2,206 Views
fabio_estevam
NXP Employee
NXP Employee

You would better enter a post in the u-boot list.

0 Kudos