| 1 |
# SPDX-License-Identifier: BSD-2-Clause |
| 2 |
# Copyright 2018 Linaro Ltd. |
| 3 |
# Copyright 2012 Secret Lab Technologies Ltd. |
| 4 |
%YAML 1.2 |
| 5 |
--- |
| 6 |
$id: http://devicetree.org/schemas/clock/clock.yaml# |
| 7 |
$schema: http://devicetree.org/meta-schemas/base.yaml# |
| 8 |
|
| 9 |
title: Clock Common Properties |
| 10 |
|
| 11 |
maintainers: |
| 12 |
- Michael Turquette <[email protected]> |
| 13 |
- Stephen Boyd <[email protected]> |
| 14 |
|
| 15 |
description: | |
| 16 |
Sources of clock signal can be represented by any node in the device |
| 17 |
tree. Those nodes are designated as clock providers. Clock consumer |
| 18 |
nodes use a phandle and clock specifier pair to connect clock provider |
| 19 |
outputs to clock inputs. Similar to the gpio specifiers, a clock |
| 20 |
specifier is an array of zero, one or more cells identifying the clock |
| 21 |
output on a device. The length of a clock specifier is defined by the |
| 22 |
value of a #clock-cells property in the clock provider node. |
| 23 |
|
| 24 |
Assigned clock parents and rates |
| 25 |
-------------------------------- |
| 26 |
|
| 27 |
Some platforms may require initial configuration of default parent clocks |
| 28 |
and clock frequencies. Such a configuration can be specified in a device tree |
| 29 |
node through assigned-clocks, assigned-clock-parents and assigned-clock-rates |
| 30 |
properties. The assigned-clock-parents property should contain a list of parent |
| 31 |
clocks in the form of a phandle and clock specifier pair and the |
| 32 |
assigned-clock-rates property should contain a list of frequencies in Hz. Both |
| 33 |
these properties should correspond to the clocks listed in the assigned-clocks |
| 34 |
property. |
| 35 |
|
| 36 |
To skip setting parent or rate of a clock its corresponding entry should be |
| 37 |
set to 0, or can be omitted if it is not followed by any non-zero entry. |
| 38 |
|
| 39 |
serial@a000 { |
| 40 |
compatible = "fsl,imx-uart"; |
| 41 |
reg = <0xa000 0x1000>; |
| 42 |
... |
| 43 |
clocks = <&osc 0>, <&pll 1>; |
| 44 |
clock-names = "baud", "register"; |
| 45 |
|
| 46 |
assigned-clocks = <&clkcon 0>, <&pll 2>; |
| 47 |
assigned-clock-parents = <&pll 2>; |
| 48 |
assigned-clock-rates = <0>, <460800>; |
| 49 |
}; |
| 50 |
|
| 51 |
In this example the <&pll 2> clock is set as parent of clock <&clkcon 0> and |
| 52 |
the <&pll 2> clock is assigned a frequency value of 460800 Hz. |
| 53 |
|
| 54 |
Configuring a clock's parent and rate through the device node that consumes |
| 55 |
the clock can be done only for clocks that have a single user. Specifying |
| 56 |
conflicting parent or rate configuration in multiple consumer nodes for |
| 57 |
a shared clock is forbidden. |
| 58 |
|
| 59 |
Configuration of common clocks, which affect multiple consumer devices can |
| 60 |
be similarly specified in the clock provider node. |
| 61 |
|
| 62 |
# always select the core schema |
| 63 |
select: true |
| 64 |
|
| 65 |
properties: |
| 66 |
# Legacy clock properties |
| 67 |
clock-frequency: |
| 68 |
description: Legacy property for single, fixed frequency clocks |
| 69 |
anyOf: |
| 70 |
- $ref: /schemas/types.yaml#/definitions/uint32 |
| 71 |
- $ref: /schemas/types.yaml#/definitions/uint64 |
| 72 |
bus-frequency: |
| 73 |
description: Legacy property for fixed bus frequencies |
| 74 |
$ref: /schemas/types.yaml#/definitions/uint32 |
| 75 |
|
| 76 |
# Provider properties |
| 77 |
"#clock-cells": |
| 78 |
description: Number of cells in a clock specifier; Typically 0 for |
| 79 |
nodes with a single clock output and 1 for nodes with multiple clock |
| 80 |
outputs. |
| 81 |
|
| 82 |
clock-output-names: |
| 83 |
description: | |
| 84 |
Recommended to be a list of strings of clock output signal |
| 85 |
names indexed by the first cell in the clock specifier. |
| 86 |
However, the meaning of clock-output-names is domain |
| 87 |
specific to the clock provider, and is only provided to |
| 88 |
encourage using the same meaning for the majority of clock |
| 89 |
providers. This format may not work for clock providers |
| 90 |
using a complex clock specifier format. In those cases it |
| 91 |
is recommended to omit this property and create a binding |
| 92 |
specific names property. |
| 93 |
|
| 94 |
Clock consumer nodes must never directly reference |
| 95 |
the provider\'s clock-output-names property. |
| 96 |
|
| 97 |
clock-indices: |
| 98 |
$ref: /schemas/types.yaml#/definitions/uint32-array |
| 99 |
description: If the identifying number for the clocks in the node |
| 100 |
is not linear from zero, then this allows the mapping of identifiers |
| 101 |
into the clock-output-names array. |
| 102 |
|
| 103 |
# Consumer properties |
| 104 |
clocks: |
| 105 |
anyOf: |
| 106 |
- type: object # for nodes named 'clocks' |
| 107 |
- $ref: /schemas/types.yaml#/definitions/phandle-array |
| 108 |
description: | |
| 109 |
List of phandle and clock specifier pairs, one pair |
| 110 |
for each clock input to the device. Note: if the |
| 111 |
clock provider specifies '0' for #clock-cells, then |
| 112 |
only the phandle portion of the pair will appear. |
| 113 |
|
| 114 |
clock-names: |
| 115 |
$ref: /schemas/types.yaml#/definitions/string-array |
| 116 |
description: List of clock input name strings sorted in the same order |
| 117 |
as the clocks property. Consumers drivers will use clock-names |
| 118 |
to match clock input names with clocks specifiers. |
| 119 |
|
| 120 |
clock-ranges: |
| 121 |
type: boolean |
| 122 |
description: Empty property indicating that child nodes can inherit |
| 123 |
named clocks from this node. Useful for bus nodes to provide a clock |
| 124 |
to their children. |
| 125 |
|
| 126 |
assigned-clocks: |
| 127 |
$ref: /schemas/types.yaml#/definitions/phandle-array |
| 128 |
assigned-clock-parents: |
| 129 |
$ref: /schemas/types.yaml#/definitions/phandle-array |
| 130 |
assigned-clock-rates: |
| 131 |
$ref: /schemas/types.yaml#/definitions/uint32-array |
| 132 |
assigned-clock-rates-u64: |
| 133 |
$ref: /schemas/types.yaml#/definitions/uint64-array |
| 134 |
assigned-clock-sscs: |
| 135 |
$ref: /schemas/types.yaml#/definitions/uint32-matrix |
| 136 |
items: |
| 137 |
items: |
| 138 |
- description: The modulation frequency |
| 139 |
- description: The modulation depth in permyriad |
| 140 |
- description: The modulation method, down-spread(3), up-spread(2), |
| 141 |
center-spread(1), no-spread(0) |
| 142 |
minimum: 0 |
| 143 |
maximum: 3 |
| 144 |
|
| 145 |
protected-clocks: |
| 146 |
$ref: /schemas/types.yaml#/definitions/uint32-array |
| 147 |
description: |
| 148 |
Some platforms or firmwares may not fully expose all the clocks to the OS, |
| 149 |
such as in situations where those clks are used by drivers running in ARM |
| 150 |
secure execution levels. Such a configuration can be specified in |
| 151 |
devicetree with the protected-clocks property in the form of a clock |
| 152 |
specifier list. This property should only be specified in the node that is |
| 153 |
providing the clocks being protected. |
| 154 |
|
| 155 |
dependentRequired: |
| 156 |
clock-names: [clocks] |
| 157 |
clock-output-names: ["#clock-cells"] |
| 158 |
clock-indices: [clock-output-names] |
| 159 |
clock-ranges: [clocks] |
| 160 |
assigned-clock-parents: [assigned-clocks] |
| 161 |
assigned-clock-rates: [assigned-clocks] |
| 162 |
assigned-clock-rates-u64: [assigned-clocks] |
| 163 |
assigned-clock-sscs: [assigned-clocks] |
| 164 |
protected-clocks: ["#clock-cells"] |
| 165 |
|
| 166 |
dependentSchemas: |
| 167 |
assigned-clocks: |
| 168 |
anyOf: |
| 169 |
- required: [clocks] |
| 170 |
- required: ["#clock-cells"] |
| 171 |
|
| 172 |
additionalProperties: true |