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