Commit Graph

47 Commits

Author SHA1 Message Date
Jiafei Pan 5161cfde9b fix(layerscape): fix coverity issue
Check return value of mmap_add_dynamic_region().

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I84e257b3052371e18af158c3254f42a1bae0da10
2022-03-30 10:38:22 +08:00
Jiafei Pan 9df5ba05b4 feat(ls1088a): add new SoC platform ls1088a
LS1088A is a cost-effective, powerefficient, and highly integrated
SoC device featuring eight extremely power-efficient 64-bit ARM
Cortex-A53 cores with ECC-protected L1 and L2 cache memories for
high reliability, running up to 1.6 GHz.

This patch is to add ls1088a SoC support in TF-A.

Signed-off-by: Ruchika Gupta <ruchika.gupta@nxp.com>
Signed-off-by: rocket <rod.dorris@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Id9ebcdad1beab07ea81a41955edd4f471d6cf090
2022-03-27 23:24:24 +08:00
Biwen Li ceae374357 refactor(layerscape): refine comparison of inerconnection
Refine the code to be compatible with new CCN504 which is used
by ls2088a.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I2e2b3bbb9392862b04bf8a89dfb9575bf4be974a
2022-03-27 23:24:24 +08:00
Jiafei Pan 602cf53b6f feat(layerscape): add soc helper macro definition for chassis 3
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I27b3a1f597de84dc2a007798e54eb919c877281a
2022-03-27 23:24:24 +08:00
Biwen Li 9550ce9ddd feat(layerscape): add CHASSIS 3 support for tbbr
Support CHASSIS 3.0(such as SoC LS1088A).

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I60843bc4d604f0de1d91c6d3ad5eb4921cdcc91a
2022-03-27 23:24:24 +08:00
Jiafei Pan 0d396d6455 feat(layerscape): define more chassis 3 hardware address
Add base address definiton for Chassis 3 platforms.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I6041b93c9e9bb49af60743bd277ac7cc6f1b9da8
2022-03-27 23:24:24 +08:00
Jiafei Pan 3412716b30 feat(layerscape): print DDR errata information
Print Errata information in debug mode.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I70d6baa4dc3ffd79fedbc827555268d8f06605c7
2022-03-27 23:24:24 +08:00
Pankit Garg 291adf521a feat(nxp-ddr): add workaround for errata A050958
Set the receiver gain to max value to recover
cold temp marginality issue for phy-gen2

Signed-off-by: Pankit Garg <pankit.garg@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: If639fa3ed404cf6e1b8abcc2b7137db1fdd0b2c2
2022-03-27 23:24:24 +08:00
Jiafei Pan 85bd092943 feat(layerscape): add new soc errata a010539 support
Add new soc errata a010539 support.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Idbd8caaac12da8ab4f39dc0019cb656bcf4f3401
2022-03-27 23:24:24 +08:00
Jiafei Pan 785ee93cc3 feat(layerscape): add new soc errata a009660 support
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Ice37155d971dec5c610026043e34b64f761fc1b7
2022-03-27 23:24:24 +08:00
Biwen Li e2818d0afc fix(layerscape): fix build issue of mmap_add_ddr_region_dynamically
Fix build issue of mmap_add_ddr_region_dynamically():
ls_bl2_el3_setup.c:(.text.bl2_plat_preload_setup+0x28): undefined
reference to mmap_add_ddr_region_dynamically

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I74a8b4c2337fc0646d6acb16ce61755c5efbdf38
2022-03-27 23:24:24 +08:00
Wasim Khan 72feaad980 fix(layerscape): update WA for Errata A-050426
Update WA for Errata A-050426 as Commands for
PEX (PEX1..PEX6) , lnx1_e1000#0, lnx1_xfi and
lnx2_xfi has been moved to PBI phase.

