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

firmware: xilinx: Add reset API's

This Patch Adds reset API's to support release, assert
and status functionalities by using firmware interface.

Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

authored by

Nava kishore Manne and committed by
Michal Simek
bc3843d4 bfeffd15

+176
+40
drivers/firmware/xilinx/zynqmp.c
··· 469 469 arg1, arg2, out); 470 470 } 471 471 472 + /** 473 + * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release) 474 + * @reset: Reset to be configured 475 + * @assert_flag: Flag stating should reset be asserted (1) or 476 + * released (0) 477 + * 478 + * Return: Returns status, either success or error+reason 479 + */ 480 + static int zynqmp_pm_reset_assert(const enum zynqmp_pm_reset reset, 481 + const enum zynqmp_pm_reset_action assert_flag) 482 + { 483 + return zynqmp_pm_invoke_fn(PM_RESET_ASSERT, reset, assert_flag, 484 + 0, 0, NULL); 485 + } 486 + 487 + /** 488 + * zynqmp_pm_reset_get_status - Get status of the reset 489 + * @reset: Reset whose status should be returned 490 + * @status: Returned status 491 + * 492 + * Return: Returns status, either success or error+reason 493 + */ 494 + static int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset, 495 + u32 *status) 496 + { 497 + u32 ret_payload[PAYLOAD_ARG_CNT]; 498 + int ret; 499 + 500 + if (!status) 501 + return -EINVAL; 502 + 503 + ret = zynqmp_pm_invoke_fn(PM_RESET_GET_STATUS, reset, 0, 504 + 0, 0, ret_payload); 505 + *status = ret_payload[1]; 506 + 507 + return ret; 508 + } 509 + 472 510 static const struct zynqmp_eemi_ops eemi_ops = { 473 511 .get_api_version = zynqmp_pm_get_api_version, 474 512 .query_data = zynqmp_pm_query_data, ··· 520 482 .clock_setparent = zynqmp_pm_clock_setparent, 521 483 .clock_getparent = zynqmp_pm_clock_getparent, 522 484 .ioctl = zynqmp_pm_ioctl, 485 + .reset_assert = zynqmp_pm_reset_assert, 486 + .reset_get_status = zynqmp_pm_reset_get_status, 523 487 }; 524 488 525 489 /**
+136
include/linux/firmware/xlnx-zynqmp.h
··· 34 34 35 35 enum pm_api_id { 36 36 PM_GET_API_VERSION = 1, 37 + PM_RESET_ASSERT = 17, 38 + PM_RESET_GET_STATUS, 37 39 PM_IOCTL = 34, 38 40 PM_QUERY_DATA, 39 41 PM_CLOCK_ENABLE, ··· 77 75 PM_QID_CLOCK_GET_NUM_CLOCKS = 12, 78 76 }; 79 77 78 + enum zynqmp_pm_reset_action { 79 + PM_RESET_ACTION_RELEASE, 80 + PM_RESET_ACTION_ASSERT, 81 + PM_RESET_ACTION_PULSE, 82 + }; 83 + 84 + enum zynqmp_pm_reset { 85 + ZYNQMP_PM_RESET_START = 1000, 86 + ZYNQMP_PM_RESET_PCIE_CFG = ZYNQMP_PM_RESET_START, 87 + ZYNQMP_PM_RESET_PCIE_BRIDGE, 88 + ZYNQMP_PM_RESET_PCIE_CTRL, 89 + ZYNQMP_PM_RESET_DP, 90 + ZYNQMP_PM_RESET_SWDT_CRF, 91 + ZYNQMP_PM_RESET_AFI_FM5, 92 + ZYNQMP_PM_RESET_AFI_FM4, 93 + ZYNQMP_PM_RESET_AFI_FM3, 94 + ZYNQMP_PM_RESET_AFI_FM2, 95 + ZYNQMP_PM_RESET_AFI_FM1, 96 + ZYNQMP_PM_RESET_AFI_FM0, 97 + ZYNQMP_PM_RESET_GDMA, 98 + ZYNQMP_PM_RESET_GPU_PP1, 99 + ZYNQMP_PM_RESET_GPU_PP0, 100 + ZYNQMP_PM_RESET_GPU, 101 + ZYNQMP_PM_RESET_GT, 102 + ZYNQMP_PM_RESET_SATA, 103 + ZYNQMP_PM_RESET_ACPU3_PWRON, 104 + ZYNQMP_PM_RESET_ACPU2_PWRON, 105 + ZYNQMP_PM_RESET_ACPU1_PWRON, 106 + ZYNQMP_PM_RESET_ACPU0_PWRON, 107 + ZYNQMP_PM_RESET_APU_L2, 108 + ZYNQMP_PM_RESET_ACPU3, 109 + ZYNQMP_PM_RESET_ACPU2, 110 + ZYNQMP_PM_RESET_ACPU1, 111 + ZYNQMP_PM_RESET_ACPU0, 112 + ZYNQMP_PM_RESET_DDR, 113 + ZYNQMP_PM_RESET_APM_FPD, 114 + ZYNQMP_PM_RESET_SOFT, 115 + ZYNQMP_PM_RESET_GEM0, 116 + ZYNQMP_PM_RESET_GEM1, 117 + ZYNQMP_PM_RESET_GEM2, 118 + ZYNQMP_PM_RESET_GEM3, 119 + ZYNQMP_PM_RESET_QSPI, 120 + ZYNQMP_PM_RESET_UART0, 121 + ZYNQMP_PM_RESET_UART1, 122 + ZYNQMP_PM_RESET_SPI0, 123 + ZYNQMP_PM_RESET_SPI1, 124 + ZYNQMP_PM_RESET_SDIO0, 125 + ZYNQMP_PM_RESET_SDIO1, 126 + ZYNQMP_PM_RESET_CAN0, 127 + ZYNQMP_PM_RESET_CAN1, 128 + ZYNQMP_PM_RESET_I2C0, 129 + ZYNQMP_PM_RESET_I2C1, 130 + ZYNQMP_PM_RESET_TTC0, 131 + ZYNQMP_PM_RESET_TTC1, 132 + ZYNQMP_PM_RESET_TTC2, 133 + ZYNQMP_PM_RESET_TTC3, 134 + ZYNQMP_PM_RESET_SWDT_CRL, 135 + ZYNQMP_PM_RESET_NAND, 136 + ZYNQMP_PM_RESET_ADMA, 137 + ZYNQMP_PM_RESET_GPIO, 138 + ZYNQMP_PM_RESET_IOU_CC, 139 + ZYNQMP_PM_RESET_TIMESTAMP, 140 + ZYNQMP_PM_RESET_RPU_R50, 141 + ZYNQMP_PM_RESET_RPU_R51, 142 + ZYNQMP_PM_RESET_RPU_AMBA, 143 + ZYNQMP_PM_RESET_OCM, 144 + ZYNQMP_PM_RESET_RPU_PGE, 145 + ZYNQMP_PM_RESET_USB0_CORERESET, 146 + ZYNQMP_PM_RESET_USB1_CORERESET, 147 + ZYNQMP_PM_RESET_USB0_HIBERRESET, 148 + ZYNQMP_PM_RESET_USB1_HIBERRESET, 149 + ZYNQMP_PM_RESET_USB0_APB, 150 + ZYNQMP_PM_RESET_USB1_APB, 151 + ZYNQMP_PM_RESET_IPI, 152 + ZYNQMP_PM_RESET_APM_LPD, 153 + ZYNQMP_PM_RESET_RTC, 154 + ZYNQMP_PM_RESET_SYSMON, 155 + ZYNQMP_PM_RESET_AFI_FM6, 156 + ZYNQMP_PM_RESET_LPD_SWDT, 157 + ZYNQMP_PM_RESET_FPD, 158 + ZYNQMP_PM_RESET_RPU_DBG1, 159 + ZYNQMP_PM_RESET_RPU_DBG0, 160 + ZYNQMP_PM_RESET_DBG_LPD, 161 + ZYNQMP_PM_RESET_DBG_FPD, 162 + ZYNQMP_PM_RESET_APLL, 163 + ZYNQMP_PM_RESET_DPLL, 164 + ZYNQMP_PM_RESET_VPLL, 165 + ZYNQMP_PM_RESET_IOPLL, 166 + ZYNQMP_PM_RESET_RPLL, 167 + ZYNQMP_PM_RESET_GPO3_PL_0, 168 + ZYNQMP_PM_RESET_GPO3_PL_1, 169 + ZYNQMP_PM_RESET_GPO3_PL_2, 170 + ZYNQMP_PM_RESET_GPO3_PL_3, 171 + ZYNQMP_PM_RESET_GPO3_PL_4, 172 + ZYNQMP_PM_RESET_GPO3_PL_5, 173 + ZYNQMP_PM_RESET_GPO3_PL_6, 174 + ZYNQMP_PM_RESET_GPO3_PL_7, 175 + ZYNQMP_PM_RESET_GPO3_PL_8, 176 + ZYNQMP_PM_RESET_GPO3_PL_9, 177 + ZYNQMP_PM_RESET_GPO3_PL_10, 178 + ZYNQMP_PM_RESET_GPO3_PL_11, 179 + ZYNQMP_PM_RESET_GPO3_PL_12, 180 + ZYNQMP_PM_RESET_GPO3_PL_13, 181 + ZYNQMP_PM_RESET_GPO3_PL_14, 182 + ZYNQMP_PM_RESET_GPO3_PL_15, 183 + ZYNQMP_PM_RESET_GPO3_PL_16, 184 + ZYNQMP_PM_RESET_GPO3_PL_17, 185 + ZYNQMP_PM_RESET_GPO3_PL_18, 186 + ZYNQMP_PM_RESET_GPO3_PL_19, 187 + ZYNQMP_PM_RESET_GPO3_PL_20, 188 + ZYNQMP_PM_RESET_GPO3_PL_21, 189 + ZYNQMP_PM_RESET_GPO3_PL_22, 190 + ZYNQMP_PM_RESET_GPO3_PL_23, 191 + ZYNQMP_PM_RESET_GPO3_PL_24, 192 + ZYNQMP_PM_RESET_GPO3_PL_25, 193 + ZYNQMP_PM_RESET_GPO3_PL_26, 194 + ZYNQMP_PM_RESET_GPO3_PL_27, 195 + ZYNQMP_PM_RESET_GPO3_PL_28, 196 + ZYNQMP_PM_RESET_GPO3_PL_29, 197 + ZYNQMP_PM_RESET_GPO3_PL_30, 198 + ZYNQMP_PM_RESET_GPO3_PL_31, 199 + ZYNQMP_PM_RESET_RPU_LS, 200 + ZYNQMP_PM_RESET_PS_ONLY, 201 + ZYNQMP_PM_RESET_PL, 202 + ZYNQMP_PM_RESET_PS_PL0, 203 + ZYNQMP_PM_RESET_PS_PL1, 204 + ZYNQMP_PM_RESET_PS_PL2, 205 + ZYNQMP_PM_RESET_PS_PL3, 206 + ZYNQMP_PM_RESET_END = ZYNQMP_PM_RESET_PS_PL3 207 + }; 208 + 80 209 /** 81 210 * struct zynqmp_pm_query_data - PM query data 82 211 * @qid: query ID ··· 235 102 int (*clock_setparent)(u32 clock_id, u32 parent_id); 236 103 int (*clock_getparent)(u32 clock_id, u32 *parent_id); 237 104 int (*ioctl)(u32 node_id, u32 ioctl_id, u32 arg1, u32 arg2, u32 *out); 105 + int (*reset_assert)(const enum zynqmp_pm_reset reset, 106 + const enum zynqmp_pm_reset_action assert_flag); 107 + int (*reset_get_status)(const enum zynqmp_pm_reset reset, u32 *status); 238 108 }; 239 109 240 110 #if IS_REACHABLE(CONFIG_ARCH_ZYNQMP)