1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) 2024 Arm Ltd.
4 */
5
6/dts-v1/;
7
8#include "sun50i-h616.dtsi"
9#include "sun50i-h616-cpu-opp.dtsi"
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include <dt-bindings/input/linux-event-codes.h>
14#include <dt-bindings/leds/common.h>
15
16/ {
17	model = "Tanix TX1";
18	compatible = "oranth,tanix-tx1", "allwinner,sun50i-h616";
19
20	aliases {
21		serial0 = &uart0;
22		ethernet0 = &sdio_wifi;
23	};
24
25	chosen {
26		stdout-path = "serial0:115200n8";
27	};
28
29	gpio-keys {
30		compatible = "gpio-keys";
31
32		key {
33			label = "hidden";
34			linux,code = <BTN_0>;
35			gpios = <&pio 7 9 GPIO_ACTIVE_LOW>; /* PH9 */
36		};
37	};
38
39	leds {
40		compatible = "gpio-leds";
41
42		led-0 {
43			function = LED_FUNCTION_POWER;
44			color = <LED_COLOR_ID_BLUE>;
45			gpios = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
46			default-state = "on";
47		};
48	};
49
50	wifi_pwrseq: pwrseq {
51		compatible = "mmc-pwrseq-simple";
52		clocks = <&rtc CLK_OSC32K_FANOUT>;
53		clock-names = "ext_clock";
54		pinctrl-0 = <&x32clk_fanout_pin>;
55		pinctrl-names = "default";
56		reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>; /* PG18 */
57	};
58
59	reg_vcc5v: vcc5v {
60		/* board wide 5V supply directly from the DC input */
61		compatible = "regulator-fixed";
62		regulator-name = "vcc-5v";
63		regulator-min-microvolt = <5000000>;
64		regulator-max-microvolt = <5000000>;
65		regulator-always-on;
66	};
67};
68
69&codec {
70	allwinner,audio-routing = "Line Out", "LINEOUT";
71	status = "okay";
72};
73
74&cpu0 {
75	cpu-supply = <&reg_dcdc2>;
76};
77
78&ehci0 {
79	status = "okay";
80};
81
82&ir {
83	status = "okay";
84};
85
86&mmc1 {
87	vmmc-supply = <&reg_dldo1>;
88	vqmmc-supply = <&reg_aldo1>;
89	mmc-pwrseq = <&wifi_pwrseq>;
90	bus-width = <4>;
91	non-removable;
92	status = "okay";
93
94	sdio_wifi: wifi@1 {
95		reg = <1>;
96	};
97};
98
99&mmc2 {
100	vmmc-supply = <&reg_dldo1>;
101	vqmmc-supply = <&reg_aldo1>;
102	bus-width = <8>;
103	non-removable;
104	max-frequency = <100000000>;
105	cap-mmc-hw-reset;
106	mmc-ddr-1_8v;
107	status = "okay";
108};
109
110&ohci0 {
111	status = "okay";
112};
113
114&pio {
115	vcc-pc-supply = <&reg_aldo1>;
116	vcc-pf-supply = <&reg_dldo1>;
117	vcc-pg-supply = <&reg_aldo1>;
118	vcc-ph-supply = <&reg_dldo1>;
119	vcc-pi-supply = <&reg_dldo1>;
120};
121
122&r_i2c {
123	status = "okay";
124
125	axp313: pmic@36 {
126		compatible = "x-powers,axp313a";
127		reg = <0x36>;
128		#interrupt-cells = <1>;
129		interrupt-controller;
130
131		vin1-supply = <&reg_vcc5v>;
132		vin2-supply = <&reg_vcc5v>;
133		vin3-supply = <&reg_vcc5v>;
134
135		regulators {
136			/* Supplies VCC-PLL, so needs to be always on. */
137			reg_aldo1: aldo1 {
138				regulator-always-on;
139				regulator-min-microvolt = <1800000>;
140				regulator-max-microvolt = <1800000>;
141				regulator-name = "vcc1v8";
142			};
143
144			/* Supplies VCC-IO, so needs to be always on. */
145			reg_dldo1: dldo1 {
146				regulator-always-on;
147				regulator-min-microvolt = <3300000>;
148				regulator-max-microvolt = <3300000>;
149				regulator-name = "vcc3v3";
150			};
151
152			reg_dcdc1: dcdc1 {
153				regulator-always-on;
154				regulator-min-microvolt = <810000>;
155				regulator-max-microvolt = <990000>;
156				regulator-name = "vdd-gpu-sys";
157			};
158
159			reg_dcdc2: dcdc2 {
160				regulator-always-on;
161				regulator-min-microvolt = <810000>;
162				regulator-max-microvolt = <1120000>;
163				regulator-name = "vdd-cpu";
164			};
165
166			reg_dcdc3: dcdc3 {
167				regulator-always-on;
168				regulator-min-microvolt = <1200000>;
169				regulator-max-microvolt = <1200000>;
170				regulator-name = "vdd-dram";
171			};
172		};
173	};
174};
175
176&uart0 {
177	pinctrl-names = "default";
178	pinctrl-0 = <&uart0_ph_pins>;
179	status = "okay";
180};
181
182&usbotg {
183	dr_mode = "host";       /* USB A type receptable */
184	status = "okay";
185};
186
187&usbphy {
188	status = "okay";
189};
190