summaryrefslogtreecommitdiff
path: root/plat/rockchip/common
AgeCommit message (Collapse)Author
2017-06-14Unique names for defines in the CPU librariesVarun Wadekar
This patch makes all the defines in the CPU libraries unique, by prefixing them with the CPU name. NOTE: PLATFORMS USING THESE MACROS WILL HAVE TO UPDATE THEIR CODE TO START USING THE UPDATED NAMES Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2017-06-08rockchip: check wakeup cpu when resumeLin Huang
unlike rk3399 and rk3368, there are some rockchip 64bit SOC do not have CPUPD, and pmu_cpuson_entrypoint() is common function for rockchip platform, so we need to check wakeup cpu when resume. Change-Id: I6313e8a9d7c16b03e033414f0cb281646c2159ff Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-06-08rockchip/rk3399: enable PMU_PERILP_PD_EN bit when suspendLin Huang
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>
2017-06-08rockchip: add pmusram sectionLin Huang
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>
2017-05-10Use SPDX license identifiers for remaining filesdp-arm
Change-Id: I7f54f45db65f32481cc05e1bd2c9c683b756e19a Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-05-10Merge pull request #918 from rockchip-linux/rk3328davidcunado-arm
rockchip: rk3328: support rk3328
2017-05-10Revert "rockchip: Remove unused rockchip_pd_pwr_down_wfi function"Antonio Nino Diaz
This reverts commit b6dcbf588af442fa87721dc707ff9e54d04ff504. This function wasn't used when it was removed, but it is needed to compile the new changes proposed for Rockchip platforms. Change-Id: Ia5bfe1f8398e08431f96923e2f059a83e5cb78d4 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-05-03Use SPDX license identifiersdp-arm
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>
2017-04-25rockchip: rk3328: support rk3328tony.xie
rk3328 is a Quad-core soc and Cortex-a53 inside! This patch supports the following functions: 1、power up/off cpus 2、suspend/resume cpus 3、suspend/resume system 4、reset system 5、power off system Change-Id: I60687058d13912c6929293b06fed9c6bc72bdc84 Signed-off-by: tony.xie <tony.xie@rock-chips.com>
2017-04-05rockchip: Remove unused rockchip_pd_pwr_down_wfi functionPaul Kocialkowski
The rockchip_pd_pwr_down_wfi function is currently unused, which may trigger compiler warnings or errors. Remove it. Change-Id: I7e1b0ae092e8855528ac2065ecefc8bd45305f31 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2017-03-03Merge pull request #854 from rockchip-linux/pm_platdavidcunado-arm
rockchip: plat_pm.c: Change callbacks implement for our SOCs.
2017-03-01rockchip: plat_pm.c: Change callbacks implement for our SOCs.tony.xie
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>
2017-02-24rk3399: dram: use PMU M0 to do ddr frequency scalingXing Zheng
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>
2017-01-24Use #ifdef for IMAGE_BL* instead of #ifMasahiro Yamada
One nasty part of ATF is some of boolean macros are always defined as 1 or 0, and the rest of them are only defined under certain conditions. For the former group, "#if FOO" or "#if !FOO" must be used because "#ifdef FOO" is always true. (Options passed by $(call add_define,) are the cases.) For the latter, "#ifdef FOO" or "#ifndef FOO" should be used because checking the value of an undefined macro is strange. Here, IMAGE_BL* is handled by make_helpers/build_macro.mk like follows: $(eval IMAGE := IMAGE_BL$(call uppercase,$(3))) $(OBJ): $(2) @echo " CC $$<" $$(Q)$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -D$(IMAGE) -c $$< -o $$@ This means, IMAGE_BL* is defined when building the corresponding image, but *undefined* for the other images. So, IMAGE_BL* belongs to the latter group where we should use #ifdef or #ifndef. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-18Merge pull request #801 from masahir0y/cleanupdavidcunado-arm
Macro cleanups
2017-01-18Move BL_COHERENT_RAM_BASE/END defines to common_def.hMasahiro Yamada
We have lots of duplicated defines (and comment blocks too). Move them to include/plat/common/common_def.h. While we are here, suffix the end address with _END instead of _LIMIT. The _END is a better fit to indicate the linker-derived real end address. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-01-13utils: move BIT(n) macro to utils.hMasahiro Yamada
We are duplicating this macro define, and it is useful enough to be placed in the common place. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-12-14Fix incorrect copyright noticesAntonio Nino Diaz
Some files have incorrect copyright notices, this patch fixes all files with deviations from the standard notice. Change-Id: I66b73e78a50a235acb55f1e2ec2052a42c0570d2 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2016-10-26Merge pull request #724 from rockchip-linux/support-rk3399-sdramdavidcunado-arm
rockchip: optimize the link mechanism for SRAM code
2016-10-25rockchip: fix A72 L2CTLR_DATA_RAM_LATENCY to 5Caesar Wang
The default value of L2CTLR_DATA_RAM_LATENCY is 2, depends to the test result on rk3399, the A72 will need lower voltage for high frequency if it's set to be 5, and almost no effect on performance. Change-Id: I99a6a43edcc0c58f7775c10f4b85669dc3eff66d Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2016-10-25rockchip: clear the power mode status via M0Caesar Wang
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>
2016-10-25rockchip: optimize the link mechanism for SRAM codeCaesar Wang
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>
2016-09-14Merge pull request #700 from rockchip-linux/fixes-typo-and-warningsdavidcunado-arm
rockchip: Fixes typo and warnings
2016-09-10rockchip: fixes some typoCaesar Wang
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
2016-09-10rockchip: set gpio2 ~ gpio4 to input and pull none modeCaesar Wang
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
2016-09-10rockchip: support disable/enable specific gpio when suspend/resumeCaesar Wang
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
2016-09-08rockchip: fix the scu idle for rk3399Tony Xie
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
2016-08-25rockchip: handle some interrupt before enter power mode for rk3399Caesar Wang
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
2016-08-11rockchip: fix the power up/dowm cnt for rk3399Caesar Wang
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
2016-07-28rockchip: fixes typo and some bugs for suspend/resume testsCaesar Wang
1. Remove the AP_PWROFF in ATF, should configure it in kernel. 2. Save and restore the PWMs pin/regs for suspend/resume. 3. The pmusgrf reset-hold bits needs to be released. since the pmusgrf reset-hold bits needs to be held. 4. Configure the PMU power up/down cycles about delay 3ms. 5. With the MMIO register block as one big mapping. 6. Fix the build error with psci_entrypoint since PSCI lib updated. Fixes the commit 9ec78bd ("rockchip: support the suspend/resume for rk3399"). Change-Id: I112806700bf433c87763aac23d22fa7e6a7f5264
2016-07-18Merge pull request #654 from rockchip-linux/rk3399-suspend-resumedanh-arm
rockchip: support the suspend/resume for rk3399
2016-07-18Merge pull request #653 from rockchip-linux/support-rockchip-sip-runtime-servicedanh-arm
rockchip: support plat SIP runtime service for rk3399
2016-07-18rockchip: support the suspend/resume for rk3399Tony Xie
1.Fixes the suspend/resume some bugs. 2.Add the power domain for saving power consumption. 3.Add cpu clusters suspend for rk3399 SoCs Change-Id: Id602779016b41d6281f4ba40a20229d909b28e46
2016-07-18rockchip: support plat SIP runtime serviceCaesar Wang
Software executing in the normal world and in the trusted world at exception levels lower than EL3 will request runtime services using the SMC instruction. See the documentation here: https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/ rt-svc-writers-guide.md This to be implemented as an EL3 Runtime Service in rockchip BL31 platform port, using the "SiP Service Call" range as specified in the SMC Calling Convention. This doesn't support any SMC yet, we will support it in later. Change-Id: I0a638dd0b653c28b08f79d89f77ed7c69864017d
2016-07-08Introduce utils.h header fileSandrine Bailleux
This patch introduces a new header file: include/lib/utils.h. Its purpose is to provide generic macros and helper functions that are independent of any BL image, architecture, platform and even not specific to Trusted Firmware. For now, it contains only 2 macros: ARRAY_SIZE() and IS_POWER_OF_TWO(). These were previously defined in bl_common.h and xlat_tables.c respectively. bl_common.h includes utils.h to retain compatibility for platforms that relied on bl_common.h for the ARRAY_SIZE() macro. Upstream platform ports that use this macro have been updated to include utils.h. Change-Id: I960450f54134f25d1710bfbdc4184f12c049a9a9
2016-05-27rockchip: support system off function for rk3399Caesar Wang
if define power off gpio, BL31 will do system power off through gpio control.
2016-05-27rockchip: add reset or power off gpio configuration for rk3399Caesar Wang
We add plat parameter structs to support BL2 to pass variable-length, variable-type parameters to BL31. The parameters are structured as a link list. During bl31 setup time, we travse the list to process each parameter. throuth this way, we can get the reset or power off gpio parameter, and do hardware control in BL31. This structure also can pass other parameter to BL31 in future.
2016-05-27rockchip: support rk3399 gpio driverCaesar Wang
There are 5 groups of GPIO (GPIO0~GPIO4), totally have 122 GPIOs on rk3399 platform. The pull direction(pullup or pulldown) for all of GPIOs are software-programmable. At the moment, we add the gpio basic driver since reset or power off the devices from gpio configuration for BL31.
2016-05-20Replace Rockchip delay timer by generic oneAntonio Nino Diaz
Use the generic delay timer instead of having a specific platform file for configuring it. Change-Id: Ifa68b9c97cd96ae1190cee74d22d729af95e4537
2016-05-20Implement plat_get_syscnt_freq2 on platformsAntonio Nino Diaz
Replaced plat_get_syscnt_freq by plat_get_syscnt_freq2 on all upstream platforms. Change-Id: I3248f3f65a16dc5e9720012a05c35b9e3ba6abbe
2016-05-04rockchip: support the suspend/resume for rk3399Caesar Wang
This patch adds to support the suspend/resume for rk3399 SoCs. Signed-off-by: Shengfei xu <xsf@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2016-04-21Move `plat_get_syscnt_freq()` to arm_common.cYatharth Kochar
This patch moves the definition for `plat_get_syscnt_freq()` from arm_bl31_setup.c to arm_common.c. This could be useful in case a delay timer needs to be installed based on the generic timer in other BLs. This patch also modifies the return type for this function from `uint64_t` to `unsigned long long` within ARM and other platform files. Change-Id: Iccdfa811948e660d4fdcaae60ad1d700e4eda80d
2016-04-14Dump platform-defined regs in crash reportingGerald Lejeune
It is up to the platform to implement the new plat_crash_print_regs macro to report all relevant platform registers helpful for troubleshooting. plat_crash_print_regs merges or calls previously defined plat_print_gic_regs and plat_print_interconnect_regs macros for each existing platforms. NOTE: THIS COMMIT REQUIRES ALL PLATFORMS THAT ENABLE THE `CRASH_REPORTING` BUILD FLAG TO MIGRATE TO USE THE NEW `plat_crash_print_regs()` MACRO. BY DEFAULT, `CRASH_REPORTING` IS ENABLED IN DEBUG BUILDS FOR ALL PLATFORMS. Fixes: arm-software/tf-issues#373 Signed-off-by: Gerald Lejeune <gerald.lejeune@st.com>
2016-04-05Support for Rockchip's family SoCsTony Xie
This patch adds to support the RK3368 and RK3399 SoCs. RK3368/RK3399 is one of the Rockchip family SoCs, which is an multi-cores ARM SoCs. This patch adds support to boot the Trusted Firmware on RK3368/RK3399 SoCs, and adds support to boot secondary CPUs, enter/exit core power states for all CPUs in the slow/fast clusters. This is the initial version for rockchip SoCs.(RK3368/RK3399 and next SoCs) * Support arm gicv2 & gicv3. * Boot up multi-cores CPU. * Add generic CPU helper functions. * Support suspend/resume. * Add system_off & system_reset implementation. * Add delay timer platform implementation. * Support the new porting interface for the PSCI implementation. Change-Id: I704bb3532d65e8c70dbd99b512c5e6e440ea6f43 Signed-off-by: Tony Xie <tony.xie@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Shengfei xu <xsf@rock-chips.com>