From: Fabio Estevam <festevam@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7] mx7ulp: Allow setting a lower DDR frequency
Date: Mon, 21 Oct 2019 10:50:32 -0300 [thread overview]
Message-ID: <20191021135034.18677-5-festevam@gmail.com> (raw)
In-Reply-To: <20191021135034.18677-1-festevam@gmail.com>
By default the i.MX7ULP DDR frequency runs at 352 MHz, but not all
i.MX7ULP based systems are able to run at such frequency, such as
the i.MX7ULP Embedded Artists board.
Introduce a CONFIG_IMX7ULP_LOWER_DDR_FREQUENCY option that
allows running DDR at a lower frequency of 316.8MHz.
When such option is not selected DDR will run at the default 352MHz
frequency.
Suggested-by: Bogdan Petru Chircu Mare <bogdan-petru.chircu-mare@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
arch/arm/mach-imx/Kconfig | 7 +++++++
arch/arm/mach-imx/mx7ulp/clock.c | 27 +++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index b0b9d2c070..bb79734738 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -89,6 +89,13 @@ config CMD_NANDBCB
This is similar to kobs-ng, which is used in Linux as separate
rootfs package.
+config IMX7ULP_LOWER_DDR_FREQUENCY
+ bool "Use lower DDR Frequency for i.MX7ULP"
+ depends on ARCH_MX7ULP
+ help
+ Some systems can not run DDR frequency at 352MHz, so select
+ this option to run DDR frequency at 316.8MHz instead
+
config NXP_BOARD_REVISION
bool "Read NXP board revision from fuses"
depends on ARCH_MX6 || ARCH_MX7
diff --git a/arch/arm/mach-imx/mx7ulp/clock.c b/arch/arm/mach-imx/mx7ulp/clock.c
index d3365dd411..c26dbd3781 100644
--- a/arch/arm/mach-imx/mx7ulp/clock.c
+++ b/arch/arm/mach-imx/mx7ulp/clock.c
@@ -274,6 +274,31 @@ static void init_clk_rgpio2p(void)
writel(PCC_CGC_MASK, (PCC0_RBASE + 0x3C));
}
+/*
+ * Default PFD0 divide is 27, which generates:
+ * PFD0 Freq = A7 APLL(528MHz) * 18 / 27 = 352MHz
+ *
+ * As some systems can not run DDR at 352MHz, use a
+ * divider of 30, which gives:
+ *
+ * PFD0 Freq = A7 APLL(528MHz) * 18 / 30 = 316.8MHz
+ */
+#define SCG1_APLL_PFD0_FRAC_NUM 30
+static void scg_a7_apll_update_pfd0(void)
+{
+ scg_p scg1_regs = (scg_p)SCG1_RBASE;
+ u32 val;
+
+ if (!IS_ENABLED(CONFIG_IMX7ULP_LOWER_DDR_FREQUENCY))
+ return;
+
+ /* Configure A7 APLL PFD0 */
+ val = readl(&scg1_regs->apllpfd);
+ val &= ~SCG_PLL_PFD0_FRAC_MASK;
+ val |= SCG1_APLL_PFD0_FRAC_NUM;
+ writel(val, &scg1_regs->apllpfd);
+}
+
/* Configure PLL/PFD freq */
void clock_init(void)
{
@@ -300,6 +325,8 @@ void clock_init(void)
scg_a7_soscdiv_init();
+ scg_a7_apll_update_pfd0();
+
scg_a7_init_core_clk();
/* APLL PFD1 = 270Mhz, PFD2=345.6Mhz, PFD3=800Mhz */
--
2.17.1
next prev parent reply other threads:[~2019-10-21 13:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 13:50 [U-Boot] [PATCH 1/7] mx7ulp: Print the LDO mode status Fabio Estevam
2019-10-21 13:50 ` [U-Boot] [PATCH 2/7] mx7ulp: Introduce the CONFIG_LDO_ENABLED_MODE option Fabio Estevam
2019-10-21 13:50 ` [U-Boot] [PATCH 3/7] mx7ulp: Remove the _RUN notation from the PMC1 LDOVL definitions Fabio Estevam
2019-10-21 13:50 ` [U-Boot] [PATCH 4/7] mx7ulp: scg: Remove unnused scg_a7_apll_init() Fabio Estevam
2019-10-21 13:50 ` Fabio Estevam [this message]
2019-10-21 13:50 ` [U-Boot] [PATCH 6/7] mx7ulp: Sync the device tree related files Fabio Estevam
2019-10-21 13:50 ` [U-Boot] [PATCH 7/7] mx7ulp: Add support for Embedded Artists COM board Fabio Estevam
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=20191021135034.18677-5-festevam@gmail.com \
--to=festevam@gmail.com \
--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