project/bcm63xx/atf.git
8 years agoAdd new version of image loading.
Yatharth Kochar [Mon, 12 Sep 2016 15:08:41 +0000 (16:08 +0100)]
Add new version of image loading.

This patch adds capability to load BL images based on image
descriptors instead of hard coded way of loading BL images.
This framework is designed such that it can be readily adapted
by any BL stage that needs to load images.

In order to provide the above capability the following new
platform functions are introduced:

  bl_load_info_t *plat_get_bl_image_load_info(void);
    This function returns pointer to the list of images that the
    platform has populated to load.

  bl_params_t *plat_get_next_bl_params(void);
    This function returns a pointer to the shared memory that the
    platform has kept aside to pass trusted firmware related
    information that next BL image needs.

  void plat_flush_next_bl_params(void);
    This function flushes to main memory all the params that
    are passed to next image.

  int bl2_plat_handle_post_image_load(unsigned int image_id)
    This function can be used by the platforms to update/use
    image information for given `image_id`.

`desc_image_load.c` contains utility functions which can be used
by the platforms to generate, load and executable, image list
based on the registered image descriptors.

This patch also adds new version of `load_image/load_auth_image`
functions in-order to achieve the above capability.

Following are the changes for the new version as compared to old:
  - Refactor the signature and only keep image_id and image_info_t
    arguments. Removed image_base argument as it is already passed
    through image_info_t. Given that the BL image base addresses and
    limit/size are already provided by the platforms, the meminfo_t
    and entry_point_info arguments are not needed to provide/reserve
    the extent of free memory for the given BL image.

  - Added check for the image size against the defined max size.
    This is needed because the image size could come from an
    unauthenticated source (e.g. the FIP header).
    To make this check, new member is added to the image_info_t
    struct for identifying the image maximum size.

New flag `LOAD_IMAGE_V2` is added in the Makefile.
Default value is 0.

NOTE: `TRUSTED_BOARD_BOOT` is currently not supported when
      `LOAD_IMAGE_V2` is enabled.

Change-Id: Ia7b643f4817a170d5a2fbf479b9bc12e63112e79

8 years agoMerge pull request #711 from leon-chen-mtk/mt6795_2
danh-arm [Mon, 19 Sep 2016 10:58:55 +0000 (11:58 +0100)]
Merge pull request #711 from leon-chen-mtk/mt6795_2

Remove MT6795 plat_sip_svc.c to fix Coverity analysis error.

8 years agoMerge pull request #710 from dp-arm/dp/fiptool-usage
danh-arm [Mon, 19 Sep 2016 10:57:30 +0000 (11:57 +0100)]
Merge pull request #710 from dp-arm/dp/fiptool-usage

fiptool: Invoke command specific usage function

8 years agoMerge pull request #706 from dp-arm/dp/pmf-aligned-svc
danh-arm [Mon, 19 Sep 2016 10:57:02 +0000 (11:57 +0100)]
Merge pull request #706 from dp-arm/dp/pmf-aligned-svc

Ensure PMF service timestamps are properly aligned on a cache line bo…

8 years agoMerge pull request #705 from dp-arm/dp/pmf-macro-rename
danh-arm [Mon, 19 Sep 2016 10:56:39 +0000 (11:56 +0100)]
Merge pull request #705 from dp-arm/dp/pmf-macro-rename

Rename `pmf_calc_timestamp_offset` to `pmf_calc_timestamp_addr`

8 years agoMerge pull request #704 from yatharth-arm/yk/genfw-1495
danh-arm [Mon, 19 Sep 2016 10:56:23 +0000 (11:56 +0100)]
Merge pull request #704 from yatharth-arm/yk/genfw-1495

GICv3: Allow either G1S or G0 interrupts to be configured

8 years agoMerge pull request #702 from jeenu-arm/psci-node-hw-state
danh-arm [Mon, 19 Sep 2016 10:55:56 +0000 (11:55 +0100)]
Merge pull request #702 from jeenu-arm/psci-node-hw-state

Support for PSCI NODE_HW_STATE

8 years agoMerge pull request #701 from dp-arm/dp/fiptool-sha256
danh-arm [Mon, 19 Sep 2016 10:54:27 +0000 (11:54 +0100)]
Merge pull request #701 from dp-arm/dp/fiptool-sha256

fiptool: Add support for printing the sha256 digest with info command

8 years agoRemove MT6795 plat_sip_svc.c to fix Coverity analysis error.
Leon Chen [Mon, 19 Sep 2016 06:20:42 +0000 (14:20 +0800)]
Remove MT6795 plat_sip_svc.c to fix Coverity analysis error.

8 years agoMerge pull request #709 from Xilinx/zynqmp-2016-09
davidcunado-arm [Fri, 16 Sep 2016 12:57:10 +0000 (13:57 +0100)]
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

