Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: firmware: xilinx: Add unique family code for all platforms

The family code is currently derived from the PMC_TAP_IDCODE register
value, but there are issues where Versal, Versal NET, and future
platforms share the same family code. Additionally for some platforms
have identical subfamily code, making it challenging to differentiate
between platforms based on the family and subfamily codes. To resolve
this, a new family code member is added to the platform data, initialized
with unique values. This change enables better platform distinction via
the compatible string.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Link: https://lore.kernel.org/r/20250701123851.1314531-3-jay.buddhabhatti@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>

authored by

Jay Buddhabhatti and committed by
Michal Simek
e66f4c35 ff1c629c

+34 -3
+29 -3
drivers/firmware/xilinx/zynqmp.c
··· 72 72 struct hlist_node hentry; 73 73 }; 74 74 75 + struct platform_fw_data { 76 + /* 77 + * Family code for platform. 78 + */ 79 + const u32 family_code; 80 + }; 81 + 82 + static struct platform_fw_data *active_platform_fw_data; 83 + 75 84 static const struct mfd_cell firmware_devs[] = { 76 85 { 77 86 .name = "zynqmp_power_controller", ··· 2061 2052 if (ret) 2062 2053 return ret; 2063 2054 2055 + /* Get platform-specific firmware data from device tree match */ 2056 + active_platform_fw_data = (struct platform_fw_data *)device_get_match_data(dev); 2057 + if (!active_platform_fw_data) 2058 + return -EINVAL; 2059 + 2064 2060 /* Get SiP SVC version number */ 2065 2061 ret = zynqmp_pm_get_sip_svc_version(&sip_svc_version); 2066 2062 if (ret) ··· 2166 2152 dev_warn(dev, "failed to release power management to firmware\n"); 2167 2153 } 2168 2154 2155 + static const struct platform_fw_data platform_fw_data_versal = { 2156 + .family_code = PM_VERSAL_FAMILY_CODE, 2157 + }; 2158 + 2159 + static const struct platform_fw_data platform_fw_data_versal_net = { 2160 + .family_code = PM_VERSAL_NET_FAMILY_CODE, 2161 + }; 2162 + 2163 + static const struct platform_fw_data platform_fw_data_zynqmp = { 2164 + .family_code = PM_ZYNQMP_FAMILY_CODE, 2165 + }; 2166 + 2169 2167 static const struct of_device_id zynqmp_firmware_of_match[] = { 2170 - {.compatible = "xlnx,zynqmp-firmware"}, 2171 - {.compatible = "xlnx,versal-firmware"}, 2172 - {.compatible = "xlnx,versal-net-firmware"}, 2168 + {.compatible = "xlnx,zynqmp-firmware", .data = &platform_fw_data_zynqmp}, 2169 + {.compatible = "xlnx,versal-firmware", .data = &platform_fw_data_versal}, 2170 + {.compatible = "xlnx,versal-net-firmware", .data = &platform_fw_data_versal_net}, 2173 2171 {}, 2174 2172 }; 2175 2173 MODULE_DEVICE_TABLE(of, zynqmp_firmware_of_match);
+5
include/linux/firmware/xlnx-zynqmp.h
··· 54 54 #define ZYNQMP_FAMILY_CODE 0x23 55 55 #define VERSAL_FAMILY_CODE 0x26 56 56 57 + /* Family codes */ 58 + #define PM_ZYNQMP_FAMILY_CODE 0x1 /* ZynqMP family code */ 59 + #define PM_VERSAL_FAMILY_CODE 0x2 /* Versal family code */ 60 + #define PM_VERSAL_NET_FAMILY_CODE 0x3 /* Versal NET family code */ 61 + 57 62 /* When all subfamily of platform need to support */ 58 63 #define ALL_SUB_FAMILY_CODE 0x00 59 64 #define VERSAL_SUB_FAMILY_CODE 0x01