diff options
author | Biwen Li <biwen.li@nxp.com> | 2020-02-05 22:02:17 +0800 |
---|---|---|
committer | Priyanka Jain <priyanka.jain@nxp.com> | 2020-03-30 08:12:13 +0530 |
commit | bb1165f900088c796e254cc99c8f81d47e3d57c9 (patch) | |
tree | d2b7f39562aa8227b00601529a81b6848b0cd226 /board/freescale/ls1046afrwy | |
parent | fefac937fbd87f380042501c63b874994b3dccee (diff) | |
download | u-boot-bb1165f900088c796e254cc99c8f81d47e3d57c9.tar.gz |
dm: arm64: ls1046a: add i2c DM support
This supports i2c DM and enables CONFIG_DM_I2C
for SoC LS1046A
Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'board/freescale/ls1046afrwy')
-rw-r--r-- | board/freescale/ls1046afrwy/ls1046afrwy.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/board/freescale/ls1046afrwy/ls1046afrwy.c b/board/freescale/ls1046afrwy/ls1046afrwy.c index db8b3a5b92..8c0abb63a9 100644 --- a/board/freescale/ls1046afrwy/ls1046afrwy.c +++ b/board/freescale/ls1046afrwy/ls1046afrwy.c @@ -36,11 +36,24 @@ DECLARE_GLOBAL_DATA_PTR; -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; @@ -149,7 +162,7 @@ val = (in_le32(SMMU_SCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK); sec_init(); #endif - select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); + select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0); return 0; } |