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 = "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
44		dai-link-0 {
45			sound-dai = <&frddr_a>;
46		};
47
48		dai-link-1 {
49			sound-dai = <&frddr_b>;
50		};
51
52		dai-link-2 {
53			sound-dai = <&frddr_c>;
54		};
55
56		/* 8ch hdmi interface */
57		dai-link-3 {
58			sound-dai = <&tdmif_b>;
59			dai-format = "i2s";
60			dai-tdm-slot-tx-mask-0 = <1 1>;
61			dai-tdm-slot-tx-mask-1 = <1 1>;
62			dai-tdm-slot-tx-mask-2 = <1 1>;
63			dai-tdm-slot-tx-mask-3 = <1 1>;
64			mclk-fs = <256>;
65
66			codec {
67				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
68			};
69		};
70
71		/* spdif hdmi or toslink interface */
72		dai-link-4 {
73			sound-dai = <&spdifout>;
74
75			codec-0 {
76				sound-dai = <&spdif_dit>;
77			};
78
79			codec-1 {
80				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>;
81			};
82		};
83
84		/* spdif hdmi interface */
85		dai-link-5 {
86			sound-dai = <&spdifout_b>;
87
88			codec {
89				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>;
90			};
91		};
92
93		/* hdmi glue */
94		dai-link-6 {
95			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
96
97			codec {
98				sound-dai = <&hdmi_tx>;
99			};
100		};
101	};
102};
103
104&arb {
105	status = "okay";
106};
107
108&clkc_audio {
109	status = "okay";
110};
111
112&frddr_a {
113	status = "okay";
114};
115
116&frddr_b {
117	status = "okay";
118};
119
120&frddr_c {
121	status = "okay";
122};
123
124&ir {
125	linux,rc-map-name = "rc-khadas";
126};
127
128&spdifout {
129	pinctrl-0 = <&spdif_out_h_pins>;
130	pinctrl-names = "default";
131	status = "okay";
132};
133
134&spdifout_b {
135	status = "okay";
136};
137
138&tdmif_b {
139	status = "okay";
140};
141
142&tdmout_b {
143	status = "okay";
144};
145
146&tohdmitx {
147	status = "okay";
148};
149
150&uart_A {
151	status = "okay";
152	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
153	pinctrl-names = "default";
154	uart-has-rtscts;
155
156	bluetooth {
157		compatible = "brcm,bcm43438-bt";
158		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
159		max-speed = <2000000>;
160		clocks = <&wifi32k>;
161	clock-names = "lpo";
162	};
163};
164
165&uart_AO {
166	status = "okay";
167	pinctrl-0 = <&uart_ao_a_pins>;
168	pinctrl-names = "default";
169};
170
171&usb {
172	status = "okay";
173	dr_mode = "host";
174	vbus-supply = <&usb_pwr_en>;
175};
176
177&usb2_phy0 {
178	phy-supply = <&usb1_pow>;
179};
180
181&usb2_phy1 {
182	phy-supply = <&usb1_pow>;
183};
184