Lines Matching +full:node +full:- +full:version

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] */
43 /* Firmware feature check version mask */
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 -EACCES; in zynqmp_pm_ret_code()
98 return -ECANCELED; in zynqmp_pm_ret_code()
100 return -EUSERS; in zynqmp_pm_ret_code()
105 return -EINVAL; in zynqmp_pm_ret_code()
112 return -ENODEV; in do_fw_call_fail()
122 * do_fw_call_smc() - Call system-level platform management layer (SMC)
150 * do_fw_call_hvc() - Call system-level platform management layer (HVC)
157 * HVC-based for communication through hypervisor
189 ret = -EOPNOTSUPP; in __do_feature_check_call()
205 if (feature_data->pm_api_id == api_id) in do_feature_check_call()
206 return feature_data->feature_status; in do_feature_check_call()
212 return -ENOMEM; in do_feature_check_call()
214 feature_data->pm_api_id = api_id; in do_feature_check_call()
217 feature_data->feature_status = ret; in do_feature_check_call()
218 hash_add(pm_api_features_map, &feature_data->hentry, api_id); in do_feature_check_call()
232 * zynqmp_pm_feature() - Check whether given feature is supported or not and
251 * zynqmp_pm_is_function_supported() - Check whether given IOCTL/QUERY function
265 return -EINVAL; in zynqmp_pm_is_function_supported()
267 /* Check feature check API version */ in zynqmp_pm_is_function_supported()
272 /* Check if feature check version 2 is supported or not */ in zynqmp_pm_is_function_supported()
285 return -EOPNOTSUPP; in zynqmp_pm_is_function_supported()
287 return -ENODATA; in zynqmp_pm_is_function_supported()
295 * zynqmp_pm_invoke_fn() - Invoke the system-level platform management layer
297 * @pm_api_id: Requested PM-API call
298 * @arg0: Argument 0 to requested PM-API call
299 * @arg1: Argument 1 to requested PM-API call
300 * @arg2: Argument 2 to requested PM-API call
301 * @arg3: Argument 3 to requested PM-API call
314 * PM_SIP_SVC - Registered ZynqMP SIP Service Call.
315 * PM_API_ID - Platform Management API ID.
361 * zynqmp_pm_get_api_version() - Get version number of PMU PM firmware
362 * @version: Returned version value
366 int zynqmp_pm_get_api_version(u32 *version) in zynqmp_pm_get_api_version() argument
371 if (!version) in zynqmp_pm_get_api_version()
372 return -EINVAL; in zynqmp_pm_get_api_version()
374 /* Check is PM API version already verified */ in zynqmp_pm_get_api_version()
376 *version = pm_api_version; in zynqmp_pm_get_api_version()
380 *version = ret_payload[1]; in zynqmp_pm_get_api_version()
387 * zynqmp_pm_get_chipid - Get silicon ID registers
389 * @version: version register
391 * Return: Returns the status of the operation and the idcode and version
392 * registers in @idcode and @version.
394 int zynqmp_pm_get_chipid(u32 *idcode, u32 *version) in zynqmp_pm_get_chipid() argument
399 if (!idcode || !version) in zynqmp_pm_get_chipid()
400 return -EINVAL; in zynqmp_pm_get_chipid()
404 *version = ret_payload[2]; in zynqmp_pm_get_chipid()
411 * zynqmp_pm_get_family_info() - Get family info of platform
413 * @subfamily: Returned sub-family code value
423 /* Check is family or sub-family code already received */ in zynqmp_pm_get_family_info()
444 * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version
445 * @version: Returned version value
449 static int zynqmp_pm_get_trustzone_version(u32 *version) in zynqmp_pm_get_trustzone_version() argument
454 if (!version) in zynqmp_pm_get_trustzone_version()
455 return -EINVAL; in zynqmp_pm_get_trustzone_version()
457 /* Check is PM trustzone version already verified */ in zynqmp_pm_get_trustzone_version()
459 *version = pm_tz_version; in zynqmp_pm_get_trustzone_version()
464 *version = ret_payload[1]; in zynqmp_pm_get_trustzone_version()
470 * get_set_conduit_method() - Choose SMC or HVC based communication
473 * Use SMC or HVC-based functions to communicate with EL2/EL3.
483 return -ENXIO; in get_set_conduit_method()
493 return -EINVAL; in get_set_conduit_method()
500 * zynqmp_pm_query_data() - Get query data from firmware
523 * zynqmp_pm_clock_enable() - Enable the clock for given id
538 * zynqmp_pm_clock_disable() - Disable the clock for given id
553 * zynqmp_pm_clock_getstate() - Get the clock state for given id
576 * zynqmp_pm_clock_setdivider() - Set the clock divider for given id
593 * zynqmp_pm_clock_getdivider() - Get the clock divider for given id
616 * zynqmp_pm_clock_setrate() - Set the clock rate for given id
634 * zynqmp_pm_clock_getrate() - Get the clock rate for given id
657 * zynqmp_pm_clock_setparent() - Set the clock parent for given id
673 * zynqmp_pm_clock_getparent() - Get the clock parent for given id
696 * zynqmp_pm_set_pll_frac_mode() - PM API for set PLL mode
713 * zynqmp_pm_get_pll_frac_mode() - PM API for get PLL mode
730 * 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
765 * zynqmp_pm_set_sd_tapdelay() - Set tap delay for the SD device
767 * @node_id: Node ID of the device
798 * Use PM_MMIO_READ/PM_MMIO_WRITE to re-implement the missing counter in zynqmp_pm_set_sd_tapdelay()
806 * zynqmp_pm_sd_dll_reset() - Reset DLL logic
808 * @node_id: Node ID of the device
823 * zynqmp_pm_ospi_mux_select() - OSPI Mux selection
840 * zynqmp_pm_write_ggs() - PM API for writing global general storage (ggs)
856 * zynqmp_pm_read_ggs() - PM API for reading global general storage (ggs)
872 * zynqmp_pm_write_pggs() - PM API for writing persistent global general
889 * zynqmp_pm_read_pggs() - PM API for reading persistent global general
913 * zynqmp_pm_set_boot_health_status() - PM API for setting healthy boot status
928 * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release)
944 * zynqmp_pm_reset_get_status - Get status of the reset
956 return -EINVAL; in zynqmp_pm_reset_get_status()
967 * zynqmp_pm_fpga_load - Perform the fpga load
971 * -XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
972 * -XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
988 return -ret_payload[0]; in zynqmp_pm_fpga_load()
995 * zynqmp_pm_fpga_get_status - Read value from PCAP status register
1009 return -EINVAL; in zynqmp_pm_fpga_get_status()
1019 * zynqmp_pm_fpga_get_config_status - Get the FPGA configuration status.
1034 return -EINVAL; in zynqmp_pm_fpga_get_config_status()
1052 * zynqmp_pm_pinctrl_request - Request Pin from firmware
1066 * zynqmp_pm_pinctrl_release - Inform firmware that Pin control is released
1080 * zynqmp_pm_pinctrl_get_function - Read function id set for the given pin
1094 return -EINVAL; in zynqmp_pm_pinctrl_get_function()
1105 * zynqmp_pm_pinctrl_set_function - Set requested function for the pin
1121 * zynqmp_pm_pinctrl_get_config - Get configuration parameter for the pin
1137 return -EINVAL; in zynqmp_pm_pinctrl_get_config()
1148 * zynqmp_pm_pinctrl_set_config - Set configuration parameter for the pin
1166 return -EOPNOTSUPP; in zynqmp_pm_pinctrl_set_config()
1175 * zynqmp_pm_bootmode_read() - PM Config API for read bootpin status
1198 * zynqmp_pm_bootmode_write() - PM Config API for Configure bootpin
1214 * zynqmp_pm_init_finalize() - PM call to inform firmware that the caller
1229 * zynqmp_pm_set_suspend_mode() - Set system suspend mode
1243 * zynqmp_pm_request_node() - Request a node with specific capabilities
1244 * @node: Node ID of the slave
1249 * This function is used by master to request particular node from firmware.
1250 * Every master must request node before using it.
1254 int zynqmp_pm_request_node(const u32 node, const u32 capabilities, in zynqmp_pm_request_node() argument
1257 return zynqmp_pm_invoke_fn(PM_REQUEST_NODE, node, capabilities, in zynqmp_pm_request_node()
1263 * zynqmp_pm_release_node() - Release a node
1264 * @node: Node ID of the slave
1267 * has released node. Once released, master must not use that node
1268 * without re-request.
1272 int zynqmp_pm_release_node(const u32 node) in zynqmp_pm_release_node() argument
1274 return zynqmp_pm_invoke_fn(PM_RELEASE_NODE, node, 0, 0, 0, NULL); in zynqmp_pm_release_node()
1279 * zynqmp_pm_get_rpu_mode() - Get RPU mode
1280 * @node_id: Node ID of the device
1305 * zynqmp_pm_set_rpu_mode() - Set RPU mode
1306 * @node_id: Node ID of the device
1323 * zynqmp_pm_set_tcm_config - configure TCM
1341 * zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to
1343 * @node: Node ID of the targeted PU or subsystem
1348 int zynqmp_pm_force_pwrdwn(const u32 node, in zynqmp_pm_force_pwrdwn() argument
1351 return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, node, ack, 0, 0, NULL); in zynqmp_pm_force_pwrdwn()
1356 * zynqmp_pm_request_wake - PM call to wake up selected master or subsystem
1357 * @node: Node ID of the master or subsystem
1364 int zynqmp_pm_request_wake(const u32 node, in zynqmp_pm_request_wake() argument
1370 return zynqmp_pm_invoke_fn(PM_REQUEST_WAKEUP, node, address | set_addr, in zynqmp_pm_request_wake()
1376 * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
1377 * @node: Node ID of the slave
1387 int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, in zynqmp_pm_set_requirement() argument
1391 return zynqmp_pm_invoke_fn(PM_SET_REQUIREMENT, node, capabilities, in zynqmp_pm_set_requirement()
1397 * zynqmp_pm_load_pdi - Load and process PDI
1414 * zynqmp_pm_aes_engine - Access AES hardware to encrypt/decrypt the data using
1415 * AES-GCM core.
1427 return -EINVAL; in zynqmp_pm_aes_engine()
1439 * zynqmp_pm_sha_hash - Access the SHA engine to calculate the hash
1444 * BIT(0) - for initializing csudma driver and SHA3(Here address
1446 * BIT(1) - to call Sha3_Update API which can be called multiple
1448 * BIT(2) - to get final hash of the whole updated data.
1465 * zynqmp_pm_register_notifier() - PM API for register a subsystem
1468 * @node: Node ID to which the event is related.
1473 * This function is used to register/un-register for particular node-event
1479 int zynqmp_pm_register_notifier(const u32 node, const u32 event, in zynqmp_pm_register_notifier() argument
1482 return zynqmp_pm_invoke_fn(PM_REGISTER_NOTIFIER, node, event, in zynqmp_pm_register_notifier()
1488 * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart
1501 * zynqmp_pm_set_feature_config - PM call to request IOCTL for feature config
1514 * zynqmp_pm_get_feature_config - PM call to get value of configured feature
1528 * zynqmp_pm_set_sd_config - PM call to set value of SD config registers
1529 * @node: SD node ID
1535 int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value) in zynqmp_pm_set_sd_config() argument
1537 return zynqmp_pm_invoke_fn(PM_IOCTL, node, IOCTL_SET_SD_CONFIG, in zynqmp_pm_set_sd_config()
1543 * zynqmp_pm_set_gem_config - PM call to set value of GEM config registers
1544 * @node: GEM node ID
1550 int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, in zynqmp_pm_set_gem_config() argument
1553 return zynqmp_pm_invoke_fn(PM_IOCTL, node, IOCTL_SET_GEM_CONFIG, in zynqmp_pm_set_gem_config()
1559 * struct zynqmp_pm_shutdown_scope - Struct for shutdown scope
1589 * zynqmp_pm_is_shutdown_scope_valid - Check if shutdown scope string is valid
1638 return -EINVAL; in shutdown_scope_store()
1641 scope->subtype); in shutdown_scope_store()
1701 return -EINVAL; in ggs_store()
1705 count = -EFAULT; in ggs_store()
1711 count = -EFAULT; in ggs_store()
1769 return -EINVAL; in pggs_store()
1773 count = -EFAULT; in pggs_store()
1779 count = -EFAULT; in pggs_store()
1832 return sysfs_emit(buf, "%d\n", devinfo->feature_conf_id); in feature_config_id_show()
1844 return -EINVAL; in feature_config_id_store()
1850 devinfo->feature_conf_id = config_id; in feature_config_id_store()
1865 ret = zynqmp_pm_get_feature_config(devinfo->feature_conf_id, in feature_config_value_show()
1882 return -EINVAL; in feature_config_value_store()
1888 ret = zynqmp_pm_set_feature_config(devinfo->feature_conf_id, in feature_config_value_store()
1918 struct device *dev = &pdev->dev; in zynqmp_firmware_probe()
1923 ret = get_set_conduit_method(dev->of_node); in zynqmp_firmware_probe()
1946 return -ENOMEM; in zynqmp_firmware_probe()
1948 devinfo->dev = dev; in zynqmp_firmware_probe()
1952 /* Check PM API version number */ in zynqmp_firmware_probe()
1958 panic("%s Platform Management API version error. Expected: v%d.%d - Found: v%d.%d\n", in zynqmp_firmware_probe()
1972 /* Check trustzone version number */ in zynqmp_firmware_probe()
1975 panic("Legacy trustzone found without version support\n"); in zynqmp_firmware_probe()
1978 panic("%s Trustzone version error. Expected: v%d.%d - Found: v%d.%d\n", in zynqmp_firmware_probe()
1983 pr_info("%s Trustzone version v%d.%d\n", __func__, in zynqmp_firmware_probe()
1986 ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, firmware_devs, in zynqmp_firmware_probe()
1989 dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret); in zynqmp_firmware_probe()
1997 em_dev = platform_device_register_data(&pdev->dev, "xlnx_event_manager", in zynqmp_firmware_probe()
1998 -1, NULL, 0); in zynqmp_firmware_probe()
2000 dev_err_probe(&pdev->dev, PTR_ERR(em_dev), "EM register fail with error\n"); in zynqmp_firmware_probe()
2004 return of_platform_populate(dev->of_node, NULL, NULL, dev); in zynqmp_firmware_probe()
2013 mfd_remove_devices(&pdev->dev); in zynqmp_firmware_remove()
2017 hash_del(&feature_data->hentry); in zynqmp_firmware_remove()
2027 {.compatible = "xlnx,zynqmp-firmware"},
2028 {.compatible = "xlnx,versal-firmware"},