1edd63ea5d8b5e410b67b8d49d8452a258b03264
[openwrt/staging/wigyori.git] /
1 From b39069a482ade0c5e18c407c3218ba1aeed371b6 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Wed, 6 Jan 2021 21:58:36 +0100
4 Subject: [PATCH] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the
5 json-schema
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Changes that require mentioning:
11 1. interrupt-names
12 Name "wakeup" was changed to the "wake". It matches example and what
13 Linux driver looks for in the first place
14 2. brcm,ipp and brcm,ioc
15 Both were described as booleans with 0 / 1 values. In examples they
16 were integers and Linux checks for int as well. Both got uint32.
17 3. Added minimal description
18
19 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
20 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
21 Reviewed-by: Rob Herring <robh@kernel.org>
22 Link: https://lore.kernel.org/r/20210106205838.10964-1-zajec5@gmail.com
23 Signed-off-by: Vinod Koul <vkoul@kernel.org>
24 ---
25 .../bindings/phy/brcm,brcmstb-usb-phy.txt | 86 --------
26 .../bindings/phy/brcm,brcmstb-usb-phy.yaml | 193 ++++++++++++++++++
27 2 files changed, 193 insertions(+), 86 deletions(-)
28 delete mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
29 create mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
30
31 --- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
32 +++ /dev/null
33 @@ -1,86 +0,0 @@
34 -Broadcom STB USB PHY
35 -
36 -Required properties:
37 -- compatible: should be one of
38 - "brcm,brcmstb-usb-phy"
39 - "brcm,bcm7216-usb-phy"
40 - "brcm,bcm7211-usb-phy"
41 -
42 -- reg and reg-names properties requirements are specific to the
43 - compatible string.
44 - "brcm,brcmstb-usb-phy":
45 - - reg: 1 or 2 offset and length pairs. One for the base CTRL registers
46 - and an optional pair for systems with USB 3.x support
47 - - reg-names: not specified
48 - "brcm,bcm7216-usb-phy":
49 - - reg: 3 offset and length pairs for CTRL, XHCI_EC and XHCI_GBL
50 - registers
51 - - reg-names: "ctrl", "xhci_ec", "xhci_gbl"
52 - "brcm,bcm7211-usb-phy":
53 - - reg: 5 offset and length pairs for CTRL, XHCI_EC, XHCI_GBL,
54 - USB_PHY and USB_MDIO registers and an optional pair
55 - for the BDC registers
56 - - reg-names: "ctrl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec"
57 -
58 -- #phy-cells: Shall be 1 as it expects one argument for setting
59 - the type of the PHY. Possible values are:
60 - - PHY_TYPE_USB2 for USB1.1/2.0 PHY
61 - - PHY_TYPE_USB3 for USB3.x PHY
62 -
63 -Optional Properties:
64 -- clocks : clock phandles.
65 -- clock-names: String, clock name.
66 -- interrupts: wakeup interrupt
67 -- interrupt-names: "wakeup"
68 -- brcm,ipp: Boolean, Invert Port Power.
69 - Possible values are: 0 (Don't invert), 1 (Invert)
70 -- brcm,ioc: Boolean, Invert Over Current detection.
71 - Possible values are: 0 (Don't invert), 1 (Invert)
72 -- dr_mode: String, PHY Device mode.
73 - Possible values are: "host", "peripheral ", "drd" or "typec-pd"
74 - If this property is not defined, the phy will default to "host" mode.
75 -- brcm,syscon-piarbctl: phandle to syscon for handling config registers
76 -NOTE: one or both of the following two properties must be set
77 -- brcm,has-xhci: Boolean indicating the phy has an XHCI phy.
78 -- brcm,has-eohci: Boolean indicating the phy has an EHCI/OHCI phy.
79 -
80 -
81 -Example:
82 -
83 -usbphy_0: usb-phy@f0470200 {
84 - reg = <0xf0470200 0xb8>,
85 - <0xf0471940 0x6c0>;
86 - compatible = "brcm,brcmstb-usb-phy";
87 - #phy-cells = <1>;
88 - dr_mode = "host"
89 - brcm,ioc = <1>;
90 - brcm,ipp = <1>;
91 - brcm,has-xhci;
92 - brcm,has-eohci;
93 - clocks = <&usb20>, <&usb30>;
94 - clock-names = "sw_usb", "sw_usb3";
95 -};
96 -
97 -usb-phy@29f0200 {
98 - reg = <0x29f0200 0x200>,
99 - <0x29c0880 0x30>,
100 - <0x29cc100 0x534>,
101 - <0x2808000 0x24>,
102 - <0x2980080 0x8>;
103 - reg-names = "ctrl",
104 - "xhci_ec",
105 - "xhci_gbl",
106 - "usb_phy",
107 - "usb_mdio";
108 - brcm,ioc = <0x0>;
109 - brcm,ipp = <0x0>;
110 - compatible = "brcm,bcm7211-usb-phy";
111 - interrupts = <0x30>;
112 - interrupt-parent = <&vpu_intr1_nosec_intc>;
113 - interrupt-names = "wake";
114 - #phy-cells = <0x1>;
115 - brcm,has-xhci;
116 - syscon-piarbctl = <&syscon_piarbctl>;
117 - clocks = <&scmi_clk 256>;
118 - clock-names = "sw_usb";
119 -};
120 --- /dev/null
121 +++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
122 @@ -0,0 +1,193 @@
123 +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
124 +%YAML 1.2
125 +---
126 +$id: http://devicetree.org/schemas/phy/brcm,brcmstb-usb-phy.yaml#
127 +$schema: http://devicetree.org/meta-schemas/core.yaml#
128 +
129 +title: Broadcom STB USB PHY
130 +
131 +description: Broadcom's PHY that handles EHCI/OHCI and/or XHCI
132 +
133 +maintainers:
134 + - Al Cooper <alcooperx@gmail.com>
135 + - Rafał Miłecki <rafal@milecki.pl>
136 +
137 +properties:
138 + compatible:
139 + enum:
140 + - brcm,bcm7211-usb-phy
141 + - brcm,bcm7216-usb-phy
142 + - brcm,brcmstb-usb-phy
143 +
144 + reg:
145 + minItems: 1
146 + maxItems: 6
147 + items:
148 + - description: the base CTRL register
149 + - description: XHCI EC register
150 + - description: XHCI GBL register
151 + - description: USB PHY register
152 + - description: USB MDIO register
153 + - description: BDC register
154 +
155 + reg-names:
156 + minItems: 1
157 + maxItems: 6
158 + items:
159 + - const: ctrl
160 + - const: xhci_ec
161 + - const: xhci_gbl
162 + - const: usb_phy
163 + - const: usb_mdio
164 + - const: bdc_ec
165 +
166 + clocks:
167 + minItems: 1
168 + maxItems: 2
169 +
170 + clock-names:
171 + minItems: 1
172 + maxItems: 2
173 + items:
174 + - const: sw_usb
175 + - const: sw_usb3
176 +
177 + interrupts:
178 + description: wakeup interrupt
179 +
180 + interrupt-names:
181 + const: wake
182 +
183 + brcm,ipp:
184 + $ref: /schemas/types.yaml#/definitions/uint32
185 + description: Invert Port Power
186 + minimum: 0
187 + maximum: 1
188 +
189 + brcm,ioc:
190 + $ref: /schemas/types.yaml#/definitions/uint32
191 + description: Invert Over Current detection
192 + minimum: 0
193 + maximum: 1
194 +
195 + dr_mode:
196 + description: PHY Device mode. If this property is not defined, the PHY will
197 + default to "host" mode.
198 + enum:
199 + - host
200 + - peripheral
201 + - drd
202 + - typec-pd
203 +
204 + brcm,syscon-piarbctl:
205 + description: phandle to syscon for handling config registers
206 + $ref: /schemas/types.yaml#/definitions/phandle
207 +
208 + brcm,has-xhci:
209 + description: Indicates the PHY has an XHCI PHY.
210 + type: boolean
211 +
212 + brcm,has-eohci:
213 + description: Indicates the PHY has an EHCI/OHCI PHY.
214 + type: boolean
215 +
216 + "#phy-cells":
217 + description: |
218 + Cell allows setting the type of the PHY. Possible values are:
219 + - PHY_TYPE_USB2 for USB1.1/2.0 PHY
220 + - PHY_TYPE_USB3 for USB3.x PHY
221 + const: 1
222 +
223 +required:
224 + - reg
225 + - "#phy-cells"
226 +
227 +anyOf:
228 + - required:
229 + - brcm,has-xhci
230 + - required:
231 + - brcm,has-eohci
232 +
233 +allOf:
234 + - if:
235 + properties:
236 + compatible:
237 + contains:
238 + const: brcm,brcmstb-usb-phy
239 + then:
240 + properties:
241 + reg:
242 + minItems: 1
243 + maxItems: 2
244 + - if:
245 + properties:
246 + compatible:
247 + contains:
248 + const: brcm,bcm7211-usb-phy
249 + then:
250 + properties:
251 + reg:
252 + minItems: 5
253 + maxItems: 6
254 + reg-names:
255 + minItems: 5
256 + maxItems: 6
257 + - if:
258 + properties:
259 + compatible:
260 + contains:
261 + const: brcm,bcm7216-usb-phy
262 + then:
263 + properties:
264 + reg:
265 + minItems: 3
266 + maxItems: 3
267 + reg-names:
268 + minItems: 3
269 + maxItems: 3
270 +
271 +additionalProperties: false
272 +
273 +examples:
274 + - |
275 + #include <dt-bindings/phy/phy.h>
276 +
277 + usb-phy@f0470200 {
278 + compatible = "brcm,brcmstb-usb-phy";
279 + reg = <0xf0470200 0xb8>,
280 + <0xf0471940 0x6c0>;
281 + #phy-cells = <1>;
282 + dr_mode = "host";
283 + brcm,ioc = <1>;
284 + brcm,ipp = <1>;
285 + brcm,has-xhci;
286 + brcm,has-eohci;
287 + clocks = <&usb20>, <&usb30>;
288 + clock-names = "sw_usb", "sw_usb3";
289 + };
290 + - |
291 + #include <dt-bindings/phy/phy.h>
292 +
293 + usb-phy@29f0200 {
294 + compatible = "brcm,bcm7211-usb-phy";
295 + reg = <0x29f0200 0x200>,
296 + <0x29c0880 0x30>,
297 + <0x29cc100 0x534>,
298 + <0x2808000 0x24>,
299 + <0x2980080 0x8>;
300 + reg-names = "ctrl",
301 + "xhci_ec",
302 + "xhci_gbl",
303 + "usb_phy",
304 + "usb_mdio";
305 + brcm,ioc = <0x0>;
306 + brcm,ipp = <0x0>;
307 + interrupts = <0x30>;
308 + interrupt-parent = <&vpu_intr1_nosec_intc>;
309 + interrupt-names = "wake";
310 + #phy-cells = <0x1>;
311 + brcm,has-xhci;
312 + brcm,syscon-piarbctl = <&syscon_piarbctl>;
313 + clocks = <&scmi_clk 256>;
314 + clock-names = "sw_usb";
315 + };