8 years agoCSS: Implement support for NODE_HW_STATE
Jeenu Viswambharan [Thu, 4 Aug 2016 08:43:15 +0000 (09:43 +0100)]
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

8 years agoSCPI: Add function to query CSS power state
Jeenu Viswambharan [Thu, 4 Aug 2016 11:44:52 +0000 (12:44 +0100)]
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

8 years agoFVP: Implement support for NODE_HW_STATE
Jeenu Viswambharan [Thu, 4 Aug 2016 08:43:15 +0000 (09:43 +0100)]
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

8 years agoPSCI: Add support for PSCI NODE_HW_STATE API
Jeenu Viswambharan [Wed, 3 Aug 2016 14:54:50 +0000 (15:54 +0100)]
PSCI: Add support for PSCI NODE_HW_STATE API

This patch adds support for NODE_HW_STATE PSCI API by introducing a new
PSCI platform hook (get_node_hw_state). The implementation validates
supplied arguments, and then invokes this platform-defined hook and
returns its result to the caller. PSCI capabilities are updated
accordingly.

Also updates porting and firmware design guides.

Change-Id: I808e55bdf0c157002a7c104b875779fe50a68a30

8 years agoMerge pull request #707 from sandrine-bailleux-arm/sb/restore-xlat-defines
davidcunado-arm [Thu, 15 Sep 2016 10:17:41 +0000 (11:17 +0100)]
Merge pull request #707 from sandrine-bailleux-arm/sb/restore-xlat-defines

Restore some defines in xlat_tables.h

8 years agoMerge pull request #708 from sandrine-bailleux-arm/sb/forward-decs
davidcunado-arm [Thu, 15 Sep 2016 10:17:27 +0000 (11:17 +0100)]
Merge pull request #708 from sandrine-bailleux-arm/sb/forward-decs

Add some missing forward declarations in plat_arm.h

8 years agoAdd some missing forward declarations in plat_arm.h
Sandrine Bailleux [Thu, 15 Sep 2016 09:09:53 +0000 (10:09 +0100)]
Add some missing forward declarations in plat_arm.h

This patch adds a couple of missing forward declarations in plat_arm.h
so that all types it references are known within this header file,
without relying on previous header inclusions. This concerns the
meminfo and bl31_params structures, which are defined in bl_common.h.
Other external types referenced from plat_arm.h (e.g. mmap_region_t)
get declared through header files included by arm_plat.h so they
don't need forward declarations.

Change-Id: I471d5aa487919aff3fa979fc65e053f4f5b0ef32

8 years agoRestore some defines in xlat_tables.h
Sandrine Bailleux [Thu, 15 Sep 2016 08:24:54 +0000 (09:24 +0100)]
Restore some defines in xlat_tables.h

Commit e8719552a24 removed some definitions related to translation
tables from the xlat_tables.h header file, based on the assumption
that they weren't used by any platform. These are actually used by
some partners so this patch restores them.

Fixes ARM-software/tf-issues#425

Change-Id: Idafa5f00bb0bd9c2847b5ae6541cf8db93c7b89a

8 years agofiptool: Invoke command specific usage function
dp-arm [Thu, 15 Sep 2016 08:58:50 +0000 (09:58 +0100)]
fiptool: Invoke command specific usage function

Instead of always calling the top level usage function when an
error is detected, call the command-specific usage function.

For example running `fiptool create` will produce the same output
as `fiptool help create`.  This is more convenient for the user
when they make a mistake.

Change-Id: I60178ab89d47adf93cdfe6d8b5d5f778a5ea3bca

8 years agoMerge pull request #663 from leon-chen-mtk/mt6795_2
davidcunado-arm [Wed, 14 Sep 2016 17:09:38 +0000 (18:09 +0100)]
Merge pull request #663 from leon-chen-mtk/mt6795_2

mediatek: Support for Mediatek MT6795 SoC

8 years agoMerge pull request #700 from rockchip-linux/fixes-typo-and-warnings
davidcunado-arm [Wed, 14 Sep 2016 16:06:19 +0000 (17:06 +0100)]
Merge pull request #700 from rockchip-linux/fixes-typo-and-warnings

rockchip: Fixes typo and warnings

8 years agoEnsure PMF service timestamps are properly aligned on a cache line boundary
dp-arm [Fri, 9 Sep 2016 10:39:09 +0000 (11:39 +0100)]
Ensure PMF service timestamps are properly aligned on a cache line boundary

When using more than a single service in PMF, it is necessary that the
per-service timestamps begin on a cache line boundary.  Previously it
was possible that two services shared a cache line for their
timestamps.  This made it difficult to reason about cache maintenance
operations within a single service and required a global understanding
of how all services operate.

