Commit Graph

6220 Commits

Author SHA1 Message Date
Samuel Holland fb23b104c0 allwinner: h6: power: Switch to using the AXP driver
Chip ID checking and poweroff work just like they did before.
Regulators are now enabled just like on A64/H5.

This changes the signatures of the low-level register read/write
functions to match the interface expected by the common driver.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I14d63d171a094fa1375904928270fa3e21761646
2019-12-13 19:22:34 -06:00
Samuel Holland f6d9c4cafa drivers: allwinner: axp: Add AXP805 support
This adds the new regulator list, as well as changes to make the switch
(equivalent to DC1SW on the AXP803) work on both PMICs.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I9a1eac8ddfc54b27096c10a8eebdd51aaf9b8311
2019-12-13 19:22:34 -06:00
Samuel Holland 0bc752c9ad allwinner: Convert AXP803 regulator setup code into a driver
Previously, the A64/H5 and H6 platforms' PMIC setup code was entirely
independent. However, some H6 boards also need early regulator setup.

Most of the register interface and all of the device tree traversal code
can be reused between the AXP803 and AXP805. The main difference is the
hardware bus interface, so that part is left to the platforms. The
remainder is moved into a driver.

I factored out the bits that were obviously specific to the AXP803;
additional changes for compatibility with other PMICs can be made as
needed.

The only functional change is that rsb_init() now checks the PMIC's chip
ID register against the expected value. This was already being done in
the H6 version of the code.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Icdcf9edd6565f78cccc503922405129ac27e08a2
2019-12-13 19:22:34 -06:00
Samuel Holland 79b8546507 allwinner: a64: power: Use fdt_for_each_subnode
This simplifies the code a bit. Verified to produce the same binary.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Ie1ec1ce2ea39c46525840906826c90a8a7eff287
2019-12-13 19:20:36 -06:00
Samuel Holland 494c823361 allwinner: a64: power: Remove obsolete register check
As of a561e41bf1 ("allwinner: power: add enable switches for DCDC1/5")
there are no longer regulators without an enable register provided.
Since it seems reasonable that this will continue to be the case, drop
the check.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Icd7ec26fc6450d053e6e6d855fc16229b1d65a39
2019-12-13 19:20:36 -06:00
Samuel Holland 3bea03e7b4 allwinner: a64: power: Remove duplicate DT check
should_enable_regulator() is already checked in the regulators subnode
loop before setup_regulator() is called, so there's no need to check it
again here.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Idb8b8a6e435246f4fb226bc84813449d80a0a977
2019-12-13 19:20:36 -06:00
Samuel Holland 18fbfefbbb allwinner: Build PMIC bus drivers only in BL31
These are used by the PMIC setup code, which runs during BL31
initialization, and the PSCI shutdown code, also a part of BL31.
They can't be needed before BL31, or it wouldn't be possible to boot.
Allwinner platforms don't generally build anything but BL31 anyway, but
this change improves clarity and consistency with allwinner-common.mk.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I24f1d9ca8b4256e44badf5218d04d8690082babf
2019-12-13 19:20:36 -06:00
Samuel Holland df77a95451 allwinner: a64: power: Make sunxi_turn_off_soc static
The function is only used in this file, and it doesn't make sense for it
to be used anywhere else.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Iab18f082911edcdbc37ceeaff8c512be68e0cb0f
2019-12-13 19:20:36 -06:00
Samuel Holland 818e67324b allwinner: Merge duplicate code in sunxi_power_down
The action of last resort isn't going to change between SoCs. This moves
that code back to the PSCI implementation, where it more obviously
matches the code in sunxi_system_reset().

The two error messages say essentially the same thing anyway.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I62ac35fdb5ed78a016e9b18281416f1dcea38a4a
2019-12-13 19:20:36 -06:00
Samuel Holland 4538c4983b allwinner: Clean up PMIC-related error handling
- Check the return value from sunxi_init_platform_r_twi().
- Print the PMIC banner before doing anything that might fail.
- Remove double prefixes in error messages.
- Consistently omit the trailing period.
- No need to print the unknown SoC's ID, since we already did that
  earlier in bl31_platform_setup().
- On the other hand, do print the ID of the unknown PMIC.
- Try to keep the messages concise, as the large string size in these
  files was causing the firmware to spill into the next page.
