]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: imx: mx5: Convert MX53 Menlo board to DM I2C and DM RTC
authorMarek Vasut <marex@denx.de>
Sun, 8 May 2022 00:19:12 +0000 (02:19 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 23 May 2022 09:37:58 +0000 (11:37 +0200)
Convert the board to DM I2C and DM RTC. This leads to removal of board
side iomuxc configuration, which is now done using pin control driver,
and conversion of board side legacy I2C accessors to DM ones.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
board/menlo/m53menlo/m53menlo.c
configs/m53menlo_defconfig

index 9545e633a3dc15daf39d8b6efa92fe6e1f617db7..61ab3844b87833a27ed0f3e4d1604c5ca26d784e 100644 (file)
@@ -226,16 +226,21 @@ static const char *lvds_compat_string;
 
 static int detect_lvds(struct display_info_t const *dev)
 {
+       struct udevice *idev, *ibus;
        u8 touchid[23];
        u8 *touchptr = &touchid[0];
        int ret;
 
-       ret = i2c_set_bus_num(0);
+       ret = uclass_get_device_by_seq(UCLASS_I2C, 0, &ibus);
+       if (ret)
+               return 0;
+
+       ret = dm_i2c_probe(ibus, 0x38, 0, &idev);
        if (ret)
                return 0;
 
        /* Touchscreen is at address 0x38, ID register is 0xbb. */
-       ret = i2c_read(0x38, 0xbb, 1, touchid, sizeof(touchid));
+       ret = dm_i2c_read(idev, 0xbb, touchid, sizeof(touchid));
        if (ret)
                return 0;
 
@@ -385,23 +390,6 @@ splasherr:
        return 0;
 }
 
-#define I2C_PAD_CTRL   (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \
-                        PAD_CTL_PUS_100K_UP | PAD_CTL_ODE)
-
-static void setup_iomux_i2c(void)
-{
-       static const iomux_v3_cfg_t i2c_pads[] = {
-               /* I2C1 */
-               NEW_PAD_CTRL(MX53_PAD_EIM_D28__I2C1_SDA, I2C_PAD_CTRL),
-               NEW_PAD_CTRL(MX53_PAD_EIM_D21__I2C1_SCL, I2C_PAD_CTRL),
-               /* I2C2 */
-               NEW_PAD_CTRL(MX53_PAD_EIM_D16__I2C2_SDA, I2C_PAD_CTRL),
-               NEW_PAD_CTRL(MX53_PAD_EIM_EB2__I2C2_SCL, I2C_PAD_CTRL),
-       };
-
-       imx_iomux_v3_setup_multiple_pads(i2c_pads, ARRAY_SIZE(i2c_pads));
-}
-
 static void setup_iomux_video(void)
 {
        static const iomux_v3_cfg_t lcd_pads[] = {
@@ -505,7 +493,6 @@ int board_early_init_f(void)
 {
        setup_iomux_uart();
        setup_iomux_fec();
-       setup_iomux_i2c();
        setup_iomux_nand();
        setup_iomux_video();
 
index df4907a82632209c86e7ea26e4b0c45016fce9d4..90d3e59e57d8189fcd0ad2d955fd3c47369c43a7 100644 (file)
@@ -11,9 +11,6 @@ CONFIG_NR_DRAM_BANKS=2
 CONFIG_ENV_SIZE=0x4000
 CONFIG_ENV_OFFSET=0x100000
 CONFIG_TARGET_M53MENLO=y
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx53-m53menlo"
 CONFIG_SPL_TEXT_BASE=0x70008000
@@ -53,7 +50,6 @@ CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_BMP=y
 CONFIG_CMD_BOOTCOUNT=y
-CONFIG_CMD_DATE=y
 CONFIG_CMD_BTRFS=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -75,8 +71,7 @@ CONFIG_VERSION_VARIABLE=y
 CONFIG_DM=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_ESDHC_IMX=y
 CONFIG_MTD=y
@@ -102,6 +97,7 @@ CONFIG_PINCTRL_IMX5=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_RTC=y
 CONFIG_RTC_M41T62=y
 CONFIG_MXC_UART=y
 CONFIG_SYSRESET=y