Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2017 Masahiro Yamada <yamada.masahiro@socionext.com> |
| 4 | * |
| 5 | * Based on drivers/firmware/psci.c from Linux: |
| 6 | * Copyright (C) 2015 ARM Limited |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 7 | */ |
| 8 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 9 | #include <command.h> |
Simon Glass | 11c89f3 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 10 | #include <dm.h> |
Etienne Carriere | fe24380 | 2022-06-01 10:27:32 +0200 | [diff] [blame] | 11 | #include <efi_loader.h> |
Simon Glass | 8f3f761 | 2019-11-14 12:57:42 -0700 | [diff] [blame] | 12 | #include <irq_func.h> |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 13 | #include <linker_lists.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 14 | #include <log.h> |
Igor Opaniuk | 3696c09 | 2021-04-01 02:01:53 +0300 | [diff] [blame] | 15 | #include <sysreset.h> |
Etienne Carriere | fe24380 | 2022-06-01 10:27:32 +0200 | [diff] [blame] | 16 | #include <asm/system.h> |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 17 | #include <dm/device-internal.h> |
Etienne Carriere | fe24380 | 2022-06-01 10:27:32 +0200 | [diff] [blame] | 18 | #include <dm/lists.h> |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 19 | #include <linux/arm-smccc.h> |
Etienne Carriere | fe24380 | 2022-06-01 10:27:32 +0200 | [diff] [blame] | 20 | #include <linux/delay.h> |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 21 | #include <linux/errno.h> |
Etienne Carriere | fe24380 | 2022-06-01 10:27:32 +0200 | [diff] [blame] | 22 | #include <linux/libfdt.h> |
Masahiro Yamada | 8fa57ed | 2017-11-29 15:04:40 +0900 | [diff] [blame] | 23 | #include <linux/printk.h> |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 24 | #include <linux/psci.h> |
Neil Armstrong | 6e7c779 | 2024-06-28 11:54:47 +0200 | [diff] [blame^] | 25 | #include <power-domain-uclass.h> |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 26 | |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 27 | #define DRIVER_NAME "psci" |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 28 | |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 29 | #define PSCI_METHOD_HVC 1 |
| 30 | #define PSCI_METHOD_SMC 2 |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 31 | |
Igor Opaniuk | 3696c09 | 2021-04-01 02:01:53 +0300 | [diff] [blame] | 32 | /* |
| 33 | * While a 64-bit OS can make calls with SMC32 calling conventions, for some |
| 34 | * calls it is necessary to use SMC64 to pass or return 64-bit values. |
| 35 | * For such calls PSCI_FN_NATIVE(version, name) will choose the appropriate |
| 36 | * (native-width) function ID. |
| 37 | */ |
| 38 | #if defined(CONFIG_ARM64) |
| 39 | #define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name |
| 40 | #else |
| 41 | #define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN_##name |
| 42 | #endif |
| 43 | |
Yann Gautier | 2aa7fc6 | 2020-07-17 14:20:15 +0200 | [diff] [blame] | 44 | #if CONFIG_IS_ENABLED(EFI_LOADER) |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 45 | int __efi_runtime_data psci_method; |
Yann Gautier | 2aa7fc6 | 2020-07-17 14:20:15 +0200 | [diff] [blame] | 46 | #else |
Marek BehĂșn | 4bebdd3 | 2021-05-20 13:23:52 +0200 | [diff] [blame] | 47 | int psci_method __section(".data"); |
Yann Gautier | 2aa7fc6 | 2020-07-17 14:20:15 +0200 | [diff] [blame] | 48 | #endif |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 49 | |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 50 | unsigned long __efi_runtime invoke_psci_fn |
| 51 | (unsigned long function_id, unsigned long arg0, |
| 52 | unsigned long arg1, unsigned long arg2) |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 53 | { |
| 54 | struct arm_smccc_res res; |
| 55 | |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 56 | /* |
| 57 | * In the __efi_runtime we need to avoid the switch statement. In some |
| 58 | * cases the compiler creates lookup tables to implement switch. These |
| 59 | * tables are not correctly relocated when SetVirtualAddressMap is |
| 60 | * called. |
| 61 | */ |
| 62 | if (psci_method == PSCI_METHOD_SMC) |
| 63 | arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); |
| 64 | else if (psci_method == PSCI_METHOD_HVC) |
| 65 | arm_smccc_hvc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); |
| 66 | else |
| 67 | res.a0 = PSCI_RET_DISABLED; |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 68 | return res.a0; |
| 69 | } |
| 70 | |
Igor Opaniuk | ecb99d0 | 2021-05-06 17:34:27 +0300 | [diff] [blame] | 71 | static int request_psci_features(u32 psci_func_id) |
Igor Opaniuk | 3696c09 | 2021-04-01 02:01:53 +0300 | [diff] [blame] | 72 | { |
| 73 | return invoke_psci_fn(PSCI_1_0_FN_PSCI_FEATURES, |
| 74 | psci_func_id, 0, 0); |
| 75 | } |
| 76 | |
| 77 | static u32 psci_0_2_get_version(void) |
| 78 | { |
| 79 | return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0); |
| 80 | } |
| 81 | |
| 82 | static bool psci_is_system_reset2_supported(void) |
| 83 | { |
| 84 | int ret; |
| 85 | u32 ver; |
| 86 | |
| 87 | ver = psci_0_2_get_version(); |
| 88 | |
| 89 | if (PSCI_VERSION_MAJOR(ver) >= 1) { |
Igor Opaniuk | ecb99d0 | 2021-05-06 17:34:27 +0300 | [diff] [blame] | 90 | ret = request_psci_features(PSCI_FN_NATIVE(1_1, |
| 91 | SYSTEM_RESET2)); |
Igor Opaniuk | 3696c09 | 2021-04-01 02:01:53 +0300 | [diff] [blame] | 92 | |
| 93 | if (ret != PSCI_RET_NOT_SUPPORTED) |
| 94 | return true; |
| 95 | } |
| 96 | |
| 97 | return false; |
| 98 | } |
| 99 | |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 100 | static void smccc_invoke_hvc(unsigned long a0, unsigned long a1, |
| 101 | unsigned long a2, unsigned long a3, |
| 102 | unsigned long a4, unsigned long a5, |
| 103 | unsigned long a6, unsigned long a7, |
| 104 | struct arm_smccc_res *res) |
| 105 | { |
| 106 | arm_smccc_hvc(a0, a1, a2, a3, a4, a5, a6, a7, res); |
| 107 | } |
| 108 | |
| 109 | static void smccc_invoke_smc(unsigned long a0, unsigned long a1, |
| 110 | unsigned long a2, unsigned long a3, |
| 111 | unsigned long a4, unsigned long a5, |
| 112 | unsigned long a6, unsigned long a7, |
| 113 | struct arm_smccc_res *res) |
| 114 | { |
| 115 | arm_smccc_smc(a0, a1, a2, a3, a4, a5, a6, a7, res); |
| 116 | } |
| 117 | |
| 118 | static int bind_smccc_features(struct udevice *dev, int psci_method) |
| 119 | { |
| 120 | struct psci_plat_data *pdata = dev_get_plat(dev); |
| 121 | struct arm_smccc_feature *feature; |
| 122 | size_t feature_cnt, n; |
| 123 | |
| 124 | if (!IS_ENABLED(CONFIG_ARM_SMCCC_FEATURES)) |
| 125 | return 0; |
| 126 | |
| 127 | /* |
| 128 | * SMCCC features discovery invoke SMCCC standard function ID |
| 129 | * ARM_SMCCC_ARCH_FEATURES but this sequence requires that this |
| 130 | * standard ARM_SMCCC_ARCH_FEATURES function ID itself is supported. |
| 131 | * It is queried here with invoking PSCI_FEATURES known available |
| 132 | * from PSCI 1.0. |
| 133 | */ |
| 134 | if (!device_is_compatible(dev, "arm,psci-1.0") || |
| 135 | PSCI_VERSION_MAJOR(psci_0_2_get_version()) == 0) |
| 136 | return 0; |
| 137 | |
Weizhao Ouyang | 7f734c0 | 2024-03-04 14:42:40 +0000 | [diff] [blame] | 138 | if (request_psci_features(ARM_SMCCC_VERSION) == |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 139 | PSCI_RET_NOT_SUPPORTED) |
| 140 | return 0; |
| 141 | |
Weizhao Ouyang | 7f734c0 | 2024-03-04 14:42:40 +0000 | [diff] [blame] | 142 | if (invoke_psci_fn(ARM_SMCCC_VERSION, 0, 0, 0) < ARM_SMCCC_VERSION_1_1) |
| 143 | return 0; |
| 144 | |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 145 | if (psci_method == PSCI_METHOD_HVC) |
| 146 | pdata->invoke_fn = smccc_invoke_hvc; |
| 147 | else |
| 148 | pdata->invoke_fn = smccc_invoke_smc; |
| 149 | |
| 150 | feature_cnt = ll_entry_count(struct arm_smccc_feature, arm_smccc_feature); |
| 151 | feature = ll_entry_start(struct arm_smccc_feature, arm_smccc_feature); |
| 152 | |
| 153 | for (n = 0; n < feature_cnt; n++, feature++) { |
| 154 | const char *drv_name = feature->driver_name; |
| 155 | struct udevice *dev2; |
| 156 | int ret; |
| 157 | |
| 158 | if (!feature->is_supported || !feature->is_supported(pdata->invoke_fn)) |
| 159 | continue; |
| 160 | |
| 161 | ret = device_bind_driver(dev, drv_name, drv_name, &dev2); |
| 162 | if (ret) { |
| 163 | pr_warn("%s was not bound: %d, ignore\n", drv_name, ret); |
| 164 | continue; |
| 165 | } |
| 166 | |
| 167 | dev_set_parent_plat(dev2, dev_get_plat(dev)); |
| 168 | } |
| 169 | |
| 170 | return 0; |
| 171 | } |
| 172 | |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 173 | static int psci_bind(struct udevice *dev) |
| 174 | { |
Neil Armstrong | 6e7c779 | 2024-06-28 11:54:47 +0200 | [diff] [blame^] | 175 | #if IS_ENABLED(CONFIG_POWER_DOMAIN) |
| 176 | ofnode node; |
| 177 | #endif |
| 178 | |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 179 | /* No SYSTEM_RESET support for PSCI 0.1 */ |
Simon Glass | 54cbcc8 | 2017-05-18 20:08:57 -0600 | [diff] [blame] | 180 | if (device_is_compatible(dev, "arm,psci-0.2") || |
| 181 | device_is_compatible(dev, "arm,psci-1.0")) { |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 182 | int ret; |
| 183 | |
| 184 | /* bind psci-sysreset optionally */ |
| 185 | ret = device_bind_driver(dev, "psci-sysreset", "psci-sysreset", |
| 186 | NULL); |
| 187 | if (ret) |
Masahiro Yamada | 8fa57ed | 2017-11-29 15:04:40 +0900 | [diff] [blame] | 188 | pr_debug("PSCI System Reset was not bound.\n"); |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 189 | } |
| 190 | |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 191 | /* From PSCI v1.0 onward we can discover services through ARM_SMCCC_FEATURE */ |
| 192 | if (IS_ENABLED(CONFIG_ARM_SMCCC_FEATURES) && device_is_compatible(dev, "arm,psci-1.0")) |
| 193 | dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND); |
| 194 | |
Neil Armstrong | 6e7c779 | 2024-06-28 11:54:47 +0200 | [diff] [blame^] | 195 | /* Bind power-domain subnodes */ |
| 196 | #if IS_ENABLED(CONFIG_POWER_DOMAIN) |
| 197 | dev_for_each_subnode(node, dev) { |
| 198 | if (device_bind_driver_to_node(dev, "psci_power_domain", |
| 199 | ofnode_get_name(node), |
| 200 | node, NULL)) |
| 201 | pr_warn("failed to bind %s\n", ofnode_get_name(node)); |
| 202 | } |
| 203 | #endif |
| 204 | |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 205 | return 0; |
| 206 | } |
| 207 | |
| 208 | static int psci_probe(struct udevice *dev) |
| 209 | { |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 210 | const char *method; |
| 211 | |
Michal Simek | d180353 | 2020-08-13 12:43:22 +0200 | [diff] [blame] | 212 | #if defined(CONFIG_ARM64) |
| 213 | if (current_el() == 3) |
| 214 | return -EINVAL; |
| 215 | #endif |
| 216 | |
Jon Hunter | 52b72c1 | 2020-06-18 12:54:38 +0100 | [diff] [blame] | 217 | method = ofnode_read_string(dev_ofnode(dev), "method"); |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 218 | if (!method) { |
Masahiro Yamada | 8fa57ed | 2017-11-29 15:04:40 +0900 | [diff] [blame] | 219 | pr_warn("missing \"method\" property\n"); |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 220 | return -ENXIO; |
| 221 | } |
| 222 | |
| 223 | if (!strcmp("hvc", method)) { |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 224 | psci_method = PSCI_METHOD_HVC; |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 225 | } else if (!strcmp("smc", method)) { |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 226 | psci_method = PSCI_METHOD_SMC; |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 227 | } else { |
Masahiro Yamada | 8fa57ed | 2017-11-29 15:04:40 +0900 | [diff] [blame] | 228 | pr_warn("invalid \"method\" property: %s\n", method); |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 229 | return -EINVAL; |
| 230 | } |
| 231 | |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 232 | return bind_smccc_features(dev, psci_method); |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 233 | } |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 234 | |
| 235 | /** |
| 236 | * void do_psci_probe() - probe PSCI firmware driver |
| 237 | * |
| 238 | * Ensure that psci_method is initialized. |
| 239 | */ |
| 240 | static void __maybe_unused do_psci_probe(void) |
| 241 | { |
| 242 | struct udevice *dev; |
| 243 | |
| 244 | uclass_get_device_by_name(UCLASS_FIRMWARE, DRIVER_NAME, &dev); |
| 245 | } |
| 246 | |
| 247 | #if IS_ENABLED(CONFIG_EFI_LOADER) && IS_ENABLED(CONFIG_PSCI_RESET) |
| 248 | efi_status_t efi_reset_system_init(void) |
| 249 | { |
| 250 | do_psci_probe(); |
| 251 | return EFI_SUCCESS; |
| 252 | } |
| 253 | |
| 254 | void __efi_runtime EFIAPI efi_reset_system(enum efi_reset_type reset_type, |
| 255 | efi_status_t reset_status, |
| 256 | unsigned long data_size, |
| 257 | void *reset_data) |
| 258 | { |
| 259 | if (reset_type == EFI_RESET_COLD || |
| 260 | reset_type == EFI_RESET_WARM || |
| 261 | reset_type == EFI_RESET_PLATFORM_SPECIFIC) { |
| 262 | invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); |
| 263 | } else if (reset_type == EFI_RESET_SHUTDOWN) { |
| 264 | invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); |
| 265 | } |
| 266 | while (1) |
| 267 | ; |
| 268 | } |
| 269 | #endif /* IS_ENABLED(CONFIG_EFI_LOADER) && IS_ENABLED(CONFIG_PSCI_RESET) */ |
| 270 | |
| 271 | #ifdef CONFIG_PSCI_RESET |
| 272 | void reset_misc(void) |
| 273 | { |
| 274 | do_psci_probe(); |
| 275 | invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); |
| 276 | } |
| 277 | #endif /* CONFIG_PSCI_RESET */ |
| 278 | |
Igor Opaniuk | 3696c09 | 2021-04-01 02:01:53 +0300 | [diff] [blame] | 279 | void psci_sys_reset(u32 type) |
| 280 | { |
| 281 | bool reset2_supported; |
| 282 | |
| 283 | do_psci_probe(); |
| 284 | |
| 285 | reset2_supported = psci_is_system_reset2_supported(); |
| 286 | |
| 287 | if (type == SYSRESET_WARM && reset2_supported) { |
| 288 | /* |
| 289 | * reset_type[31] = 0 (architectural) |
| 290 | * reset_type[30:0] = 0 (SYSTEM_WARM_RESET) |
| 291 | * cookie = 0 (ignored by the implementation) |
| 292 | */ |
| 293 | invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0); |
| 294 | } else { |
| 295 | invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | void psci_sys_poweroff(void) |
| 300 | { |
| 301 | do_psci_probe(); |
| 302 | |
| 303 | invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); |
| 304 | } |
| 305 | |
Michal Simek | f92175c | 2021-07-13 16:53:46 +0200 | [diff] [blame] | 306 | #if IS_ENABLED(CONFIG_CMD_POWEROFF) && !IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF) |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 307 | int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 308 | { |
| 309 | do_psci_probe(); |
| 310 | |
| 311 | puts("poweroff ...\n"); |
| 312 | udelay(50000); /* wait 50 ms */ |
| 313 | |
| 314 | disable_interrupts(); |
| 315 | invoke_psci_fn(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); |
| 316 | enable_interrupts(); |
| 317 | |
| 318 | log_err("Power off not supported on this platform\n"); |
| 319 | return CMD_RET_FAILURE; |
| 320 | } |
| 321 | #endif |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 322 | |
| 323 | static const struct udevice_id psci_of_match[] = { |
| 324 | { .compatible = "arm,psci" }, |
| 325 | { .compatible = "arm,psci-0.2" }, |
| 326 | { .compatible = "arm,psci-1.0" }, |
| 327 | {}, |
| 328 | }; |
| 329 | |
| 330 | U_BOOT_DRIVER(psci) = { |
Heinrich Schuchardt | 26f09d0 | 2018-10-18 12:29:40 +0200 | [diff] [blame] | 331 | .name = DRIVER_NAME, |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 332 | .id = UCLASS_FIRMWARE, |
| 333 | .of_match = psci_of_match, |
| 334 | .bind = psci_bind, |
| 335 | .probe = psci_probe, |
Etienne Carriere | 73b4eaf | 2022-06-01 10:27:33 +0200 | [diff] [blame] | 336 | #ifdef CONFIG_ARM_SMCCC_FEATURES |
| 337 | .plat_auto = sizeof(struct psci_plat_data), |
| 338 | #endif |
Peng Fan | a6fb3e8 | 2023-04-06 18:23:17 +0800 | [diff] [blame] | 339 | .flags = DM_FLAG_PRE_RELOC, |
Masahiro Yamada | 836c55d | 2017-04-14 11:10:24 +0900 | [diff] [blame] | 340 | }; |
Neil Armstrong | 6e7c779 | 2024-06-28 11:54:47 +0200 | [diff] [blame^] | 341 | |
| 342 | #if IS_ENABLED(CONFIG_POWER_DOMAIN) |
| 343 | /* Accept #power-domain-cells == 0 */ |
| 344 | static int psci_power_domain_xlate(struct power_domain *power_domain, |
| 345 | struct ofnode_phandle_args *args) |
| 346 | { |
| 347 | return args->args_count == 0 ? 0 : -EINVAL; |
| 348 | } |
| 349 | |
| 350 | static const struct power_domain_ops psci_power_ops = { |
| 351 | .of_xlate = psci_power_domain_xlate, |
| 352 | }; |
| 353 | |
| 354 | static int psci_power_domain_probe(struct udevice *dev) |
| 355 | { |
| 356 | return 0; |
| 357 | } |
| 358 | |
| 359 | U_BOOT_DRIVER(psci_power_domain) = { |
| 360 | .name = "psci_power_domain", |
| 361 | .id = UCLASS_POWER_DOMAIN, |
| 362 | .ops = &psci_power_ops, |
| 363 | .probe = psci_power_domain_probe, |
| 364 | .flags = DM_FLAG_PRE_RELOC, |
| 365 | }; |
| 366 | #endif |