wandboard: Don't use I2C speed Kconfig settings with DM_I2C
authorTrent Piepho <tpiepho@impinj.com>
Wed, 8 May 2019 23:30:01 +0000 (23:30 +0000)
committerHeiko Schocher <hs@denx.de>
Fri, 17 May 2019 03:35:24 +0000 (05:35 +0200)
When using DM_I2C the speed value supplied to setup_i2c() is not used,
so this code required CONFIG_SYS_MXC_I2C[12]_SPEED to be defined to
compile, but did not actually use them.

Change this so we no longer need to define an unused macro to compile in
DM_I2C mode.  Also make it more clear that they do not control the bus
speed.  Otherwise it is quite easy to mistakenly believe they are used
to set the bus speed.

Cc: Heiko Schocher <hs@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
board/wandboard/wandboard.c

index 69fbc8b690797a658aa117d5d29040effc447428..9d7a94ff9d9874577c377526900a7ab387cce8b1 100644 (file)
@@ -46,6 +46,15 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ETH_PHY_AR8035_POWER   IMX_GPIO_NR(7, 13)
 #define REV_DETECTION          IMX_GPIO_NR(2, 28)
 
+/* Speed defined in Kconfig is only applicable when not using DM_I2C.  */
+#ifdef CONFIG_DM_I2C
+#define I2C1_SPEED_NON_DM      0
+#define I2C2_SPEED_NON_DM      0
+#else
+#define I2C1_SPEED_NON_DM      CONFIG_SYS_MXC_I2C1_SPEED
+#define I2C2_SPEED_NON_DM      CONFIG_SYS_MXC_I2C2_SPEED
+#endif
+
 static bool with_pmic;
 
 int dram_init(void)
@@ -463,13 +472,13 @@ int board_init(void)
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
 #if defined(CONFIG_VIDEO_IPUV3)
-       setup_i2c(1, CONFIG_SYS_MXC_I2C1_SPEED, 0x7f, &mx6dl_i2c2_pad_info);
+       setup_i2c(1, I2C1_SPEED_NON_DM, 0x7f, &mx6dl_i2c2_pad_info);
        if (is_mx6dq() || is_mx6dqp()) {
-               setup_i2c(1, CONFIG_SYS_MXC_I2C1_SPEED, 0x7f, &mx6q_i2c2_pad_info);
-               setup_i2c(2, CONFIG_SYS_MXC_I2C2_SPEED, 0x7f, &mx6q_i2c3_pad_info);
+               setup_i2c(1, I2C1_SPEED_NON_DM, 0x7f, &mx6q_i2c2_pad_info);
+               setup_i2c(2, I2C2_SPEED_NON_DM, 0x7f, &mx6q_i2c3_pad_info);
        } else {
-               setup_i2c(1, CONFIG_SYS_MXC_I2C1_SPEED, 0x7f, &mx6dl_i2c2_pad_info);
-               setup_i2c(2, CONFIG_SYS_MXC_I2C2_SPEED, 0x7f, &mx6dl_i2c3_pad_info);
+               setup_i2c(1, I2C1_SPEED_NON_DM, 0x7f, &mx6dl_i2c2_pad_info);
+               setup_i2c(2, I2C2_SPEED_NON_DM, 0x7f, &mx6dl_i2c3_pad_info);
        }
 
        setup_display();