From patchwork Mon Mar 2 08:44:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 243161 List-Id: U-Boot discussion From: hs at denx.de (Heiko Schocher) Date: Mon, 2 Mar 2020 09:44:03 +0100 Subject: [PATCH] imx6, aristainetos2c: add da9063 pmic setup Message-ID: <20200302084403.1861514-1-hs@denx.de> On the aristainetos2c boards the PMIC needs to be initialized, because the Ethernet PHY uses a different regulator that is not setup per hardware default. This does not influence the other versions as this regulator isn't used there at all. Signed-off-by: Heiko Schocher --- board/aristainetos/aristainetos.c | 56 +++++++++++++++++++++++++++++++ configs/aristainetos2c_defconfig | 3 ++ 2 files changed, 59 insertions(+) diff --git a/board/aristainetos/aristainetos.c b/board/aristainetos/aristainetos.c index 3541717873..70671039c2 100644 --- a/board/aristainetos/aristainetos.c +++ b/board/aristainetos/aristainetos.c @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include #include @@ -438,6 +441,56 @@ static void aristainetos_bootmode_settings(void) } } +#if defined(CONFIG_DM_PMIC_DA9063) +/* + * On the aristainetos2c boards the PMIC needs to be initialized, + * because the Ethernet PHY uses a different regulator that is not + * setup per hardware default. This does not influence the other versions + * as this regulator isn't used there at all. + * + * Unfortunately we have not yet a interface to setup all + * values we need. + */ +static int setup_pmic_voltages(void) +{ + struct udevice *dev; + int off; + int ret; + + off = fdt_path_offset(gd->fdt_blob, "pmic0"); + if (off < 0) { + printf("%s: No pmic path offset\n", __func__); + return off; + } + + ret = uclass_get_device_by_of_offset(UCLASS_PMIC, off, &dev); + if (ret) { + printf("%s: Could not find PMIC\n", __func__); + return ret; + } + + pmic_reg_write(dev, DA9063_REG_PAGE_CON, 0x01); + pmic_reg_write(dev, DA9063_REG_BPRO_CFG, 0xc1); + ret = pmic_reg_read(dev, DA9063_REG_BUCK_ILIM_B); + if (ret < 0) { + printf("%s: error %d get register\n", __func__, ret); + return ret; + } + ret &= 0xf0; + ret |= 0x09; + pmic_reg_write(dev, DA9063_REG_BUCK_ILIM_B, ret); + pmic_reg_write(dev, DA9063_REG_VBPRO_A, 0x43); + pmic_reg_write(dev, DA9063_REG_VBPRO_B, 0xc3); + + return 0; +} +#else +static int setup_pmic_voltages(void) +{ + return 0; +} +#endif + int board_late_init(void) { int x, y; @@ -457,6 +510,9 @@ int board_late_init(void) else env_set("board_type", ARI_BT_7); + if (setup_pmic_voltages()) + printf("Error setup PMIC\n"); + return 0; } diff --git a/configs/aristainetos2c_defconfig b/configs/aristainetos2c_defconfig index c6d92251ce..8611915877 100644 --- a/configs/aristainetos2c_defconfig +++ b/configs/aristainetos2c_defconfig @@ -87,7 +87,10 @@ CONFIG_PHY=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_DM_PMIC=y +# CONFIG_SPL_PMIC_CHILDREN is not set +CONFIG_DM_PMIC_DA9063=y CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_DA9063=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_PWM=y CONFIG_PWM_IMX=y