- 15 May, 2018 3 commits
-
-
Derek Basehore authored
To catch early hangs in resume, this sets up the watchdog before anything else in the pmusram code (ignoring setting up the stack...). This uses hard coded settings for the watchdog until the proper watchdog restore later on in the firmware/kernel. This also restores the old watchdog register values before the PLLs are restored to make sure we don't temporarily switch over to a 1/3s timeout on the watchdog when the pclk_wdt goes from 4MHz to 100MHz. Change-Id: I8f7652089a88783271b17482117b4609330abe80 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
-
Lin Huang authored
All the m0 code run in SRAM before, but we need to watch PMU_POWER_ST when SOC enter into FSM, and SRAM will shutdown during this time, so this code need run in PMUSRAM. But PMUSRAM only 8K space, we can not put all the m0 binary into PMUSRAM, Split the M0 binary into two, dram part still run in SRAM, and suspend part run in PMUSRAM. Change-Id: Ie08bdf3e2b8838f12b9297fe60ab0aad219684b1 Signed-off-by: Lin Huang <hl@rock-chips.com>
-
Lin Huang authored
we need to enable PMU_WKUP_RST_EN for pmu powermode configure, since enable wakeup reset will hold the soc status, so the SOC will not affect by some power or other single glitch when resume, and keep the soc in the right status. And it not need to enable DDRIO_RET_HW_DE_REQ, the ddr resume will do it manual. Change-Id: Ib4af897ffb3cb63dc2aa9a6002e5d9ef86ee4a49 Signed-off-by: Lin Huang <hl@rock-chips.com>
-
- 26 Mar, 2018 1 commit
-
-
Jonathan Wright authored
Ensure (where possible) that switch statements in plat comply with MISRA rules 16.1 - 16.7. Change-Id: Ie4a7d2fd10f6141c0cfb89317ea28a755391622f Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
-
- 20 Mar, 2018 1 commit
-
-
Lin Huang authored
there are two fix for save/restore watchdog register: 1. watchdog plck will shutdown after secure_watchdog_disable(), so need to save register before it and restore after secure_watchdog_enable(). 2. need write 0x76 to cnt_restart to keep watchdog alive when restore watchdog register. Change-Id: I1f6fbceae22186e3b72a87df6332a110adf37479 Signed-off-by: Lin Huang <hl@rock-chips.com>
-
- 30 Jan, 2018 1 commit
-
-
Caesar Wang authored
Coverity scan done for the coreboot project found the issue: Coverity (*** CID 1385418: Memory - illegal accesses (OVERRUN)) Coverity (*** CID 1385419: Memory - corruptions (OVERRUN)) Fix the Converity error issue with store_cru[] loop needs to be one element bigger. Fixes: ARM-software/tf-issues#544 Change-Id: I420f0a660b24baaa5fc5e78fca242cf750c9bbc7 Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 24 Jan, 2018 3 commits
-
-
Derek Basehore authored
This adds calls to the GICv3 save/restore functions for the GIC distributor and redistributor. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
-
Derek Basehore authored
We were looping for MAX_WAIT_COUNT in several places without any delays, so this adds the delays to make those loops more predictable. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
-
Derek Basehore authored
The code was accidentally restoring the QOS on suspend and saving the QOS on resume. This is the opposite of what we want. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
-
- 29 Aug, 2017 5 commits
-
-
Lin Huang authored
when shutdown logic power rail, the some sgrf register value will reset, so need to reinitilize secure. Change-Id: I8ad0570432e54441fe1c60dd2960a81fd58f7163 Signed-off-by: Lin Huang <hl@rock-chips.com>
-
Lin Huang authored
Change-Id: Ia59adf48cf14eb627721264765bce50cb31065ef Signed-off-by: Lin Huang <hl@rock-chips.com>
-
Lin Huang authored
pd_alive control cru, grf, timer, gpio and wdt, when turn off logic power rail, these register value will back to reset value, we need to save them value in suspend and restore them when resuem, since timer will reinitial in kernel, so it not need to save/restore. Change-Id: I0fc2a011d3cdc04b66ffbf728e769eb28b51ee38 Signed-off-by: Lin Huang <hl@rock-chips.com>
-
Lin Huang authored
when logic power rail shutdown, CRU register will back to reset value, ddr use abpll as clock source when do suspend, we need to save and dpll value in pmusram, then set back these ddr clock back to dpll when dddr resume. Change-Id: I95dc0173649e8515859cfa46b40a606e0cc2fe3f Signed-off-by: Lin Huang <hl@rock-chips.com>
-
Lin Huang authored
when shutdown logic power rail, the uart register value will reset, so need to reinitilize debug uart. Change-Id: I48d3535c0068fd671dea6ea32e908612992faf62 Signed-off-by: Lin Huang <hl@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 14 Jul, 2017 1 commit
-
-
Isla Mitchell authored
This fix modifies the order of system includes to meet the ARM TF coding standard. There are some exceptions to this change in order to retain header groupings and where there are headers within #if statements. Change-Id: Ib5b668c992d817cc860e97b29e16ef106d17e404 Signed-off-by: Isla Mitchell <isla.mitchell@arm.com>
-
- 30 Jun, 2017 1 commit
-
-
Caesar Wang authored
This patch fixes the two things as follows: 1) rk3399_flash_l2_b" seems to be a typo. That's "flush", not "flash". 2) fixes the warnings log. We always hit the warnings thing during the suspend, as below log: .. [ 51.022334] CPU5: shutdown [ 51.025069] psci: CPU5 killed. INFO: sdram_params->ddr_freq = 928000000 WARNING: rk3399_flash_l2_b:reg 28830380,wait When the L2 completes the clean and invalidate sequence, it asserts the L2FLUSHDONE signal. The SoC can now deassert L2FLUSHREQ signal and then the L2 deasserts L2FLUSHDONE. Then, a loop without a delay isn't really great to measure time. We should probably add a udelay(10) or so in there and then maybe replace the WARN() after the loop. In the actual tests, the L2 cache will take ~4ms by default for big cluster. In the real world that give 10ms for the enough margin, like the ddr/cpu/cci frequency and other factors that will affect it. Change-Id: I55788c897be232bf72e8c7b0e10cf9b06f7aa50d Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 08 Jun, 2017 2 commits
-
-
Lin Huang authored
with PMU_PERILP_PD_EN bit enable, the soc will shutdown cm0, crypto, dcf, imem(normal SRAM), dmac, bootrom, efuse_con, spi, i2c, uart, saradc, tsadc when suspend, we have M0 code need to run when suspend in normal SRAM, so we need to take care of that. Change-Id: I8c066637e5b81d4b1d53197450b9d592cbe00793 Signed-off-by: Lin Huang <hl@rock-chips.com> Signed-off-by: Derek Basehore <dbasehore@chromium.org> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
Lin Huang authored
the function pmu_cpuon_entrypoint() need to run in the pmusram, we just copy bin file to pmusram before, now we add pmusram section and link pmu_cpuon_entrypoint() to pmusram directly Change-Id: Iae31e4c01c480c8e6f565a8f588332b478efdb16 Signed-off-by: Lin Huang <hl@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 03 May, 2017 1 commit
-
-
dp-arm authored
To make software license auditing simpler, use SPDX[0] license identifiers instead of duplicating the license text in every file. NOTE: Files that have been imported by FreeBSD have not been modified. [0]: https://spdx.org/ Change-Id: I80a00e1f641b8cc075ca5a95b10607ed9ed8761a Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
-
- 01 Mar, 2017 1 commit
-
-
tony.xie authored
Remove struct rockchip_pm_ops_cb and instead of using weak functions implement; in this way we want the codes look clear and simple; Change-Id: Ib9e8a5e932fdfc2b3e6a1ec502c40dfe720ac400 Signed-off-by: tony.xie <tony.xie@rock-chips.com>
-
- 24 Feb, 2017 4 commits
-
-
Xing Zheng authored
The goal is that make clear the secure and SoC codes. Now cleaning them will help secure code extensions for RK3399 in the future. Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
-
Lin Huang authored
This patch do following things: 1. Request hresetn_cm0s_pmu_req first then request poresetn_cm0s_pmu_req during M0 enable. 2. Do not diable M0 clock for ddr dvfs. 3. Correct the clk_pmum0_gating_dis bit, it is BIT0 not BIT1 4. do not set/clear hclk_noc_pmu_en in M0 code, it does not relate to the M0 clock. Signed-off-by: Lin Huang <hl@rock-chips.com> Signed-off-by: Derek Basehore <dbasehore@chromium.org>
-
Derek Basehore authored
This patch sets the frequency configuration of the next DRAM DFS index to the configuration of the current index. This does not perform a frequency transition. It just configures registers so the training on resume for both indices will be correct. Signed-off-by: Derek Basehore <dbasehore@chromium.org> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
-
Xing Zheng authored
We used dcf do ddr frequency scaling, but we just include a dcf binary, it hard to maintain later, we have M0 compile flow in ATF, and M0 can also work for ddr frequency scaling, so let's use it. Signed-off-by: Lin Huang <hl@rock-chips.com> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
-
- 07 Nov, 2016 2 commits
-
-
Caesar Wang authored
We have do something for clocks gate. Fox example as the below: susped: clk_gate_con_save(); clk_gate_con_disable(); resume: clk_gate_con_restore(); -- SO, add the plls_suspend_prepare() and plls_resume_finish() are not necessary to S2R, that will save S2R time if remove them. BRANCH=none BUG=chrome-os-partner:58870,chrome-os-partner:55934 TEST=build kevin, two dogfooders with suspend_stress_test passing 3000 cycles and still going on. Change-Id: Icfbabc0b3ea8d2b5108d4f3de99a803b6d459669 Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
Caesar Wang authored
The CA53 and CM0 WDT clock gating in rk3399 SGRF, and ATF is in charge of it because the kernel can't touch SGRF. Basically the WDT didn't stop at suspend time, it just switched from the 24M to the 32k clock. That meant that the WDT would fire if you slept for long enough. In other word, the watchdog timer over count will increase to 750 (24*1000/32) times. The RK3399 HW watchdog interval is 21 seconds. When machine enters the suspend, the watchdog will reset the system after 35.7 (750/21) hours. BUG=chrome-os-partner:59257 TEST=daisydog checked and set value, powerd_dbus_suspend to verify. Change-Id: I88bb2a05b7d67d5ffd292f9d05d033ae9a6a3593 Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 26 Oct, 2016 1 commit
-
-
Caesar Wang authored
The RK3399 supports close the center logic enter power mode, so we can close PD_CENTER to save more power during suspend. Therefore, we need to support save/restore the DDR PHY and controller registers during suspend/resume. Also, need CL (http://crosreview.com/397399 ) to check disabling center logic. Change-Id: I288defd8e9caa3846d9fa663a33e4d51df1aaa5d Signed-off-by: Xing Zheng <zhengxing@rock-chips.com> Signed-off-by: Derek Basehore <dbasehore@chromium.org> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 24 Oct, 2016 2 commits
-
-
Caesar Wang authored
Due to the PMU design, the PMU may not clear the WAKEUP bit after wakeup, therefore, the state machine at the power mode may enter the infinite loop during WFI. There is a solution that we can use the M0 to monitor the WAKEUP bit and clear it during power mode, then the state machine will be recovered immediately. Then, the DUT can exit the WFI normally. Change-Id: I303628553b728c214bf2d436bd3122032b5e669c Signed-off-by: Xing Zheng <zhengxing@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
Caesar Wang authored
Add the common extra.ld.S and customized rk3399.ld.S to extend to more features for different platforms. For example, we can add SRAM section and specific address to load there if we need it, and the common bl31.ld.S not need to be modified. Therefore, we can remove the unused codes which copying explicitly from the function pmusram_prepare(). It looks like more clear. Change-Id: Ibffa2da5e8e3d1d2fca80085ebb296ceb967fce8 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
- 13 Sep, 2016 1 commit
-
-
Caesar Wang authored
We make sure the resuming of gic need to be enabled. Otherwise, The resume will hit the below panic. ... [ 24.230541] CPU0: update max cpu_capacity 451 [ 24.236029] CPU5: update max cpu_capacity 1024 [ 24.236046] CPU4: shutdown [ 24.243205] psci: CPU4 killed. [ 24.258730] CPU5: shutdown [ 24.261472] psci: CPU5 killed. [ 24.270417] GIC: unable to set SRE (disabled at EL2), panic ahead [ 24.270417] cat[7801]: undefined instruction: pc=ffffffc0004e65d0 [ 24.270417] Code: b0003940 91274400 97f871af d2801e00 (d5184600) [ 24.270417] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT Change-Id: Ie9542c8d5768ba0accfa073453da8bfe06d4f921
-
- 09 Sep, 2016 3 commits
-
-
Caesar Wang authored
As the checkpatch reports the warning or error. plat/rockchip/common/plat_pm.c:96: ERROR: do not set execute permissions for source files plat/rockchip/rk3399/drivers/pmu/pmu.c:294: ERROR: do not set execute permissions for source files plat/rockchip/common/plat_pm.c:286: WARNING: line over 80 characters plat/rockchip/common/plat_pm.c:287: WARNING: line over 80 characters Change-Id: Ib347da21c56551c31df3f90f03777b13c75d5c26
-
Caesar Wang authored
For save power cosumption, if gpio power supply shut down, we need to set gpio2 ~ gpio4 to input and HiZ status when suspend, and recovery they status when rusume. we do it base on apio pass from loader. Change-Id: I59fd2395e5e37e63425472a39f519822c9197e4c
-
Caesar Wang authored
some specific board need to disable/enable specific gpio when suspend/resume, so we add this function, bootloader can pass the specific gpio, and we can handle these gpios in bl31 suspend/resuem function. Change-Id: I373b03ef9202ee4a05a2b9caacdfa01b47ee2177
-
- 08 Sep, 2016 1 commit
-
-
Tony Xie authored
As rk3399 reported the d8/octane scores drop 10% with cpu idle. The root cause is thc cpu cluster enter the slow mode. We don't need switch the clock to 24MHz if cpu cluster enter the retention mode. In order to improve performance, it just needs for cluster enter powering off mode. Also, we shouldn't do anything for hlvl if the system is off. Change-Id: I2a02962a01343abd0cba47ed63192c1cdf88b119
-
- 25 Aug, 2016 3 commits
-
-
Caesar Wang authored
For the PMU design, we don't expect to get the interrupts before enter the power mode. Since that will cause the confusion for the state machine in the power mode. Change-Id: Id8dee79ae617a66271b5caf92caf35f520f45099
-
Caesar Wang authored
Change-Id: I986d64df9dc62354d50ccea0468b90f090a44160 Signed-off-by: Caesar Wang <wxt@rock-chips.com>
-
Caesar Wang authored
If we don't enable the Schmitt trigger on the 32 kHz clock then systems won't always resume from suspend properly. Presumably anything else in the system that relies on the 32 kHz clock also will have problems without the Schmitt trigger enabled. Enable it always since having the 32 kHz clock on GPIO0_A0 isn't exactly an optional feature, so all boards using rk3399 will need this. Change-Id: Idc18c6cd1adc5be5f60efd9cb805d83d5cd40129
-
- 24 Aug, 2016 1 commit
-
-
Caesar Wang authored
In a previous change we mistakenly thought that PMU_24M_EN_CFG directly controlled whether the PMU counts ran off the 32k vs. 24M clock. Apparently that's not true. Real logic is now documented in code. Also in the previous change we mistaknely though that PMU_24M_EN_CFG was normally supposed to be 1 and we should "restore" it at resume time. This is a terrible idea and made the system totally unreliable after resume. Apparently PMU_24M_EN_CFG should always be 0 with all the current code and settings. Let's fix the above two problems. While we're changing all of this, let's also: 1. Init at boot time. Many of these counts are used when the system is running normally. We want the behavior at boot to match the behavior after suspend/resume. 2. Init CPU counts to be 1 us. Although old code was trying to set this to 1 ms (1000x slower) at suspend/resume time, we've been testing the kernel with 1 us for a long time now. That's because the kernel (at boot time) set these values to 24. Let's keep at 24 until we know that's wrong. 3. Init GPU counts to be 1 us. Old code wasn't touching the GPU, but as documented in comments it makes sense to init here. Do it. 4. Document the crap out of this code, since the SoC's behavior is confusing and poorly documented in the TRM. 5. Increase some stabilization times to 30 ms (from 3 ms). It's unclear that a full 30 ms is needed, but let's be safe for now. This also inits the counts for the GPU. (Thanks to Doug's patch that come from https://crosreview.com/372381) Change-Id: Id1bc159a5a99916aeab043895e5c4585c4adab22
-
- 11 Aug, 2016 2 commits
-
-
Caesar Wang authored
The pmusgrf reset-hold bits needs to be released, since the pmusgrf reset-hold bits needs to be held. Change-Id: Ia1eccc8fba18294f26b4cc07d47bc5e513dd9a1f
-
Caesar Wang authored
Sometimes this will cause the long delay for suspend/resume. Since the 24M OCS will be turned off in power mode. Also, remove the ERROR_DEPRECATED config define. Change-Id: I78f21c35912c2250972e551695cdacc7bc4c020a
-