Commit Graph

5164 Commits

Author SHA1 Message Date
Anson Huang cce904024d imx: enable necessary errata for i.mx8qm
NXP's i.MX8QM uses Cortex-A53 r0p4, enable necessary
erratas for it.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-24 11:00:50 +08:00
Anson Huang 218bdbe087 imx: enable necessary errata for i.mx8mq
NXP's i.MX8MQ uses Cortex-A53 r0p4, enable necessary
erratas for it.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-24 11:00:47 +08:00
Varun Wadekar 8ec4562165 Tegra186: remove RELOCATE_TO_BL31_BASE config
This patch removes this unused config option from the Tegra186
platform makefiles.

Change-Id: Idcdf6854332a26599323a247289c2d3ce19f475f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:33:13 -08:00
Varun Wadekar fc5adf7d1b Tegra: memctrl_v2: remove usage of ENABLE_SMMU_DEVICE config
This patch removes the usage of this platform config, as it is always
enabled by all the supported platforms.

Change-Id: Ie7adb641adeb3604b177b6960b797722d60addfa
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:33:11 -08:00
Dilan Lee 3e1923d9cf Tegra: add 'late' platform setup handler
This patch adds a platform setup handler that gets called after
the MMU is enabled. Platforms wanting to make use of this handler
should declare 'plat_late_platform_setup' handler in their platform
files, to override the default weakly defined handler.

Change-Id: Ibc97a2e5a24608ddea856d0bd543a9d5876f604c
Signed-off-by: Dilan Lee <dilee@nvidia.com>
2019-01-23 10:33:08 -08:00
Varun Wadekar dd20f5b3d9 Tegra: spe: shared console for Tegra platforms
There are Tegra platforms which have limited UART ports and so
all the components have to share the console. The SPE helps out
by collecting all the logs in such cases and prints them on the
shared UART port.

This patch adds a driver to communicate with the SPE driver, which
in turn provides the console.

Change-Id: Ie750520b936b8bed0ab1d876f03fc0a3490a85a3
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:33:06 -08:00
Varun Wadekar 4cba698567 Tegra: console driver compilation from platform makefiles
This patch includes the console driver from individual platform
makefiles and removes it from tegra_common.mk. This allows future
platforms to include consoles of their choice.

Change-Id: I7506562bfac78421a80fb6782ac8472fbef6cfb0
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:33:03 -08:00
Varun Wadekar 2ad1bddca9 Tegra: smmu: change exit criteria for context size calculation
Tegra SoCs currently do not have a SMMU register at address 0xFFFFFFFF.
This patch changes the search criteria, to look for this marker, to
calculate the size of the saved context.

Change-Id: I15d91945ecb78267f91c45f37985dbb2327ca3ae
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:33:00 -08:00
Steven Kao c63ec2639a Tegra: memctrl_v2: platform handler for TZDRAM setup
The Tegra memctrl driver sets up the TZDRAM fence during boot and
system suspend exit. This patch provides individual platforms with
handlers to perform custom steps during TZDRAM setup.

Change-Id: Iee094d6ca189c6dd24f1147003c33c99ff3a953b
Signed-off-by: Steven Kao <skao@nvidia.com>
2019-01-23 10:32:57 -08:00
Varun Wadekar 539c62d7b3 Tegra186: save system suspend entry marker to TZDRAM
This patch adds support to save the system suspend entry and exit
markers to TZDRAM to help the trampoline code decide if the current
warmboot is actually an exit from System Suspend.

The Tegra186 platform handler sets the system suspend entry marker
before entering SC7 state and the trampoline flips the state back to
system resume, on exiting SC7.

Change-Id: I29d73f1693c89ebc8d19d7abb1df1e460eb5558e
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:55 -08:00
Varun Wadekar 889c07c7b1 Tegra186: helper functions for CPU rst handler and SMMU ctx offset
This patch adds a helper function to get the SMMU context's offset
and uses another helper function to get the CPU trampoline offset.
These helper functions are used by the System Suspend entry sequence
to save the SMMU context and CPU reset handler to TZDRAM.

