xref: /openbmc/linux/arch/mips/boot/dts/ingenic/gcw0.dts (revision d8242e6a71bac37b6cde52c0add533615eef8c5e)
1// SPDX-License-Identifier: GPL-2.0
2/dts-v1/;
3
4#include "jz4770.dtsi"
5#include <dt-bindings/clock/ingenic,tcu.h>
6
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/iio/adc/ingenic,adc.h>
9#include <dt-bindings/input/input.h>
10
11/ {
12	compatible = "gcw,zero", "ingenic,jz4770";
13	model = "GCW Zero";
14
15	aliases {
16		serial0 = &uart0;
17		serial1 = &uart1;
18		serial2 = &uart2;
19		serial3 = &uart3;
20	};
21
22	chosen {
23		stdout-path = "serial2:57600n8";
24	};
25
26	vcc: regulator@0 {
27		compatible = "regulator-fixed";
28		regulator-name = "vcc";
29
30		regulator-min-microvolt = <3300000>;
31		regulator-max-microvolt = <3300000>;
32		regulator-always-on;
33	};
34
35	mmc1_power: regulator@1 {
36		compatible = "regulator-fixed";
37		regulator-name = "mmc1_vcc";
38		gpio = <&gpe 9 0>;
39
40		regulator-min-microvolt = <3300000>;
41		regulator-max-microvolt = <3300000>;
42		vin-supply = <&vcc>;
43	};
44
45	headphones_amp: analog-amplifier@0 {
46		compatible = "simple-audio-amplifier";
47		enable-gpios = <&gpf 3 GPIO_ACTIVE_LOW>;
48		enable-delay-ms = <50>;
49
50		VCC-supply = <&ldo5>;
51		sound-name-prefix = "Headphones Amp";
52	};
53
54	speaker_amp: analog-amplifier@1 {
55		compatible = "simple-audio-amplifier";
56		enable-gpios = <&gpf 20 GPIO_ACTIVE_HIGH>;
57
58		VCC-supply = <&ldo5>;
59		sound-name-prefix = "Speaker Amp";
60	};
61
62	sound {
63		compatible = "simple-audio-card";
64
65		simple-audio-card,name = "gcw0-audio";
66		simple-audio-card,format = "i2s";
67
68		simple-audio-card,widgets =
69			"Speaker", "Speaker",
70			"Headphone", "Headphones",
71			"Line", "FM Radio",
72			"Microphone", "Built-in Mic";
73		simple-audio-card,routing =
74			"Headphones Amp INL", "LHPOUT",
75			"Headphones Amp INR", "RHPOUT",
76			"Headphones", "Headphones Amp OUTL",
77			"Headphones", "Headphones Amp OUTR",
78			"Speaker Amp INL", "LOUT",
79			"Speaker Amp INR", "ROUT",
80			"Speaker", "Speaker Amp OUTL",
81			"Speaker", "Speaker Amp OUTR",
82			"LLINEIN", "FM Radio",
83			"RLINEIN", "FM Radio",
84			"Built-in Mic", "MICBIAS",
85			"MIC1P", "Built-in Mic",
86			"MIC1N", "Built-in Mic";
87		simple-audio-card,pin-switches = "Speaker", "Headphones";
88
89		simple-audio-card,hp-det-gpio = <&gpf 21 GPIO_ACTIVE_HIGH>;
90		simple-audio-card,aux-devs = <&speaker_amp>, <&headphones_amp>;
91
92		simple-audio-card,bitclock-master = <&dai_codec>;
93		simple-audio-card,frame-master = <&dai_codec>;
94
95		dai_cpu: simple-audio-card,cpu {
96			sound-dai = <&aic>;
97		};
98
99		dai_codec: simple-audio-card,codec {
100			sound-dai = <&codec>;
101		};
102	};
103
104	rumble {
105		compatible = "pwm-vibrator";
106		pwms = <&pwm 4 2000000 0>;
107		pwm-names = "enable";
108
109		pinctrl-names = "default";
110		pinctrl-0 = <&pins_pwm4>;
111	};
112
113	backlight: backlight {
114		compatible = "pwm-backlight";
115		pwms = <&pwm 1 40000 0>;
116		power-supply = <&vcc>;
117
118		brightness-levels = <0 16 32 48 64 80 96 112 128
119				     144 160 176 192 208 224 240 255>;
120		default-brightness-level = <12>;
121
122		pinctrl-names = "default";
123		pinctrl-0 = <&pins_pwm1>;
124	};
125
126	gpio-keys {
127		compatible = "gpio-keys";
128		#address-cells = <1>;
129		#size-cells = <0>;
130
131		autorepeat;
132
133		button@0 {
134			label = "D-pad up";
135			linux,code = <KEY_UP>;
136			linux,can-disable;
137			gpios = <&gpe 21 GPIO_ACTIVE_LOW>;
138		};
139
140		button@1 {
141			label = "D-pad down";
142			linux,code = <KEY_DOWN>;
143			linux,can-disable;
144			gpios = <&gpe 25 GPIO_ACTIVE_LOW>;
145		};
146
147		button@2 {
148			label = "D-pad left";
149			linux,code = <KEY_LEFT>;
150			linux,can-disable;
151			gpios = <&gpe 23 GPIO_ACTIVE_LOW>;
152		};
153
154		button@3 {
155			label = "D-pad right";
156			linux,code = <KEY_RIGHT>;
157			linux,can-disable;
158			gpios = <&gpe 24 GPIO_ACTIVE_LOW>;
159		};
160
161		button@4 {
162			label = "Button A";
163			linux,code = <KEY_LEFTCTRL>;
164			linux,can-disable;
165			gpios = <&gpe 29 GPIO_ACTIVE_LOW>;
166		};
167
168		button@5 {
169			label = "Button B";
170			linux,code = <KEY_LEFTALT>;
171			linux,can-disable;
172			gpios = <&gpe 20 GPIO_ACTIVE_LOW>;
173		};
174
175		button@6 {
176			label = "Button Y";
177			linux,code = <KEY_SPACE>;
178			linux,can-disable;
179			gpios = <&gpe 27 GPIO_ACTIVE_LOW>;
180		};
181
182		button@7 {
183			label = "Button X";
184			linux,code = <KEY_LEFTSHIFT>;
185			linux,can-disable;
186			gpios = <&gpe 28 GPIO_ACTIVE_LOW>;
187		};
188
189		button@8 {
190			label = "Left shoulder button";
191			linux,code = <KEY_TAB>;
192			linux,can-disable;
193			gpios = <&gpb 20 GPIO_ACTIVE_LOW>;
194		};
195
196		button@9 {
197			label = "Right shoulder button";
198			linux,code = <KEY_BACKSPACE>;
199			linux,can-disable;
200			gpios = <&gpe 26 GPIO_ACTIVE_LOW>;
201		};
202
203		button@10 {
204			label = "Start button";
205			linux,code = <KEY_ENTER>;
206			linux,can-disable;
207			gpios = <&gpb 21 GPIO_ACTIVE_LOW>;
208		};
209
210		button@11 {
211			label = "Select button";
212			linux,code = <KEY_ESC>;
213			linux,can-disable;
214			/*
215			 * This is the only button that is active high,
216			 * since it doubles as BOOT_SEL1.
217			 */
218			gpios = <&gpd 18 GPIO_ACTIVE_HIGH>;
219		};
220
221		button@12 {
222			label = "Power slider";
223			linux,code = <KEY_POWER>;
224			linux,can-disable;
225			gpios = <&gpa 30 GPIO_ACTIVE_LOW>;
226			wakeup-source;
227		};
228
229		button@13 {
230			label = "Power hold";
231			linux,code = <KEY_PAUSE>;
232			linux,can-disable;
233			gpios = <&gpf 11 GPIO_ACTIVE_LOW>;
234		};
235	};
236
237	i2c3: i2c-controller@3 {
238		compatible = "i2c-gpio";
239		#address-cells = <1>;
240		#size-cells = <0>;
241
242		sda-gpios = <&gpd 5 GPIO_ACTIVE_HIGH>;
243		scl-gpios = <&gpd 4 GPIO_ACTIVE_HIGH>;
244		i2c-gpio,delay-us = <2>; /* 250 kHz */
245
246		act8600: pmic@5a {
247			compatible = "active-semi,act8600";
248			reg = <0x5a>;
249
250			regulators {
251				/* USB OTG */
252				otg_vbus: SUDCDC_REG4 {
253					/*
254					 * 5.3V instead of 5.0V to compensate
255					 * for the voltage drop of a diode
256					 * between the regulator and the
257					 * connector.
258					 */
259					regulator-min-microvolt = <5300000>;
260					regulator-max-microvolt = <5300000>;
261					inl-supply = <&vcc>;
262				};
263
264				/*
265				 * When this is off, there is no sound, but also
266				 * no USB networking.
267				 */
268				ldo5: LDO5 {
269					regulator-min-microvolt = <2500000>;
270					regulator-max-microvolt = <2500000>;
271					inl-supply = <&vcc>;
272				};
273
274				/* LCD panel and FM radio */
275				ldo6: LDO6 {
276					regulator-min-microvolt = <3300000>;
277					regulator-max-microvolt = <3300000>;
278					inl-supply = <&vcc>;
279				};
280
281				/* ??? */
282				LDO7 {
283					regulator-min-microvolt = <3300000>;
284					regulator-max-microvolt = <3300000>;
285					/*regulator-always-on;*/
286					inl-supply = <&vcc>;
287				};
288
289				/*
290				 * The colors on the LCD are wrong when this is
291				 * off. Which is strange, since the LCD panel
292				 * data sheet only mentions a 3.3V input.
293				 */
294				LDO8 {
295					regulator-min-microvolt = <1800000>;
296					regulator-max-microvolt = <1800000>;
297					regulator-always-on;
298					inl-supply = <&vcc>;
299				};
300
301				/* RTC fixed 3.3V */
302				LDO_REG9 {
303					regulator-min-microvolt = <3300000>;
304					regulator-max-microvolt = <3300000>;
305					regulator-always-on;
306					inl-supply = <&vcc>;
307				};
308
309				/* Unused fixed 1.2V */
310				LDO_REG10 {
311					inl-supply = <&vcc>;
312				};
313			};
314		};
315	};
316
317	leds {
318		compatible = "gpio-leds";
319
320		led {
321			gpios = <&gpb 30 GPIO_ACTIVE_LOW>;
322			default-state = "on";
323		};
324	};
325
326	spi {
327		compatible = "spi-gpio";
328		#address-cells = <1>;
329		#size-cells = <0>;
330
331		sck-gpios = <&gpe 15 GPIO_ACTIVE_HIGH>;
332		mosi-gpios = <&gpe 17 GPIO_ACTIVE_HIGH>;
333		cs-gpios = <&gpe 16 GPIO_ACTIVE_HIGH>;
334		num-chipselects = <1>;
335
336		nt39016@0 {
337			compatible = "kingdisplay,kd035g6-54nt";
338			reg = <0>;
339
340			spi-max-frequency = <3125000>;
341			spi-3wire;
342			spi-cs-high;
343
344			reset-gpios = <&gpe 2 GPIO_ACTIVE_LOW>;
345
346			backlight = <&backlight>;
347			power-supply = <&ldo6>;
348
349			port {
350				panel_input: endpoint {
351					remote-endpoint = <&panel_output>;
352				};
353			};
354		};
355	};
356
357	connector {
358		compatible = "gpio-usb-b-connector", "usb-b-connector";
359		label = "mini-USB";
360		type = "mini";
361
362		/*
363		 * USB OTG is not yet working reliably, the ID detection
364		 * mechanism tends to fry easily for unknown reasons.
365		 * Until this is fixed, disable OTG by not providing the
366		 * ID GPIO to the driver.
367		 */
368		//id-gpios = <&gpf 18 GPIO_ACTIVE_LOW>;
369
370		vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
371		vbus-supply = <&otg_vbus>;
372
373		pinctrl-names = "default";
374		pinctrl-0 = <&pins_otg>;
375
376		port {
377			usb_ep: endpoint {
378				remote-endpoint = <&usb_otg_ep>;
379			};
380		};
381	};
382};
383
384&ext {
385	clock-frequency = <12000000>;
386};
387
388&pinctrl {
389	pins_lcd: lcd {
390		function = "lcd";
391		groups = "lcd-24bit";
392	};
393
394	pins_uart2: uart2 {
395		function = "uart2";
396		groups = "uart2-data";
397	};
398
399	pins_mmc0: mmc0 {
400		function = "mmc0";
401		groups = "mmc0-1bit-a", "mmc0-4bit-a";
402	};
403
404	pins_mmc1: mmc1 {
405		function = "mmc1";
406		groups = "mmc1-1bit-d", "mmc1-4bit-d";
407	};
408
409	pins_otg: otg {
410		otg-vbus-pin {
411			function = "otg";
412			groups = "otg-vbus";
413		};
414
415		vbus-pin {
416			pins = "PB5";
417			bias-disable;
418		};
419	};
420
421	pins_pwm1: pwm1 {
422		function = "pwm1";
423		groups = "pwm1";
424	};
425
426	pins_pwm4: pwm4 {
427		function = "pwm4";
428		groups = "pwm4";
429	};
430};
431
432&uart2 {
433	pinctrl-names = "default";
434	pinctrl-0 = <&pins_uart2>;
435
436	status = "okay";
437};
438
439&cgu {
440	/*
441	 * Put high-speed peripherals under PLL1, such that we can change the
442	 * PLL0 frequency on demand without having to suspend peripherals.
443	 * We use a rate of 432 MHz, which is the least common multiple of
444	 * 27 MHz (required by TV encoder) and 48 MHz (required by USB host).
445	 * Put the GPU under PLL0 since we want a higher frequency.
446	 * Use the 32 kHz oscillator as the parent of the RTC for a higher
447	 * precision.
448	 */
449	assigned-clocks =
450		<&cgu JZ4770_CLK_PLL1>,
451		<&cgu JZ4770_CLK_GPU>,
452		<&cgu JZ4770_CLK_RTC>,
453		<&cgu JZ4770_CLK_UHC>,
454		<&cgu JZ4770_CLK_LPCLK_MUX>,
455		<&cgu JZ4770_CLK_MMC0_MUX>,
456		<&cgu JZ4770_CLK_MMC1_MUX>;
457	assigned-clock-parents =
458		<0>,
459		<&cgu JZ4770_CLK_PLL0>,
460		<&cgu JZ4770_CLK_OSC32K>,
461		<&cgu JZ4770_CLK_PLL1>,
462		<&cgu JZ4770_CLK_PLL1>,
463		<&cgu JZ4770_CLK_PLL1>,
464		<&cgu JZ4770_CLK_PLL1>;
465	assigned-clock-rates =
466		<432000000>,
467		<600000000>;
468};
469
470&uhc {
471	/* The WiFi module is connected to the UHC. */
472	status = "okay";
473};
474
475&tcu {
476	/*
477	 * 750 kHz for the system timer and clocksource, 12 MHz for the OST,
478	 * and use RTC as the parent for the watchdog clock
479	 */
480	assigned-clocks = <&tcu TCU_CLK_TIMER0>, <&tcu TCU_CLK_TIMER2>,
481			  <&tcu TCU_CLK_OST>, <&tcu TCU_CLK_WDT>;
482	assigned-clock-parents = <0>, <0>, <0>, <&cgu JZ4770_CLK_RTC>;
483	assigned-clock-rates = <750000>, <750000>, <12000000>;
484
485	/* PWM1 is in use, so use channel #2 for the clocksource */
486	ingenic,pwm-channels-mask = <0xfa>;
487};
488
489&usb_otg {
490	port {
491		usb_otg_ep: endpoint {
492			remote-endpoint = <&usb_ep>;
493		};
494	};
495};
496
497&otg_phy {
498	vcc-supply = <&ldo5>;
499};
500
501&rtc {
502	clocks = <&cgu JZ4770_CLK_RTC>;
503	clock-names = "rtc";
504
505	system-power-controller;
506};
507
508&mmc0 {
509	status = "okay";
510
511	bus-width = <4>;
512	max-frequency = <48000000>;
513	vmmc-supply = <&vcc>;
514	non-removable;
515
516	pinctrl-names = "default";
517	pinctrl-0 = <&pins_mmc0>;
518};
519
520&mmc1 {
521	status = "okay";
522
523	bus-width = <4>;
524	max-frequency = <48000000>;
525	cd-gpios = <&gpb 2 GPIO_ACTIVE_LOW>;
526	vmmc-supply = <&mmc1_power>;
527
528	pinctrl-names = "default";
529	pinctrl-0 = <&pins_mmc1>;
530};
531
532&lcd {
533	pinctrl-names = "default";
534	pinctrl-0 = <&pins_lcd>;
535
536	port {
537		panel_output: endpoint {
538			remote-endpoint = <&panel_input>;
539		};
540	};
541};
542