From 4ca0f767297985eb3498ac96a8ae4013ec73433a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=A6=E5=B3=B0?= Date: Mon, 20 May 2024 21:52:54 +0800 Subject: [PATCH] add single/dual rank support Change-Id: I633daa4a871f93c5b4d897b1d60ed23bcc198912 --- board/thead/light-c910/lpddr4/include/ddr_retention.h | 2 ++ board/thead/light-c910/lpddr4/src/ddr_retention.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/board/thead/light-c910/lpddr4/include/ddr_retention.h b/board/thead/light-c910/lpddr4/include/ddr_retention.h index 42eb034f..9e1d34aa 100644 --- a/board/thead/light-c910/lpddr4/include/ddr_retention.h +++ b/board/thead/light-c910/lpddr4/include/ddr_retention.h @@ -28,6 +28,8 @@ typedef enum { typedef struct Ddr_Reg_Config { uint32_t misc_reg_num; uint32_t phy_reg_num; + uint8_t ddr_rank; + uint8_t reserve[55]; } Ddr_Reg_Config_t; int dwc_ddrphy_phyinit_regInterface(regInstr myRegInstr); diff --git a/board/thead/light-c910/lpddr4/src/ddr_retention.c b/board/thead/light-c910/lpddr4/src/ddr_retention.c index eed83aac..bfbe0bf9 100644 --- a/board/thead/light-c910/lpddr4/src/ddr_retention.c +++ b/board/thead/light-c910/lpddr4/src/ddr_retention.c @@ -1009,6 +1009,11 @@ int dwc_ddrphy_phyinit_regInterface(regInstr myRegInstr) { uint32_t phy_reg_num = ARRAY_SIZE(RetRegList_addr); ddr_Regu_Config->phy_reg_num = phy_reg_num; +#ifdef CONFIG_DDR_DUAL_RANK + ddr_Regu_Config->ddr_rank = 2; +#else + ddr_Regu_Config->ddr_rank = 1; +#endif Reg_Phy_Addr_Val_t* phy_addr_t = (Reg_Phy_Addr_Val_t*)((char*)ddr_Regu_Config + 64 + sizeof(Reg_Misc_Addr_Val_t) * ARRAY_SIZE(MiscRegList)); #ifdef CONFIG_DDR_MSG