Commit Graph

575 Commits

Author SHA1 Message Date
davidcunado-arm bce266f07b Merge pull request #717 from sandrine-bailleux-arm/sb/foundation-fvp-v10
Whitelist version 9.6 of Foundation FVP
2016-09-26 10:20:08 +01:00
Sandrine Bailleux 4faa4a1d3d Whitelist version 9.6 of Foundation FVP
This prevents a warning being emitted in the console during FVP
configuration setup when using the Foundation FVP 9.6 onwards.

Change-Id: I685b8bd0dbd0119af4b0cb3f7d708fcc08e99561
2016-09-23 13:22:19 +01:00
Yatharth Kochar 03a3042b04 AArch32: Add support for ARM Cortex-A32 MPCore Processor
This patch adds ARM Cortex-A32 MPCore Processor support
in the CPU specific operations framework. It also includes
this support for the Base FVP port.

Change-Id: If3697b88678df737c29f79cf3fa1ea2cb6fa565d
2016-09-21 16:28:55 +01:00
Yatharth Kochar d991551872 AArch32: Support in SP_MIN to receive arguments from BL2
This patch adds support in SP_MIN to receive generic and
platform specific arguments from BL2.

The new signature is as following:
    void sp_min_early_platform_setup(void *from_bl2,
         void *plat_params_from_bl2);

ARM platforms have been modified to use this support.

Note: Platforms may break if using old signature.
      Default value for RESET_TO_SP_MIN is changed to 0.

Change-Id: I008d4b09fd3803c7b6231587ebf02a047bdba8d0
2016-09-21 16:28:46 +01:00
Yatharth Kochar 6fe8aa2fa6 AArch32: Add ARM platform changes in BL2
This patch adds ARM platform changes in BL2 for AArch32 state.
It instantiates a descriptor array for ARM platforms describing
image and entrypoint information for `SCP_BL2`, `BL32` and `BL33`.
It also enables building of BL2 for ARCH=aarch32.

Change-Id: I60dc7a284311eceba401fc789311c50ac746c51e
2016-09-21 16:28:25 +01:00
Yatharth Kochar 83fc4a930b AArch32: Add ARM platform changes in BL1
This patch adds ARM platform changes in BL1 for AArch32 state.
It also enables building of BL1 for ARCH=aarch32.

Change-Id: I079be81a93d027f37b0f7d8bb474b1252bb4cf48
2016-09-21 16:27:35 +01:00
Yatharth Kochar 1a0a3f0622 AArch32: Common changes needed for BL1/BL2
This patch adds common changes to support AArch32 state in
BL1 and BL2. Following are the changes:

* Added functions for disabling MMU from Secure state.
* Added AArch32 specific SMC function.
* Added semihosting support.
* Added reporting of unhandled exceptions.
* Added uniprocessor stack support.
* Added `el3_entrypoint_common` macro that can be
  shared by BL1 and BL32 (SP_MIN) BL stages. The
  `el3_entrypoint_common` is similar to the AArch64
  counterpart with the main difference in the assembly
  instructions and the registers that are relevant to
  AArch32 execution state.
* Enabled `LOAD_IMAGE_V2` flag in Makefile for
  `ARCH=aarch32` and added check to make sure that
  platform has not overridden to disable it.

Change-Id: I33c6d8dfefb2e5d142fdfd06a0f4a7332962e1a3
2016-09-21 16:27:15 +01:00
Yatharth Kochar a8aa7fec1d ARM platform changes for new version of image loading
This patch adds changes in ARM platform code to use new
version of image loading.

Following are the major changes:
  -Refactor the signatures for bl31_early_platform_setup()
   and arm_bl31_early_platform_setup() function to use
   `void *` instead of `bl31_params_t *`.
  -Introduce `plat_arm_bl2_handle_scp_bl2()` to handle
   loading of SCP_BL2 image from BL2.
  -Remove usage of reserve_mem() function from
   `arm_bl1_early_platform_setup()`
  -Extract BL32 & BL33 entrypoint info, from the link list
   passed by BL2, in `arm_bl31_early_platform_setup()`
  -Provides weak definitions for following platform functions:
     plat_get_bl_image_load_info
     plat_get_next_bl_params
     plat_flush_next_bl_params
     bl2_plat_handle_post_image_load
  -Instantiates a descriptor array for ARM platforms
   describing image and entrypoint information for
   `SCP_BL2`, `BL31`, `BL32` and `BL33` images.

