Commit graph

23 commits

Author SHA1 Message Date
Marek Vasut
f1bb459c31 feat(imx8m): add 3600 MTps DDR PLL rate
Add 3600 MTps DRAM and its 900 MHz PLL setting M=300 P=8 S=0 , so
24 MHz * 300 / 8 / 2^0 = 900 MHz ~ 3600 MTps (x4) .

Signed-off-by: Marek Vasut <marex@denx.de>
Change-Id: If2743827294efc0f981718f04b772cc462846195
2023-12-02 06:47:44 +01:00
Marek Vasut
060fe63337 fix(imx8m): align 3200 MTps rate with U-Boot
The 3200 MTps DRAM and its 800 MHz PLL setting in U-Boot is set to
M=300 P=9 S=0 , so 24 MHz * 300 / 9 / 2^0 = 800 MHz ~ 3200 MTps (x4) .
Make sure the PLL settings are aligned across software components.

Signed-off-by: Marek Vasut <marex@denx.de>
Change-Id: I163f81696be213acf6ecebe89ff2c76d41484cc5
2023-12-02 06:47:38 +01:00
Marek Vasut
cb60a876ef fix(imx8m): handle 3734 in addition to 3733 and 3732 MTps rates
The new MX8M DDR tool 3.31 now generates a programming file which uses
data rate 3734 instead of 3733 or 3732 . Handle another rounding option .

Signed-off-by: Marek Vasut <marex@denx.de>
Change-Id: I97a69650c12d78dfff9dcdb23e27fd6590f57fc0
2023-12-02 06:47:28 +01:00
Yann Gautier
117b357260 Merge "feat(imx8m): move the gpc reg & macro to a separate header file" into integration 2023-09-06 11:20:14 +02:00
Jacky Bai
2a6ffa99af feat(imx8m): move the gpc reg & macro to a separate header file
move the gpc reg offset, bit define & macro to a separate header
file for code reuse.

This fixes suspend to mem on i.MX8M Plus too, since the register
layout is different there.

Change-Id: Ibec60c3a68ffa8c378de5334577a7b0e463ca875
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Marek Vasut <marex@denx.de> # Upgrade to latest, update commit message
2023-08-31 17:35:28 +02:00
Marek Vasut
89474044a5 feat(imx8m): add more dram pll setting
Add DRAM PLL frequency setting for 3732mts & 3733mts.

Change-Id: I74feab2185376bbb84826d7ee79b5e25cbc4d263
Signed-off-by: Marek Vasut <marex@denx.de>
2023-08-31 17:10:14 +02:00
Jacky Bai
8962bdd603 feat(imx8mq): enable dram dvfs support on imx8mq
Enable DRAM DVFS support on i.MX8MQ.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Id72c5eb9625936052ec51e5a52d9d31175ed1b1b
2023-03-01 10:18:03 +08:00
Jacky Bai
dd108c3c1f feat(imx8mq): add the dram retention support for imx8mq
Add the dram retention support for i.MX8MQ. As there is
no enough ocram space available before entering TF-A,
so the timing info need to be copied from dram into ocram.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Id8264c342fd62e297b1969cba5ed505450c78a25
2023-03-01 10:18:03 +08:00
Jacky Bai
a2655f4869 fix(imx8m): backup mr12/14 value from lpddr4 chip
Backup the mr12/14 value as the actual value used is not the
one we configured in the ddrc config timing.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Change-Id: If04733b34a3b4c080828bb7c82e83f0badbeaafd
2023-03-01 10:03:37 +08:00
Jacky Bai
e00fe11df3 fix(imx8m): add ddr4 dvfs sw workaround for ERR050712
APB Write data corruption following MRCTRL0.mr_wr=1 while
hardware-driven MR access is occurring

When performing a software driven MR access, the following
sequence must be done automatically before performing other
APB register accesses:

1. Set MRCTRL0.mr_wr=1
2. Check for MRSTAT.mr_wr_busy=0. If not, go to step (2)
3. Check for MRSTAT.mr_wr_busy=0 again (for the second time),
   if not, go to step (2).

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Change-Id: Ie26e08bcc83d3ed4844ed04a853162308dcdccd0
2023-02-28 14:27:28 +08:00
Jacky Bai
0331b1c611 fix(imx8m): fix coverity out of bound access issue
Fix the out of bound access to the rank setting array.

