1*c66ec88fSEmmanuel VadotSystem Control and Power Interface (SCPI) Message Protocol
2*c66ec88fSEmmanuel Vadot----------------------------------------------------------
3*c66ec88fSEmmanuel Vadot
4*c66ec88fSEmmanuel VadotFirmware implementing the SCPI described in ARM document number ARM DUI 0922B
5*c66ec88fSEmmanuel Vadot("ARM Compute Subsystem SCP: Message Interface Protocols")[0] can be used
6*c66ec88fSEmmanuel Vadotby Linux to initiate various system control and power operations.
7*c66ec88fSEmmanuel Vadot
8*c66ec88fSEmmanuel VadotRequired properties:
9*c66ec88fSEmmanuel Vadot
10*c66ec88fSEmmanuel Vadot- compatible : should be
11*c66ec88fSEmmanuel Vadot	* "arm,scpi" : For implementations complying to SCPI v1.0 or above
12*c66ec88fSEmmanuel Vadot	* "arm,scpi-pre-1.0" : For implementations complying to all
13*c66ec88fSEmmanuel Vadot		unversioned releases prior to SCPI v1.0
14*c66ec88fSEmmanuel Vadot- mboxes: List of phandle and mailbox channel specifiers
15*c66ec88fSEmmanuel Vadot	  All the channels reserved by remote SCP firmware for use by
16*c66ec88fSEmmanuel Vadot	  SCPI message protocol should be specified in any order
17*c66ec88fSEmmanuel Vadot- shmem : List of phandle pointing to the shared memory(SHM) area between the
18*c66ec88fSEmmanuel Vadot	  processors using these mailboxes for IPC, one for each mailbox
19*c66ec88fSEmmanuel Vadot	  SHM can be any memory reserved for the purpose of this communication
20*c66ec88fSEmmanuel Vadot	  between the processors.
21*c66ec88fSEmmanuel Vadot
22*c66ec88fSEmmanuel VadotSee Documentation/devicetree/bindings/mailbox/mailbox.txt
23*c66ec88fSEmmanuel Vadotfor more details about the generic mailbox controller and
24*c66ec88fSEmmanuel Vadotclient driver bindings.
25*c66ec88fSEmmanuel Vadot
26*c66ec88fSEmmanuel VadotClock bindings for the clocks based on SCPI Message Protocol
27*c66ec88fSEmmanuel Vadot------------------------------------------------------------
28*c66ec88fSEmmanuel Vadot
29*c66ec88fSEmmanuel VadotThis binding uses the common clock binding[1].
30*c66ec88fSEmmanuel Vadot
31*c66ec88fSEmmanuel VadotContainer Node
32*c66ec88fSEmmanuel Vadot==============
33*c66ec88fSEmmanuel VadotRequired properties:
34*c66ec88fSEmmanuel Vadot- compatible : should be "arm,scpi-clocks"
35*c66ec88fSEmmanuel Vadot	       All the clocks provided by SCP firmware via SCPI message
36*c66ec88fSEmmanuel Vadot	       protocol much be listed as sub-nodes under this node.
37*c66ec88fSEmmanuel Vadot
38*c66ec88fSEmmanuel VadotSub-nodes
39*c66ec88fSEmmanuel Vadot=========
40*c66ec88fSEmmanuel VadotRequired properties:
41*c66ec88fSEmmanuel Vadot- compatible : shall include one of the following
42*c66ec88fSEmmanuel Vadot	"arm,scpi-dvfs-clocks" - all the clocks that are variable and index based.
43*c66ec88fSEmmanuel Vadot		These clocks don't provide an entire range of values between the
44*c66ec88fSEmmanuel Vadot		limits but only discrete points within the range. The firmware
45*c66ec88fSEmmanuel Vadot		provides the mapping for each such operating frequency and the
46*c66ec88fSEmmanuel Vadot		index associated with it. The firmware also manages the
47*c66ec88fSEmmanuel Vadot		voltage scaling appropriately with the clock scaling.
48*c66ec88fSEmmanuel Vadot	"arm,scpi-variable-clocks" - all the clocks that are variable and provide full
49*c66ec88fSEmmanuel Vadot		range within the specified range. The firmware provides the
50*c66ec88fSEmmanuel Vadot		range of values within a specified range.
51*c66ec88fSEmmanuel Vadot
52*c66ec88fSEmmanuel VadotOther required properties for all clocks(all from common clock binding):
53*c66ec88fSEmmanuel Vadot- #clock-cells : Should be 1. Contains the Clock ID value used by SCPI commands.
54*c66ec88fSEmmanuel Vadot- clock-output-names : shall be the corresponding names of the outputs.
55*c66ec88fSEmmanuel Vadot- clock-indices: The identifying number for the clocks(i.e.clock_id) in the
56*c66ec88fSEmmanuel Vadot	node. It can be non linear and hence provide the mapping of identifiers
57*c66ec88fSEmmanuel Vadot	into the clock-output-names array.
58*c66ec88fSEmmanuel Vadot
59*c66ec88fSEmmanuel VadotSRAM and Shared Memory for SCPI
60*c66ec88fSEmmanuel Vadot-------------------------------
61*c66ec88fSEmmanuel Vadot
62*c66ec88fSEmmanuel VadotA small area of SRAM is reserved for SCPI communication between application
63*c66ec88fSEmmanuel Vadotprocessors and SCP.
64*c66ec88fSEmmanuel Vadot
65*c66ec88fSEmmanuel VadotThe properties should follow the generic mmio-sram description found in [3]
66*c66ec88fSEmmanuel Vadot
67*c66ec88fSEmmanuel VadotEach sub-node represents the reserved area for SCPI.
68*c66ec88fSEmmanuel Vadot
69*c66ec88fSEmmanuel VadotRequired sub-node properties:
70*c66ec88fSEmmanuel Vadot- reg : The base offset and size of the reserved area with the SRAM
71*c66ec88fSEmmanuel Vadot- compatible : should be "arm,scp-shmem" for Non-secure SRAM based
72*c66ec88fSEmmanuel Vadot	       shared memory
73*c66ec88fSEmmanuel Vadot
74*c66ec88fSEmmanuel VadotSensor bindings for the sensors based on SCPI Message Protocol
75*c66ec88fSEmmanuel Vadot--------------------------------------------------------------
76*c66ec88fSEmmanuel VadotSCPI provides an API to access the various sensors on the SoC.
77*c66ec88fSEmmanuel Vadot
78*c66ec88fSEmmanuel VadotRequired properties:
79*c66ec88fSEmmanuel Vadot- compatible : should be "arm,scpi-sensors".
80*c66ec88fSEmmanuel Vadot- #thermal-sensor-cells: should be set to 1. This property follows the
81*c66ec88fSEmmanuel Vadot			 thermal device tree bindings[2].
82*c66ec88fSEmmanuel Vadot
83*c66ec88fSEmmanuel Vadot			 Valid cell values are raw identifiers (Sensor ID)
84*c66ec88fSEmmanuel Vadot			 as used by the firmware. Refer to  platform details
85*c66ec88fSEmmanuel Vadot			 for your implementation for the IDs to use.
86*c66ec88fSEmmanuel Vadot
87*c66ec88fSEmmanuel VadotPower domain bindings for the power domains based on SCPI Message Protocol
88*c66ec88fSEmmanuel Vadot------------------------------------------------------------
89*c66ec88fSEmmanuel Vadot
90*c66ec88fSEmmanuel VadotThis binding uses the generic power domain binding[4].
91*c66ec88fSEmmanuel Vadot
92*c66ec88fSEmmanuel VadotPM domain providers
93*c66ec88fSEmmanuel Vadot===================
94*c66ec88fSEmmanuel Vadot
95*c66ec88fSEmmanuel VadotRequired properties:
96*c66ec88fSEmmanuel Vadot - #power-domain-cells : Should be 1. Contains the device or the power
97*c66ec88fSEmmanuel Vadot			 domain ID value used by SCPI commands.
98*c66ec88fSEmmanuel Vadot - num-domains: Total number of power domains provided by SCPI. This is
99*c66ec88fSEmmanuel Vadot		needed as the SCPI message protocol lacks a mechanism to
100*c66ec88fSEmmanuel Vadot		query this information at runtime.
101*c66ec88fSEmmanuel Vadot
102*c66ec88fSEmmanuel VadotPM domain consumers
103*c66ec88fSEmmanuel Vadot===================
104*c66ec88fSEmmanuel Vadot
105*c66ec88fSEmmanuel VadotRequired properties:
106*c66ec88fSEmmanuel Vadot - power-domains : A phandle and PM domain specifier as defined by bindings of
107*c66ec88fSEmmanuel Vadot                   the power controller specified by phandle.
108*c66ec88fSEmmanuel Vadot
109*c66ec88fSEmmanuel Vadot[0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html
110*c66ec88fSEmmanuel Vadot[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
111*c66ec88fSEmmanuel Vadot[2] Documentation/devicetree/bindings/thermal/thermal*.yaml
112*c66ec88fSEmmanuel Vadot[3] Documentation/devicetree/bindings/sram/sram.yaml
113*c66ec88fSEmmanuel Vadot[4] Documentation/devicetree/bindings/power/power-domain.yaml
114*c66ec88fSEmmanuel Vadot
115*c66ec88fSEmmanuel VadotExample:
116*c66ec88fSEmmanuel Vadot
117*c66ec88fSEmmanuel Vadotsram: sram@50000000 {
118*c66ec88fSEmmanuel Vadot	compatible = "arm,juno-sram-ns", "mmio-sram";
119*c66ec88fSEmmanuel Vadot	reg = <0x0 0x50000000 0x0 0x10000>;
120*c66ec88fSEmmanuel Vadot
121*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
122*c66ec88fSEmmanuel Vadot	#size-cells = <1>;
123*c66ec88fSEmmanuel Vadot	ranges = <0 0x0 0x50000000 0x10000>;
124*c66ec88fSEmmanuel Vadot
125*c66ec88fSEmmanuel Vadot	cpu_scp_lpri: scp-shmem@0 {
126*c66ec88fSEmmanuel Vadot		compatible = "arm,juno-scp-shmem";
127*c66ec88fSEmmanuel Vadot		reg = <0x0 0x200>;
128*c66ec88fSEmmanuel Vadot	};
129*c66ec88fSEmmanuel Vadot
130*c66ec88fSEmmanuel Vadot	cpu_scp_hpri: scp-shmem@200 {
131*c66ec88fSEmmanuel Vadot		compatible = "arm,juno-scp-shmem";
132*c66ec88fSEmmanuel Vadot		reg = <0x200 0x200>;
133*c66ec88fSEmmanuel Vadot	};
134*c66ec88fSEmmanuel Vadot};
135*c66ec88fSEmmanuel Vadot
136*c66ec88fSEmmanuel Vadotmailbox: mailbox0@40000000 {
137*c66ec88fSEmmanuel Vadot	....
138*c66ec88fSEmmanuel Vadot	#mbox-cells = <1>;
139*c66ec88fSEmmanuel Vadot};
140*c66ec88fSEmmanuel Vadot
141*c66ec88fSEmmanuel Vadotscpi_protocol: scpi@2e000000 {
142*c66ec88fSEmmanuel Vadot	compatible = "arm,scpi";
143*c66ec88fSEmmanuel Vadot	mboxes = <&mailbox 0 &mailbox 1>;
144*c66ec88fSEmmanuel Vadot	shmem = <&cpu_scp_lpri &cpu_scp_hpri>;
145*c66ec88fSEmmanuel Vadot
146*c66ec88fSEmmanuel Vadot	clocks {
147*c66ec88fSEmmanuel Vadot		compatible = "arm,scpi-clocks";
148*c66ec88fSEmmanuel Vadot
149*c66ec88fSEmmanuel Vadot		scpi_dvfs: scpi_clocks@0 {
150*c66ec88fSEmmanuel Vadot			compatible = "arm,scpi-dvfs-clocks";
151*c66ec88fSEmmanuel Vadot			#clock-cells = <1>;
152*c66ec88fSEmmanuel Vadot			clock-indices = <0>, <1>, <2>;
153*c66ec88fSEmmanuel Vadot			clock-output-names = "atlclk", "aplclk","gpuclk";
154*c66ec88fSEmmanuel Vadot		};
155*c66ec88fSEmmanuel Vadot		scpi_clk: scpi_clocks@3 {
156*c66ec88fSEmmanuel Vadot			compatible = "arm,scpi-variable-clocks";
157*c66ec88fSEmmanuel Vadot			#clock-cells = <1>;
158*c66ec88fSEmmanuel Vadot			clock-indices = <3>, <4>;
159*c66ec88fSEmmanuel Vadot			clock-output-names = "pxlclk0", "pxlclk1";
160*c66ec88fSEmmanuel Vadot		};
161*c66ec88fSEmmanuel Vadot	};
162*c66ec88fSEmmanuel Vadot
163*c66ec88fSEmmanuel Vadot	scpi_sensors0: sensors {
164*c66ec88fSEmmanuel Vadot		compatible = "arm,scpi-sensors";
165*c66ec88fSEmmanuel Vadot		#thermal-sensor-cells = <1>;
166*c66ec88fSEmmanuel Vadot	};
167*c66ec88fSEmmanuel Vadot
168*c66ec88fSEmmanuel Vadot	scpi_devpd: scpi-power-domains {
169*c66ec88fSEmmanuel Vadot		compatible = "arm,scpi-power-domains";
170*c66ec88fSEmmanuel Vadot		num-domains = <2>;
171*c66ec88fSEmmanuel Vadot		#power-domain-cells = <1>;
172*c66ec88fSEmmanuel Vadot	};
173*c66ec88fSEmmanuel Vadot};
174*c66ec88fSEmmanuel Vadot
175*c66ec88fSEmmanuel Vadotcpu@0 {
176*c66ec88fSEmmanuel Vadot	...
177*c66ec88fSEmmanuel Vadot	reg = <0 0>;
178*c66ec88fSEmmanuel Vadot	clocks = <&scpi_dvfs 0>;
179*c66ec88fSEmmanuel Vadot};
180*c66ec88fSEmmanuel Vadot
181*c66ec88fSEmmanuel Vadothdlcd@7ff60000 {
182*c66ec88fSEmmanuel Vadot	...
183*c66ec88fSEmmanuel Vadot	reg = <0 0x7ff60000 0 0x1000>;
184*c66ec88fSEmmanuel Vadot	clocks = <&scpi_clk 4>;
185*c66ec88fSEmmanuel Vadot	power-domains = <&scpi_devpd 1>;
186*c66ec88fSEmmanuel Vadot};
187*c66ec88fSEmmanuel Vadot
188*c66ec88fSEmmanuel Vadotthermal-zones {
189*c66ec88fSEmmanuel Vadot	soc_thermal {
190*c66ec88fSEmmanuel Vadot		polling-delay-passive = <100>;
191*c66ec88fSEmmanuel Vadot		polling-delay = <1000>;
192*c66ec88fSEmmanuel Vadot
193*c66ec88fSEmmanuel Vadot				/* sensor         ID */
194*c66ec88fSEmmanuel Vadot		thermal-sensors = <&scpi_sensors0 3>;
195*c66ec88fSEmmanuel Vadot		...
196*c66ec88fSEmmanuel Vadot	};
197*c66ec88fSEmmanuel Vadot};
198*c66ec88fSEmmanuel Vadot
199*c66ec88fSEmmanuel VadotIn the above example, the #clock-cells is set to 1 as required.
200*c66ec88fSEmmanuel Vadotscpi_dvfs has 3 output clocks namely: atlclk, aplclk, and gpuclk with 0,
201*c66ec88fSEmmanuel Vadot1 and 2 as clock-indices. scpi_clk has 2 output clocks namely: pxlclk0
202*c66ec88fSEmmanuel Vadotand pxlclk1 with 3 and 4 as clock-indices.
203*c66ec88fSEmmanuel Vadot
204*c66ec88fSEmmanuel VadotThe first consumer in the example is cpu@0 and it has '0' as the clock
205*c66ec88fSEmmanuel Vadotspecifier which points to the first entry in the output clocks of
206*c66ec88fSEmmanuel Vadotscpi_dvfs i.e. "atlclk".
207*c66ec88fSEmmanuel Vadot
208*c66ec88fSEmmanuel VadotSimilarly the second example is hdlcd@7ff60000 and it has pxlclk1 as input
209*c66ec88fSEmmanuel Vadotclock. '4' in the clock specifier here points to the second entry
210*c66ec88fSEmmanuel Vadotin the output clocks of scpi_clocks  i.e. "pxlclk1"
211*c66ec88fSEmmanuel Vadot
212*c66ec88fSEmmanuel VadotThe thermal-sensors property in the soc_thermal node uses the
213*c66ec88fSEmmanuel Vadottemperature sensor provided by SCP firmware to setup a thermal
214*c66ec88fSEmmanuel Vadotzone. The ID "3" is the sensor identifier for the temperature sensor
215*c66ec88fSEmmanuel Vadotas used by the firmware.
216*c66ec88fSEmmanuel Vadot
217*c66ec88fSEmmanuel VadotThe num-domains property in scpi-power-domains domain specifies that
218*c66ec88fSEmmanuel VadotSCPI provides 2 power domains. The hdlcd node uses the power domain with
219*c66ec88fSEmmanuel Vadotdomain ID 1.
220