1LEDs connected to Broadcom BCM6328 controller
2
3This controller is present on BCM6318, BCM6328, BCM6362 and BCM63268.
4In these SoCs it's possible to control LEDs both as GPIOs or by hardware.
5However, on some devices there are Serial LEDs (LEDs connected to a 74x164
6controller), which can either be controlled by software (exporting the 74x164
7as spi-gpio. See Documentation/devicetree/bindings/gpio/gpio-74x164.txt), or
8by hardware using this driver.
9Some of these Serial LEDs are hardware controlled (e.g. ethernet LEDs) and
10exporting the 74x164 as spi-gpio prevents those LEDs to be hardware
11controlled, so the only chance to keep them working is by using this driver.
12
13BCM6328 LED controller has a HWDIS register, which controls whether a LED
14should be controlled by a hardware signal instead of the MODE register value,
15with 0 meaning hardware control enabled and 1 hardware control disabled. This
16is usually 1:1 for hardware to LED signals, but through the activity/link
17registers you have some limited control over rerouting the LEDs (as
18explained later in brcm,link-signal-sources). Even if a LED is hardware
19controlled you are still able to make it blink or light it up if it isn't,
20but you can't turn it off if the hardware decides to light it up. For this
21reason, hardware controlled LEDs aren't registered as LED class devices.
22
23Required properties:
24  - compatible : should be "brcm,bcm6328-leds".
25  - #address-cells : must be 1.
26  - #size-cells : must be 0.
27  - reg : BCM6328 LED controller address and size.
28
29Optional properties:
30  - brcm,serial-leds : Boolean, enables Serial LEDs.
31    Default : false
32  - brcm,serial-mux : Boolean, enables Serial LEDs multiplexing.
33    Default : false
34  - brcm,serial-clk-low : Boolean, makes clock signal active low.
35    Default : false
36  - brcm,serial-dat-low : Boolean, makes data signal active low.
37    Default : false
38  - brcm,serial-shift-inv : Boolean, inverts Serial LEDs shift direction.
39    Default : false
40
41Each LED is represented as a sub-node of the brcm,bcm6328-leds device.
42
43LED sub-node required properties:
44  - reg : LED pin number (only LEDs 0 to 23 are valid).
45
46LED sub-node optional properties:
47  a) Optional properties for sub-nodes related to software controlled LEDs:
48    - label : see Documentation/devicetree/bindings/leds/common.txt
49    - active-low : Boolean, makes LED active low.
50      Default : false
51    - default-state : see
52      Documentation/devicetree/bindings/leds/common.txt
53    - linux,default-trigger : see
54      Documentation/devicetree/bindings/leds/common.txt
55
56  b) Optional properties for sub-nodes related to hardware controlled LEDs:
57    - brcm,hardware-controlled : Boolean, makes this LED hardware controlled.
58      Default : false
59    - brcm,link-signal-sources : An array of hardware link
60      signal sources. Up to four link hardware signals can get muxed into
61      these LEDs. Only valid for LEDs 0 to 7, where LED signals 0 to 3 may
62      be muxed to LEDs 0 to 3, and signals 4 to 7 may be muxed to LEDs
63      4 to 7. A signal can be muxed to more than one LED, and one LED can
64      have more than one source signal.
65    - brcm,activity-signal-sources : An array of hardware activity
66      signal sources. Up to four activity hardware signals can get muxed into
67      these LEDs. Only valid for LEDs 0 to 7, where LED signals 0 to 3 may
68      be muxed to LEDs 0 to 3, and signals 4 to 7 may be muxed to LEDs
69      4 to 7. A signal can be muxed to more than one LED, and one LED can
70      have more than one source signal.
71
72Examples:
73Scenario 1 : BCM6328 with 4 EPHY LEDs
74	leds0: led-controller@10000800 {
75		compatible = "brcm,bcm6328-leds";
76		#address-cells = <1>;
77		#size-cells = <0>;
78		reg = <0x10000800 0x24>;
79
80		alarm_red@2 {
81			reg = <2>;
82			active-low;
83			label = "red:alarm";
84		};
85		inet_green@3 {
86			reg = <3>;
87			active-low;
88			label = "green:inet";
89		};
90		power_green@4 {
91			reg = <4>;
92			active-low;
93			label = "green:power";
94			default-state = "on";
95		};
96		ephy0_spd@17 {
97			reg = <17>;
98			brcm,hardware-controlled;
99		};
100		ephy1_spd@18 {
101			reg = <18>;
102			brcm,hardware-controlled;
103		};
104		ephy2_spd@19 {
105			reg = <19>;
106			brcm,hardware-controlled;
107		};
108		ephy3_spd@20 {
109			reg = <20>;
110			brcm,hardware-controlled;
111		};
112	};
113
114Scenario 2 : BCM63268 with Serial/GPHY0 LEDs
115	leds0: led-controller@10001900 {
116		compatible = "brcm,bcm6328-leds";
117		#address-cells = <1>;
118		#size-cells = <0>;
119		reg = <0x10001900 0x24>;
120		brcm,serial-leds;
121		brcm,serial-dat-low;
122		brcm,serial-shift-inv;
123
124		gphy0_spd0@0 {
125			reg = <0>;
126			brcm,hardware-controlled;
127			brcm,link-signal-sources = <0>;
128		};
129		gphy0_spd1@1 {
130			reg = <1>;
131			brcm,hardware-controlled;
132			brcm,link-signal-sources = <1>;
133		};
134		inet_red@2 {
135			reg = <2>;
136			active-low;
137			label = "red:inet";
138		};
139		dsl_green@3 {
140			reg = <3>;
141			active-low;
142			label = "green:dsl";
143		};
144		usb_green@4 {
145			reg = <4>;
146			active-low;
147			label = "green:usb";
148		};
149		wps_green@7 {
150			reg = <7>;
151			active-low;
152			label = "green:wps";
153		};
154		inet_green@8 {
155			reg = <8>;
156			active-low;
157			label = "green:inet";
158		};
159		ephy0_act@9 {
160			reg = <9>;
161			brcm,hardware-controlled;
162		};
163		ephy1_act@10 {
164			reg = <10>;
165			brcm,hardware-controlled;
166		};
167		ephy2_act@11 {
168			reg = <11>;
169			brcm,hardware-controlled;
170		};
171		gphy0_act@12 {
172			reg = <12>;
173			brcm,hardware-controlled;
174		};
175		ephy0_spd@13 {
176			reg = <13>;
177			brcm,hardware-controlled;
178		};
179		ephy1_spd@14 {
180			reg = <14>;
181			brcm,hardware-controlled;
182		};
183		ephy2_spd@15 {
184			reg = <15>;
185			brcm,hardware-controlled;
186		};
187		power_green@20 {
188			reg = <20>;
189			active-low;
190			label = "green:power";
191			default-state = "on";
192		};
193	};
194
195Scenario 3 : BCM6362 with 1 LED for each EPHY
196	leds0: led-controller@10001900 {
197		compatible = "brcm,bcm6328-leds";
198		#address-cells = <1>;
199		#size-cells = <0>;
200		reg = <0x10001900 0x24>;
201
202		usb@0 {
203			reg = <0>;
204			brcm,hardware-controlled;
205			brcm,link-signal-sources = <0>;
206			brcm,activity-signal-sources = <0>;
207			/* USB link/activity routed to USB LED */
208		};
209		inet@1 {
210			reg = <1>;
211			brcm,hardware-controlled;
212			brcm,activity-signal-sources = <1>;
213			/* INET activity routed to INET LED */
214		};
215		ephy0@4 {
216			reg = <4>;
217			brcm,hardware-controlled;
218			brcm,link-signal-sources = <4>;
219			/* EPHY0 link routed to EPHY0 LED */
220		};
221		ephy1@5 {
222			reg = <5>;
223			brcm,hardware-controlled;
224			brcm,link-signal-sources = <5>;
225			/* EPHY1 link routed to EPHY1 LED */
226		};
227		ephy2@6 {
228			reg = <6>;
229			brcm,hardware-controlled;
230			brcm,link-signal-sources = <6>;
231			/* EPHY2 link routed to EPHY2 LED */
232		};
233		ephy3@7 {
234			reg = <7>;
235			brcm,hardware-controlled;
236			brcm,link-signal-sources = <7>;
237			/* EPHY3 link routed to EPHY3 LED */
238		};
239		power_green@20 {
240			reg = <20>;
241			active-low;
242			label = "green:power";
243			default-state = "on";
244		};
245	};
246
247Scenario 4 : BCM6362 with 1 LED for all EPHYs
248	leds0: led-controller@10001900 {
249		compatible = "brcm,bcm6328-leds";
250		#address-cells = <1>;
251		#size-cells = <0>;
252		reg = <0x10001900 0x24>;
253
254		usb@0 {
255			reg = <0>;
256			brcm,hardware-controlled;
257			brcm,link-signal-sources = <0 1>;
258			brcm,activity-signal-sources = <0 1>;
259			/* USB/INET link/activity routed to USB LED */
260		};
261		ephy@4 {
262			reg = <4>;
263			brcm,hardware-controlled;
264			brcm,link-signal-sources = <4 5 6 7>;
265			/* EPHY0/1/2/3 link routed to EPHY0 LED */
266		};
267		power_green@20 {
268			reg = <20>;
269			active-low;
270			label = "green:power";
271			default-state = "on";
272		};
273	};
274
275Scenario 5 : BCM6362 with EPHY LEDs swapped
276	leds0: led-controller@10001900 {
277		compatible = "brcm,bcm6328-leds";
278		#address-cells = <1>;
279		#size-cells = <0>;
280		reg = <0x10001900 0x24>;
281
282		usb@0 {
283			reg = <0>;
284			brcm,hardware-controlled;
285			brcm,link-signal-sources = <0>;
286			brcm,activity-signal-sources = <0 1>;
287			/* USB link/act and INET act routed to USB LED */
288		};
289		ephy0@4 {
290			reg = <4>;
291			brcm,hardware-controlled;
292			brcm,link-signal-sources = <7>;
293			/* EPHY3 link routed to EPHY0 LED */
294		};
295		ephy1@5 {
296			reg = <5>;
297			brcm,hardware-controlled;
298			brcm,link-signal-sources = <6>;
299			/* EPHY2 link routed to EPHY1 LED */
300		};
301		ephy2@6 {
302			reg = <6>;
303			brcm,hardware-controlled;
304			brcm,link-signal-sources = <5>;
305			/* EPHY1 link routed to EPHY2 LED */
306		};
307		ephy3@7 {
308			reg = <7>;
309			brcm,hardware-controlled;
310			brcm,link-signal-sources = <4>;
311			/* EPHY0 link routed to EPHY3 LED */
312		};
313		power_green@20 {
314			reg = <20>;
315			active-low;
316			label = "green:power";
317			default-state = "on";
318		};
319	};
320