All the above changes are conditionally compiled using the
`LOAD_IMAGE_V2` flag.

Change-Id: I5e88b9785a3df1a2b2bbbb37d85b8e353ca61049
2016-09-21 16:12:48 +01:00
danh-arm 131f7cd401 Merge pull request #711 from leon-chen-mtk/mt6795_2
Remove MT6795 plat_sip_svc.c to fix Coverity analysis error.
2016-09-19 11:58:55 +01:00
danh-arm 7a1b279430 Merge pull request #702 from jeenu-arm/psci-node-hw-state
Support for PSCI NODE_HW_STATE
2016-09-19 11:55:56 +01:00
Leon Chen 3c4dea1942 Remove MT6795 plat_sip_svc.c to fix Coverity analysis error. 2016-09-19 14:20:42 +08:00
davidcunado-arm a8de89c974 Merge pull request #709 from Xilinx/zynqmp-2016-09
xilinx: ZynqMP updates
- new SIP calls for bitstream programming
- new SIP call to discover the SOC silicon version
- support the delay timer
2016-09-16 13:57:10 +01:00
Jeenu Viswambharan 3cc17aae72 CSS: Implement support for NODE_HW_STATE
This patch implements CSS platform hook to support NODE_HW_STATE PSCI
API. The platform hook queries SCP to obtain CSS power state. Power
states returned by SCP are then converted to expected PSCI return codes.

Juno's PSCI operation structure is modified to use the CSS
implementation.

Change-Id: I4a5edac0e5895dd77b51398cbd78f934831dafc0
2016-09-15 11:18:48 +01:00
Jeenu Viswambharan 05b128f25e SCPI: Add function to query CSS power state
This patch adds the function scpi_get_css_power_state to perform the
'Get CSS Power State' SCP command and handle its response. The function
parses SCP response to obtain power states of requested cluster and CPUs
within.

Change-Id: I3ea26e48dff1a139da73f6c1e0893f21accaf9f0
2016-09-15 11:18:48 +01:00
Jeenu Viswambharan 1298ae0234 FVP: Implement support for NODE_HW_STATE
This patch implements FVP platform hook to support NODE_HW_STATE PSCI
API. The platform hook validates the given MPIDR and reads corresponding
status from FVP power controller, and returns expected values for the
PSCI call.

Change-Id: I286c92637da11858db2c8aba8ba079389032de6d
2016-09-15 11:18:48 +01:00
davidcunado-arm a760613fc0 Merge pull request #663 from leon-chen-mtk/mt6795_2
mediatek: Support for Mediatek MT6795 SoC
2016-09-14 18:09:38 +01:00
davidcunado-arm d9738fbc64 Merge pull request #700 from rockchip-linux/fixes-typo-and-warnings
rockchip: Fixes typo and warnings
2016-09-14 17:06:19 +01:00
Soren Brinkmann 8787c0e00c zynqmp: Make MMIO write FW call synchronous
We must guarantee that writes have become effective before returning to
the caller. Hence, wait for PMUFW signaling completion of the FW call
before returning to the rich OS.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:03 -07:00
Siva Durga Prasad Paladugu 3104f2e78d zynqmp: Add support to provide silicon id through SMC
Add support to provide silicon id to non-secure
software through SMC.

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>

[ sb
Move zynqmp_get_silicon_id outside of compile guards to avoid build
errors.
]

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
2016-09-13 09:19:03 -07:00
Nava kishore Manne 2ddc31dece zynqmp: pm: Implemented pm API functions to load the bitstream into PL
This patch adds pm_fpga_load() and pm_fpga_get_status() API's to provide
the Access to the xilfpga library to load the bitstream into zynqmp
PL region.

