Lines Matching +full:shutdown +full:- +full:ack

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2014-2022 Xilinx, Inc.
13 #include <linux/arm-smccc.h>
26 #include <linux/firmware/xlnx-zynqmp.h>
27 #include <linux/firmware/xlnx-event-manager.h>
28 #include "zynqmp-debug.h"
35 /* BOOT_PIN_CTRL- Used to control the mode pins after boot */
37 /* BOOT_PIN_CTRL_MASK- out_val[11:8], out_en[3:0] */
54 * struct zynqmp_devinfo - Structure for Zynqmp device instance
64 * struct pm_api_feature_data - PM API Feature data
82 * zynqmp_pm_ret_code() - Convert PMU-FW error codes to Linux error codes
94 return -ENOTSUPP; in zynqmp_pm_ret_code()
96 return -EOPNOTSUPP; in zynqmp_pm_ret_code()
98 return -EACCES; in zynqmp_pm_ret_code()
100 return -ECANCELED; in zynqmp_pm_ret_code()
102 return -EUSERS; in zynqmp_pm_ret_code()
108 return -EINVAL; in zynqmp_pm_ret_code()
114 return -ENODEV; in do_fw_call_fail()
124 * do_fw_call_smc() - Call system-level platform management layer (SMC)
140 return -EINVAL; in do_fw_call_smc()
162 * do_fw_call_hvc() - Call system-level platform management layer (HVC)
167 * HVC-based for communication through hypervisor
180 return -EINVAL; in do_fw_call_hvc()
211 * Feature check of APIs belonging to PM, XSEM, and TF-A are handled by calling in __do_feature_check_call()
220 * Feature check of TF-A APIs is done in the TF-A layer and it expects for in __do_feature_check_call()
231 ret = -EOPNOTSUPP; in __do_feature_check_call()
247 if (feature_data->pm_api_id == api_id) in do_feature_check_call()
248 return feature_data->feature_status; in do_feature_check_call()
254 return -ENOMEM; in do_feature_check_call()
256 feature_data->pm_api_id = api_id; in do_feature_check_call()
259 feature_data->feature_status = ret; in do_feature_check_call()
260 hash_add(pm_api_features_map, &feature_data->hentry, api_id); in do_feature_check_call()
273 * zynqmp_pm_feature() - Check whether given feature is supported or not and
293 * zynqmp_pm_is_function_supported() - Check whether given IOCTL/QUERY function
307 return -EINVAL; in zynqmp_pm_is_function_supported()
327 return -EOPNOTSUPP; in zynqmp_pm_is_function_supported()
329 return -ENODATA; in zynqmp_pm_is_function_supported()
337 * zynqmp_pm_invoke_fn() - Invoke the system-level platform management layer
339 * @pm_api_id: Requested PM-API call
341 * @num_args: Number of arguments to requested PM-API call
353 * PM_SIP_SVC - Registered ZynqMP SIP Service Call.
354 * PM_API_ID - Platform Management API ID.
370 return -EINVAL; in zynqmp_pm_invoke_fn()
402 if (ret != -EOPNOTSUPP && !ret) in zynqmp_pm_register_sgi()
410 * zynqmp_pm_get_api_version() - Get version number of PMU PM firmware
421 return -EINVAL; in zynqmp_pm_get_api_version()
436 * zynqmp_pm_get_chipid - Get silicon ID registers
449 return -EINVAL; in zynqmp_pm_get_chipid()
460 * zynqmp_pm_get_family_info() - Get family info of platform
462 * @subfamily: Returned sub-family code value
472 /* Check is family or sub-family code already received */ in zynqmp_pm_get_family_info()
494 * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version
505 return -EINVAL; in zynqmp_pm_get_trustzone_version()
519 * get_set_conduit_method() - Choose SMC or HVC based communication
522 * Use SMC or HVC-based functions to communicate with EL2/EL3.
532 return -ENXIO; in get_set_conduit_method()
542 return -EINVAL; in get_set_conduit_method()
549 * zynqmp_pm_query_data() - Get query data from firmware
572 * zynqmp_pm_clock_enable() - Enable the clock for given id
587 * zynqmp_pm_clock_disable() - Disable the clock for given id
602 * zynqmp_pm_clock_getstate() - Get the clock state for given id
624 * zynqmp_pm_clock_setdivider() - Set the clock divider for given id
640 * zynqmp_pm_clock_getdivider() - Get the clock divider for given id
662 * zynqmp_pm_clock_setparent() - Set the clock parent for given id
677 * zynqmp_pm_clock_getparent() - Get the clock parent for given id
699 * zynqmp_pm_set_pll_frac_mode() - PM API for set PLL mode
715 * zynqmp_pm_get_pll_frac_mode() - PM API for get PLL mode
731 * zynqmp_pm_set_pll_frac_data() - PM API for setting pll fraction data
748 * zynqmp_pm_get_pll_frac_data() - PM API for getting pll fraction data
764 * zynqmp_pm_set_sd_tapdelay() - Set tap delay for the SD device
796 * Use PM_MMIO_READ/PM_MMIO_WRITE to re-implement the missing counter in zynqmp_pm_set_sd_tapdelay()
804 * zynqmp_pm_sd_dll_reset() - Reset DLL logic
820 * zynqmp_pm_ospi_mux_select() - OSPI Mux selection
836 * zynqmp_pm_write_ggs() - PM API for writing global general storage (ggs)
851 * zynqmp_pm_read_ggs() - PM API for reading global general storage (ggs)
866 * zynqmp_pm_write_pggs() - PM API for writing persistent global general
882 * zynqmp_pm_read_pggs() - PM API for reading persistent global general
904 * zynqmp_pm_set_boot_health_status() - PM API for setting healthy boot status
918 * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release)
933 * zynqmp_pm_reset_get_status - Get status of the reset
945 return -EINVAL; in zynqmp_pm_reset_get_status()
955 * zynqmp_pm_fpga_load - Perform the fpga load
959 * -XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
960 * -XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
975 return -ret_payload[0]; in zynqmp_pm_fpga_load()
982 * zynqmp_pm_fpga_get_status - Read value from PCAP status register
996 return -EINVAL; in zynqmp_pm_fpga_get_status()
1006 * zynqmp_pm_fpga_get_config_status - Get the FPGA configuration status.
1021 return -EINVAL; in zynqmp_pm_fpga_get_config_status()
1037 * zynqmp_pm_pinctrl_request - Request Pin from firmware
1051 * zynqmp_pm_pinctrl_release - Inform firmware that Pin control is released
1065 * zynqmp_pm_pinctrl_set_function - Set requested function for the pin
1080 * zynqmp_pm_pinctrl_get_config - Get configuration parameter for the pin
1096 return -EINVAL; in zynqmp_pm_pinctrl_get_config()
1106 * zynqmp_pm_pinctrl_set_config - Set configuration parameter for the pin
1124 return -EOPNOTSUPP; in zynqmp_pm_pinctrl_set_config()
1132 * zynqmp_pm_bootmode_read() - PM Config API for read bootpin status
1154 * zynqmp_pm_bootmode_write() - PM Config API for Configure bootpin
1170 * zynqmp_pm_init_finalize() - PM call to inform firmware that the caller
1185 * zynqmp_pm_set_suspend_mode() - Set system suspend mode
1199 * zynqmp_pm_request_node() - Request a node with specific capabilities
1203 * @ack: Flag to specify whether acknowledge is requested
1211 const u32 qos, const enum zynqmp_pm_request_ack ack) in zynqmp_pm_request_node() argument
1213 return zynqmp_pm_invoke_fn(PM_REQUEST_NODE, NULL, 4, node, capabilities, qos, ack); in zynqmp_pm_request_node()
1218 * zynqmp_pm_release_node() - Release a node
1223 * without re-request.
1234 * zynqmp_pm_get_rpu_mode() - Get RPU mode
1259 * zynqmp_pm_set_rpu_mode() - Set RPU mode
1276 * zynqmp_pm_set_tcm_config - configure TCM
1293 * zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to
1296 * @ack: Flag to specify whether acknowledge is requested
1301 const enum zynqmp_pm_request_ack ack) in zynqmp_pm_force_pwrdwn() argument
1303 return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, NULL, 2, node, ack); in zynqmp_pm_force_pwrdwn()
1308 * zynqmp_pm_request_wake - PM call to wake up selected master or subsystem
1312 * @ack: Flag to specify whether acknowledge requested
1319 const enum zynqmp_pm_request_ack ack) in zynqmp_pm_request_wake() argument
1323 address >> 32, ack); in zynqmp_pm_request_wake()
1328 * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
1332 * @ack: Flag to specify whether acknowledge is requested
1341 const enum zynqmp_pm_request_ack ack) in zynqmp_pm_set_requirement() argument
1343 return zynqmp_pm_invoke_fn(PM_SET_REQUIREMENT, NULL, 4, node, capabilities, qos, ack); in zynqmp_pm_set_requirement()
1348 * zynqmp_pm_load_pdi - Load and process PDI
1364 * zynqmp_pm_aes_engine - Access AES hardware to encrypt/decrypt the data using
1365 * AES-GCM core.
1377 return -EINVAL; in zynqmp_pm_aes_engine()
1388 * zynqmp_pm_sha_hash - Access the SHA engine to calculate the hash
1393 * BIT(0) - for initializing csudma driver and SHA3(Here address
1395 * BIT(1) - to call Sha3_Update API which can be called multiple
1397 * BIT(2) - to get final hash of the whole updated data.
1413 * zynqmp_pm_register_notifier() - PM API for register a subsystem
1421 * This function is used to register/un-register for particular node-event
1435 * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart
1436 * @type: Shutdown or restart? 0 for shutdown, 1 for restart
1447 * zynqmp_pm_set_feature_config - PM call to request IOCTL for feature config
1459 * zynqmp_pm_get_feature_config - PM call to get value of configured feature
1472 * zynqmp_pm_set_sd_config - PM call to set value of SD config registers
1486 * zynqmp_pm_set_gem_config - PM call to set value of GEM config registers
1501 * struct zynqmp_pm_shutdown_scope - Struct for shutdown scope
1502 * @subtype: Shutdown subtype
1505 * This struct encapsulates mapping between shutdown scope ID and string.
1531 * zynqmp_pm_is_shutdown_scope_valid - Check if shutdown scope string is valid
1532 * @scope_string: Shutdown scope string
1534 * Return: Return pointer to matching shutdown scope struct from
1580 return -EINVAL; in shutdown_scope_store()
1583 scope->subtype); in shutdown_scope_store()
1585 pr_err("unable to set shutdown scope %s\n", buf); in shutdown_scope_store()
1643 return -EINVAL; in ggs_store()
1647 count = -EFAULT; in ggs_store()
1653 count = -EFAULT; in ggs_store()
1711 return -EINVAL; in pggs_store()
1715 count = -EFAULT; in pggs_store()
1721 count = -EFAULT; in pggs_store()
1774 return sysfs_emit(buf, "%d\n", devinfo->feature_conf_id); in feature_config_id_show()
1786 return -EINVAL; in feature_config_id_store()
1792 devinfo->feature_conf_id = config_id; in feature_config_id_store()
1807 ret = zynqmp_pm_get_feature_config(devinfo->feature_conf_id, in feature_config_value_show()
1824 return -EINVAL; in feature_config_value_store()
1830 ret = zynqmp_pm_set_feature_config(devinfo->feature_conf_id, in feature_config_value_store()
1860 struct device *dev = &pdev->dev; in zynqmp_firmware_probe()
1864 ret = get_set_conduit_method(dev->of_node); in zynqmp_firmware_probe()
1874 return -ENOMEM; in zynqmp_firmware_probe()
1876 devinfo->dev = dev; in zynqmp_firmware_probe()
1886 panic("%s Platform Management API version error. Expected: v%d.%d - Found: v%d.%d\n", in zynqmp_firmware_probe()
1906 panic("%s Trustzone version error. Expected: v%d.%d - Found: v%d.%d\n", in zynqmp_firmware_probe()
1914 ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, firmware_devs, in zynqmp_firmware_probe()
1917 dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret); in zynqmp_firmware_probe()
1924 em_dev = platform_device_register_data(&pdev->dev, "xlnx_event_manager", in zynqmp_firmware_probe()
1925 -1, NULL, 0); in zynqmp_firmware_probe()
1927 dev_err_probe(&pdev->dev, PTR_ERR(em_dev), "EM register fail with error\n"); in zynqmp_firmware_probe()
1930 return of_platform_populate(dev->of_node, NULL, NULL, dev); in zynqmp_firmware_probe()
1939 mfd_remove_devices(&pdev->dev); in zynqmp_firmware_remove()
1943 hash_del(&feature_data->hentry); in zynqmp_firmware_remove()
1951 {.compatible = "xlnx,zynqmp-firmware"},
1952 {.compatible = "xlnx,versal-firmware"},