summaryrefslogtreecommitdiffstats
path: root/board/freescale
diff options
context:
space:
mode:
authorBiwen Li <biwen.li@nxp.com>2020-05-01 20:04:19 +0800
committerPriyanka Jain <priyanka.jain@nxp.com>2020-05-04 09:12:36 +0530
commit8e4be6dfb755bda97bea4d4b211c4aaabe08b730 (patch)
tree336a073962174db68cd041f77255f23625eebdf1 /board/freescale
parent30ea84768b678c64fbd890b952b719bf3b8d9dc0 (diff)
downloadu-boot-8e4be6dfb755bda97bea4d4b211c4aaabe08b730.tar.gz
u-boot-8e4be6dfb755bda97bea4d4b211c4aaabe08b730.tar.xz
u-boot-8e4be6dfb755bda97bea4d4b211c4aaabe08b730.zip
dm: powerpc: T2080/T2081: add i2c DM support
This supports i2c DM for SoC T2080/T2081 Signed-off-by: Biwen Li <biwen.li@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'board/freescale')
-rw-r--r--board/freescale/t208xqds/t208xqds.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c
index 79cc1543f9..9100401022 100644
--- a/board/freescale/t208xqds/t208xqds.c
+++ b/board/freescale/t208xqds/t208xqds.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2009-2013 Freescale Semiconductor, Inc.
+ * Copyright 2020 NXP
*/
#include <common.h>
@@ -75,11 +76,23 @@ int checkboard(void)
return 0;
}
-int select_i2c_ch_pca9547(u8 ch)
+int select_i2c_ch_pca9547(u8 ch, int bus_num)
{
int ret;
+#ifdef CONFIG_DM_I2C
+ struct udevice *dev;
+
+ ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, 1, &dev);
+ if (ret) {
+ printf("%s: Cannot find udev for a bus %d\n", __func__,
+ bus_num);
+ return ret;
+ }
+ ret = dm_i2c_write(dev, 0, &ch, 1);
+#else
ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1);
+#endif
if (ret) {
puts("PCA: failed to select proper channel\n");
return ret;
@@ -90,7 +103,7 @@ int select_i2c_ch_pca9547(u8 ch)
int i2c_multiplexer_select_vid_channel(u8 channel)
{
- return select_i2c_ch_pca9547(channel);
+ return select_i2c_ch_pca9547(channel, 0);
}
int brd_mux_lane_to_slot(void)
@@ -368,7 +381,7 @@ int board_early_init_r(void)
printf("Warning: Adjusting core voltage failed.\n");
brd_mux_lane_to_slot();
- select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
+ select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0);
return 0;
}