Change-Id: I95e2862fe37ccad00fa48ec165c6e4024df01147
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:53 -08:00
Varun Wadekar d7be5e2e3a Tegra: bpmp: return error if BPMP init fails
This patch returns error if BPMP initialization fails. The platform
code marks the cluster as "runnning" since we wont be able to get
it into the low power state without BPMP.

Change-Id: I86f51d478626240bb7b4ccede8907674290c5dc1
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:51 -08:00
Steven Kao 601a8e5495 Tegra: rename secure scratch register macros
This patch renames all the secure scratch registers to reflect their
usage.

This is a list of all the macros being renamed:

- SECURE_SCRATCH_RSV1_* -> SCRATCH_RESET_VECTOR_*
- SECURE_SCRATCH_RSV6 -> SCRATCH_SECURE_BOOTP_FCFG
- SECURE_SCRATCH_RSV11_* -> SCRATCH_SMMU_TABLE_ADDR_*
- SECURE_SCRATCH_RSV53_* -> SCRATCH_BOOT_PARAMS_ADDR_*
- SECURE_SCRATCH_RSV55_* -> SCRATCH_TZDRAM_ADDR_*

NOTE: Future SoCs will have to define these macros to
      keep the drivers functioning.

Change-Id: Ib3ba40dd32e77b92b47825f19c420e6fdfa8b987
Signed-off-by: Steven Kao <skao@nvidia.com>
2019-01-23 10:32:48 -08:00
Varun Wadekar d5bd0de627 Tegra: memctrl_v2: platform handler for TZDRAM settings
The Tegra memctrl driver sets up the TZDRAM fence during boot and
system suspend exit. This patch provides individual platforms with
handlers to perform platform specific steps, e.g. enable encryption,
save base/size to secure scratch registers.

Change-Id: Ifaa2e0eac20b50f77ec734256544c36dd511bd63
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:46 -08:00
Varun Wadekar 7191566c69 Tegra186: secondary: fix MISRA violations for Rules 8.6, 11.1
This patch fixes the following MISRA violations:

Rule 8.6: Externally-linked object or function has "no" definition(s).
Rule 11.1: A cast shall not convert a pointer to a function to
any other type.

Change-Id: Ic1f6fc14c744e54ff782c6987dab9c9430410f5e
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:41 -08:00
Varun Wadekar b6d1757b82 Tegra186: sanity check target cluster during core power on
This patch sanity checks the target cluster value, during core power on,
by comparing it against the maximum number of clusters supported by the
platform.

Reported by: Rohit Khanna <rokhanna@nvidia.com>

Change-Id: Ia73ccf04bd246403de4ffff6e5c99e3b00fb98ca
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:20 -08:00
Anthony Zhou ad67f8c56d Tegra186: setup: Fix MISRA Rule 8.4 violation
MISRA Rule 8.4, A compatible declaration shall be visible when an
object or function with external linkage is defined.

This patch adds static for local array to fix this defect.

Change-Id: I8231448bf1bc0b1e59611d7645ca983b83d5c8e3
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
2019-01-23 10:32:18 -08:00
Varun Wadekar 26e2b93a85 Tegra: bpmp_ipc: IPC driver to communicate with BPMP firmware
This patch adds the driver to communicate with the BPMP firmware on Tegra
SoCs, starting Tegra186. BPMP firmware is responsible for clock enable/
disable requests, module resets among other things.

MRQ is short for Message ReQuest. This is the general purpose, multi channel
messaging protocol that is widely used to communicate with BPMP. This is further
divided into a common high level protocol and a peer-specific low level protocol.
The higher level protocol specifies the peer identification, channel definition
and allocation, message structure, message semantics and message dispatch process
whereas the lower level protocol defines actual message transfer implementation
details. Currently, BPMP supports two lower level protocols - Token Mail Operations
(TMO), IVC Mail Operations (IMO).

This driver implements the IMO protocol. IMO is implemented using the IVC (Inter-VM
Communication) protocol which is a lockless, shared memory messaging queue management
protocol.

The IVC peer is expected to perform the following as part of establishing a connection
with BPMP.