This patch requires RCW to include PBI commands
to write commands in BIST mode for PEX, lnx1_e1000,
lnx1_xfi and lnx2_xfi IP blocks.

Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
Change-Id: I27c2b055c82c0b58df83449f9082bfbfdeb65115
2022-03-17 07:08:42 +01:00
Jiafei Pan 3ccd7e45a2 fix(nxp/common/setup): increase soc name maximum length
Increate SoC name length as it is not enough for some
SoC personalities.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I2142b4b5162dd3c9ab3afefcdc859063836d8bcc
2022-01-20 23:38:03 +08:00
Jiafei Pan 3d14a30b88 feat(nxp/common/errata): add SoC erratum a008850
Add SoC erratum a008850 support.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I1ef41c67737b7b5fdf1d892929a2d8040effc282
2022-01-20 23:38:03 +08:00
Jiafei Pan b759727f59 feat(nxp/common/io): add ifc nor and nand as io devices
Added IFC Nor and NAN flash as boot IO devices.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Ie1b87174d9c08d4e32138066b007fef6f8e3c5dd
2022-01-20 23:38:03 +08:00
Jiafei Pan d374060abe feat(nxp/common/rcpm): add RCPM2 registers definition
Added some RCPM2 register offset definiton for register: IPSTPCR,
IPSTPACKR and POWMGTDCR, also added OVRD bit definiton of register
POWMGTDCR.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I301bc1401e053c2089b5eb3672c6e649c805a2ab
2022-01-19 11:36:23 +08:00
Jiafei Pan 0259a3e828 fix(nxp/common/setup): fix total dram size checking
total_dram_size should be signed value because it is equal to return
value of init_ddr(), so if it is lower or equal zero, report
error as DDR is not initialized correctly.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Idbc40da103f60f10cb18c5306e97b764c1a9d372
2022-01-19 11:36:23 +08:00
Jiafei Pan 3ccc8ac3e5 feat(nxp/common): add CORTEX A53 helper functions
Add helper function to disable the load-store prefetch.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I36d7be37e0b800ab1e5842a56cfd04d779338868
2022-01-19 11:36:23 +08:00
Scott Branden 4ce3e99a33 fix: libc: use long for 64-bit types on aarch64
Use long instead of long long on aarch64 for 64_t stdint types.
Introduce inttypes.h to properly support printf format specifiers for
fixed width types for such change.

Change-Id: I0bca594687a996fde0a9702d7a383055b99f10a1
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
2021-11-08 14:41:17 +00:00
Jiafei Pan 10b1e13bd2 feat(nxp/common/ocram): add driver for OCRAM initialization
In order to enable OCRAM ECC, it need to be initialized
with 64-bit writes and then a write performed to address
0x0010_0534 with the value 0x0000_0008.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Id7d4f5df65ca52f24e9251c08a75ad2006451b95
2021-10-09 10:57:54 +02:00
Jiafei Pan 8bfb16813a feat(plat/nxp/common): add EESR register definition
Add OCRAM bit mask to be used in OCRAM driver.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: If82542cc6c1c243d8f998b193954dd72312ee1a4
2021-10-09 10:57:46 +02:00
Jiafei Pan 4225ce8b87 feat(plat/nxp/common): define default SD buffer
Define default SD buffer address and size in DRAM.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I5872d95b0c1114e05f0e145756e9a6ef39b2fd9a
2021-09-15 11:28:47 +08:00
Jiafei Pan 66f7884b52 feat(plat/nxp/common): add SecMon register definition for ch_3_2
Add SecMon register definition for ch_3_2.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I80d134ea4e94ad234e1a8fbd02798d5fd86d2544
2021-09-15 11:19:36 +08:00
Jiafei Pan 3a2cc2e262 feat(plat/nxp/common/psci): define CPUECTLR_TIMER_2TICKS
Define CPUECTLR_TIMER_2TICKS.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Iecb5ede82939e8502d2f1bc74ec3bfe2a00be65c
2021-09-15 11:19:36 +08:00
Jiafei Pan a204785322 feat(plat/nxp/common): define default PSCI features if not defined
SoC code can define supported features, otherwise use default setting.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I0f11498c1f7558ff0ec2d9b344f3f7a4f5489ced
2021-09-15 11:19:36 +08:00
Jiafei Pan 35efe7a4ce feat(plat/nxp/common): define common macro for ARM registers
Define common register macro both for Cortex-A53 and Cortex-A72
because the code will be used by both Cortex platform.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I485661bfe3ed4f214c403ff6af53dc6af1ddf089
2021-09-15 11:19:36 +08:00
Jiafei Pan 6cad59c429 feat(plat/nxp/common): add CCI and EPU address definition
Add CCI and EPU base address definiton for Chassis v3.2.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I13250555b6646c1e7ba2e9d7c9efca8501f17b3a
2021-09-15 11:19:36 +08:00
Jiafei Pan 08695df91d refactor(plat/nxp): refine api to read SVR register
1. Refined struct soc_info_t definition.
2. Refined get_soc_info function.
3. Fixed some SVR persernality value.
4. Refined API to get cluster numbers and cores per cluster.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I3c20611a523516cc63330dce4c925e6cda1e93c4
2021-08-26 10:08:57 +08:00
Jiafei Pan 1ca7229529 refactor(plat/nxp): each errata use a seperate source file
Don't mix erratas together in one file.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Ib1671011b91a41b0653210e4706d62b7e946c642
2021-08-25 09:53:20 +08:00
Jiafei Pan 9616db154b refactor(plat/nxp): use a unified errata api
Use a unfied API soc_errata() for each platforms,
add print a INFO message for each enabled errata,
so that it will be easy to check which errata is
enabled on current platform.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I5eab3f338db6b46c57cbad475819043fc60ca6d3
2021-08-25 09:53:20 +08:00
Jiafei Pan 64cadc1637 refactor(plat/soc-lx2160): move errata to common directory
Will add more Erratas, some errata can be used for multiple
platforms, so move errata to be common code which can
be share between different platforms.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Ib149b3eac365bdb593331e9f38f0b89d92c9c0d1
2021-08-25 09:53:20 +08:00
Jiafei Pan cd1280ea2e feat(plat/nxp/common): add build macro for BOOT_MODE validation checking
1. Added the build macro "add_boot_mode_define".
2. Use the macro to validate current BOOT_MODE against the
   pre-determined list of SUPPORTED_BOOT_MODE, so each platform
   need to define the list: SUPPORTED_BOOT_MODE.
