123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
- * All rights reserved.
- *
- * This software is supplied "AS IS" without any warranties.
- * RDA assumes no responsibility or liability for the use of the software,
- * conveys no license or title under any patent, copyright, or mask work
- * right to the product. RDA reserves the right to make changes in the
- * software without notification. RDA also make no representation or
- * warranty that such application will be suitable for the specified use
- * without further testing or modification.
- */
- #define __APS_64__
- //#define CONFIG_USE_PSRAM
- //#define CONFIG_PSRAM_LP_HALF_SLEEP
- static void prvDelayUS(uint32_t us);
- static inline void prvRamPhyPadCfg(void)
- {
- // PSRAM PHY
- hwp_psramPhy->psram_rf_cfg_psram_type = 0x00000040;
- hwp_psramPhy->psram_rf_cfg_phy = 0x00000001;
- hwp_psramPhy->psram_drf_cfg = 0x00000001;
- hwp_psramPhy->psram_rf_cfg_dll_dl_0_wr_ads0 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads0 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads0 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_3_wr_ads0 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_4_wr_ads0 = 0x00001D0B;
- hwp_psramPhy->psram_rf_cfg_dll_dl_5_wr_ads0 = 0x06180B0D;
- hwp_psramPhy->psram_rf_cfg_dll_dl_6_wr_ads0 = 0x1D011F0A;
- hwp_psramPhy->psram_rf_cfg_dll_dl_7_wr_ads0 = 0x0C1C1708;
- hwp_psramPhy->psram_rf_cfg_dll_dl_8_wr_ads0 = 0x0A001B0E;
- hwp_psramPhy->psram_rf_cfg_dll_dl_9_wr_ads0 = 0x0018041C;
- hwp_psramPhy->psram_rf_cfg_dll_dl_0_wr_ads1 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads1 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads1 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_3_wr_ads1 = 0x00000002;
- hwp_psramPhy->psram_rf_cfg_dll_dl_4_wr_ads1 = 0x0000150F;
- hwp_psramPhy->psram_rf_cfg_dll_dl_5_wr_ads1 = 0x0B0D0008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_6_wr_ads1 = 0x03060A12;
- hwp_psramPhy->psram_rf_cfg_dll_dl_7_wr_ads1 = 0x13161514;
- hwp_psramPhy->psram_rf_cfg_dll_dl_8_wr_ads1 = 0x08171C13;
- hwp_psramPhy->psram_rf_cfg_dll_dl_9_wr_ads1 = 0x00100D0A;
- hwp_psramPhy->psram_drf_cfg_reg_sel = 0x00000000;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f0 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f1 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f2 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f3 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f0 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f1 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f2 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f3 = 0x00000008;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f0 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f1 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f2 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f3 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f0 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f1 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f2 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f3 = 0x00000010;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f0 = 0x00000002;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f1 = 0x00000002;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f2 = 0x00000002;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f3 = 0x00000002;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f0 = 0x00000001;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f1 = 0x00000001;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f2 = 0x00000001;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f3 = 0x00000001;
- hwp_psramPhy->psram_drf_format_control = 0x00000001;
- hwp_psramPhy->psram_drf_t_rcd = 0x00000006;
- hwp_psramPhy->psram_drf_t_rddata_en = 0x00000006;
- hwp_psramPhy->psram_drf_t_cph_rd = 0x00000002;
- hwp_psramPhy->psram_drf_t_rddata_late = 0x00000002;
- hwp_psramPhy->psram_drf_t_rddata_valid_early = 0x00000003;
- hwp_psramPhy->psram_drf_t_cph_wr = 0x00000006;
- hwp_psramPhy->psram_drf_t_data_oe_ext = 0x00000011;
- hwp_psramPhy->psram_drf_t_dqs_oe_ext = 0x00000001;
- hwp_psramPhy->psram_drf_t_xphs = 0x0000000C;
- hwp_psramPhy->psram_rf_cfg_clock_gate = 0x0000001F;
- hwp_psramPhy->psram_rf_cfg_phy = 0x00000003;
- }
- static inline void prvRamPor(void)
- {
- hwp_pwrctrl->psram_hold_ctrl = 0;
- prvDelayUS(100000); // 100ms
- hwp_dmcCtrl->direct_cmd = 0x00000000;
- prvDelayUS(10000);
- hwp_dmcCtrl->direct_cmd = 0x1000003F;
- prvDelayUS(100000); // 100ms
- hwp_dmcCtrl->direct_cmd = 0x10001800;
- prvDelayUS(100000); // 100ms
- hwp_dmcCtrl->direct_cmd = 0x10008004;
- prvDelayUS(10000);
- // hwp_pwrctrl->psram_hold_ctrl = 1;
- }
- static inline void prvRamDmcCfg(void)
- {
- hwp_dmcCtrl->format_control = 0x11000101; // 32x16, BURST_2_DDR_BL4, ACC_GRANU_2_DDR_4N, ALIGN_BOUNDARY_2_COL_2BIT
- hwp_dmcCtrl->address_control = 0x20201; // 9_COL_BITS, 13_ROW_BITS, 2_BANK_BITS_4BK, 0_CHIP_BITS_1CS, 0_CHANNEL_BITS_1MEMIF
- hwp_dmcCtrl->decode_control = 0x20; // CHANNEL_CHIP_ROW_BANK_COL, PAGE_ADDR_11_10
- hwp_dmcCtrl->t_refi = 0x00000208;
- hwp_dmcCtrl->t_rfc = 0x00040004;
- hwp_dmcCtrl->t_mrr = 0x00000002;
- hwp_dmcCtrl->t_mrw = 0x00000005;
- hwp_dmcCtrl->t_rcd = 0x00000006;
- hwp_dmcCtrl->t_ras = 0x00000011;
- hwp_dmcCtrl->t_rp = 0x00000004;
- hwp_dmcCtrl->t_rpall = 0x00000004;
- hwp_dmcCtrl->t_rrd = 0x00000004;
- hwp_dmcCtrl->t_faw = 0x00000014;
- hwp_dmcCtrl->read_latency = 0x0000000e;
- hwp_dmcCtrl->t_rtr = 0x00000006;
- hwp_dmcCtrl->t_rtw = 0x0000000c;
- hwp_dmcCtrl->t_rtp = 0x00000008;
- hwp_dmcCtrl->write_latency = 0x0000000a;
- hwp_dmcCtrl->t_wr = 0x0000000c;
- hwp_dmcCtrl->t_wtr = 0x00090009;
- hwp_dmcCtrl->t_wtw = 0x000c000c;
- hwp_dmcCtrl->t_eckd = 0x0000000b;
- hwp_dmcCtrl->t_xckd = 0x0000000b;
- hwp_dmcCtrl->t_ep = 0x00000002;
- hwp_dmcCtrl->t_xp = 0x00030003;
- hwp_dmcCtrl->t_esr = 0x00000002;
- hwp_dmcCtrl->t_xsr = 0x00040004;
- hwp_dmcCtrl->t_srckd = 0x0000000b;
- hwp_dmcCtrl->t_cksrd = 0x0000000b;
- hwp_dmcCtrl->t_rddata_en = 0x00000006; // RL=6
- hwp_dmcCtrl->turnaround_priority = 0x00000022;
- hwp_dmcCtrl->hit_priority = 0x00000022;
- hwp_dmcCtrl->qos0_control = 0x00000f05;
- hwp_dmcCtrl->t_phywrlat = 0x00000103;
- }
- static inline void prvRamBootCfg(void)
- {
- hwp_dmcCtrl->memc_cmd = 0x00000003;
- prvDelayUS(100000); // 100ms
- // hwp_pwrctrl->psram_hold_ctrl = 0;
- }
- static inline void prvRamWakeCfg(void)
- {
- hwp_pwrctrl->psram_hold_ctrl = 0;
- hwp_dmcCtrl->memc_cmd = 0x00000003;
- prvDelayUS(10); // 10us
- }
- /////aps 64m/32m////////////////////
- static inline void prvPsramPhyConfig(void)
- {
- //rprintf("START APS32 PHY INIT" );
- hwp_psramPhy->psram_rf_cfg_phy = 0x1; //rf_phy_en=1,rf_phy_init_complete.
- hwp_psramPhy->psram_drf_cfg = 0x1; //select clk phase
- //ads0
- //#if definedCONFIG_POST_SIM
- //hwp_psramPhy->psram_rf_cfg_dll_dl_0_wr_ads0=0x80000008;
- //#else
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_psramPhy->psram_rf_cfg_psram_type = 0x42;
- #endif
- hwp_psramPhy->psram_rf_cfg_dll_dl_0_wr_ads0 = 0x80000008;
- //#endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads0 = 0x80080008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads0 = 0x83190008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_3_wr_ads0 = 0x00000002;
- #endif
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads0 = 0x80050008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads0 = 0x831f0008;
- //#endif
- hwp_psramPhy->psram_rf_cfg_dll_dl_3_wr_ads0 = 0x00000000;
- #endif
- #if defined(__APS_64__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads0 = 0x80000008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads0 = 0x80000008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_3_wr_ads0 = 0x00000000; //0527
- #endif
- //#if definedCONFIG_POST_SIM
- //hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads0=0x83060008;
- //#else
- hwp_psramPhy->psram_rf_cfg_dll_dl_4_wr_ads0 = 0x1c08;
- hwp_psramPhy->psram_rf_cfg_dll_dl_5_wr_ads0 = 0x1409180a;
- hwp_psramPhy->psram_rf_cfg_dll_dl_6_wr_ads0 = 0x9001a;
- hwp_psramPhy->psram_rf_cfg_dll_dl_7_wr_ads0 = 0xa090a13;
- hwp_psramPhy->psram_rf_cfg_dll_dl_8_wr_ads0 = 0x61e1e11;
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_9_wr_ads0 = 0x1f0d0a;
- #endif
- #if defined(__APS_64__) || defined(__APS_128__) || defined(__APS_256__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_9_wr_ads0 = 0xb0c0a;
- #endif
- //ads1
- //#if definedCONFIG_POST_SIM
- //hwp_psramPhy->psram_rf_cfg_dll_dl_0_wr_ads1=0x80000008;
- //#else
- hwp_psramPhy->psram_rf_cfg_dll_dl_0_wr_ads1 = 0x80000008;
- //#endif
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads1 = 0x80080008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads1 = 0x801b0008;
- #endif
- #if defined(__APS_64__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads1 = 0x80000008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads1 = 0x80000008;
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_1_wr_ads1 = 0x80170008;
- hwp_psramPhy->psram_rf_cfg_dll_dl_2_wr_ads1 = 0x831f0008;
- #endif
- hwp_psramPhy->psram_rf_cfg_dll_dl_3_wr_ads1 = 0x00000000;
- hwp_psramPhy->psram_rf_cfg_dll_dl_4_wr_ads1 = 0x1;
- hwp_psramPhy->psram_rf_cfg_dll_dl_5_wr_ads1 = 0x140b0e02;
- hwp_psramPhy->psram_rf_cfg_dll_dl_6_wr_ads1 = 0xd0c0901;
- #if defined(__APS_32__) || defined(__aps__64__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_7_wr_ads1 = 0x13161514;
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_psramPhy->psram_rf_cfg_dll_dl_7_wr_ads1 = 0xa090a13;
- #endif
- hwp_psramPhy->psram_rf_cfg_dll_dl_8_wr_ads1 = 0x8171c13;
- hwp_psramPhy->psram_rf_cfg_dll_dl_9_wr_ads1 = 0x1f0d0a;
- //shift_sel16
- hwp_psramPhy->psram_drf_cfg_reg_sel = 0x0;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f0 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f1 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f2 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_ie_sel_f3 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f0 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f1 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f2 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_oe_sel_f3 = 0x8;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f0 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f1 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f2 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_out_sel_f3 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f0 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f1 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f2 = 0x10;
- hwp_psramPhy->psram_drf_cfg_dqs_gate_sel_f3 = 0x10;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f0 = 0x2;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f1 = 0x2;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f2 = 0x2;
- hwp_psramPhy->psram_drf_cfg_data_ie_sel_f3 = 0x2;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f0 = 0x1;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f1 = 0x1;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f2 = 0x1;
- hwp_psramPhy->psram_drf_cfg_data_oe_sel_f3 = 0x1;
- hwp_psramPhy->psram_drf_format_control = 0x1;
- hwp_psramPhy->psram_drf_t_rcd = 0x6;
- #if defined(__APS_128__) || defined(__APS_256__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_drf_t_phywrlat = 0x0;
- #endif
- hwp_psramPhy->psram_drf_t_rddata_en = 0x6;
- #if defined(__APS_32__) || defined(__APS_64__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_drf_t_cph_rd = 0x2;
- #endif
- hwp_psramPhy->psram_drf_t_rddata_late = 0x2;
- hwp_psramPhy->psram_drf_t_rddata_valid_early = 0x3;
- #if defined(__APS_32__) || defined(__APS_64__) || defined(__WB955__)
- hwp_psramPhy->psram_drf_t_cph_wr = 0x61e6;
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_psramPhy->psram_drf_t_cph_wr = 0x6;
- hwp_psramPhy->psram_drf_t_cph_rd = 0x5;
- #endif
- hwp_psramPhy->psram_drf_t_data_oe_ext = 0x11;
- hwp_psramPhy->psram_drf_t_dqs_oe_ext = 0x1;
- hwp_psramPhy->psram_drf_t_xphs = 0xc;
- hwp_psramPhy->psram_rf_cfg_clock_gate = 0x1f;
- #if definedCONFIG_POST_SIM
- hwp_psramPhy->io_rf_psram_drv_cfg = 0xa0;
- #endif
- hwp_psramPhy->io_rf_psram_drv_cfg = 0x1009;
- hwp_psramPhy->psram_rf_cfg_phy = 0x3; //rf_phy_en=1,rf_phy_init_complete.
- }
- static inline void prvPsramDmc400Config(void)
- {
- //rprintf("START APS32 DMC INIT" );
- hwp_dmcCtrl->format_control = 0x11000101;
- hwp_dmcCtrl->address_control = 0x20201;
- hwp_dmcCtrl->decode_control = 0x20;
- hwp_dmcCtrl->t_refi = 0x00000208;
- hwp_dmcCtrl->t_rfc = 0x00040004; // TODO
- hwp_dmcCtrl->t_mrr = 0x00000002;
- hwp_dmcCtrl->t_mrw = 0x00000005;
- hwp_dmcCtrl->t_rcd = 0x00000006;
- hwp_dmcCtrl->t_ras = 0x00000011;
- hwp_dmcCtrl->t_rp = 0x00000004;
- hwp_dmcCtrl->t_rpall = 0x00000004;
- hwp_dmcCtrl->t_rrd = 0x00000004;
- hwp_dmcCtrl->t_faw = 0x00000014;
- hwp_dmcCtrl->read_latency = 0x0000000e; // TODO
- hwp_dmcCtrl->t_rtr = 0x00000006; // TODO
- hwp_dmcCtrl->t_rtw = 0x0000000c; // TODO
- hwp_dmcCtrl->t_rtp = 0x00000008; // TODO
- hwp_dmcCtrl->write_latency = 0x0000000a; // TODO
- hwp_dmcCtrl->t_wr = 0x0000000c;
- hwp_dmcCtrl->t_wtr = 0x00090009; //initial version
- //hwp_dmcCtrl->t_wtr =0x00090012;
- hwp_dmcCtrl->t_wtw = 0x000c000c;
- hwp_dmcCtrl->t_eckd = 0x0000000b; // TODO
- hwp_dmcCtrl->t_xckd = 0x0000000b; // TODO
- hwp_dmcCtrl->t_ep = 0x00000002; // TODO
- hwp_dmcCtrl->t_xp = 0x00030003;
- hwp_dmcCtrl->t_esr = 0x00000002; // TODO
- hwp_dmcCtrl->t_xsr = 0x00040004;
- hwp_dmcCtrl->t_srckd = 0x0000000b; // TODO
- hwp_dmcCtrl->t_cksrd = 0x0000000b; // TODO
- hwp_dmcCtrl->t_rddata_en = 0x00000006; // RL=6
- //hwp_dmcCtrl->t_rddata_en =0x00000007; // RL=6
- #if defined(__APS_32__) || defined(__APS_64__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_dmcCtrl->t_phywrlat = 0x00000103; // tDQSS=1(0.75-1.25) + WL=3
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_dmcCtrl->t_phywrlat = 0x00000108; // tDQSS=1(0.75-1.25) + WL=3
- #endif
- // DMC400 : 0x8 - memc_cmd
- // 2:0 - memc_cmd.
- // 0b000 : CONFIGURE
- // 0b001 : SLEEP
- // 0b010 : PAUSE
- // 0b011 : GO
- // 0b100 : INVALIDATE
- // hwp_dmcCtrl->memc_cmd = 0x3; // GO
- prvDelayUS(5);
- }
- static inline void prvPsramPor(void)
- {
- //rprintf("START APS32 POR INIT" );
- //*(volatile unsigned int*) REG_PWRCTRL_PSRAM_HOLD_CTRL = 0;
- hwp_pwrctrl->psram_hold_ctrl = 0;
- //TODO:t_PU>=150us
- //prvDelayUS(15000);//according to tb define the delay function
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_drf_t_cph_rd = 0x6;
- #endif
- prvDelayUS(5); //according to tb define the delay function
- hwp_dmcCtrl->direct_cmd = 0x0; //NOP
- //CONFIG psram MR63 for reset
- hwp_dmcCtrl->direct_cmd = 0x1000003f; //no
- //TODO t_RST>2us
- prvDelayUS(5);
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- prvDelayUS(5); //according to tb define the delay function
- hwp_dmcCtrl->direct_cmd = 0x0; //NOP
- //CONFIG psram MR63 for reset
- hwp_dmcCtrl->direct_cmd = 0x1000003f;
- //TODO t_RST>2us
- prvDelayUS(5);
- hwp_psramPhy->psram_drf_t_cph_rd = 0x2;
- prvDelayUS(5);
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_dmcCtrl->direct_cmd = 0x10001000;
- prvDelayUS(5);
- #endif
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_dmcCtrl->direct_cmd = 0x10001900;
- #endif
- #if defined(__APS_64__)
- hwp_dmcCtrl->direct_cmd = 0x10001a00;
- #endif
- #if defined(__APS_32__) || defined(__APS_64__)
- prvDelayUS(5);
- hwp_dmcCtrl->direct_cmd = 0x10008004;
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_dmcCtrl->direct_cmd = 0x10002004;
- prvDelayUS(10);
- hwp_dmcCtrl->direct_cmd = 0x10004708;
- #endif
- prvDelayUS(5);
- //*(volatile unsigned int*) REG_PWRCTRL_PSRAM_HOLD_CTRL = 1;
- hwp_pwrctrl->psram_hold_ctrl = 1; //no
- }
- static inline void prvPsramWarmPor(void)
- {
- //rprintf("START APS32 POR INIT" );
- //*(volatile unsigned int*) REG_PWRCTRL_PSRAM_HOLD_CTRL = 0;
- hwp_pwrctrl->psram_hold_ctrl = 0;
- //TODO:t_PU>=150us
- //prvDelayUS(15000);//according to tb define the delay function
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_psramPhy->psram_drf_t_cph_rd = 0x6;
- #endif
- prvDelayUS(5); //according to tb define the delay function
- hwp_dmcCtrl->direct_cmd = 0x0; //NOP
- //CONFIG psram MR63 for reset
- //hwp_dmcCtrl->direct_cmd = 0x60000000;
- //hwp_dmcCtrl->direct_cmd = 0x1000003f;//no
- //TODO t_RST>2us
- prvDelayUS(5);
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- prvDelayUS(5); //according to tb define the delay function
- hwp_dmcCtrl->direct_cmd = 0x0; //NOP
- //CONFIG psram MR63 for reset
- hwp_dmcCtrl->direct_cmd = 0x1000003f;
- //TODO t_RST>2us
- prvDelayUS(5);
- hwp_psramPhy->psram_drf_t_cph_rd = 0x2;
- prvDelayUS(5);
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_dmcCtrl->direct_cmd = 0x10001000;
- prvDelayUS(5);
- #endif
- #if defined(__APS_32__) || defined(__WB955__) || defined(__WB956__) || defined(__WB958__)
- hwp_dmcCtrl->direct_cmd = 0x10001900;
- #endif
- #if defined(__APS_32__) || defined(__APS_64__)
- prvDelayUS(5);
- hwp_dmcCtrl->direct_cmd = 0x10008004;
- #endif
- #if defined(__APS_128__) || defined(__APS_256__)
- hwp_dmcCtrl->direct_cmd = 0x10002004;
- prvDelayUS(10);
- hwp_dmcCtrl->direct_cmd = 0x10004708;
- #endif
- prvDelayUS(5);
- //*(volatile unsigned int*) REG_PWRCTRL_PSRAM_HOLD_CTRL = 1;
- hwp_pwrctrl->psram_hold_ctrl = 1; //no
- }
|