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