imx6, aristainetos2c: add da9063 pmic setup

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 <hs@denx.de>
This commit is contained in:
Heiko Schocher 2020-03-02 09:44:03 +01:00 committed by Stefano Babic
parent 9f976bac2b
commit 158d93adb4
2 changed files with 59 additions and 0 deletions

View File

@ -30,6 +30,9 @@
#include <miiphy.h>
#include <lcd.h>
#include <led.h>
#include <power/pmic.h>
#include <power/regulator.h>
#include <power/da9063_pmic.h>
#include <splash.h>
#include <video_fb.h>
@ -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;
}

View File

@ -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