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: dc-12v-regulator {
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: vcc3v3-baseboard-regulator {
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: vcc5v0-baseboard-regulator {
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: vdda-codec-regulator {
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: vddd-codec-regulator {
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	eeprom@50 {
158		reg = <0x50>;
159		compatible = "atmel,24c01";
160		pagesize = <8>;
161		size = <128>;
162		vcc-supply = <&vcc3v3_baseboard>;
163	};
164};
165
166&i2s0_8ch {
167	status = "okay";
168};
169
170&gmac {
171	status = "okay";
172};
173
174&pinctrl {
175	haikou {
176		haikou_keys_pin: haikou-keys-pin {
177			rockchip,pins =
178			  /* WAKE# */
179			  <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
180			  /* SLP_BTN# */
181			  <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
182			  /* LID_BTN */
183			  <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
184			  /* BATLOW# */
185			  <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
186			  /* BIOS_DISABLE# */
187			  <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>;
188		};
189	};
190
191	leds {
192		sd_card_led_pin: sd-card-led-pin {
193			rockchip,pins =
194			  <3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
195		};
196	};
197};
198
199&pwm0 {
200	status = "okay";
201};
202
203&sdmmc {
204	sd-uhs-sdr12;
205	sd-uhs-sdr25;
206	sd-uhs-sdr50;
207	bus-width = <4>;
208	cap-mmc-highspeed;
209	cap-sd-highspeed;
210	cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>;
211	disable-wp;
212	vmmc-supply = <&vcc3v3_baseboard>;
213	status = "okay";
214};
215
216&spi1 {
217	status = "okay";
218};
219
220&u2phy_otg {
221	status = "okay";
222};
223
224&uart0 {
225	status = "okay";
226};
227
228&uart5 {
229	pinctrl-0 = <&uart5_xfer>;
230	rts-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
231	status = "okay";
232};
233
234&usb20_otg {
235	status = "okay";
236};
237