board: toradex: verdin-imx8mm: set fixed LPDDR4 refresh rate as per errata ERR050805
authorAndrejs Cainikovs <andrejs.cainikovs@toradex.com>
Thu, 28 Sep 2023 14:39:33 +0000 (16:39 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 16 Oct 2023 06:46:01 +0000 (08:46 +0200)
commit35fe2ae244b13a06297f08cdc5785bf913708079
tree8d082ffbdc2e54818454496f3e7dba566f0928a6
parent3319eb8bc3968f9cae4af9f53aa39ebd156716f5
board: toradex: verdin-imx8mm: set fixed LPDDR4 refresh rate as per errata ERR050805

Update lpddr4 configuration and training using updated spreadsheet and
tools from NXP using data from previous spreadsheet and verified
toward datasheet:

- MX8M_Mini_LPDDR4_RPA_v22.xlsx
- mscale_ddr_tool_v3.31_setup.exe

The most relevant update is related to errata ERR050805:
"DRAM: Controller automatic derating logic may not work when
the LPDDR4 memory temperature is above 85 °C at initialization"

Other relevant fixes:
- DRAMTMG7 register: corrected calculation of T_CKPDX parameter
  (equal to tCKCKEH for LPDDR4)
- RANKCTL register: corrected calculations for ODTLon and ODTLoff
  to follow the JEDEC specification
- ADDRMAP7 register: added support for 17-row devices

As per errata ERR050805:

An issue exists with the automatic derating logic of the DDR
controller that only samples the LPDDR4 MR4 register when the
Temperature Update Flag (TUF) field (MR4[7] ) is 1’b1. If the
LPDDR4 memory is initialized and starts operation above 85 °C
(MR4[2:0] > 3’b011), the MR4 Temperature Update Flag (TUF) will
not be set. The DDR Controller will therefore not automatically
adjust the memory refresh rate or de-rate memory timings based
on the LPDDR4 memory temperature. This may cause the controller
incorrectly setting the refresh period, potentially cause the
LPDDR4 memory losing data contents and lead to possible data
integrity issues above 85 °C.

Errata provides three possible workaround options, while option 2
is the most reasonable:

Disable the automatic derating logic of the DDR controller and
apply fixed x2 refresh rate (0.5x refresh). This option is
suitable for designs that are expected to boot at or above 85 °C
and memory’s MR4[2:0] (Refresh Rate) DOES NOT report the following
conditions:
3b101: 0.25x refresh, no de-rating
3b110: 0.25x refresh, with de-rating
3b111: SDRAM High temperature operating limit exceeded

[1]: https://www.nxp.com/docs/en/errata/IMX8MM_0N87W.pdf

Signed-off-by: Andrejs Cainikovs <andrejs.cainikovs@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
board/toradex/verdin-imx8mm/lpddr4_timing.c