Change-Id: Iacaae5154a7e19ad4107468e56df9ad082ee371c

8 years agoRename `pmf_calc_timestamp_offset` to `pmf_calc_timestamp_addr`
dp-arm [Thu, 8 Sep 2016 10:51:49 +0000 (11:51 +0100)]
Rename `pmf_calc_timestamp_offset` to `pmf_calc_timestamp_addr`

The macro calculates an absolute address rather than an offset so
rename it to avoid confusion.

Change-Id: I351f73dfd809fd28c0c30d38928caf5c5cd1af04

8 years agozynqmp: Make MMIO write FW call synchronous
Soren Brinkmann [Tue, 6 Sep 2016 23:29:07 +0000 (16:29 -0700)]
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>
8 years agozynqmp: Add support to provide silicon id through SMC
Siva Durga Prasad Paladugu [Wed, 24 Aug 2016 06:15:47 +0000 (11:45 +0530)]
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>
8 years agozynqmp: pm: Implemented pm API functions to load the bitstream into PL
Nava kishore Manne [Sat, 20 Aug 2016 17:48:09 +0000 (23:18 +0530)]
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>
8 years agozynqmp: pm: adds new pm ID to sync with PMUFW ID numbers
Nava kishore Manne [Sat, 20 Aug 2016 17:41:11 +0000 (23:11 +0530)]
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>
8 years agozynqmp: Initialize GIC on suspend_finish
Soren Brinkmann [Fri, 19 Feb 2016 05:16:35 +0000 (21:16 -0800)]
zynqmp: Initialize GIC on suspend_finish

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: pm: Call set_wakeup_source for all wake devices on sys-suspend
Filip Drazic [Tue, 26 Jul 2016 10:11:33 +0000 (12:11 +0200)]
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>
8 years agozynqmp: pm: Add PM node IDs for GPU, PCIE, PCAP and RTC
Filip Drazic [Tue, 26 Jul 2016 10:07:05 +0000 (12:07 +0200)]
zynqmp: pm: Add PM node IDs for GPU, PCIE, PCAP and RTC

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
8 years agozynqmp: pm: Provide state argument to the pm_self_suspend API call
Filip Drazic [Wed, 20 Jul 2016 15:17:39 +0000 (17:17 +0200)]
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>
8 years agozynqmp: Add simple implementation of zynqmp_validate_power_state()
Stefan Krsmanovic [Mon, 9 May 2016 16:00:47 +0000 (18:00 +0200)]
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>
8 years agozynqmp: Increase MAX_XLAT_TABLES
Soren Brinkmann [Mon, 25 Jul 2016 17:33:53 +0000 (10:33 -0700)]
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>
8 years agozynqmp: Change default BL31 address space
Soren Brinkmann [Fri, 15 Jul 2016 13:23:37 +0000 (06:23 -0700)]
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>
8 years agozynqmp: Add RW access to L2ACTLR_EL1 and CPUACTLR_EL1
Naga Sureshkumar Relli [Fri, 1 Jul 2016 07:16:43 +0000 (12:46 +0530)]
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>
8 years agozynqmp: Set RESET_TO_BL31 through platform.mk
Soren Brinkmann [Wed, 6 Jul 2016 22:11:31 +0000 (15:11 -0700)]
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>
8 years agozynqmp: pm: Added NODE_IPI_RPU_0 node definition in pm_defs
Mirela Simonovic [Fri, 17 Jun 2016 14:17:23 +0000 (16:17 +0200)]
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>
8 years agozynqmp: Add support for generic_delay_timer
Soren Brinkmann [Wed, 22 Jun 2016 16:02:56 +0000 (09:02 -0700)]
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>
8 years agoMerge pull request #703 from rockchip-linux/fixes-gic-panic
davidcunado-arm [Tue, 13 Sep 2016 16:13:45 +0000 (17:13 +0100)]
Merge pull request #703 from rockchip-linux/fixes-gic-panic

rockchip: fixes the gic panic for rk3399 resume

8 years agorockchip: fixes the gic panic for rk3399 resume
Caesar Wang [Tue, 13 Sep 2016 03:15:00 +0000 (11:15 +0800)]
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

8 years agoMerge pull request #698 from rockchip-linux/set-APIO-for-rk3399
davidcunado-arm [Mon, 12 Sep 2016 16:58:41 +0000 (17:58 +0100)]
Merge pull request #698 from rockchip-linux/set-APIO-for-rk3399

Set apio for rk3399

8 years agoGICv3: Allow either G1S or G0 interrupts to be configured
Yatharth Kochar [Tue, 6 Sep 2016 10:48:05 +0000 (11:48 +0100)]
GICv3: Allow either G1S or G0 interrupts to be configured

