pico-imx7d: Convert to DM_I2C and DM_PMIC
authorFabio Estevam <festevam@denx.de>
Tue, 3 Jan 2023 13:19:40 +0000 (10:19 -0300)
committerStefano Babic <sbabic@denx.de>
Tue, 31 Jan 2023 07:36:52 +0000 (08:36 +0100)
The conversion to DM_I2C is mandatory, so convert to it
and also to DM_PMIC.

Signed-off-by: Fabio Estevam <festevam@denx.de>
board/technexion/pico-imx7d/pico-imx7d.c
configs/pico-dwarf-imx7d_defconfig
configs/pico-hobbit-imx7d_defconfig
configs/pico-imx7d_bl33_defconfig
configs/pico-imx7d_defconfig
configs/pico-nymph-imx7d_defconfig
configs/pico-pi-imx7d_defconfig
include/configs/pico-imx7d.h

index 7db34abcb1e71b4cd44890b3d774e9039ce7d441..6e98b85b2873c1e584ac2ff4cc7b82e121fffc1e 100644 (file)
 #include <asm/global_data.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
-#include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
 #include <common.h>
-#include <i2c.h>
 #include <miiphy.h>
 #include <power/pmic.h>
 #include <power/pfuze3000_pmic.h>
@@ -27,27 +25,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define UART_PAD_CTRL  (PAD_CTL_DSE_3P3V_49OHM | \
        PAD_CTL_PUS_PU100KOHM | PAD_CTL_HYS)
 
-#define I2C_PAD_CTRL    (PAD_CTL_DSE_3P3V_32OHM | PAD_CTL_SRE_SLOW | \
-       PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PUS_PU100KOHM)
-
-#ifdef CONFIG_SYS_I2C_MXC
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-
-/* I2C4 for PMIC */
-static struct i2c_pads_info i2c_pad_info4 = {
-       .scl = {
-               .i2c_mode = MX7D_PAD_SAI1_RX_SYNC__I2C4_SCL | PC,
-               .gpio_mode = MX7D_PAD_SAI1_RX_SYNC__GPIO6_IO16 | PC,
-               .gp = IMX_GPIO_NR(6, 16),
-       },
-       .sda = {
-               .i2c_mode = MX7D_PAD_SAI1_RX_BCLK__I2C4_SDA | PC,
-               .gpio_mode = MX7D_PAD_SAI1_RX_BCLK__GPIO6_IO17 | PC,
-               .gp = IMX_GPIO_NR(6, 17),
-       },
-};
-#endif
-
 int dram_init(void)
 {
        gd->ram_size = imx_ddr_size();
@@ -60,50 +37,43 @@ int dram_init(void)
        return 0;
 }
 
