public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Adam Ford <aford173@gmail.com>
To: u-boot@lists.denx.de
Cc: sbabic@denx.de, Adam Ford <aford173@gmail.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Fabio Estevam <festevam@denx.de>, Peng Fan <peng.fan@nxp.com>,
	Simon Glass <sjg@chromium.org>
Subject: [PATCH V2 4/4] imx: imx8mn-beacon: Fix out of spec voltage
Date: Sat, 22 Oct 2022 08:43:44 -0500	[thread overview]
Message-ID: <20221022134345.7613-4-aford173@gmail.com> (raw)
In-Reply-To: <20221022134345.7613-1-aford173@gmail.com>

The DDR is configured for LPDDR4 running at 1.6GHz which requires
the voltage on the PMIC to rise a bit before initializing LPDDR4
or it will be running out of spec.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/board/beacon/imx8mn/spl.c b/board/beacon/imx8mn/spl.c
index 029f71bc99..9acd916180 100644
--- a/board/beacon/imx8mn/spl.c
+++ b/board/beacon/imx8mn/spl.c
@@ -74,6 +74,38 @@ static iomux_v3_cfg_t const pwm_pads[] = {
 	IMX8MN_PAD_GPIO1_IO01__PWM1_OUT | MUX_PAD_CTRL(PWM1_PAD_CTRL),
 };
 
+static 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);
+
+	/* lock the PMIC regs */
+	pmic_reg_write(dev, BD718XX_REGLOCK, 0x11);
+
+	return 0;
+}
+
 int board_early_init_f(void)
 {
 	/* Claiming pwm pins prevents LCD flicker during startup*/
@@ -107,6 +139,9 @@ void board_init_f(ulong dummy)
 
 	enable_tzc380();
 
+	/* LPDDR4 at 1.6GHz requires a voltage adjustment on the PMIC */
+	power_init_board();
+
 	/* DDR initialization */
 	spl_dram_init();
 
-- 
2.34.1


  parent reply	other threads:[~2022-10-22 13:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 13:43 [PATCH V2 1/4] configs: imx8mn_beacon: Re-align memory to standard imx8mn settings Adam Ford
2022-10-22 13:43 ` [PATCH V2 2/4] regulator: bd718x7: Only bind children when PMIC_CHILDREN is enabled Adam Ford
2022-10-22 15:37   ` Fabio Estevam
2022-11-08 16:38   ` sbabic
2022-10-22 13:43 ` [PATCH V2 3/4] configs: imx8mn_beacon: Enable SPL_DM_PMIC_BD71837 Adam Ford
2022-10-22 15:37   ` Fabio Estevam
2022-10-25  1:22   ` Peng Fan
2022-11-08 16:50   ` sbabic
2022-10-22 13:43 ` Adam Ford [this message]
2022-10-22 15:38   ` [PATCH V2 4/4] imx: imx8mn-beacon: Fix out of spec voltage Fabio Estevam
2022-10-25  1:22   ` Peng Fan
2022-11-08 16:38   ` sbabic
2022-10-22 15:36 ` [PATCH V2 1/4] configs: imx8mn_beacon: Re-align memory to standard imx8mn settings Fabio Estevam
2022-10-24 21:36 ` Tim Harvey
2022-10-25  1:20 ` Peng Fan
2022-11-08 16:39 ` sbabic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221022134345.7613-4-aford173@gmail.com \
    --to=aford173@gmail.com \
    --cc=festevam@denx.de \
    --cc=jh80.chung@samsung.com \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox