rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #ifndef _PI_API_H |
| 2 | #define _PI_API_H |
| 3 | |
| 4 | /***********************************************************************/ |
| 5 | /* Includes */ |
| 6 | /***********************************************************************/ |
| 7 | |
| 8 | /***********************************************************************/ |
| 9 | /* Constant Define */ |
| 10 | /***********************************************************************/ |
| 11 | |
| 12 | #ifndef __FLASH_TOOL_DA__ |
| 13 | #define __FLASH_TOOL_DA__ 0 |
| 14 | #else |
| 15 | #undef __FLASH_TOOL_DA__ |
| 16 | #define __FLASH_TOOL_DA__ 1 |
| 17 | #endif |
| 18 | #define SW_CHANGE_FOR_SIMULATION 0 //calibration funciton for whole chip simulation. Code changed due to different compiler |
| 19 | #define FOR_DV_SIMULATION_USED 0 ////calibration funciton for DV simulation. Code changed due to different compiler |
| 20 | #define FT_DSIM_USED 0 |
| 21 | //#define DUMP_INIT_RG_LOG_TO_DE //dump init RG settings to DE |
| 22 | //#define DUMP_INIT_AND_K_RG_LOG_TO_DE //dump init and calibration RG settings to DE |
| 23 | //#define SLT |
| 24 | |
| 25 | #if FOR_DV_SIMULATION_USED |
| 26 | #include "typedefs.h" |
| 27 | #else |
| 28 | #if(!SW_CHANGE_FOR_SIMULATION) |
| 29 | #if __FLASH_TOOL_DA__ |
| 30 | #include "sw_types.h" |
| 31 | #else |
| 32 | #include <platform/mt_typedefs.h> |
| 33 | #include <string.h> |
| 34 | #include <assert.h> |
| 35 | #endif |
| 36 | #endif |
| 37 | #endif |
| 38 | |
| 39 | //Bring Up Selection : Do Not open it when normal operation |
| 40 | //#define FIRST_BRING_UP |
| 41 | #define BIANCO_TO_BE_PORTING |
| 42 | #define CERVINO_TO_BE_PORTING |
| 43 | |
| 44 | //DRAMC Chip |
| 45 | #define fcA60501 1 |
| 46 | #define fcElbrus 3 |
| 47 | #define fcOlympus 4 |
| 48 | #define fcA60838 5 |
| 49 | #define fcWhitney 6 |
| 50 | #define fcAlaska 7 |
| 51 | #define fcBianco 8 |
| 52 | #define fcSylvia 9 |
| 53 | #define fcCannon 10 |
| 54 | #define fcCervino 11 |
| 55 | #define fcLaurel 12 |
| 56 | #define fcFOR_CHIP_ID fcLaurel |
| 57 | #define fcFOR_PINMUX fcLaurel |
| 58 | |
| 59 | #define VENDOR_SAMSUNG 1 |
| 60 | #define VENDOR_HYNIX 6 |
| 61 | #define VENDOR_MICRON 0xFF |
| 62 | #define REVISION_ID_MAGIC 0x9501 |
| 63 | |
| 64 | #define CHANNEL_NUM 2 // 1 single channel, 2 dual channel, 4 4 channel |
| 65 | #define DUAL_RANK_ENABLE 1 |
| 66 | |
| 67 | |
| 68 | //Feature option |
| 69 | #define ENABLE_LP4_ZQ_CAL 1 |
| 70 | #define ENABLE_CA_TRAINING 1 |
| 71 | #define ENABLE_WRITE_LEVELING 1 |
| 72 | #define ENABLE_PHY_RX_INPUT_OFFSET 0 |
| 73 | #define ENABLE_LOW_POWER_BOOT 0 |
| 74 | #define ENABLE_DUTY_SCAN_V2 1 |
| 75 | #define DUTY_SCAN_V2_ONLY_K_HIGHEST_FREQ 0 // 0: K all Freq 1: K highest Freq |
| 76 | #define APPLY_DQDQM_DUTY_CALIBRATION 1 //0: no support(Cann_on\Sylv_ia\merl_ot\cervi_no) 1: support(Eig_er) |
| 77 | //#define YH_SWEEP_IC |
| 78 | |
| 79 | |
| 80 | //#define SOLUTION_FOR_SS_B422_TX_WIN_TOO_SMALL 1 //Only for Bianco, Only for Samsung normal mode (B422), Only for DRVP >=15 ==> Set DRAM ODT to RZQ/3 (80ohm) |
| 81 | |
| 82 | #define TX_DQ_PRE_EMPHASIS 0 //pre-emphasis shoulde be adjusted by different frequency and IMP |
| 83 | #define AC_TIMING_DERATE_ENABLE 0 |
| 84 | |
| 85 | //SW option |
| 86 | #define DUAL_FREQ_K 0 // If enable, need to define DDR_xxxx the same as DUAL_FREQ_HIGH |
| 87 | |
| 88 | #define ENABLE_SLT 0 |
| 89 | #define EVEREST_PORTING_TODO 0 |
| 90 | #define ENABLE_RANK_NUMBER_AUTO_DETECTION 1 //only can enable when DUAL_RANK_ENABLE is 1 |
| 91 | #define SPECIAL_WORKAROUND_FOR_LP4 1///TODO: will be removed |
| 92 | #define SPECIAL_WA_LP4_TERM_FREQ 1200 |
| 93 | |
| 94 | // For code size limitation issue, these 3 #define listed below MAY NOT be open at the same time. |
| 95 | #define EYESCAN_LOG __ETT__ //draw eye diagram after calibration. |
| 96 | #define ENABLE_LP3_SW 1// for LP4 only project, can set to 0 to save code size. |
| 97 | #define ENABLE_LOW_POWER_FLOW 0 |
| 98 | |
| 99 | |
| 100 | #define REDUCE_LOG_FOR_PRELOADER 1 |
| 101 | #define APPLY_LP4_POWER_INIT_SEQUENCE 1 |
| 102 | #define CA_TRAINING_K_RANK1_ENABLE 1 |
| 103 | #define ENABLE_READ_DBI 0 |
| 104 | #define ENABLE_WRITE_DBI 1 |
| 105 | #define ENABLE_WRITE_DBI_Protect 0 |
| 106 | #define ENABLE_TX_WDQS 1 |
| 107 | #define ENABLE_DRS 0 |
| 108 | |
| 109 | #ifdef DUMP_INIT_AND_K_RG_LOG_TO_DE |
| 110 | #define DUMP_INIT_RG_LOG_TO_DE |
| 111 | #undef ENABLE_TX_WDQS |
| 112 | #define ENABLE_TX_WDQS 0 |
| 113 | #endif |
| 114 | |
| 115 | /* If defined: Use LP4_DDR3733 as highest freq |
| 116 | * If not defined: Use LP4_DDR3200 as highest freq |
| 117 | */ |
| 118 | #define LP4_HIGHEST_DDR3733 0 |
| 119 | #if LP4_HIGHEST_DDR3733 |
| 120 | #define LP4_HIGHEST_FREQ (1866) |
| 121 | #define LP4_MIDDLE_FREQ (1600) |
| 122 | #define LP4_LOWEST_FREQ (800) |
| 123 | #define LP4_HIGHEST_FREQSEL (LP4_DDR3733) |
| 124 | #define LP4_MIDDLE_FREQSEL (LP4_DDR3200) |
| 125 | #define LP4_LOWEST_FREQSEL (LP4_DDR1600) |
| 126 | #else //LP4_HIGHEST_DDR3200 |
| 127 | #define LP4_HIGHEST_FREQ (1600) |
| 128 | #define LP4_MIDDLE_FREQ (1200) |
| 129 | #define LP4_LOWEST_FREQ (800) |
| 130 | #define LP4_HIGHEST_FREQSEL (LP4_DDR3200) |
| 131 | #define LP4_MIDDLE_FREQSEL (LP4_DDR2400) |
| 132 | #define LP4_LOWEST_FREQSEL (LP4_DDR1600) |
| 133 | #endif |
| 134 | |
| 135 | |
| 136 | // Sw work around options. |
| 137 | #define WRITE_LEVELING_MOVE_DQS_INSTEAD_OF_CLK 1 // work around for clock multi phase problem(cannot move clk or the clk will be bad) |
| 138 | #define CA_TRAIN_RESULT_DO_NOT_MOVE_CLK 1 // work around for clock multi phase problem(cannot move clk or the clk will be bad) |
| 139 | #define TX_PERBIT_INIT_FLOW_CONTROL 1 // work around for clock multi phase problem(cannot move clk or the clk will be bad) |
| 140 | #define DramcHWDQSGatingTracking_DVT_JADE_TRACKING_MODE 0 |
| 141 | #define DramcHWDQSGatingTracking_DVT_FIFO_MODE 1 |
| 142 | #define DramcHWDQSGatingTracking_DVT_LP3_FIFO_MODE 1 |
| 143 | |
| 144 | //if SAMSUNG_TEST_MODE_MRS_FOR_PRELOADER == 0, Disable |
| 145 | //if SAMSUNG_TEST_MODE_MRS_FOR_PRELOADER == 1, Buffer sensitivity decrease1, test 2. TMRS enter -> 000 -> 390 -> 120 -> 8A7 |
| 146 | //if SAMSUNG_TEST_MODE_MRS_FOR_PRELOADER == 2, Buffer sensitivity decrease2, test 3. TMRS enter -> 000 -> 390 -> 120 -> 803 |
| 147 | //if SAMSUNG_TEST_MODE_MRS_FOR_PRELOADER == 3, xxxxxxxxxxxxxxxxxxxxxxxxxxxx, test 4. TMRS enter -> 000 -> 390 -> 120 -> 014 -> 863 |
| 148 | //if SAMSUNG_TEST_MODE_MRS_FOR_PRELOADER == 4, Separate Rd fail/write fail , test 5. TMRS enter -> 000 -> 390 -> 120 -> 52A |
| 149 | #define SAMSUNG_TEST_MODE_MRS_FOR_PRELOADER 0 |
| 150 | |
| 151 | /* Samsung's 1xnm LP4(X) uses nWR & RL settings to determine the freq range it operates at |
| 152 | * Frequency info determined by nWR & RL is used to adjust write-related internal timing(Write Pulse Width = WCSL) other than auto-precharge |
| 153 | * For all samsung LP4 dram 1. Fix nWR to 30 2. tWTR@800Mhz: "original tWTR" + 2tCK |
| 154 | */ |
| 155 | #define SAMSUNG_LP4_NWR_WORKAROUND 1 |
| 156 | |
| 157 | //Definitions indicating DRAMC, DDRPHY register shuffle offset |
| 158 | #define SHU_GRP_DRAMC_OFFSET 0x600 |
| 159 | #define SHU_GRP_DDRPHY_OFFSET 0x500 |
| 160 | |
| 161 | //init for test engine |
| 162 | #define DEFAULT_TEST2_1_CAL 0x55000000 // pattern0 and base address for test engine when we do calibration |
| 163 | #if (FOR_DV_SIMULATION_USED!=0) |
| 164 | //because cmd_len=1 has bug with byte mode, so need to set cmd_len=0, then it will cost more time to do a pattern test |
| 165 | //workaround: reduce TEST2_OFF to make less test agent cmd. make lpddr4-1600 can finish in 60us |
| 166 | #define DEFAULT_TEST2_2_CAL 0xaa000020 // pattern1 and offset address for test engine when we do calibraion |
| 167 | #else |
| 168 | //change offset to 0x100, confirm with YH Tsai and Chris. xtalk length 0x20, 0x100 is long enough. |
| 169 | #define DEFAULT_TEST2_2_CAL 0xaa000100 // pattern1 and offset address for test engine when we do calibraion |
| 170 | #endif |
| 171 | #define CMP_CPT_POLLING_PERIOD 1 // timeout for TE2: (CMP_CPT_POLLING_PERIOD X MAX_CMP_CPT_WAIT_LOOP) |
| 172 | #define MAX_CMP_CPT_WAIT_LOOP 10000 // max loop |
| 173 | |
| 174 | // common |
| 175 | #define DQS_NUMBER 4 |
| 176 | #define DQS_NUMBER_LP4 2 |
| 177 | #define DQS_BIT_NUMBER 8 |
| 178 | #define DQ_DATA_WIDTH 32 // define max support bus width in the system (to allocate array size) |
| 179 | #define DQ_DATA_WIDTH_LP4 16 |
| 180 | #define TIME_OUT_CNT 100 //100us |
| 181 | #define HW_REG_SHUFFLE_MAX 4 |
| 182 | |
| 183 | //for CBT |
| 184 | #define CLK_SHIFT_PI_DELAY 0 //16 to scan CA before CLK |
| 185 | #define CBT_SPEED_UP_CALIBRATION 1 //0 : disable 1: enable |
| 186 | |
| 187 | // Gating window |
| 188 | #define DQS_GW_COARSE_STEP 1//8 // for testing// 1 |
| 189 | #define DQS_GW_FINE_START 0 |
| 190 | #define DQS_GW_FINE_END 32 |
| 191 | #define DQS_GW_FINE_STEP 4 |
| 192 | #define GATING_ADJUST_TXDLY_FOR_TRACKING 1 |
| 193 | /* When DQS_GW_7UI is |
| 194 | * defined: 7UI burst length gating mode |
| 195 | * not defined: 8UI burst length gating mode |
| 196 | */ |
| 197 | #define DQS_GW_7UI |
| 198 | |
| 199 | // DATLAT |
| 200 | #define DATLAT_TAP_NUMBER 32 // DATLAT[3:0] = {0x80[20:4]} |
| 201 | |
| 202 | // RX DQ/DQS |
| 203 | #define MAX_RX_DQSDLY_TAPS 127 // 0x018, May set back to 64 if no need. |
| 204 | #define MAX_RX_DQDLY_TAPS 63 // 0x210~0x22c, 0~15 delay tap |
| 205 | |
| 206 | // TX DQ/DQS |
| 207 | #define MAX_TX_DQDLY_TAPS 31 // max DQ TAP number |
| 208 | #define MAX_TX_DQSDLY_TAPS 31 // max DQS TAP number |
| 209 | #define TX_OE_EXTEND 0 |
| 210 | #if TX_OE_EXTEND |
| 211 | #define TX_DQ_OE_SHIFT_LP4 4 |
| 212 | #else |
| 213 | #define TX_DQ_OE_SHIFT_LP4 3 |
| 214 | #endif |
| 215 | #define TX_DQ_OE_SHIFT_LP3 2 |
| 216 | #define TX_K_DQM_WITH_WDBI 1 |
| 217 | #define TX_OE_CALIBATION (!TX_OE_EXTEND) |
| 218 | |
| 219 | // DVFS |
| 220 | // need to review #if & #ifdef, Jeremy |
| 221 | #define TDQSCK_PRECALCULATION_FOR_DVFS 1//DQS pre-calculation |
| 222 | #define ENABLE_DLL_ALL_SLAVE_MODE 1 //set DLL to all slave mode to reduce 70mck during DVFS (data rate <= DDR1866) |
| 223 | #define DLL_ASYNC_MODE 0 //0:Sync mode(old),CHB CA will be slave; 1:Async mode(new),CHB CA will be master |
| 224 | #define ENABLE_DVS 1 |
| 225 | #define DRAMC_DFS_MODE 1 //0:RG/SPM, 1:SPM, 2:RG |
| 226 | |
| 227 | //DVT test |
| 228 | #define DVT_TEST_DUMMY_RD_SIDEBAND_FROM_SPM 0 |
| 229 | #define DVT_TEST_DUMMY_READ_FOR_DQS_GATING_TRACKING 0 |
| 230 | |
| 231 | //Run time config |
| 232 | #define HW_GATING //DQS strobe calibration enable |
| 233 | //#define GATING_7UI_FOR_TRACKING /* Use DQS_GW_7UI instead */ |
| 234 | #define DUMMY_READ_FOR_TRACKING |
| 235 | #define ENABLE_SW_RUN_TIME_ZQ_WA 0 |
| 236 | #if !ENABLE_SW_RUN_TIME_ZQ_WA |
| 237 | #define ZQCS_ENABLE_LP4 //Whitney E1 can't enable HQZQ, enable SW ZQ @ kernel. |
| 238 | #endif |
| 239 | #define ZQCS_ENABLE_LP3 //Enable LP3 ZQCS run time because of DRS de-feature. |
| 240 | #define TEMP_SENSOR_ENABLE //After enable rumtime MR4 read, Get DramC SPCMDRESP_REFRESH_RATE. |
| 241 | #if(!SW_CHANGE_FOR_SIMULATION) |
| 242 | #define APPLY_LOWPOWER_GOLDEN_SETTINGS 1 //Low pwer settings |
| 243 | #define SPM_CONTROL_AFTERK //Disable in bring-up and enable thereafter. |
| 244 | #else |
| 245 | #define APPLY_LOWPOWER_GOLDEN_SETTINGS 0 //Low pwer settings |
| 246 | #endif |
| 247 | #define IMPEDANCE_TRACKING_ENABLE //Impendence tracking |
| 248 | #define IMPEDANCE_HW_SAVING //mask because function fail, it lets clk swing change larger before DVFS occurs |
| 249 | |
| 250 | #define MR13_RRO 1 //MR4 refresh rate option, 0:Disable codes 001 and 010 in MR4 OP[2:0] 1:Enable all codes in MR4 OP[2:0] |
| 251 | |
| 252 | //Lewis@20170508: Undefine DUMMY_READ_FOR_DQS_GATING_RETRY since SPM not use it. |
| 253 | //#define DUMMY_READ_FOR_DQS_GATING_RETRY //LP4, LP4X: DQS gating retry controlled by SPM side band signal, dummy read rank selection controlled by test agent for DQS gating retry |
| 254 | //LP3: Disable DQS gating retry |
| 255 | #define HW_SAVE_FOR_SR |
| 256 | #define CLK_FREE_FUN_FOR_DRAMC_PSEL //If Psel is 1, clock will be free run at the periof of 2T to let conf be applied. |
| 257 | //If Psel is 0, Clock will be gated |
| 258 | #define PA_IMPROVEMENT_FOR_DRAMC_ACTIVE_POWER 1 //DE PIC: Jouling, PowerArtist enables RTL-to-GDS design for power methodology by providing early RTL power estimation and analysis-driven power reduction capabilities |
| 259 | //#define MPC_SW_FIFO //LPDDR4 WRFIFO and RDFIFO |
| 260 | |
| 261 | #define ENABLE_TX_TRACKING 1 |
| 262 | #if ENABLE_TX_TRACKING |
| 263 | #if (__ETT__) |
| 264 | #define ENABLE_SW_TX_TRACKING 0 |
| 265 | #else |
| 266 | #define ENABLE_SW_TX_TRACKING 0 |
| 267 | #endif |
| 268 | #endif |
| 269 | #define ENABLE_RX_TRACKING_LP4 1 |
| 270 | #define ENABLE_PER_BANK_REFRESH 1 |
| 271 | |
| 272 | #define ENABLE_RODT_TRACKING 1 |
| 273 | #define ENABLE_RODT_TRACKING_SAVE_MCK 0 //Maybe turn on behind Vinson project |
| 274 | #define ENABLE_TMRRI_NEW_MODE 1 |
| 275 | #ifdef LOOPBACK_TEST |
| 276 | #undef ENABLE_TMRRI_NEW_MODE |
| 277 | #define ENABLE_TMRRI_NEW_MODE 0 |
| 278 | #endif |
| 279 | |
| 280 | //Debug option |
| 281 | #define CHECK_GOLDEN_SETTING 0 |
| 282 | #define CHECK_GOLDEN_SETTING_LP2 0 // 1: check LP2 0: check LP4 |
| 283 | |
| 284 | #define GATING_ONLY_FOR_DEBUG 0 |
| 285 | #define RX_DLY_TRACK_ONLY_FOR_DEBUG 0 // LP4 only, LP3 not support |
| 286 | #define CPU_RW_TEST_AFTER_K 0// need to enable GATING_ONLY_FOR_DEBUG at the same time for gating debug log |
| 287 | #define TA2_RW_TEST_AFTER_K 1 |
| 288 | #if (ENABLE_SLT == 1) |
| 289 | #undef CPU_RW_TEST_AFTER_K |
| 290 | #undef TA2_RW_TEST_AFTER_K |
| 291 | #define CPU_RW_TEST_AFTER_K 0// need to enable GATING_ONLY_FOR_DEBUG at the same time for gating debug log |
| 292 | #define TA2_RW_TEST_AFTER_K 0 |
| 293 | #endif |
| 294 | #define MRW_CHECK_ONLY 0 |
| 295 | |
| 296 | //PINMUX auto test per bit related |
| 297 | #define PINMUX_AUTO_TEST_PER_BIT_CA 0 //LP2 LP4 |
| 298 | #define PINMUX_AUTO_TEST_PER_BIT_RX 0 //LP4 |
| 299 | #define PINMUX_AUTO_TEST_PER_BIT_RX_LP3 0 //LP2 |
| 300 | #define PINMUX_AUTO_TEST_PER_BIT_TX 0 //LP4 only |
| 301 | |
| 302 | #if (FOR_DV_SIMULATION_USED==0) |
| 303 | #define ETT_PRINT_FORMAT // Apply for both preloader and ETT |
| 304 | #endif |
| 305 | #define LJPLL_FREQ_DEBUG_LOG 0 |
| 306 | #if (__ETT__) || defined(SLT) || (FT_DSIM_USED) |
| 307 | #define ENABLE_DDRPHY_FREQ_METER 1 |
| 308 | #endif |
| 309 | #define SUPPORT_LP3_800 1 // cross rank parameters are over spec. cannot support |
| 310 | #define CLOCKDUTY_SCAN_FOR_SLT_ONLY 0 // 1: for SLT test used |
| 311 | #define PRINT_CALIBRATION_SUMMARY (!SW_CHANGE_FOR_SIMULATION) |
| 312 | //... add new feature compile option here. |
| 313 | //#define RX_DLY_TRACKING_VERIFY 0 // not implemented |
| 314 | |
| 315 | //misc feature |
| 316 | #define ENABLE_DQ3200_UNTERM 0 // 0: not support, 1: enable unterm swimp cal setting with 30 ohm @ DDR3200 |
| 317 | #if (ENABLE_DQ3200_UNTERM == 1) |
| 318 | #undef IMPEDANCE_TRACKING_ENABLE |
| 319 | #endif |
| 320 | //#define ENABLE_HW_IMPCAL |
| 321 | |
| 322 | #define XRTW2W_PERFORM_ENHANCE_TX |
| 323 | #define XRTR2R_PERFORM_ENHANCE_DQSG_RX_DLY |
| 324 | //#define XRTR2W_PERFORM_ENHANCE_RODTEN //conflict with ENABLE_RODT_TRACKING, LP4 support only |
| 325 | |
| 326 | #define APPLY_SIGNAL_WAVEFORM_SETTINGS_ADJUST 1 //adjust IMP DRVP and DQ ODT RZQ(MR11) in the test menu |
| 327 | #define DRAMC_MODEREG_CHECK 1 |
| 328 | |
| 329 | |
| 330 | /* LEGACY_DELAY_CELL: Initial DQ delay cell settings (originated from DE's mem.c) |
| 331 | * Preserved here for 1. "DV_SIM" + "TX calibration bypassed" 2. May be required for high freq initial ModeRegWrite? |
| 332 | */ |
| 333 | #if (FOR_DV_SIMULATION_USED==0) |
| 334 | #define LEGACY_DELAY_CELL 1 |
| 335 | #define LEGACY_TX_TRACK 0 //Legacy TX tracking redundant initial settings (actual correct values are set during calibration) |
| 336 | #define LEGACY_TDQSCK_PRECAL 0 //Legacy tDQSCK precal redundant initial settings (actual correct values are set during calibration) |
| 337 | #define LEGACY_GATING_DLY 0 //Legacy settings which correct values are calibrated/set during gating |
| 338 | #define LEGACY_RX_DLY 0 //Legacy settings which correct values are calibrated/set during DramcRxWindowPerbitCal() |
| 339 | #else |
| 340 | #define LEGACY_DELAY_CELL 1 |
| 341 | #define LEGACY_TX_TRACK 1 //Legacy TX tracking redundant initial settings (actual correct values are set during calibration) |
| 342 | #define LEGACY_TDQSCK_PRECAL 1 //Legacy tDQSCK precal redundant initial settings (actual correct values are set during calibration) |
| 343 | #define LEGACY_GATING_DLY 1 //Legacy settings which correct values are calibrated/set during gating |
| 344 | #define LEGACY_RX_DLY 1 //Legacy settings which correct values are calibrated/set during DramcRxWindowPerbitCal() |
| 345 | #endif |
| 346 | |
| 347 | #ifdef DUMP_INIT_RG_LOG_TO_DE |
| 348 | #define LP3_CATRAING_SHIFT_CLK_PI 0 |
| 349 | #define LP3_MR_INIT_AFTER_CA_TRAIN 0 |
| 350 | #else |
| 351 | #define LP3_CATRAING_SHIFT_CLK_PI 0 |
| 352 | #define LP3_MR_INIT_AFTER_CA_TRAIN 0 // Do mode register init after CA training |
| 353 | #endif |
| 354 | #define LP3_CA_PER_BIT 1 |
| 355 | |
| 356 | #define CA_PER_BIT_DELAY_CELL 1 /* LP4 */ |
| 357 | #if PINMUX_AUTO_TEST_PER_BIT_CA |
| 358 | #undef CA_PER_BIT_DELAY_CELL |
| 359 | #define CA_PER_BIT_DELAY_CELL 0 |
| 360 | #undef LP3_CA_PER_BIT |
| 361 | #define LP3_CA_PER_BIT 0 |
| 362 | #endif |
| 363 | |
| 364 | #define ENABLE_MIOCK_JMETER // for TX_PER_BIT_DELAY_CELL |
| 365 | |
| 366 | /* HQA debug option - Calibration results summary |
| 367 | * 1. Enabled in ETT |
| 368 | * 2. Disabled in preloader |
| 369 | * (May be enabled manually) |
| 370 | */ |
| 371 | #if (__ETT__) |
| 372 | #define FOR_HQA_TEST_USED // HQA test used, to print result for easy report |
| 373 | #define FOR_HQA_REPORT_USED // print out special format result for HQA make report used, from Arnold |
| 374 | #endif |
| 375 | |
| 376 | //#define DEVIATION // for special test used |
| 377 | |
| 378 | //#define ENABLE_POST_PACKAGE_REPAIR |
| 379 | //#define POST_PACKAGE_REPAIR_LP4 //Sub switch for LP4 |
| 380 | //#define SKH_POST_PACKAGE_REPAIR_LP3 //Sub switch for LP3 |
| 381 | |
| 382 | #ifdef ENABLE_POST_PACKAGE_REPAIR |
| 383 | #define SK_CHANNEL_BITS 2 |
| 384 | #define SK_BYTE_BITS 4 |
| 385 | #define SK_RANK_BITS 2 |
| 386 | #define SK_BANK_BITS 8 |
| 387 | #define SK_ROW_BITS 15 |
| 388 | #endif |
| 389 | |
| 390 | #define RUNTIME_SHMOO_RELEATED_FUNCTION CFG_DRAM_SAVE_FOR_RUNTIME_SHMOO |
| 391 | #define RUNTIME_SHMOO_RG_BACKUP_NUM (200) |
| 392 | |
| 393 | #if (__ETT__) |
| 394 | /* 1. Add test file (ex: ft_scan_test.c or fpc_lpbk_mem.c) in the ett\makefile (C_SRC_FILES = ft_scan_test.c ...) |
| 395 | * 2. Enable LOOPBACK_TEST define and others(below) |
| 396 | * 3. Enable VCORE_SHMOO |
| 397 | */ |
| 398 | /* |
| 399 | #define LOOPBACK_TEST |
| 400 | //#define DDR1600_LPBK |
| 401 | //#define DDR2667_LPBK |
| 402 | //#define DDR3200_LPBK |
| 403 | #define DDR3733_LPBK |
| 404 | #define LPBK_INTERNAL_EN |
| 405 | #define DDRPHY_LPBK_CAL_EN |
| 406 | #define EN_DDR3733 |
| 407 | */ |
| 408 | //#define VCORE_SHMOO |
| 409 | #ifdef VCORE_SHMOO |
| 410 | #define VCORE_SHMOO_RX_TX_SCAN 0 //for Rx_Tx_scan pattern |
| 411 | #endif |
| 412 | #endif |
| 413 | |
| 414 | #define ETT_NO_DRAM 0 //For ETT power measure, test with NO DRAM |
| 415 | |
| 416 | |
| 417 | #if !__ETT__ |
| 418 | #define EMMC_READY 0 |
| 419 | #if (FOR_DV_SIMULATION_USED==0) |
| 420 | // Preloader: using config CFG_DRAM_CALIB_OPTIMIZATION to identify |
| 421 | #define SUPPORT_SAVE_TIME_FOR_CALIBRATION EMMC_READY |
| 422 | #else |
| 423 | // DV simulation, use full calibration flow |
| 424 | #define SUPPORT_SAVE_TIME_FOR_CALIBRATION 0 |
| 425 | #endif |
| 426 | #define BYPASS_VREF_CAL (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 427 | #define BYPASS_CBT (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 428 | #define BYPASS_DATLAT (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 429 | #define BYPASS_WRITELEVELING (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 430 | #define BYPASS_RDDQC (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 431 | #define BYPASS_RXWINDOW (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 432 | #define BYPASS_TXWINDOW (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 433 | #define BYPASS_GatingCal (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 434 | #define BYPASS_CA_PER_BIT_DELAY_CELL (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 435 | //#define BYPASS_TX_PER_BIT_DELAY_CELL (SUPPORT_SAVE_TIME_FOR_CALIBRATION & EMMC_READY) |
| 436 | #else |
| 437 | // ETT |
| 438 | #define EMMC_READY 0 |
| 439 | #define SUPPORT_SAVE_TIME_FOR_CALIBRATION 0 |
| 440 | #define BYPASS_VREF_CAL 1 |
| 441 | #define BYPASS_CBT 1 |
| 442 | #define BYPASS_DATLAT 1 |
| 443 | #define BYPASS_WRITELEVELING 1 |
| 444 | #define BYPASS_RDDQC 1 |
| 445 | #define BYPASS_RXWINDOW 1 |
| 446 | #define BYPASS_TXWINDOW 1 |
| 447 | #define BYPASS_GatingCal 1 |
| 448 | #define BYPASS_CA_PER_BIT_DELAY_CELL CA_PER_BIT_DELAY_CELL |
| 449 | //#define BYPASS_TX_PER_BIT_DELAY_CELL 0 |
| 450 | //for DRAM calibration data stored in emmc trial-run: disable LP3 to reduce code size for msdc driver |
| 451 | //#if SUPPORT_SAVE_TIME_FOR_CALIBRATION |
| 452 | //#undef ENABLE_LP3_SW |
| 453 | //#define ENABLE_LP3_SW 0 |
| 454 | //#endif |
| 455 | #endif |
| 456 | |
| 457 | //============================ For Future Definition ================================= |
| 458 | |
| 459 | #define ENABLE_DVFS_CDC_SYNCHRONIZER_OPTION 1 |
| 460 | #define ENABLE_DVFS_BYPASS_MR13_FSP 0 |
| 461 | #define MRFSP_TERM_FREQ 1200 |
| 462 | #define FIX_CROSSRK_XRT_05T_OPT 1 |
| 463 | #define RX_PIPE_BYPASS_EN 0 |
| 464 | #define CBT_MOVE_CA_INSTEAD_OF_CLK 1 |
| 465 | |
| 466 | //============================================================================= |
| 467 | |
| 468 | //======================== FIRST_BRING_UP Init Definition ===================== |
| 469 | #ifdef FIRST_BRING_UP |
| 470 | |
| 471 | //#define USE_CLK26M |
| 472 | |
| 473 | #undef DUAL_FREQ_K |
| 474 | #define DUAL_FREQ_K 0 |
| 475 | |
| 476 | #undef TDQSCK_PRECALCULATION_FOR_DVFS |
| 477 | #define TDQSCK_PRECALCULATION_FOR_DVFS 0//DQS pre-calculation |
| 478 | |
| 479 | #undef CHANNEL_NUM |
| 480 | #define CHANNEL_NUM 2 |
| 481 | #undef DUAL_RANK_ENABLE |
| 482 | #define DUAL_RANK_ENABLE 1 |
| 483 | |
| 484 | #undef ENABLE_DUTY_SCAN_V2 |
| 485 | #define ENABLE_DUTY_SCAN_V2 0 |
| 486 | |
| 487 | #undef ENABLE_DRS |
| 488 | #define ENABLE_DRS 0 |
| 489 | |
| 490 | #undef ENABLE_CA_TRAINING |
| 491 | #define ENABLE_CA_TRAINING 1 |
| 492 | #undef ENABLE_WRITE_LEVELING |
| 493 | #define ENABLE_WRITE_LEVELING 1 |
| 494 | #undef ENABLE_PHY_RX_INPUT_OFFSET |
| 495 | #define ENABLE_PHY_RX_INPUT_OFFSET 0 |
| 496 | |
| 497 | //#undef REDUCE_LOG_FOR_PRELOADER |
| 498 | //#define REDUCE_LOG_FOR_PRELOADER 0 |
| 499 | |
| 500 | #undef REDUCE_CALIBRATION_OLYMPUS_ONLY |
| 501 | #define REDUCE_CALIBRATION_OLYMPUS_ONLY 0 |
| 502 | |
| 503 | #undef APPLY_LOWPOWER_GOLDEN_SETTINGS |
| 504 | #define APPLY_LOWPOWER_GOLDEN_SETTINGS 1 |
| 505 | |
| 506 | #undef TX_K_DQM_WITH_WDBI |
| 507 | #define TX_K_DQM_WITH_WDBI 0 |
| 508 | |
| 509 | #undef EYESCAN_LOG |
| 510 | #define EYESCAN_LOG 0 |
| 511 | |
| 512 | #undef PA_IMPROVEMENT_FOR_DRAMC_ACTIVE_POWER |
| 513 | #define PA_IMPROVEMENT_FOR_DRAMC_ACTIVE_POWER 0 |
| 514 | |
| 515 | #undef ENABLE_TX_TRACKING |
| 516 | #undef ENABLE_SW_TX_TRACKING |
| 517 | #define ENABLE_TX_TRACKING 0 |
| 518 | #define ENABLE_SW_TX_TRACKING 0 |
| 519 | |
| 520 | #undef ENABLE_RX_TRACKING_LP4 |
| 521 | #define ENABLE_RX_TRACKING_LP4 0 |
| 522 | |
| 523 | #undef ENABLE_PER_BANK_REFRESH |
| 524 | #define ENABLE_PER_BANK_REFRESH 1 |
| 525 | |
| 526 | #undef ENABLE_DVFS_BYPASS_MR13_FSP |
| 527 | #define ENABLE_DVFS_BYPASS_MR13_FSP 0 |
| 528 | |
| 529 | #undef HW_GATING |
| 530 | #undef DUMMY_READ_FOR_TRACKING |
| 531 | //#undef ZQCS_ENABLE_LP3 |
| 532 | //#undef ZQCS_ENABLE_LP4 |
| 533 | //#undef SPM_CONTROL_AFTERK |
| 534 | #undef TEMP_SENSOR_ENABLE |
| 535 | #undef IMPEDANCE_TRACKING_ENABLE |
| 536 | #undef ENABLE_SW_RUN_TIME_ZQ_WA |
| 537 | #define ENABLE_SW_RUN_TIME_ZQ_WA 0 |
| 538 | |
| 539 | //#undef XRTR2R_PERFORM_ENHANCE_DQSG_RX_DLY |
| 540 | |
| 541 | #if 0 |
| 542 | #undef XRTW2W_PERFORM_ENHANCE_TX |
| 543 | #undef XRTR2R_PERFORM_ENHANCE_DQSG_RX_DLY |
| 544 | #ifdef XRTR2W_PERFORM_ENHANCE_RODTEN |
| 545 | #undef XRTR2W_PERFORM_ENHANCE_RODTEN //conflict with ENABLE_RODT_TRACKING, LP4 support only |
| 546 | #endif |
| 547 | #endif |
| 548 | #endif //FIRST_BRING_UP |
| 549 | |
| 550 | //============================================================================= |
| 551 | // for D Sim sumulation used |
| 552 | //============================================================================= |
| 553 | #if SW_CHANGE_FOR_SIMULATION |
| 554 | #define SIMULATION_LP4_ZQ 0 |
| 555 | #define SIMULATION_RX_INPUT_BUF 0 //only LP4 |
| 556 | #define SIMULATION_LP3_CA_TRAINING 0 |
| 557 | #define SIMUILATION_LP4_CBT 0 |
| 558 | #define SIMULATION_WRITE_LEVELING 0 |
| 559 | #define SIMULATION_GATING 0 |
| 560 | #define SIMUILATION_LP4_RDDQC 0 |
| 561 | #define SIMULATION_DATLAT 0 |
| 562 | #define SIMULATION_SW_IMPED 0 |
| 563 | #define SIMULATION_RX_PERBIT 0 |
| 564 | #define SIMULATION_TX_PERBIT 0 // Please enable with write leveling |
| 565 | #else |
| 566 | #define SIMULATION_LP4_ZQ 1 |
| 567 | #define SIMULATION_RX_INPUT_BUF 0 |
| 568 | #define SIMULATION_LP3_CA_TRAINING 1 |
| 569 | #define SIMUILATION_LP4_CBT 1 |
| 570 | #define SIMULATION_WRITE_LEVELING 1 |
| 571 | #define SIMULATION_GATING 1 |
| 572 | #define SIMUILATION_LP4_RDDQC 1 |
| 573 | #define SIMULATION_DATLAT 1 |
| 574 | #define SIMULATION_SW_IMPED 1 |
| 575 | #define SIMULATION_RX_PERBIT 1 |
| 576 | #define SIMULATION_TX_PERBIT 1 // Please enable with write leveling |
| 577 | #endif |
| 578 | |
| 579 | #if (!PRINT_CALIBRATION_SUMMARY) |
| 580 | #define vSetCalibrationResult(x,y,z) |
| 581 | #endif |
| 582 | |
| 583 | //#define DDR_INIT_TIME_PROFILING |
| 584 | #define DDR_INIT_TIME_PROFILING_TEST_CNT 100 |
| 585 | |
| 586 | #ifdef DDR_INIT_TIME_PROFILING |
| 587 | extern U16 u2TimeProfileCnt; |
| 588 | #endif |
| 589 | |
| 590 | //======================== ETT Definition ===================================== |
| 591 | #if __ETT__ |
| 592 | //#define TEST_MODE_MRS |
| 593 | #define VENDER_JV_LOG 0 |
| 594 | #if DUAL_RANK_ENABLE |
| 595 | #define LP3_DUAL_RANK_RX_K |
| 596 | #define LP3_DUAL_RANK_TX_K |
| 597 | #endif |
| 598 | #define ENABLE_MPLL_SSC 1 // only for Everest ETT |
| 599 | #else // not ETT |
| 600 | #define ENABLE_MPLL_SSC 0 // not for android. never enable. |
| 601 | #endif |
| 602 | |
| 603 | #if SW_CHANGE_FOR_SIMULATION |
| 604 | #define VENDER_JV_LOG 0 |
| 605 | |
| 606 | #undef ENABLE_SW_TX_TRACKING |
| 607 | #define ENABLE_TX_TRACKING 0 |
| 608 | |
| 609 | #undef HW_GATING |
| 610 | #undef DUMMY_READ_FOR_TRACKING |
| 611 | //#undef ZQCS_ENABLE_LP3 |
| 612 | //#undef ZQCS_ENABLE_LP4 |
| 613 | #undef SPM_CONTROL_AFTERK |
| 614 | #undef TEMP_SENSOR_ENABLE |
| 615 | #undef IMPEDANCE_TRACKING_ENABLE |
| 616 | #endif |
| 617 | //============================================================================= |
| 618 | |
| 619 | //======================== FLASH TOOL DA Definition ===================================== |
| 620 | #if __FLASH_TOOL_DA__ |
| 621 | |
| 622 | #undef DUAL_FREQ_K |
| 623 | #define DUAL_FREQ_K 0 // If enable, need to define DDR_xxxx the same as DUAL_FREQ_HIGH |
| 624 | |
| 625 | #undef SUPPORT_SAVE_TIME_FOR_CALIBRATION |
| 626 | #define SUPPORT_SAVE_TIME_FOR_CALIBRATION 0 |
| 627 | |
| 628 | #endif |
| 629 | //============================================================================= |
| 630 | |
| 631 | //======================== EMI LPBK TEST Definition ===================================== |
| 632 | #define EMI_LPBK_DRAM_USED 1 // 0: EMI LPBK test, 1: normal K, dram used |
| 633 | |
| 634 | #define EMI_LPBK_USE_THROUGH_IO 0 //test through IO |
| 635 | #define EMI_INT_LPBK_WL_DQS_RINGCNT 0 //test ring counter |
| 636 | #define EMI_LPBK_ADDRESS_DEFECT 0 //test address defect |
| 637 | |
| 638 | //code base: CL68690 |
| 639 | #define EMI_LPBK_USE_LP3_PINMUX 0 |
| 640 | #define EMI_LPBK_8W1R 1 |
| 641 | |
| 642 | #if EMI_LPBK_USE_THROUGH_IO |
| 643 | #define EMI_LPBK_USE_DDR_800 1 |
| 644 | #else |
| 645 | #define EMI_LPBK_USE_DDR_800 0 |
| 646 | #endif |
| 647 | //#define K_TX_DQS_DLY 0 |
| 648 | |
| 649 | #define LP3_1866_freq_meter 464 |
| 650 | #define LP3_1600_freq_meter 383 |
| 651 | #define LP3_1200_freq_meter 299 |
| 652 | |
| 653 | #define LP4_3200_freq_meter 399 |
| 654 | #define LP4_2400_freq_meter 299 |
| 655 | #define LP4_1600_freq_meter 191 |
| 656 | |
| 657 | #if EMI_LPBK_DRAM_USED==0 |
| 658 | #define SLT |
| 659 | #undef ENABLE_TMRRI_NEW_MODE |
| 660 | #define ENABLE_TMRRI_NEW_MODE 0 |
| 661 | #undef ENABLE_DUTY_SCAN_V2 |
| 662 | #define ENABLE_DUTY_SCAN_V2 0 |
| 663 | #undef ENABLE_RODT_TRACKING |
| 664 | #define ENABLE_RODT_TRACKING 0 |
| 665 | #undef TX_K_DQM_WITH_WDBI |
| 666 | #define TX_K_DQM_WITH_WDBI 0 |
| 667 | #undef ENABLE_WRITE_DBI |
| 668 | #define ENABLE_WRITE_DBI 0 |
| 669 | #endif |
| 670 | #if (EMI_LPBK_DRAM_USED) |
| 671 | #undef ENABLE_MIOCK_JMETER |
| 672 | #define ENABLE_MIOCK_JMETER // for TX_PER_BIT_DELAY_CELL |
| 673 | #endif |
| 674 | |
| 675 | #if EMI_INT_LPBK_WL_DQS_RINGCNT |
| 676 | #undef EMI_LPBK_USE_THROUGH_IO |
| 677 | #define EMI_LPBK_USE_THROUGH_IO 1 |
| 678 | #undef EMI_LPBK_USE_DDR_800 |
| 679 | #define EMI_LPBK_USE_DDR_800 0 |
| 680 | #endif |
| 681 | //============================================================================= |
| 682 | |
| 683 | |
| 684 | |
| 685 | //======================== RSHMOO Definition ===================================== |
| 686 | #if RUNTIME_SHMOO_RELEATED_FUNCTION //if enable rshmoo, close TX OE calibration |
| 687 | #undef TX_OE_EXTEND |
| 688 | #define TX_OE_EXTEND 1 |
| 689 | #undef TX_DQ_OE_SHIFT_LP4 |
| 690 | #define TX_DQ_OE_SHIFT_LP4 4 |
| 691 | #undef TX_OE_CALIBATION |
| 692 | #define TX_OE_CALIBATION (!TX_OE_EXTEND) |
| 693 | |
| 694 | #define RUNTIME_SHMOO_TEST_CHANNEL 0 // 0: CHA, 1: CHB |
| 695 | #define RUNTIME_SHMOO_TEST_RANK 0 // 0: RK0, 1: RK1 |
| 696 | #define RUNTIME_SHMOO_TEST_BYTE 0 // 0: Byte0, 1: Byte1 |
| 697 | |
| 698 | #define RUNTIME_SHMOO_TEST_PI_DELAY_START 0 // 0~63 |
| 699 | #define RUNTIME_SHMOO_TEST_PI_DELAY_END 63 // 0~63 |
| 700 | #define RUNTIME_SHMOO_TEST_PI_DELAY_STEP 1 |
| 701 | |
| 702 | #define RUNTIME_SHMOO_TEST_VREF_START 0 // 0~81 : 0~50 is range 0, 51~81 is range 1 |
| 703 | #define RUNTIME_SHMOO_TEST_VREF_END 81 // 0~81 : 0~50 is range 0, 51~81 is range 1 |
| 704 | #define RUNTIME_SHMOO_TEST_VREF_STEP 1 |
| 705 | #endif |
| 706 | //============================================================================= |
| 707 | |
| 708 | #if SW_CHANGE_FOR_SIMULATION |
| 709 | typedef signed char INT8; |
| 710 | typedef signed short INT16; |
| 711 | typedef signed int INT32; |
| 712 | typedef signed char S8; |
| 713 | typedef signed short S16; |
| 714 | typedef signed int S32; |
| 715 | typedef unsigned char U8; |
| 716 | typedef unsigned short U16; |
| 717 | typedef unsigned int U32; |
| 718 | typedef unsigned char BOOL; |
| 719 | #define FALSE 0 |
| 720 | #define TRUE 1 |
| 721 | |
| 722 | #define NULL 0 |
| 723 | #define DDR_BASE 0x40000000 |
| 724 | #endif |
| 725 | #if FOR_DV_SIMULATION_USED==1 |
| 726 | #define DDR_BASE 0x40000000 |
| 727 | #endif |
| 728 | /***********************************************************************/ |
| 729 | /* Defines */ |
| 730 | /***********************************************************************/ |
| 731 | #define ENABLE 1 |
| 732 | #define DISABLE 0 |
| 733 | |
| 734 | #define CBT_LOW_FREQ 0 |
| 735 | #define CBT_HIGH_FREQ 1 |
| 736 | |
| 737 | typedef enum |
| 738 | { |
| 739 | DRAM_OK = 0, // OK |
| 740 | DRAM_FAIL, // FAIL |
| 741 | } DRAM_STATUS_T; // DRAM status type |
| 742 | |
| 743 | typedef enum |
| 744 | { |
| 745 | IC_VERSION_E1 =0, |
| 746 | IC_VERSION_E2, |
| 747 | IC_VERSION_E3 |
| 748 | } DRAM_IC_VERSION_T; |
| 749 | |
| 750 | typedef enum |
| 751 | { |
| 752 | CKE_FIXOFF = 0, |
| 753 | CKE_FIXON, |
| 754 | CKE_DYNAMIC //After CKE FIX on/off, CKE should be returned to dynamic (control by HW) |
| 755 | } CKE_FIX_OPTION; |
| 756 | |
| 757 | typedef enum |
| 758 | { |
| 759 | CKE_WRITE_TO_ONE_CHANNEL = 0, //just need to write CKE FIX register to current channel |
| 760 | CKE_WRITE_TO_ALL_CHANNEL, //need to write CKE FIX register to all channel |
| 761 | CKE_WRITE_TO_ALL_RANK |
| 762 | } CKE_FIX_CHANNEL; |
| 763 | |
| 764 | typedef enum |
| 765 | { |
| 766 | AD_MPLL_208M_CK=0, |
| 767 | DA_MPLL_52M_DIV_CK, |
| 768 | FMEM_CK_BFE_DCM_CH0, |
| 769 | }CLOCK_SRC_T; |
| 770 | |
| 771 | typedef enum |
| 772 | { |
| 773 | DLL_MASTER = 0, |
| 774 | DLL_SLAVE, |
| 775 | } DRAM_DLL_MODE_T; |
| 776 | |
| 777 | |
| 778 | typedef enum |
| 779 | { |
| 780 | LP4_DDR3733=0, |
| 781 | LP4_DDR3200, |
| 782 | LP4_DDR2667, |
| 783 | LP4_DDR2400, |
| 784 | LP4_DDR2280, |
| 785 | LP4_DDR1600, |
| 786 | LP4_DDR800, |
| 787 | |
| 788 | // scy: reduce code size by removing unused LPDDR3 opp |
| 789 | LP3_DDR1866, |
| 790 | LP3_DDR1600, |
| 791 | LP3_DDR1333, |
| 792 | LP3_DDR1200, |
| 793 | LP3_DDR1066, |
| 794 | LP3_DDR933, |
| 795 | LP3_DDR800, |
| 796 | #if __ETT__ |
| 797 | LJ_DDR1866, |
| 798 | LJ_DDR1700, |
| 799 | LJ_DDR1600, |
| 800 | LJ_DDR933, //mpdiv2 |
| 801 | LJ_DDR850, //mpdiv2 |
| 802 | LJ_DDR800, //mpdiv2 |
| 803 | LJ_MAX_SEL, |
| 804 | LC_DDR1600, |
| 805 | LC_DDR1270, |
| 806 | LC_DDR1066, |
| 807 | LC_DDR800, //mpdiv2 |
| 808 | LC_DDR635, //mpdiv2 |
| 809 | LC_DDR533, //mpdiv2 |
| 810 | #endif |
| 811 | PLL_FREQ_SEL_MAX |
| 812 | } DRAM_PLL_FREQ_SEL_T; // DRAM DFS type |
| 813 | |
| 814 | typedef enum |
| 815 | { |
| 816 | DRAM_DFS_SHUFFLE_1 = 0, |
| 817 | DRAM_DFS_SHUFFLE_MAX |
| 818 | } DRAM_DFS_SHUFFLE_TYPE_T; // DRAM SHUFFLE RG type |
| 819 | |
| 820 | |
| 821 | typedef struct _DRAM_DFS_FREQUENCY_TABLE_T |
| 822 | { |
| 823 | DRAM_PLL_FREQ_SEL_T freq_sel; |
| 824 | U16 frequency; |
| 825 | DRAM_DFS_SHUFFLE_TYPE_T shuffleIdx; |
| 826 | } DRAM_DFS_FREQUENCY_TABLE_T; |
| 827 | |
| 828 | typedef struct _DRAM_DVFS_TABLE_T |
| 829 | { |
| 830 | DRAM_PLL_FREQ_SEL_T freq_sel; |
| 831 | U32 u4Vcore; |
| 832 | } DRAM_DVFS_TABLE_T; |
| 833 | |
| 834 | typedef enum |
| 835 | { |
| 836 | DRAM_CALIBRATION_ZQ = 0, |
| 837 | DRAM_CALIBRATION_SW_IMPEDANCE , |
| 838 | DRAM_CALIBRATION_CA_TRAIN , |
| 839 | DRAM_CALIBRATION_WRITE_LEVEL, |
| 840 | DRAM_CALIBRATION_GATING, |
| 841 | DRAM_CALIBRATION_DATLAT, |
| 842 | DRAM_CALIBRATION_RX_RDDQC, |
| 843 | DRAM_CALIBRATION_RX_PERBIT, |
| 844 | DRAM_CALIBRATION_TX_PERBIT, |
| 845 | DRAM_CALIBRATION_MAX |
| 846 | } DRAM_CALIBRATION_STATUS_T; |
| 847 | |
| 848 | |
| 849 | typedef enum |
| 850 | { |
| 851 | DDRPHY_CONF_A = 0, |
| 852 | DDRPHY_CONF_B, |
| 853 | DDRPHY_CONF_C, |
| 854 | DDRPHY_CONF_D, |
| 855 | DDRPHY_CONF_MAX |
| 856 | } DDRPHY_CONF_T; |
| 857 | |
| 858 | |
| 859 | typedef enum |
| 860 | { |
| 861 | CHANNEL_A = 0, |
| 862 | CHANNEL_B, |
| 863 | CHANNEL_C, |
| 864 | CHANNEL_D, |
| 865 | } DRAM_CHANNEL_T; |
| 866 | |
| 867 | typedef enum |
| 868 | { |
| 869 | CHANNEL_SINGLE = 1, |
| 870 | CHANNEL_DUAL, |
| 871 | CHANNEL_THIRD, |
| 872 | CHANNEL_FOURTH |
| 873 | } DRAM_CHANNEL_NUMBER_T; |
| 874 | |
| 875 | typedef enum |
| 876 | { |
| 877 | RANK_0= 0, |
| 878 | RANK_1, |
| 879 | RANK_MAX |
| 880 | } DRAM_RANK_T; |
| 881 | |
| 882 | typedef enum |
| 883 | { |
| 884 | RANK_SINGLE = 1, |
| 885 | RANK_DUAL |
| 886 | } DRAM_RANK_NUMBER_T; |
| 887 | |
| 888 | |
| 889 | typedef enum |
| 890 | { |
| 891 | TYPE_DDR1 = 1, |
| 892 | TYPE_LPDDR2, |
| 893 | TYPE_LPDDR3, |
| 894 | TYPE_PCDDR3, |
| 895 | TYPE_LPDDR4, |
| 896 | TYPE_LPDDR4X, |
| 897 | TYPE_LPDDR4P |
| 898 | } DRAM_DRAM_TYPE_T; |
| 899 | |
| 900 | /* For faster switching between term and un-term operation |
| 901 | * FSP_0: For un-terminated freq. |
| 902 | * FSP_1: For terminated freq. |
| 903 | */ |
| 904 | typedef enum |
| 905 | { |
| 906 | FSP_0 = 0, |
| 907 | FSP_1, |
| 908 | FSP_MAX |
| 909 | } DRAM_FAST_SWITH_POINT_T; |
| 910 | |
| 911 | /* |
| 912 | * Internal CBT mode enum |
| 913 | * 1. Calibration flow uses vGet_Dram_CBT_Mode to |
| 914 | * differentiate between mixed vs non-mixed LP4 |
| 915 | * 2. Declared as dram_cbt_mode[RANK_MAX] internally to |
| 916 | * store each rank's CBT mode type |
| 917 | */ |
| 918 | typedef enum |
| 919 | { |
| 920 | CBT_NORMAL_MODE = 0, |
| 921 | CBT_BYTE_MODE1 |
| 922 | } DRAM_CBT_MODE_T; |
| 923 | |
| 924 | /* |
| 925 | * External CBT mode enum |
| 926 | * Due to MDL structure compatibility (single field for dram CBT mode), |
| 927 | * the below enum is used in preloader to differentiate between dram cbt modes |
| 928 | */ |
| 929 | typedef enum |
| 930 | { |
| 931 | CBT_R0_R1_NORMAL = 0, // Normal mode |
| 932 | CBT_R0_R1_BYTE, // Byte mode |
| 933 | CBT_R0_NORMAL_R1_BYTE, // Mixed mode R0: Normal R1: Byte |
| 934 | CBT_R0_BYTE_R1_NORMAL // Mixed mode R0: Byte R1: Normal |
| 935 | } DRAM_CBT_MODE_EXTERN_T; |
| 936 | |
| 937 | typedef enum |
| 938 | { |
| 939 | ODT_OFF = 0, |
| 940 | ODT_ON |
| 941 | } DRAM_ODT_MODE_T; |
| 942 | |
| 943 | |
| 944 | typedef enum |
| 945 | { |
| 946 | DBI_OFF = 0, |
| 947 | DBI_ON |
| 948 | } DRAM_DBI_MODE_T; |
| 949 | |
| 950 | typedef enum |
| 951 | { |
| 952 | DATA_WIDTH_16BIT = 16, |
| 953 | DATA_WIDTH_32BIT = 32 |
| 954 | } DRAM_DATA_WIDTH_T; |
| 955 | |
| 956 | typedef enum |
| 957 | { |
| 958 | GET_MDL_USED = 0, |
| 959 | NORMAL_USED |
| 960 | } DRAM_INIT_USED_T; |
| 961 | |
| 962 | // for A60501 DDR3 |
| 963 | typedef enum |
| 964 | { |
| 965 | PCB_LOC_ASIDE = 0, |
| 966 | PCB_LOC_BSIDE |
| 967 | } DRAM_PCB_LOC_T; |
| 968 | |
| 969 | typedef enum |
| 970 | { |
| 971 | MODE_1X = 0, |
| 972 | MODE_2X |
| 973 | } DRAM_DRAM_MODE_T; |
| 974 | |
| 975 | typedef enum |
| 976 | { |
| 977 | PACKAGE_SBS = 0, |
| 978 | PACKAGE_POP |
| 979 | } DRAM_PACKAGE_T; |
| 980 | |
| 981 | typedef enum |
| 982 | { |
| 983 | TE_OP_WRITE_READ_CHECK = 0, |
| 984 | TE_OP_READ_CHECK |
| 985 | } DRAM_TE_OP_T; |
| 986 | |
| 987 | typedef enum |
| 988 | { |
| 989 | TEST_ISI_PATTERN = 0, //don't change |
| 990 | TEST_AUDIO_PATTERN =1, //don't change |
| 991 | TEST_XTALK_PATTERN =2, //don't change |
| 992 | TEST_TA1_SIMPLE, |
| 993 | TEST_TESTPAT4, |
| 994 | TEST_TESTPAT4_3, |
| 995 | TEST_MIX_PATTERN, |
| 996 | TEST_DMA, |
| 997 | } DRAM_TEST_PATTERN_T; |
| 998 | |
| 999 | typedef enum |
| 1000 | { |
| 1001 | BL_TYPE_4 = 0, |
| 1002 | BL_TYPE_8 |
| 1003 | } DRAM_BL_TYPE_T; |
| 1004 | |
| 1005 | typedef enum |
| 1006 | { |
| 1007 | DLINE_0 = 0, |
| 1008 | DLINE_1, |
| 1009 | DLINE_TOGGLE |
| 1010 | } PLL_PHASE_CAL_STATUS_T; |
| 1011 | |
| 1012 | typedef enum |
| 1013 | { |
| 1014 | TA43_OP_STOP, |
| 1015 | TA43_OP_CLEAR, |
| 1016 | TA43_OP_RUN, |
| 1017 | TA43_OP_RUNQUIET, |
| 1018 | TA43_OP_UNKNOWN, |
| 1019 | } DRAM_TA43_OP_TYPE_T; |
| 1020 | |
| 1021 | // used for record last test pattern in TA |
| 1022 | typedef enum |
| 1023 | { |
| 1024 | TA_PATTERN_IDLE, |
| 1025 | TA_PATTERN_TA43, |
| 1026 | TA_PATTERN_TA4, |
| 1027 | TA_PATTERN_UNKNOWM, |
| 1028 | } DRAM_TA_PATTERN_T; |
| 1029 | |
| 1030 | |
| 1031 | typedef enum |
| 1032 | { |
| 1033 | DMA_PREPARE_DATA_ONLY, |
| 1034 | DMA_CHECK_DATA_ACCESS_ONLY_AND_NO_WAIT, |
| 1035 | DMA_CHECK_COMAPRE_RESULT_ONLY, |
| 1036 | DMA_CHECK_DATA_ACCESS_AND_COMPARE, |
| 1037 | } DRAM_DMA_CHECK_RESULT_T; |
| 1038 | |
| 1039 | |
| 1040 | typedef enum |
| 1041 | { |
| 1042 | fcDATLAT_USE_DEFAULT = 0, |
| 1043 | fcDATLAT_USE_RX_SCAN, |
| 1044 | //fcDATLAT_USE_TXRX_SCAN |
| 1045 | }DRAM_DATLAT_CALIBRATION_TYTE_T; |
| 1046 | |
| 1047 | |
| 1048 | typedef enum |
| 1049 | { |
| 1050 | TX_DQ_DQS_MOVE_DQ_ONLY = 0, |
| 1051 | TX_DQ_DQS_MOVE_DQM_ONLY, |
| 1052 | TX_DQ_DQS_MOVE_DQ_DQM |
| 1053 | } DRAM_TX_PER_BIT_CALIBRATION_TYTE_T; |
| 1054 | |
| 1055 | typedef enum |
| 1056 | { |
| 1057 | DISABLE_VREF_SCAN = 0, |
| 1058 | ENABLE_VREF_SCAN, |
| 1059 | SET_VREF_AND_DISABLE_VREF_SCAN |
| 1060 | } DRAM_VREF_SCAN_OPTION_T; |
| 1061 | |
| 1062 | typedef enum |
| 1063 | { |
| 1064 | TX_DQM_WINDOW_SPEC_IN = 0xfe, |
| 1065 | TX_DQM_WINDOW_SPEC_OUT = 0xff |
| 1066 | } DRAM_TX_PER_BIT_DQM_WINDOW_RESULT_TYPE_T; |
| 1067 | |
| 1068 | typedef enum |
| 1069 | { |
| 1070 | TX_TRIANGLE_EYE_STATE_START = 0, |
| 1071 | TX_TRIANGLE_EYE_STATE_ADD_MARGIN, |
| 1072 | TX_TRIANGLE_EYE_STATE_RESTART, |
| 1073 | TX_TRIANGLE_EYE_STATE_END |
| 1074 | } TX_TRIANGLe_EYE_TYPE_T; |
| 1075 | |
| 1076 | typedef enum |
| 1077 | { |
| 1078 | HQA_REPORT_FORMAT0 = 0, |
| 1079 | HQA_REPORT_FORMAT0_1, |
| 1080 | HQA_REPORT_FORMAT0_2, |
| 1081 | HQA_REPORT_FORMAT1, |
| 1082 | HQA_REPORT_FORMAT2, |
| 1083 | HQA_REPORT_FORMAT3, |
| 1084 | HQA_REPORT_FORMAT4, |
| 1085 | HQA_REPORT_FORMAT5, |
| 1086 | HQA_REPORT_FORMAT6 |
| 1087 | } |
| 1088 | HQA_REPORT_FORMAT_T; |
| 1089 | |
| 1090 | typedef enum |
| 1091 | { |
| 1092 | VREF_RANGE_0= 0, |
| 1093 | VREF_RANGE_1, |
| 1094 | VREF_RANGE_MAX |
| 1095 | }DRAM_VREF_RANGE_T; |
| 1096 | #define VREF_VOLTAGE_TABLE_NUM 51 |
| 1097 | #define VREF_VOLTAGE_TABLE_TOTAL_NUM 81 |
| 1098 | |
| 1099 | // enum for CKE toggle mode (toggle both ranks 1. at the same time (CKE_RANK_DEPENDENT) 2. individually (CKE_RANK_INDEPENDENT)) |
| 1100 | typedef enum |
| 1101 | { |
| 1102 | CKE_RANK_INDEPENDENT = 0, |
| 1103 | CKE_RANK_DEPENDENT |
| 1104 | } CKE_CTRL_MODE_T; |
| 1105 | |
| 1106 | typedef enum |
| 1107 | { |
| 1108 | DutyScan_Calibration_K_CLK= 0, |
| 1109 | DutyScan_Calibration_K_DQS, |
| 1110 | DutyScan_Calibration_K_DQ, |
| 1111 | DutyScan_Calibration_K_DQM |
| 1112 | }DUTYSCAN_CALIBRATION_FLOW_K_T; |
| 1113 | |
| 1114 | typedef enum |
| 1115 | { |
| 1116 | DRVP = 0, |
| 1117 | DRVN, |
| 1118 | ODTP, |
| 1119 | ODTN |
| 1120 | } DRAM_IMP_DRV_T; |
| 1121 | |
| 1122 | //Definitions to enable specific freq's LP4 ACTiming support (To save code size) |
| 1123 | #define SUPPORT_LP4_DDR3733_ACTIM 1 |
| 1124 | #define SUPPORT_LP4_DDR3200_ACTIM 1 |
| 1125 | #define SUPPORT_LP4_DDR2667_ACTIM 0 |
| 1126 | #define SUPPORT_LP4_DDR2400_ACTIM 1 |
| 1127 | #define SUPPORT_LP4_DDR1600_ACTIM 1 |
| 1128 | |
| 1129 | /* Used to keep track the total number of LP4 ACTimings */ |
| 1130 | /* Since READ_DBI is enable/disabled using preprocessor C define |
| 1131 | * -> Save code size by excluding unneeded ACTimingTable entries |
| 1132 | * Note 1: READ_DBI on/off is for (LP4 data rate >= DDR2667 (FSP1)) |
| 1133 | * Must make sure DDR3733 is the 1st entry (DMCATRAIN_INTV is used) |
| 1134 | */ |
| 1135 | typedef enum |
| 1136 | { |
| 1137 | #if SUPPORT_LP4_DDR3733_ACTIM |
| 1138 | #if ENABLE_READ_DBI |
| 1139 | AC_TIME_LP4_BYTE_DDR3733_RDBI_ON = 0, |
| 1140 | AC_TIME_LP4_NORM_DDR3733_RDBI_ON, |
| 1141 | #else //(ENABLE_READ_DBI == 0) |
| 1142 | AC_TIME_LP4_BYTE_DDR3733_RDBI_OFF, |
| 1143 | AC_TIME_LP4_NORM_DDR3733_RDBI_OFF, |
| 1144 | #endif //ENABLE_READ_DBI |
| 1145 | #endif |
| 1146 | |
| 1147 | #if SUPPORT_LP4_DDR3200_ACTIM |
| 1148 | #if ENABLE_READ_DBI |
| 1149 | AC_TIME_LP4_BYTE_DDR3200_RDBI_ON, |
| 1150 | AC_TIME_LP4_NORM_DDR3200_RDBI_ON, |
| 1151 | #else //(ENABLE_READ_DBI == 0) |
| 1152 | AC_TIME_LP4_BYTE_DDR3200_RDBI_OFF, |
| 1153 | AC_TIME_LP4_NORM_DDR3200_RDBI_OFF, |
| 1154 | #endif //ENABLE_READ_DBI |
| 1155 | #endif |
| 1156 | |
| 1157 | #if SUPPORT_LP4_DDR2667_ACTIM |
| 1158 | #if ENABLE_READ_DBI |
| 1159 | AC_TIME_LP4_BYTE_DDR2667_RDBI_ON, |
| 1160 | AC_TIME_LP4_NORM_DDR2667_RDBI_ON, |
| 1161 | #else //(ENABLE_READ_DBI == 0) |
| 1162 | AC_TIME_LP4_BYTE_DDR2667_RDBI_OFF, |
| 1163 | AC_TIME_LP4_NORM_DDR2667_RDBI_OFF, |
| 1164 | #endif //ENABLE_READ_DBI |
| 1165 | #endif |
| 1166 | |
| 1167 | #if SUPPORT_LP4_DDR2400_ACTIM |
| 1168 | AC_TIME_LP4_BYTE_DDR2400_RDBI_OFF, |
| 1169 | AC_TIME_LP4_NORM_DDR2400_RDBI_OFF, |
| 1170 | #endif |
| 1171 | |
| 1172 | #if SUPPORT_LP4_DDR1600_ACTIM |
| 1173 | AC_TIME_LP4_BYTE_DDR1600_RDBI_OFF, |
| 1174 | AC_TIME_LP4_NORM_DDR1600_RDBI_OFF, |
| 1175 | #endif |
| 1176 | AC_TIMING_NUMBER_LP4 |
| 1177 | } AC_TIMING_LP4_COUNT_TYPE_T; |
| 1178 | |
| 1179 | #if ENABLE_LP3_SW |
| 1180 | /* Used to keep track the total number of LP3 ACTimings */ |
| 1181 | typedef enum |
| 1182 | { |
| 1183 | AC_TIME_LP3_DDR1866 = 0, |
| 1184 | AC_TIME_LP3_DDR1600, |
| 1185 | AC_TIME_LP3_DDR1333, |
| 1186 | AC_TIME_LP3_DDR1200, |
| 1187 | AC_TIME_LP3_DDR1066, |
| 1188 | |
| 1189 | AC_TIMING_NUMBER_LP3 |
| 1190 | } AC_TIMING_LP3_COUNT_TYPE_T; |
| 1191 | #else |
| 1192 | #define AC_TIMING_NUMBER_LP3 0 |
| 1193 | #endif |
| 1194 | |
| 1195 | typedef enum |
| 1196 | { |
| 1197 | TA2_RKSEL_XRT = 3, |
| 1198 | TA2_RKSEL_HW = 4, |
| 1199 | } TA2_RKSEL_TYPE_T; |
| 1200 | |
| 1201 | typedef enum |
| 1202 | { |
| 1203 | TA2_PAT_SWITCH_OFF = 0, |
| 1204 | TA2_PAT_SWITCH_ON, |
| 1205 | } TA2_PAT_SWITCH_TYPE_T; |
| 1206 | |
| 1207 | |
| 1208 | //Combine LP3 & LP4 ACTiming count |
| 1209 | #define TOTAL_AC_TIMING_NUMBER (AC_TIMING_NUMBER_LP3 + AC_TIMING_NUMBER_LP4) |
| 1210 | |
| 1211 | #if SUPPORT_SAVE_TIME_FOR_CALIBRATION |
| 1212 | #if RUNTIME_SHMOO_RELEATED_FUNCTION |
| 1213 | typedef struct _RUNTIME_SHMOO_SAVE_PARAMETER_T |
| 1214 | { |
| 1215 | U8 flag; |
| 1216 | U16 TX_PI_delay; |
| 1217 | U16 TX_Original_PI_delay; |
| 1218 | U16 TX_DQM_PI_delay; |
| 1219 | U16 TX_Original_DQM_PI_delay; |
| 1220 | U8 TX_Vref_Range; |
| 1221 | U8 TX_Vref_Value; |
| 1222 | U8 TX_Channel; |
| 1223 | U8 TX_Rank; |
| 1224 | U8 TX_Byte; |
| 1225 | } RUNTIME_SHMOO_SAVE_PARAMETER_T; |
| 1226 | #endif |
| 1227 | |
| 1228 | typedef struct _SAVE_TIME_FOR_CALIBRATION_T |
| 1229 | { |
| 1230 | //U8 femmc_Ready; |
| 1231 | |
| 1232 | DRAM_RANK_NUMBER_T support_rank_num; |
| 1233 | |
| 1234 | // Calibration or not |
| 1235 | //U8 Bypass_TXWINDOW; |
| 1236 | //U8 Bypass_RXWINDOW; |
| 1237 | //U8 Bypass_RDDQC; |
| 1238 | |
| 1239 | // delay cell time |
| 1240 | //U8 ucg_num_dlycell_perT_all[DRAM_DFS_SHUFFLE_MAX][CHANNEL_NUM]; |
| 1241 | //U16 u2gdelay_cell_ps_all[DRAM_DFS_SHUFFLE_MAX][CHANNEL_NUM]; |
| 1242 | U8 ucnum_dlycell_perT; |
| 1243 | U16 u2DelayCellTimex100; |
| 1244 | |
| 1245 | // CLK & DQS duty |
| 1246 | S8 s1ClockDuty_clk_delay_cell[CHANNEL_NUM][RANK_MAX]; |
| 1247 | U8 u1clk_use_rev_bit; |
| 1248 | S8 s1DQSDuty_clk_delay_cell[CHANNEL_NUM][DQS_NUMBER_LP4]; |
| 1249 | U8 u1dqs_use_rev_bit; |
| 1250 | #if APPLY_DQDQM_DUTY_CALIBRATION |
| 1251 | S8 s1DQDuty_clk_delay_cell[CHANNEL_NUM][DQS_NUMBER_LP4]; |
| 1252 | U8 u1dq_use_rev_bit; |
| 1253 | S8 s1DQMDuty_clk_delay_cell[CHANNEL_NUM][DQS_NUMBER_LP4]; |
| 1254 | U8 u1dqm_use_rev_bit; |
| 1255 | #endif |
| 1256 | |
| 1257 | // CBT |
| 1258 | U8 u1CBTVref_Save[CHANNEL_NUM][RANK_MAX]; |
| 1259 | U8 u1CBTClkDelay_Save[CHANNEL_NUM][RANK_MAX]; |
| 1260 | U8 u1CBTCmdDelay_Save[CHANNEL_NUM][RANK_MAX]; |
| 1261 | U8 u1CBTCsDelay_Save[CHANNEL_NUM][RANK_MAX]; |
| 1262 | #if CA_PER_BIT_DELAY_CELL |
| 1263 | U8 u1CBTCA_PerBit_DelayLine_Save[CHANNEL_NUM][RANK_MAX][DQS_BIT_NUMBER]; |
| 1264 | #endif |
| 1265 | |
| 1266 | // Write leveling |
| 1267 | U8 u1WriteLeveling_bypass_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; //for bypass writeleveling |
| 1268 | |
| 1269 | // Gating |
| 1270 | U8 u1Gating2T_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1271 | U8 u1Gating05T_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1272 | U8 u1Gatingfine_tune_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1273 | U8 u1Gatingucpass_count_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1274 | |
| 1275 | // TX perbit |
| 1276 | U8 u1TxWindowPerbitVref_Save[CHANNEL_NUM][RANK_MAX]; |
| 1277 | U16 u1TxCenter_min_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1278 | U16 u1TxCenter_max_Save[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1279 | U16 u1Txwin_center_Save[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; |
| 1280 | //U16 u1Txfirst_pass_Save[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; |
| 1281 | //U16 u1Txlast_pass_Save[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; |
| 1282 | //U8 u1TX_PerBit_DelayLine_Save[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; |
| 1283 | |
| 1284 | // Datlat |
| 1285 | U8 u1RxDatlat_Save[CHANNEL_NUM][RANK_MAX]; |
| 1286 | |
| 1287 | // RX perbit |
| 1288 | U8 u1RxWinPerbitVref_Save[CHANNEL_NUM]; |
| 1289 | U8 u1RxWinPerbit_DQS[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1290 | U8 u1RxWinPerbit_DQM[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1291 | U8 u1RxWinPerbit_DQ[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; |
| 1292 | //S16 u1RxWinPerbitDQ_firsbypass_Save[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; //for bypass rxwindow |
| 1293 | //U8 u1RxWinPerbitDQ_lastbypass_Save[CHANNEL_NUM][RANK_MAX][DQ_DATA_WIDTH_LP4]; //for bypass rxwindow |
| 1294 | |
| 1295 | //TX OE |
| 1296 | U8 u1TX_OE_DQ_MCK[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1297 | U8 u1TX_OE_DQ_UI[CHANNEL_NUM][RANK_MAX][DQS_NUMBER_LP4]; |
| 1298 | |
| 1299 | |
| 1300 | #if RUNTIME_SHMOO_RELEATED_FUNCTION |
| 1301 | U8 u1SwImpedanceResule[2][4]; |
| 1302 | U32 u4TXRG_Backup[CHANNEL_NUM][RUNTIME_SHMOO_RG_BACKUP_NUM]; |
| 1303 | |
| 1304 | RUNTIME_SHMOO_SAVE_PARAMETER_T Runtime_Shmoo_para; |
| 1305 | #endif |
| 1306 | } SAVE_TIME_FOR_CALIBRATION_T; |
| 1307 | |
| 1308 | extern int write_offline_dram_calibration_data(DRAM_DFS_SHUFFLE_TYPE_T shuffle, SAVE_TIME_FOR_CALIBRATION_T *offLine_SaveData); |
| 1309 | extern int read_offline_dram_calibration_data(DRAM_DFS_SHUFFLE_TYPE_T shuffle, SAVE_TIME_FOR_CALIBRATION_T *offLine_SaveData); |
| 1310 | //3733, 3200, 2667, 2400, 2280, 1600, 800 |
| 1311 | extern U8 _MappingFreqArray[]; |
| 1312 | #endif |
| 1313 | |
| 1314 | |
| 1315 | //////////////////////////// |
| 1316 | typedef struct _DRAMC_CTX_T |
| 1317 | { |
| 1318 | DRAM_CHANNEL_NUMBER_T support_channel_num; |
| 1319 | DRAM_CHANNEL_T channel; |
| 1320 | DRAM_RANK_NUMBER_T support_rank_num; |
| 1321 | DRAM_RANK_T rank; |
| 1322 | DRAM_PLL_FREQ_SEL_T freq_sel; |
| 1323 | DRAM_DFS_SHUFFLE_TYPE_T shu_type; |
| 1324 | DRAM_DRAM_TYPE_T dram_type; |
| 1325 | DRAM_FAST_SWITH_POINT_T dram_fsp; // only for LP4, uesless in LP3 |
| 1326 | DRAM_ODT_MODE_T odt_onoff;/// only for LP4, uesless in LP3 |
| 1327 | DRAM_CBT_MODE_T dram_cbt_mode[RANK_MAX]; //only for LP4, useless in LP3 |
| 1328 | DRAM_DBI_MODE_T DBI_R_onoff[FSP_MAX]; // only for LP4, uesless in LP3 |
| 1329 | DRAM_DBI_MODE_T DBI_W_onoff[FSP_MAX]; // only for LP4, uesless in LP3 |
| 1330 | DRAM_DATA_WIDTH_T data_width; |
| 1331 | U32 test2_1; |
| 1332 | U32 test2_2; |
| 1333 | DRAM_TEST_PATTERN_T test_pattern; |
| 1334 | U16 frequency; |
| 1335 | U16 freqGroup; /* Used to support freq's that are not in ACTimingTable */ |
| 1336 | U16 vendor_id; |
| 1337 | U16 revision_id; |
| 1338 | U16 density; |
| 1339 | U64 ranksize[RANK_MAX]; |
| 1340 | U8 ucnum_dlycell_perT; |
| 1341 | U16 u2DelayCellTimex100; |
| 1342 | U8 enable_cbt_scan_vref; |
| 1343 | U8 enable_rx_scan_vref; |
| 1344 | U8 enable_tx_scan_vref; |
| 1345 | #if PRINT_CALIBRATION_SUMMARY |
| 1346 | U32 aru4CalResultFlag[CHANNEL_NUM][RANK_MAX];// record the calibration is fail or success, 0:success, 1: fail |
| 1347 | U32 aru4CalExecuteFlag[CHANNEL_NUM][RANK_MAX]; // record the calibration is execute or not, 0:no operate, 1: done |
| 1348 | #endif |
| 1349 | #if WRITE_LEVELING_MOVE_DQS_INSTEAD_OF_CLK |
| 1350 | BOOL arfgWriteLevelingInitShif[CHANNEL_NUM][RANK_MAX]; |
| 1351 | #endif |
| 1352 | #if TX_PERBIT_INIT_FLOW_CONTROL |
| 1353 | BOOL fgTXPerbifInit[CHANNEL_NUM][RANK_MAX]; |
| 1354 | #endif |
| 1355 | #if SUPPORT_SAVE_TIME_FOR_CALIBRATION |
| 1356 | U8 femmc_Ready; |
| 1357 | // Calibration or not |
| 1358 | U8 Bypass_TXWINDOW; |
| 1359 | U8 Bypass_RXWINDOW; |
| 1360 | U8 Bypass_RDDQC; |
| 1361 | SAVE_TIME_FOR_CALIBRATION_T *pSavetimeData; |
| 1362 | #endif |
| 1363 | #if (fcFOR_CHIP_ID == fcLaurel) |
| 1364 | BOOL bDLP3; |
| 1365 | #endif |
| 1366 | #if defined(SLT) || (FT_DSIM_USED) |
| 1367 | U8 shuffle_index; |
| 1368 | #endif |
| 1369 | U8 u1PhyPLLEn; |
| 1370 | } DRAMC_CTX_T; |
| 1371 | |
| 1372 | typedef struct _PASS_WIN_DATA_T |
| 1373 | { |
| 1374 | S16 first_pass; |
| 1375 | S16 last_pass; |
| 1376 | S16 win_center; |
| 1377 | U16 win_size; |
| 1378 | U16 best_dqdly; |
| 1379 | } PASS_WIN_DATA_T; |
| 1380 | |
| 1381 | typedef enum |
| 1382 | { |
| 1383 | BANK_TYPE_S2, |
| 1384 | BANK_TYPE_S4 |
| 1385 | } BANK_TYPE_T; |
| 1386 | |
| 1387 | typedef struct _DRAM_INFO_BY_MRR_T |
| 1388 | { |
| 1389 | U16 u2MR5VendorID; |
| 1390 | U16 u2MR6RevisionID; |
| 1391 | U64 u8MR8Density[CHANNEL_NUM][RANK_MAX]; |
| 1392 | U32 u4RankNum; |
| 1393 | U8 u1DieNum[RANK_MAX]; |
| 1394 | BANK_TYPE_T u4BankMode; |
| 1395 | } DRAM_INFO_BY_MRR_T; |
| 1396 | |
| 1397 | typedef struct _VCORE_DELAYCELL_T |
| 1398 | { |
| 1399 | U32 u2Vcore; |
| 1400 | U16 u2DelayCell; |
| 1401 | } VCORE_DELAYCELL_T; |
| 1402 | |
| 1403 | typedef struct _REG_TRANSFER |
| 1404 | { |
| 1405 | U32 u4Addr; |
| 1406 | U32 u4Fld; |
| 1407 | } REG_TRANSFER_T; |
| 1408 | |
| 1409 | |
| 1410 | //For new register access |
| 1411 | #define SHIFT_TO_CHB_ADDR ((U32)CHANNEL_B<<POS_BANK_NUM) |
| 1412 | #define DRAMC_REG_ADDR(offset) ((p->channel << POS_BANK_NUM)+ (offset)) |
| 1413 | #define SYS_REG_ADDR(offset) (offset) |
| 1414 | |
| 1415 | // Different from Pi_calibration.c due to Base address |
| 1416 | //#define mcSET_DRAMC_REG_ADDR(offset) (DRAMC_BASE_ADDRESS | (p->channel << POS_BANK_NUM) | (offset)) |
| 1417 | #define mcSET_SYS_REG_ADDR(offset) (DRAMC_BASE_ADDRESS | (offset)) |
| 1418 | #define mcSET_DRAMC_NAO_REG_ADDR(offset) (DRAMC_NAO_BASE_ADDRESS | (offset)) |
| 1419 | #define mcSET_DRAMC_AO_REG_ADDR(offset) (DRAMC_AO_BASE_ADDRESS | (offset)) |
| 1420 | //#define mcSET_DRAMC_AO_REG_ADDR_CHC(offset) ((DRAMC_AO_BASE_ADDRESS + ((U32)CHANNEL_C << POS_BANK_NUM)) | (offset)) |
| 1421 | #define mcSET_DDRPHY_REG_ADDR(offset) (DDRPHY_BASE_ADDR | (offset)) |
| 1422 | #define mcSET_DDRPHY_REG_ADDR_CHA(offset) ((DDRPHY_BASE_ADDR + ((U32) CHANNEL_A << POS_BANK_NUM)) | (offset)) |
| 1423 | #define mcSET_DDRPHY_REG_ADDR_CHB(offset) ((DDRPHY_BASE_ADDR + SHIFT_TO_CHB_ADDR) | (offset)) |
| 1424 | //#define mcSET_DDRPHY_REG_ADDR_CHC(offset) ((DDRPHY_BASE_ADDR + ((U32) CHANNEL_C << POS_BANK_NUM)) | (offset)) |
| 1425 | //#define mcSET_DDRPHY_REG_ADDR_CHD(offset) ((DDRPHY_BASE_ADDR + ((U32) CHANNEL_D << POS_BANK_NUM)) | (offset)) |
| 1426 | |
| 1427 | /***********************************************************************/ |
| 1428 | /* External declarations */ |
| 1429 | /***********************************************************************/ |
| 1430 | extern U8 RXPERBIT_LOG_PRINT; |
| 1431 | extern U32 gu4TermFreq; |
| 1432 | |
| 1433 | #ifdef DUMP_INIT_RG_LOG_TO_DE |
| 1434 | extern U8 gDUMP_INIT_RG_LOG_TO_DE_RG_log_flag; |
| 1435 | #endif |
| 1436 | |
| 1437 | |
| 1438 | /***********************************************************************/ |
| 1439 | /* Public Functions */ |
| 1440 | /***********************************************************************/ |
| 1441 | // basic function |
| 1442 | //DRAM_IC_VERSION_T u1GetICVersion_Bianco(void); |
| 1443 | U8 u1IsLP4Family(DRAM_DRAM_TYPE_T dram_type); |
| 1444 | void setFreqGroup(DRAMC_CTX_T *p); /* Used to support freq's not in ACTimingTable */ |
| 1445 | void DDRPhyFMeter_Init(void); |
| 1446 | U16 DDRPhyFMeter(void); |
| 1447 | void DDRPhyFreqSel(DRAMC_CTX_T *p, DRAM_PLL_FREQ_SEL_T sel); |
| 1448 | void vDramcInit_PreSettings(DRAMC_CTX_T *p); |
| 1449 | void Global_Option_Init(DRAMC_CTX_T *p); |
| 1450 | void Global_Option_Init2(DRAMC_CTX_T *p); |
| 1451 | DRAM_STATUS_T DramcInit(DRAMC_CTX_T *p); |
| 1452 | void vInitGlobalVariablesByCondition(DRAM_DRAM_TYPE_T dram_type); |
| 1453 | void vDramcACTimingOptimize(DRAMC_CTX_T *p); |
| 1454 | void CBT_Switch_Freq(DRAMC_CTX_T *p, U8 freq); |
| 1455 | DRAM_CBT_MODE_T vGet_Dram_CBT_Mode(DRAMC_CTX_T *p); |
| 1456 | |
| 1457 | void DramcSetRankEngine2(DRAMC_CTX_T *p, U8 u1RankSel); |
| 1458 | DRAM_STATUS_T DramcEngine2Init(DRAMC_CTX_T *p, U32 test2_1, U32 test2_2, U8 testaudpat, U8 log2loopcount); |
| 1459 | void DramcEngine2SetPat(DRAMC_CTX_T *p, U8 testaudpat, U8 log2loopcount, U8 Use_Len1_Flag); |
| 1460 | U32 DramcEngine2Run(DRAMC_CTX_T *p, DRAM_TE_OP_T wr, U8 testaudpat); |
| 1461 | void DramcEngine2End(DRAMC_CTX_T *p); |
| 1462 | U32 TestEngineCompare(DRAMC_CTX_T *p); |
| 1463 | void DramcEnterSelfRefresh(DRAMC_CTX_T *p, U8 op); |
| 1464 | void DramcRunTimeConfig(DRAMC_CTX_T *p); |
| 1465 | void TransferToSPMControl(DRAMC_CTX_T *p); |
| 1466 | #if (SW_CHANGE_FOR_SIMULATION==0) |
| 1467 | void EnableDramcPhyDCM(DRAMC_CTX_T *p, BOOL bEn); |
| 1468 | #endif |
| 1469 | |
| 1470 | void vSetDramMRWriteLevelingOnOff(DRAMC_CTX_T *p, U8 u1OnOff); |
| 1471 | |
| 1472 | void MoveDramC_TX_DQS(DRAMC_CTX_T *p, U8 u1ByteIdx, S8 iShiftUI); |
| 1473 | void MoveDramC_TX_DQS_OEN(DRAMC_CTX_T *p, U8 u1ByteIdx, S8 iShiftUI); |
| 1474 | void MoveDramC_TX_DQ(DRAMC_CTX_T *p, U8 u1ByteIdx, S8 iShiftUI); |
| 1475 | void MoveDramC_TX_DQ_OEN(DRAMC_CTX_T *p, U8 u1ByteIdx, S8 iShiftUI); |
| 1476 | |
| 1477 | void CKEFixOnOff(DRAMC_CTX_T *p, U8 u1RankIdx, CKE_FIX_OPTION option, CKE_FIX_CHANNEL WriteChannelNUM); |
| 1478 | // Control CKE toggle mode (toggle both ranks 1. at the same time (CKE_RANK_DEPENDENT) 2. individually (CKE_RANK_INDEPENDENT)) |
| 1479 | void vCKERankCtrl(DRAMC_CTX_T *p, CKE_CTRL_MODE_T RankCtrlMode); |
| 1480 | void SetCKE2RankIndependent(DRAMC_CTX_T *p); |
| 1481 | |
| 1482 | /* RxDQSIsiPulseCG() - API for "RX DQS ISI pulse CG function" 0: disable, 1: enable */ |
| 1483 | void RxDQSIsiPulseCG(DRAMC_CTX_T *p, U8 u1OnOff); |
| 1484 | |
| 1485 | DRAM_STATUS_T DramcRegDump(DRAMC_CTX_T *p); |
| 1486 | |
| 1487 | void DramcDumpDebugInfo(DRAMC_CTX_T *p); |
| 1488 | void vPrintCalibrationResult(DRAMC_CTX_T *p); |
| 1489 | |
| 1490 | void DramcModeRegReadByRank(DRAMC_CTX_T *p, U8 u1Rank, U8 u1MRIdx, U16 *u2pValue); |
| 1491 | void DramcModeRegRead(DRAMC_CTX_T *p, U8 u1MRIdx, U16 *u1pValue); |
| 1492 | void DramcModeRegWrite(DRAMC_CTX_T *p, U8 u1MRIdx, U8 u1Value); |
| 1493 | void SetDramModeRegForWriteDBIOnOff(DRAMC_CTX_T *p, U8 onoff); |
| 1494 | |
| 1495 | void DramPhyReset(DRAMC_CTX_T *p); |
| 1496 | U8 u1GetMR4RefreshRate(DRAMC_CTX_T *p, DRAM_CHANNEL_T channel); |
| 1497 | void vAutoRefreshSwitch(DRAMC_CTX_T *p, U8 option); |
| 1498 | |
| 1499 | // mandatory calibration function |
| 1500 | DRAM_STATUS_T DramcDQSOSCAuto(DRAMC_CTX_T *p); |
| 1501 | DRAM_STATUS_T DramcStartDQSOSC(DRAMC_CTX_T *p); |
| 1502 | DRAM_STATUS_T DramcStopDQSOSC(DRAMC_CTX_T *p); |
| 1503 | DRAM_STATUS_T DramcZQCalibration(DRAMC_CTX_T *p); |
| 1504 | DRAM_STATUS_T DramcRXInputBufferOffsetCal(DRAMC_CTX_T *p); |
| 1505 | DRAM_STATUS_T DramcSwImpedanceCal(DRAMC_CTX_T *p, U8 u1Para, U8 term_option); |
| 1506 | DRAM_STATUS_T DramcWriteLeveling(DRAMC_CTX_T *p); |
| 1507 | #if GATING_ONLY_FOR_DEBUG |
| 1508 | void DramcGatingDebugInit(DRAMC_CTX_T *p); |
| 1509 | void DramcGatingDebugRankSel(DRAMC_CTX_T *p, U8 u1Rank); |
| 1510 | void DramcGatingDebug(DRAMC_CTX_T *p, U8 u1Channel); |
| 1511 | void DramcGatingDebugExit(DRAMC_CTX_T *p); |
| 1512 | #endif |
| 1513 | |
| 1514 | void vApplyConfigBeforeCalibration(DRAMC_CTX_T *p); |
| 1515 | void vApplyConfigAfterCalibration(DRAMC_CTX_T *p); |
| 1516 | void DramcRxdqsGatingPreProcess(DRAMC_CTX_T *p); |
| 1517 | void DramcRxdqsGatingPostProcess(DRAMC_CTX_T *p); |
| 1518 | DRAM_STATUS_T DramcRxdqsGatingCal(DRAMC_CTX_T *p); |
| 1519 | DRAM_STATUS_T DramcRxWindowPerbitCal(DRAMC_CTX_T *p, U8 u1UseTestEngine); |
| 1520 | void DramcRxdatlatCal(DRAMC_CTX_T *p); |
| 1521 | DRAM_STATUS_T DramcDualRankRxdatlatCal(DRAMC_CTX_T *p); |
| 1522 | DRAM_STATUS_T DramcTxWindowPerbitCal(DRAMC_CTX_T *p, DRAM_TX_PER_BIT_CALIBRATION_TYTE_T calType, U8 u1VrefScanEnable); |
| 1523 | void DramcTxOECalibration(DRAMC_CTX_T *p); |
| 1524 | void Dram_Reset(DRAMC_CTX_T *p); |
| 1525 | |
| 1526 | void DFSInitForCalibration(DRAMC_CTX_T *p); |
| 1527 | U16 u2DFSGetHighestFreq(DRAMC_CTX_T * p); |
| 1528 | |
| 1529 | #if ENABLE_RX_TRACKING_LP4 |
| 1530 | void DramcRxInputDelayTrackingInit_byFreq(DRAMC_CTX_T *p); |
| 1531 | void DramcRxInputDelayTrackingInit_Common(DRAMC_CTX_T *p); |
| 1532 | void DramcRxInputDelayTrackingHW(DRAMC_CTX_T *p); |
| 1533 | #endif |
| 1534 | |
| 1535 | #if DUAL_FREQ_K |
| 1536 | void DramcDFS(DRAMC_CTX_T *p, int iDoDMA); |
| 1537 | void DFSSwitchFreq(DRAMC_CTX_T *p); |
| 1538 | void DramcSaveFreqSetting(DRAMC_CTX_T *p); |
| 1539 | void DramcDumpFreqSetting(DRAMC_CTX_T *p); |
| 1540 | void DramcRestorePLLSetting(DRAMC_CTX_T *p); |
| 1541 | void DramcRestoreFreqSetting(DRAMC_CTX_T *p); |
| 1542 | void DramcExchangeFreqSetting(DRAMC_CTX_T *p); |
| 1543 | DRAM_STATUS_T DramcRestoreGatingTrackingToRG(DRAMC_CTX_T *p); |
| 1544 | #endif |
| 1545 | |
| 1546 | void DramcHWGatingInit(DRAMC_CTX_T *p); |
| 1547 | void DramcHWGatingOnOff(DRAMC_CTX_T *p, U8 u1OnOff); |
| 1548 | void DramcPrintHWGatingStatus(DRAMC_CTX_T *p, U8 u1Channel); |
| 1549 | void DramcGatingMode(DRAMC_CTX_T *p, U8 u1Mode); |
| 1550 | |
| 1551 | // reference function |
| 1552 | //DRAM_STATUS_T DramcRankSwap(DRAMC_CTX_T *p, U8 u1Rank); |
| 1553 | |
| 1554 | // DDR reserved mode function |
| 1555 | void Dramc_DDR_Reserved_Mode_setting(void); |
| 1556 | void Dramc_DDR_Reserved_Mode_AfterSR(void); |
| 1557 | void Before_Init_DRAM_While_Reserve_Mode_fail(DRAM_DRAM_TYPE_T dram_type); |
| 1558 | |
| 1559 | extern void DFSTestProgram(DRAMC_CTX_T *p, int iDoDMA); |
| 1560 | |
| 1561 | // dump all reg for debug |
| 1562 | extern void RISCReadAll(void); |
| 1563 | #if ENABLE_DDRPHY_FREQ_METER |
| 1564 | extern U32 DDRPhyFreqMeter(); |
| 1565 | #else |
| 1566 | #define DDRPhyFreqMeter(_x_) |
| 1567 | #endif |
| 1568 | extern void GetPhyPllFrequency(DRAMC_CTX_T *p); |
| 1569 | extern void vSetPHY2ChannelMapping(DRAMC_CTX_T *p, U8 u1Channel); |
| 1570 | #if (SW_CHANGE_FOR_SIMULATION || FOR_DV_SIMULATION_USED) |
| 1571 | extern void vMR2InitForSimulationTest(DRAMC_CTX_T *p); |
| 1572 | #endif |
| 1573 | DRAM_STATUS_T CmdBusTrainingLP4(DRAMC_CTX_T *p); |
| 1574 | |
| 1575 | void MPLLInit(void); |
| 1576 | |
| 1577 | void vSetChannelNumber(DRAMC_CTX_T *p); |
| 1578 | void vSetRankNumber(DRAMC_CTX_T *p); |
| 1579 | void vSetPHY2ChannelMapping(DRAMC_CTX_T *p, U8 u1Channel); |
| 1580 | U8 vGetPHY2ChannelMapping(DRAMC_CTX_T *p); |
| 1581 | void vSetRank(DRAMC_CTX_T *p, U8 ucRank); |
| 1582 | U8 u1GetRank(DRAMC_CTX_T *p); |
| 1583 | |
| 1584 | void vIO32WriteFldAlign_Phy_All2(DRAMC_CTX_T *p, U32 reg32, U32 val32, U32 fld); |
| 1585 | void vIO32WriteFldAlign_Phy_Byte2(DRAMC_CTX_T *p, U8 ucByteIdx, U32 reg32, U32 val32, U32 fld); |
| 1586 | U32 u4IO32ReadFldAlign_Phy_Byte2(DRAMC_CTX_T *p, U8 ucByteIdx, U32 reg32, U32 fld); |
| 1587 | #define vIO32WriteFldAlign_Phy_All(reg32, val32, fld) vIO32WriteFldAlign_Phy_All2(p, reg32, val32, fld) |
| 1588 | #define vIO32WriteFldAlign_Phy_Byte(ucByteIdx, reg32, val32, fld) vIO32WriteFldAlign_Phy_Byte2(p, ucByteIdx, reg32, val32, fld) |
| 1589 | #define u4IO32ReadFldAlign_Phy_Byte(ucByteIdx, reg32, fld) u4IO32ReadFldAlign_Phy_Byte2(p, ucByteIdx, reg32, fld) |
| 1590 | |
| 1591 | |
| 1592 | void DramcHwDQSOSC(DRAMC_CTX_T *p); |
| 1593 | |
| 1594 | #ifdef MPC_SW_FIFO |
| 1595 | void DramcMPC_FIFO(DRAMC_CTX_T *p); |
| 1596 | #endif |
| 1597 | |
| 1598 | #ifdef ENABLE_POST_PACKAGE_REPAIR |
| 1599 | void DramcPostPackageRepair(DRAMC_CTX_T *p); |
| 1600 | #endif |
| 1601 | |
| 1602 | void PRE_MIOCK_JMETER_HQA_USED(DRAMC_CTX_T *p); |
| 1603 | U8 Get_PRE_MIOCK_JMETER_HQA_USED_flag(void); |
| 1604 | void DramcMiockJmeterHQA(DRAMC_CTX_T *p); |
| 1605 | void print_HQA_measure_message(DRAMC_CTX_T * p); |
| 1606 | |
| 1607 | void DramcWriteDBIOnOff(DRAMC_CTX_T *p, U8 onoff); |
| 1608 | void DramcReadDBIOnOff(DRAMC_CTX_T *p, U8 onoff); |
| 1609 | void EnableDRAMModeRegWriteDBIAfterCalibration(DRAMC_CTX_T *p); |
| 1610 | void DramcModeRegWriteByRank(DRAMC_CTX_T *p, U8 u1Rank, U8 u1MRIdx, U8 u1Value); |
| 1611 | void DramcWriteMinus1MCKForWriteDBI(DRAMC_CTX_T *p, S8 iShiftUI); |
| 1612 | void ApplyWriteDBIPowerImprove(DRAMC_CTX_T *p, U8 onoff); |
| 1613 | void DramcDRS(DRAMC_CTX_T *p, U8 bEnable); |
| 1614 | |
| 1615 | void SPM_Pinmux_Setting(DRAMC_CTX_T * p); |
| 1616 | |
| 1617 | /* Macro that implements ceil function for unsigned integers (Test before using!) */ |
| 1618 | #define CEILING(n, v) (((n)%(v)) ? (((n)/(v)) + 1) : ((n)/(v))) |
| 1619 | |
| 1620 | // Global variables |
| 1621 | #ifdef _WIN32 |
| 1622 | extern FILE *fp_A60501; |
| 1623 | #endif |
| 1624 | |
| 1625 | U16 vGetRXVrefDefault(DRAMC_CTX_T *p); |
| 1626 | |
| 1627 | #ifdef DDR_INIT_TIME_PROFILING |
| 1628 | void TimeProfileBegin(void); |
| 1629 | UINT32 TimeProfileEnd(void); |
| 1630 | #endif |
| 1631 | |
| 1632 | |
| 1633 | extern U8 u1DMAtest; |
| 1634 | extern U8 u1MR02Value[FSP_MAX]; |
| 1635 | extern U8 u1MR12Value[CHANNEL_NUM][RANK_MAX][FSP_MAX]; |
| 1636 | extern U8 u1MR13Value; |
| 1637 | extern U8 u1MR14Value[CHANNEL_NUM][RANK_MAX][FSP_MAX]; |
| 1638 | extern U8 u1MR01Value[FSP_MAX]; |
| 1639 | extern U8 u1MR03Value[FSP_MAX]; |
| 1640 | extern DRAM_DFS_FREQUENCY_TABLE_T gFreqTbl[DRAM_DFS_SHUFFLE_MAX]; |
| 1641 | extern DRAM_DFS_FREQUENCY_TABLE_T gFreqTbl_LP3[DRAM_DFS_SHUFFLE_MAX]; |
| 1642 | extern U8 u1PrintModeRegWrite; |
| 1643 | |
| 1644 | #if FOR_DV_SIMULATION_USED |
| 1645 | extern U8 u1BroadcastOnOff; |
| 1646 | extern U8 gu1BroadcastIsLP4; |
| 1647 | #endif |
| 1648 | |
| 1649 | #if MRW_CHECK_ONLY |
| 1650 | #define MR_NUM 64 |
| 1651 | extern U16 u2MRRecord[CHANNEL_NUM][RANK_MAX][FSP_MAX][MR_NUM]; |
| 1652 | #endif |
| 1653 | |
| 1654 | #if APPLY_SIGNAL_WAVEFORM_SETTINGS_ADJUST |
| 1655 | extern S8 gDramcSwImpedanceAdjust[2][4];//ODT_ON/OFF x DRVP/DRVN/ODTP/ODTN |
| 1656 | extern S8 gDramcDqOdtRZQAdjust; |
| 1657 | extern S8 gDramcMR03PDDSAdjust[FSP_MAX]; |
| 1658 | extern S8 gDramcMR22SoCODTAdjust[FSP_MAX]; |
| 1659 | #endif |
| 1660 | |
| 1661 | extern U8 gEye_Scan_color_flag; |
| 1662 | extern U8 gCBT_EYE_Scan_flag; |
| 1663 | extern U8 gCBT_EYE_Scan_only_higheset_freq_flag; |
| 1664 | extern U8 gRX_EYE_Scan_flag; |
| 1665 | extern U8 gRX_EYE_Scan_only_higheset_freq_flag; |
| 1666 | extern U8 gTX_EYE_Scan_flag; |
| 1667 | extern U8 gTX_EYE_Scan_only_higheset_freq_flag; |
| 1668 | |
| 1669 | #ifdef DEVIATION |
| 1670 | extern U8 gSetSpecificedVref_Enable[]; |
| 1671 | extern U8 gSetSpecificedVref_Type; |
| 1672 | extern U8 gSetSpecificedVref_All_ChRk[]; |
| 1673 | extern U8 gSetSpecificedVref_Channel[]; |
| 1674 | extern U8 gSetSpecificedVref_Rank[]; |
| 1675 | extern S8 gSetSpecificedVref_Vref_Offset[]; |
| 1676 | #endif |
| 1677 | |
| 1678 | #if (CA_PER_BIT_DELAY_CELL || PINMUX_AUTO_TEST_PER_BIT_CA) |
| 1679 | extern const U8 uiLPDDR4_CA_Mapping_POP[CHANNEL_NUM][6]; |
| 1680 | #endif |
| 1681 | |
| 1682 | #if PINMUX_AUTO_TEST_PER_BIT_CA |
| 1683 | extern void CheckCAPinMux(DRAMC_CTX_T *p); |
| 1684 | #if ENABLE_LP3_SW |
| 1685 | extern void CheckCAPinMux_LP3(DRAMC_CTX_T *p); |
| 1686 | #endif |
| 1687 | #endif |
| 1688 | |
| 1689 | #if (PINMUX_AUTO_TEST_PER_BIT_RX | PINMUX_AUTO_TEST_PER_BIT_RX_LP3) |
| 1690 | extern void CheckRxPinMux(DRAMC_CTX_T *p); //By view of DRAM in LP4 |
| 1691 | #endif |
| 1692 | |
| 1693 | #if PINMUX_AUTO_TEST_PER_BIT_TX |
| 1694 | extern void CheckTxPinMux(DRAMC_CTX_T *p); |
| 1695 | #endif |
| 1696 | |
| 1697 | U8 *u1ChannelSet; |
| 1698 | extern const U8 u1LP4Channel[]; |
| 1699 | extern const U8 u1LP3Channel[]; |
| 1700 | |
| 1701 | #ifdef FOR_HQA_REPORT_USED |
| 1702 | void HQA_Log_Message_for_Report(DRAMC_CTX_T *p, U8 u1ChannelIdx, U8 u1RankIdx, U32 who_am_I, U8 *main_str, U8 byte_bit_idx, S32 value1, U8 *ans_str); |
| 1703 | #endif |
| 1704 | |
| 1705 | #if defined(SLT) |
| 1706 | void O1Path_Test(DRAMC_CTX_T * p); |
| 1707 | #endif |
| 1708 | #if DRAMC_MODEREG_CHECK |
| 1709 | void DramcModeReg_Check(DRAMC_CTX_T *p); |
| 1710 | #endif |
| 1711 | #if RUNTIME_SHMOO_RELEATED_FUNCTION && SUPPORT_SAVE_TIME_FOR_CALIBRATION |
| 1712 | void DramcRunTimeShmooRG_BackupRestore(DRAMC_CTX_T *p); |
| 1713 | #endif |
| 1714 | |
| 1715 | void TA2_Test_Run_Time_HW_Set_Column_Num(DRAMC_CTX_T * p); |
| 1716 | void TA2_Test_Run_Time_HW_Presetting(DRAMC_CTX_T * p, U32 len, TA2_RKSEL_TYPE_T rksel_mode); |
| 1717 | void TA2_Test_Run_Time_Pat_Setting(DRAMC_CTX_T *p, U8 PatSwitch); |
| 1718 | void TA2_Test_Run_Time_HW_Write(DRAMC_CTX_T * p, U8 u1Enable); |
| 1719 | void TA2_Test_Run_Time_HW_Status(DRAMC_CTX_T * p); |
| 1720 | void TA2_Test_Run_Time_HW(DRAMC_CTX_T * p); |
| 1721 | |
| 1722 | void SetMr13VrcgToNormalOperation(DRAMC_CTX_T *p); |
| 1723 | |
| 1724 | U32 GetDramcBroadcast(void); |
| 1725 | void DramcBroadcastOnOff(U32 bOnOff); |
| 1726 | |
| 1727 | void DramcBackupRegisters(DRAMC_CTX_T *p, U32 *backup_addr, U32 backup_num); |
| 1728 | void DramcRestoreRegisters(DRAMC_CTX_T *p, U32 *restore_addr, U32 restore_num); |
| 1729 | |
| 1730 | void DramcSwImpedanceSaveRegister(DRAMC_CTX_T *p, U8 ca_term_option, U8 dq_term_option, U8 save_to_where); |
| 1731 | void DramcUpdateImpedanceTerm2UnTerm(DRAMC_CTX_T *p); |
| 1732 | |
| 1733 | int Init_DRAM(DRAM_DRAM_TYPE_T dram_type, DRAM_CBT_MODE_EXTERN_T dram_cbt_mode_extern, DRAM_INFO_BY_MRR_T *DramInfo, U8 get_mdl_used); |
| 1734 | |
| 1735 | U8 Get_MDL_Used_Flag(void); |
| 1736 | void Set_MDL_Used_Flag(U8 value); |
| 1737 | |
| 1738 | void CheckDramcWBR(U32 u4address); |
| 1739 | U8 get_shuffleIndex_by_Freq(DRAMC_CTX_T *p); |
| 1740 | void mem_test_address_calculation(DRAMC_CTX_T * p, unsigned long uiSrcAddr, unsigned long *pu4Dest); |
| 1741 | U32 vGetVoltage(DRAMC_CTX_T *p, U32 get_voltage_type); |
| 1742 | void GetVcoreDelayCellTimeFromTable(DRAMC_CTX_T *p); |
| 1743 | void HQA_measure_message_reset_all_data(DRAMC_CTX_T *p); |
| 1744 | |
| 1745 | void DramcCmdUIDelaySetting(DRAMC_CTX_T *p, U8 value); |
| 1746 | |
| 1747 | void DramcNewDutyCalibration(DRAMC_CTX_T *p); |
| 1748 | void print_EYESCAN_LOG_message(DRAMC_CTX_T *p, U8 print_type); |
| 1749 | void Dramc_K_TX_EyeScan_Log(DRAMC_CTX_T *p); |
| 1750 | DRAM_STATUS_T DramcDQSOSCMR23(DRAMC_CTX_T *p); |
| 1751 | DRAM_STATUS_T DramcDQSOSCSetMR18MR19(DRAMC_CTX_T *p); |
| 1752 | DRAM_STATUS_T DramcDQSOSCShuSettings(DRAMC_CTX_T *p); |
| 1753 | void DramcHWGatingTrackingRecord(DRAMC_CTX_T *p, U8 u1Channel); |
| 1754 | void DramcConfInfraReset(DRAMC_CTX_T *p); |
| 1755 | UINT32 GPT_GetTickCount(UINT32 *tick_high_part); |
| 1756 | |
| 1757 | extern void Switch26MHzDisableDummyReadRefreshAllBank(DRAMC_CTX_T *p); |
| 1758 | |
| 1759 | #endif // _PI_API_H |