Commit Graph

103 Commits

Author SHA1 Message Date
Julius Werner d5dfdeb65f Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__
NOTE: __ASSEMBLY__ macro is now deprecated in favor of __ASSEMBLER__.

All common C compilers predefine a macro called __ASSEMBLER__ when
preprocessing a .S file. There is no reason for TF-A to define it's own
__ASSEMBLY__ macro for this purpose instead. To unify code with the
export headers (which use __ASSEMBLER__ to avoid one extra dependency),
let's deprecate __ASSEMBLY__ and switch the code base over to the
predefined standard.

Change-Id: Id7d0ec8cf330195da80499c68562b65cb5ab7417
Signed-off-by: Julius Werner <jwerner@chromium.org>
2019-08-01 13:14:12 -07:00
Soby Mathew df7a906f88 Merge changes from topic "jun-add-imx7-pico" into integration
* changes:
  plat: imx7: Add PicoPi iMX7D basic support
  plat: imx7: refactor code for reuse
2019-07-26 09:25:54 +00:00
Jacky Bai 3d660799b4 plat: imx8m: Add basic rdc module init driver
Add the basic support for RDC init/config driver,
this module driver can be enhanced more if necessary.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I290dc378d0d85671435f9de46d5aa790b4e006c8
2019-07-24 09:03:03 +08:00
Jun Nie 936072edbb plat: imx7: Add PicoPi iMX7D basic support
The PicoPi iMX7D is a 2 board development board consisting of
a System-on-Module and a carrier baseboard and optimized for
the Internet-of-Things (IoT).

This patch add basic support to this board.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Louis Mayencourt <louis.mayencourt@arm.com>
Change-Id: I009d85819c4f73b7063aab73d0f6ee74e6ef3fc4
2019-07-17 16:03:20 +08:00
Jun Nie c5937f2d1d plat: imx7: refactor code for reuse
For the iMX7 SOCs, part of the code for platform
setup implementation can be reused and made
common for all these SoCs. This patch extracts
the common part for reuse.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Change-Id: I42fd4167e6903416df96a0159a046abf3896e878
2019-07-17 16:03:20 +08:00
Justin Chadwell dc5baeb3c2 Update imx platform to not rely on undefined overflow behaviour
This consists of ensuring that the left operand of each shift is
unsigned when the operation might overflow into the sign bit.

Change-Id: Ia0a10b4a30e63c0cbf1d0f8dfe5768e0a93ae1c7
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
2019-07-12 09:12:19 +01:00
Jacky Bai 2502709f60 plat: imx8m: Add caam module init on imx8m
CAAM module must be initialized in secure world
before it can be used in non-secure world.

Change-Id: I042893667ddef99d8b6fc3902847d516d8591996
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-07-04 19:59:43 +08:00
Soby Mathew 0d220b3519 Merge changes from topic "banned_api_list" into integration
* changes:
  Fix the License header template in imx_aipstz.c
  docs: Add the list of banned/use with caution APIs
2019-07-01 13:21:23 +00:00
Soby Mathew 2aca35fd9b Fix the License header template in imx_aipstz.c
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I2281b3c1b8a0f2caa751c746b7835f998183e0af
2019-07-01 14:16:27 +01:00
Ambroise Vincent 0821731ac3 warp7: remove old console from makefile
Change-Id: I87818b220568cc34838726b32ddf29ee6cf31ed7
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-06-28 10:52:48 +01:00
Ambroise Vincent 5b6ebeec9c Remove MULTI_CONSOLE_API flag and references to it
The new API becomes the default one.

Change-Id: Ic1d602da3dff4f4ebbcc158b885295c902a24fec
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-06-28 10:52:48 +01:00
Soby Mathew 4d384eb4ed Merge "plat: imx8m: Add the aipstz init to config peripheral access" into integration 2019-05-28 13:18:56 +00:00
Jacky Bai ac166f64e2 plat: imx8m: Add the aipstz init to config peripheral access
AIPSTZ provide access control for all the peripherals connected
to it. In this patch all the perperals are configured accessible
to all the master. it can be customized based the actual use
case.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Change-Id: I5ef5baa1da6906f13a60923d27ede336c61e319a
2019-05-21 21:13:29 +08:00
Leonard Crestez f56afc1f59 imx8: Replace PLAT_IMX8* with automatic PLAT_imx8*
Platform defines are already provided by the build system so let's not
duplicate them.

