1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2022 Theobroma Systems Design und Consulting GmbH
4 */
5
6/dts-v1/;
7#include "px30-ringneck.dtsi"
8#include <dt-bindings/input/input.h>
9#include <dt-bindings/leds/common.h>
10
11/ {
12	model = "Theobroma Systems PX30-uQ7 SoM on Haikou devkit";
13	compatible = "tsd,px30-ringneck-haikou", "rockchip,px30";
14
15	aliases {
16		mmc2 = &sdmmc;
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	gpio-keys {
24		compatible = "gpio-keys";
25		pinctrl-0 = <&haikou_keys_pin>;
26		pinctrl-names = "default";
27
28		button-batlow-n {
29			label = "BATLOW#";
30			linux,code = <KEY_BATTERY>;
31			gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>;
32		};
33
34		button-slp-btn-n {
35			label = "SLP_BTN#";
36			linux,code = <KEY_SLEEP>;
37			gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>;
38		};
39
40		button-wake-n {
41			label = "WAKE#";
42			linux,code = <KEY_WAKEUP>;
43			gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>;
44			wakeup-source;
45		};
46
47		switch-lid-btn-n {
48			label = "LID_BTN#";
49			linux,code = <SW_LID>;
50			linux,input-type = <EV_SW>;
51			gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
52		};
53	};
54
55	leds {
56		pinctrl-0 = <&module_led_pin>, <&sd_card_led_pin>;
57
58		sd_card_led: led-1 {
59			gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>;
60			linux,default-trigger = "mmc2";
61			function = LED_FUNCTION_SD;
62			color = <LED_COLOR_ID_BLUE>;
63		};
64	};
65
66	i2s0-sound {
67		compatible = "simple-audio-card";
68		simple-audio-card,format = "i2s";
69		simple-audio-card,name = "Haikou,I2S-codec";
70		simple-audio-card,mclk-fs = <512>;
71		simple-audio-card,frame-master = <&sgtl5000_codec>;
72		simple-audio-card,bitclock-master = <&sgtl5000_codec>;
73
74		sgtl5000_codec: simple-audio-card,codec {
75			sound-dai = <&sgtl5000>;
76			// Prevent the dai subsystem from overwriting the clock
77			// frequency. We are using a fixed-frequency oscillator.
78			system-clock-fixed;
79		};
80
81		simple-audio-card,cpu {
82			sound-dai = <&i2s0_8ch>;
83		};
84	};
85
86	sgtl5000_clk: sgtl5000-oscillator {
87		compatible = "fixed-clock";
88		#clock-cells = <0>;
89		clock-frequency = <24576000>;
90	};
91
92	dc_12v: dc-12v-regulator {
93		compatible = "regulator-fixed";
94		regulator-name = "dc_12v";
95		regulator-always-on;
96		regulator-boot-on;
97		regulator-min-microvolt = <12000000>;
98		regulator-max-microvolt = <12000000>;
99	};
100
101	vcc3v3_baseboard: vcc3v3-baseboard-regulator {
102		compatible = "regulator-fixed";
103		regulator-name = "vcc3v3_baseboard";
104		regulator-always-on;
105		regulator-boot-on;
106		regulator-min-microvolt = <3300000>;
107		regulator-max-microvolt = <3300000>;
108		vin-supply = <&dc_12v>;
109	};
110
111	vcc5v0_baseboard: vcc5v0-baseboard-regulator {
112		compatible = "regulator-fixed";
113		regulator-name = "vcc5v0_baseboard";
114		regulator-always-on;
115		regulator-boot-on;
116		regulator-min-microvolt = <5000000>;
117		regulator-max-microvolt = <5000000>;
118		vin-supply = <&dc_12v>;
119	};
120
121	vdda_codec: vdda-codec-regulator {
122		compatible = "regulator-fixed";
123		regulator-name = "vdda_codec";
124		regulator-boot-on;
125		regulator-min-microvolt = <3300000>;
126		regulator-max-microvolt = <3300000>;
127		vin-supply = <&vcc5v0_baseboard>;
128	};
129
130	vddd_codec: vddd-codec-regulator {
131		compatible = "regulator-fixed";
132		regulator-name = "vddd_codec";
133		regulator-boot-on;
134		regulator-min-microvolt = <1600000>;
135		regulator-max-microvolt = <1600000>;
136		vin-supply = <&vcc5v0_baseboard>;
137	};
138};
139
140&i2c2 {
141	status = "okay";
142	clock-frequency = <400000>;
143
144	sgtl5000: codec@a {
145		compatible = "fsl,sgtl5000";
146		reg = <0x0a>;
147		clocks = <&sgtl5000_clk>;
148		#sound-dai-cells = <0>;
149		VDDA-supply = <&vdda_codec>;
150		VDDIO-supply = <&vcc3v3_baseboard>;
151		VDDD-supply = <&vddd_codec>;
152	};
153};
154
155&i2c3 {
156	eeprom@50 {
157		reg = <0x50>;
158		compatible = "atmel,24c01";
159		pagesize = <8>;
160		size = <128>;
161		vcc-supply = <&vcc3v3_baseboard>;
162	};
163};
164
165&i2s0_8ch {
166	status = "okay";
167};
168
169&gmac {
170	status = "okay";
171};
172
173&pinctrl {
174	haikou {
175		haikou_keys_pin: haikou-keys-pin {
176			rockchip,pins =
177			  /* WAKE# */
178			  <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
179			  /* SLP_BTN# */
180			  <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
181			  /* LID_BTN */
182			  <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
183			  /* BATLOW# */
184			  <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
185			  /* BIOS_DISABLE# */
186			  <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
187		};
188	};
189
190	leds {
191		sd_card_led_pin: sd-card-led-pin {
192			rockchip,pins =
193			  <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
194		};
195	};
196};
197
198&pwm0 {
199	status = "okay";
200};
201
202&sdmmc {
203	sd-uhs-sdr12;
204	sd-uhs-sdr25;
205	sd-uhs-sdr50;
206	bus-width = <4>;
207	cap-mmc-highspeed;
208	cap-sd-highspeed;
209	cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>;
210	disable-wp;
211	vmmc-supply = <&vcc3v3_baseboard>;
212	status = "okay";
213};
214
215&spi1 {
216	status = "okay";
217};
218
219&u2phy_otg {
220	status = "okay";
221};
222
223&uart0 {
224	status = "okay";
225};
226
227&uart5 {
228	pinctrl-0 = <&uart5_xfer>;
229	status = "okay";
230};
231
232&usb20_otg {
233	status = "okay";
234};
235