Signed-off-by: Nava kishore Manne <navam@xilinx.com>
2016-09-13 09:19:03 -07:00
Nava kishore Manne f7d4bfc2bf zynqmp: pm: adds new pm ID to sync with PMUFW ID numbers
This patch adds a new pm ID to sync with PMUFW ID numbers.

Signed-off-by: Nava kishore Manne <navam@xilinx.com>
2016-09-13 09:19:03 -07:00
Soren Brinkmann 4fe0f4be7d zynqmp: Initialize GIC on suspend_finish
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:03 -07:00
Filip Drazic b516b7dc5d zynqmp: pm: Call set_wakeup_source for all wake devices on sys-suspend
During system suspend, identify slaves which are configured
as wake sources and call pm_set_wakeup_source API for each of them.

Identifying if device may wake the system is done by checking if any
interrupt of that device is enabled in GICD_ISENABLER when the APU is
about to enter SUSPEND_TO_RAM state. If such interrupt is found,
pm_set_wakeup_source is called with corresponding PM node ID as
argument.

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
2016-09-13 09:19:03 -07:00
Filip Drazic 6aa4c533b8 zynqmp: pm: Add PM node IDs for GPU, PCIE, PCAP and RTC
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
2016-09-13 09:19:03 -07:00
Filip Drazic 95fd990fe6 zynqmp: pm: Provide state argument to the pm_self_suspend API call
The state argument of the pm_self_suspend API encodes the state to
which the APU intends to suspend. The state can be:
- PM_APU_STATE_CPU_IDLE - processor power down, all memories remain
  on
- PM_APU_STATE_SUSPEND_TO_RAM - all processors powered down, L2$
  powered down, all OCM banks in retention and DDR in
  self-refresh.
The calls for setting requirements for L2$ and OCM banks are now
redundant and removed.

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
[ sb
 - remove redundant #defines
]
Signed-off-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:03 -07:00
Stefan Krsmanovic eccc7cde9f zynqmp: Add simple implementation of zynqmp_validate_power_state()
Implementation is based on arm_validate_power_state().
This function is called during CPU_SUSPEND PSCI call to validate
power_state parameter. If state is valid this function populate it
in req_state array as power domain level specific local state.
ATF platform migration guide chapter 2.2 defines this function as
mandatory for PSCIv1.0 CPU_SUSPEND support.

Signed-off-by: Stefan Krsmanovic <stefan.krsmanovic@aggios.com>
2016-09-13 09:19:02 -07:00
Soren Brinkmann 797ab652fb zynqmp: Increase MAX_XLAT_TABLES
When moving the ATF into the DRAM address space an additional
translation table is required.

Reported-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:02 -07:00
Soren Brinkmann 0ab6a2429b zynqmp: Change default BL31 address space
The OCM space was reorganized to use the space more efficiently. Adjust
the default ATF location to be aligned with other ZynqMP software
components.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:02 -07:00
Naga Sureshkumar Relli 06526c9797 zynqmp: Add RW access to L2ACTLR_EL1 and CPUACTLR_EL1
Arm provided error injection support. To enable this error injection,
we need to set L2DEIEN in L2ACTLR_EL1 register and L1DEIEN in
CPUACTLR_EL1 register.

This is needed for our cortexa53 edac linux driver testing.
These registers need write access from non secure EL1 i.e linux
at the time of setting the above bits.

Signed-off-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
2016-09-13 09:19:02 -07:00
Soren Brinkmann 538957d85b zynqmp: Set RESET_TO_BL31 through platform.mk
ZynqMP only supports builds with RESET_TO_BL31=1. Set this option
through the platform makefile on default.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:02 -07:00
Mirela Simonovic 2c239f7c2a zynqmp: pm: Added NODE_IPI_RPU_0 node definition in pm_defs
Nodes represent IPI dedicated to the RPU (not accessible by APU)

Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
2016-09-13 09:19:02 -07:00
Soren Brinkmann e1cb4da465 zynqmp: Add support for generic_delay_timer
Initialize the generic_delay_timer in the zynqmp port.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-09-13 09:19:02 -07:00
Caesar Wang 0587788abc rockchip: fixes the gic panic for rk3399 resume
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
2016-09-13 14:18:40 +08:00
Leon Chen c1ff80b128 Support for Mediatek MT6795 SoC
This patch support single core to boot to Linux kernel
through Trusted Firmware.
It also support 32 bit kernel and 64 bit kernel booting.
2016-09-12 17:13:55 +08:00
Caesar Wang 7e1bedb697 rockchip: fixes some typo
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-10 06:37:23 +08:00
Caesar Wang a8656400c4 rockchip: SIP call use 32 bit return value for rk3399
for compatible 32bit and 64bit, we use 0x82xxxxxx as function ID,
we modify SIP call function return value to 32 bit.

