xlnx-zynqmp.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Xilinx Zynq MPSoC Firmware layer
  4. *
  5. * Copyright (C) 2014-2021 Xilinx
  6. *
  7. * Michal Simek <[email protected]>
  8. * Davorin Mista <[email protected]>
  9. * Jolly Shah <[email protected]>
  10. * Rajan Vaja <[email protected]>
  11. */
  12. #ifndef __FIRMWARE_ZYNQMP_H__
  13. #define __FIRMWARE_ZYNQMP_H__
  14. #include <linux/err.h>
  15. #define ZYNQMP_PM_VERSION_MAJOR 1
  16. #define ZYNQMP_PM_VERSION_MINOR 0
  17. #define ZYNQMP_PM_VERSION ((ZYNQMP_PM_VERSION_MAJOR << 16) | \
  18. ZYNQMP_PM_VERSION_MINOR)
  19. #define ZYNQMP_TZ_VERSION_MAJOR 1
  20. #define ZYNQMP_TZ_VERSION_MINOR 0
  21. #define ZYNQMP_TZ_VERSION ((ZYNQMP_TZ_VERSION_MAJOR << 16) | \
  22. ZYNQMP_TZ_VERSION_MINOR)
  23. /* SMC SIP service Call Function Identifier Prefix */
  24. #define PM_SIP_SVC 0xC2000000
  25. /* PM API versions */
  26. #define PM_API_VERSION_2 2
  27. /* ATF only commands */
  28. #define TF_A_PM_REGISTER_SGI 0xa04
  29. #define PM_GET_TRUSTZONE_VERSION 0xa03
  30. #define PM_SET_SUSPEND_MODE 0xa02
  31. #define GET_CALLBACK_DATA 0xa01
  32. /* Number of 32bits values in payload */
  33. #define PAYLOAD_ARG_CNT 4U
  34. /* Number of arguments for a callback */
  35. #define CB_ARG_CNT 4
  36. /* Payload size (consists of callback API ID + arguments) */
  37. #define CB_PAYLOAD_SIZE (CB_ARG_CNT + 1)
  38. #define ZYNQMP_PM_MAX_QOS 100U
  39. #define GSS_NUM_REGS (4)
  40. /* Node capabilities */
  41. #define ZYNQMP_PM_CAPABILITY_ACCESS 0x1U
  42. #define ZYNQMP_PM_CAPABILITY_CONTEXT 0x2U
  43. #define ZYNQMP_PM_CAPABILITY_WAKEUP 0x4U
  44. #define ZYNQMP_PM_CAPABILITY_UNUSABLE 0x8U
  45. /* Loader commands */
  46. #define PM_LOAD_PDI 0x701
  47. #define PDI_SRC_DDR 0xF
  48. /*
  49. * Firmware FPGA Manager flags
  50. * XILINX_ZYNQMP_PM_FPGA_FULL: FPGA full reconfiguration
  51. * XILINX_ZYNQMP_PM_FPGA_PARTIAL: FPGA partial reconfiguration
  52. */
  53. #define XILINX_ZYNQMP_PM_FPGA_FULL 0x0U
  54. #define XILINX_ZYNQMP_PM_FPGA_PARTIAL BIT(0)
  55. /*
  56. * Node IDs for the Error Events.
  57. */
  58. #define EVENT_ERROR_PMC_ERR1 (0x28100000U)
  59. #define EVENT_ERROR_PMC_ERR2 (0x28104000U)
  60. #define EVENT_ERROR_PSM_ERR1 (0x28108000U)
  61. #define EVENT_ERROR_PSM_ERR2 (0x2810C000U)
  62. enum pm_api_cb_id {
  63. PM_INIT_SUSPEND_CB = 30,
  64. PM_ACKNOWLEDGE_CB = 31,
  65. PM_NOTIFY_CB = 32,
  66. };
  67. enum pm_api_id {
  68. PM_GET_API_VERSION = 1,
  69. PM_REGISTER_NOTIFIER = 5,
  70. PM_SYSTEM_SHUTDOWN = 12,
  71. PM_REQUEST_NODE = 13,
  72. PM_RELEASE_NODE = 14,
  73. PM_SET_REQUIREMENT = 15,
  74. PM_RESET_ASSERT = 17,
  75. PM_RESET_GET_STATUS = 18,
  76. PM_MMIO_WRITE = 19,
  77. PM_MMIO_READ = 20,
  78. PM_PM_INIT_FINALIZE = 21,
  79. PM_FPGA_LOAD = 22,
  80. PM_FPGA_GET_STATUS = 23,
  81. PM_GET_CHIPID = 24,
  82. PM_SECURE_SHA = 26,
  83. PM_PINCTRL_REQUEST = 28,
  84. PM_PINCTRL_RELEASE = 29,
  85. PM_PINCTRL_GET_FUNCTION = 30,
  86. PM_PINCTRL_SET_FUNCTION = 31,
  87. PM_PINCTRL_CONFIG_PARAM_GET = 32,
  88. PM_PINCTRL_CONFIG_PARAM_SET = 33,
  89. PM_IOCTL = 34,
  90. PM_QUERY_DATA = 35,
  91. PM_CLOCK_ENABLE = 36,
  92. PM_CLOCK_DISABLE = 37,
  93. PM_CLOCK_GETSTATE = 38,
  94. PM_CLOCK_SETDIVIDER = 39,
  95. PM_CLOCK_GETDIVIDER = 40,
  96. PM_CLOCK_SETRATE = 41,
  97. PM_CLOCK_GETRATE = 42,
  98. PM_CLOCK_SETPARENT = 43,
  99. PM_CLOCK_GETPARENT = 44,
  100. PM_SECURE_AES = 47,
  101. PM_FEATURE_CHECK = 63,
  102. };
  103. /* PMU-FW return status codes */
  104. enum pm_ret_status {
  105. XST_PM_SUCCESS = 0,
  106. XST_PM_NO_FEATURE = 19,
  107. XST_PM_INTERNAL = 2000,
  108. XST_PM_CONFLICT = 2001,
  109. XST_PM_NO_ACCESS = 2002,
  110. XST_PM_INVALID_NODE = 2003,
  111. XST_PM_DOUBLE_REQ = 2004,
  112. XST_PM_ABORT_SUSPEND = 2005,
  113. XST_PM_MULT_USER = 2008,
  114. };
  115. enum pm_ioctl_id {
  116. IOCTL_SD_DLL_RESET = 6,
  117. IOCTL_SET_SD_TAPDELAY = 7,
  118. IOCTL_SET_PLL_FRAC_MODE = 8,
  119. IOCTL_GET_PLL_FRAC_MODE = 9,
  120. IOCTL_SET_PLL_FRAC_DATA = 10,
  121. IOCTL_GET_PLL_FRAC_DATA = 11,
  122. IOCTL_WRITE_GGS = 12,
  123. IOCTL_READ_GGS = 13,
  124. IOCTL_WRITE_PGGS = 14,
  125. IOCTL_READ_PGGS = 15,
  126. /* Set healthy bit value */
  127. IOCTL_SET_BOOT_HEALTH_STATUS = 17,
  128. IOCTL_OSPI_MUX_SELECT = 21,
  129. /* Register SGI to ATF */
  130. IOCTL_REGISTER_SGI = 25,
  131. /* Runtime feature configuration */
  132. IOCTL_SET_FEATURE_CONFIG = 26,
  133. IOCTL_GET_FEATURE_CONFIG = 27,
  134. /* Dynamic SD/GEM configuration */
  135. IOCTL_SET_SD_CONFIG = 30,
  136. IOCTL_SET_GEM_CONFIG = 31,
  137. };
  138. enum pm_query_id {
  139. PM_QID_INVALID = 0,
  140. PM_QID_CLOCK_GET_NAME = 1,
  141. PM_QID_CLOCK_GET_TOPOLOGY = 2,
  142. PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS = 3,
  143. PM_QID_CLOCK_GET_PARENTS = 4,
  144. PM_QID_CLOCK_GET_ATTRIBUTES = 5,
  145. PM_QID_PINCTRL_GET_NUM_PINS = 6,
  146. PM_QID_PINCTRL_GET_NUM_FUNCTIONS = 7,
  147. PM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS = 8,
  148. PM_QID_PINCTRL_GET_FUNCTION_NAME = 9,
  149. PM_QID_PINCTRL_GET_FUNCTION_GROUPS = 10,
  150. PM_QID_PINCTRL_GET_PIN_GROUPS = 11,
  151. PM_QID_CLOCK_GET_NUM_CLOCKS = 12,
  152. PM_QID_CLOCK_GET_MAX_DIVISOR = 13,
  153. };
  154. enum zynqmp_pm_reset_action {
  155. PM_RESET_ACTION_RELEASE = 0,
  156. PM_RESET_ACTION_ASSERT = 1,
  157. PM_RESET_ACTION_PULSE = 2,
  158. };
  159. enum zynqmp_pm_reset {
  160. ZYNQMP_PM_RESET_START = 1000,
  161. ZYNQMP_PM_RESET_PCIE_CFG = ZYNQMP_PM_RESET_START,
  162. ZYNQMP_PM_RESET_PCIE_BRIDGE = 1001,
  163. ZYNQMP_PM_RESET_PCIE_CTRL = 1002,
  164. ZYNQMP_PM_RESET_DP = 1003,
  165. ZYNQMP_PM_RESET_SWDT_CRF = 1004,
  166. ZYNQMP_PM_RESET_AFI_FM5 = 1005,
  167. ZYNQMP_PM_RESET_AFI_FM4 = 1006,
  168. ZYNQMP_PM_RESET_AFI_FM3 = 1007,
  169. ZYNQMP_PM_RESET_AFI_FM2 = 1008,
  170. ZYNQMP_PM_RESET_AFI_FM1 = 1009,
  171. ZYNQMP_PM_RESET_AFI_FM0 = 1010,
  172. ZYNQMP_PM_RESET_GDMA = 1011,
  173. ZYNQMP_PM_RESET_GPU_PP1 = 1012,
  174. ZYNQMP_PM_RESET_GPU_PP0 = 1013,
  175. ZYNQMP_PM_RESET_GPU = 1014,
  176. ZYNQMP_PM_RESET_GT = 1015,
  177. ZYNQMP_PM_RESET_SATA = 1016,
  178. ZYNQMP_PM_RESET_ACPU3_PWRON = 1017,
  179. ZYNQMP_PM_RESET_ACPU2_PWRON = 1018,
  180. ZYNQMP_PM_RESET_ACPU1_PWRON = 1019,
  181. ZYNQMP_PM_RESET_ACPU0_PWRON = 1020,
  182. ZYNQMP_PM_RESET_APU_L2 = 1021,
  183. ZYNQMP_PM_RESET_ACPU3 = 1022,
  184. ZYNQMP_PM_RESET_ACPU2 = 1023,
  185. ZYNQMP_PM_RESET_ACPU1 = 1024,
  186. ZYNQMP_PM_RESET_ACPU0 = 1025,
  187. ZYNQMP_PM_RESET_DDR = 1026,
  188. ZYNQMP_PM_RESET_APM_FPD = 1027,
  189. ZYNQMP_PM_RESET_SOFT = 1028,
  190. ZYNQMP_PM_RESET_GEM0 = 1029,
  191. ZYNQMP_PM_RESET_GEM1 = 1030,
  192. ZYNQMP_PM_RESET_GEM2 = 1031,
  193. ZYNQMP_PM_RESET_GEM3 = 1032,
  194. ZYNQMP_PM_RESET_QSPI = 1033,
  195. ZYNQMP_PM_RESET_UART0 = 1034,
  196. ZYNQMP_PM_RESET_UART1 = 1035,
  197. ZYNQMP_PM_RESET_SPI0 = 1036,
  198. ZYNQMP_PM_RESET_SPI1 = 1037,
  199. ZYNQMP_PM_RESET_SDIO0 = 1038,
  200. ZYNQMP_PM_RESET_SDIO1 = 1039,
  201. ZYNQMP_PM_RESET_CAN0 = 1040,
  202. ZYNQMP_PM_RESET_CAN1 = 1041,
  203. ZYNQMP_PM_RESET_I2C0 = 1042,
  204. ZYNQMP_PM_RESET_I2C1 = 1043,
  205. ZYNQMP_PM_RESET_TTC0 = 1044,
  206. ZYNQMP_PM_RESET_TTC1 = 1045,
  207. ZYNQMP_PM_RESET_TTC2 = 1046,
  208. ZYNQMP_PM_RESET_TTC3 = 1047,
  209. ZYNQMP_PM_RESET_SWDT_CRL = 1048,
  210. ZYNQMP_PM_RESET_NAND = 1049,
  211. ZYNQMP_PM_RESET_ADMA = 1050,
  212. ZYNQMP_PM_RESET_GPIO = 1051,
  213. ZYNQMP_PM_RESET_IOU_CC = 1052,
  214. ZYNQMP_PM_RESET_TIMESTAMP = 1053,
  215. ZYNQMP_PM_RESET_RPU_R50 = 1054,
  216. ZYNQMP_PM_RESET_RPU_R51 = 1055,
  217. ZYNQMP_PM_RESET_RPU_AMBA = 1056,
  218. ZYNQMP_PM_RESET_OCM = 1057,
  219. ZYNQMP_PM_RESET_RPU_PGE = 1058,
  220. ZYNQMP_PM_RESET_USB0_CORERESET = 1059,
  221. ZYNQMP_PM_RESET_USB1_CORERESET = 1060,
  222. ZYNQMP_PM_RESET_USB0_HIBERRESET = 1061,
  223. ZYNQMP_PM_RESET_USB1_HIBERRESET = 1062,
  224. ZYNQMP_PM_RESET_USB0_APB = 1063,
  225. ZYNQMP_PM_RESET_USB1_APB = 1064,
  226. ZYNQMP_PM_RESET_IPI = 1065,
  227. ZYNQMP_PM_RESET_APM_LPD = 1066,
  228. ZYNQMP_PM_RESET_RTC = 1067,
  229. ZYNQMP_PM_RESET_SYSMON = 1068,
  230. ZYNQMP_PM_RESET_AFI_FM6 = 1069,
  231. ZYNQMP_PM_RESET_LPD_SWDT = 1070,
  232. ZYNQMP_PM_RESET_FPD = 1071,
  233. ZYNQMP_PM_RESET_RPU_DBG1 = 1072,
  234. ZYNQMP_PM_RESET_RPU_DBG0 = 1073,
  235. ZYNQMP_PM_RESET_DBG_LPD = 1074,
  236. ZYNQMP_PM_RESET_DBG_FPD = 1075,
  237. ZYNQMP_PM_RESET_APLL = 1076,
  238. ZYNQMP_PM_RESET_DPLL = 1077,
  239. ZYNQMP_PM_RESET_VPLL = 1078,
  240. ZYNQMP_PM_RESET_IOPLL = 1079,
  241. ZYNQMP_PM_RESET_RPLL = 1080,
  242. ZYNQMP_PM_RESET_GPO3_PL_0 = 1081,
  243. ZYNQMP_PM_RESET_GPO3_PL_1 = 1082,
  244. ZYNQMP_PM_RESET_GPO3_PL_2 = 1083,
  245. ZYNQMP_PM_RESET_GPO3_PL_3 = 1084,
  246. ZYNQMP_PM_RESET_GPO3_PL_4 = 1085,
  247. ZYNQMP_PM_RESET_GPO3_PL_5 = 1086,
  248. ZYNQMP_PM_RESET_GPO3_PL_6 = 1087,
  249. ZYNQMP_PM_RESET_GPO3_PL_7 = 1088,
  250. ZYNQMP_PM_RESET_GPO3_PL_8 = 1089,
  251. ZYNQMP_PM_RESET_GPO3_PL_9 = 1090,
  252. ZYNQMP_PM_RESET_GPO3_PL_10 = 1091,
  253. ZYNQMP_PM_RESET_GPO3_PL_11 = 1092,
  254. ZYNQMP_PM_RESET_GPO3_PL_12 = 1093,
  255. ZYNQMP_PM_RESET_GPO3_PL_13 = 1094,
  256. ZYNQMP_PM_RESET_GPO3_PL_14 = 1095,
  257. ZYNQMP_PM_RESET_GPO3_PL_15 = 1096,
  258. ZYNQMP_PM_RESET_GPO3_PL_16 = 1097,
  259. ZYNQMP_PM_RESET_GPO3_PL_17 = 1098,
  260. ZYNQMP_PM_RESET_GPO3_PL_18 = 1099,
  261. ZYNQMP_PM_RESET_GPO3_PL_19 = 1100,
  262. ZYNQMP_PM_RESET_GPO3_PL_20 = 1101,
  263. ZYNQMP_PM_RESET_GPO3_PL_21 = 1102,
  264. ZYNQMP_PM_RESET_GPO3_PL_22 = 1103,
  265. ZYNQMP_PM_RESET_GPO3_PL_23 = 1104,
  266. ZYNQMP_PM_RESET_GPO3_PL_24 = 1105,
  267. ZYNQMP_PM_RESET_GPO3_PL_25 = 1106,
  268. ZYNQMP_PM_RESET_GPO3_PL_26 = 1107,
  269. ZYNQMP_PM_RESET_GPO3_PL_27 = 1108,
  270. ZYNQMP_PM_RESET_GPO3_PL_28 = 1109,
  271. ZYNQMP_PM_RESET_GPO3_PL_29 = 1110,
  272. ZYNQMP_PM_RESET_GPO3_PL_30 = 1111,
  273. ZYNQMP_PM_RESET_GPO3_PL_31 = 1112,
  274. ZYNQMP_PM_RESET_RPU_LS = 1113,
  275. ZYNQMP_PM_RESET_PS_ONLY = 1114,
  276. ZYNQMP_PM_RESET_PL = 1115,
  277. ZYNQMP_PM_RESET_PS_PL0 = 1116,
  278. ZYNQMP_PM_RESET_PS_PL1 = 1117,
  279. ZYNQMP_PM_RESET_PS_PL2 = 1118,
  280. ZYNQMP_PM_RESET_PS_PL3 = 1119,
  281. ZYNQMP_PM_RESET_END = ZYNQMP_PM_RESET_PS_PL3
  282. };
  283. enum zynqmp_pm_suspend_reason {
  284. SUSPEND_POWER_REQUEST = 201,
  285. SUSPEND_ALERT = 202,
  286. SUSPEND_SYSTEM_SHUTDOWN = 203,
  287. };
  288. enum zynqmp_pm_request_ack {
  289. ZYNQMP_PM_REQUEST_ACK_NO = 1,
  290. ZYNQMP_PM_REQUEST_ACK_BLOCKING = 2,
  291. ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING = 3,
  292. };
  293. enum pm_node_id {
  294. NODE_SD_0 = 39,
  295. NODE_SD_1 = 40,
  296. };
  297. enum tap_delay_type {
  298. PM_TAPDELAY_INPUT = 0,
  299. PM_TAPDELAY_OUTPUT = 1,
  300. };
  301. enum dll_reset_type {
  302. PM_DLL_RESET_ASSERT = 0,
  303. PM_DLL_RESET_RELEASE = 1,
  304. PM_DLL_RESET_PULSE = 2,
  305. };
  306. enum pm_pinctrl_config_param {
  307. PM_PINCTRL_CONFIG_SLEW_RATE = 0,
  308. PM_PINCTRL_CONFIG_BIAS_STATUS = 1,
  309. PM_PINCTRL_CONFIG_PULL_CTRL = 2,
  310. PM_PINCTRL_CONFIG_SCHMITT_CMOS = 3,
  311. PM_PINCTRL_CONFIG_DRIVE_STRENGTH = 4,
  312. PM_PINCTRL_CONFIG_VOLTAGE_STATUS = 5,
  313. PM_PINCTRL_CONFIG_TRI_STATE = 6,
  314. PM_PINCTRL_CONFIG_MAX = 7,
  315. };
  316. enum pm_pinctrl_slew_rate {
  317. PM_PINCTRL_SLEW_RATE_FAST = 0,
  318. PM_PINCTRL_SLEW_RATE_SLOW = 1,
  319. };
  320. enum pm_pinctrl_bias_status {
  321. PM_PINCTRL_BIAS_DISABLE = 0,
  322. PM_PINCTRL_BIAS_ENABLE = 1,
  323. };
  324. enum pm_pinctrl_pull_ctrl {
  325. PM_PINCTRL_BIAS_PULL_DOWN = 0,
  326. PM_PINCTRL_BIAS_PULL_UP = 1,
  327. };
  328. enum pm_pinctrl_schmitt_cmos {
  329. PM_PINCTRL_INPUT_TYPE_CMOS = 0,
  330. PM_PINCTRL_INPUT_TYPE_SCHMITT = 1,
  331. };
  332. enum pm_pinctrl_drive_strength {
  333. PM_PINCTRL_DRIVE_STRENGTH_2MA = 0,
  334. PM_PINCTRL_DRIVE_STRENGTH_4MA = 1,
  335. PM_PINCTRL_DRIVE_STRENGTH_8MA = 2,
  336. PM_PINCTRL_DRIVE_STRENGTH_12MA = 3,
  337. };
  338. enum pm_pinctrl_tri_state {
  339. PM_PINCTRL_TRI_STATE_DISABLE = 0,
  340. PM_PINCTRL_TRI_STATE_ENABLE = 1,
  341. };
  342. enum zynqmp_pm_shutdown_type {
  343. ZYNQMP_PM_SHUTDOWN_TYPE_SHUTDOWN = 0,
  344. ZYNQMP_PM_SHUTDOWN_TYPE_RESET = 1,
  345. ZYNQMP_PM_SHUTDOWN_TYPE_SETSCOPE_ONLY = 2,
  346. };
  347. enum zynqmp_pm_shutdown_subtype {
  348. ZYNQMP_PM_SHUTDOWN_SUBTYPE_SUBSYSTEM = 0,
  349. ZYNQMP_PM_SHUTDOWN_SUBTYPE_PS_ONLY = 1,
  350. ZYNQMP_PM_SHUTDOWN_SUBTYPE_SYSTEM = 2,
  351. };
  352. enum ospi_mux_select_type {
  353. PM_OSPI_MUX_SEL_DMA = 0,
  354. PM_OSPI_MUX_SEL_LINEAR = 1,
  355. };
  356. enum pm_feature_config_id {
  357. PM_FEATURE_INVALID = 0,
  358. PM_FEATURE_OVERTEMP_STATUS = 1,
  359. PM_FEATURE_OVERTEMP_VALUE = 2,
  360. PM_FEATURE_EXTWDT_STATUS = 3,
  361. PM_FEATURE_EXTWDT_VALUE = 4,
  362. };
  363. /**
  364. * enum pm_sd_config_type - PM SD configuration.
  365. * @SD_CONFIG_EMMC_SEL: To set SD_EMMC_SEL in CTRL_REG_SD and SD_SLOTTYPE
  366. * @SD_CONFIG_BASECLK: To set SD_BASECLK in SD_CONFIG_REG1
  367. * @SD_CONFIG_8BIT: To set SD_8BIT in SD_CONFIG_REG2
  368. * @SD_CONFIG_FIXED: To set fixed config registers
  369. */
  370. enum pm_sd_config_type {
  371. SD_CONFIG_EMMC_SEL = 1,
  372. SD_CONFIG_BASECLK = 2,
  373. SD_CONFIG_8BIT = 3,
  374. SD_CONFIG_FIXED = 4,
  375. };
  376. /**
  377. * enum pm_gem_config_type - PM GEM configuration.
  378. * @GEM_CONFIG_SGMII_MODE: To set GEM_SGMII_MODE in GEM_CLK_CTRL register
  379. * @GEM_CONFIG_FIXED: To set fixed config registers
  380. */
  381. enum pm_gem_config_type {
  382. GEM_CONFIG_SGMII_MODE = 1,
  383. GEM_CONFIG_FIXED = 2,
  384. };
  385. /**
  386. * struct zynqmp_pm_query_data - PM query data
  387. * @qid: query ID
  388. * @arg1: Argument 1 of query data
  389. * @arg2: Argument 2 of query data
  390. * @arg3: Argument 3 of query data
  391. */
  392. struct zynqmp_pm_query_data {
  393. u32 qid;
  394. u32 arg1;
  395. u32 arg2;
  396. u32 arg3;
  397. };
  398. int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,
  399. u32 arg2, u32 arg3, u32 *ret_payload);
  400. #if IS_REACHABLE(CONFIG_ZYNQMP_FIRMWARE)
  401. int zynqmp_pm_get_api_version(u32 *version);
  402. int zynqmp_pm_get_chipid(u32 *idcode, u32 *version);
  403. int zynqmp_pm_query_data(struct zynqmp_pm_query_data qdata, u32 *out);
  404. int zynqmp_pm_clock_enable(u32 clock_id);
  405. int zynqmp_pm_clock_disable(u32 clock_id);
  406. int zynqmp_pm_clock_getstate(u32 clock_id, u32 *state);
  407. int zynqmp_pm_clock_setdivider(u32 clock_id, u32 divider);
  408. int zynqmp_pm_clock_getdivider(u32 clock_id, u32 *divider);
  409. int zynqmp_pm_clock_setrate(u32 clock_id, u64 rate);
  410. int zynqmp_pm_clock_getrate(u32 clock_id, u64 *rate);
  411. int zynqmp_pm_clock_setparent(u32 clock_id, u32 parent_id);
  412. int zynqmp_pm_clock_getparent(u32 clock_id, u32 *parent_id);
  413. int zynqmp_pm_set_pll_frac_mode(u32 clk_id, u32 mode);
  414. int zynqmp_pm_get_pll_frac_mode(u32 clk_id, u32 *mode);
  415. int zynqmp_pm_set_pll_frac_data(u32 clk_id, u32 data);
  416. int zynqmp_pm_get_pll_frac_data(u32 clk_id, u32 *data);
  417. int zynqmp_pm_set_sd_tapdelay(u32 node_id, u32 type, u32 value);
  418. int zynqmp_pm_sd_dll_reset(u32 node_id, u32 type);
  419. int zynqmp_pm_ospi_mux_select(u32 dev_id, u32 select);
  420. int zynqmp_pm_reset_assert(const enum zynqmp_pm_reset reset,
  421. const enum zynqmp_pm_reset_action assert_flag);
  422. int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset, u32 *status);
  423. unsigned int zynqmp_pm_bootmode_read(u32 *ps_mode);
  424. int zynqmp_pm_bootmode_write(u32 ps_mode);
  425. int zynqmp_pm_init_finalize(void);
  426. int zynqmp_pm_set_suspend_mode(u32 mode);
  427. int zynqmp_pm_request_node(const u32 node, const u32 capabilities,
  428. const u32 qos, const enum zynqmp_pm_request_ack ack);
  429. int zynqmp_pm_release_node(const u32 node);
  430. int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
  431. const u32 qos,
  432. const enum zynqmp_pm_request_ack ack);
  433. int zynqmp_pm_aes_engine(const u64 address, u32 *out);
  434. int zynqmp_pm_sha_hash(const u64 address, const u32 size, const u32 flags);
  435. int zynqmp_pm_fpga_load(const u64 address, const u32 size, const u32 flags);
  436. int zynqmp_pm_fpga_get_status(u32 *value);
  437. int zynqmp_pm_write_ggs(u32 index, u32 value);
  438. int zynqmp_pm_read_ggs(u32 index, u32 *value);
  439. int zynqmp_pm_write_pggs(u32 index, u32 value);
  440. int zynqmp_pm_read_pggs(u32 index, u32 *value);
  441. int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype);
  442. int zynqmp_pm_set_boot_health_status(u32 value);
  443. int zynqmp_pm_pinctrl_request(const u32 pin);
  444. int zynqmp_pm_pinctrl_release(const u32 pin);
  445. int zynqmp_pm_pinctrl_get_function(const u32 pin, u32 *id);
  446. int zynqmp_pm_pinctrl_set_function(const u32 pin, const u32 id);
  447. int zynqmp_pm_pinctrl_get_config(const u32 pin, const u32 param,
  448. u32 *value);
  449. int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
  450. u32 value);
  451. int zynqmp_pm_load_pdi(const u32 src, const u64 address);
  452. int zynqmp_pm_register_notifier(const u32 node, const u32 event,
  453. const u32 wake, const u32 enable);
  454. int zynqmp_pm_feature(const u32 api_id);
  455. int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
  456. int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value);
  457. int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload);
  458. int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset);
  459. int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
  460. int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
  461. u32 value);
  462. #else
  463. static inline int zynqmp_pm_get_api_version(u32 *version)
  464. {
  465. return -ENODEV;
  466. }
  467. static inline int zynqmp_pm_get_chipid(u32 *idcode, u32 *version)
  468. {
  469. return -ENODEV;
  470. }
  471. static inline int zynqmp_pm_query_data(struct zynqmp_pm_query_data qdata,
  472. u32 *out)
  473. {
  474. return -ENODEV;
  475. }
  476. static inline int zynqmp_pm_clock_enable(u32 clock_id)
  477. {
  478. return -ENODEV;
  479. }
  480. static inline int zynqmp_pm_clock_disable(u32 clock_id)
  481. {
  482. return -ENODEV;
  483. }
  484. static inline int zynqmp_pm_clock_getstate(u32 clock_id, u32 *state)
  485. {
  486. return -ENODEV;
  487. }
  488. static inline int zynqmp_pm_clock_setdivider(u32 clock_id, u32 divider)
  489. {
  490. return -ENODEV;
  491. }
  492. static inline int zynqmp_pm_clock_getdivider(u32 clock_id, u32 *divider)
  493. {
  494. return -ENODEV;
  495. }
  496. static inline int zynqmp_pm_clock_setrate(u32 clock_id, u64 rate)
  497. {
  498. return -ENODEV;
  499. }
  500. static inline int zynqmp_pm_clock_getrate(u32 clock_id, u64 *rate)
  501. {
  502. return -ENODEV;
  503. }
  504. static inline int zynqmp_pm_clock_setparent(u32 clock_id, u32 parent_id)
  505. {
  506. return -ENODEV;
  507. }
  508. static inline int zynqmp_pm_clock_getparent(u32 clock_id, u32 *parent_id)
  509. {
  510. return -ENODEV;
  511. }
  512. static inline int zynqmp_pm_set_pll_frac_mode(u32 clk_id, u32 mode)
  513. {
  514. return -ENODEV;
  515. }
  516. static inline int zynqmp_pm_get_pll_frac_mode(u32 clk_id, u32 *mode)
  517. {
  518. return -ENODEV;
  519. }
  520. static inline int zynqmp_pm_set_pll_frac_data(u32 clk_id, u32 data)
  521. {
  522. return -ENODEV;
  523. }
  524. static inline int zynqmp_pm_get_pll_frac_data(u32 clk_id, u32 *data)
  525. {
  526. return -ENODEV;
  527. }
  528. static inline int zynqmp_pm_set_sd_tapdelay(u32 node_id, u32 type, u32 value)
  529. {
  530. return -ENODEV;
  531. }
  532. static inline int zynqmp_pm_sd_dll_reset(u32 node_id, u32 type)
  533. {
  534. return -ENODEV;
  535. }
  536. static inline int zynqmp_pm_ospi_mux_select(u32 dev_id, u32 select)
  537. {
  538. return -ENODEV;
  539. }
  540. static inline int zynqmp_pm_reset_assert(const enum zynqmp_pm_reset reset,
  541. const enum zynqmp_pm_reset_action assert_flag)
  542. {
  543. return -ENODEV;
  544. }
  545. static inline int zynqmp_pm_reset_get_status(const enum zynqmp_pm_reset reset,
  546. u32 *status)
  547. {
  548. return -ENODEV;
  549. }
  550. static inline unsigned int zynqmp_pm_bootmode_read(u32 *ps_mode)
  551. {
  552. return -ENODEV;
  553. }
  554. static inline int zynqmp_pm_bootmode_write(u32 ps_mode)
  555. {
  556. return -ENODEV;
  557. }
  558. static inline int zynqmp_pm_init_finalize(void)
  559. {
  560. return -ENODEV;
  561. }
  562. static inline int zynqmp_pm_set_suspend_mode(u32 mode)
  563. {
  564. return -ENODEV;
  565. }
  566. static inline int zynqmp_pm_request_node(const u32 node, const u32 capabilities,
  567. const u32 qos,
  568. const enum zynqmp_pm_request_ack ack)
  569. {
  570. return -ENODEV;
  571. }
  572. static inline int zynqmp_pm_release_node(const u32 node)
  573. {
  574. return -ENODEV;
  575. }
  576. static inline int zynqmp_pm_set_requirement(const u32 node,
  577. const u32 capabilities,
  578. const u32 qos,
  579. const enum zynqmp_pm_request_ack ack)
  580. {
  581. return -ENODEV;
  582. }
  583. static inline int zynqmp_pm_aes_engine(const u64 address, u32 *out)
  584. {
  585. return -ENODEV;
  586. }
  587. static inline int zynqmp_pm_sha_hash(const u64 address, const u32 size,
  588. const u32 flags)
  589. {
  590. return -ENODEV;
  591. }
  592. static inline int zynqmp_pm_fpga_load(const u64 address, const u32 size,
  593. const u32 flags)
  594. {
  595. return -ENODEV;
  596. }
  597. static inline int zynqmp_pm_fpga_get_status(u32 *value)
  598. {
  599. return -ENODEV;
  600. }
  601. static inline int zynqmp_pm_write_ggs(u32 index, u32 value)
  602. {
  603. return -ENODEV;
  604. }
  605. static inline int zynqmp_pm_read_ggs(u32 index, u32 *value)
  606. {
  607. return -ENODEV;
  608. }
  609. static inline int zynqmp_pm_write_pggs(u32 index, u32 value)
  610. {
  611. return -ENODEV;
  612. }
  613. static inline int zynqmp_pm_read_pggs(u32 index, u32 *value)
  614. {
  615. return -ENODEV;
  616. }
  617. static inline int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype)
  618. {
  619. return -ENODEV;
  620. }
  621. static inline int zynqmp_pm_set_boot_health_status(u32 value)
  622. {
  623. return -ENODEV;
  624. }
  625. static inline int zynqmp_pm_pinctrl_request(const u32 pin)
  626. {
  627. return -ENODEV;
  628. }
  629. static inline int zynqmp_pm_pinctrl_release(const u32 pin)
  630. {
  631. return -ENODEV;
  632. }
  633. static inline int zynqmp_pm_pinctrl_get_function(const u32 pin, u32 *id)
  634. {
  635. return -ENODEV;
  636. }
  637. static inline int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
  638. {
  639. return -ENODEV;
  640. }
  641. static inline int zynqmp_pm_pinctrl_set_function(const u32 pin, const u32 id)
  642. {
  643. return -ENODEV;
  644. }
  645. static inline int zynqmp_pm_pinctrl_get_config(const u32 pin, const u32 param,
  646. u32 *value)
  647. {
  648. return -ENODEV;
  649. }
  650. static inline int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
  651. u32 value)
  652. {
  653. return -ENODEV;
  654. }
  655. static inline int zynqmp_pm_load_pdi(const u32 src, const u64 address)
  656. {
  657. return -ENODEV;
  658. }
  659. static inline int zynqmp_pm_register_notifier(const u32 node, const u32 event,
  660. const u32 wake, const u32 enable)
  661. {
  662. return -ENODEV;
  663. }
  664. static inline int zynqmp_pm_feature(const u32 api_id)
  665. {
  666. return -ENODEV;
  667. }
  668. static inline int zynqmp_pm_set_feature_config(enum pm_feature_config_id id,
  669. u32 value)
  670. {
  671. return -ENODEV;
  672. }
  673. static inline int zynqmp_pm_get_feature_config(enum pm_feature_config_id id,
  674. u32 *payload)
  675. {
  676. return -ENODEV;
  677. }
  678. static inline int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset)
  679. {
  680. return -ENODEV;
  681. }
  682. static inline int zynqmp_pm_set_sd_config(u32 node,
  683. enum pm_sd_config_type config,
  684. u32 value)
  685. {
  686. return -ENODEV;
  687. }
  688. static inline int zynqmp_pm_set_gem_config(u32 node,
  689. enum pm_gem_config_type config,
  690. u32 value)
  691. {
  692. return -ENODEV;
  693. }
  694. #endif
  695. #endif /* __FIRMWARE_ZYNQMP_H__ */