Change-Id: Icf1ea76c3c3213e27b447c95e2b22b961fa7693e
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-05-20 11:28:51 +03:00
Leonard Crestez 72196cbb66 plat: imx8mq: Implement IMX_SIP_GET_SOC_INFO
The manual documents that 0x3036006c should contains the soc revision
for imx8mq but this always reports A0. Work around this by parsing the
ROM header and checking if OCOTP register 0x40 is stuck at 0xff0055aa.

Determining this inside TF-A makes life easier for OS, see for example
this linux discussion: https://lkml.org/lkml/2019/5/3/465

The soc revision can also be useful inside TF-A itself, for example for
the non-upstream DDR DVFS "busfreq" feature is affected by 8mq erratas.

The clock for OCOTP block can be disabled by OS so only initialize soc
revision once at boot time.

Change-Id: I9ca3f27840229ce8a28b53870e44da29f63c73aa
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-05-20 11:24:54 +03:00
Jacky Bai b05631afdc plat: imx8mq: Remove duplicated linker symbols
Remove duplicated linker symbols, resue the symbols
defined in bl_common.h

Change-Id: I10de450eccc78c09b61a8ae7126bf4f4029fa682
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-05-13 21:55:53 +08:00
Leonard Crestez 950d05f752 plat: imx8m: Implement IMX_SIP_BUILDINFO
The IMX_SIP_BUILDINFO call was implemented for imx8qm and imx8qx but
it's also applicable to imx8m.

This fixes U-Boot not printing commit hash on 8m with upstream TF-A.

Change-Id: Idcfd9729eaaccf329c24e241da325f1f6cd3c880
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
2019-05-09 17:20:43 +03:00
Leonard Crestez 7696880ad4 plat: imx8mq: Only keep IRQ 32 unmasked
Only IRQ 32 (SPI 0) needs to be kept unmasked, not everything divisible
by 32.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Change-Id: I286b925eead89218cfeddd82f53a634f3447d212
2019-05-08 14:23:07 +03:00
Leonard Crestez e1958506ae plat: imx8mq: gpc: Enable all power domain by default
This is similar to imx8mm and allows uboot to run fastboot over USB otg.

There is a different set of power domains on 8mq but same bits covers
all off them.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Change-Id: I1151c2bc2d32b1e02b4db16285b3d30cabc0d64d
2019-05-08 14:23:02 +03:00
Ambroise Vincent 2374ab1799 Mbed TLS: Remove weak heap implementation
The implementation of the heap function plat_get_mbedtls_heap() becomes
mandatory for platforms supporting TRUSTED_BOARD_BOOT.

The shared Mbed TLS heap default weak function implementation is
converted to a helper function get_mbedtls_heap_helper() which can be
used by the platforms for their own function implementation.

Change-Id: Ic8f2994e25e3d9fcd371a21ac459fdcafe07433e
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-04-12 09:52:52 +01:00
Jacky Bai 43c733b1f8 plat: imx8m: remove deprecated code include
The 'drivers/console/aarch64/console.S' is not needed,
so remove it from build to fix the build error when
'ERROR_DEPRECATED'set.

Change-Id: Id047a355f82fd33298b7e2b49eff289d28eb5b56
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-04-08 18:21:45 +08:00
Ambroise Vincent 6e756f6d6d Makefile: remove extra include paths in INCLUDES
Now it is needed to use the full path of the common header files.

Commit 09d40e0e08 ("Sanitise includes across codebase") provides more
information.

Change-Id: Ifedc79d9f664d208ba565f5736612a3edd94c647
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-04-03 15:30:46 +01:00
Ambroise Vincent be3991c0c3 Console: remove deprecated finish_console_register
The old version of the macro is deprecated.