Currently the GICv3 driver mandates that platform populate
both G1S and G0 interrupts. However, it is possible that a
given platform is not interested in both the groups and
just needs to specify either one of them.

This patch modifies the `gicv3_rdistif_init()` & `gicv3_distif_init()`
functions to allow either G1S or G0 interrupts to be configured.

Fixes ARM-software/tf-issues#400

Change-Id: I43572b0e08ae30bed5af9334f25d35bf439b0d2b

8 years agofiptool: Add support for printing the sha256 digest with info command
dp-arm [Wed, 24 Aug 2016 12:21:08 +0000 (13:21 +0100)]
fiptool: Add support for printing the sha256 digest with info command

This feature allows one to quickly verify that the expected
image is contained in the FIP without extracting the image and
running sha256sum(1) on it.

The sha256 digest is only shown when the verbose flag is used.

This change requires libssl-dev to be installed in order to build
Trusted Firmware. Previously, libssl-dev was optionally needed only
to support Trusted Board Boot configurations.

Fixes ARM-Software/tf-issues#124

Change-Id: Ifb1408d17f483d482bb270a589ee74add25ec5a6

8 years agoSupport for Mediatek MT6795 SoC
Leon Chen [Mon, 11 Jul 2016 08:05:23 +0000 (16:05 +0800)]
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.

8 years agoMerge pull request #699 from soby-mathew/sm/flush_plat_psci_ops
danh-arm [Mon, 12 Sep 2016 08:58:44 +0000 (09:58 +0100)]
Merge pull request #699 from soby-mathew/sm/flush_plat_psci_ops

Flush `psci_plat_pm_ops` after initialization

8 years agorockchip: fixes some typo
Caesar Wang [Fri, 9 Sep 2016 22:26:11 +0000 (06:26 +0800)]
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

8 years agorockchip: SIP call use 32 bit return value for rk3399
Caesar Wang [Fri, 9 Sep 2016 22:25:29 +0000 (06:25 +0800)]
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

8 years agorockchip: set gpio2 ~ gpio4 to input and pull none mode
Caesar Wang [Fri, 9 Sep 2016 18:47:53 +0000 (02:47 +0800)]
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

8 years agorockchip: support disable/enable specific gpio when suspend/resume
Caesar Wang [Fri, 9 Sep 2016 18:43:15 +0000 (02:43 +0800)]
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

8 years agorockchip/rk3399: improve gpio driver and support get pull mode function
Caesar Wang [Fri, 9 Sep 2016 18:42:32 +0000 (02:42 +0800)]
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

8 years agoFlush `psci_plat_pm_ops` after initialization
Soby Mathew [Fri, 9 Sep 2016 10:33:58 +0000 (11:33 +0100)]
Flush `psci_plat_pm_ops` after initialization

The `psci_plat_pm_ops` global pointer is initialized during cold boot by the
primary CPU and will be accessed by the secondary CPUs before enabling data
cache during warm boot. This patch adds a missing data cache flush of
`psci_plat_psci_ops` after initialization during psci_setup() so that
secondaries can see the updated `psci_plat_psci_ops` pointer.

Fixes ARM-software/tf-issues#424

Change-Id: Id4554800b5646302b944115a33be69507d53cedb

8 years agoMerge pull request #697 from rockchip-linux/fixes-scu-idle
davidcunado-arm [Thu, 8 Sep 2016 13:42:45 +0000 (14:42 +0100)]
Merge pull request #697 from rockchip-linux/fixes-scu-idle

rockchip: fix the scu idle for rk3399

8 years agorockchip: fix the scu idle for rk3399
Tony Xie [Fri, 2 Sep 2016 18:13:38 +0000 (11:13 -0700)]
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

8 years agoMerge pull request #695 from soby-mathew/sm/AArch32_fixes
davidcunado-arm [Thu, 1 Sep 2016 08:43:32 +0000 (09:43 +0100)]
Merge pull request #695 from soby-mathew/sm/AArch32_fixes

Fixes for AArch32 port of TF

8 years agoAArch32: Fix SCTLR context initialization
Soby Mathew [Wed, 31 Aug 2016 11:34:33 +0000 (12:34 +0100)]
AArch32: Fix SCTLR context initialization

This patch fixes a bug in context management library when writing
SCTLR register during context initialization. The write happened
prior to initialization of the register context pointer. This
resulted in the compiler optimizing the write sequence from the
final binary and hence SCTLR remains uninitialized when
entering normal world. The bug is fixed by doing the
initialization of the register context pointer earlier in the
sequence.

Change-Id: Ic7465593a74534046b79f40446ffa1165c52ed76