3. Reports error if BOOT_MODE is not in SUPPORTED_BOOT_MODE list,
   or BOOT_MODE is not supported yet althoug it is in SUPPORTED_BOOT_MODE.

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I29be60ecdb19fbec1cd162e327cdfb30ba629b07
2021-06-15 17:43:04 +08:00
Jiafei Pan 9398841e21 refactor(plat/nxp/common): moved soc make-variables to new soc_common_def.mk
Move some soc make variables to new soc_common_def.mk,
then it can be reused by other platforms.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: Ia30bd332c95b6475f1cfee2f03a8ed3892a9568d
2021-06-15 17:43:04 +08:00
Jiafei Pan 5d5c3ff3f7 refactor(plat/nxp/common): moved plat make-variables to new plat_common_def.mk
Move some common make variables to new plat_common_def.mk,
then it can be reused by other platforms.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Change-Id: I37bd65b0f8124f63074fa03339f886c2cdb30bd3
2021-06-15 17:43:04 +08:00
Pankaj Gupta dc05e50b8d nxp: deflt hdr files for soc & their platforms
- Default header files for:
  -- plat/nxp/soc-lxxxx/include/soc.h uses:
	--- soc_default_base_addr.h
        --- soc_default_base_macros.h

  -- plat/nxp/soc-lxxxx/<$PLAT>/platform_def.h uses:
	--- plat_default_def.h: Every macro define can be overidden.

  -- include/common/tbbr/tbbr_img_def.h uses:
	--- plat_tbbr_img_def.h: platform specific new FIP image macros.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: Ic50003e27e87891be3cd18bdb4e14a1c7272d492
2021-03-24 09:49:32 +05:30
Pankaj Gupta b53c2c5f2d nxp: platform files for bl2 and bl31 setup
For NXP platforms:
- Setup files for BL2 and BL31
- Other supporting files.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: I36a1183a0652701bdede9e02d41eb976accbb017
2021-03-24 09:49:32 +05:30
Pankaj Gupta 0f33f50e21 nxp: warm reset support to retain ddr content
NXP: Added warm reset handler to handle SMC PSCI_SYSTEM_RESET2
raised from kernel (> 5.4).

As part of first cold boot, DDR training data is stored in NV storage.

As part of this SMC handling, following things are done:
- DDR is put in self-refresh mode to retain the content of DDR.
- Reset cause is saved.
- Reset is triggered.

On next boot to last warm-reset, DDR training is restored from
the NV storage.

Signed-off-by: Ashish Kumar <ashish.kumar@nxp.com>
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: I8e4fb0824887af49e959c93825e2ab0ba887fc9d
2021-03-24 09:49:32 +05:30
Pankaj Gupta 7c2d17792d nxp: nv storage api on platforms
NV storage API(s) for NXP platforms, supported on:
- flexspi-nor
- SecMon - General Purpose Registers at Low-Power section,
           retains their content if backed by coined battery.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: Id65dee4f28e7d6d2024407030039de33ebe0fa05
