- 24 Jan, 2021 8 commits
-
-
Samuel Holland authored
In order to keep SCP firmware as optional, the original, limited native PSCI implementation was kept around as a fallback. This turned out to be a good decision, as some newer SoCs omit the ARISC, and thus cannot run SCP firmware. However, keeping the two implementations in one file makes things unnecessarily messy. First, it is difficult to compile out the SCPI-based implementation where it is not applicable. Second the check is done in each callback, while scpi_available is only updated at boot. This makes the individual callbacks unnecessarily complicated. It is cleaner to provide two entirely separate implementations in two separate files. The native implementation does not support any kind of CPU suspend, so its callbacks are greatly simplified. One function, sunxi_validate_ns_entrypoint, is shared between the two implementations. Finally, the logic for choosing between implementations is kept in a third file, to provide for platforms where only one implementation is applicable and the other is compiled out. Change-Id: I4914f07d8e693dbce218e0e2394bef15c42945f8 Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
- When the SCPI shutdown/reset command returns success, the SCP is still waiting for the CPU to enter WFI. Do that. - Peform board-level poweroff before CPU poweroff. If there is a PMIC available, it will turn everything off including the CPUs, so doing CPU poweroff first is a waste of cycles. - During poweroff, attempt to turn off the local CPU using the ARISC. This should use slightly less power than just an infinite WFI. - Drop the WFI in the reset failure path. The panic will hang anyway. Change-Id: I897efecb3fe4e77a56041b97dd273156ec51ef8e Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
When operating on the local cpu, sunxi_cpu_power_off_self() only "arms" the ARISC to perform the power-off process; the SCP waits for the CPU to enter WFI before acutally powering it off. Since this matches the expected split between .pwr_domain_off and .pwr_domain_pwr_down_wfi, we can move the sunxi_cpu_power_off_self() call to sunxi_pwr_domain_off(). Since that change makes sunxi_pwr_down_wfi() equivalent to the default implementation, the callback is no longer needed. Change-Id: I7d65f66c550d1c69fa5e9945affd7a25b3d3ef42 Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
Currently, sunxi_cpu_off() has two separate code paths: one for the local CPU, and one for other CPUs. Let's split them in to two functions. This actually simplifies things, because all callers either operate on the local CPU only (sunxi_pwr_down_wfi()) or other CPUs only (sunxi_cpu_power_off_others()). This avoids needing a second MPIDR read to choose the appropriate code path. Change-Id: I55de85025235cc95466bfa106831fc4c2368f527 Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
Disabling secondary CPUs during boot is unnecessary because the other CPUs are already in reset, and it saves an entirely insignificant amount of power. Let's remove this bit of code that was added mostly "because we can", and along with it remove an unconditional dependency on the CPU ops functions. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ia77a1b722da6ba989c3992b656a6cde3f2238fd7
-
Samuel Holland authored
Checking the exceptional case and letting the success case fall through is not only more idiomatic, but it also allows adding more exceptional cases in the future, such as a check for overlapping secure DRAM. Change-Id: I720441a6a8853fd7f211ebe851f14d921a6db03d Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
This duplicated the logic in psci_validate_mpidr() which was already called from psci_cpu_on(). Change-Id: I96ee92f1ce3e9cc2985b4e229ba86ebd27b79915 Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
This optional PSCI function was only implemented when SCPI was available. However, the underlying SCPI function is not able to fulfill the necessary contract. First, the SCPI protocol has no way to represent HW_STANDBY at the CPU power level. Second, the SCPI implementation maintains its own logical view of power states, and its implementation of SCPI_CMD_GET_CSS_POWER_STATE does not actually query the hardware. Thus it cannot provide "the physical view of power state", as required for this function by the PSCI specification. Since the function is optional, drop it. Change-Id: I5f3a0810ac19ddeb3c0c5d35aeb09f09a0b80c1d Signed-off-by: Samuel Holland <samuel@sholland.org>
-
- 14 Dec, 2020 7 commits
-
-
Samuel Holland authored
RSB is faster and more efficient, and it has a simpler driver. As long as the PMIC is returned to I2C mode after use, the rich OS can later use either bus. Change-Id: I0c5f32e88a090c8c5cccb81bd24596b301ab9da7 Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
This gives the rich OS the flexibility to choose between I2C and RSB communication. Since a runtime address can only be assigned once after entering RSB mode, it also lets the rich OS choose any runtime address. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Id49c124c5e925985fc31c0ba38c7fb6c941aafa8
-
Samuel Holland authored
None of the other drivers (Linux, U-Boot, Crust) need to lower the bus clock frequency to switch the PMIC to RSB mode. That logic is not needed here, either. The hardware takes care of running this transaction at the correct bus frequency. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Idcfe933df4da75d5fd5a4f3e362da40ac26bdad1
-
Samuel Holland authored
BL31 reports the following warning during boot: WARNING: BL31: cortex_a53: CPU workaround for 1530924 was missing! Resolve this by enabling the workaround on the affected platforms. Change-Id: Ia1d5075370be5ae67b7bece96ec0069d9692b14c Signed-off-by: Samuel Holland <samuel@sholland.org>
-
Samuel Holland authored
While the Allwinner platform code nominally supported a custom PRELOADED_BL33_BASE, some references to the BL33 load address used another constant: PLAT_SUNXI_NS_IMAGE_OFFSET. To allow the DTB search code to work if a U-Boot BL33 is loaded to a custom address, consistently use PRELOADED_BL33_BASE. And to avoid this confusion in the future, remove the other constant. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ie6b97ae1fdec95d784676aef39200bef161471b0
-
Samuel Holland authored
The H6 has a "secure port controller" similar to the A64/H5, but with more ports and a different register layout. Split the platform-specific parts out into a header, and add the missing MMIO base address. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I3703868bc595459ecf9568b9d1605cb1be014bf5
-
Samuel Holland authored
H6 has a reorganized R_PRCM compared to A64/H5, with the security switch at a different offset. Until now, we did not notice, because the switch has no effect unless the secure mode e-fuse is blown. Since we are adding more platform-specific CCU registers, move them to their own header, and out of the memory map (where they do not belong). Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ie77476db0515080954eaa2e32bf6c3de657cda86
-
- 17 Aug, 2020 1 commit
-
-
Andre Przywara authored
Compiling BL31 for the Allwinner platform now produces a message about the deprecation of gic_common.c. Follow the advice and use include gicv2.mk instead. Collect all includes at the beginning of the file on the way. Change-Id: Iee46e21a630bfa831d28059f09aa7b049eb554bb Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-
- 29 Jun, 2020 1 commit
-
-
Samuel Holland authored
The non-secure world has no business accessing the CPU power switches in the PRCM; those are handled by TF-A or the SCP. Only allow access to the clock control part of the PRCM. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I657b97f4ea8a0073448ad3343fbc66ba168ed89e
-
- 23 Mar, 2020 1 commit
-
-
Andre Przywara authored
The base address for both the GPIO and the clock unit of the H6 memory map have been typo-ed. Fix them to match the Linux DT and the manual. The H6 code use neither of them, so this doesn't change or fix anything in the real world, but should be corrected anyway. The issue was found and reported by Github user "armlabs". Change-Id: Ic6fdfb732ce1cfc54cbb927718035624a06a9e08 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-
- 25 Feb, 2020 1 commit
-
-
Andre Przywara authored
Since now the generic console_t structure holds the UART base address as well, let's use that generic location and drop the UART driver specific data structure at all. Change-Id: I5c2fe3b6a667acf80c808cfec4a64059a2c9c25f Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-
- 13 Feb, 2020 4 commits
-
-
Samuel Holland authored
If an SCP firmware is present and able to communicate via SCPI, then use that to implement CPU and system power state transitions, including CPU hotplug and system suspend. Otherwise, fall back to the existing CPU power control implementation. The last 16 KiB of SRAM A2 are reserved for the SCP firmware, and the SCPI shared memory is at the very end of this region (and therefore the end of SRAM A2). BL31 continues to start at the beginning of SRAM A2 (not counting the ARISC exception vector area) and fills up to the beginning of the SCP firmware. Because the SCP firmware is not loaded adjacent to the ARISC exception vector area, the jump instructions used for exception handling cannot be included in the SCP firmware image, and must be initialized here before turning on the SCP. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I37b9b9636f94d4125230423726f3ac5e9cdb551c
-
Samuel Holland authored
The function names follow the naming convention used by the existing ARM SCPI client. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I543bae7d46e206eb405dbedfcf7aeba88a12ca48
-
Samuel Holland authored
The SCP firmware is allocated the last 16KiB of SRAM A2. This includes the SCPI shared memory area, which must be mapped as MT_DEVICE to prevent problems with cache coherency between the AP CPUs and the SCP. For simplicity, map the whole SCP region as MT_DEVICE. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ie39eb5ff281b8898a3c1d9748dc08755f528e2f8
-
Samuel Holland authored
The ARISC vector area consists of 0x4000 bytes before the beginning of usable SRAM. Still, it is technically a part of SRAM A2, so include it in the memory definition. This avoids the confusing practice of subtracting from the beginning of the SRAM region when referencing the ARISC vectors. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Iae89e01aeab93560159562692e03e88306e2a1bf
-
- 24 Jan, 2020 1 commit
-
-
Deepika Bhavnani authored
PLATFORM_CORE_COUNT - Unsigned int PLATFORM_CLUSTER_COUNT - Unsigned int PLATFORM_MAX_CPUS_PER_CLUSTER - Unsigned int PLATFORM_CORE_COUNT_PER_CLUSTER - Unsigned int Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com> Change-Id: I7aea86891e54522c88af5ff16795a575f9a9322d
-
- 20 Jan, 2020 1 commit
-
-
Samuel Holland authored
Remove the general BL31 mmap region: it duplicates the existing static mapping for the entire SRAM region. Use the helper definitions when applicable to simplify the code and add the MT_EXECUTE_NEVER flag. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I7a6b79e50e4b5c698774229530dd3d2a89e94a6d
-
- 15 Jan, 2020 1 commit
-
-
Samuel Holland authored
Now that there is plenty of space (32 KiB) available for NOBITS sections, we can afford using an entire page for coherent memory. In fact, because it simplifies the code, this is a beneficial change for loaded image (.text) size, where we are still close to the size limit. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I0b899dabcb162015c63b0e4aed0869569c889ed9
-
- 29 Dec, 2019 2 commits
-
-
Samuel Holland authored
Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ia2f69e26e34462e113bc2cad4dcb923e20b8fb95
-
Samuel Holland authored
This frees up space in SRAM A2 that will be used by the SCP firmware and SCPI shared memory. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: I8ce035257451e2d142666fe0cd045e59d4d57b35
-
- 14 Dec, 2019 11 commits
-
-
Samuel Holland authored
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
-
Samuel Holland authored
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
-
Samuel Holland authored
This simplifies the code a bit. Verified to produce the same binary. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ie1ec1ce2ea39c46525840906826c90a8a7eff287
-
Samuel Holland authored
As of a561e41b ("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
-
Samuel Holland authored
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
-
Samuel Holland authored
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
-
Samuel Holland authored
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
-
Samuel Holland authored
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
-
Samuel Holland authored
- 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
-
Samuel Holland authored
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
-
Samuel Holland authored
The clock must be running for the module to be reset. Signed-off-by: Samuel Holland <samuel@sholland.org> Change-Id: Ic8fafc946f3a1a697174b91288e357ffa033ab9a
-
- 04 Dec, 2019 1 commit
-
-
Samuel Holland authored
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
-