1*c66ec88fSEmmanuel VadotRPMH RSC: 2*c66ec88fSEmmanuel Vadot------------ 3*c66ec88fSEmmanuel Vadot 4*c66ec88fSEmmanuel VadotResource Power Manager Hardened (RPMH) is the mechanism for communicating with 5*c66ec88fSEmmanuel Vadotthe hardened resource accelerators on Qualcomm SoCs. Requests to the resources 6*c66ec88fSEmmanuel Vadotcan be written to the Trigger Command Set (TCS) registers and using a (addr, 7*c66ec88fSEmmanuel Vadotval) pair and triggered. Messages in the TCS are then sent in sequence over an 8*c66ec88fSEmmanuel Vadotinternal bus. 9*c66ec88fSEmmanuel Vadot 10*c66ec88fSEmmanuel VadotThe hardware block (Direct Resource Voter or DRV) is a part of the h/w entity 11*c66ec88fSEmmanuel Vadot(Resource State Coordinator a.k.a RSC) that can handle multiple sleep and 12*c66ec88fSEmmanuel Vadotactive/wake resource requests. Multiple such DRVs can exist in a SoC and can 13*c66ec88fSEmmanuel Vadotbe written to from Linux. The structure of each DRV follows the same template 14*c66ec88fSEmmanuel Vadotwith a few variations that are captured by the properties here. 15*c66ec88fSEmmanuel Vadot 16*c66ec88fSEmmanuel VadotA TCS may be triggered from Linux or triggered by the F/W after all the CPUs 17*c66ec88fSEmmanuel Vadothave powered off to facilitate idle power saving. TCS could be classified as - 18*c66ec88fSEmmanuel Vadot 19*c66ec88fSEmmanuel Vadot ACTIVE /* Triggered by Linux */ 20*c66ec88fSEmmanuel Vadot SLEEP /* Triggered by F/W */ 21*c66ec88fSEmmanuel Vadot WAKE /* Triggered by F/W */ 22*c66ec88fSEmmanuel Vadot CONTROL /* Triggered by F/W */ 23*c66ec88fSEmmanuel Vadot 24*c66ec88fSEmmanuel VadotThe order in which they are described in the DT, should match the hardware 25*c66ec88fSEmmanuel Vadotconfiguration. 26*c66ec88fSEmmanuel Vadot 27*c66ec88fSEmmanuel VadotRequests can be made for the state of a resource, when the subsystem is active 28*c66ec88fSEmmanuel Vadotor idle. When all subsystems like Modem, GPU, CPU are idle, the resource state 29*c66ec88fSEmmanuel Vadotwill be an aggregate of the sleep votes from each of those subsystems. Clients 30*c66ec88fSEmmanuel Vadotmay request a sleep value for their shared resources in addition to the active 31*c66ec88fSEmmanuel Vadotmode requests. 32*c66ec88fSEmmanuel Vadot 33*c66ec88fSEmmanuel VadotProperties: 34*c66ec88fSEmmanuel Vadot 35*c66ec88fSEmmanuel Vadot- compatible: 36*c66ec88fSEmmanuel Vadot Usage: required 37*c66ec88fSEmmanuel Vadot Value type: <string> 38*c66ec88fSEmmanuel Vadot Definition: Should be "qcom,rpmh-rsc". 39*c66ec88fSEmmanuel Vadot 40*c66ec88fSEmmanuel Vadot- reg: 41*c66ec88fSEmmanuel Vadot Usage: required 42*c66ec88fSEmmanuel Vadot Value type: <prop-encoded-array> 43*c66ec88fSEmmanuel Vadot Definition: The first register specifies the base address of the 44*c66ec88fSEmmanuel Vadot DRV(s). The number of DRVs in the dependent on the RSC. 45*c66ec88fSEmmanuel Vadot The tcs-offset specifies the start address of the 46*c66ec88fSEmmanuel Vadot TCS in the DRVs. 47*c66ec88fSEmmanuel Vadot 48*c66ec88fSEmmanuel Vadot- reg-names: 49*c66ec88fSEmmanuel Vadot Usage: required 50*c66ec88fSEmmanuel Vadot Value type: <string> 51*c66ec88fSEmmanuel Vadot Definition: Maps the register specified in the reg property. Must be 52*c66ec88fSEmmanuel Vadot "drv-0", "drv-1", "drv-2" etc and "tcs-offset". The 53*c66ec88fSEmmanuel Vadot 54*c66ec88fSEmmanuel Vadot- interrupts: 55*c66ec88fSEmmanuel Vadot Usage: required 56*c66ec88fSEmmanuel Vadot Value type: <prop-encoded-interrupt> 57*c66ec88fSEmmanuel Vadot Definition: The interrupt that trips when a message complete/response 58*c66ec88fSEmmanuel Vadot is received for this DRV from the accelerators. 59*c66ec88fSEmmanuel Vadot 60*c66ec88fSEmmanuel Vadot- qcom,drv-id: 61*c66ec88fSEmmanuel Vadot Usage: required 62*c66ec88fSEmmanuel Vadot Value type: <u32> 63*c66ec88fSEmmanuel Vadot Definition: The id of the DRV in the RSC block that will be used by 64*c66ec88fSEmmanuel Vadot this controller. 65*c66ec88fSEmmanuel Vadot 66*c66ec88fSEmmanuel Vadot- qcom,tcs-config: 67*c66ec88fSEmmanuel Vadot Usage: required 68*c66ec88fSEmmanuel Vadot Value type: <prop-encoded-array> 69*c66ec88fSEmmanuel Vadot Definition: The tuple defining the configuration of TCS. 70*c66ec88fSEmmanuel Vadot Must have 2 cells which describe each TCS type. 71*c66ec88fSEmmanuel Vadot <type number_of_tcs>. 72*c66ec88fSEmmanuel Vadot The order of the TCS must match the hardware 73*c66ec88fSEmmanuel Vadot configuration. 74*c66ec88fSEmmanuel Vadot - Cell #1 (TCS Type): TCS types to be specified - 75*c66ec88fSEmmanuel Vadot ACTIVE_TCS 76*c66ec88fSEmmanuel Vadot SLEEP_TCS 77*c66ec88fSEmmanuel Vadot WAKE_TCS 78*c66ec88fSEmmanuel Vadot CONTROL_TCS 79*c66ec88fSEmmanuel Vadot - Cell #2 (Number of TCS): <u32> 80*c66ec88fSEmmanuel Vadot 81*c66ec88fSEmmanuel Vadot- label: 82*c66ec88fSEmmanuel Vadot Usage: optional 83*c66ec88fSEmmanuel Vadot Value type: <string> 84*c66ec88fSEmmanuel Vadot Definition: Name for the RSC. The name would be used in trace logs. 85*c66ec88fSEmmanuel Vadot 86*c66ec88fSEmmanuel VadotDrivers that want to use the RSC to communicate with RPMH must specify their 87*c66ec88fSEmmanuel Vadotbindings as child nodes of the RSC controllers they wish to communicate with. 88*c66ec88fSEmmanuel Vadot 89*c66ec88fSEmmanuel VadotExample 1: 90*c66ec88fSEmmanuel Vadot 91*c66ec88fSEmmanuel VadotFor a TCS whose RSC base address is is 0x179C0000 and is at a DRV id of 2, the 92*c66ec88fSEmmanuel Vadotregister offsets for DRV2 start at 0D00, the register calculations are like 93*c66ec88fSEmmanuel Vadotthis - 94*c66ec88fSEmmanuel VadotDRV0: 0x179C0000 95*c66ec88fSEmmanuel VadotDRV2: 0x179C0000 + 0x10000 = 0x179D0000 96*c66ec88fSEmmanuel VadotDRV2: 0x179C0000 + 0x10000 * 2 = 0x179E0000 97*c66ec88fSEmmanuel VadotTCS-OFFSET: 0xD00 98*c66ec88fSEmmanuel Vadot 99*c66ec88fSEmmanuel Vadot apps_rsc: rsc@179c0000 { 100*c66ec88fSEmmanuel Vadot label = "apps_rsc"; 101*c66ec88fSEmmanuel Vadot compatible = "qcom,rpmh-rsc"; 102*c66ec88fSEmmanuel Vadot reg = <0x179c0000 0x10000>, 103*c66ec88fSEmmanuel Vadot <0x179d0000 0x10000>, 104*c66ec88fSEmmanuel Vadot <0x179e0000 0x10000>; 105*c66ec88fSEmmanuel Vadot reg-names = "drv-0", "drv-1", "drv-2"; 106*c66ec88fSEmmanuel Vadot interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, 107*c66ec88fSEmmanuel Vadot <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, 108*c66ec88fSEmmanuel Vadot <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>; 109*c66ec88fSEmmanuel Vadot qcom,tcs-offset = <0xd00>; 110*c66ec88fSEmmanuel Vadot qcom,drv-id = <2>; 111*c66ec88fSEmmanuel Vadot qcom,tcs-config = <ACTIVE_TCS 2>, 112*c66ec88fSEmmanuel Vadot <SLEEP_TCS 3>, 113*c66ec88fSEmmanuel Vadot <WAKE_TCS 3>, 114*c66ec88fSEmmanuel Vadot <CONTROL_TCS 1>; 115*c66ec88fSEmmanuel Vadot }; 116*c66ec88fSEmmanuel Vadot 117*c66ec88fSEmmanuel VadotExample 2: 118*c66ec88fSEmmanuel Vadot 119*c66ec88fSEmmanuel VadotFor a TCS whose RSC base address is 0xAF20000 and is at DRV id of 0, the 120*c66ec88fSEmmanuel Vadotregister offsets for DRV0 start at 01C00, the register calculations are like 121*c66ec88fSEmmanuel Vadotthis - 122*c66ec88fSEmmanuel VadotDRV0: 0xAF20000 123*c66ec88fSEmmanuel VadotTCS-OFFSET: 0x1C00 124*c66ec88fSEmmanuel Vadot 125*c66ec88fSEmmanuel Vadot disp_rsc: rsc@af20000 { 126*c66ec88fSEmmanuel Vadot label = "disp_rsc"; 127*c66ec88fSEmmanuel Vadot compatible = "qcom,rpmh-rsc"; 128*c66ec88fSEmmanuel Vadot reg = <0xaf20000 0x10000>; 129*c66ec88fSEmmanuel Vadot reg-names = "drv-0"; 130*c66ec88fSEmmanuel Vadot interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>; 131*c66ec88fSEmmanuel Vadot qcom,tcs-offset = <0x1c00>; 132*c66ec88fSEmmanuel Vadot qcom,drv-id = <0>; 133*c66ec88fSEmmanuel Vadot qcom,tcs-config = <ACTIVE_TCS 0>, 134*c66ec88fSEmmanuel Vadot <SLEEP_TCS 1>, 135*c66ec88fSEmmanuel Vadot <WAKE_TCS 1>, 136*c66ec88fSEmmanuel Vadot <CONTROL_TCS 0>; 137*c66ec88fSEmmanuel Vadot }; 138