]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx8mm: evk: enable bd71837 pmic
authorPeng Fan <peng.fan@nxp.com>
Wed, 16 Oct 2019 10:24:42 +0000 (10:24 +0000)
committerStefano Babic <sbabic@denx.de>
Sun, 3 Nov 2019 16:04:16 +0000 (17:04 +0100)
Enable bd71837 pmic for i.MX8MM EVK board, need to set voltage for
DRAM and linux suspend voltage requirement.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/dts/imx8mm-evk-u-boot.dtsi
board/freescale/imx8mm_evk/spl.c
configs/imx8mm_evk_defconfig

index 1095d36e3124579dec5ec26074674c2ec5695f68..10d9a20f2a1997a7eba756fe60f0fc01d4efd48b 100644 (file)
 &usdhc3 {
        u-boot,dm-spl;
 };
+
+&i2c1 {
+       u-boot,dm-spl;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b} {
+       u-boot,dm-spl;
+};
+
+&{/soc@0/bus@30800000/i2c@30a20000/pmic@4b/regulators} {
+       u-boot,dm-spl;
+};
+
+&pinctrl_i2c1 {
+       u-boot,dm-spl;
+};
+
+&pinctrl_pmic {
+       u-boot,dm-spl;
+};
index 2a5fb27a734feb68068e7680da3e6b9769ca3a6d..2d08f9a56331c15a061c65b6c9af7cab5cd2e1b8 100644 (file)
@@ -18,6 +18,9 @@
 #include <dm/uclass-internal.h>
 #include <dm/device-internal.h>
 
+#include <power/pmic.h>
+#include <power/bd71837.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
 int spl_board_boot_device(enum boot_device boot_dev_spl)
@@ -79,6 +82,42 @@ int board_early_init_f(void)
        return 0;
 }
 
+int power_init_board(void)
+{
+       struct udevice *dev;
+       int ret;
+
+       ret = pmic_get("pmic@4b", &dev);
+       if (ret == -ENODEV) {
+               puts("No pmic\n");
+               return 0;
+       }
+       if (ret != 0)
+               return ret;
+
+       /* decrease RESET key long push time from the default 10s to 10ms */
+       pmic_reg_write(dev, BD718XX_PWRONCONFIG1, 0x0);
+
+       /* unlock the PMIC regs */
+       pmic_reg_write(dev, BD718XX_REGLOCK, 0x1);
+
+       /* increase VDD_SOC to typical value 0.85v before first DRAM access */
+       pmic_reg_write(dev, BD718XX_BUCK1_VOLT_RUN, 0x0f);
+
+       /* increase VDD_DRAM to 0.975v for 3Ghz DDR */
+       pmic_reg_write(dev, BD718XX_1ST_NODVS_BUCK_VOLT, 0x83);
+
+#ifndef CONFIG_IMX8M_LPDDR4
+       /* increase NVCC_DRAM_1V2 to 1.2v for DDR4 */
+       pmic_reg_write(dev, BD718XX_4TH_NODVS_BUCK_VOLT, 0x28);
+#endif
+
+       /* lock the PMIC regs */
+       pmic_reg_write(dev, BD718XX_REGLOCK, 0x11);
+
+       return 0;
+}
+
 void board_init_f(ulong dummy)
 {
        struct udevice *dev;
@@ -113,6 +152,8 @@ void board_init_f(ulong dummy)
 
        enable_tzc380();
 
+       power_init_board();
+
        /* DDR initialization */
        spl_dram_init();
 
index a934363277d159cbf08b7c2a6e3c5502248d6c53..4cbc62fd8f2f5d10b6ee1b41ae1a6b0ab26e1148 100644 (file)
@@ -12,6 +12,7 @@ CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_SPL=y
+CONFIG_SPL_TEXT_BASE=0x7E1000
 CONFIG_FIT=y
 CONFIG_FIT_EXTERNAL_OFFSET=0x3000
 CONFIG_SPL_LOAD_FIT=y
@@ -20,10 +21,10 @@ CONFIG_OF_SYSTEM_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg"
 CONFIG_DEFAULT_FDT_FILE="fsl-imx8mm-evk.dtb"
 CONFIG_BOARD_LATE_INIT=y
-CONFIG_SPL_TEXT_BASE=0x7E1000
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_SEPARATE_BSS=y
 CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="u-boot=> "
 # CONFIG_CMD_EXPORTENV is not set
@@ -65,6 +66,8 @@ CONFIG_DM_ETH=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8M=y
+CONFIG_DM_PMIC=y
+CONFIG_SPL_DM_PMIC_BD71837=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y