From eae4ce781c2c7a4f503a9b42b9da27b1ba91ba15 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Mon, 12 Oct 2020 14:58:39 +0200 Subject: verdin-imx8mm: spl: add pca9450 pmic V1.1A HW switched the PMIC from BD71837 to PCA9450. - If only one PMIC is configured in include/configs/*.h use that unconditional. - Detect PCA9450 PMIC with a fallback to BD71837 PMIC if not found. - Disable combined DVS in PCA9450_BUCK123_DVS. - Increase DDR Voltage to 0.95V as we use a 1.5GHz RAM. - Configure WDOG_B behaviour. Copied and adapted the PMIC initialization from board/freescale/imx8mm_ab2/spl.c Related-to: ELB-3130 Signed-off-by: Max Krummenacher --- board/toradex/verdin-imx8mm/spl.c | 36 ++++++++++++++++++++++++++++++++++++ include/configs/verdin-imx8mm.h | 1 + 2 files changed, 37 insertions(+) diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c index c2539f9738..99e130f3a9 100644 --- a/board/toradex/verdin-imx8mm/spl.c +++ b/board/toradex/verdin-imx8mm/spl.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -167,6 +168,40 @@ int power_init_board(void) struct pmic *p; int ret; +#ifdef CONFIG_POWER_PCA9450 +#ifdef CONFIG_POWER_BD71837 + uint8_t is_bd71837 = 0; + ret = i2c_set_bus_num(I2C_PMIC); + if (!ret) + ret = i2c_read(0x4b, BD71837_REV, 1, &is_bd71837, 1); + /* BD71837_REV, High Nibble is major version, fix 1010 */ + is_bd71837 = !ret && ((is_bd71837 & 0xf0) == 0xa0); + if (!is_bd71837) { +#endif + + ret = power_pca9450b_init(I2C_PMIC); + if (ret) + printf("power init failed\n"); + p = pmic_get("PCA9450"); + pmic_probe(p); + + /* BUCKxOUT_DVS0/1 control BUCK123 output, clear PRESET_EN */ + pmic_reg_write(p, PCA9450_BUCK123_DVS, 0x29); + + /* increase VDD_DRAM to 0.975v for 1.5Ghz DDR */ + pmic_reg_write(p, PCA9450_BUCK3OUT_DVS0, 0x1c); + + /* set WDOG_B_CFG to cold reset */ + pmic_reg_write(p, PCA9450_RESET_CTRL, 0xA1); + + return 0; + +#ifdef CONFIG_POWER_BD71837 + } +#endif +#endif /* CONFIG_POWER_PCA9450 */ + +#ifdef CONFIG_POWER_BD71837 ret = power_bd71837_init(I2C_PMIC); if (ret) printf("power init failed"); @@ -193,6 +228,7 @@ int power_init_board(void) /* lock the PMIC regs */ pmic_reg_write(p, BD71837_REGLOCK, 0x11); +#endif return 0; } diff --git a/include/configs/verdin-imx8mm.h b/include/configs/verdin-imx8mm.h index d455d6e05c..18e97f840b 100644 --- a/include/configs/verdin-imx8mm.h +++ b/include/configs/verdin-imx8mm.h @@ -39,6 +39,7 @@ #define CONFIG_POWER #define CONFIG_POWER_I2C #define CONFIG_POWER_BD71837 +#define CONFIG_POWER_PCA9450 #define CONFIG_SYS_I2C -- cgit v1.2.3