plat: imx8mq: fix boot hang on ddr4/ddr3l board
Currently, DDR3L/DDR4 board don't support DDR DVFS,
So skip ddr switch 3200 mts if the DDR is not LPDDR4.
Signed-off-by: Bai Ping <ping.bai@nxp.com>
(cherry picked from commit 05bf9993de22db9d6081d94a5d99db1c241f9062)
diff --git a/plat/freescale/imx8mq/ddr/lpddr4_dvfs.c b/plat/freescale/imx8mq/ddr/lpddr4_dvfs.c
index 501b0f7..c8a8dfd 100644
--- a/plat/freescale/imx8mq/ddr/lpddr4_dvfs.c
+++ b/plat/freescale/imx8mq/ddr/lpddr4_dvfs.c
@@ -16,6 +16,9 @@
#include "lpddr4_dvfs.h"
+#define DDRC_LPDDR4 (1 << 5)
+#define DDR_TYPE_MASK 0x3f
+
/* lock used for DDR DVFS */
spinlock_t dfs_lock;
/* IRQ used for DDR DVFS */
@@ -25,9 +28,15 @@
static unsigned int init_fsp = 0x1;
+static inline int get_ddr_type(void)
+{
+ return mmio_read_32(IMX_DDRC_BASE + DDRC_MSTR(0)) & DDR_TYPE_MASK;
+}
+
void lpddr4_switch_to_3200(void)
{
- lpddr4_dvfs_swffc(init_fsp, 0x0);
+ if (get_ddr_type() == DDRC_LPDDR4)
+ lpddr4_dvfs_swffc(init_fsp, 0x0);
}
/*