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