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