8 years agoAArch32: resolve build error when LOG_LEVEL=50
Soby Mathew [Tue, 30 Aug 2016 12:07:31 +0000 (13:07 +0100)]
AArch32: resolve build error when LOG_LEVEL=50

This patch resolves a build error in Trusted Firmware when `ARCH=aarch32`
and LOG_LEVEL >= 50.

Change-Id: I62a23ded4a25304533cdcc5ff11442aee041709b

8 years agoMerge pull request #689 from yatharth-arm/yk/plat_report_expn
davidcunado-arm [Wed, 31 Aug 2016 13:36:20 +0000 (14:36 +0100)]
Merge pull request #689 from yatharth-arm/yk/plat_report_expn

Remove looping around `plat_report_exception`

8 years agoMerge pull request #690 from soby-mathew/sm/level_sel_xlat
davidcunado-arm [Wed, 31 Aug 2016 11:44:21 +0000 (12:44 +0100)]
Merge pull request #690 from soby-mathew/sm/level_sel_xlat

Automatically select initial xlation lookup level

8 years agoMerge pull request #693 from dp-arm/pmf-asm
davidcunado-arm [Wed, 31 Aug 2016 10:26:24 +0000 (11:26 +0100)]
Merge pull request #693 from dp-arm/pmf-asm

Move pmf headers to include/lib/pmf and add assembler helper

8 years agoMerge pull request #692 from dp-arm/master
davidcunado-arm [Fri, 26 Aug 2016 15:52:51 +0000 (16:52 +0100)]
Merge pull request #692 from dp-arm/master

fiptool: Fix typo in create and update usage functions

8 years agoMerge pull request #691 from rockchip-linux/fixes-suspend/resume-bugs
davidcunado-arm [Fri, 26 Aug 2016 10:59:42 +0000 (11:59 +0100)]
Merge pull request #691 from rockchip-linux/fixes-suspend/resume-bugs

Fixes suspend/resume bugs

8 years agoAdd assembler helper to calculate PMF timestamp offset
dp-arm [Mon, 15 Aug 2016 09:35:54 +0000 (10:35 +0100)]
Add assembler helper to calculate PMF timestamp offset

Given the service name and timestamp id, this assembler macro
calculates the offset into a memory region where the per-cpu timestamp
value is located.

Change-Id: I47f6dfa2a17be182675e2ca0489d6eed42433209

8 years agoMove pmf headers to include/lib/pmf
dp-arm [Mon, 15 Aug 2016 09:33:08 +0000 (10:33 +0100)]
Move pmf headers to include/lib/pmf

More headers will be needed soon so better to move these to their own
directory to avoid cluttering include/lib.

Change-Id: I6a72dc5b602d6f51954cf60aadd1beb52a268670

8 years agoMerge pull request #684 from rockchip-linux/add-sdram-for-rk3399
davidcunado-arm [Thu, 25 Aug 2016 12:56:25 +0000 (13:56 +0100)]
Merge pull request #684 from rockchip-linux/add-sdram-for-rk3399

rockchip: add dram driver for rk3399

8 years agofiptool: Fix typo in create and update usage functions
dp-arm [Tue, 23 Aug 2016 13:31:41 +0000 (14:31 +0100)]
fiptool: Fix typo in create and update usage functions

It should be 'fiptool' instead of 'fiptfool'.

Change-Id: I84ce1b6aaae5b8b33e5781bfe4f9e9cf462edb03

8 years agorockchip: handle some interrupt before enter power mode for rk3399
Caesar Wang [Thu, 18 Aug 2016 00:22:10 +0000 (17:22 -0700)]
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

8 years agorockchip: remove the unused code for rk3399
Caesar Wang [Tue, 23 Aug 2016 19:52:59 +0000 (12:52 -0700)]
rockchip: remove the unused code for rk3399

Change-Id: I986d64df9dc62354d50ccea0468b90f090a44160
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
8 years agorockchip: on rk3399 enable Schmitt trigger on 32 kHz clock
Caesar Wang [Wed, 24 Aug 2016 22:31:32 +0000 (06:31 +0800)]
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

8 years agorockchip: enable or disable auto power down base on frequency
Caesar Wang [Thu, 25 Aug 2016 00:38:23 +0000 (08:38 +0800)]
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

8 years agorockchip: rk3399: add dram driver
Caesar Wang [Thu, 25 Aug 2016 00:37:42 +0000 (08:37 +0800)]
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

8 years agorockchip: on rk3399 init the PMU counts at boot; set 24M/32k properly
Caesar Wang [Wed, 24 Aug 2016 22:29:46 +0000 (06:29 +0800)]
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

8 years agoAutomatically select initial xlation lookup level
Antonio Nino Diaz [Tue, 2 Aug 2016 08:21:41 +0000 (09:21 +0100)]
Automatically select initial xlation lookup level