Commit cc5859ca19 ("Multi-console: Deprecate the
`finish_console_register` macro") provides more details.

Change-Id: I3d1cdf6496db7d8e6cfbb5804f508ff46ae7e67e
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-04-03 14:55:18 +01:00
Jacky Bai 179f82a2c6 plat: imx8m: Add the basic support for imx8mm
The i.MX8M Mini is new SOC of the i.MX8M family. it is
focused on delivering the latest and greatest video and
audio experience combining state-of-the-art media-specific
features with high-performance processing while optimized
for lowest power consumption. The i.MX 8M Mini Media Applications
Processor is  14nm FinFET product of the growing i.MX8M family
targeting the consumer & industrial market. It is built in 14LPP
to achieve both high performance and low power consumption
and relies on a powerful fully coherent core complex based on
a quad Cortex-A53 cluster with video and graphics accelerators

this patch add the basic support for i.MX8MM.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-03-13 10:14:59 +08:00
Jacky Bai e8837b0aef plat: imx8m: refactor the code to make it reusable
for the i.MX8M SOCs, part of the code for gpc
and PSCI implementation can be reused and make it
common for all these SoCs. this patch extracts
the common part for reuse.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
2019-03-12 21:21:03 +08:00
Antonio Niño Díaz 22cde67b1f
Merge pull request #1837 from spencercw/master
imx: Configure CAAM job rings master ID for i.MX8MQ
2019-03-04 09:50:59 +00:00
Anson Huang e655fefcea imx: make sure GIC redistributor is awake before initialization
GICR_WAKER.ProcessorSleep can only be set to zero when:
— GICR_WAKER.Sleep bit[0] == 0.
— GICR_WAKER.Quiescent bit[31] == 0.

On some platforms, when system reboot with GIC in sleep
mode but with power ON, such as on NXP's i.MX8QM, Linux
kernel enters suspend but could be requested to reboot,
and GIC is in sleep mode and it is inside a power domain
which is ON in this scenario, when CPU reset, the GIC
driver trys to set CORE's redistributor interface to awake,
with GICR_WAKER.Sleep bit[0] and GICR_WAKER.Quiescent bit[31]
both set, the ProcessorSleep bit[1] will never be clear
and cause system hang.

This patch makes sure GICR_WAKER.Sleep bit[0] and
GICR_WAKER.Quiescent bit[31] are both zeor before clearing
ProcessorSleep bit[1].

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-03-01 14:22:23 +08:00
Chris Spencer 45a95e3908 imx: Configure CAAM job rings master ID for i.MX8MQ
For i.MX8MQ B0 revision the default configuration of JRaMID is not valid
to allow the kernel to use the CAAM job rings. This patch sets the
master ID of the Cortex A in the JRaMID registers.

Signed-off-by: Chris Spencer <christopher.spencer@sea.co.uk>
2019-02-22 14:20:01 +00:00
Ying-Chun Liu (PaulLiu) 70086dc466 imx: warp7: Migrate to MULTI_CONSOLE_API
This commit migrates to MULTI_CONSOLE_API for IMX Warp7 board.
We also rename the functions in imx_uart driver to more specific one.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
2019-02-12 18:56:29 +08:00
Antonio Nino Diaz 5e447816c7 Remove unneeded include paths in PLAT_INCLUDES
Also, update platform_def.h guidelines about includes in the porting
guide.

Change-Id: I1ae338c9dd3242b309f6d53687ba2cb755d488c3
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2019-02-01 12:24:57 +00:00
Anson Huang e6cf7a468e imx: power optimization for i.mx8qx
Current implementation of i.MX8QX power management related
features does NOT optimize power number, all system resources
like CCI, DDR, and A cluster etc. are kept in STBY mode (powered
ON) when system suspend or CPU hotplug.

To lower the power number, OFF mode should be adopted for those
system resources whenever they can be OFF, A cluster will be OFF
if the CPUs in the cluster are all off line, DDR/MU/DB can be OFF
if system suspend, IRQ steer can be OFF if the wakeup source is
belonged to system controller partition, so wakeup source runtime
check is used to determine if IRQ steer can be OFF before system
suspend.

If resources are powered off for suspend, they should be restored
properly after system resume.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-29 09:26:41 +08:00
Anson Huang 3a2b51993d imx: power optimization for i.mx8qm
Current implementation of i.MX8QM power management related
features does NOT optimize power number, all system resources
like CCI, DDR, and A cluster etc. are kept in STBY mode (powered
ON) when system suspend or CPU hotplug.

To lower the power number, OFF mode should be adopted for those
system resources whenever they can be OFF, A cluster will be OFF
if the CPUs in the cluster are all off line, DDR/MU/DB can be OFF
if system suspend, IRQ steer can be OFF if the wakeup source is
belonged to system controller partition, so wakeup source runtime
check is used to determine if IRQ steer can be OFF before system
suspend.

If resources are powered off for suspend, they should be restored
properly after system resume.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-29 09:26:41 +08:00
Antonio Niño Díaz 72106f823c
Merge pull request #1766 from Anson-Huang/master
Add more SIP runtime service for i.MX8
2019-01-25 10:29:52 +00:00
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
Bryan O'Donoghue a41d81cdb1 warp7: Enable Trusted Board Boot for WaRP7
This patch enables Trusted Board Boot for warp7. A subsequent patch
contains build/run instructions.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Jun Nie <jun.nie@linaro.org>
2019-01-18 16:10:55 +00:00
Bryan O'Donoghue e483639ad2 warp7: Define DTB overlay address in memory map
This patch defines the expected DTB overlay address in the memory map for
this platform. Its important that all points in the boot process agree on
this memory map even if not all elements utilize it.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
2019-01-18 14:24:09 +00:00
Bryan O'Donoghue c2f31c99fe warp7: io_storage: Remove DTB from FIP
Recently upstreamed changes to OP-TEE mean that it is possible for OP-TEE
to provide a DTB overlay directly to subsequent boot stages thus negating
the requirement to bundle a DTB in the FIP.

This patch switches off the dependency on the DTB in the FIP descriptor
instead we will provide the necessary data as an overlay from OP-TEE.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
2019-01-18 14:24:09 +00:00
Anson Huang 760f794105 imx: add i.MX8 SoCs build info SIP(silicon provider) service support
This patch adds NXP i.MX8 SoCs' build info SIP support for easy debug.
With this function enabled, TF-A's commit hash can be showed in u-boot
debug console when booting up, when there is any issue which could be
related to TF-A, users can use the commit hash value to easily identify
which commit introduces the issue.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-18 11:23:04 +08:00
Anson Huang 869eebc39d imx: add i.MX8 SoCs thermal alarm SIP(silicon provider) service support
For NXP's i.MX8 SoCs with system controller inside, thermal sensors
are maintained by SCFW, Linux needs to call SMC to trap to TF-A for
thermal alarm operation etc. by calling SCFW API.

This patch adds temperature alarm SIP service support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-18 11:23:04 +08:00
Anson Huang dbfa45e816 imx: add i.MX8 SoCs OTP SIP(silicon provider) service support
For NXP's i.MX8 SoCs with system controller inside, OTP is
maintained by SCFW, Linux needs to call SMC to trap to TF-A
for OTP read/write etc. operations by calling SCFW API.

This patch adds OTP SIP service support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-18 11:23:00 +08:00
Anson Huang 936840f143 imx: support for i.MX8 SoCs misc IPC
NXP's i.MX8 SoCs have system controller (M4 core) which takes
control of misc functions like temperature alarm, dma etc., other
Cortex-A clusters can send out command via MU (Message Unit) to
system controller for misc operation etc..

This patch adds misc IPC(inter-processor communication) support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-18 10:59:20 +08:00
Anson Huang ebdbc25b4c imx: add wakeup source SIP runtime service support
On i.MX8QM/i.MX8QX with system controller inside, the wakeup
source is managed in SCFW(system controller firmware), if the
wakeup source is belonged to system controller partition, then
before Linux suspend, the wakeup source should be set to
SC_PM_WAKE_SRC_SCU, and if the wakeup source is belonged to
Cortex-A partition, the wakeup source should be set to
SC_PM_WAKE_SRC_IRQSTEER, so need to add wakeup source SIP runtime
service to get Linux kernel's wakeup source and set the correct
wakeup source for system controller.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-18 10:29:22 +08:00
Anson Huang d3996c590d imx: add cpu-freq SIP runtime service support
On i.MX8QM/i.MX8QX with system controller inside, the CPU's clock
rate is managed by SCFW(system controller firmware) and can ONLY be
changed from secure world, so SIP runtime service is needed for
setting CPU's clock rate, this patch adds cpu-freq SIP runtime service
support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-17 10:49:48 +08:00
Anson Huang 025514ba80 imx: add imx8qm/imx8qx SRTC SIP runtime service support
On i.MX8QM/i.MX8QX with system controller inside, the SRTC is
managed by SCFW(system controller firmware) and some functions
like setting SRTC's time etc. can ONLY be requested from secure
world, so SIP runtime service is needed for such kind of operations,
this patch adds SRTC SIP runtime service support for i.MX8QM and
i.MX8QX.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-17 10:49:48 +08:00
Anson Huang 1552df5d25 Support for NXP's i.MX8 SoCs timer IPC
NXP's i.MX8 SoCs have system controller (M4 core) which takes
control of timer management, including watchdog, srtc and system
counter etc., other clusters like Cortex-A35 can send out command
via MU (Message Unit) to system controller for timer operation.

This patch adds timer IPC(inter-processor communication) support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-17 10:49:48 +08:00
Anson Huang 2e8ab4f538 imx: make imx uart work for debug mode
With DEBUG_CONSOLE enabled, build will fail for imx8mq platform:

./build/imx8mq/release/bl31/imx8mq_bl31_setup.o:
In function `bl31_early_platform_setup2':
imx8mq_bl31_setup.c:(.text.bl31_early_platform_setup2+0x40):
	undefined reference to `console_uart_register'
Makefile:741: recipe for target 'build/imx8mq/release/bl31/bl31.elf' failed
make: *** [build/imx8mq/release/bl31/bl31.elf] Error 1

Besides, the .console_flush callback needs to be added to avoid
panic when debug mode is enabled, since the console_flush() will
call it without checking whether the function callback is valid.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-15 14:32:31 +08:00
Anson Huang f1ac79642e imx: add necessary lpuart console_flush callback for debug
Current lpuart driver does NOT implement .console_flush callback,
if debug console is enabled, the console_flush() will call the
undefined .console_flush callback(NULL) for lpuart and leak to
panic, this patch adds .console_flush callback to make lpuart work
for debug mode.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-01-15 13:58:59 +08:00
Antonio Nino Diaz 09d40e0e08 Sanitise includes across codebase
Enforce full include path for includes. Deprecate old paths.

The following folders inside include/lib have been left unchanged:

- include/lib/cpus/${ARCH}
- include/lib/el3_runtime/${ARCH}

The reason for this change is that having a global namespace for
includes isn't a good idea. It defeats one of the advantages of having
folders and it introduces problems that are sometimes subtle (because
you may not know the header you are actually including if there are two
of them).

For example, this patch had to be created because two headers were
called the same way: e0ea0928d5 ("Fix gpio includes of mt8173 platform
to avoid collision."). More recently, this patch has had similar
problems: 46f9b2c3a2 ("drivers: add tzc380 support").

This problem was introduced in commit 4ecca33988 ("Move include and
source files to logical locations"). At that time, there weren't too
many headers so it wasn't a real issue. However, time has shown that
this creates problems.

Platforms that want to preserve the way they include headers may add the
removed paths to PLAT_INCLUDES, but this is discouraged.

Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2019-01-04 10:43:17 +00:00
Yann Gautier b7c6529c41 io_block: define MAX_IO_BLOCK_DEVICES as unsigned
This is used as a table index, and already compared with an unsigned int:
block_dev_count.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
2018-12-10 18:09:49 +01:00