Message ID | 20191114103641.34085-8-biwen.li@nxp.com |
---|---|
State | Changes Requested |
Delegated to: | Priyanka Jain |
Headers | show |
Series | [U-Boot,01/42] configs: ls1012a: enable CONFIG_DM_I2C | expand |
>-----Original Message----- >From: Biwen Li <biwen.li@nxp.com> >Sent: Thursday, November 14, 2019 4:06 PM >To: Jagdish Gediya <jagdish.gediya@nxp.com>; Priyanka Jain ><priyanka.jain@nxp.com>; hs@denx.de; jagan@amarulasolutions.com; >aford173@gmail.com; Alison Wang <alison.wang@nxp.com>; >bhaskar.upadhaya@nxp.com; feng.li_2@nxp.com; jh80.chung@samsung.com; >Pramod Kumar <pramod.kumar_1@nxp.com>; Rajesh Bhagat ><rajesh.bhagat@nxp.com>; Ruchika Gupta <ruchika.gupta@nxp.com>; >olteanv@gmail.com >Cc: Xiaobo Xie <xiaobo.xie@nxp.com>; Jiafei Pan <jiafei.pan@nxp.com>; u- >boot@lists.denx.de; Biwen Li <biwen.li@nxp.com> >Subject: [PATCH 08/42] board: freescale: ls1012aqds: support dm_i2c_* API > >This supports dm_i2c_* API to >fix compilation error when >enabled CONFIG_DM_I2C as follows: > - board/freescale/ls1012aqds/built-in.o: In function `misc_init_r: > board/freescale/ls1012aqds/ls1012aqds.c:111: undefined reference >to > `i2c_set_bus_num' > board/freescale/ls1012aqds/ls1012aqds.c:113: undefined reference >to > `i2c_write' > If this compilation error is introduced by one of your patch, merge with that. >Signed-off-by: Biwen Li <biwen.li@nxp.com> >--- <snip> -priyankajain
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index 86c72ee357..30bf1047d5 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -107,10 +107,26 @@ int board_early_init_f(void) int misc_init_r(void) { u8 mux_sdhc_cd = 0x80; - - i2c_set_bus_num(0); + int bus_num = 0; + +#ifdef CONFIG_DM_I2C + struct udevice *dev; + int ret; + + ret = i2c_get_chip_for_busnum(bus_num, CONFIG_SYS_I2C_FPGA_ADDR, + 1, &dev); + if (ret) { + printf("%s: Cannot find udev for a bus %d\n", __func__, + bus_num); + return ret; + } + dm_i2c_write(dev, 0x5a, &mux_sdhc_cd, 1); +#else + i2c_set_bus_num(bus_num); i2c_write(CONFIG_SYS_I2C_FPGA_ADDR, 0x5a, 1, &mux_sdhc_cd, 1); +#endif + return 0; } #endif
This supports dm_i2c_* API to fix compilation error when enabled CONFIG_DM_I2C as follows: - board/freescale/ls1012aqds/built-in.o: In function `misc_init_r: board/freescale/ls1012aqds/ls1012aqds.c:111: undefined reference to `i2c_set_bus_num' board/freescale/ls1012aqds/ls1012aqds.c:113: undefined reference to `i2c_write' Signed-off-by: Biwen Li <biwen.li@nxp.com> --- board/freescale/ls1012aqds/ls1012aqds.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)