gemini: 4.14: Fix up DNS-313 compatible string
[openwrt/openwrt.git] / target / linux / gemini / patches-4.14 / 0013-ARM-dts-Add-basic-devicetree-for-D-Link-DNS-313.patch
1 From 2f08de94f207a4347053e1faa22c9a310c9c61b0 Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Fri, 17 Nov 2017 16:36:32 +0100
4 Subject: [PATCH 13/31] ARM: dts: Add basic devicetree for D-Link DNS-313
5
6 This adds a basic device tree for the D-Link DNS-313
7 NAS enclosure. This device has a thermal sensor and a
8 fan so we add a thermal zone for the chassis in the
9 device tree based on information from the product.
10
11 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
12 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
13 ---
14 arch/arm/boot/dts/Makefile | 1 +
15 arch/arm/boot/dts/gemini-dlink-dns-313.dts | 241 +++++++++++++++++++++++++++++
16 2 files changed, 242 insertions(+)
17 create mode 100644 arch/arm/boot/dts/gemini-dlink-dns-313.dts
18
19 --- a/arch/arm/boot/dts/Makefile
20 +++ b/arch/arm/boot/dts/Makefile
21 @@ -185,6 +185,7 @@ dtb-$(CONFIG_ARCH_EXYNOS5) += \
22 exynos5800-peach-pi.dtb
23 dtb-$(CONFIG_ARCH_GEMINI) += \
24 gemini-dlink-dir-685.dtb \
25 + gemini-dlink-dns-313.dtb \
26 gemini-nas4220b.dtb \
27 gemini-rut1xx.dtb \
28 gemini-sq201.dtb \
29 --- /dev/null
30 +++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts
31 @@ -0,0 +1,241 @@
32 +// SPDX-License-Identifier: GPL-2.0
33 +/*
34 + * Device Tree file for D-Link DNS-313 1-Bay Network Storage Enclosure
35 + */
36 +
37 +/dts-v1/;
38 +
39 +#include "gemini.dtsi"
40 +#include <dt-bindings/input/input.h>
41 +#include <dt-bindings/thermal/thermal.h>
42 +
43 +/ {
44 + model = "D-Link DNS-313 1-Bay Network Storage Enclosure";
45 + compatible = "dlink,dns-313", "cortina,gemini";
46 + #address-cells = <1>;
47 + #size-cells = <1>;
48 +
49 + memory {
50 + /* 64 MB SDRAM in a Nanya NT5DS32M16BS-6K package */
51 + device_type = "memory";
52 + reg = <0x00000000 0x4000000>;
53 + };
54 +
55 + aliases {
56 + mdio-gpio0 = &mdio0;
57 + };
58 +
59 + chosen {
60 + stdout-path = "uart0:19200n8";
61 + };
62 +
63 + gpio_keys {
64 + compatible = "gpio-keys";
65 + #address-cells = <1>;
66 + #size-cells = <0>;
67 + button-esc {
68 + debounce_interval = <50>;
69 + wakeup-source;
70 + linux,code = <KEY_ESC>;
71 + label = "reset";
72 + gpios = <&gpio1 31 GPIO_ACTIVE_LOW>;
73 + };
74 + };
75 +
76 + leds {
77 + compatible = "gpio-leds";
78 + led-power {
79 + label = "dns313:blue:power";
80 + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
81 + default-state = "on";
82 + linux,default-trigger = "heartbeat";
83 + };
84 + led-disk-blue {
85 + label = "dns313:blue:disk";
86 + gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
87 + default-state = "off";
88 + };
89 + led-disk-green {
90 + label = "dns313:green:disk";
91 + gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
92 + default-state = "off";
93 + linux,default-trigger = "ide-disk";
94 + /* Ideally should activate while reading */
95 + };
96 + led-disk-red {
97 + label = "dns313:red:disk";
98 + gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
99 + default-state = "off";
100 + /* Ideally should activate while writing */
101 + };
102 + };
103 +
104 + /*
105 + * This is a ADDA AD0405GB-G73 fan @3000 and 6000 RPM.
106 + */
107 + fan0: gpio-fan {
108 + compatible = "gpio-fan";
109 + gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>,
110 + <&gpio0 12 GPIO_ACTIVE_HIGH>;
111 + gpio-fan,speed-map = <0 0>, <3000 1>, <6000 2>;
112 + cooling-min-level = <0>;
113 + cooling-max-level = <2>;
114 + #cooling-cells = <2>;
115 + };
116 +
117 +
118 + /* Global Mixed-Mode Technology G751 mounted on GPIO I2C */
119 + gpio-i2c {
120 + compatible = "i2c-gpio";
121 + sda-gpios = <&gpio0 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
122 + scl-gpios = <&gpio0 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
123 + #address-cells = <1>;
124 + #size-cells = <0>;
125 +
126 + g751: temperature-sensor@48 {
127 + compatible = "gmt,g751";
128 + reg = <0x48>;
129 + #thermal-sensor-cells = <0>;
130 + };
131 + };
132 +
133 + thermal-zones {
134 + chassis-thermal {
135 + /* Poll every 20 seconds */
136 + polling-delay = <20000>;
137 + /* Poll every 2nd second when cooling */
138 + polling-delay-passive = <2000>;
139 +
140 + thermal-sensors = <&g751>;
141 +
142 + /* Tripping points from the fan.script in the rootfs */
143 + trips {
144 + chassis_alert0: chassis-alert0 {
145 + /* At 43 degrees turn on low speed */
146 + temperature = <43000>;
147 + hysteresis = <3000>;
148 + type = "active";
149 + };
150 + chassis_alert1: chassis-alert1 {
151 + /* At 47 degrees turn on high speed */
152 + temperature = <47000>;
153 + hysteresis = <3000>;
154 + type = "active";
155 + };
156 + chassis_crit: chassis-crit {
157 + /* Just shut down at 60 degrees */
158 + temperature = <60000>;
159 + hysteresis = <2000>;
160 + type = "critical";
161 + };
162 + };
163 +
164 + cooling-maps {
165 + map0 {
166 + trip = <&chassis_alert0>;
167 + cooling-device = <&fan0 1 1>;
168 + };
169 + map1 {
170 + trip = <&chassis_alert1>;
171 + cooling-device = <&fan0 2 2>;
172 + };
173 + };
174 + };
175 + };
176 +
177 + mdio0: ethernet-phy {
178 + compatible = "virtual,mdio-gpio";
179 + /* Uses MDC and MDIO */
180 + gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>, /* MDC */
181 + <&gpio0 21 GPIO_ACTIVE_HIGH>; /* MDIO */
182 + #address-cells = <1>;
183 + #size-cells = <0>;
184 +
185 + /* This is a Realtek RTL8211B Gigabit ethernet transceiver */
186 + phy0: ethernet-phy@1 {
187 + reg = <1>;
188 + device_type = "ethernet-phy";
189 + };
190 + };
191 +
192 + soc {
193 + flash@30000000 {
194 + status = "okay";
195 + /* 512KB of flash */
196 + reg = <0x30000000 0x00080000>;
197 +
198 + /*
199 + * This "RedBoot" is the Storlink derivative.
200 + */
201 + partition@0 {
202 + label = "RedBoot";
203 + reg = <0x00000000 0x00040000>;
204 + read-only;
205 + };
206 + partition@40000 {
207 + label = "MTD1";
208 + reg = <0x00040000 0x00020000>;
209 + read-only;
210 + };
211 + partition@60000 {
212 + label = "MTD2";
213 + reg = <0x00060000 0x00020000>;
214 + read-only;
215 + };
216 + };
217 +
218 + syscon: syscon@40000000 {
219 + pinctrl {
220 + /*
221 + */
222 + gpio0_default_pins: pinctrl-gpio0 {
223 + mux {
224 + function = "gpio0";
225 + groups =
226 + /* Used by LEDs conflicts ICE */
227 + "gpio0bgrp",
228 + /* Used by ? conflicts ICE */
229 + "gpio0cgrp",
230 + /*
231 + * Used by fan & G751, conflicts LPC,
232 + * UART modem lines, SSP
233 + */
234 + "gpio0egrp",
235 + /* Used by G751 */
236 + "gpio0fgrp",
237 + /* Used by MDIO */
238 + "gpio0igrp";
239 + };
240 + };
241 + gpio1_default_pins: pinctrl-gpio1 {
242 + mux {
243 + function = "gpio1";
244 + /* Used by "reset" button */
245 + groups = "gpio1dgrp";
246 + };
247 + };
248 + };
249 + };
250 +
251 + sata: sata@46000000 {
252 + /* The ROM uses this muxmode */
253 + cortina,gemini-ata-muxmode = <3>;
254 + cortina,gemini-enable-sata-bridge;
255 + status = "okay";
256 + };
257 +
258 + gpio0: gpio@4d000000 {
259 + pinctrl-names = "default";
260 + pinctrl-0 = <&gpio0_default_pins>;
261 + };
262 +
263 + gpio1: gpio@4e000000 {
264 + pinctrl-names = "default";
265 + pinctrl-0 = <&gpio1_default_pins>;
266 + };
267 +
268 + ata@63000000 {
269 + status = "okay";
270 + };
271 + };
272 +};