summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorChuanhua Han <chuanhua.han@nxp.com>2019-07-10 21:16:49 +0800
committerPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>2019-08-22 09:07:35 +0530
commit954cd7882857c64158de8d90660f490b0b136b7a (patch)
tree9887181dcd9fe12c668cd4f71ae4a84480385c12 /board
parent7abf9c16aa5f153903914620dc3062fa3bddef65 (diff)
boards: ls1028a: Add support of I2C driver model
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 ls1028a platform does not support dm. Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com> Reviewed-by: Alex Marginean <alexm.osslist@gmail.com> Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Diffstat (limited to 'board')
-rw-r--r--board/freescale/ls1028a/ls1028a.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c
index 4aa7cec9ce..1410d0f920 100644
--- a/board/freescale/ls1028a/ls1028a.c
+++ b/board/freescale/ls1028a/ls1028a.c
@@ -73,7 +73,15 @@ int board_init(void)
#if defined(CONFIG_TARGET_LS1028ARDB)
u8 val = I2C_MUX_CH_DEFAULT;
+#ifndef CONFIG_DM_I2C
i2c_write(I2C_MUX_PCA_ADDR_PRI, 0x0b, 1, &val, 1);
+#else
+ struct udevice *dev;
+
+ if (!i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev))
+ dm_i2c_write(dev, 0x0b, &val, 1);
+#endif
+
#endif
return 0;
}