- Downgrade the banner from NOTICE to INFO. It's purely informational,
  and people should be using debug builds on untested hardware anyway.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Ib909408a5fdaebe05470fbce48d245dd0bf040eb
2019-12-13 19:20:36 -06:00
Samuel Holland c0e109f2fe allwinner: Synchronize PMIC enumerations
Ensure that the default (zero) value represents the case where we take
no action. Previously, if a PLAT=sun50i_a64 build was booted on an
unknown SoC ID, it would be treated as an H5 at shutdown.

This removes some duplicate code and fixes error propagation on H6.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I4e51d8a43a56eccb0d8088593cb9908e52e782bc
2019-12-13 19:20:36 -06:00
Samuel Holland eb75518d98 allwinner: Enable clock before resetting I2C/RSB
The clock must be running for the module to be reset.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Ic8fafc946f3a1a697174b91288e357ffa033ab9a
2019-12-13 19:20:36 -06:00
Soby Mathew 1a433965af Merge "allwinner: Fix incorrect ARISC code patch offset check" into integration 2019-12-13 17:20:04 +00:00
Olivier Deprez 2bcc672f34 Merge changes from topic "aa/sel2_support" into integration
* changes:
  S-EL2 Support: Check for AArch64
  Add support for enabling S-EL2
2019-12-13 16:26:32 +00:00
Sandrine Bailleux 49c71a36c1 Merge "allwinner: power: Add DLDO4 power rail" into integration 2019-12-13 08:47:28 +00:00
Sandrine Bailleux a47f60f609 Merge "intel: s10: Remove unused source code" into integration 2019-12-13 07:20:50 +00:00
Sandrine Bailleux 4987435196 Merge changes from topic "enable-tegra194-compilation" into integration
* changes:
  docs: tegra: add support for Tegra194 class of SoCs
  Tegra194: smmu: add support for backup multiple smmu regs
  Tegra194: introduce tegra_mc_def.h
  Tegra194: 40-bit wide memory address space
  Tegra194: psci: rename 'percpu_data' variable
2019-12-12 14:32:42 +00:00
Soby Mathew 7999904074 Merge "PIE: make call to GDT relocation fixup generalized" into integration 2019-12-12 14:25:47 +00:00
Manish Pandey da90359b78 PIE: make call to GDT relocation fixup generalized
When a Firmware is complied as Position Independent Executable it needs
to request GDT fixup by passing size of the memory region to
el3_entrypoint_common macro.
The Global descriptor table fixup will be done early on during cold boot
process of primary core.

Currently only BL31 supports PIE, but in future when BL2_AT_EL3 will be
compiled as PIE, it can simply pass fixup size to the common el3
entrypoint macro to fixup GDT.

The reason for this patch was to overcome the bug introduced by SHA
330ead806 which called fixup routine for each core causing
re-initializing of global pointers thus overwriting any changes
done by the previous core.

Change-Id: I55c792cc3ea9e7eef34c2e4653afd04572c4f055
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
2019-12-12 14:16:14 +00:00
Hadi Asyrafi 0d1b704ad8 intel: s10: Remove unused source code
remove plat_sip_svc.c and plat_psci.c in stratix 10 platform directory
as both has been refactored to common directory for sharing with agilex
platform

Signed-off-by: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com>
Change-Id: I395fed66408f536e8fefd637681e742c63621818
2019-12-12 10:46:15 +08:00
Alexei Fedorov fcccd358e4 Merge "libc: add memrchr" into integration 2019-12-11 10:14:13 +00:00
Ambroise Vincent ebff107268 libc: add memrchr
This function scans a string backwards from the end for the first
instance of a character.

Change-Id: I46b21573ed25a0ff222eac340e1e1fb93b040763
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2019-12-11 08:51:26 +01:00
Varun Wadekar fbd9eb58e6 docs: tegra: add support for Tegra194 class of SoCs
This patch adds the Tegra194 SoC information to the nvidia-tegra.rst
file.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: Id649a5ff1b3f70eeee34b508edb7965e7b7a2454
2019-12-10 10:06:48 -08:00
Pritesh Raithatha fba54d5568 Tegra194: smmu: add support for backup multiple smmu regs
Tegra194 supports multiple SMMU blocks. This patch adds support to
save register values for SMMU0 and SMMU2, before entering the System
Suspend state.

Change-Id: I3a376cdb606ea057ad7047714717245f9dced5cf
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
2019-12-10 09:59:40 -08:00
Pritesh Raithatha 8ecc429143 Tegra194: introduce tegra_mc_def.h
This patch introduces memory controller register defines
for Tegra194 platforms.

