]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
boards: ls2088a: Add support of I2C driver model.
authorChuanhua Han <chuanhua.han@nxp.com>
Mon, 22 Jul 2019 08:36:42 +0000 (16:36 +0800)
committerPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Thu, 22 Aug 2019 03:37:35 +0000 (09:07 +0530)
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM
I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for
compilation, a compilation error will be generated. This patch
solves the problem that the i2c-related api of the ls2088a platform
does not support dm.

Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com>
Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
board/freescale/ls2080ardb/ls2080ardb.c
include/configs/ls2080a_common.h
include/configs/ls2080ardb.h

index e000b1fd51174403535be2edb25c608c4139e3f6..e20267f27ce06d35d40d1f1737198062fc9e73a2 100644 (file)
@@ -164,7 +164,16 @@ int select_i2c_ch_pca9547(u8 ch)
 {
        int ret;
 
+#ifndef CONFIG_DM_I2C
        ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
+#else
+       struct udevice *dev;
+
+       ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
+       if (!ret)
+               ret = dm_i2c_write(dev, 0, &ch, 1);
+#endif
+
        if (ret) {
                puts("PCA: failed to select proper channel\n");
                return ret;
index c7d8a3b6eb6c9fa4be779f5824ee3ba80aec8045..6be581a229ca19e16c0980eb6a7a854f3a632009 100644 (file)
@@ -75,7 +75,9 @@
 #define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 2048 * 1024)
 
 /* I2C */
+#ifndef CONFIG_DM_I2C
 #define CONFIG_SYS_I2C
+#endif
 
 /* Serial Port */
 #define CONFIG_SYS_NS16550_SERIAL
index bfb54be79b998a3c842498375307fbc791b91565..2bf82176858813d7f975ae495e478cad680270db 100644 (file)
 #ifdef CONFIG_TARGET_LS2081ARDB
 #define CONFIG_QIXIS_I2C_ACCESS
 #endif
+#ifndef CONFIG_DM_I2C
 #define CONFIG_SYS_I2C_EARLY_INIT
 #endif
+#endif
 
 #define I2C_MUX_CH_VOL_MONITOR         0xa
 #define I2C_VOL_MONITOR_ADDR           0x38