[U-Boot] [PATCH 08/42] board: freescale: ls1012aqds: support dm_i2c_* API
Biwen Li
biwen.li at nxp.com
Thu Nov 14 10:36:07 UTC 2019
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 at nxp.com>
---
board/freescale/ls1012aqds/ls1012aqds.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
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
--
2.17.1
More information about the U-Boot
mailing list