AnsweredAssumed Answered

Using I2C api in uboot with 7ulp

Question asked by Arthur LAMBERT on Feb 14, 2020
Latest reply on Feb 28, 2020 by igorpadykov

Hi,

 

 I am using uboot from official repository Aurora : uboot-imx - i.MX U-Boot 

Tag : rel_imx_4.14.98_2.3.0

 

I am using the mx7ulp_10x10_arm2 defconfig. 

 

I would like to use i2c api in my board init code to drive a peripheral. 

I used to pilot i2c device with i2c_setup, i2c_write, etc...

 

Problem is that I have plenty of problem to used i2c api with 7ulp in uboot.

There is plenty of missing stuff in code. Is there a new I2C api in recent uboot ? LPI2C ?

 

Some example of my modification :

 

First to used I2C api from  i2c-mxv7.c, there is no define for 7ulp SOC, I have to add it :

 

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 1d13812b8a..2376fff7ab 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -54,6 +54,7 @@ ifeq ($(SOC),$(filter $(SOC),mx7ulp))
obj-y += cache.o
obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
obj-$(CONFIG_SECURE_BOOT) += hab.o
+obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
endif
ifeq ($(SOC),$(filter $(SOC),vf610))
obj-y += ddrmc-vf610.o

 

Then after including <asm/mach-imx/mxc_i2c.h> in my code, I have plenty of multiple define

from arch/arm/include/asm/mach-imx/iomux-v3.h. So I have to comment plenty of stuff

from iomux-v3.

 

In file included from ./arch/arm/include/asm/mach-imx/mxc_i2c.h:9:0,
from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:14:
./arch/arm/include/asm/mach-imx/iomux-v3.h:51:0: warning: "MUX_CTRL_OFS_MASK" redefined
#define MUX_CTRL_OFS_MASK ((iomux_v3_cfg_t)0xfff << MUX_CTRL_OFS_SHIFT)

In file included from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:12:0:
./arch/arm/include/asm/arch/iomux.h:48:0: note: this is the location of the previous definition
#define MUX_CTRL_OFS_MASK ((iomux_cfg_t)0xffff << MUX_CTRL_OFS_SHIFT)

In file included from ./arch/arm/include/asm/mach-imx/mxc_i2c.h:9:0,
from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:14:
./arch/arm/include/asm/mach-imx/iomux-v3.h:55:0: warning: "MUX_SEL_INPUT_OFS_SHIFT" redefined
#define MUX_SEL_INPUT_OFS_SHIFT 24

In file included from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:12:0:
./arch/arm/include/asm/arch/iomux.h:49:0: note: this is the location of the previous definition
#define MUX_SEL_INPUT_OFS_SHIFT 16

In file included from ./arch/arm/include/asm/mach-imx/mxc_i2c.h:9:0,
from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:14:
./arch/arm/include/asm/mach-imx/iomux-v3.h:56:0: warning: "MUX_SEL_INPUT_OFS_MASK" redefined
#define MUX_SEL_INPUT_OFS_MASK ((iomux_v3_cfg_t)0xfff << \

In file included from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:12:0:
./arch/arm/include/asm/arch/iomux.h:50:0: note: this is the location of the previous definition
#define MUX_SEL_INPUT_OFS_MASK ((iomux_cfg_t)0xffff << \

In file included from ./arch/arm/include/asm/mach-imx/mxc_i2c.h:9:0,
from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:14:
./arch/arm/include/asm/mach-imx/iomux-v3.h:59:0: warning: "MUX_MODE_SHIFT" redefined
#define MUX_MODE_SHIFT 36

In file included from board/freescale/mx7ulp_arm2/mx7ulp_arm2.c:12:0:
./arch/arm/include/asm/arch/iomux.h:53:0: note: this is the location of the previous definition
#define MUX_MODE_SHIFT 32

 

There is also no I2CX_BASE_ADDR available in include. Only LPI2CX_BASE_ADDR ?

 

Thanks,

Outcomes