fix(nxp-drivers): ddr: corrects mapping of HNFs nodes

Corrects mapping of HNFs nodes with SNFs nodes based on their
proximity in CCN508 ring when disabling unused ddr controller.

When DDRC 2 disabled and DDR 1 is active the mapping is 0x3/3/8/8/8/8/3/3.
When DDRC 1 is disabled and DDR2 is active the mapping is 0x
18/18/13/13/13/13/18/18 .

Signed-off-by: Maninder Singh <maninder.singh_1@nxp.com>
Signed-off-by: JaiPrakash Singh <JaiPrakash.singh@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I6ec1e02f8ad7e8bb8628913625ff5313a054dcc6
This commit is contained in:
Maninder Singh 2021-12-30 00:09:32 -07:00 committed by Jiafei Pan
parent b19630037d
commit e3a234971a
1 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2021 NXP
* Copyright 2021-2022 NXP
*
* SPDX-License-Identifier: BSD-3-Clause
*
@ -33,8 +33,10 @@
#define CCN_HN_F_SAM_NODEID_DDR0 0x4
#define CCN_HN_F_SAM_NODEID_DDR1 0xe
#elif defined(NXP_HAS_CCN508)
#define CCN_HN_F_SAM_NODEID_DDR0 0x8
#define CCN_HN_F_SAM_NODEID_DDR1 0x18
#define CCN_HN_F_SAM_NODEID_DDR0_0 0x3
#define CCN_HN_F_SAM_NODEID_DDR0_1 0x8
#define CCN_HN_F_SAM_NODEID_DDR1_0 0x13
#define CCN_HN_F_SAM_NODEID_DDR1_1 0x18
#endif
unsigned long get_ddr_freq(struct sysinfo *sys, int ctrl_num)
@ -166,10 +168,21 @@ int disable_unused_ddrc(struct ddr_info *priv,
for (i = 0; i < num_hnf_nodes; i++) {
val = mmio_read_64((uintptr_t)hnf_sam_ctrl);
#ifdef NXP_HAS_CCN504
nodeid = disable_ddrc == 1 ? CCN_HN_F_SAM_NODEID_DDR1 :
(disable_ddrc == 2 ? CCN_HN_F_SAM_NODEID_DDR0 :
(i < 4 ? CCN_HN_F_SAM_NODEID_DDR0
: CCN_HN_F_SAM_NODEID_DDR1));
(disable_ddrc == 2 ? CCN_HN_F_SAM_NODEID_DDR0 :
0x0); /*Failure condition. never hit */
#elif defined(NXP_HAS_CCN508)
if (disable_ddrc == 1) {
nodeid = (i < 2 || i >= 6) ? CCN_HN_F_SAM_NODEID_DDR1_1 :
CCN_HN_F_SAM_NODEID_DDR1_0;
} else if (disable_ddrc == 2) {
nodeid = (i < 2 || i >= 6) ? CCN_HN_F_SAM_NODEID_DDR0_0 :
CCN_HN_F_SAM_NODEID_DDR0_1;
} else {
nodeid = 0; /* Failure condition. never hit */
}
#endif
if (nodeid != (val & CCN_HN_F_SAM_NODEID_MASK)) {
debug("Setting HN-F node %d\n", i);
debug("nodeid = 0x%x\n", nodeid);