summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/imx8m
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-imx/imx8m')
-rw-r--r--arch/arm/mach-imx/imx8m/Kconfig11
-rw-r--r--arch/arm/mach-imx/imx8m/Makefile2
-rw-r--r--arch/arm/mach-imx/imx8m/clock_imx8mm.c340
-rw-r--r--arch/arm/mach-imx/imx8m/clock_imx8mq.c14
-rw-r--r--arch/arm/mach-imx/imx8m/clock_slice.c272
-rw-r--r--arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg17
-rw-r--r--arch/arm/mach-imx/imx8m/soc.c9
7 files changed, 623 insertions, 42 deletions
diff --git a/arch/arm/mach-imx/imx8m/Kconfig b/arch/arm/mach-imx/imx8m/Kconfig
index eb4a73b3e2..72affb1bdc 100644
--- a/arch/arm/mach-imx/imx8m/Kconfig
+++ b/arch/arm/mach-imx/imx8m/Kconfig
@@ -16,6 +16,10 @@ config IMX8MN
bool
select IMX8M
+config IMX8MP
+ bool
+ select IMX8M
+
config SYS_SOC
default "imx8m"
@@ -40,10 +44,17 @@ config TARGET_IMX8MN_EVK
select SUPPORT_SPL
select IMX8M_DDR4
+config TARGET_IMX8MP_EVK
+ bool "imx8mp LPDDR4 EVK board"
+ select IMX8MP
+ select SUPPORT_SPL
+ select IMX8M_LPDDR4
+
endchoice
source "board/freescale/imx8mq_evk/Kconfig"
source "board/freescale/imx8mm_evk/Kconfig"
source "board/freescale/imx8mn_evk/Kconfig"
+source "board/freescale/imx8mp_evk/Kconfig"
endif
diff --git a/arch/arm/mach-imx/imx8m/Makefile b/arch/arm/mach-imx/imx8m/Makefile
index db4ba30c24..d9dee894aa 100644
--- a/arch/arm/mach-imx/imx8m/Makefile
+++ b/arch/arm/mach-imx/imx8m/Makefile
@@ -5,4 +5,4 @@
obj-y += lowlevel_init.o
obj-y += clock_slice.o soc.o
obj-$(CONFIG_IMX8MQ) += clock_imx8mq.o
-obj-$(CONFIG_IMX8MM)$(CONFIG_IMX8MN) += clock_imx8mm.o
+obj-$(CONFIG_IMX8MM)$(CONFIG_IMX8MN)$(CONFIG_IMX8MP) += clock_imx8mm.o
diff --git a/arch/arm/mach-imx/imx8m/clock_imx8mm.c b/arch/arm/mach-imx/imx8m/clock_imx8mm.c
index ee44ba75fe..ca4b4c05ab 100644
--- a/arch/arm/mach-imx/imx8m/clock_imx8mm.c
+++ b/arch/arm/mach-imx/imx8m/clock_imx8mm.c
@@ -10,9 +10,6 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/sys_proto.h>
#include <asm/io.h>
-#include <clk.h>
-#include <clk-uclass.h>
-#include <dt-bindings/clock/imx8mm-clock.h>
#include <div64.h>
#include <errno.h>
@@ -22,34 +19,23 @@ static struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
void enable_ocotp_clk(unsigned char enable)
{
- struct clk *clkp;
- int ret;
-
- ret = clk_get_by_id(IMX8MM_CLK_OCOTP_ROOT, &clkp);
- if (ret) {
- printf("%s: err: %d\n", __func__, ret);
- return;
- }
-
- enable ? clk_enable(clkp) : clk_disable(clkp);
+ clock_enable(CCGR_OCOTP, !!enable);
}
int enable_i2c_clk(unsigned char enable, unsigned i2c_num)
{
- struct clk *clkp;
- int ret;
+ /* 0 - 3 is valid i2c num */
+ if (i2c_num > 3)
+ return -EINVAL;
- ret = clk_get_by_id(IMX8MM_CLK_I2C1_ROOT + i2c_num, &clkp);
- if (ret) {
- printf("%s: err: %d\n", __func__, ret);
- return ret;
- }
+ clock_enable(CCGR_I2C1 + i2c_num, !!enable);
- return enable ? clk_enable(clkp) : clk_disable(clkp);
+ return 0;
}
#ifdef CONFIG_SPL_BUILD
static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[] = {
+ PLL_1443X_RATE(1000000000U, 250, 3, 1, 0),
PLL_1443X_RATE(800000000U, 300, 9, 0, 0),
PLL_1443X_RATE(750000000U, 250, 8, 0, 0),
PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
@@ -282,24 +268,312 @@ u32 imx_get_uartclk(void)
return 24000000U;
}
+u32 decode_intpll(enum clk_root_src intpll)
+{
+ u32 pll_gnrl_ctl, pll_div_ctl, pll_clke_mask;
+ u32 main_div, pre_div, post_div, div;
+ u64 freq;
+
+ switch (intpll) {
+ case ARM_PLL_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->arm_pll_gnrl_ctl);
+ pll_div_ctl = readl(&ana_pll->arm_pll_div_ctl);
+ break;
+ case GPU_PLL_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->gpu_pll_gnrl_ctl);
+ pll_div_ctl = readl(&ana_pll->gpu_pll_div_ctl);
+ break;
+ case VPU_PLL_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->vpu_pll_gnrl_ctl);
+ pll_div_ctl = readl(&ana_pll->vpu_pll_div_ctl);
+ break;
+ case SYSTEM_PLL1_800M_CLK:
+ case SYSTEM_PLL1_400M_CLK:
+ case SYSTEM_PLL1_266M_CLK:
+ case SYSTEM_PLL1_200M_CLK:
+ case SYSTEM_PLL1_160M_CLK:
+ case SYSTEM_PLL1_133M_CLK:
+ case SYSTEM_PLL1_100M_CLK:
+ case SYSTEM_PLL1_80M_CLK:
+ case SYSTEM_PLL1_40M_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->sys_pll1_gnrl_ctl);
+ pll_div_ctl = readl(&ana_pll->sys_pll1_div_ctl);
+ break;
+ case SYSTEM_PLL2_1000M_CLK:
+ case SYSTEM_PLL2_500M_CLK:
+ case SYSTEM_PLL2_333M_CLK:
+ case SYSTEM_PLL2_250M_CLK:
+ case SYSTEM_PLL2_200M_CLK:
+ case SYSTEM_PLL2_166M_CLK:
+ case SYSTEM_PLL2_125M_CLK:
+ case SYSTEM_PLL2_100M_CLK:
+ case SYSTEM_PLL2_50M_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->sys_pll2_gnrl_ctl);
+ pll_div_ctl = readl(&ana_pll->sys_pll2_div_ctl);
+ break;
+ case SYSTEM_PLL3_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->sys_pll3_gnrl_ctl);
+ pll_div_ctl = readl(&ana_pll->sys_pll3_div_ctl);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ /* Only support SYS_XTAL 24M, PAD_CLK not take into consideration */
+ if ((pll_gnrl_ctl & INTPLL_REF_CLK_SEL_MASK) != 0)
+ return 0;
+
+ if ((pll_gnrl_ctl & INTPLL_RST_MASK) == 0)
+ return 0;
+
+ /*
+ * When BYPASS is equal to 1, PLL enters the bypass mode
+ * regardless of the values of RESETB
+ */
+ if (pll_gnrl_ctl & INTPLL_BYPASS_MASK)
+ return 24000000u;
+
+ if (!(pll_gnrl_ctl & INTPLL_LOCK_MASK)) {
+ puts("pll not locked\n");
+ return 0;
+ }
+
+ switch (intpll) {
+ case ARM_PLL_CLK:
+ case GPU_PLL_CLK:
+ case VPU_PLL_CLK:
+ case SYSTEM_PLL3_CLK:
+ case SYSTEM_PLL1_800M_CLK:
+ case SYSTEM_PLL2_1000M_CLK:
+ pll_clke_mask = INTPLL_CLKE_MASK;
+ div = 1;
+ break;
+
+ case SYSTEM_PLL1_400M_CLK:
+ case SYSTEM_PLL2_500M_CLK:
+ pll_clke_mask = INTPLL_DIV2_CLKE_MASK;
+ div = 2;
+ break;
+
+ case SYSTEM_PLL1_266M_CLK:
+ case SYSTEM_PLL2_333M_CLK:
+ pll_clke_mask = INTPLL_DIV3_CLKE_MASK;
+ div = 3;
+ break;
+
+ case SYSTEM_PLL1_200M_CLK:
+ case SYSTEM_PLL2_250M_CLK:
+ pll_clke_mask = INTPLL_DIV4_CLKE_MASK;
+ div = 4;
+ break;
+
+ case SYSTEM_PLL1_160M_CLK:
+ case SYSTEM_PLL2_200M_CLK:
+ pll_clke_mask = INTPLL_DIV5_CLKE_MASK;
+ div = 5;
+ break;
+
+ case SYSTEM_PLL1_133M_CLK:
+ case SYSTEM_PLL2_166M_CLK:
+ pll_clke_mask = INTPLL_DIV6_CLKE_MASK;
+ div = 6;
+ break;
+
+ case SYSTEM_PLL1_100M_CLK:
+ case SYSTEM_PLL2_125M_CLK:
+ pll_clke_mask = INTPLL_DIV8_CLKE_MASK;
+ div = 8;
+ break;
+
+ case SYSTEM_PLL1_80M_CLK:
+ case SYSTEM_PLL2_100M_CLK:
+ pll_clke_mask = INTPLL_DIV10_CLKE_MASK;
+ div = 10;
+ break;
+
+ case SYSTEM_PLL1_40M_CLK:
+ case SYSTEM_PLL2_50M_CLK:
+ pll_clke_mask = INTPLL_DIV20_CLKE_MASK;
+ div = 20;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if ((pll_gnrl_ctl & pll_clke_mask) == 0)
+ return 0;
+
+ main_div = (pll_div_ctl & INTPLL_MAIN_DIV_MASK) >>
+ INTPLL_MAIN_DIV_SHIFT;
+ pre_div = (pll_div_ctl & INTPLL_PRE_DIV_MASK) >>
+ INTPLL_PRE_DIV_SHIFT;
+ post_div = (pll_div_ctl & INTPLL_POST_DIV_MASK) >>
+ INTPLL_POST_DIV_SHIFT;
+
+ /* FFVCO = (m * FFIN) / p, FFOUT = (m * FFIN) / (p * 2^s) */
+ freq = 24000000ULL * main_div;
+ return lldiv(freq, pre_div * (1 << post_div) * div);
+}
+
+u32 decode_fracpll(enum clk_root_src frac_pll)
+{
+ u32 pll_gnrl_ctl, pll_fdiv_ctl0, pll_fdiv_ctl1;
+ u32 main_div, pre_div, post_div, k;
+
+ switch (frac_pll) {
+ case DRAM_PLL1_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->dram_pll_gnrl_ctl);
+ pll_fdiv_ctl0 = readl(&ana_pll->dram_pll_fdiv_ctl0);
+ pll_fdiv_ctl1 = readl(&ana_pll->dram_pll_fdiv_ctl1);
+ break;
+ case AUDIO_PLL1_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->audio_pll1_gnrl_ctl);
+ pll_fdiv_ctl0 = readl(&ana_pll->audio_pll1_fdiv_ctl0);
+ pll_fdiv_ctl1 = readl(&ana_pll->audio_pll1_fdiv_ctl1);
+ break;
+ case AUDIO_PLL2_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->audio_pll2_gnrl_ctl);
+ pll_fdiv_ctl0 = readl(&ana_pll->audio_pll2_fdiv_ctl0);
+ pll_fdiv_ctl1 = readl(&ana_pll->audio_pll2_fdiv_ctl1);
+ break;
+ case VIDEO_PLL_CLK:
+ pll_gnrl_ctl = readl(&ana_pll->video_pll1_gnrl_ctl);
+ pll_fdiv_ctl0 = readl(&ana_pll->video_pll1_fdiv_ctl0);
+ pll_fdiv_ctl1 = readl(&ana_pll->video_pll1_fdiv_ctl1);
+ break;
+ default:
+ printf("Not supported\n");
+ return 0;
+ }
+
+ /* Only support SYS_XTAL 24M, PAD_CLK not take into consideration */
+ if ((pll_gnrl_ctl & INTPLL_REF_CLK_SEL_MASK) != 0)
+ return 0;
+
+ if ((pll_gnrl_ctl & INTPLL_RST_MASK) == 0)
+ return 0;
+ /*
+ * When BYPASS is equal to 1, PLL enters the bypass mode
+ * regardless of the values of RESETB
+ */
+ if (pll_gnrl_ctl & INTPLL_BYPASS_MASK)
+ return 24000000u;
+
+ if (!(pll_gnrl_ctl & INTPLL_LOCK_MASK)) {
+ puts("pll not locked\n");
+ return 0;
+ }
+
+ if (!(pll_gnrl_ctl & INTPLL_CLKE_MASK))
+ return 0;
+
+ main_div = (pll_fdiv_ctl0 & INTPLL_MAIN_DIV_MASK) >>
+ INTPLL_MAIN_DIV_SHIFT;
+ pre_div = (pll_fdiv_ctl0 & INTPLL_PRE_DIV_MASK) >>
+ INTPLL_PRE_DIV_SHIFT;
+ post_div = (pll_fdiv_ctl0 & INTPLL_POST_DIV_MASK) >>
+ INTPLL_POST_DIV_SHIFT;
+
+ k = pll_fdiv_ctl1 & GENMASK(15, 0);
+
+ return lldiv((main_div * 65536 + k) * 24000000ULL,
+ 65536 * pre_div * (1 << post_div));
+}
+
+u32 get_root_src_clk(enum clk_root_src root_src)
+{
+ switch (root_src) {
+ case OSC_24M_CLK:
+ return 24000000u;
+ case OSC_HDMI_CLK:
+ return 26000000u;
+ case OSC_32K_CLK:
+ return 32000u;
+ case ARM_PLL_CLK:
+ case GPU_PLL_CLK:
+ case VPU_PLL_CLK:
+ case SYSTEM_PLL1_800M_CLK:
+ case SYSTEM_PLL1_400M_CLK:
+ case SYSTEM_PLL1_266M_CLK:
+ case SYSTEM_PLL1_200M_CLK:
+ case SYSTEM_PLL1_160M_CLK:
+ case SYSTEM_PLL1_133M_CLK:
+ case SYSTEM_PLL1_100M_CLK:
+ case SYSTEM_PLL1_80M_CLK:
+ case SYSTEM_PLL1_40M_CLK:
+ case SYSTEM_PLL2_1000M_CLK:
+ case SYSTEM_PLL2_500M_CLK:
+ case SYSTEM_PLL2_333M_CLK:
+ case SYSTEM_PLL2_250M_CLK:
+ case SYSTEM_PLL2_200M_CLK:
+ case SYSTEM_PLL2_166M_CLK:
+ case SYSTEM_PLL2_125M_CLK:
+ case SYSTEM_PLL2_100M_CLK:
+ case SYSTEM_PLL2_50M_CLK:
+ case SYSTEM_PLL3_CLK:
+ return decode_intpll(root_src);
+ case DRAM_PLL1_CLK:
+ case AUDIO_PLL1_CLK:
+ case AUDIO_PLL2_CLK:
+ case VIDEO_PLL_CLK:
+ return decode_fracpll(root_src);
+ default:
+ return 0;
+ }
+
+ return 0;
+}
+
+u32 get_root_clk(enum clk_root_index clock_id)
+{
+ enum clk_root_src root_src;
+ u32 post_podf, pre_podf, root_src_clk;
+
+ if (clock_root_enabled(clock_id) <= 0)
+ return 0;
+
+ if (clock_get_prediv(clock_id, &pre_podf) < 0)
+ return 0;
+
+ if (clock_get_postdiv(clock_id, &post_podf) < 0)
+ return 0;
+
+ if (clock_get_src(clock_id, &root_src) < 0)
+ return 0;
+
+ root_src_clk = get_root_src_clk(root_src);
+
+ return root_src_clk / (post_podf + 1) / (pre_podf + 1);
+}
+
u32 mxc_get_clock(enum mxc_clock clk)
{
- struct clk *clkp;
- int ret;
+ u32 val;
switch (clk) {
- case MXC_IPG_CLK:
- ret = clk_get_by_id(IMX8MM_CLK_IPG_ROOT, &clkp);
- if (ret)
- return 0;
- return clk_get_rate(clkp);
case MXC_ARM_CLK:
- ret = clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp);
- if (ret)
- return 0;
- return clk_get_rate(clkp);
+ return get_root_clk(ARM_A53_CLK_ROOT);
+ case MXC_IPG_CLK:
+ clock_get_target_val(IPG_CLK_ROOT, &val);
+ val = val & 0x3;
+ return get_root_clk(AHB_CLK_ROOT) / 2 / (val + 1);
+ case MXC_CSPI_CLK:
+ return get_root_clk(ECSPI1_CLK_ROOT);
+ case MXC_ESDHC_CLK:
+ return get_root_clk(USDHC1_CLK_ROOT);
+ case MXC_ESDHC2_CLK:
+ return get_root_clk(USDHC2_CLK_ROOT);
+ case MXC_ESDHC3_CLK:
+ return get_root_clk(USDHC3_CLK_ROOT);
+ case MXC_I2C_CLK:
+ return get_root_clk(I2C1_CLK_ROOT);
+ case MXC_UART_CLK:
+ return get_root_clk(UART1_CLK_ROOT);
+ case MXC_QSPI_CLK:
+ return get_root_clk(QSPI_CLK_ROOT);
default:
- printf("%s: %d not supported\n", __func__, clk);
+ printf("Unsupported mxc_clock %d\n", clk);
+ break;
}
return 0;
diff --git a/arch/arm/mach-imx/imx8m/clock_imx8mq.c b/arch/arm/mach-imx/imx8m/clock_imx8mq.c
index 2db5bde211..878f2be166 100644
--- a/arch/arm/mach-imx/imx8m/clock_imx8mq.c
+++ b/arch/arm/mach-imx/imx8m/clock_imx8mq.c
@@ -326,16 +326,20 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
{
u32 val;
- if (clk == MXC_ARM_CLK)
+ switch(clk) {
+ case MXC_ARM_CLK:
return get_root_clk(ARM_A53_CLK_ROOT);
-
- if (clk == MXC_IPG_CLK) {
+ case MXC_IPG_CLK:
clock_get_target_val(IPG_CLK_ROOT, &val);
val = val & 0x3;
return get_root_clk(AHB_CLK_ROOT) / (val + 1);
+ case MXC_ESDHC_CLK:
+ return get_root_clk(USDHC1_CLK_ROOT);
+ case MXC_ESDHC2_CLK:
+ return get_root_clk(USDHC2_CLK_ROOT);
+ default:
+ return get_root_clk(clk);
}
-
- return get_root_clk(clk);
}
u32 imx_get_uartclk(void)
diff --git a/arch/arm/mach-imx/imx8m/clock_slice.c b/arch/arm/mach-imx/imx8m/clock_slice.c
index 09c5615004..31925ccaba 100644
--- a/arch/arm/mach-imx/imx8m/clock_slice.c
+++ b/arch/arm/mach-imx/imx8m/clock_slice.c
@@ -538,6 +538,278 @@ static struct clk_root_map root_array[] = {
{DRAM_PLL1_CLK}
},
};
+#elif defined(CONFIG_IMX8MP)
+static struct clk_root_map root_array[] = {
+ {ARM_A53_CLK_ROOT, CORE_CLOCK_SLICE, 0,
+ {OSC_24M_CLK, ARM_PLL_CLK, SYSTEM_PLL2_500M_CLK,
+ SYSTEM_PLL2_1000M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL1_400M_CLK, AUDIO_PLL1_CLK, SYSTEM_PLL3_CLK}
+ },
+ {ARM_M7_CLK_ROOT, CORE_CLOCK_SLICE, 1,
+ {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_250M_CLK,
+ VPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+ AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL3_CLK}
+ },
+ {ML_CLK_ROOT, CORE_CLOCK_SLICE, 2,
+ {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_250M_CLK,
+ VPU_PLL_CLK, SYSTEM_PLL1_800M_CLK,
+ AUDIO_PLL1_CLK, VIDEO_PLL_CLK, SYSTEM_PLL3_CLK}
+ },
+ {HSIO_AXI_CLK_ROOT, CORE_CLOCK_SLICE, 7,
+ {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK, EXT_CLK_2,
+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F_CLK_ROOT, IP_CLOCK_SLICE, 21,
+ {OSC_24M_CLK, SYSTEM_PLL2_50M_CLK, SYSTEM_PLL2_125M_CLK,
+ SYSTEM_PLL2_200M_CLK, SYSTEM_PLL2_500M_CLK, AUDIO_PLL1_CLK,
+ VIDEO_PLL_CLK, AUDIO_PLL2_CLK}
+ },
+ {NAND_CLK_ROOT, IP_CLOCK_SLICE, 22,
+ {OSC_24M_CLK, SYSTEM_PLL2_500M_CLK, AUDIO_PLL1_CLK,
+ SYSTEM_PLL1_400M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL3_CLK,
+ SYSTEM_PLL2_250M_CLK, VIDEO_PLL_CLK}
+ },
+ {QSPI_CLK_ROOT, IP_CLOCK_SLICE, 23,
+ {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL2_333M_CLK,
+ SYSTEM_PLL2_500M_CLK, AUDIO_PLL2_CLK,
+ SYSTEM_PLL1_266M_CLK, SYSTEM_PLL3_CLK, SYSTEM_PLL1_100M_CLK}
+ },
+ {USDHC1_CLK_ROOT, IP_CLOCK_SLICE, 24,
+ {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+ SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+ },
+ {USDHC2_CLK_ROOT, IP_CLOCK_SLICE, 25,
+ {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+ SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+ },
+ {I2C1_CLK_ROOT, IP_CLOCK_SLICE, 26,
+ {OSC_24M_CLK, SYSTEM_PLL1_160M_CLK, SYSTEM_PLL2_50M_CLK,
+ SYSTEM_PLL3_CLK, AUDIO_PL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PLL2_100M_CLK, SYSTEM_PLL3_CLK,
+ EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+ },
+ {UART4_CLK_ROOT, IP_CLOCK_SLICE, 33,
+ {OSC_24M_CLK, SYSTEM_PLL1_80M_CLK, SYSTEM_PLL2_200M_CLK,
+ SYSTEM_PLL2_100M_CLK, SYSTEM_PLL3_CLK,
+ EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+ },
+ {USB_PHY_REF_CLK_ROOT, IP_CLOCK_SLICE, 35,
+ {OSC_24M_CLK, SYSTEM_PLL1_100M_CLK, SYSTEM_PLL1_40M_CLK,
+ SYSTEM_PLL2_100M_CLK, SYSTEM_PLL2_200M_CLK,
+ EXT_CLK_2, EXT_CLK_3, AUDIO_PLL2_CLK}
+ },
+ {GIC_CLK_ROOT, IP_CLOCK_SLICE, 36,
+ {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+ SYSTEM_PLL2_100M_CLK, SYSTEM_PLL1_800M_CLK,
+ EXT_CLK_2, EXT_CLK_4, AUDIO_PLL2_CLK}
+ },
+ {ECSPI1_CLK_ROOT, IP_CLOCK_SLICE, 37,
+ {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+ SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+ },
+ {ECSPI2_CLK_ROOT, IP_CLOCK_SLICE, 38,
+ {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+ SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+ },
+ {PWM1_CLK_ROOT, IP_CLOCK_SLICE, 39,
+ {OSC_24M_CLK, SYSTEM_PLL2_100M_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LK_ROOT, IP_CLOCK_SLICE, 51,
+ {OSC_24M_CLK, SYSTEM_PLL1_40M_CLK, VPU_PLL_CLK,
+ SYSTEM_PLL3_CLK, SYSTEM_PLL2_200M_CLK,
+ SYSTEM_PLL1_266M_CLK, SYSTEM_PLL2_500M_CLK, SYSTEM_PLL1_100M_CLK}
+ },
+ {USDHC3_CLK_ROOT, IP_CLOCK_SLICE, 57,
+ {OSC_24M_CLK, SYSTEM_PLL1_400M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL2_500M_CLK, SYSTEM_PLL3_CLK,
+ SYSTEM_PLL1_266M_CLK, AUDIO_PLL2_CLK, SYSTEM_PLL1_100M_CLK}
+ },
+ {ECSPI3_CLK_ROOT, IP_CLOCK_SLICE, 67,
+ {OSC_24M_CLK, SYSTEM_PLL2_200M_CLK, SYSTEM_PLL1_40M_CLK,
+ SYSTEM_PLL1_160M_CLK, SYSTEM_PLL1_800M_CLK,
+ SYSTEM_PLL3_CLK, SYSTEM_PLL2_250M_CLK, AUDIO_PLL2_CLK}
+ },
+ {DRAM_SEL_CFG, DRAM_SEL_CLOCK_SLICE, 0,
+ {DRAM_PLL1_CLK}
+ },
+ {CORE_SEL_CFG, CORE_SEL_CLOCK_SLICE, 0,
+ {DRAM_PLL1_CLK}
+ },
+};
#endif
static int select(enum clk_root_index clock_id)
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
new file mode 100644
index 0000000000..586a5ff306
--- /dev/null
+++ b/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#define __ASSEMBLY__
+
+FIT
+ROM_VERSION v2
+BOOT_FROM sd
+LOADER spl/u-boot-spl-ddr.bin 0x920000
+SECOND_LOADER u-boot.itb 0x40200000 0x60000
+
+DDR_FW lpddr4_pmu_train_1d_imem.bin
+DDR_FW lpddr4_pmu_train_1d_dmem.bin
+DDR_FW lpddr4_pmu_train_2d_imem.bin
+DDR_FW lpddr4_pmu_train_2d_dmem.bin
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 5ce5a180e8..7fcbd53f30 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -57,7 +57,7 @@ void enable_tzc380(void)
/* Enable TZASC and lock setting */
setbits_le32(&gpr->gpr[10], GPR_TZASC_EN);
setbits_le32(&gpr->gpr[10], GPR_TZASC_EN_LOCK);
- if (is_imx8mm() || is_imx8mn())
+ if (is_imx8mm() || is_imx8mn() || is_imx8mp())
setbits_le32(&gpr->gpr[10], BIT(1));
/*
* set Region 0 attribute to allow secure and non-secure
@@ -197,8 +197,11 @@ u32 get_cpu_rev(void)
reg &= 0xff;
- /* i.MX8MM */
- if (major_low == 0x42) {
+ /* iMX8MP */
+ if (major_low == 0x43) {
+ return (MXC_CPU_IMX8MP << 12) | reg;
+ } else if (major_low == 0x42) {
+ /* iMX8MN */
return (MXC_CPU_IMX8MN << 12) | reg;
} else if (major_low == 0x41) {
type = get_cpu_variant_type(MXC_CPU_IMX8MM);