Change-Id: I6596341ae817b6cec30cb74d201ad854a0c8c0a6
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
2019-12-10 09:59:09 -08:00
Steven Kao 56c27438bd Tegra194: 40-bit wide memory address space
This patch updates the memory address space, physical and virtual,
to be 40-bits wide for all Tegra194 platforms.

Change-Id: Ie1bcdec2c4e8e15975048ce1c2a31c2ae0dd494c
Signed-off-by: Steven Kao <skao@nvidia.com>
2019-12-10 09:57:24 -08:00
Varun Wadekar 4719bba93d Tegra194: psci: rename 'percpu_data' variable
The per CPU wake times are saved in an array called 't19x_percpu_data'. But,
there is one instance in the code where the name of the variable is misspelt.

This patch fixes this typographical error to fix compilation errors.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Change-Id: I52f5f0b150c51d8cc38372675415dec7944a7735
2019-12-10 09:56:38 -08:00
Manish Pandey 2bcaeab663 Merge "adding support to enable different personality of the same soc." into integration 2019-12-10 17:01:48 +00:00
Alexei Fedorov 953dc5410b Merge "Use the proper size for tb_fw_cfg_dtb" into integration 2019-12-10 12:07:27 +00:00
Sandrine Bailleux 9be5ca7aa6 Merge "arm: Fix current RECLAIM_INIT_CODE behavior" into integration 2019-12-10 11:53:50 +00:00
Ambroise Vincent a71c59d5cb arm: Fix current RECLAIM_INIT_CODE behavior
Previously the .init section was created even when the reclaim flag was
manually set to 0.

Change-Id: Ia9e7c7997261f54a4eca725d7ea605192f60bcf8
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
	       Zelalem Aweke <zelalem.aweke@arm.com>
2019-12-09 11:09:09 -06:00
Sandrine Bailleux ae630cdbb3 Merge changes from topic "lm/memmap" into integration
* changes:
  Add memory_map tools as a target for Make
  tools: Add show_memory script
2019-12-09 15:12:10 +00:00
Louis Mayencourt 6c77dfc5e6 Use the proper size for tb_fw_cfg_dtb
Currently tb_fw_cfg_dtb size is fixed to max, which is generally a page
(but depend on the platform). Instead, read the actual size of the dtb
with the libfdt "fdt_totalsize" function.
This avoid flushing extra memory after updating the dtb with mbedtls
heap information when shared heap is used.

Change-Id: Ibec727661116429f486464a0c9f15e9760d7afe2
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
2019-12-09 14:15:40 +00:00
Artsem Artsemenka db3ae8538b S-EL2 Support: Check for AArch64
Check that entry point information requesting S-EL2
has AArch64 as an execution state during context setup.

Signed-off-by: Artsem Artsemenka <artsem.artsemenka@arm.com>
Change-Id: I447263692fed6e55c1b076913e6eb73b1ea735b7
2019-12-06 17:42:45 +00:00
Achin Gupta 0376e7c4aa Add support for enabling S-EL2
This patch adds support for enabling S-EL2 if this EL is specified in the entry
point information being used to initialise a secure context. It is the caller's
responsibility to check if S-EL2 is available on the system before requesting
this EL through the entry point information.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Change-Id: I2752964f078ab528b2e80de71c7d2f35e60569e1
2019-12-06 17:42:45 +00:00
Soby Mathew ade3f5df96 Merge changes from topic "bs/libc" into integration
* changes:
  libc: Consolidate the size_t and NULL definitions
  libc: Consolidate unified definitions
  libc: Unify intmax_t and uintmax_t on AArch32/64
2019-12-06 11:15:58 +00:00
Bence Szépkúti d45c323a9c libc: Consolidate the size_t and NULL definitions
Consolidate the definition of size_t to one header per AArch, and
the definition of NULL to one header

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
Change-Id: Iecfbad2cf360cfb705ce7aaa981700fd16219b82
2019-12-06 11:37:19 +01:00
Bence Szépkúti b382ac6887 libc: Consolidate unified definitions
As supporting architectures aside from AArch32 and AArch64 is not a
concern, keeping identical definitions in two places for a large part
of the libc seems counterproductive

