summaryrefslogtreecommitdiff
path: root/plat/rockchip
AgeCommit message (Collapse)Author
2018-02-27Update ULL() macro and instances of ull to comply with MISRADavid Cunado
MISRA C-2012 Rule 7.3 violation: lowercase l shall not be used as literal suffixes. This patch resolves this for the ULL() macro by using ULL suffix instead of the ull suffix. Change-Id: Ia8183c399e74677e676956e8653e82375d0e0a01 Signed-off-by: David Cunado <david.cunado@arm.com>
2018-02-21Ensure the correct execution of TLBI instructionsAntonio Nino Diaz
After executing a TLBI a DSB is needed to ensure completion of the TLBI. rk3328: The MMU is allowed to load TLB entries for as long as it is enabled. Because of this, the correct place to execute a TLBI is right after disabling the MMU. Change-Id: I8280f248d10b49a8c354a4ccbdc8f8345ac4c170 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-02-01Merge pull request #1247 from rockchip-linux/rk3399/fixes-memory-corruptionsdavidcunado-arm
rockchip/rk3399: Fix memory corruptions or illegal memory access
2018-02-01Merge pull request #1240 from dp-arm/dp/smcccdavidcunado-arm
Implement support for SMCCC v1.1 and optimize security mitigations for CVE-2017-5715 on AArch64
2018-02-01Merge pull request #1236 from dbasehore/gic-save-restoredavidcunado-arm
RK3399 GIC save/restore
2018-01-30rockchip/rk3399: Fix memory corruptions or illegal memory accessCaesar Wang
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>
2018-01-29Disable workaround for CVE-2017-5715 on unaffected platformsDimitris Papastamos
Change-Id: Ib67b841ab621ca1ace3280e44cf3e1d83052cb73 Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-01-25rockchip: Disable rdist before pwr_dm_suspend is calledDerek Basehore
This disables the redistributor before either of the pwr_dm_suspend functions are called. This is because the rdist save code in the rk3399 rockchip_soc_sys_pwr_dm_suspend function requires that each redistributor be disabled before saving state. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2018-01-23rockchip/rk3399: Save and restore GICDerek Basehore
This adds calls to the GICv3 save/restore functions for the GIC distributor and redistributor. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2018-01-23rockchip/rk3399: Add udelay to wait loopsDerek Basehore
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>
2018-01-23rockchip/rk3399: Fix QOS save/restoreDerek Basehore
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>
2018-01-23rockchip/rk3399: Change PD_CTR_LOOP to 10000Derek Basehore
This brings ATF into line with the kernel on the timeout for power domains turning on. We could actually timeout (when we shouldn't) on resume when turning power domains on. The guaranteed maximum delay is now 10ms. Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2018-01-19rockchip: Move to MULTI_CONSOLE_APIJulius Werner
This patch changes all Rockchip platforms to use the new MULTI_CONSOLE_API. The platform-specific plat_crash_console implementations are removed so that the platform can use the ones from the common platform code instead. Also change the registers used in plat_crash_print_regs. The existing use of x16 and x17 has always been illegal, since those registers are reserved for use by the linker as a temporary scratch registers in intra-procedure-call veneers and can never be expected to maintain their values across a function call. Change-Id: I8249424150be8d5543ed4af93b56756795a5288f Signed-off-by: Julius Werner <jwerner@chromium.org>
2018-01-19rockchip: Use coreboot-supplied serial console on coreboot systemsJulius Werner
This patch changes all Rockchip platforms to initialize the serial console with information supplied by coreboot rather than hardcoded base address and divisor values if BL31 is run on top of coreboot. Moving the BL2-to-BL31 parameter parsing as early as possible to ensure that the console is available for all following code. Also update the Rockchip platform to use MULTI_CONSOLE_API. Change-Id: I670d350fa2f8b8133539f91ac14977ab47db60d9 Signed-off-by: Julius Werner <jwerner@chromium.org>
2017-12-12rockchip: Implement a panic handler that will reboot the systemJulius Werner
The current Rockchip platform code retains the "common" default panic handler which simply hangs the system (until the watchdog kicks in, if enabled). This is usually not a great user experience. This patch implements a Rockchip-specific panic handler that calls the platform's reboot implementation to reset the system. Change-Id: I4cbe09c48f1b3f86ebdfc0108c186565f9ffc119 Signed-off-by: Julius Werner <jwerner@chromium.org>
2017-12-11Merge pull request #1178 from davidcunado-arm/dc/enable_svedavidcunado-arm
Enable SVE for Non-secure world
2017-12-09Merge pull request #1179 from paulkocialkowski/integrationdavidcunado-arm
rockchip: Include stdint header in plat_sip_calls.c
2017-12-03rockchip: Include stdint header in plat_sip_calls.cPaul Kocialkowski
This includes the stdint header to declare the various types used within the file, preventing build errors with recent GCC versions. Change-Id: I9e7e92bb31deb58d4ff2732067dd88b53124bcc9 Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2017-11-30Do not enable SVE on pre-v8.2 platformsDavid Cunado
Pre-v8.2 platforms such as the Juno platform does not have the Scalable Vector Extensions implemented and so the build option ENABLE_SVE is set to zero. This has a minor performance improvement with no functional impact. Change-Id: Ib072735db7a0247406f8b60e325b7e28b1e04ad1 Signed-off-by: David Cunado <david.cunado@arm.com>
2017-11-29Replace magic numbers in linkerscripts by PAGE_SIZEAntonio Nino Diaz
When defining different sections in linker scripts it is needed to align them to multiples of the page size. In most linker scripts this is done by aligning to the hardcoded value 4096 instead of PAGE_SIZE. This may be confusing when taking a look at all the codebase, as 4096 is used in some parts that aren't meant to be a multiple of the page size. Change-Id: I36c6f461c7782437a58d13d37ec8b822a1663ec1 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2017-11-07Merge pull request #1155 from masahir0y/uniphierdavidcunado-arm
Fix build error when creating ROT key for UniPhier platform
2017-11-07Build: introduce ${BUILD_PLAT} target to create the top build directoryMasahiro Yamada
Some platforms (for ex. UniPhier) want to create files in the very top of the build directory. Add ${BUILD_PLAT} so such files can depend on it. Make existing directory targets depend on ${BUILD_PLAT} because they are sub-directories of ${BUILD_PLAT}. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-01Fix usage of IMAGE_BLx macrosRoberto Vargas
These macros are only defined for corresponding image, and they are undefined for other images. It means that we have to use ifdef or defined() instead of relying on being 0 by default. Change-Id: Iad11efab9830ddf471599b46286e1c56581ef5a7 Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-29rockchip/rk3399: reinitilize secure sgrf when resumeLin Huang
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>
2017-08-29rockchip/rk3399: do secure timer init in pmusramLin Huang
we will use timer in pmusarm, when logic power rail shutdown, the secure timer will gone, so need to initial it in pmusram. Change-Id: I472e7eec3fc197f56223e6fff9167556c1c5e3bc Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: use slice1 to restore ddr slice1 ~ slice4Lin Huang
we do not have enough pmusram space now, so use slice1 to restore ddr slice1 ~ slice4, that's will save more pmusram space. Change-Id: Id54a7944f33d01a8f244cee6a8a0707bfe4d42da Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: disable more powerdomain prepare for shutdown logic railLin Huang
Change-Id: Ia59adf48cf14eb627721264765bce50cb31065ef Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29rockchip/rk3399: save and restore pd_alive registerLin Huang
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>
2017-08-29rockchip/rk3399: set ddr clock source back to dpll when ddr resumeLin Huang
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>
2017-08-29rockchip/rk3399: reinitilize debug uart when resumeLin Huang
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>
2017-08-15Add new alignment parameter to func assembler macroJulius Werner
Assembler programmers are used to being able to define functions with a specific aligment with a pattern like this: .align X myfunction: However, this pattern is subtly broken when instead of a direct label like 'myfunction:', you use the 'func myfunction' macro that's standard in Trusted Firmware. Since the func macro declares a new section for the function, the .align directive written above it actually applies to the *previous* section in the assembly file, and the function it was supposed to apply to is linked with default alignment. An extreme case can be seen in Rockchip's plat_helpers.S which contains this code: [...] endfunc plat_crash_console_putc .align 16 func platform_cpu_warmboot [...] This assembles into the following plat_helpers.o: Sections: Idx Name Size [...] Algn 9 .text.plat_crash_console_putc 00010000 [...] 2**16 10 .text.platform_cpu_warmboot 00000080 [...] 2**3 As can be seen, the *previous* function actually got the alignment constraint, and it is also 64KB big even though it contains only two instructions, because the .align directive at the end of its section forces the assembler to insert a giant sled of NOPs. The function we actually wanted to align has the default constraint. This code only works at all because the linker just happens to put the two functions right behind each other when linking the final image, and since the end of plat_crash_console_putc is aligned the start of platform_cpu_warmboot will also be. But it still wastes almost 64KB of image space unnecessarily, and it will break under certain circumstances (e.g. if the plat_crash_console_putc function becomes unused and its section gets garbage-collected out). There's no real way to fix this with the existing func macro. Code like func myfunc .align X happens to do the right thing, but is still not really correct code (because the function label is inserted before the .align directive, so the assembler is technically allowed to insert padding at the beginning of the function which would then get executed as instructions if the function was called). Therefore, this patch adds a new parameter with a default value to the func macro that allows overriding its alignment. Also fix up all existing instances of this dangerous antipattern. Change-Id: I5696a07e2fde896f21e0e83644c95b7b6ac79a10 Signed-off-by: Julius Werner <jwerner@chromium.org>
2017-07-14Fix order of remaining platform #includesIsla Mitchell
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>
2017-07-10Merge pull request #1012 from rockchip-linux/rk3399/l2cachedavidcunado-arm
rockchip/rk3399: fixes the typo and the WARNINGS during suspend/resume
2017-07-10Merge pull request #993 from rockchip-linux/hdcp-rk3399davidcunado-arm
rockchip: support to use hdcp for rk3399
2017-07-05rockchip: implement hdcp key decryption feature for rk3399Ziyuan Xu
Decrypt device private keys which transfer from kernel, then stuff it to DP controller. So that DP driver could start HDCP authentication in kernel. Change-Id: If3c2cd99bca811fe5fc30acc88bf5dc1afd7416d Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2017-06-30rockchip/rk3399: fixes the typo and the WARNINGS during suspend/resumeCaesar Wang
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>
2017-06-28rockchip: enable A53's erratum 855873 for rk3399Caesar Wang
For rk3399, the L2ACTLR[14] is 0 by default, as ACE CCI-500 doesn't support WriteEvict. and you will hit the condition L2ACTLR[3] with 0, as the Evict transactions should propagate to CCI-500 since it has snoop filters. Maybe this erratum applies to all Cortex-A53 cores so far, especially if RK3399's A53 is a r0p4. we should enable it to avoid data corruption, Change-Id: Ib86933f1fc84f8919c8e43dac41af60fd0c3ce2f Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2017-06-26rockchip: include hdcp.bin and declare hdcp key decryption handlerZiyuan Xu
For some reason, HDCP key decrytion can't open source in ATF, so we build it as hdcp.bin. Besides declare the handler for decrypting. Change-Id: Ia67ff2442ab43cb3ee4875b3d59cc1608e854b4b Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
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/rk3399: Move DRAM restore to PMUSRAMDerek Basehore
This moves the DRAM restore code to PMUSRAM. This is so that the voltage domain that contains the SRAM that it was stored in before may be turned off during system suspend. Change-Id: Id761181a30caadd12f1ce061d1034f3159a76d28 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2017-06-08rockchip/rk3399: convert to for-loops to save code spaceDerek Basehore
This converts two functions to use for-loops. This saves a bit of space to help moving DRAM resume code to PMUSRAM. Change-Id: Ie6ca490cf50c2ec83335cf1845b337c3e8a47496 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2017-06-08rockchip/rk3399: Remove unneeded if statementDerek Basehore
The removed if statement would make the same check that the for loop it is in does to break out of the for loop, so it doesn't make any sense to keep it there. Change-Id: I819c29f9182e6de1fc47e418aed15ad38e8f9fa9 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2017-06-08rockchip/rk3399: Remove unneeded register setsDerek Basehore
This removes the mmio_... function calls to set the multicast bit for the PHY registers when overriding the write leveling values. These are not needed since multicast is set by default when calling the function, and it's also better not to leave the side effect of disabling multicast when exiting the function. Change-Id: I83e089a2a2d55268b3832f36724c3b2c4be81082 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2017-06-08rockchip/rk3399: remove unneeded DDR restore functionDerek Basehore
This removes the phy_dll_bypass_set function as it is unneeded. The values that function sets are saved during suspend, so the proper values will be restored on resume. Change-Id: I17542206c56e639ce8cb6375233145167441d4e2 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
2017-06-08rockchip/rk3399: Save space for DRAM suspend dataDerek Basehore
This removes the space allocation for the unused PHY register space. For instance in PHY registers 0-127, only 0-90 are used, so don't save the 91-127 registers. This saves about 1.6KB of space. Change-Id: I0c9f6d9bed8f0c1f3b8b805dfb10cf0c06208919 Signed-off-by: Derek Basehore <dbasehore@chromium.org>
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-06-08rockchip/rk3399: fix DRAM gate training issueLin Huang
The differential signal of DQS need keep low level before gate training. It need enable RPULL and disable PHY side ODT to ensure it when do gate training. But it can not access the PHY registers to do it when perform DFS.So the workaroud as below: It is ensure that the PHY's read gate is landing somewhere in the incoming DQS's pulses before it starts searching for pre-amble window. It need get the rddqs_delay_ps to calculate the start point of gate training for DFS. Change-Id: I79eabcf4ec9a9c8f4539f68a51f22afba49c72fe Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-05-15rockchip: rk3328: Add assert check in pmu.ctony.xie
Add assert() check for cpuson_flags[] and cpuson_entry_point[]. Change-Id: I971fe54c2baa3b4514a3979042341220f5e20901 Signed-off-by: tony.xie <tony.xie@rock-chips.com>