1// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2/*
3 * Broadcom BCM470X / BCM5301X ARM platform code.
4 * DTS for Buffalo WZR-1166DHP and WZR-1166DHP2
5 *
6 * Copyright (C) 2014 Rafał Miłecki <zajec5@gmail.com>
7 * Copyright (C) 2022 SHIMAMOTO Takayoshi <takayoshi.shimamoto.360@gmail.com>
8 */
9
10
11#include "bcm4708.dtsi"
12#include "bcm5301x-nand-cs0-bch8.dtsi"
13#include <dt-bindings/leds/common.h>
14
15/ {
16	spi {
17		compatible = "spi-gpio";
18		num-chipselects = <1>;
19		sck-gpios = <&chipcommon 7 0>;
20		mosi-gpios = <&chipcommon 4 0>;
21		cs-gpios = <&chipcommon 6 0>;
22		#address-cells = <1>;
23		#size-cells = <0>;
24
25		hc595: gpio_spi@0 {
26			compatible = "fairchild,74hc595";
27			reg = <0>;
28			registers-number = <1>;
29			spi-max-frequency = <100000>;
30
31			gpio-controller;
32			#gpio-cells = <2>;
33
34		};
35	};
36
37	leds {
38		compatible = "gpio-leds";
39
40		led-usb {
41			/* label = "bcm53xx:blue:usb"; */
42			function = LED_FUNCTION_USB;
43			color = <LED_COLOR_ID_BLUE>;
44			gpios = <&hc595 0 GPIO_ACTIVE_HIGH>;
45			trigger-sources = <&ohci_port1>, <&ehci_port1>,
46					  <&xhci_port1>, <&ohci_port2>,
47					  <&ehci_port2>;
48			linux,default-trigger = "usbport";
49		};
50
51		led-power0 {
52			/* label = "bcm53xx:red:power"; */
53			function = LED_FUNCTION_FAULT;
54			color = <LED_COLOR_ID_RED>;
55			gpios = <&hc595 1 GPIO_ACTIVE_HIGH>;
56		};
57
58		led-power1 {
59			/* label = "bcm53xx:white:power"; */
60			function = LED_FUNCTION_POWER;
61			color = <LED_COLOR_ID_WHITE>;
62			gpios = <&hc595 2 GPIO_ACTIVE_HIGH>;
63			linux,default-trigger = "default-on";
64		};
65
66		led-router0 {
67			/*  label = "bcm53xx:blue:router"; */
68			function = LED_FUNCTION_STATUS;
69			color = <LED_COLOR_ID_BLUE>;
70			gpios = <&hc595 3 GPIO_ACTIVE_HIGH>;
71			linux,default-trigger = "default-on";
72		};
73
74		led-router1 {
75			/* label = "bcm53xx:amber:router"; */
76			function = LED_FUNCTION_STATUS;
77			color = <LED_COLOR_ID_AMBER>;
78			gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
79		};
80
81		led-wan {
82			/* label = "bcm53xx:blue:wan"; */
83			function = LED_FUNCTION_WAN;
84			color = <LED_COLOR_ID_BLUE>;
85			gpios = <&hc595 5 GPIO_ACTIVE_HIGH>;
86			linux,default-trigger = "default-on";
87		};
88
89		led-wireless0 {
90			/* label = "bcm53xx:blue:wireless"; */
91			function = LED_FUNCTION_WLAN;
92			color = <LED_COLOR_ID_BLUE>;
93			gpios = <&hc595 6 GPIO_ACTIVE_HIGH>;
94		};
95
96		led-wireless1 {
97			/* label = "bcm53xx:amber:wireless"; */
98			function = LED_FUNCTION_WLAN;
99			color = <LED_COLOR_ID_AMBER>;
100			gpios = <&hc595 7 GPIO_ACTIVE_HIGH>;
101		};
102	};
103
104	gpio-keys {
105		compatible = "gpio-keys";
106
107		button-restart {
108			label = "Reset";
109			linux,code = <KEY_RESTART>;
110			gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>;
111		};
112
113		button-aoss {
114			label = "AOSS";
115			linux,code = <KEY_WPS_BUTTON>;
116			gpios = <&chipcommon 12 GPIO_ACTIVE_LOW>;
117		};
118
119		/* Commit mode set by switch? */
120		button-mode {
121			label = "Mode";
122			linux,code = <KEY_SETUP>;
123			gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>;
124		};
125
126		/* Switch: AP mode */
127		button-sw-ap {
128			label = "AP";
129			linux,code = <BTN_0>;
130			gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
131		};
132
133		button-eject {
134			label = "USB eject";
135			linux,code = <KEY_EJECTCD>;
136			gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>;
137		};
138	};
139};
140
141&usb2 {
142	vcc-gpio = <&chipcommon 9 GPIO_ACTIVE_HIGH>;
143};
144
145&usb3 {
146	vcc-gpio = <&chipcommon 10 GPIO_ACTIVE_LOW>;
147};
148
149&spi_nor {
150	status = "okay";
151};
152
153&usb3_phy {
154	status = "okay";
155};
156
157&srab {
158	status = "okay";
159
160	ports {
161		port@0 {
162			label = "lan1";
163		};
164
165		port@1 {
166			label = "lan2";
167		};
168
169		port@2 {
170			label = "lan3";
171		};
172
173		port@3 {
174			label = "lan4";
175		};
176
177		port@4 {
178			label = "wan";
179		};
180
181		port@5 {
182			label = "cpu";
183		};
184
185		port@7 {
186			status = "disabled";
187		};
188
189		port@8 {
190			status = "disabled";
191		};
192	};
193};
194