The int128 types were left un-unified as __int128 is not supported by
gcc on AArch32

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
Change-Id: Idf08e6fab7e4680d9da62d3c57266ea2d80472cf
2019-12-06 11:37:19 +01:00
Bence Szépkúti d005cfbfd9 libc: Unify intmax_t and uintmax_t on AArch32/64
Conceptually, these are supposed to be the largest integers
representable in C, but GCC and Clang define them as long long for
compatibility.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
Change-Id: I7c0117f3be167342814d260a371889120dcf6576
2019-12-06 11:37:19 +01:00
Soby Mathew f224bd4ee2 Merge changes from topic "allwinner_bl31_size" into integration
* changes:
  Reduce space lost to object alignment
  imx: Fix multiple definition of ipc_handle
  imx: Fix missing inclusion of cdefs.h
2019-12-06 09:43:28 +00:00
Mark Dykes b3257a3d39 Merge "intel: Refactor common platform code [5/5]" into integration 2019-12-04 19:03:52 +00:00
Mark Dykes b33772eb9c Merge changes from topic "platform-refactor" into integration
* changes:
  intel: Refactor common platform code [4/5]
  intel: Refactor common platform code [3/5]
  intel: Refactor common platform code [2/5]
  intel: Refactor common platform code [1/5]
2019-12-04 19:03:01 +00:00
Mark Dykes b3fc6c1c95 Merge "Remove -Wunused-const-variable warning" into integration 2019-12-04 17:25:26 +00:00
Manish Pandey 449aeb67d1 Merge "rockchip: px30: Add support for UART3 as serial output" into integration 2019-12-04 13:52:37 +00:00
Soby Mathew 84bd7a43af Merge "Enable Link Time Optimization in GCC" into integration 2019-12-04 10:35:49 +00:00
Samuel Holland ebd6efae67 Reduce space lost to object alignment
Currently, sections within .text/.rodata/.data/.bss are emitted in the
order they are seen by the linker. This leads to wasted space, when a
section with a larger alignment follows one with a smaller alignment.
We can avoid this wasted space by sorting the sections.

To take full advantage of this, we must disable generation of common
symbols, so "common" data can be sorted along with the rest of .bss.

An example of the improvement, from `make DEBUG=1 PLAT=sun50i_a64 bl31`:
  .text   => no change
  .rodata => 16 bytes saved
  .data   => 11 bytes saved
  .bss    => 576 bytes saved

As a side effect, the addition of `-fno-common` in TF_CFLAGS makes it
easier to spot bugs in header files.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I073630a9b0b84e7302a7a500d4bb4b547be01d51
2019-12-04 02:59:30 -06:00
Samuel Holland 118a67a9a3 imx: Fix multiple definition of ipc_handle
This is not conforming C and does not compile with -fno-common.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I6535954cc567d6efa06919069b91e3f50975b073
2019-12-04 02:59:03 -06:00
Samuel Holland e8bb1c2caa imx: Fix missing inclusion of cdefs.h
This was found by compiling with -fno-common:

./build/picopi/release/bl2/imx_snvs.o:(.bss.__packed+0x0): multiple definition of `__packed';
./build/picopi/release/bl2/imx_caam.o:(.bss.__packed+0x0): first defined here

__packed was intended to be the attribute macro from cdefs.h, not an
object of the structure type.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Id02fac3f098be2d71c35c6b4a18012515532f32a
2019-12-04 02:58:41 -06:00
Samuel Holland 5cffedcec2 allwinner: Fix incorrect ARISC code patch offset check
The current range check for the offset is wrong: it is counting bytes,
while indexing an array of uint32_t. Since the offset is always zero,
the parameter is unnecessary. Instead of adding more code to fix the
check, remove the parameter to avoid the problem entirely.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: Iadfc7d027155adc754e017b3462233ce9a1d64f6
2019-12-04 01:54:48 -06:00
Justin Chadwell 4960ef301a Remove -Wunused-const-variable warning
-Wunused-const-variable=1 is already included by -Wunused-variable,
which is part of -Wall. -Wunused-const-variable=2, which is what we have
been using as part of W=1, warns for unused static const variables in
headers, which will likely produce a lot of false positives that will
take a large effort to fix.

Additionally, some of these issues may be caused by different builds of
TF-A where some features are used in some builds and ignored in others.

Change-Id: Ifa0b16a75344cc1f6240e8d5745005f8f2046d34
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
2019-12-03 17:49:38 -06:00