Instead of hardcoding a level 1 table as the base translation level
table, let the code decide which level is the most appropriate given
the virtual address space size.

As the table granularity is 4 KB, this allows the code to select
level 0, 1 or 2 as base level for AArch64. This way, instead of
limiting the virtual address space width to 39-31 bits, widths of
48-25 bit can be used.

For AArch32, this change allows the code to select level 1 or 2
as the base translation level table and use virtual address space
width of 32-25 bits.

Also removed some unused definitions related to translation tables.

Fixes ARM-software/tf-issues#362

Change-Id: Ie3bb5d6d1a4730a26700b09827c79f37ca3cdb65

8 years agoRemove looping around `plat_report_exception`
Yatharth Kochar [Wed, 17 Aug 2016 10:10:16 +0000 (11:10 +0100)]
Remove looping around `plat_report_exception`

This patch removes the tight loop that calls `plat_report_exception`
in unhandled exceptions in AArch64 state.
The new behaviour is to call the `plat_report_exception` only
once followed by call to `plat_panic_handler`.
This allows platforms to take platform-specific action when
there is an unhandled exception, instead of always spinning
in a tight loop.

Note: This is a subtle break in behaviour for platforms that
      expect `plat_report_exception` to be continuously executed
      when there is an unhandled exception.

Change-Id: Ie2453804b9b7caf9b010ee73e1a90eeb8384e4e8

8 years agoMerge pull request #687 from sandrine-bailleux-arm/sb/panic-handler
danh-arm [Fri, 19 Aug 2016 14:31:36 +0000 (15:31 +0100)]
Merge pull request #687 from sandrine-bailleux-arm/sb/panic-handler

Add WFI in platform's unexpected error handlers

8 years agoAdd WFI in platform's unexpected error handlers
Sandrine Bailleux [Thu, 18 Aug 2016 08:24:40 +0000 (09:24 +0100)]
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

8 years agoMerge pull request #686 from danh-arm/dh/remove-inv-dcache-after-auth
danh-arm [Thu, 18 Aug 2016 10:38:48 +0000 (11:38 +0100)]
Merge pull request #686 from danh-arm/dh/remove-inv-dcache-after-auth

Remove dcache invalidation after image authentication

8 years agoMerge pull request #678 from soby-mathew/sm/PSCI_AArch32
danh-arm [Thu, 18 Aug 2016 10:38:19 +0000 (11:38 +0100)]
Merge pull request #678 from soby-mathew/sm/PSCI_AArch32

Introduce AArch32 support for PSCI library

8 years agoRemove dcache invalidation after image authentication
Dan Handley [Thu, 28 Jul 2016 13:38:03 +0000 (14:38 +0100)]
Remove dcache invalidation after image authentication

At the end of successful image authentication in load_auth_image(),
the data cache for the virtual address range corresponding to the
image is invalidated (by a call to inv_dcache_range()). The intent
seems to be to ensure the data caches do not contain any sensitive
data used during authentication, which subsequent code can read.
However, this same address range is already flushed (cleaned and
invalidated by a call to flush_dcache_range()) at the end of
load_image(), and the subsequent invalidate has no functional
effect.

This patch removes the redundant call to inv_dcache_range(). It
also moves the flush_dcache_range() call from the end of load_image()
to the end of load_auth_image(), so the image data will remain in
the caches during authentication, improving performance.

This also improves the comments that explain the rationale for
calling flush_dcache_range() after image loading/authentication.

Change-Id: I14f17ad2935075ef6f3d1327361c5088bfb2d284

8 years agoMerge pull request #685 from sandrine-bailleux-arm/sb/base-fvp-7.6
danh-arm [Wed, 17 Aug 2016 15:09:31 +0000 (16:09 +0100)]
Merge pull request #685 from sandrine-bailleux-arm/sb/base-fvp-7.6

Move up to Base FVP version 7.6

8 years agoMerge pull request #683 from dp-arm/dp/fiptool
danh-arm [Wed, 17 Aug 2016 11:55:01 +0000 (12:55 +0100)]
Merge pull request #683 from dp-arm/dp/fiptool

fiptool: Suppress verbose messages during normal build

8 years agoMerge pull request #682 from sudeep-holla/gicv3_ns_intr
danh-arm [Wed, 17 Aug 2016 11:54:38 +0000 (12:54 +0100)]
Merge pull request #682 from sudeep-holla/gicv3_ns_intr

gicv3: disable Group1 NonSecure interrupts during core powerdown

8 years agoMerge pull request #680 from hzhuang1/emmc_cmd23_v2
danh-arm [Wed, 17 Aug 2016 11:54:14 +0000 (12:54 +0100)]
Merge pull request #680 from hzhuang1/emmc_cmd23_v2

