From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trent Piepho Date: Fri, 3 May 2019 20:16:07 +0000 Subject: [U-Boot] [PATCH] i2c: mxc: Hide kconfig based control in DM_I2C mode In-Reply-To: <20190502081127.7991b5e4@crub> References: <20190412191848.3123-1-tpiepho@impinj.com> <9d8dcbca-2741-ba4e-2221-d59341137666@denx.de> <1556644895.31309.24.camel@impinj.com> <20190502081127.7991b5e4@crub> Message-ID: <1556914566.31309.57.camel@impinj.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 2019-05-02 at 08:11 +0200, Anatolij Gustschin wrote: > Hi Heiko, > > On Thu, 2 May 2019 07:39:06 +0200 > Heiko Schocher hs at denx.de wrote: > ... > > > > @Anatolij: Is this code needed anymore, as board is moved to DM ? > > ... > > dm_i2c_probe should initialize the i2c bus completly, also we need > > not longer the: > > > > #ifdef CONFIG_DM_I2C > > > > and remove the else part ... or ? Can you test this change? > > The DM conversion is not complete yet and I still need the > possibility to revert to non-DM code for various video tests > to complete the DM_VIDEO/DM_I2C conversion, so that video > related stuff works on i.MX boards similar as before the > conversion. Unfortunately, I do not have time for this now, > this must wait. Sorry. > > Anatolij Would something like this be ok? It will allow removing the MXC hardcoded speeds when using DM_I2C. It also makes it more clear in wandboard.c that the speed is not used when using DM_I2C. --- a/board/wandboard/wandboard.c +++ b/board/wandboard/wandboard.c @@ -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();