Skip to content

Commit 72781f0

Browse files
Michal SimekPortia Stephens
authored andcommitted
firmware: xilinx: Add pm api function for PL readback
This patch adds PM API for performing PL configuration readback. Signed-off-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> State: pending Signed-off-by: Hsuan-Yu Lin <shane.lin@canonical.com>
1 parent 368f51b commit 72781f0

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

drivers/firmware/xilinx/zynqmp.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,37 @@ int zynqmp_pm_init_finalize(void)
959959
}
960960
EXPORT_SYMBOL_GPL(zynqmp_pm_init_finalize);
961961

962+
/**
963+
* zynqmp_pm_fpga_read - Perform the fpga configuration readback
964+
* @reg_numframes: Configuration register offset (or) Number of frames to read
965+
* @phys_address: Physical Address of the buffer
966+
* @readback_type: Type of fpga readback operation
967+
* @value: Value to read
968+
*
969+
* This function provides access to xilfpga library to perform
970+
* fpga configuration readback.
971+
*
972+
* Return: Returns status, either success or error+reason
973+
*/
974+
int zynqmp_pm_fpga_read(const u32 reg_numframes, const u64 phys_address,
975+
u32 readback_type, u32 *value)
976+
{
977+
u32 ret_payload[PAYLOAD_ARG_CNT];
978+
int ret;
979+
980+
if (!value)
981+
return -EINVAL;
982+
983+
ret = zynqmp_pm_invoke_fn(PM_FPGA_READ, reg_numframes,
984+
lower_32_bits(phys_address),
985+
upper_32_bits(phys_address), readback_type,
986+
ret_payload);
987+
*value = ret_payload[1];
988+
989+
return ret;
990+
}
991+
EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_read);
992+
962993
/**
963994
* zynqmp_pm_sha_hash - Access the SHA engine to calculate the hash
964995
* @address: Address of the data/ Address of output buffer where

include/linux/firmware/xlnx-zynqmp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ enum pm_api_id {
125125
PM_CLOCK_GETRATE = 42,
126126
PM_CLOCK_SETPARENT = 43,
127127
PM_CLOCK_GETPARENT = 44,
128+
PM_FPGA_READ = 46,
128129
PM_SECURE_AES = 47,
129130
/* PM_REGISTER_ACCESS API */
130131
PM_REGISTER_ACCESS = 52,
@@ -481,6 +482,8 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
481482
const enum zynqmp_pm_request_ack ack);
482483
int zynqmp_pm_aes_engine(const u64 address, u32 *out);
483484
int zynqmp_pm_efuse_access(const u64 address, u32 *out);
485+
int zynqmp_pm_fpga_read(const u32 reg_numframes, const u64 phys_address,
486+
u32 readback_type, u32 *value);
484487
int zynqmp_pm_sha_hash(const u64 address, const u32 size, const u32 flags);
485488
int zynqmp_pm_rsa(const u64 address, const u32 size, const u32 flags);
486489
int zynqmp_pm_config_reg_access(u32 register_access_id, u32 address, u32 mask,
@@ -854,6 +857,13 @@ static inline int zynqmp_pm_set_wakeup_source(const u32 target,
854857
return -ENODEV;
855858
}
856859

860+
static inline int zynqmp_pm_fpga_read(const u32 reg_numframes,
861+
const u64 phys_address, u32 readback_type,
862+
u32 *value)
863+
{
864+
return -ENODEV;
865+
}
866+
857867
static inline int zynqmp_pm_register_notifier(const u32 node, const u32 event,
858868
const u32 wake, const u32 enable)
859869
{

0 commit comments

Comments
 (0)