emmc: support CMD23

8 years agoMove up to Base FVP version 7.6
Sandrine Bailleux [Tue, 16 Aug 2016 09:58:15 +0000 (10:58 +0100)]
Move up to Base FVP version 7.6

This patch updates the User Guide to move up from version 7.2 to 7.6
of the Base FVP.

Change-Id: I792b2250deb4836266e14b40992ae59a5ab5f729

8 years agofiptool: Suppress verbose messages during normal build
dp-arm [Wed, 10 Aug 2016 12:39:42 +0000 (13:39 +0100)]
fiptool: Suppress verbose messages during normal build

The output is shown only when built with V=1.

Change-Id: I17fef10df6f127f07956a78b478ff3cadba4bd61

8 years agoAArch32: Enable build at top level Makefile for FVP
Soby Mathew [Thu, 5 May 2016 13:33:33 +0000 (14:33 +0100)]
AArch32: Enable build at top level Makefile for FVP

This patch enables the AArch32 build including SP_MIN in the
top level Makefile. The build flag `ARCH` now can specify either
`aarch64`(default) or `aarch32`. Currently only FVP AEM model is
supported for AArch32 build. Another new build flag `AARCH32_SP`
is introduced to specify the AArch32 secure payload to be built.

Change-Id: Ie1198cb9e52d7da1b79b93243338fc3868b08faa

8 years agoMerge pull request #679 from rockchip-linux/support-pwm-for-rk3399
danh-arm [Fri, 12 Aug 2016 11:19:43 +0000 (12:19 +0100)]
Merge pull request #679 from rockchip-linux/support-pwm-for-rk3399

Support pwm for rk3399

8 years agoemmc: support CMD23
Haojian Zhuang [Tue, 2 Aug 2016 12:51:27 +0000 (20:51 +0800)]
emmc: support CMD23

Support CMD23. When CMD23 is used, CMD12 could be avoided.

Two scenarios:
1. CMD17 for single block, CMD18 + CMD12 for multiple blocks.
2. CMD23 + CMD18 for both single block and multiple blocks.

The emmc_init() should initialize whether CMD23 is supported
or not.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
8 years agogicv3: disable Group1 NonSecure interrupts during core powerdown
Sudeep Holla [Thu, 4 Aug 2016 15:14:50 +0000 (16:14 +0100)]
gicv3: disable Group1 NonSecure interrupts during core powerdown

As per the GICv3 specification, to power down a processor using GICv3
and allow automatic power-on if an interrupt must be sent to a processor,
software must set Enable to zero for all interrupt groups(by writing to
GICC_CTLR or ICC_IGRPEN{0,1}_EL1/3 as appropriate.

Also, NonSecure EL1 software may not be aware of the CPU power state
details and fail to choose right states that require quiescing the CPU
interface. So it's preferred that the PSCI implementation handles it as
it is fully aware of the CPU power states.

This patch adds disabling of Group1 NonSecure interrupts during processor
power down along with Group0 and Group1 Secure interrupts so that all the
interrupt groups are handled at once as per specification.

Change-Id: Ib564d773c9c4c41f2ca9471451c030e3de75e641

8 years agorockchip: fix the reset-hold release for rk3399 resume
Caesar Wang [Mon, 8 Aug 2016 23:53:41 +0000 (07:53 +0800)]
rockchip: fix the reset-hold release for rk3399 resume

The pmusgrf reset-hold bits needs to be released, since the
pmusgrf reset-hold bits needs to be held.

Change-Id: Ia1eccc8fba18294f26b4cc07d47bc5e513dd9a1f

8 years agorockchip: fix the power up/dowm cnt for rk3399
Caesar Wang [Tue, 9 Aug 2016 00:15:44 +0000 (08:15 +0800)]
rockchip: fix the power up/dowm cnt for rk3399

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

8 years agorockchip: update to handle PWMs for rk3399
Caesar Wang [Wed, 10 Aug 2016 18:11:45 +0000 (02:11 +0800)]
rockchip: update to handle PWMs for rk3399

This patch updates some things for rk3399, as following:

1) Add the new file to handle the pwm. (e.g. the pwm regulator)
Make sure that good deal with the pwm related things.
Also, remove some pwm setting for pmu.c.

2) Set the plls slow mode and bypass in suspend, and restore them.

Change-Id: I112806700bf433c87763aac23d22fa7e6a7f5264

8 years agoAArch32: Add FVP support for SP_MIN
Soby Mathew [Mon, 11 Jul 2016 13:15:27 +0000 (14:15 +0100)]
AArch32: Add FVP support for SP_MIN

This patch implements the support for SP_MIN in FVP. The SP_MIN platform
APIs are implemented and the required makefile support is added for FVP.

