xref: /freebsd/sys/contrib/device-tree/Bindings/leds/leds-bcm6328.yaml (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/leds/leds-bcm6328.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: LEDs connected to Broadcom BCM6328 controller
8
9maintainers:
10  - Álvaro Fernández Rojas <noltari@gmail.com>
11
12description: |
13  This controller is present on BCM6318, BCM6328, BCM6362 and BCM63268.
14  In these SoCs it's possible to control LEDs both as GPIOs or by hardware.
15  However, on some devices there are Serial LEDs (LEDs connected to a 74x164
16  controller), which can either be controlled by software (exporting the 74x164
17  as spi-gpio. See
18  Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or by hardware
19  using this driver.
20  Some of these Serial LEDs are hardware controlled (e.g. ethernet LEDs) and
21  exporting the 74x164 as spi-gpio prevents those LEDs to be hardware
22  controlled, so the only chance to keep them working is by using this driver.
23
24  BCM6328 LED controller has a HWDIS register, which controls whether a LED
25  should be controlled by a hardware signal instead of the MODE register value,
26  with 0 meaning hardware control enabled and 1 hardware control disabled. This
27  is usually 1:1 for hardware to LED signals, but through the activity/link
28  registers you have some limited control over rerouting the LEDs (as
29  explained later in brcm,link-signal-sources). Even if a LED is hardware
30  controlled you are still able to make it blink or light it up if it isn't,
31  but you can't turn it off if the hardware decides to light it up. For this
32  reason, hardware controlled LEDs aren't registered as LED class devices.
33
34  Each LED is represented as a sub-node of the brcm,bcm6328-leds device.
35
36properties:
37  compatible:
38    const: brcm,bcm6328-leds
39
40  reg:
41    maxItems: 1
42
43  brcm,serial-leds:
44    type: boolean
45    description: Enables Serial LEDs.
46
47  brcm,serial-mux:
48    type: boolean
49    description: Enables Serial LEDs multiplexing.
50
51  brcm,serial-clk-low:
52    type: boolean
53    description: Makes clock signal active low.
54
55  brcm,serial-dat-low:
56    type: boolean
57    description: Makes data signal active low.
58
59  brcm,serial-shift-inv:
60    type: boolean
61    description: Inverts Serial LEDs shift direction.
62
63  "#address-cells":
64    const: 1
65
66  "#size-cells":
67    const: 0
68
69patternProperties:
70  "@[a-f0-9]+$":
71    type: object
72
73    $ref: common.yaml#
74
75    properties:
76      reg:
77        items:
78          - maximum: 23
79        description: LED pin number (only LEDs 0 to 23 are valid).
80
81      active-low:
82        type: boolean
83        description: Makes LED active low.
84
85      brcm,hardware-controlled:
86        type: boolean
87        description: Makes this LED hardware controlled.
88
89      brcm,link-signal-sources:
90        $ref: /schemas/types.yaml#/definitions/uint32-array
91        minItems: 1
92        maxItems: 4
93        description: >
94          An array of hardware link signal sources. Up to four link hardware
95          signals can get muxed into these LEDs. Only valid for LEDs 0 to 7,
96          where LED signals 0 to 3 may be muxed to LEDs 0 to 3, and signals 4 to
97          7 may be muxed to LEDs 4 to 7. A signal can be muxed to more than one
98          LED, and one LED can have more than one source signal.
99
100      brcm,activity-signal-sources:
101        $ref: /schemas/types.yaml#/definitions/uint32-array
102        minItems: 1
103        maxItems: 4
104        description: >
105          An array of hardware activity signal sources. Up to four activity
106          hardware signals can get muxed into these LEDs. Only valid for LEDs 0
107          to 7, where LED signals 0 to 3 may be muxed to LEDs 0 to 3, and
108          signals 4 to 7 may be muxed to LEDs 4 to 7. A signal can be muxed to
109          more than one LED, and one LED can have more than one source signal.
110
111    required:
112      - reg
113
114    unevaluatedProperties: false
115
116required:
117  - reg
118  - "#address-cells"
119  - "#size-cells"
120
121additionalProperties: false
122
123examples:
124  - |
125    /* BCM6328 with 4 EPHY LEDs */
126    led-controller@10000800 {
127        compatible = "brcm,bcm6328-leds";
128        #address-cells = <1>;
129        #size-cells = <0>;
130        reg = <0x10000800 0x24>;
131
132        alarm_red@2 {
133            reg = <2>;
134            active-low;
135            label = "red:alarm";
136        };
137
138        inet_green@3 {
139            reg = <3>;
140            active-low;
141            label = "green:inet";
142        };
143
144        power_green@4 {
145            reg = <4>;
146            active-low;
147            label = "green:power";
148            default-state = "on";
149        };
150
151        ephy0_spd@17 {
152            reg = <17>;
153            brcm,hardware-controlled;
154        };
155
156        ephy1_spd@18 {
157            reg = <18>;
158            brcm,hardware-controlled;
159        };
160
161        ephy2_spd@19 {
162            reg = <19>;
163            brcm,hardware-controlled;
164        };
165
166        ephy3_spd@20 {
167            reg = <20>;
168            brcm,hardware-controlled;
169        };
170    };
171  - |
172    /* BCM63268 with Serial/GPHY0 LEDs */
173    led-controller@10001900 {
174        compatible = "brcm,bcm6328-leds";
175        #address-cells = <1>;
176        #size-cells = <0>;
177        reg = <0x10001900 0x24>;
178        brcm,serial-leds;
179        brcm,serial-dat-low;
180        brcm,serial-shift-inv;
181
182        gphy0_spd0@0 {
183            reg = <0>;
184            brcm,hardware-controlled;
185            brcm,link-signal-sources = <0>;
186        };
187
188        gphy0_spd1@1 {
189            reg = <1>;
190            brcm,hardware-controlled;
191            brcm,link-signal-sources = <1>;
192        };
193
194        inet_red@2 {
195            reg = <2>;
196            active-low;
197            label = "red:inet";
198        };
199
200        dsl_green@3 {
201            reg = <3>;
202            active-low;
203            label = "green:dsl";
204        };
205
206        usb_green@4 {
207            reg = <4>;
208            active-low;
209            label = "green:usb";
210        };
211
212        wps_green@7 {
213            reg = <7>;
214            active-low;
215            label = "green:wps";
216        };
217
218        inet_green@8 {
219            reg = <8>;
220            active-low;
221            label = "green:inet";
222        };
223
224        ephy0_act@9 {
225            reg = <9>;
226            brcm,hardware-controlled;
227        };
228
229        ephy1_act@10 {
230            reg = <10>;
231            brcm,hardware-controlled;
232        };
233
234        ephy2_act@11 {
235            reg = <11>;
236            brcm,hardware-controlled;
237        };
238
239        gphy0_act@12 {
240            reg = <12>;
241            brcm,hardware-controlled;
242        };
243
244        ephy0_spd@13 {
245            reg = <13>;
246            brcm,hardware-controlled;
247        };
248
249        ephy1_spd@14 {
250            reg = <14>;
251            brcm,hardware-controlled;
252        };
253
254        ephy2_spd@15 {
255            reg = <15>;
256            brcm,hardware-controlled;
257        };
258
259        power_green@20 {
260            reg = <20>;
261            active-low;
262            label = "green:power";
263            default-state = "on";
264        };
265    };
266  - |
267    /* BCM6362 with 1 LED for each EPHY */
268    led-controller@10001900 {
269        compatible = "brcm,bcm6328-leds";
270        #address-cells = <1>;
271        #size-cells = <0>;
272        reg = <0x10001900 0x24>;
273
274        usb@0 {
275            reg = <0>;
276            brcm,hardware-controlled;
277            brcm,link-signal-sources = <0>;
278            brcm,activity-signal-sources = <0>;
279            /* USB link/activity routed to USB LED */
280        };
281
282        inet@1 {
283            reg = <1>;
284            brcm,hardware-controlled;
285            brcm,activity-signal-sources = <1>;
286            /* INET activity routed to INET LED */
287        };
288
289        ephy0@4 {
290            reg = <4>;
291            brcm,hardware-controlled;
292            brcm,link-signal-sources = <4>;
293            /* EPHY0 link routed to EPHY0 LED */
294        };
295
296        ephy1@5 {
297            reg = <5>;
298            brcm,hardware-controlled;
299            brcm,link-signal-sources = <5>;
300            /* EPHY1 link routed to EPHY1 LED */
301        };
302
303        ephy2@6 {
304            reg = <6>;
305            brcm,hardware-controlled;
306            brcm,link-signal-sources = <6>;
307            /* EPHY2 link routed to EPHY2 LED */
308        };
309
310        ephy3@7 {
311            reg = <7>;
312            brcm,hardware-controlled;
313            brcm,link-signal-sources = <7>;
314            /* EPHY3 link routed to EPHY3 LED */
315        };
316
317        power_green@20 {
318            reg = <20>;
319            active-low;
320            label = "green:power";
321            default-state = "on";
322        };
323    };
324  - |
325    /* BCM6362 with 1 LED for all EPHYs */
326    led-controller@10001900 {
327        compatible = "brcm,bcm6328-leds";
328        #address-cells = <1>;
329        #size-cells = <0>;
330        reg = <0x10001900 0x24>;
331
332        usb@0 {
333            reg = <0>;
334            brcm,hardware-controlled;
335            brcm,link-signal-sources = <0 1>;
336            brcm,activity-signal-sources = <0 1>;
337            /* USB/INET link/activity routed to USB LED */
338        };
339
340        ephy@4 {
341            reg = <4>;
342            brcm,hardware-controlled;
343            brcm,link-signal-sources = <4 5 6 7>;
344            /* EPHY0/1/2/3 link routed to EPHY0 LED */
345        };
346
347        power_green@20 {
348            reg = <20>;
349            active-low;
350            label = "green:power";
351            default-state = "on";
352        };
353    };
354  - |
355    /* BCM6362 with EPHY LEDs swapped */
356    led-controller@10001900 {
357        compatible = "brcm,bcm6328-leds";
358        #address-cells = <1>;
359        #size-cells = <0>;
360        reg = <0x10001900 0x24>;
361
362        usb@0 {
363            reg = <0>;
364            brcm,hardware-controlled;
365            brcm,link-signal-sources = <0>;
366            brcm,activity-signal-sources = <0 1>;
367            /* USB link/act and INET act routed to USB LED */
368        };
369
370        ephy0@4 {
371            reg = <4>;
372            brcm,hardware-controlled;
373            brcm,link-signal-sources = <7>;
374            /* EPHY3 link routed to EPHY0 LED */
375        };
376
377        ephy1@5 {
378            reg = <5>;
379            brcm,hardware-controlled;
380            brcm,link-signal-sources = <6>;
381            /* EPHY2 link routed to EPHY1 LED */
382        };
383
384        ephy2@6 {
385            reg = <6>;
386            brcm,hardware-controlled;
387            brcm,link-signal-sources = <5>;
388            /* EPHY1 link routed to EPHY2 LED */
389        };
390
391        ephy3@7 {
392            reg = <7>;
393            brcm,hardware-controlled;
394            brcm,link-signal-sources = <4>;
395            /* EPHY0 link routed to EPHY3 LED */
396        };
397
398        power_green@20 {
399            reg = <20>;
400            active-low;
401            label = "green:power";
402            default-state = "on";
403        };
404    };
405