2021-03-24 09:49:32 +05:30
Pankaj Gupta 99cd54f312 nxp: supports two mode of trusted board boot
NXP SoC supports two TBB mode:
- MBED_TLS based
  -- ROTK key hash is placed as part of the BL2 binary at section:
     --- .rodata.nxp_rotpk_hash
  -- Supporting non-volatile counter via SFP.
     -- platform function used by TFA common authentication code.

- NXP CSF based
  -- ROTK key deployment vary from MBEDTLS

Signed-off-by: Ruchika Gupta <ruchika.gupta@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: Ib0f0bf024fd93de906c5d4f609383ae9e02b2fbc
2021-03-24 09:49:32 +05:30
Pankaj Gupta 6df5c0c9f3 nxp: fip-handler for additional fip_fuse.bin
All of the NXP SoC, needs fip_fuse image to be
loaded additionally as part of preparation for Trusted board boot
- fip_fuse.bin contains an image for auto fuse provisioning.
- Auto fuse provisioning is based on the input file with values for:
  -- SRK Hash
  -- OTPMK
  -- misc. refer board manual for more details.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: I26d4024fefe352d967ca120191f784f1f47aa9d1
2021-03-24 09:49:32 +05:30
Pankaj Gupta 34d4835650 nxp: fip-handler for additional ddr-fip.bin
Few of the NXP SoC like LX2160A, needs ddr-phy images to be
loaded additionally before DDR initialization
- fip_ddr.bin is created containing upto 6 ddr images.
- With TRUSTED_BOARD_BOOT = 1, fip_ddr.bin is authenticated
  first before loading and starting DDR initialization.
- To successfully compile this image, platform-defined header files
needs to be defined:
  -- include/common/tbbr/tbbr_img_def.h uses:
	--- plat_tbbr_img_def.h: platform specific new FIP image macros.

  -- include/tools/share/firmware_image_package.h uses:
	--- plat_def_fip_uuid.h: platform specific new UUID macros.
	    ---- Added UUID for DDR images to create FIP-DDR.
	    ---- Added UUID for FUSE provisioning images to create FIP-fuse.

  -- include/tools/share/tbbr_oid.h uses:
	--- platform_oid.h: platform specific new OID  macros.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: Icbcf1673a8c398aae98680b5016f4276b4864b91
2021-03-24 09:49:32 +05:30
Pankaj Gupta ed7cf3bff0 nxp: image loader for loading fip image
function load_img(), is dependent on:
- Recursively calling load_image() defined in common/bl_common.c
- for each image in the fip.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: I57ca4b666cd1b0b992b7c0fc2a4260b558c0e2a9
2021-03-24 09:49:32 +05:30
Pankaj Gupta c2d621db58 nxp: svp & sip smc handling
SMC call handling at EL3 due SIP and SVC calls.

Signed-off-by: rocket <rod.dorris@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: If86ee43477fc3b6116623928a3299d4e9015df8c
2021-03-24 09:49:32 +05:30
Pankaj Gupta dd4268a2db nxp: psci platform functions used by lib/psci
Signed-off-by: rocket <rod.dorris@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: I9853263ed38fb2a9f04b9dc7d768942e32074719
2021-03-24 09:49:32 +05:30
Pankaj Gupta 044ddf9ea3 nxp: helper function used by plat & common code
Signed-off-by: rocket <rod.dorris@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: Idafd8b0d94edf3515e8317431274d77289b7a1d0
2021-03-24 09:49:32 +05:30
Pankaj Gupta bdfad087d9 nxp: add data handler used by bl31
bl31-data file written in assembly helps to manage data at bl31.

Signed-off-by: rocket <rod.dorris@nxp.com>
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: Ic3ace03364648cc1174bb05b5b334b9ccdaaa4ed
2021-03-24 09:49:32 +05:30
Pankaj Gupta b749ae3d3e nxp: added the makefile helper macros
NXP specifc macro SET_NXP_MAKE_FLAG is added.

NXP has pool of multiple IPs. This macro helps:
- In soc.mk, this macro help the selected IP source files to be included
  for that SoC.
  -- The set of IPs required for one NXP SoC is different to the set of IPs
     required by another NXP SoC.

- For the same SoC,
  -- For one feature, the IP may be required in both BL2 and BL31.
  -- Without the above feature, that IP may be required in one.
     This macro help in selecting the inclusion of source and header files to:
     --- BL2 only
     --- BL31 only
     --- COMM (used by BL2 and BL31)

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Change-Id: I2cdb13b89aa815fc5219cf8bfb9666d0a9f78765
2021-02-12 17:20:24 +05:30