Lines Matching +full:partial +full:- +full:fpga +full:- +full:config
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2014-2022 Xilinx, Inc.
6 * Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc.
14 #include <linux/arm-smccc.h>
27 #include <linux/firmware/xlnx-zynqmp.h>
28 #include <linux/firmware/xlnx-event-manager.h>
29 #include "zynqmp-debug.h"
36 /* BOOT_PIN_CTRL- Used to control the mode pins after boot */
38 /* BOOT_PIN_CTRL_MASK- out_val[11:8], out_en[3:0] */
53 * struct zynqmp_devinfo - Structure for Zynqmp device instance
63 * struct pm_api_feature_data - PM API Feature data
81 * zynqmp_pm_ret_code() - Convert PMU-FW error codes to Linux error codes
93 return -ENOTSUPP; in zynqmp_pm_ret_code()
95 return -EOPNOTSUPP; in zynqmp_pm_ret_code()
97 return -EACCES; in zynqmp_pm_ret_code()
99 return -ECANCELED; in zynqmp_pm_ret_code()
101 return -EUSERS; in zynqmp_pm_ret_code()
107 return -EINVAL; in zynqmp_pm_ret_code()
113 return -ENODEV; in do_fw_call_fail()
123 * do_fw_call_smc() - Call system-level platform management layer (SMC)
139 return -EINVAL; in do_fw_call_smc()
164 * do_fw_call_hvc() - Call system-level platform management layer (HVC)
169 * HVC-based for communication through hypervisor
182 return -EINVAL; in do_fw_call_hvc()
216 * Feature check of APIs belonging to PM, XSEM, and TF-A are handled by calling in __do_feature_check_call()
225 * Feature check of TF-A APIs is done in the TF-A layer and it expects for in __do_feature_check_call()
239 ret = -EOPNOTSUPP; in __do_feature_check_call()
255 if (feature_data->pm_api_id == api_id) in do_feature_check_call()
256 return feature_data->feature_status; in do_feature_check_call()
262 return -ENOMEM; in do_feature_check_call()
264 feature_data->pm_api_id = api_id; in do_feature_check_call()
267 feature_data->feature_status = ret; in do_feature_check_call()
268 hash_add(pm_api_features_map, &feature_data->hentry, api_id); in do_feature_check_call()
281 * zynqmp_pm_feature() - Check whether given feature is supported or not and
301 * zynqmp_pm_is_function_supported() - Check whether given IOCTL/QUERY function
315 return -EINVAL; in zynqmp_pm_is_function_supported()
335 return -EOPNOTSUPP; in zynqmp_pm_is_function_supported()
337 return -ENODATA; in zynqmp_pm_is_function_supported()
345 * zynqmp_pm_invoke_fw_fn() - Invoke the system-level platform management layer
347 * @pm_api_id: Requested PM-API call
349 * @num_args: Number of arguments to requested PM-API call
361 * PM_SIP_SVC - Registered ZynqMP SIP Service Call.
362 * PASS_THROUGH_FW_CMD_ID - Fixed SiP SVC call ID for FW specific calls.
379 return -EINVAL; in zynqmp_pm_invoke_fw_fn()
401 for (i = 1; i < (SMC_ARG_CNT_64 - 1); i++) in zynqmp_pm_invoke_fw_fn()
402 smc_arg[i + 1] = ((u64)args[(i * 2)] << 32U) | args[(i * 2) - 1]; in zynqmp_pm_invoke_fw_fn()
409 * zynqmp_pm_invoke_fn() - Invoke the system-level platform management layer
411 * @pm_api_id: Requested PM-API call
413 * @num_args: Number of arguments to requested PM-API call
425 * PM_SIP_SVC - Registered ZynqMP SIP Service Call.
426 * PM_API_ID - Platform Management API ID.
442 return -EINVAL; in zynqmp_pm_invoke_fn()
474 if (ret != -EOPNOTSUPP && !ret) in zynqmp_pm_register_sgi()
482 * zynqmp_pm_get_api_version() - Get version number of PMU PM firmware
493 return -EINVAL; in zynqmp_pm_get_api_version()
508 * zynqmp_pm_get_chipid - Get silicon ID registers
521 return -EINVAL; in zynqmp_pm_get_chipid()
532 * zynqmp_pm_get_family_info() - Get family info of platform
534 * @subfamily: Returned sub-family code value
544 /* Check is family or sub-family code already received */ in zynqmp_pm_get_family_info()
566 * zynqmp_pm_get_sip_svc_version() - Get SiP service call version
577 return -EINVAL; in zynqmp_pm_get_sip_svc_version()
595 * zynqmp_pm_get_trustzone_version() - Get secure trustzone firmware version
606 return -EINVAL; in zynqmp_pm_get_trustzone_version()
620 * get_set_conduit_method() - Choose SMC or HVC based communication
623 * Use SMC or HVC-based functions to communicate with EL2/EL3.
633 return -ENXIO; in get_set_conduit_method()
643 return -EINVAL; in get_set_conduit_method()
650 * zynqmp_pm_query_data() - Get query data from firmware
668 * TF-A passes return status on 0th index but in zynqmp_pm_query_data()
697 * zynqmp_pm_clock_enable() - Enable the clock for given id
712 * zynqmp_pm_clock_disable() - Disable the clock for given id
727 * zynqmp_pm_clock_getstate() - Get the clock state for given id
749 * zynqmp_pm_clock_setdivider() - Set the clock divider for given id
765 * zynqmp_pm_clock_getdivider() - Get the clock divider for given id
787 * zynqmp_pm_clock_setparent() - Set the clock parent for given id
802 * zynqmp_pm_clock_getparent() - Get the clock parent for given id
824 * zynqmp_pm_set_pll_frac_mode() - PM API for set PLL mode
840 * zynqmp_pm_get_pll_frac_mode() - PM API for get PLL mode
856 * zynqmp_pm_set_pll_frac_data() - PM API for setting pll fraction data
873 * zynqmp_pm_get_pll_frac_data() - PM API for getting pll fraction data
889 * zynqmp_pm_set_sd_tapdelay() - Set tap delay for the SD device
921 * Use PM_MMIO_READ/PM_MMIO_WRITE to re-implement the missing counter in zynqmp_pm_set_sd_tapdelay()
929 * zynqmp_pm_sd_dll_reset() - Reset DLL logic
945 * zynqmp_pm_ospi_mux_select() - OSPI Mux selection
961 * zynqmp_pm_write_ggs() - PM API for writing global general storage (ggs)
976 * zynqmp_pm_read_ggs() - PM API for reading global general storage (ggs)
991 * zynqmp_pm_write_pggs() - PM API for writing persistent global general
1007 * zynqmp_pm_read_pggs() - PM API for reading persistent global general
1029 * zynqmp_pm_set_boot_health_status() - PM API for setting healthy boot status
1043 * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release)
1058 * zynqmp_pm_reset_get_status - Get status of the reset
1070 return -EINVAL; in zynqmp_pm_reset_get_status()
1080 * zynqmp_pm_fpga_load - Perform the fpga load
1084 * -XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
1085 * -XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
1100 return -ret_payload[0]; in zynqmp_pm_fpga_load()
1107 * zynqmp_pm_fpga_get_status - Read value from PCAP status register
1121 return -EINVAL; in zynqmp_pm_fpga_get_status()
1131 * zynqmp_pm_fpga_get_config_status - Get the FPGA configuration status.
1132 * @value: Buffer to store FPGA configuration status.
1134 * This function provides access to the pmufw to get the FPGA configuration
1146 return -EINVAL; in zynqmp_pm_fpga_get_config_status()
1162 * zynqmp_pm_pinctrl_request - Request Pin from firmware
1176 * zynqmp_pm_pinctrl_release - Inform firmware that Pin control is released
1190 * zynqmp_pm_pinctrl_set_function - Set requested function for the pin
1205 * zynqmp_pm_pinctrl_get_config - Get configuration parameter for the pin
1221 return -EINVAL; in zynqmp_pm_pinctrl_get_config()
1231 * zynqmp_pm_pinctrl_set_config - Set configuration parameter for the pin
1251 return -EOPNOTSUPP; in zynqmp_pm_pinctrl_set_config()
1260 * zynqmp_pm_bootmode_read() - PM Config API for read bootpin status
1282 * zynqmp_pm_bootmode_write() - PM Config API for Configure bootpin
1298 * zynqmp_pm_init_finalize() - PM call to inform firmware that the caller
1313 * zynqmp_pm_set_suspend_mode() - Set system suspend mode
1327 * zynqmp_pm_request_node() - Request a node with specific capabilities
1346 * zynqmp_pm_release_node() - Release a node
1351 * without re-request.
1362 * zynqmp_pm_get_rpu_mode() - Get RPU mode
1387 * zynqmp_pm_set_rpu_mode() - Set RPU mode
1404 * zynqmp_pm_set_tcm_config - configure TCM
1421 * zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to
1436 * zynqmp_pm_request_wake - PM call to wake up selected master or subsystem
1456 * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves
1476 * zynqmp_pm_load_pdi - Load and process PDI
1492 * zynqmp_pm_aes_engine - Access AES hardware to encrypt/decrypt the data using
1493 * AES-GCM core.
1505 return -EINVAL; in zynqmp_pm_aes_engine()
1516 * zynqmp_pm_efuse_access - Provides access to efuse memory.
1528 return -EINVAL; in zynqmp_pm_efuse_access()
1540 * zynqmp_pm_sha_hash - Access the SHA engine to calculate the hash
1545 * BIT(0) - for initializing csudma driver and SHA3(Here address
1547 * BIT(1) - to call Sha3_Update API which can be called multiple
1549 * BIT(2) - to get final hash of the whole updated data.
1565 * zynqmp_pm_register_notifier() - PM API for register a subsystem
1573 * This function is used to register/un-register for particular node-event
1587 * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart
1599 * zynqmp_pm_set_feature_config - PM call to request IOCTL for feature config
1600 * @id: The config ID of the feature to be configured
1601 * @value: The config value of the feature to be configured
1611 * zynqmp_pm_get_feature_config - PM call to get value of configured feature
1612 * @id: The config id of the feature to be queried
1624 * zynqmp_pm_set_sd_config - PM call to set value of SD config registers
1626 * @config: The config type of SD registers
1631 int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value) in zynqmp_pm_set_sd_config() argument
1633 return zynqmp_pm_invoke_fn(PM_IOCTL, NULL, 4, node, IOCTL_SET_SD_CONFIG, config, value); in zynqmp_pm_set_sd_config()
1638 * zynqmp_pm_set_gem_config - PM call to set value of GEM config registers
1640 * @config: The config type of GEM registers
1645 int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, in zynqmp_pm_set_gem_config() argument
1648 return zynqmp_pm_invoke_fn(PM_IOCTL, NULL, 4, node, IOCTL_SET_GEM_CONFIG, config, value); in zynqmp_pm_set_gem_config()
1653 * struct zynqmp_pm_shutdown_scope - Struct for shutdown scope
1683 * zynqmp_pm_is_shutdown_scope_valid - Check if shutdown scope string is valid
1732 return -EINVAL; in shutdown_scope_store()
1735 scope->subtype); in shutdown_scope_store()
1795 return -EINVAL; in ggs_store()
1799 count = -EFAULT; in ggs_store()
1805 count = -EFAULT; in ggs_store()
1863 return -EINVAL; in pggs_store()
1867 count = -EFAULT; in pggs_store()
1873 count = -EFAULT; in pggs_store()
1926 return sysfs_emit(buf, "%d\n", devinfo->feature_conf_id); in feature_config_id_show()
1938 return -EINVAL; in feature_config_id_store()
1944 devinfo->feature_conf_id = config_id; in feature_config_id_store()
1959 ret = zynqmp_pm_get_feature_config(devinfo->feature_conf_id, in feature_config_value_show()
1976 return -EINVAL; in feature_config_value_store()
1982 ret = zynqmp_pm_set_feature_config(devinfo->feature_conf_id, in feature_config_value_store()
2012 struct device *dev = &pdev->dev; in zynqmp_firmware_probe()
2016 ret = get_set_conduit_method(dev->of_node); in zynqmp_firmware_probe()
2031 return -ENOMEM; in zynqmp_firmware_probe()
2033 devinfo->dev = dev; in zynqmp_firmware_probe()
2043 panic("%s Platform Management API version error. Expected: v%d.%d - Found: v%d.%d\n", in zynqmp_firmware_probe()
2063 panic("%s Trustzone version error. Expected: v%d.%d - Found: v%d.%d\n", in zynqmp_firmware_probe()
2071 ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, firmware_devs, in zynqmp_firmware_probe()
2074 dev_err(&pdev->dev, "failed to add MFD devices %d\n", ret); in zynqmp_firmware_probe()
2081 em_dev = platform_device_register_data(&pdev->dev, "xlnx_event_manager", in zynqmp_firmware_probe()
2082 -1, NULL, 0); in zynqmp_firmware_probe()
2084 dev_err_probe(&pdev->dev, PTR_ERR(em_dev), "EM register fail with error\n"); in zynqmp_firmware_probe()
2087 return of_platform_populate(dev->of_node, NULL, NULL, dev); in zynqmp_firmware_probe()
2096 mfd_remove_devices(&pdev->dev); in zynqmp_firmware_remove()
2100 hash_del(&feature_data->hentry); in zynqmp_firmware_remove()
2108 {.compatible = "xlnx,zynqmp-firmware"},
2109 {.compatible = "xlnx,versal-firmware"},