1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 BayLibre, SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
6 */
7
8/dts-v1/;
9
10#include "meson-g12b-w400.dtsi"
11#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13/ {
14	compatible = "ugoos,am6", "amlogic,s922x", "amlogic,g12b";
15	model = "Ugoos AM6";
16
17	spdif_dit: audio-codec-1 {
18		#sound-dai-cells = <0>;
19		compatible = "linux,spdif-dit";
20		status = "okay";
21		sound-name-prefix = "DIT";
22	};
23
24	sound {
25		compatible = "amlogic,axg-sound-card";
26		model = "G12B-UGOOS-AM6";
27		audio-aux-devs = <&tdmout_b>;
28		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
29				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
30				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
31				"TDM_B Playback", "TDMOUT_B OUT",
32				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
33				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
34				"SPDIFOUT IN 2", "FRDDR_C OUT 3";
35
36		assigned-clocks = <&clkc CLKID_MPLL2>,
37				  <&clkc CLKID_MPLL0>,
38				  <&clkc CLKID_MPLL1>;
39		assigned-clock-parents = <0>, <0>, <0>;
40		assigned-clock-rates = <294912000>,
41				       <270950400>,
42				       <393216000>;
43		status = "okay";
44
45		dai-link-0 {
46			sound-dai = <&frddr_a>;
47		};
48
49		dai-link-1 {
50			sound-dai = <&frddr_b>;
51		};
52
53		dai-link-2 {
54			sound-dai = <&frddr_c>;
55		};
56
57		/* 8ch hdmi interface */
58		dai-link-3 {
59			sound-dai = <&tdmif_b>;
60			dai-format = "i2s";
61			dai-tdm-slot-tx-mask-0 = <1 1>;
62			dai-tdm-slot-tx-mask-1 = <1 1>;
63			dai-tdm-slot-tx-mask-2 = <1 1>;
64			dai-tdm-slot-tx-mask-3 = <1 1>;
65			mclk-fs = <256>;
66
67			codec {
68				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
69			};
70		};
71
72		/* spdif hdmi or toslink interface */
73		dai-link-4 {
74			sound-dai = <&spdifout>;
75
76			codec-0 {
77				sound-dai = <&spdif_dit>;
78			};
79
80			codec-1 {
81				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>;
82			};
83		};
84
85		/* spdif hdmi interface */
86		dai-link-5 {
87			sound-dai = <&spdifout_b>;
88
89			codec {
90				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>;
91			};
92		};
93
94		/* hdmi glue */
95		dai-link-6 {
96			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
97
98			codec {
99				sound-dai = <&hdmi_tx>;
100			};
101		};
102	};
103};
104
105&arb {
106	status = "okay";
107};
108
109&clkc_audio {
110	status = "okay";
111};
112
113&frddr_a {
114	status = "okay";
115};
116
117&frddr_b {
118	status = "okay";
119};
120
121&frddr_c {
122	status = "okay";
123};
124
125&ir {
126	linux,rc-map-name = "rc-khadas";
127};
128
129&spdifout {
130	pinctrl-0 = <&spdif_out_h_pins>;
131	pinctrl-names = "default";
132	status = "okay";
133};
134
135&spdifout_b {
136	status = "okay";
137};
138
139&tdmif_b {
140	status = "okay";
141};
142
143&tdmout_b {
144	status = "okay";
145};
146
147&tohdmitx {
148	status = "okay";
149};
150
151&uart_A {
152	status = "okay";
153	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
154	pinctrl-names = "default";
155	uart-has-rtscts;
156
157	bluetooth {
158		compatible = "brcm,bcm43438-bt";
159		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
160		max-speed = <2000000>;
161		clocks = <&wifi32k>;
162	clock-names = "lpo";
163	};
164};
165
166&uart_AO {
167	status = "okay";
168	pinctrl-0 = <&uart_ao_a_pins>;
169	pinctrl-names = "default";
170};
171
172&usb {
173	status = "okay";
174	dr_mode = "host";
175	vbus-supply = <&usb_pwr_en>;
176};
177
178&usb2_phy0 {
179	phy-supply = <&usb1_pow>;
180};
181
182&usb2_phy1 {
183	phy-supply = <&usb1_pow>;
184};
185