Fix Coverity issue:

CID 6474575: Out-of-bounds access (OVERRUN)
CID 11014855: Unused value (UNUSED_VALUE)

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Change-Id: I5d9ef90f1479e5d46d1b6c8693a27e3abd614766
2023-02-28 14:27:24 +08:00
Jacky Bai
4bf5019228 fix(imx8m): fix the dram retention random hang on some imx8mq Rev2.0
It seems the DRAM APB clock root slice can NOT work normally
if the PLLs is power down in DSM mode. So update this clock
slice's setting explicitly to make it work. This piece of code
is there for a long while on previous release, so just add
it back to align with previous flow.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Change-Id: I113069494074194e116fdb1229052d2956bf90ea
2023-02-28 14:26:39 +08:00
Jacky Bai
4234b902ae feat(imx8m): add more dram pll setting
Add DRAM PLL frequency setting for 3200mts & 4000mts.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: I4b0609f9e7c0f35d75a26ec9ccebec77b3dbe68f
2023-02-28 14:26:39 +08:00
Jacky Bai
25c43233e8 fix(imx8m): fix the current fsp init
The dfimisc reg value should be shift right 8 bit to
get the current fsp.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
Change-Id: I4c8c166bc3ad4cc1376961cbf47631c68b5900cc
2023-02-28 14:26:39 +08:00
Jacky Bai
3330084979 fix(imx8m): fix the rank to rank space issue
update umctl2's setting based on phy training CDD value
to workaround the rank-to-rank space issue.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: I0fab18cdc378fda760daa0f89c4dd84eb46f7e11
2023-02-28 14:26:35 +08:00
Jacky Bai
ad0cbbf513 fix(imx8m): fix the dfiphymaster setting after dvfs
the dfi phy master setting need to be save/restore to make
sure it aligned with the initial config.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: I4f572b9aff9cc47a6c28524ce0fe03cdc66b88a1
2023-02-27 11:23:44 +08:00
Jacky Bai
0e39488ff3 feat(imx8m): update the ddr4 dvfs flow to include ddr3l support
the DDR3L & DDR4 can share same piece of code for DDR frequency scaling.
So update the ddr4 dvfs flow to support DDR3L too.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: Ifc6981f05ed8a4e399adad97690197a9680f554d
2023-02-27 11:22:51 +08:00
Jacky Bai
5277c09606 fix(imx8m): correct the rank info get fro mstr
the bitfield of active_ranks in MSTR is defined as below.
Correct the rank num get in dram_info.

  0x01: one rank;
  0x11: two rank;

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
Change-Id: Idcadb39f492a8fe81c973ac4136d9a1eaa32f54b
2023-02-27 11:21:32 +08:00
Jacky Bai
093888caaf feat(imx8m): fix the ddr4 dvfs random hang on imx8m
Remove the while loop waiting in step12 to align with what
we did before, just use a 'if' condition check for debug
purpose.

Tested-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: Id2685c5f628270a24944470d675a5c8706f39f13
2023-02-27 11:20:23 +08:00
Marco Felsch
6c8f523138 fix(imx8m): fix dram retention fsp_table access
The fsp_table access by [i-1] can cause invalid memory access in case of
i=0. This can be the case if no fsp_table is available. Fix this by
adding the idx variable which tracks the correct index.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Change-Id: If2285517eb9fe837f3ad54360307a77a658bf62c
2022-10-20 18:16:41 +02:00
Jacky Bai
9c336f6118 feat(imx8m): add the ddr frequency change support for imx8m family
Add the DDR frequency change support.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: If1167785796b8678c351569b83d2922c66f6e530
2022-06-27 09:27:11 +08:00
Jacky Bai
2003fa94dc feat(imx8mn): enable dram retention suuport on imx8mn
Enable dram retention support on i.MX8MN.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I9b3a08efbbd154b2fc7e41bedb36a4d4e3784448
2022-06-27 09:27:11 +08:00
Jacky Bai
c71793c647 feat(imx8m): add dram retention flow for imx8m family
Add the dram retention flow for i.MX8M SoC family.

Change-Id: Ifb8ba5b2f6f002133cf47c07fef73df29c51c890
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2022-06-27 09:27:11 +08:00