From: Nava kishore Manne <nava.manne@xilinx.com> To: <michal.simek@xilinx.com>, <mdf@kernel.org>, <hao.wu@intel.com>, <yilun.xu@intel.com>, <trix@redhat.com>, <gregkh@linuxfoundation.org>, <ronak.jain@xilinx.com>, <abhyuday.godhasara@xilinx.com>, <rajan.vaja@xilinx.com>, <nava.manne@xilinx.com>, <lakshmi.sai.krishna.potthuri@xilinx.com>, <piyush.mehta@xilinx.com>, <harsha.harsha@xilinx.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-fpga@vger.kernel.org>, <git@xilinx.com> Subject: [PATCH 2/3] firmware: xilinx: Add pm api function for PL readback Date: Tue, 24 May 2022 15:17:44 +0530 [thread overview] Message-ID: <20220524094745.287002-3-nava.manne@xilinx.com> (raw) In-Reply-To: <20220524094745.287002-1-nava.manne@xilinx.com> Adds PM API for performing PL configuration readback. It provides an interface to the pmufw to readback the FPGA configuration registers as well as configuration data. For more detailed info related to the configuration registers and configuration data refer ug570. Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com> --- drivers/firmware/xilinx/zynqmp.c | 33 ++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 14 ++++++++++++ 2 files changed, 47 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 7977a494a651..40b99299b662 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -927,6 +927,39 @@ int zynqmp_pm_fpga_get_status(u32 *value) } EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_get_status); +/** + * zynqmp_pm_fpga_read - Perform the fpga configuration readback + * @reg_numframes: Configuration register offset (or) Number of frames to read + * @phys_address: Physical Address of the buffer + * @readback_type: Type of fpga readback operation + * 0 - FPGA configuration register readback + * 1 - FPGA configuration data readback + * @value: Value to read + * + * This function provides access to xilfpga library to perform + * fpga configuration readback. + * + * Return: Returns status, either success or error+reason + */ +int zynqmp_pm_fpga_read(const u32 reg_numframes, const phys_addr_t phys_address, + bool readback_type, u32 *value) +{ + u32 ret_payload[PAYLOAD_ARG_CNT]; + int ret; + + if (!value) + return -EINVAL; + + ret = zynqmp_pm_invoke_fn(PM_FPGA_READ, reg_numframes, + lower_32_bits(phys_address), + upper_32_bits(phys_address), readback_type, + ret_payload); + *value = ret_payload[1]; + + return ret; +} +EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_read); + /** * zynqmp_pm_pinctrl_request - Request Pin from firmware * @pin: Pin number to request diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 1ec73d5352c3..7dc4981345dc 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -61,6 +61,10 @@ #define PM_LOAD_PDI 0x701 #define PDI_SRC_DDR 0xF +/* FPGA readback type */ +#define PM_FPGA_READ_CONFIG_REG 0x0U +#define PM_FPGA_READ_CONFIG_DATA 0x1U + /* * Firmware FPGA Manager flags * XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration @@ -116,6 +120,7 @@ enum pm_api_id { PM_CLOCK_GETRATE = 42, PM_CLOCK_SETPARENT = 43, PM_CLOCK_GETPARENT = 44, + PM_FPGA_READ = 46, PM_SECURE_AES = 47, PM_FEATURE_CHECK = 63, }; @@ -468,6 +473,8 @@ int zynqmp_pm_feature(const u32 api_id); int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value); int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload); +int zynqmp_pm_fpga_read(const u32 reg_numframes, const phys_addr_t phys_address, + bool readback_type, u32 *value); #else static inline int zynqmp_pm_get_api_version(u32 *version) { @@ -733,6 +740,13 @@ static inline int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, { return -ENODEV; } + +static int zynqmp_pm_fpga_read(const u32 reg_numframes, + const phys_addr_t phys_address, + bool readback_type, u32 *value); +{ + return -ENODEV; +} #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Nava kishore Manne <nava.manne@xilinx.com> To: <michal.simek@xilinx.com>, <mdf@kernel.org>, <hao.wu@intel.com>, <yilun.xu@intel.com>, <trix@redhat.com>, <gregkh@linuxfoundation.org>, <ronak.jain@xilinx.com>, <abhyuday.godhasara@xilinx.com>, <rajan.vaja@xilinx.com>, <nava.manne@xilinx.com>, <lakshmi.sai.krishna.potthuri@xilinx.com>, <piyush.mehta@xilinx.com>, <harsha.harsha@xilinx.com>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <linux-fpga@vger.kernel.org>, <git@xilinx.com> Subject: [PATCH 2/3] firmware: xilinx: Add pm api function for PL readback Date: Tue, 24 May 2022 15:17:44 +0530 [thread overview] Message-ID: <20220524094745.287002-3-nava.manne@xilinx.com> (raw) In-Reply-To: <20220524094745.287002-1-nava.manne@xilinx.com> Adds PM API for performing PL configuration readback. It provides an interface to the pmufw to readback the FPGA configuration registers as well as configuration data. For more detailed info related to the configuration registers and configuration data refer ug570. Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com> --- drivers/firmware/xilinx/zynqmp.c | 33 ++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 14 ++++++++++++ 2 files changed, 47 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 7977a494a651..40b99299b662 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -927,6 +927,39 @@ int zynqmp_pm_fpga_get_status(u32 *value) } EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_get_status); +/** + * zynqmp_pm_fpga_read - Perform the fpga configuration readback + * @reg_numframes: Configuration register offset (or) Number of frames to read + * @phys_address: Physical Address of the buffer + * @readback_type: Type of fpga readback operation + * 0 - FPGA configuration register readback + * 1 - FPGA configuration data readback + * @value: Value to read + * + * This function provides access to xilfpga library to perform + * fpga configuration readback. + * + * Return: Returns status, either success or error+reason + */ +int zynqmp_pm_fpga_read(const u32 reg_numframes, const phys_addr_t phys_address, + bool readback_type, u32 *value) +{ + u32 ret_payload[PAYLOAD_ARG_CNT]; + int ret; + + if (!value) + return -EINVAL; + + ret = zynqmp_pm_invoke_fn(PM_FPGA_READ, reg_numframes, + lower_32_bits(phys_address), + upper_32_bits(phys_address), readback_type, + ret_payload); + *value = ret_payload[1]; + + return ret; +} +EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_read); + /** * zynqmp_pm_pinctrl_request - Request Pin from firmware * @pin: Pin number to request diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 1ec73d5352c3..7dc4981345dc 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -61,6 +61,10 @@ #define PM_LOAD_PDI 0x701 #define PDI_SRC_DDR 0xF +/* FPGA readback type */ +#define PM_FPGA_READ_CONFIG_REG 0x0U +#define PM_FPGA_READ_CONFIG_DATA 0x1U + /* * Firmware FPGA Manager flags * XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration @@ -116,6 +120,7 @@ enum pm_api_id { PM_CLOCK_GETRATE = 42, PM_CLOCK_SETPARENT = 43, PM_CLOCK_GETPARENT = 44, + PM_FPGA_READ = 46, PM_SECURE_AES = 47, PM_FEATURE_CHECK = 63, }; @@ -468,6 +473,8 @@ int zynqmp_pm_feature(const u32 api_id); int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value); int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload); +int zynqmp_pm_fpga_read(const u32 reg_numframes, const phys_addr_t phys_address, + bool readback_type, u32 *value); #else static inline int zynqmp_pm_get_api_version(u32 *version) { @@ -733,6 +740,13 @@ static inline int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, { return -ENODEV; } + +static int zynqmp_pm_fpga_read(const u32 reg_numframes, + const phys_addr_t phys_address, + bool readback_type, u32 *value); +{ + return -ENODEV; +} #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-05-24 9:51 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-24 9:47 [PATCH 0/3]Adds status interface for zynqmp-fpga Nava kishore Manne 2022-05-24 9:47 ` Nava kishore Manne 2022-05-24 9:47 ` [PATCH 1/3] fpga: mgr: Update the status for fpga-manager Nava kishore Manne 2022-05-24 9:47 ` Nava kishore Manne 2022-05-24 9:47 ` Nava kishore Manne [this message] 2022-05-24 9:47 ` [PATCH 2/3] firmware: xilinx: Add pm api function for PL readback Nava kishore Manne 2022-05-24 13:10 ` kernel test robot 2022-05-24 13:10 ` kernel test robot 2022-05-24 14:41 ` kernel test robot 2022-05-24 14:41 ` kernel test robot 2022-05-24 9:47 ` [PATCH 3/3] fpga: zynqmp-fpga: Adds status interface Nava kishore Manne 2022-05-24 9:47 ` Nava kishore Manne 2022-05-28 15:21 ` Xu Yilun 2022-05-28 15:21 ` Xu Yilun 2022-06-07 5:41 ` Nava kishore Manne 2022-06-07 5:41 ` Nava kishore Manne
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220524094745.287002-3-nava.manne@xilinx.com \ --to=nava.manne@xilinx.com \ --cc=abhyuday.godhasara@xilinx.com \ --cc=git@xilinx.com \ --cc=gregkh@linuxfoundation.org \ --cc=hao.wu@intel.com \ --cc=harsha.harsha@xilinx.com \ --cc=lakshmi.sai.krishna.potthuri@xilinx.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-fpga@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mdf@kernel.org \ --cc=michal.simek@xilinx.com \ --cc=piyush.mehta@xilinx.com \ --cc=rajan.vaja@xilinx.com \ --cc=ronak.jain@xilinx.com \ --cc=trix@redhat.com \ --cc=yilun.xu@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.