1. Initialize the channels with tegra_ivc_init() or its equivalent.
2. Reset the channel with tegra_ivc_channel_reset. The peer should also ensure that
   BPMP is notified via the doorbell.
3. Poll until the channel connection is established [tegra_ivc_channel_notified() return
   0]. Interrupt BPMP with doorbell each time after tegra_ivc_channel_notified() return
   non zero.

The IPC driver currently supports reseting the GPCDMAand XUSB_PADCTL hardware blocks. In
future, more hardware blocks would be supported.

Change-Id: I52a4bd3a853de6c4fa410904b6614ff1c63df364
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:32:12 -08:00
Varun Wadekar 01da3bd2db Tegra: call 'early_init' handler earlier during boot
This patch calls the 'early_init' handler earlier during boot. This
allows the platforms using Tegra186 onwards to init the BPMP interface
earlier.

Change-Id: I0d540df39de7864ce9051ebe11eca5432c462ebf
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:31:30 -08:00
Anthony Zhou 591054a375 spd: trusty : fix defects flagged by MISRA scan
Main Fixes:

Use int32_t replace int [Rule 4.6]

Added explicit casts (e.g. 0U) to integers in order for them to be
  compatible with whatever operation they're used in [Rule 10.1]

Force operands of an operator to the same type category [Rule 10.4]

Fixed if statement conditional to be essentially boolean [Rule 14.4]

Voided non c-library functions whose return types are not used
[Rule 17.7]

Change-Id: I98caa330c371757eb2dfb9438448cb99115ed907
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
2019-01-23 10:31:28 -08:00
Steven Kao d6306d14bd Tegra: memctrl_v2: allow CPU accesses to TZRAM
This patch enables CPU access configuration register to allow
accesses to the TZRAM aperture on chips after Tegra186.

Change-Id: I0898582f8bd6fd35360ecf8ca5cee21fe35f7aab
Signed-off-by: Steven Kao <skao@nvidia.com>
2019-01-23 10:31:25 -08:00
Anthony Zhou 91196b02a6 Tegra: lib: debug: fix MISRA violation Rule 21.6
MISRA Rule 21.6, The standard library input/output functions
shall not be used.

This patch removes headers that are not really needed.

Change-Id: I746138ce7ee95d7ca985d020f89b2738d997a7a2
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
2019-01-23 10:31:22 -08:00
Harvey Hsieh b886c7c5f4 Tegra: memctrl_v2: pack TZDRAM base to RSVD55_SCRATCH
This patch saves the TZDRAM_BASE value to secure RSVD55
scratch register. The warmboot code uses this register to
restore the settings on exiting System Suspend.

Change-Id: Id76175c2a7d931227589468511365599e2908411
Signed-off-by: Harvey Hsieh <hhsieh@nvidia.com>
2019-01-23 10:31:19 -08:00
Varun Wadekar 7f9d75d236 Tegra: enable -nostdlib flag
This patch enables the '-nostdlib' flag to instruct the compiler
to not use the standard system libraries and startup files.

Change-Id: Ibf34856f7579ed686280cee19c35d08448cf921c
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:31:15 -08:00
Varun Wadekar f8f400d2e5 Tegra186: mce: get the "right" uncore command/response bits
This patch corrects the logic to read the uncore command/response bits
from the command/response values. The previous logic tapped into incorrect
bits leading to garbage counter values.

Change-Id: Ib8327ca3cb3d2086bb268e9a5366865cdf35b493
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:31:13 -08:00
Varun Wadekar f9f620d6ac Tegra186: mce: use udelay() to calculate timeouts
This patch modifies the timeout loop to use udelay() instead of
mdelay(). This helps with the boot time on some platforms which
issue a lot of MCE calls and every mdelay adds up increasing the
boot time by a lot.

Change-Id: Ic50081b73e1cbc2714361235b5c396e294b8f752
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:31:10 -08:00
Anthony Zhou 8dc9278382 Tegra186: fix MISRA Rule 8.3 violation
MISRA Rule 8.3, All declarations of an object or function
shall use the same names and type qualifiers.

This patch removes unused function(s).