-#if CONFIG_IS_ENABLED(POWER_LEGACY)
-#define I2C_PMIC       3
+#if CONFIG_IS_ENABLED(DM_PMIC)
 int power_init_board(void)
 {
-       struct pmic *p;
+       struct udevice *dev;
+       int reg, rev_id;
        int ret;
-       unsigned int reg, rev_id;
-
-       ret = power_pfuze3000_init(I2C_PMIC);
-       if (ret)
-               return ret;
 
-       p = pmic_get("PFUZE3000");
-       ret = pmic_probe(p);
-       if (ret) {
-               printf("Warning:  Cannot find PMIC PFUZE3000\n");
-               printf("\tPower consumption is not optimized.\n");
+       ret = pmic_get("pfuze3000@8", &dev);
+       if (ret == -ENODEV)
                return 0;
-       }
+       if (ret != 0)
+               return ret;
 
-       pmic_reg_read(p, PFUZE3000_DEVICEID, &reg);
-       pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
-       printf("PMIC:  PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
+       reg = pmic_reg_read(dev, PFUZE3000_DEVICEID);
+       rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
+       printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
 
        /* disable Low Power Mode during standby mode */
-       pmic_reg_read(p, PFUZE3000_LDOGCTL, &reg);
+       reg = pmic_reg_read(dev, PFUZE3000_LDOGCTL);
        reg |= 0x1;
-       pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
+       pmic_reg_write(dev, PFUZE3000_LDOGCTL, reg);
 
        /* SW1A/1B mode set to APS/APS */
        reg = 0x8;
-       pmic_reg_write(p, PFUZE3000_SW1AMODE, reg);
-       pmic_reg_write(p, PFUZE3000_SW1BMODE, reg);
+       pmic_reg_write(dev, PFUZE3000_SW1AMODE, reg);
+       pmic_reg_write(dev, PFUZE3000_SW1BMODE, reg);
 
        /* SW1A/1B standby voltage set to 1.025V */
        reg = 0xd;
-       pmic_reg_write(p, PFUZE3000_SW1ASTBY, reg);
-       pmic_reg_write(p, PFUZE3000_SW1BSTBY, reg);
+       pmic_reg_write(dev, PFUZE3000_SW1ASTBY, reg);
+       pmic_reg_write(dev, PFUZE3000_SW1BSTBY, reg);
 
        /* decrease SW1B normal voltage to 0.975V */
-       pmic_reg_read(p, PFUZE3000_SW1BVOLT, &reg);
+       reg = pmic_reg_read(dev, PFUZE3000_SW1BVOLT);
        reg &= ~0x1f;
        reg |= PFUZE3000_SW1AB_SETP(975);
-       pmic_reg_write(p, PFUZE3000_SW1BVOLT, reg);
+       pmic_reg_write(dev, PFUZE3000_SW1BVOLT, reg);
 
        return 0;
 }
@@ -168,10 +138,6 @@ int board_early_init_f(void)
 {
        setup_iomux_uart();
 
-#ifdef CONFIG_SYS_I2C_MXC
-       setup_i2c(3, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info4);
-#endif
-
        return 0;
 }
 
index 2d84e0bbec5e7f0fc1484a04a73c12194ce5e745..13e8d0c27fe6088467017767ba99193034e2a43f 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
-CONFIG_SYS_I2C_MXC_I2C4=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
 CONFIG_TARGET_PICO_IMX7D=y
@@ -30,7 +26,6 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_I2C=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
@@ -66,8 +61,7 @@ CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -80,9 +74,9 @@ CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
-CONFIG_POWER_LEGACY=y
 CONFIG_POWER_PFUZE3000=y
-CONFIG_POWER_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
index 143e7d0f8453d3e986ea9bda204bb986a4a195f4..63c168eeab8e1339b3fbf893e41c98a98044cf13 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
-CONFIG_SYS_I2C_MXC_I2C4=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
 CONFIG_TARGET_PICO_IMX7D=y
@@ -30,7 +26,6 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_I2C=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
@@ -66,8 +61,7 @@ CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -79,8 +73,8 @@ CONFIG_FEC_MXC=y
 CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
-CONFIG_PINCTRL_IMX7=y
-CONFIG_POWER_LEGACY=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_POWER_PFUZE3000=y
 CONFIG_POWER_I2C=y
 CONFIG_DM_SERIAL=y
index 2dcbb4352f3816cb9590f8af926d34a74c2b34eb..bfe0149befce28de2d936f5266fa6a6c53a35c08 100644 (file)
@@ -6,10 +6,6 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
-CONFIG_SYS_I2C_MXC_I2C4=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
 CONFIG_TARGET_PICO_IMX7D=y
@@ -31,7 +27,6 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_I2C=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
@@ -63,8 +58,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_DFU_MMC=y
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
@@ -75,8 +69,8 @@ CONFIG_FEC_MXC=y
 CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
-CONFIG_PINCTRL_IMX7=y
-CONFIG_POWER_LEGACY=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_POWER_PFUZE3000=y
 CONFIG_POWER_I2C=y
 CONFIG_CONS_INDEX=4
index 1a818efe233170b68231eca163598da0745df1a7..a4367db461aab09cb0a2ae981063d0276755b374 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
-CONFIG_SYS_I2C_MXC_I2C4=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
 CONFIG_TARGET_PICO_IMX7D=y
@@ -30,7 +26,6 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_I2C=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
@@ -66,8 +61,7 @@ CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -80,9 +74,9 @@ CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
-CONFIG_POWER_LEGACY=y
 CONFIG_POWER_PFUZE3000=y
-CONFIG_POWER_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
index 2d84e0bbec5e7f0fc1484a04a73c12194ce5e745..13e8d0c27fe6088467017767ba99193034e2a43f 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
-CONFIG_SYS_I2C_MXC_I2C4=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
 CONFIG_TARGET_PICO_IMX7D=y
@@ -30,7 +26,6 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_I2C=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
@@ -66,8 +61,7 @@ CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -80,9 +74,9 @@ CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
-CONFIG_POWER_LEGACY=y
 CONFIG_POWER_PFUZE3000=y
-CONFIG_POWER_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
index 5709fcfe64687130c251757a6d14d0c6a7539c05..4f07e53b808dda60bb05581750fcb979f04bdae6 100644 (file)
@@ -7,10 +7,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xC0000
-CONFIG_SYS_I2C_MXC_I2C1=y
-CONFIG_SYS_I2C_MXC_I2C2=y
-CONFIG_SYS_I2C_MXC_I2C3=y
-CONFIG_SYS_I2C_MXC_I2C4=y
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx7d-pico-pi"
 CONFIG_TARGET_PICO_IMX7D=y
@@ -30,7 +26,6 @@ CONFIG_SPL_MAX_SIZE=0xe000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
 CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SYS_SPL_MALLOC=y
-CONFIG_SPL_I2C=y
 CONFIG_SPL_USB_HOST=y
 CONFIG_SPL_USB_GADGET=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
@@ -66,8 +61,7 @@ CONFIG_FASTBOOT_BUF_SIZE=0x10000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
-CONFIG_SYS_I2C_LEGACY=y
-CONFIG_SPL_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MXC=y
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
@@ -80,9 +74,9 @@ CONFIG_RGMII=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
-CONFIG_POWER_LEGACY=y
 CONFIG_POWER_PFUZE3000=y
-CONFIG_POWER_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_SERIAL=y
 CONFIG_MXC_UART=y
 CONFIG_IMX_THERMAL=y
index 5774184300c2adcf4184af63bffd1a5b55705ff6..096e5bbe663f88ccc79130e756d9bec94b16f294 100644 (file)
@@ -97,9 +97,6 @@
 #define CFG_SYS_INIT_RAM_ADDR  IRAM_BASE_ADDR
 #define CFG_SYS_INIT_RAM_SIZE  IRAM_SIZE
 
-/* PMIC */
-#define CFG_POWER_PFUZE3000_I2C_ADDR   0x08
-
 /* FLASH and environment organization */
 
 /* Environment starts at 768k = 768 * 1024 = 786432 */