[U-Boot] [PATCH] i2c: mxc: Hide kconfig based control in DM_I2C mode
Heiko Schocher
hs at denx.de
Mon May 6 08:58:52 UTC 2019
Hello Trent,
Am 03.05.2019 um 22:16 schrieb Trent Piepho:
> 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();
>
For this special case and for me, this is ok.
If nobody objects here, I would pick this change in conjunction with
your original patch ... or you sent a formal v2 ?
Thanks!
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
More information about the U-Boot
mailing list