Change-Id: I90865c003d46f1dc08bfb5f4fe8a327ea42a2bb7
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
2019-01-23 10:31:08 -08:00
Varun Wadekar e4e97f1db9 Helper function to read ID_AFR0_EL1 system register
This patch provides helper function to read the ID_AFR0_EL1
system register for platforms.

Change-Id: Id5491b18e3bf9f619d98d6cc8efd9d2cf5918c9d
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
2019-01-23 10:31:04 -08:00
Puneet Saxena ab2eb455d6 Tegra: memctrl_v2: platform handlers to program MSS
Introduce platform handlers to program the MSS settings.
This allows the current driver to scale to future chips.

Change-Id: I40a27648a1a3c73b1ce38dafddc1babb6f0b0d9b
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
2019-01-23 10:30:54 -08:00
Sathees Balya 5b8d50e407 plat/arm: Save BL2 descriptors to reserved memory.
On ARM platforms, the BL2 memory can be overlaid by BL31/BL32. The memory
descriptors describing the list of executable images are created in BL2
R/W memory, which could be possibly corrupted later on by BL31/BL32 due
to overlay. This patch creates a reserved location in SRAM for these
descriptors and are copied over by BL2 before handing over to next BL
image.

Also this patch increases the PLAT_ARM_MAX_BL2_SIZE for juno when TBBR
is enabled.

Fixes ARM-Software/tf-issues#626

Change-Id: I755735706fa702024b4032f51ed4895b3687377f
Signed-off-by: Sathees Balya <sathees.balya@arm.com>
2019-01-23 16:01:19 +00:00
Antonio Niño Díaz ae478c26e5
Merge pull request #1768 from bryanodonoghue/integration+linaro_warp7-tbb
Integration+linaro warp7 tbb
2019-01-23 14:46:46 +00:00
Andrew F. Davis b5443284f4 ti: k3: common: Add support for runtime detection of GICR base address
Valid addresses for GICR base are always a set calculable distance from
the GICD and is based on the number of cores a given instance of GICv3 IP
can support. The formula for the number of address bits is given by the
ARM GIC-500 TRM section 3.2 as 2^(18+log2(cores)) with the MSB set to
one for GICR instances. Holes in the GIC address space are also
guaranteed to safely return 0 on reads. This allows us to support runtime
detection of the GICR base address by starting from GIC base address plus
BIT(18) and walking until the GICR ID register (IIDR) is detected. We
stop searching after BIT(20) to prevent searching out into space if
something goes wrong. This can be extended out if we ever have a device
with 16 or more cores.

Signed-off-by: Andrew F. Davis <afd@ti.com>
2019-01-22 13:11:09 -06:00
Antonio Niño Díaz a0d894397d
Merge pull request #1772 from glneo/clear-proxy-queue
TI K3 Clear proxy receive queue on transmit
2019-01-22 15:03:01 +00:00
Antonio Niño Díaz 94764b06fa
Merge pull request #1775 from glneo/uart-baud-rate
ti: k3: common: Allow customizing UART baud rate using build options
2019-01-22 12:51:01 +00:00
Antonio Niño Díaz fcc9ad8928
Merge pull request #1774 from glneo/error-message
ti: k3: drivers: sec_proxy: Switch error messages
2019-01-22 12:50:51 +00:00
Antonio Niño Díaz e92fc0671a
Merge pull request #1771 from glneo/core-shutdown
TI K3 Core shutdown changes
2019-01-22 12:50:39 +00:00
Antonio Niño Díaz 87d6bc1787
Merge pull request #1770 from antonio-nino-diaz-arm/an/spm-mm
Undeprecate MM-based SPM
2019-01-22 10:17:41 +00:00
Antonio Nino Diaz c26bd4270e SPM: Rename folder of SPM based on MM
This implementation is no longer deprecated.

Change-Id: I68552d0fd5ba9f08fad4345e4657e8e3c5362a36
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2019-01-22 09:21:07 +00:00
Antonio Nino Diaz 8855e52ec5 SPM: Rename SPM_DEPRECATED flag to SPM_MM
The SPM implementation based on MM is going to be kept for the
foreseeable future.

