summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBraden Kell <bradenkell@google.com>2018-06-04 15:44:36 -0700
committerJi Luo <ji.luo@nxp.com>2018-08-20 21:25:46 +0800
commit89e54e221c1bfd724b488b942bdb8f08efbd41fc (patch)
treeff5feb0421ae85284abf8aabc791bd67f8df0e30
parent91178a326f4d7acb13fa16afaa228d03236586b6 (diff)
[iot] Move i2c_setup calls to board_init
i2c_setup calls force_idle_bus which calls get_timer if SDA and SCL are not high. On the Pico baseboard there are level shifters that pull SDA and SCL high, but the test harness does not have pull-ups on these lines. Because board_early_init_f is called before timer_init the call to get_timer was causing a divide-by-zero error due to CNTFRQ not being initialized. Moving the i2c_setup calls to board_init fixes this issue. power_init_board (which uses I2C to configure the PMIC) is called after board_init, so this should be safe. Bug: Test: PMIC registers are read correctly on both boards (DEV_ID=0x30 REV_ID=0x11) Test: iMX7D SOM boots on Pico baseboard Test: iMX7D SOM boots on test harness Change-Id: Iecdd28f3177fe915a3b614565d8dfa6e20e6a842
-rw-r--r--board/technexion/pico-imx7d/pico-imx7d.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/board/technexion/pico-imx7d/pico-imx7d.c b/board/technexion/pico-imx7d/pico-imx7d.c
index cb809b1c1ac..7b4d14d7767 100644
--- a/board/technexion/pico-imx7d/pico-imx7d.c
+++ b/board/technexion/pico-imx7d/pico-imx7d.c
@@ -544,13 +544,6 @@ void board_late_mmc_init(void)
int board_early_init_f(void)
{
setup_iomux_uart();
-
-#ifdef CONFIG_SYS_I2C_MXC
- setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
- setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
- setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info4);
-#endif
-
return 0;
}
@@ -566,6 +559,12 @@ int board_init(void)
setup_fec();
#endif
+#ifdef CONFIG_SYS_I2C_MXC
+ setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
+ setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
+ setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info4);
+#endif
+
//pico-imx7 custom initialize
imx_iomux_v3_setup_multiple_pads(bcm4339_pads, ARRAY_SIZE(bcm4339_pads));
imx_iomux_v3_setup_multiple_pads(ccm_clko_pads, ARRAY_SIZE(ccm_clko_pads));