summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/psci-client.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-131-0/+1
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: client: don't hardcode method smc in fixupAhmad Fatoum2022-11-071-3/+3
| | | | | | | | | | | | | | When barebox is booted as QEMU -kernel, PSCI will have method = "hvc", because QEMU will act as Hypervisor. barebox handles this correctly and will use hvc instead of smc, but of_psci_fixup() always fixes up method = "smc" thereby breaking kernel boot. Fix this by forwarding the method read from barebox DT into the kernel DT. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20221105121154.3716964-2-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: make PSCI method a of_psci_fixup parameterAhmad Fatoum2022-11-071-1/+1
| | | | | | | | | | | | | | We currently assume PSCI fixups to always be of method smc, but this is not true when barebox fixes up the node while running under QEMU. In preparation for handling QEMU boot properly when psci-client driver is enabled, give of_psci_fixup an extra parameter. No functional change. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20221105121154.3716964-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: client: fix power off and reset via 64-bit secure monitorAhmad Fatoum2021-10-181-1/+1
| | | | | | | | | | | | | | | | | | The PSCI function code is a 32-bit integer > 0x80000000, but the the PSCI client code erroneously casted it to a signed integer. On 32-bit systems, the cast later on to unsigned long restored the original value, but on 64-bit system, we passed a very large 64-bit number in the secure monitor call because of the sign extension. This worked because TF-A seems to ignore the upper 32-bits anyway, (tested with i.MX8MN), but for other secure monitors like the default HVC implementation for QEMU ARM64 Virt machine this didn't hold true for all commands, leading to aborts when doing reset or poweroff. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211015160544.5783-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: psci: implement PSCI client driverAhmad Fatoum2019-11-071-0/+190
System reset on the STM32MP may be done via PSCI when running TF-A as first-stage boot loader. Provide a PSCI driver to simplify using it: - A psci_invoke function is exported, so other code can use it - A fixup for the PSCI device tree node is registered - A reset and poweroff handler via PSCI is registered for PSCI >= v0.2 Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>