Change-Id: Id50bd6093eccbd5e38894e3fd2b20d5baeac5452

8 years agoAArch32: Add essential ARM platform and FVP support
Soby Mathew [Mon, 11 Jul 2016 13:13:56 +0000 (14:13 +0100)]
AArch32: Add essential ARM platform and FVP support

This patch adds AArch32 support for FVP and implements common platform APIs
like `plat_get_my_stack`, `plat_set_my_stack`, `plat_my_core_cos` for AArch32.
Only Multi Processor(MP) implementations of these functions are considered in
this patch. The ARM Standard platform layer helpers are implemented for
AArch32 and the common makefiles are modified to cater for both AArch64 and
AArch32 builds. Compatibility with the deprecated platform API is not
supported for AArch32.

Change-Id: Iad228400613eec91abf731b49e21a15bcf2833ea

8 years agoAArch32: add a minimal secure payload (SP_MIN)
Soby Mathew [Thu, 5 May 2016 13:32:05 +0000 (14:32 +0100)]
AArch32: add a minimal secure payload (SP_MIN)

This patch adds a minimal AArch32 secure payload SP_MIN. It relies on PSCI
library to initialize the normal world context. It runs in Monitor mode
and uses the runtime service framework to handle SMCs. It is added as
a BL32 component in the Trusted Firmware source tree.

Change-Id: Icc04fa6b242025a769c1f6c7022fde19459c43e9

8 years agoAArch32: Add support to PSCI lib
Soby Mathew [Thu, 5 May 2016 13:11:23 +0000 (14:11 +0100)]
AArch32: Add support to PSCI lib

This patch adds AArch32 support to PSCI library, as follows :

* The `psci_helpers.S` is implemented for AArch32.

* AArch32 version of internal helper function `psci_get_ns_ep_info()` is
  defined.

* The PSCI Library is responsible for the Non Secure context initialization.
  Hence a library interface `psci_prepare_next_non_secure_ctx()` is introduced
  to enable EL3 runtime firmware to initialize the non secure context without
  invoking context management library APIs.

Change-Id: I25595b0cc2dbfdf39dbf7c589b875cba33317b9d

8 years agoAArch32: Add support in TF libraries
Soby Mathew [Thu, 5 May 2016 13:10:46 +0000 (14:10 +0100)]
AArch32: Add support in TF libraries

This patch adds AArch32 support to cpu ops, context management,
per-cpu data and spinlock libraries. The `entrypoint_info`
structure is modified to add support for AArch32 register
arguments. The CPU operations for AEM generic cpu in AArch32
mode is also added.

Change-Id: I1e52e79f498661d8f31f1e7b3a29e222bc7a4483

8 years agoAArch32: Add console driver
Soby Mathew [Thu, 24 Mar 2016 16:52:40 +0000 (16:52 +0000)]
AArch32: Add console driver

This patch adds console drivers including the pl011 driver
for the AArch32 mode.

Change-Id: Ifd22520d370fca3e73dbbf6f2d97d6aee65b67dd

8 years agoAArch32: Enable GIC and TZC support
Soby Mathew [Thu, 5 May 2016 12:59:07 +0000 (13:59 +0100)]
AArch32: Enable GIC and TZC support

This patch modifies GICv3 and TZC drivers to add AArch32 support.
No modifications are required for the GICv2 driver for AArch32 support.
The TZC driver assumes that the secure world is running in Little-Endian
mode to do 64 bit manipulations. Assertions are present to validate the
assumption.

Note: The legacy GICv3 driver is not supported for AArch32.

Change-Id: Id1bc75a9f5dafb9715c9500ca77b4606eb1e2458

8 years agoAArch32: Add SMCC context
Soby Mathew [Thu, 5 May 2016 11:53:53 +0000 (12:53 +0100)]
AArch32: Add SMCC context

This patch defines a SMCC context to save and restore
registers during a SMC call. It also adds appropriate helpers
to save and restore from this context for use by AArch32
secure payload and BL stages.

Change-Id: I64c8d6fe1d6cac22e1f1f39ea1b54ee1b1b72248

8 years agoAArch32: Add API to invoke runtime service handler
Soby Mathew [Thu, 5 May 2016 11:49:09 +0000 (12:49 +0100)]
AArch32: Add API to invoke runtime service handler

This patch adds an API in runtime service framework to
invoke the registered handler corresponding to the SMC function
identifier. This is helpful for AArch32 because the number of
arguments required by the handler is more than registers
available as per AArch32 program calling conventions and
requires the use of stack. Hence this new API will do the
necessary argument setup and invoke the appropriate
handler. Although this API is primarily intended for AArch32,
it can be used for AArch64 as well.

Change-Id: Iefa15947fe5a1df55b0859886e677446a0fd7241