Background:
DRAM devices uses rank/bank/row/column addresses to locate data.
EMI has multiple channels connecting to multiple DRAM devices.
When accessing DRAM, the given linear address needed to be translated
into rank/bank/row/column addresses. This translation is done by EMI
according to settings of hardware reigsters: emi_cona/f/h/k (which are
programmed based on the using DRAM device).
For debugging a DRAM issue (such as a DRAM bit-flip issue), the linear
address at which the issue was seen needs to be translated (to address
from DRAM point of view) to idenfiy the EMI channel number and DRAM
rank/bank numbers. This can help narrow down the issue to the exact
hardware component.
This patch adds a new function mtk_emicen_addr2dram() and export it for
translating an input address to addresses from DRAM point of view. For
compatibility, create new properties (hash value, dispatch value, version)
of the emicen device node since hash/dispatch values differ from platform
to platform and there is a new formula of translation for LPDDR5.
MTK-Commit-Id: 48d786cefe23d950e04ab1c535863bda4d9b466d
Change-Id: I7e9a8975fb56ce6e102bff2b1dfe27648d9e1bbe
Signed-off-by: mtk21827 <joanne.wang@mediatek.com>
CR-Id: ALPS05258267
Feature: External Memory Interface(emi)