Documentation / devicetree / bindings / arm / arm,scpi.txt


Based on kernel version 5.13. Page generated on 2021-06-28 07:05 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
System Control and Power Interface (SCPI) Message Protocol
----------------------------------------------------------

Firmware implementing the SCPI described in ARM document number ARM DUI 0922B
("ARM Compute Subsystem SCP: Message Interface Protocols")[0] can be used
by Linux to initiate various system control and power operations.

Required properties:

- compatible : should be
	* "arm,scpi" : For implementations complying to SCPI v1.0 or above
	* "arm,scpi-pre-1.0" : For implementations complying to all
		unversioned releases prior to SCPI v1.0
- mboxes: List of phandle and mailbox channel specifiers
	  All the channels reserved by remote SCP firmware for use by
	  SCPI message protocol should be specified in any order
- shmem : List of phandle pointing to the shared memory(SHM) area between the
	  processors using these mailboxes for IPC, one for each mailbox
	  SHM can be any memory reserved for the purpose of this communication
	  between the processors.

See Documentation/devicetree/bindings/mailbox/mailbox.txt
for more details about the generic mailbox controller and
client driver bindings.

Clock bindings for the clocks based on SCPI Message Protocol
------------------------------------------------------------

This binding uses the common clock binding[1].

Container Node
==============
Required properties:
- compatible : should be "arm,scpi-clocks"
	       All the clocks provided by SCP firmware via SCPI message
	       protocol much be listed as sub-nodes under this node.

Sub-nodes
=========
Required properties:
- compatible : shall include one of the following
	"arm,scpi-dvfs-clocks" - all the clocks that are variable and index based.
		These clocks don't provide an entire range of values between the
		limits but only discrete points within the range. The firmware
		provides the mapping for each such operating frequency and the
		index associated with it. The firmware also manages the
		voltage scaling appropriately with the clock scaling.
	"arm,scpi-variable-clocks" - all the clocks that are variable and provide full
		range within the specified range. The firmware provides the
		range of values within a specified range.

Other required properties for all clocks(all from common clock binding):
- #clock-cells : Should be 1. Contains the Clock ID value used by SCPI commands.
- clock-output-names : shall be the corresponding names of the outputs.
- clock-indices: The identifying number for the clocks(i.e.clock_id) in the
	node. It can be non linear and hence provide the mapping of identifiers
	into the clock-output-names array.

SRAM and Shared Memory for SCPI
-------------------------------

A small area of SRAM is reserved for SCPI communication between application
processors and SCP.

The properties should follow the generic mmio-sram description found in [3]

Each sub-node represents the reserved area for SCPI.

Required sub-node properties:
- reg : The base offset and size of the reserved area with the SRAM
- compatible : should be "arm,scp-shmem" for Non-secure SRAM based
	       shared memory

Sensor bindings for the sensors based on SCPI Message Protocol
--------------------------------------------------------------
SCPI provides an API to access the various sensors on the SoC.

Required properties:
- compatible : should be "arm,scpi-sensors".
- #thermal-sensor-cells: should be set to 1. This property follows the
			 thermal device tree bindings[2].

			 Valid cell values are raw identifiers (Sensor ID)
			 as used by the firmware. Refer to  platform details
			 for your implementation for the IDs to use.

Power domain bindings for the power domains based on SCPI Message Protocol
------------------------------------------------------------

This binding uses the generic power domain binding[4].

PM domain providers
===================

Required properties:
 - #power-domain-cells : Should be 1. Contains the device or the power
			 domain ID value used by SCPI commands.
 - num-domains: Total number of power domains provided by SCPI. This is
		needed as the SCPI message protocol lacks a mechanism to
		query this information at runtime.

PM domain consumers
===================

Required properties:
 - power-domains : A phandle and PM domain specifier as defined by bindings of
                   the power controller specified by phandle.

[0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
[2] Documentation/devicetree/bindings/thermal/thermal*.yaml
[3] Documentation/devicetree/bindings/sram/sram.yaml
[4] Documentation/devicetree/bindings/power/power-domain.yaml

Example:

sram: sram@50000000 {
	compatible = "arm,juno-sram-ns", "mmio-sram";
	reg = <0x0 0x50000000 0x0 0x10000>;

	#address-cells = <1>;
	#size-cells = <1>;
	ranges = <0 0x0 0x50000000 0x10000>;

	cpu_scp_lpri: scp-shmem@0 {
		compatible = "arm,juno-scp-shmem";
		reg = <0x0 0x200>;
	};

	cpu_scp_hpri: scp-shmem@200 {
		compatible = "arm,juno-scp-shmem";
		reg = <0x200 0x200>;
	};
};

mailbox: mailbox0@40000000 {
	....
	#mbox-cells = <1>;
};

scpi_protocol: scpi@2e000000 {
	compatible = "arm,scpi";
	mboxes = <&mailbox 0 &mailbox 1>;
	shmem = <&cpu_scp_lpri &cpu_scp_hpri>;

	clocks {
		compatible = "arm,scpi-clocks";

		scpi_dvfs: scpi_clocks@0 {
			compatible = "arm,scpi-dvfs-clocks";
			#clock-cells = <1>;
			clock-indices = <0>, <1>, <2>;
			clock-output-names = "atlclk", "aplclk","gpuclk";
		};
		scpi_clk: scpi_clocks@3 {
			compatible = "arm,scpi-variable-clocks";
			#clock-cells = <1>;
			clock-indices = <3>, <4>;
			clock-output-names = "pxlclk0", "pxlclk1";
		};
	};

	scpi_sensors0: sensors {
		compatible = "arm,scpi-sensors";
		#thermal-sensor-cells = <1>;
	};

	scpi_devpd: scpi-power-domains {
		compatible = "arm,scpi-power-domains";
		num-domains = <2>;
		#power-domain-cells = <1>;
	};
};

cpu@0 {
	...
	reg = <0 0>;
	clocks = <&scpi_dvfs 0>;
};

hdlcd@7ff60000 {
	...
	reg = <0 0x7ff60000 0 0x1000>;
	clocks = <&scpi_clk 4>;
	power-domains = <&scpi_devpd 1>;
};

thermal-zones {
	soc_thermal {
		polling-delay-passive = <100>;
		polling-delay = <1000>;

				/* sensor         ID */
		thermal-sensors = <&scpi_sensors0 3>;
		...
	};
};

In the above example, the #clock-cells is set to 1 as required.
scpi_dvfs has 3 output clocks namely: atlclk, aplclk, and gpuclk with 0,
1 and 2 as clock-indices. scpi_clk has 2 output clocks namely: pxlclk0
and pxlclk1 with 3 and 4 as clock-indices.

The first consumer in the example is cpu@0 and it has '0' as the clock
specifier which points to the first entry in the output clocks of
scpi_dvfs i.e. "atlclk".

Similarly the second example is hdlcd@7ff60000 and it has pxlclk1 as input
clock. '4' in the clock specifier here points to the second entry
in the output clocks of scpi_clocks  i.e. "pxlclk1"

The thermal-sensors property in the soc_thermal node uses the
temperature sensor provided by SCP firmware to setup a thermal
zone. The ID "3" is the sensor identifier for the temperature sensor
as used by the firmware.

The num-domains property in scpi-power-domains domain specifies that
SCPI provides 2 power domains. The hdlcd node uses the power domain with
domain ID 1.