Change-Id: Ib99b03a9ea423853aaa296dcc634ee82c622a552
2016-09-10 06:37:08 +08:00
Caesar Wang 2bff35bb7c rockchip: set gpio2 ~ gpio4 to input and pull none mode
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-10 04:06:44 +08:00
Caesar Wang e550c63101 rockchip: support disable/enable specific gpio when suspend/resume
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-10 04:06:44 +08:00
Caesar Wang 536c249245 rockchip/rk3399: improve gpio driver and support get pull mode function
We may need gpio pull mode later, so add this function.
Besides fix a set pull mode bug, and save gpio clock gate,
when operate the gpio, we will enable gpio clock, when
finish gpio operate, restore gpio clock gate status.

Change-Id: Ia1d602804f571a17f5ddc499908663b968b02974
2016-09-10 04:06:39 +08:00
Tony Xie 63ebf051b0 rockchip: fix the scu idle for rk3399
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-09-08 15:04:58 +08:00
davidcunado-arm 27c67f4ee9 Merge pull request #691 from rockchip-linux/fixes-suspend/resume-bugs
Fixes suspend/resume bugs
2016-08-26 11:59:42 +01:00
davidcunado-arm c2229abd75 Merge pull request #684 from rockchip-linux/add-sdram-for-rk3399
rockchip: add dram driver for rk3399
2016-08-25 13:56:25 +01:00
Caesar Wang bdb2763d64 rockchip: handle some interrupt before enter power mode for rk3399
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-25 12:29:43 +08:00
Caesar Wang b346423251 rockchip: remove the unused code for rk3399
Change-Id: I986d64df9dc62354d50ccea0468b90f090a44160
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2016-08-25 12:29:43 +08:00
Caesar Wang 9d5aee2b1f rockchip: on rk3399 enable Schmitt trigger on 32 kHz clock
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
2016-08-25 12:29:27 +08:00
Caesar Wang 863edcea43 rockchip: enable or disable auto power down base on frequency
add auto_pd_dis_freq parameter, we can pass a frequency from kernel
to disable or enable ddr auto power down function.

Change-Id: Ie30914701336c59047c380381c6b75dd76a89562
2016-08-25 08:39:16 +08:00
Caesar Wang fe877779ee rockchip: rk3399: add dram driver
add dram driver, and kernel can through sip function talk to bl31 to
do ddr frequency scaling. and ddr auto powerdown.

Change-Id: I0d0f2869aed95e336c6e23ba96a9310985c84840
2016-08-25 08:37:42 +08:00
Caesar Wang 0786d68853 rockchip: on rk3399 init the PMU counts at boot; set 24M/32k properly
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
2016-08-25 07:13:34 +08:00
danh-arm 079e522d39 Merge pull request #687 from sandrine-bailleux-arm/sb/panic-handler
Add WFI in platform's unexpected error handlers
2016-08-19 15:31:36 +01:00
Sandrine Bailleux 8c9e1af0b5 Add WFI in platform's unexpected error handlers
This patch adds a WFI instruction in the default implementations of
plat_error_handler() and plat_panic_handler(). This potentially reduces
power consumption by allowing the hardware to enter a low-power state.
The same change has been made to the FVP and Juno platform ports.

Change-Id: Ia4e6e1e5bf1ed42efbba7d0ebbad7be8d5f9f173
2016-08-19 14:04:03 +01:00