1*91f16700Schasinglulu /* 2*91f16700Schasinglulu * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. 3*91f16700Schasinglulu * 4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu */ 6*91f16700Schasinglulu 7*91f16700Schasinglulu /*! 8*91f16700Schasinglulu * Header file containing the public API for the System Controller (SC) 9*91f16700Schasinglulu * Power Management (PM) function. This includes functions for power state 10*91f16700Schasinglulu * control, clock control, reset control, and wake-up event control. 11*91f16700Schasinglulu * 12*91f16700Schasinglulu * @addtogroup PM_SVC (SVC) Power Management Service 13*91f16700Schasinglulu * 14*91f16700Schasinglulu * Module for the Power Management (PM) service. 15*91f16700Schasinglulu * 16*91f16700Schasinglulu * @{ 17*91f16700Schasinglulu */ 18*91f16700Schasinglulu 19*91f16700Schasinglulu #ifndef SCI_PM_API_H 20*91f16700Schasinglulu #define SCI_PM_API_H 21*91f16700Schasinglulu 22*91f16700Schasinglulu /* Includes */ 23*91f16700Schasinglulu 24*91f16700Schasinglulu #include <sci/sci_types.h> 25*91f16700Schasinglulu #include <sci/svc/rm/sci_rm_api.h> 26*91f16700Schasinglulu 27*91f16700Schasinglulu /* Defines */ 28*91f16700Schasinglulu 29*91f16700Schasinglulu /*! 30*91f16700Schasinglulu * @name Defines for type widths 31*91f16700Schasinglulu */ 32*91f16700Schasinglulu /*@{*/ 33*91f16700Schasinglulu #define SC_PM_POWER_MODE_W 2 /* Width of sc_pm_power_mode_t */ 34*91f16700Schasinglulu #define SC_PM_CLOCK_MODE_W 3 /* Width of sc_pm_clock_mode_t */ 35*91f16700Schasinglulu #define SC_PM_RESET_TYPE_W 2 /* Width of sc_pm_reset_type_t */ 36*91f16700Schasinglulu #define SC_PM_RESET_REASON_W 3 /* Width of sc_pm_reset_reason_t */ 37*91f16700Schasinglulu /*@}*/ 38*91f16700Schasinglulu 39*91f16700Schasinglulu /*! 40*91f16700Schasinglulu * @name Defines for clock indexes (sc_pm_clk_t) 41*91f16700Schasinglulu */ 42*91f16700Schasinglulu /*@{*/ 43*91f16700Schasinglulu /*@}*/ 44*91f16700Schasinglulu 45*91f16700Schasinglulu /*! 46*91f16700Schasinglulu * @name Defines for ALL parameters 47*91f16700Schasinglulu */ 48*91f16700Schasinglulu /*@{*/ 49*91f16700Schasinglulu #define SC_PM_CLK_ALL UINT8_MAX /* All clocks */ 50*91f16700Schasinglulu /*@}*/ 51*91f16700Schasinglulu 52*91f16700Schasinglulu /*! 53*91f16700Schasinglulu * @name Defines for sc_pm_power_mode_t 54*91f16700Schasinglulu */ 55*91f16700Schasinglulu /*@{*/ 56*91f16700Schasinglulu #define SC_PM_PW_MODE_OFF 0U /* Power off */ 57*91f16700Schasinglulu #define SC_PM_PW_MODE_STBY 1U /* Power in standby */ 58*91f16700Schasinglulu #define SC_PM_PW_MODE_LP 2U /* Power in low-power */ 59*91f16700Schasinglulu #define SC_PM_PW_MODE_ON 3U /* Power on */ 60*91f16700Schasinglulu /*@}*/ 61*91f16700Schasinglulu 62*91f16700Schasinglulu /*! 63*91f16700Schasinglulu * @name Defines for sc_pm_clk_t 64*91f16700Schasinglulu */ 65*91f16700Schasinglulu /*@{*/ 66*91f16700Schasinglulu #define SC_PM_CLK_SLV_BUS 0U /* Slave bus clock */ 67*91f16700Schasinglulu #define SC_PM_CLK_MST_BUS 1U /* Master bus clock */ 68*91f16700Schasinglulu #define SC_PM_CLK_PER 2U /* Peripheral clock */ 69*91f16700Schasinglulu #define SC_PM_CLK_PHY 3U /* Phy clock */ 70*91f16700Schasinglulu #define SC_PM_CLK_MISC 4U /* Misc clock */ 71*91f16700Schasinglulu #define SC_PM_CLK_MISC0 0U /* Misc 0 clock */ 72*91f16700Schasinglulu #define SC_PM_CLK_MISC1 1U /* Misc 1 clock */ 73*91f16700Schasinglulu #define SC_PM_CLK_MISC2 2U /* Misc 2 clock */ 74*91f16700Schasinglulu #define SC_PM_CLK_MISC3 3U /* Misc 3 clock */ 75*91f16700Schasinglulu #define SC_PM_CLK_MISC4 4U /* Misc 4 clock */ 76*91f16700Schasinglulu #define SC_PM_CLK_CPU 2U /* CPU clock */ 77*91f16700Schasinglulu #define SC_PM_CLK_PLL 4U /* PLL */ 78*91f16700Schasinglulu #define SC_PM_CLK_BYPASS 4U /* Bypass clock */ 79*91f16700Schasinglulu /*@}*/ 80*91f16700Schasinglulu 81*91f16700Schasinglulu /*! 82*91f16700Schasinglulu * @name Defines for sc_pm_clk_mode_t 83*91f16700Schasinglulu */ 84*91f16700Schasinglulu /*@{*/ 85*91f16700Schasinglulu #define SC_PM_CLK_MODE_ROM_INIT 0U /* Clock is initialized by ROM. */ 86*91f16700Schasinglulu #define SC_PM_CLK_MODE_OFF 1U /* Clock is disabled */ 87*91f16700Schasinglulu #define SC_PM_CLK_MODE_ON 2U /* Clock is enabled. */ 88*91f16700Schasinglulu #define SC_PM_CLK_MODE_AUTOGATE_SW 3U /* Clock is in SW autogate mode */ 89*91f16700Schasinglulu #define SC_PM_CLK_MODE_AUTOGATE_HW 4U /* Clock is in HW autogate mode */ 90*91f16700Schasinglulu #define SC_PM_CLK_MODE_AUTOGATE_SW_HW 5U /* Clock is in SW-HW autogate mode */ 91*91f16700Schasinglulu /*@}*/ 92*91f16700Schasinglulu 93*91f16700Schasinglulu /*! 94*91f16700Schasinglulu * @name Defines for sc_pm_clk_parent_t 95*91f16700Schasinglulu */ 96*91f16700Schasinglulu /*@{*/ 97*91f16700Schasinglulu #define SC_PM_PARENT_XTAL 0U /* Parent is XTAL. */ 98*91f16700Schasinglulu #define SC_PM_PARENT_PLL0 1U /* Parent is PLL0 */ 99*91f16700Schasinglulu #define SC_PM_PARENT_PLL1 2U /* Parent is PLL1 or PLL0/2 */ 100*91f16700Schasinglulu #define SC_PM_PARENT_PLL2 3U /* Parent in PLL2 or PLL0/4 */ 101*91f16700Schasinglulu #define SC_PM_PARENT_BYPS 4U /* Parent is a bypass clock. */ 102*91f16700Schasinglulu /*@}*/ 103*91f16700Schasinglulu 104*91f16700Schasinglulu /*! 105*91f16700Schasinglulu * @name Defines for sc_pm_reset_type_t 106*91f16700Schasinglulu */ 107*91f16700Schasinglulu /*@{*/ 108*91f16700Schasinglulu #define SC_PM_RESET_TYPE_COLD 0U /* Cold reset */ 109*91f16700Schasinglulu #define SC_PM_RESET_TYPE_WARM 1U /* Warm reset */ 110*91f16700Schasinglulu #define SC_PM_RESET_TYPE_BOARD 2U /* Board reset */ 111*91f16700Schasinglulu /*@}*/ 112*91f16700Schasinglulu 113*91f16700Schasinglulu /*! 114*91f16700Schasinglulu * @name Defines for sc_pm_reset_cause_t 115*91f16700Schasinglulu */ 116*91f16700Schasinglulu /*@{*/ 117*91f16700Schasinglulu #define SC_PM_RESET_CAUSE_TEMP 0U /* Reset due to temp panic alarm */ 118*91f16700Schasinglulu #define SC_PM_RESET_CAUSE_FAULT 1U /* Reset due to fault exception */ 119*91f16700Schasinglulu #define SC_PM_RESET_CAUSE_IRQ 2U /* Reset due to SCU reset IRQ */ 120*91f16700Schasinglulu #define SC_PM_RESET_CAUSE_WDOG 3U /* Reset due to SW WDOG */ 121*91f16700Schasinglulu #define SC_PM_RESET_CAUSE_API 4U /* Reset due to pm_reset() or monitor */ 122*91f16700Schasinglulu /*@}*/ 123*91f16700Schasinglulu 124*91f16700Schasinglulu /*! 125*91f16700Schasinglulu * @name Defines for sc_pm_reset_reason_t 126*91f16700Schasinglulu */ 127*91f16700Schasinglulu /*@{*/ 128*91f16700Schasinglulu #define SC_PM_RESET_REASON_POR 0U /* Power on reset */ 129*91f16700Schasinglulu #define SC_PM_RESET_REASON_WARM 1U /* Warm reset */ 130*91f16700Schasinglulu #define SC_PM_RESET_REASON_SW 2U /* Software reset */ 131*91f16700Schasinglulu #define SC_PM_RESET_REASON_WDOG 3U /* Watchdog reset */ 132*91f16700Schasinglulu #define SC_PM_RESET_REASON_LOCKUP 4U /* Lockup reset */ 133*91f16700Schasinglulu #define SC_PM_RESET_REASON_TAMPER 5U /* Tamper reset */ 134*91f16700Schasinglulu #define SC_PM_RESET_REASON_TEMP 6U /* Temp reset */ 135*91f16700Schasinglulu #define SC_PM_RESET_REASON_LOW_VOLT 7U /* Low voltage reset */ 136*91f16700Schasinglulu /*@}*/ 137*91f16700Schasinglulu 138*91f16700Schasinglulu /*! 139*91f16700Schasinglulu * @name Defines for sc_pm_sys_if_t 140*91f16700Schasinglulu */ 141*91f16700Schasinglulu /*@{*/ 142*91f16700Schasinglulu #define SC_PM_SYS_IF_INTERCONNECT 0U /* System interconnect */ 143*91f16700Schasinglulu #define SC_PM_SYS_IF_MU 1U /* AP -> SCU message units */ 144*91f16700Schasinglulu #define SC_PM_SYS_IF_OCMEM 2U /* On-chip memory (ROM/OCRAM) */ 145*91f16700Schasinglulu #define SC_PM_SYS_IF_DDR 3U /* DDR memory */ 146*91f16700Schasinglulu /*@}*/ 147*91f16700Schasinglulu 148*91f16700Schasinglulu /*! 149*91f16700Schasinglulu * @name Defines for sc_pm_wake_src_t 150*91f16700Schasinglulu */ 151*91f16700Schasinglulu /*@{*/ 152*91f16700Schasinglulu #define SC_PM_WAKE_SRC_NONE 0U /* No wake source, used for self-kill */ 153*91f16700Schasinglulu #define SC_PM_WAKE_SRC_SCU 1U /* Wakeup from SCU to resume CPU (IRQSTEER & GIC powered down) */ 154*91f16700Schasinglulu #define SC_PM_WAKE_SRC_IRQSTEER 2U /* Wakeup from IRQSTEER to resume CPU (GIC powered down) */ 155*91f16700Schasinglulu #define SC_PM_WAKE_SRC_IRQSTEER_GIC 3U /* Wakeup from IRQSTEER+GIC to wake CPU (GIC clock gated) */ 156*91f16700Schasinglulu #define SC_PM_WAKE_SRC_GIC 4U /* Wakeup from GIC to wake CPU */ 157*91f16700Schasinglulu /*@}*/ 158*91f16700Schasinglulu 159*91f16700Schasinglulu /* Types */ 160*91f16700Schasinglulu 161*91f16700Schasinglulu /*! 162*91f16700Schasinglulu * This type is used to declare a power mode. Note resources only use 163*91f16700Schasinglulu * SC_PM_PW_MODE_OFF and SC_PM_PW_MODE_ON. The other modes are used only 164*91f16700Schasinglulu * as system power modes. 165*91f16700Schasinglulu */ 166*91f16700Schasinglulu typedef uint8_t sc_pm_power_mode_t; 167*91f16700Schasinglulu 168*91f16700Schasinglulu /*! 169*91f16700Schasinglulu * This type is used to declare a clock. 170*91f16700Schasinglulu */ 171*91f16700Schasinglulu typedef uint8_t sc_pm_clk_t; 172*91f16700Schasinglulu 173*91f16700Schasinglulu /*! 174*91f16700Schasinglulu * This type is used to declare a clock mode. 175*91f16700Schasinglulu */ 176*91f16700Schasinglulu typedef uint8_t sc_pm_clk_mode_t; 177*91f16700Schasinglulu 178*91f16700Schasinglulu /*! 179*91f16700Schasinglulu * This type is used to declare the clock parent. 180*91f16700Schasinglulu */ 181*91f16700Schasinglulu typedef uint8_t sc_pm_clk_parent_t; 182*91f16700Schasinglulu 183*91f16700Schasinglulu /*! 184*91f16700Schasinglulu * This type is used to declare clock rates. 185*91f16700Schasinglulu */ 186*91f16700Schasinglulu typedef uint32_t sc_pm_clock_rate_t; 187*91f16700Schasinglulu 188*91f16700Schasinglulu /*! 189*91f16700Schasinglulu * This type is used to declare a desired reset type. 190*91f16700Schasinglulu */ 191*91f16700Schasinglulu typedef uint8_t sc_pm_reset_type_t; 192*91f16700Schasinglulu 193*91f16700Schasinglulu /*! 194*91f16700Schasinglulu * This type is used to declare a desired reset type. 195*91f16700Schasinglulu */ 196*91f16700Schasinglulu typedef uint8_t sc_pm_reset_cause; 197*91f16700Schasinglulu 198*91f16700Schasinglulu /*! 199*91f16700Schasinglulu * This type is used to declare a reason for a reset. 200*91f16700Schasinglulu */ 201*91f16700Schasinglulu typedef uint8_t sc_pm_reset_reason_t; 202*91f16700Schasinglulu 203*91f16700Schasinglulu /*! 204*91f16700Schasinglulu * This type is used to specify a system-level interface to be power managed. 205*91f16700Schasinglulu */ 206*91f16700Schasinglulu typedef uint8_t sc_pm_sys_if_t; 207*91f16700Schasinglulu 208*91f16700Schasinglulu /*! 209*91f16700Schasinglulu * This type is used to specify a wake source for CPU resources. 210*91f16700Schasinglulu */ 211*91f16700Schasinglulu typedef uint8_t sc_pm_wake_src_t; 212*91f16700Schasinglulu 213*91f16700Schasinglulu /* Functions */ 214*91f16700Schasinglulu 215*91f16700Schasinglulu /*! 216*91f16700Schasinglulu * @name Power Functions 217*91f16700Schasinglulu * @{ 218*91f16700Schasinglulu */ 219*91f16700Schasinglulu 220*91f16700Schasinglulu /*! 221*91f16700Schasinglulu * This function sets the system power mode. Only the owner of the 222*91f16700Schasinglulu * SC_R_SYSTEM resource can do this. 223*91f16700Schasinglulu * 224*91f16700Schasinglulu * @param[in] ipc IPC handle 225*91f16700Schasinglulu * @param[in] mode power mode to apply 226*91f16700Schasinglulu * 227*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 228*91f16700Schasinglulu * 229*91f16700Schasinglulu * Return errors: 230*91f16700Schasinglulu * - SC_ERR_PARM if invalid mode, 231*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller not the owner of SC_R_SYSTEM 232*91f16700Schasinglulu * 233*91f16700Schasinglulu * @see sc_pm_set_sys_power_mode(). 234*91f16700Schasinglulu */ 235*91f16700Schasinglulu sc_err_t sc_pm_set_sys_power_mode(sc_ipc_t ipc, sc_pm_power_mode_t mode); 236*91f16700Schasinglulu 237*91f16700Schasinglulu /*! 238*91f16700Schasinglulu * This function sets the power mode of a partition. 239*91f16700Schasinglulu * 240*91f16700Schasinglulu * @param[in] ipc IPC handle 241*91f16700Schasinglulu * @param[in] pt handle of partition 242*91f16700Schasinglulu * @param[in] mode power mode to apply 243*91f16700Schasinglulu * 244*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 245*91f16700Schasinglulu * 246*91f16700Schasinglulu * Return errors: 247*91f16700Schasinglulu * - SC_ERR_PARM if invalid partition or mode, 248*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the owner or 249*91f16700Schasinglulu * parent of \a pt 250*91f16700Schasinglulu * 251*91f16700Schasinglulu * The power mode of the partitions is a max power any resource will 252*91f16700Schasinglulu * be set to. Calling this will result in all resources owned 253*91f16700Schasinglulu * by \a pt to have their power changed to the lower of \a mode or the 254*91f16700Schasinglulu * individual resource mode set using sc_pm_set_resource_power_mode(). 255*91f16700Schasinglulu */ 256*91f16700Schasinglulu sc_err_t sc_pm_set_partition_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt, 257*91f16700Schasinglulu sc_pm_power_mode_t mode); 258*91f16700Schasinglulu 259*91f16700Schasinglulu /*! 260*91f16700Schasinglulu * This function gets the power mode of a partition. 261*91f16700Schasinglulu * 262*91f16700Schasinglulu * @param[in] ipc IPC handle 263*91f16700Schasinglulu * @param[in] pt handle of partition 264*91f16700Schasinglulu * @param[out] mode pointer to return power mode 265*91f16700Schasinglulu * 266*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 267*91f16700Schasinglulu * 268*91f16700Schasinglulu * Return errors: 269*91f16700Schasinglulu * - SC_ERR_PARM if invalid partition 270*91f16700Schasinglulu */ 271*91f16700Schasinglulu sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt, 272*91f16700Schasinglulu sc_pm_power_mode_t *mode); 273*91f16700Schasinglulu 274*91f16700Schasinglulu /*! 275*91f16700Schasinglulu * This function sets the power mode of a resource. 276*91f16700Schasinglulu * 277*91f16700Schasinglulu * @param[in] ipc IPC handle 278*91f16700Schasinglulu * @param[in] resource ID of the resource 279*91f16700Schasinglulu * @param[in] mode power mode to apply 280*91f16700Schasinglulu * 281*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 282*91f16700Schasinglulu * 283*91f16700Schasinglulu * Return errors: 284*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or mode, 285*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the resource owner 286*91f16700Schasinglulu * or parent of the owner 287*91f16700Schasinglulu * 288*91f16700Schasinglulu * This function will record the individual resource power mode 289*91f16700Schasinglulu * and change it if the requested mode is lower than or equal to the 290*91f16700Schasinglulu * partition power mode set with sc_pm_set_partition_power_mode(). 291*91f16700Schasinglulu * In other words, the power mode of the resource will be the minimum 292*91f16700Schasinglulu * of the resource power mode and the partition power mode. 293*91f16700Schasinglulu * 294*91f16700Schasinglulu * Note some resources are still not accessible even when powered up if bus 295*91f16700Schasinglulu * transactions go through a fabric not powered up. Examples of this are 296*91f16700Schasinglulu * resources in display and capture subsystems which require the display 297*91f16700Schasinglulu * controller or the imaging subsystem to be powered up first. 298*91f16700Schasinglulu * 299*91f16700Schasinglulu * Not that resources are grouped into power domains by the underlying 300*91f16700Schasinglulu * hardware. If any resource in the domain is on, the entire power domain 301*91f16700Schasinglulu * will be on. Other power domains required to access the resource will 302*91f16700Schasinglulu * also be turned on. Clocks required to access the peripheral will be 303*91f16700Schasinglulu * turned on. Refer to the SoC RM for more info on power domains and access 304*91f16700Schasinglulu * infrastructure (bus fabrics, clock domains, etc.). 305*91f16700Schasinglulu */ 306*91f16700Schasinglulu sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource, 307*91f16700Schasinglulu sc_pm_power_mode_t mode); 308*91f16700Schasinglulu 309*91f16700Schasinglulu /*! 310*91f16700Schasinglulu * This function gets the power mode of a resource. 311*91f16700Schasinglulu * 312*91f16700Schasinglulu * @param[in] ipc IPC handle 313*91f16700Schasinglulu * @param[in] resource ID of the resource 314*91f16700Schasinglulu * @param[out] mode pointer to return power mode 315*91f16700Schasinglulu * 316*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 317*91f16700Schasinglulu * 318*91f16700Schasinglulu * Note only SC_PM_PW_MODE_OFF and SC_PM_PW_MODE_ON are valid. The value 319*91f16700Schasinglulu * returned does not reflect the power mode of the partition.. 320*91f16700Schasinglulu */ 321*91f16700Schasinglulu sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource, 322*91f16700Schasinglulu sc_pm_power_mode_t *mode); 323*91f16700Schasinglulu 324*91f16700Schasinglulu /*! 325*91f16700Schasinglulu * This function requests the low power mode some of the resources 326*91f16700Schasinglulu * can enter based on their state. This API is only valid for the 327*91f16700Schasinglulu * following resources : SC_R_A53, SC_R_A53_0, SC_R_A53_1, SC_A53_2, 328*91f16700Schasinglulu * SC_A53_3, SC_R_A72, SC_R_A72_0, SC_R_A72_1, SC_R_CC1, SC_R_A35, 329*91f16700Schasinglulu * SC_R_A35_0, SC_R_A35_1, SC_R_A35_2, SC_R_A35_3. 330*91f16700Schasinglulu * For all other resources it will return SC_ERR_PARAM. 331*91f16700Schasinglulu * This function will set the low power mode the cores, cluster 332*91f16700Schasinglulu * and cluster associated resources will enter when all the cores 333*91f16700Schasinglulu * in a given cluster execute WFI 334*91f16700Schasinglulu * 335*91f16700Schasinglulu * @param[in] ipc IPC handle 336*91f16700Schasinglulu * @param[in] resource ID of the resource 337*91f16700Schasinglulu * @param[in] mode power mode to apply 338*91f16700Schasinglulu * 339*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 340*91f16700Schasinglulu * 341*91f16700Schasinglulu */ 342*91f16700Schasinglulu sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource, 343*91f16700Schasinglulu sc_pm_power_mode_t mode); 344*91f16700Schasinglulu 345*91f16700Schasinglulu /*! 346*91f16700Schasinglulu * This function requests low-power mode entry for CPU/cluster 347*91f16700Schasinglulu * resources. This API is only valid for the following resources: 348*91f16700Schasinglulu * SC_R_A53, SC_R_A53_x, SC_R_A72, SC_R_A72_x, SC_R_A35, SC_R_A35_x, 349*91f16700Schasinglulu * SC_R_CCI. For all other resources it will return SC_ERR_PARAM. 350*91f16700Schasinglulu * For individual core resources, the specified power mode 351*91f16700Schasinglulu * and wake source will be applied after the core has entered 352*91f16700Schasinglulu * WFI. For cluster resources, the specified power mode is 353*91f16700Schasinglulu * applied after all cores in the cluster have entered low-power mode. 354*91f16700Schasinglulu * For multicluster resources, the specified power mode is applied 355*91f16700Schasinglulu * after all clusters have reached low-power mode. 356*91f16700Schasinglulu * 357*91f16700Schasinglulu * @param[in] ipc IPC handle 358*91f16700Schasinglulu * @param[in] resource ID of the resource 359*91f16700Schasinglulu * @param[in] mode power mode to apply 360*91f16700Schasinglulu * @param[in] wake_src wake source for low-power exit 361*91f16700Schasinglulu * 362*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 363*91f16700Schasinglulu * 364*91f16700Schasinglulu */ 365*91f16700Schasinglulu sc_err_t sc_pm_req_cpu_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource, 366*91f16700Schasinglulu sc_pm_power_mode_t mode, 367*91f16700Schasinglulu sc_pm_wake_src_t wake_src); 368*91f16700Schasinglulu 369*91f16700Schasinglulu /*! 370*91f16700Schasinglulu * This function is used to set the resume address of a CPU. 371*91f16700Schasinglulu * 372*91f16700Schasinglulu * @param[in] ipc IPC handle 373*91f16700Schasinglulu * @param[in] resource ID of the CPU resource 374*91f16700Schasinglulu * @param[in] address 64-bit resume address 375*91f16700Schasinglulu * 376*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 377*91f16700Schasinglulu * 378*91f16700Schasinglulu * Return errors: 379*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or address, 380*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the parent of the 381*91f16700Schasinglulu * resource (CPU) owner 382*91f16700Schasinglulu */ 383*91f16700Schasinglulu sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource, 384*91f16700Schasinglulu sc_faddr_t address); 385*91f16700Schasinglulu 386*91f16700Schasinglulu /*! 387*91f16700Schasinglulu * This function is used to set parameters for CPU resume from 388*91f16700Schasinglulu * low-power mode. 389*91f16700Schasinglulu * 390*91f16700Schasinglulu * @param[in] ipc IPC handle 391*91f16700Schasinglulu * @param[in] resource ID of the CPU resource 392*91f16700Schasinglulu * @param[in] isPrimary set SC_TRUE if primary wake CPU 393*91f16700Schasinglulu * @param[in] address 64-bit resume address 394*91f16700Schasinglulu * 395*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 396*91f16700Schasinglulu * 397*91f16700Schasinglulu * Return errors: 398*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or address, 399*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the parent of the 400*91f16700Schasinglulu * resource (CPU) owner 401*91f16700Schasinglulu */ 402*91f16700Schasinglulu sc_err_t sc_pm_set_cpu_resume(sc_ipc_t ipc, sc_rsrc_t resource, 403*91f16700Schasinglulu sc_bool_t isPrimary, sc_faddr_t address); 404*91f16700Schasinglulu 405*91f16700Schasinglulu /*! 406*91f16700Schasinglulu * This function requests the power mode configuration for system-level 407*91f16700Schasinglulu * interfaces including messaging units, interconnect, and memories. This API 408*91f16700Schasinglulu * is only valid for the following resources : SC_R_A53, SC_R_A72, and 409*91f16700Schasinglulu * SC_R_M4_x_PID_y. For all other resources, it will return SC_ERR_PARAM. 410*91f16700Schasinglulu * The requested power mode will be captured and applied to system-level 411*91f16700Schasinglulu * resources as system conditions allow. 412*91f16700Schasinglulu * 413*91f16700Schasinglulu * @param[in] ipc IPC handle 414*91f16700Schasinglulu * @param[in] resource ID of the resource 415*91f16700Schasinglulu * @param[in] sys_if system-level interface to be configured 416*91f16700Schasinglulu * @param[in] hpm high-power mode for the system interface 417*91f16700Schasinglulu * @param[in] lpm low-power mode for the system interface 418*91f16700Schasinglulu * 419*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 420*91f16700Schasinglulu * 421*91f16700Schasinglulu */ 422*91f16700Schasinglulu sc_err_t sc_pm_req_sys_if_power_mode(sc_ipc_t ipc, sc_rsrc_t resource, 423*91f16700Schasinglulu sc_pm_sys_if_t sys_if, 424*91f16700Schasinglulu sc_pm_power_mode_t hpm, 425*91f16700Schasinglulu sc_pm_power_mode_t lpm); 426*91f16700Schasinglulu 427*91f16700Schasinglulu /* @} */ 428*91f16700Schasinglulu 429*91f16700Schasinglulu /*! 430*91f16700Schasinglulu * @name Clock/PLL Functions 431*91f16700Schasinglulu * @{ 432*91f16700Schasinglulu */ 433*91f16700Schasinglulu 434*91f16700Schasinglulu /*! 435*91f16700Schasinglulu * This function sets the rate of a resource's clock/PLL. 436*91f16700Schasinglulu * 437*91f16700Schasinglulu * @param[in] ipc IPC handle 438*91f16700Schasinglulu * @param[in] resource ID of the resource 439*91f16700Schasinglulu * @param[in] clk clock/PLL to affect 440*91f16700Schasinglulu * @param[in,out] rate pointer to rate to set, 441*91f16700Schasinglulu * return actual rate 442*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 443*91f16700Schasinglulu * 444*91f16700Schasinglulu * Return errors: 445*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or clock/PLL, 446*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the resource owner 447*91f16700Schasinglulu * or parent of the owner, 448*91f16700Schasinglulu * - SC_ERR_UNAVAILABLE if clock/PLL not applicable to this resource, 449*91f16700Schasinglulu * - SC_ERR_LOCKED if rate locked (usually because shared clock/PLL) 450*91f16700Schasinglulu * 451*91f16700Schasinglulu * Refer to the [Clock List](@ref CLOCKS) for valid clock/PLL values. 452*91f16700Schasinglulu */ 453*91f16700Schasinglulu sc_err_t sc_pm_set_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource, 454*91f16700Schasinglulu sc_pm_clk_t clk, sc_pm_clock_rate_t *rate); 455*91f16700Schasinglulu 456*91f16700Schasinglulu /*! 457*91f16700Schasinglulu * This function gets the rate of a resource's clock/PLL. 458*91f16700Schasinglulu * 459*91f16700Schasinglulu * @param[in] ipc IPC handle 460*91f16700Schasinglulu * @param[in] resource ID of the resource 461*91f16700Schasinglulu * @param[in] clk clock/PLL to affect 462*91f16700Schasinglulu * @param[out] rate pointer to return rate 463*91f16700Schasinglulu * 464*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 465*91f16700Schasinglulu * 466*91f16700Schasinglulu * Return errors: 467*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or clock/PLL, 468*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the resource owner 469*91f16700Schasinglulu * or parent of the owner, 470*91f16700Schasinglulu * - SC_ERR_UNAVAILABLE if clock/PLL not applicable to this resource 471*91f16700Schasinglulu * 472*91f16700Schasinglulu * Refer to the [Clock List](@ref CLOCKS) for valid clock/PLL values. 473*91f16700Schasinglulu */ 474*91f16700Schasinglulu sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource, 475*91f16700Schasinglulu sc_pm_clk_t clk, sc_pm_clock_rate_t *rate); 476*91f16700Schasinglulu 477*91f16700Schasinglulu /*! 478*91f16700Schasinglulu * This function enables/disables a resource's clock. 479*91f16700Schasinglulu * 480*91f16700Schasinglulu * @param[in] ipc IPC handle 481*91f16700Schasinglulu * @param[in] resource ID of the resource 482*91f16700Schasinglulu * @param[in] clk clock to affect 483*91f16700Schasinglulu * @param[in] enable enable if SC_TRUE; otherwise disabled 484*91f16700Schasinglulu * @param[in] autog HW auto clock gating 485*91f16700Schasinglulu * 486*91f16700Schasinglulu * If \a resource is SC_R_ALL then all resources owned will be affected. 487*91f16700Schasinglulu * No error will be returned. 488*91f16700Schasinglulu * 489*91f16700Schasinglulu * If \a clk is SC_PM_CLK_ALL, then an error will be returned if any 490*91f16700Schasinglulu * of the available clocks returns an error. 491*91f16700Schasinglulu * 492*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 493*91f16700Schasinglulu * 494*91f16700Schasinglulu * Return errors: 495*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or clock, 496*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the resource owner 497*91f16700Schasinglulu * or parent of the owner, 498*91f16700Schasinglulu * - SC_ERR_UNAVAILABLE if clock not applicable to this resource 499*91f16700Schasinglulu * 500*91f16700Schasinglulu * Refer to the [Clock List](@ref CLOCKS) for valid clock values. 501*91f16700Schasinglulu */ 502*91f16700Schasinglulu sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource, 503*91f16700Schasinglulu sc_pm_clk_t clk, sc_bool_t enable, sc_bool_t autog); 504*91f16700Schasinglulu 505*91f16700Schasinglulu /*! 506*91f16700Schasinglulu * This function sets the parent of a resource's clock. 507*91f16700Schasinglulu * This function should only be called when the clock is disabled. 508*91f16700Schasinglulu * 509*91f16700Schasinglulu * @param[in] ipc IPC handle 510*91f16700Schasinglulu * @param[in] resource ID of the resource 511*91f16700Schasinglulu * @param[in] clk clock to affect 512*91f16700Schasinglulu * @param[in] parent New parent of the clock. 513*91f16700Schasinglulu * 514*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 515*91f16700Schasinglulu * 516*91f16700Schasinglulu * Return errors: 517*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or clock, 518*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the resource owner 519*91f16700Schasinglulu * or parent of the owner, 520*91f16700Schasinglulu * - SC_ERR_UNAVAILABLE if clock not applicable to this resource 521*91f16700Schasinglulu * - SC_ERR_BUSY if clock is currently enabled. 522*91f16700Schasinglulu * - SC_ERR_NOPOWER if resource not powered 523*91f16700Schasinglulu * 524*91f16700Schasinglulu * Refer to the [Clock List](@ref CLOCKS) for valid clock values. 525*91f16700Schasinglulu */ 526*91f16700Schasinglulu sc_err_t sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource, 527*91f16700Schasinglulu sc_pm_clk_t clk, sc_pm_clk_parent_t parent); 528*91f16700Schasinglulu 529*91f16700Schasinglulu /*! 530*91f16700Schasinglulu * This function gets the parent of a resource's clock. 531*91f16700Schasinglulu * 532*91f16700Schasinglulu * @param[in] ipc IPC handle 533*91f16700Schasinglulu * @param[in] resource ID of the resource 534*91f16700Schasinglulu * @param[in] clk clock to affect 535*91f16700Schasinglulu * @param[out] parent pointer to return parent of clock. 536*91f16700Schasinglulu * 537*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 538*91f16700Schasinglulu * 539*91f16700Schasinglulu * Return errors: 540*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or clock, 541*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the resource owner 542*91f16700Schasinglulu * or parent of the owner, 543*91f16700Schasinglulu * - SC_ERR_UNAVAILABLE if clock not applicable to this resource 544*91f16700Schasinglulu * 545*91f16700Schasinglulu * Refer to the [Clock List](@ref CLOCKS) for valid clock values. 546*91f16700Schasinglulu */ 547*91f16700Schasinglulu sc_err_t sc_pm_get_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource, 548*91f16700Schasinglulu sc_pm_clk_t clk, sc_pm_clk_parent_t *parent); 549*91f16700Schasinglulu 550*91f16700Schasinglulu /* @} */ 551*91f16700Schasinglulu 552*91f16700Schasinglulu /*! 553*91f16700Schasinglulu * @name Reset Functions 554*91f16700Schasinglulu * @{ 555*91f16700Schasinglulu */ 556*91f16700Schasinglulu 557*91f16700Schasinglulu /*! 558*91f16700Schasinglulu * This function is used to reset the system. Only the owner of the 559*91f16700Schasinglulu * SC_R_SYSTEM resource can do this. 560*91f16700Schasinglulu * 561*91f16700Schasinglulu * @param[in] ipc IPC handle 562*91f16700Schasinglulu * @param[in] type reset type 563*91f16700Schasinglulu * 564*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 565*91f16700Schasinglulu * 566*91f16700Schasinglulu * Return errors: 567*91f16700Schasinglulu * - SC_ERR_PARM if invalid type, 568*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller not the owner of SC_R_SYSTEM 569*91f16700Schasinglulu * 570*91f16700Schasinglulu * If this function returns, then the reset did not occur due to an 571*91f16700Schasinglulu * invalid parameter. 572*91f16700Schasinglulu */ 573*91f16700Schasinglulu sc_err_t sc_pm_reset(sc_ipc_t ipc, sc_pm_reset_type_t type); 574*91f16700Schasinglulu 575*91f16700Schasinglulu /*! 576*91f16700Schasinglulu * This function gets a caller's reset reason. 577*91f16700Schasinglulu * 578*91f16700Schasinglulu * @param[in] ipc IPC handle 579*91f16700Schasinglulu * @param[out] reason pointer to return reset reason 580*91f16700Schasinglulu * 581*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 582*91f16700Schasinglulu */ 583*91f16700Schasinglulu sc_err_t sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason); 584*91f16700Schasinglulu 585*91f16700Schasinglulu /*! 586*91f16700Schasinglulu * This function is used to boot a partition. 587*91f16700Schasinglulu * 588*91f16700Schasinglulu * @param[in] ipc IPC handle 589*91f16700Schasinglulu * @param[in] pt handle of partition to boot 590*91f16700Schasinglulu * @param[in] resource_cpu ID of the CPU resource to start 591*91f16700Schasinglulu * @param[in] boot_addr 64-bit boot address 592*91f16700Schasinglulu * @param[in] resource_mu ID of the MU that must be powered 593*91f16700Schasinglulu * @param[in] resource_dev ID of the boot device that must be powered 594*91f16700Schasinglulu * 595*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 596*91f16700Schasinglulu * 597*91f16700Schasinglulu * Return errors: 598*91f16700Schasinglulu * - SC_ERR_PARM if invalid partition, resource, or addr, 599*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the parent of the 600*91f16700Schasinglulu * partition to boot 601*91f16700Schasinglulu */ 602*91f16700Schasinglulu sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt, 603*91f16700Schasinglulu sc_rsrc_t resource_cpu, sc_faddr_t boot_addr, 604*91f16700Schasinglulu sc_rsrc_t resource_mu, sc_rsrc_t resource_dev); 605*91f16700Schasinglulu 606*91f16700Schasinglulu /*! 607*91f16700Schasinglulu * This function is used to reboot the caller's partition. 608*91f16700Schasinglulu * 609*91f16700Schasinglulu * @param[in] ipc IPC handle 610*91f16700Schasinglulu * @param[in] type reset type 611*91f16700Schasinglulu * 612*91f16700Schasinglulu * If \a type is SC_PM_RESET_TYPE_COLD, then most peripherals owned by 613*91f16700Schasinglulu * the calling partition will be reset if possible. SC state (partitions, 614*91f16700Schasinglulu * power, clocks, etc.) is reset. The boot SW of the booting CPU must be 615*91f16700Schasinglulu * able to handle peripherals that that are not reset. 616*91f16700Schasinglulu * 617*91f16700Schasinglulu * If \a type is SC_PM_RESET_TYPE_WARM, then only the boot CPU is reset. 618*91f16700Schasinglulu * SC state (partitions, power, clocks, etc.) are NOT reset. The boot SW 619*91f16700Schasinglulu * of the booting CPU must be able to handle peripherals and SC state that 620*91f16700Schasinglulu * that are not reset. 621*91f16700Schasinglulu * 622*91f16700Schasinglulu * If \a type is SC_PM_RESET_TYPE_BOARD, then return with no action. 623*91f16700Schasinglulu * 624*91f16700Schasinglulu * If this function returns, then the reset did not occur due to an 625*91f16700Schasinglulu * invalid parameter. 626*91f16700Schasinglulu */ 627*91f16700Schasinglulu void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type); 628*91f16700Schasinglulu 629*91f16700Schasinglulu /*! 630*91f16700Schasinglulu * This function is used to reboot a partition. 631*91f16700Schasinglulu * 632*91f16700Schasinglulu * @param[in] ipc IPC handle 633*91f16700Schasinglulu * @param[in] pt handle of partition to reboot 634*91f16700Schasinglulu * @param[in] type reset type 635*91f16700Schasinglulu * 636*91f16700Schasinglulu * If \a type is SC_PM_RESET_TYPE_COLD, then most peripherals owned by 637*91f16700Schasinglulu * the calling partition will be reset if possible. SC state (partitions, 638*91f16700Schasinglulu * power, clocks, etc.) is reset. The boot SW of the booting CPU must be 639*91f16700Schasinglulu * able to handle peripherals that that are not reset. 640*91f16700Schasinglulu * 641*91f16700Schasinglulu * If \a type is SC_PM_RESET_TYPE_WARM, then only the boot CPU is reset. 642*91f16700Schasinglulu * SC state (partitions, power, clocks, etc.) are NOT reset. The boot SW 643*91f16700Schasinglulu * of the booting CPU must be able to handle peripherals and SC state that 644*91f16700Schasinglulu * that are not reset. 645*91f16700Schasinglulu * 646*91f16700Schasinglulu * If \a type is SC_PM_RESET_TYPE_BOARD, then return with no action. 647*91f16700Schasinglulu * 648*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 649*91f16700Schasinglulu * 650*91f16700Schasinglulu * Return errors: 651*91f16700Schasinglulu * - SC_ERR_PARM if invalid partition or type 652*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the parent of \a pt, 653*91f16700Schasinglulu * 654*91f16700Schasinglulu * Most peripherals owned by the partition will be reset if 655*91f16700Schasinglulu * possible. SC state (partitions, power, clocks, etc.) is reset. The 656*91f16700Schasinglulu * boot SW of the booting CPU must be able to handle peripherals that 657*91f16700Schasinglulu * that are not reset. 658*91f16700Schasinglulu */ 659*91f16700Schasinglulu sc_err_t sc_pm_reboot_partition(sc_ipc_t ipc, sc_rm_pt_t pt, 660*91f16700Schasinglulu sc_pm_reset_type_t type); 661*91f16700Schasinglulu 662*91f16700Schasinglulu /*! 663*91f16700Schasinglulu * This function is used to start/stop a CPU. 664*91f16700Schasinglulu * 665*91f16700Schasinglulu * @param[in] ipc IPC handle 666*91f16700Schasinglulu * @param[in] resource ID of the CPU resource 667*91f16700Schasinglulu * @param[in] enable start if SC_TRUE; otherwise stop 668*91f16700Schasinglulu * @param[in] address 64-bit boot address 669*91f16700Schasinglulu * 670*91f16700Schasinglulu * @return Returns an error code (SC_ERR_NONE = success). 671*91f16700Schasinglulu * 672*91f16700Schasinglulu * Return errors: 673*91f16700Schasinglulu * - SC_ERR_PARM if invalid resource or address, 674*91f16700Schasinglulu * - SC_ERR_NOACCESS if caller's partition is not the parent of the 675*91f16700Schasinglulu * resource (CPU) owner 676*91f16700Schasinglulu */ 677*91f16700Schasinglulu sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable, 678*91f16700Schasinglulu sc_faddr_t address); 679*91f16700Schasinglulu 680*91f16700Schasinglulu /* @} */ 681*91f16700Schasinglulu 682*91f16700Schasinglulu #endif /* SCI_PM_API_H */ 683*91f16700Schasinglulu 684*91f16700Schasinglulu /**@}*/ 685