Change-Id: I11e96778a4f52a1aa803e7e048d9a7cb24a53954
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
2019-01-22 09:20:59 +00:00
Andreas Dannenberg 50b2f55b69 ti: k3: common: Allow customizing UART baud rate using build options
To accommodate scenarios where we want to use a UART baud rate other than
the default 115,200 allow the associated compiler definition to be set
via the K3_USART_BAUD build option by updating the platform make file.

Since the platform make file now also contains the default value (still
115,200), go ahead and remove the redundant definition from the platform
header file.

Suggested-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
2019-01-21 13:39:51 -06:00
Andrew F. Davis 73522f0087 ti: k3: drivers: ti_sci: Clear receive queue before transmitting
Send and receive currently must be be serialized, any message already in
the receive queue when a new message is to be sent will cause a mismatch
with the expected response from this new message. Clear out all messages
from the response queue before sending a new request.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
2019-01-21 13:33:36 -06:00
Andrew F. Davis 2004552e62 ti: k3: drivers: sec_proxy: Allow clearing a Secure Proxy receive thread
It can be needed to discard all messages in a receive queue. This
can be used during some error recovery situations.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
2019-01-21 13:33:32 -06:00
Andrew F. Davis ca3d3414a8 ti: k3: common: Use shutdown API for PSCI core poweroff
To ensure WFI is reached before the PSC is trigger to power-down
a processor, the shutdonw API must be used.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
2019-01-21 13:07:07 -06:00
Andrew F. Davis 72f418e05f ti: k3: drivers: ti_sci: Add processor shutdown API
This is a pseudo-API command consisting of a wait processor status
command and a set device state command queued back-to-back without
waiting for the System Firmware to ACK either message.

This is needed as the K3 power down specification states the System
Firmware must wait for a processor to be in WFI/WFE before powering
it down. The current implementation of System Firmware does not provide
such a command. Also given that with PSCI the core to be shutdown is the
core that is processing the shutdown request, the core cannot itself wait
for its own WFI/WFE status. To workaround this limitation, we submit
a wait processor status command followed by the actual shutdown command.
The shutdown command will not be processed until the wait command has
finished. In this way we can continue to WFI before the wait command
status has been met or timed-out and the shutdown command is processed.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
2019-01-21 13:07:07 -06:00
Andrew F. Davis 394977e7ef ti: k3: drivers: ti_sci: Add processor status wait API
This TI-SCI API can be used wait for a set of processor status flags to
be set or cleared. The flags are processor type specific. This command
will not return ACK until the specified status is met. NACK will be
returned after the timeout elapses or on error.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
2019-01-21 13:07:07 -06:00
Andrew F. Davis 4f9444cd29 ti: k3: drivers: sec_proxy: Switch error messages
The logic is correct here, but the error messages are
reversed, switch them.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
2019-01-21 12:05:43 -06:00
Antonio Nino Diaz 99d5575a7f Remove reference to DISABLE_PEDANTIC
This flag was removed in 79eb1aff78 ("Remove `DISABLE_PEDANTIC` build
option").

Change-Id: Ic3584a4c5f0100ed9e57b068ec672b0baae8cfab
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2019-01-21 17:17:36 +00:00
Antonio Niño Díaz c40c88f81b
Merge pull request #1764 from vwadekar/tf2.0-tegra-downstream-rebase-1.7.19
Tf2.0 tegra downstream rebase 1.7.19
2019-01-21 14:02:32 +00:00
Antonio Niño Díaz fbf35335ae
Merge pull request #1767 from Yann-lms/updates_stm32mp1
Updates for STM32MP1
2019-01-21 11:37:06 +00:00
Harvey Hsieh 650d9c521e Tegra: memctrl: clean MC INT status before exit to bootloader
This patch cleans the Memory controller's interrupt status
register, before exiting to the non-secure world during
cold boot. This is required as we observed that the MC's
arbitration bit is set before exiting the secure world.

Change-Id: Iacd01994d03b3b9cbd7b8a57fe7ab5b04e607a9f
Signed-off-by: Harvey Hsieh <hhsieh@nvidia.com>
2019-01-18 09:21:51 -08:00