// SPDX-License-Identifier: (GPL-2.0+ or MIT)
// Copyright (C) 2022 Jisheng Zhang <jszhang@kernel.org>
// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>

#include <dt-bindings/input/input.h>

#include "sun20i-d1-lichee-rv.dts"

/ {
	model = "Sipeed Lichee RV Dock";
	compatible = "sipeed,lichee-rv-dock", "sipeed,lichee-rv",
		     "allwinner,sun20i-d1";

	aliases {
		ethernet1 = &rtl8723ds;
	};

	dmic_codec: dmic-codec {
		compatible = "dmic-codec";
		num-channels = <2>;
		#sound-dai-cells = <0>;
	};

	dmic-sound {
		compatible = "simple-audio-card";
		simple-audio-card,name = "DMIC";
		#address-cells = <1>;
		#size-cells = <0>;

		simple-audio-card,dai-link@0 {
			reg = <0>;
			format = "pdm";
			frame-master = <&link0_cpu>;
			bitclock-master = <&link0_cpu>;

			link0_cpu: cpu {
				sound-dai = <&dmic>;
			};

			link0_codec: codec {
				sound-dai = <&dmic_codec>;
			};
		};
	};

	wifi_pwrseq: wifi-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
	};
};

&dmic {
	pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>;
	pinctrl-names = "default";
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&mmc1 {
	bus-width = <4>;
	mmc-pwrseq = <&wifi_pwrseq>;
	non-removable;
	vmmc-supply = <&reg_vcc_3v3>;
	vqmmc-supply = <&reg_vcc_3v3>;
	pinctrl-0 = <&mmc1_pins>;
	pinctrl-names = "default";
	status = "okay";

	rtl8723ds: wifi@1 {
		reg = <1>;
	};
};

&ohci1 {
	status = "okay";
};

&uart1 {
	uart-has-rtscts;
	pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
	pinctrl-names = "default";
	status = "okay";

	bluetooth {
		compatible = "realtek,rtl8723ds-bt";
		device-wake-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG16 */
		enable-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */
		host-wake-gpios = <&pio 6 17 GPIO_ACTIVE_HIGH>; /* PG17 */
	};
};

&usbphy {
	usb1_vbus-supply = <&reg_vcc>;
};