code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre, SAS
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
 */

#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/gpio/meson-g12a-gpio.h>
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	aliases {
		serial0 = &uart_AO;
		ethernet0 = &ethmac;
		rtc0 = &rtc;
		rtc1 = &vrtc;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x80000000>;
	};

	adc-keys {
		compatible = "adc-keys";
		io-channels = <&saradc 2>;
		io-channel-names = "buttons";
		keyup-threshold-microvolt = <1710000>;

		button-function {
			label = "Function";
			linux,code = <KEY_FN>;
			press-threshold-microvolt = <10000>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led-white {
			color = <LED_COLOR_ID_WHITE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};

		led-red {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
		};
	};

	emmc_pwrseq: emmc-pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
	};

	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		poll-interval = <100>;

		power-button {
			label = "power";
			linux,code = <KEY_POWER>;
			gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
		};
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
		clocks = <&wifi32k>;
		clock-names = "ext_clock";
	};

	dc_in: regulator-dc_in {
		compatible = "regulator-fixed";
		regulator-name = "DC_IN";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
	};

	vcc_5v: regulator-vcc_5v {
		compatible = "regulator-fixed";
		regulator-name = "VCC_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&dc_in>;

		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
		enable-active-high;
	};

	vcc_1v8: regulator-vcc_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_3v3>;
		regulator-always-on;
	};

	vcc_3v3: regulator-vcc_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vsys_3v3>;
		regulator-always-on;
		/* FIXME: actually controlled by VDDCPU_B_EN */
	};

	vddao_1v8: regulator-vddao_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vsys_3v3>;
		regulator-always-on;
	};

	emmc_1v8: regulator-emmc_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "EMMC_AO1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_3v3>;
		regulator-always-on;
	};

	vsys_3v3: regulator-vsys_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VSYS_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&dc_in>;
		regulator-always-on;
	};

	usb_pwr: regulator-usb_pwr {
		compatible = "regulator-fixed";
		regulator-name = "USB_PWR";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc_5v>;

		gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	hdmi-connector {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_connector_in: endpoint {
				remote-endpoint = <&hdmi_tx_tmds_out>;
			};
		};
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "KHADAS-VIM3";
		audio-aux-devs = <&tdmin_a>, <&tdmout_a>;
		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
				"TDMOUT_A IN 1", "FRDDR_B OUT 0",
				"TDMOUT_A IN 2", "FRDDR_C OUT 0",
				"TDM_A Playback", "TDMOUT_A OUT",
				"TDMIN_A IN 0", "TDM_A Capture",
				"TDMIN_A IN 3", "TDM_A Loopback",
				"TODDR_A IN 0", "TDMIN_A OUT",
				"TODDR_B IN 0", "TDMIN_A OUT",
				"TODDR_C IN 0", "TDMIN_A OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		dai-link-3 {
			sound-dai = <&toddr_a>;
		};

		dai-link-4 {
			sound-dai = <&toddr_b>;
		};

		dai-link-5 {
			sound-dai = <&toddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-6 {
			sound-dai = <&tdmif_a>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
			};
		};

		/* hdmi glue */
		dai-link-7 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};

	wifi32k: wifi32k {
		compatible = "pwm-clock";
		#clock-cells = <0>;
		clock-frequency = <32768>;
		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
	};
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&cec_AO {
	pinctrl-0 = <&cec_ao_a_h_pins>;
	pinctrl-names = "default";
	status = "disabled";
	hdmi-phandle = <&hdmi_tx>;
};

&cecb_AO {
	pinctrl-0 = <&cec_ao_b_h_pins>;
	pinctrl-names = "default";
	status = "okay";
	hdmi-phandle = <&hdmi_tx>;
};

&cpu_thermal {
	trips {
		cpu_active: cpu-active {
			temperature = <80000>; /* millicelsius */
			hysteresis = <2000>; /* millicelsius */
			type = "active";
		};
	};

	cooling-maps {
		map {
			trip = <&cpu_active>;
			cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};

&ext_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
		max-speed = <1000>;

		interrupt-parent = <&gpio_intc>;
		/* MAC_INTR on GPIOZ_14 */
		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
	};
};

&ethmac {
	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
	pinctrl-names = "default";
	status = "okay";
	phy-mode = "rgmii";
	phy-handle = <&external_phy>;
	amlogic,tx-delay-ns = <2>;
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
	pinctrl-names = "default";
	hdmi-supply = <&vcc_5v>;
};

&hdmi_tx_tmds_port {
	hdmi_tx_tmds_out: endpoint {
		remote-endpoint = <&hdmi_connector_in>;
	};
};

&i2c_AO {
	status = "okay";
	pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
	pinctrl-names = "default";

	khadas_mcu: system-controller@18 {
		compatible = "khadas,mcu";
		reg = <0x18>;
		#cooling-cells = <2>;
	};

	gpio_expander: gpio-controller@20 {
		compatible = "ti,tca6408";
		reg = <0x20>;
		vcc-supply = <&vcc_3v3>;
		gpio-controller;
		#gpio-cells = <2>;
	};

	rtc: rtc@51 {
		compatible = "haoyu,hym8563";
		reg = <0x51>;
		#clock-cells = <0>;
	};
};

&ir {
	status = "okay";
	pinctrl-0 = <&remote_input_ao_pins>;
	pinctrl-names = "default";
	linux,rc-map-name = "rc-khadas";
};

&pcie {
	reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
};

&pwm_ef {
	status = "okay";
	pinctrl-0 = <&pwm_e_pins>;
	pinctrl-names = "default";
};

&saradc {
	status = "okay";
	vref-supply = <&vddao_1v8>;
};

/* SDIO */
&sd_emmc_a {
	status = "okay";
	pinctrl-0 = <&sdio_pins>;
	pinctrl-1 = <&sdio_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";
	#address-cells = <1>;
	#size-cells = <0>;

	bus-width = <4>;
	cap-sd-highspeed;
	max-frequency = <100000000>;

	non-removable;
	disable-wp;

	/* WiFi firmware requires power to be kept while in suspend */
	keep-power-in-suspend;

	mmc-pwrseq = <&sdio_pwrseq>;

	vmmc-supply = <&vsys_3v3>;
	vqmmc-supply = <&vddao_1v8>;

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

/* SD card */
&sd_emmc_b {
	status = "okay";
	pinctrl-0 = <&sdcard_c_pins>;
	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <4>;
	cap-sd-highspeed;
	max-frequency = <50000000>;
	disable-wp;

	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
	vmmc-supply = <&vsys_3v3>;
	vqmmc-supply = <&vsys_3v3>;
};

/* eMMC */
&sd_emmc_c {
	status = "okay";
	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
	pinctrl-1 = <&emmc_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <8>;
	cap-mmc-highspeed;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	max-frequency = <200000000>;
	disable-wp;

	mmc-pwrseq = <&emmc_pwrseq>;
	vmmc-supply = <&vcc_3v3>;
	vqmmc-supply = <&emmc_1v8>;
};

/*
 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
 * and eMMC Data 4 to 7 pins.
 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
 * and change bus-width to 4 then spifc can be enabled.
 */
&spifc {
	status = "disabled";
	pinctrl-0 = <&nor_pins>;
	pinctrl-names = "default";

	w25q128: flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "winbond,w25q128fw", "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <104000000>;
	};
};

&tdmif_a {
	status = "okay";
};

&tdmin_a {
	status = "okay";
};

&tdmout_a {
	status = "okay";
};

&toddr_a {
	status = "okay";
};

&toddr_b {
	status = "okay";
};

&toddr_c {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};

&uart_A {
	status = "okay";
	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
	pinctrl-names = "default";
	uart-has-rtscts;

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
		max-speed = <2000000>;
		clocks = <&wifi32k>;
		clock-names = "lpo";
	};
};

&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

&usb2_phy0 {
	phy-supply = <&dc_in>;
};

&usb2_phy1 {
	phy-supply = <&usb_pwr>;
};

&usb3_pcie_phy {
	phy-supply = <&usb_pwr>;
};

&usb {
	status = "okay";
	dr_mode = "peripheral";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
 */

/dts-v1/;

#include "meson-s4.dtsi"

/ {
	model = "Amlogic Meson S4 AQ222 Development Board";
	compatible = "amlogic,aq222", "amlogic,s4";
	interrupt-parent = <&gic>;
	#address-cells = <2>;
	#size-cells = <2>;

	aliases {
		serial0 = &uart_B;
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

};

&uart_B {
	status = "okay";
};

repo_name: angery/linux


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
 */

#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	cpus {
		#address-cells = <2>;
		#size-cells = <0>;

		cpu0: cpu@0 {
			device_type = "cpu";
			compatible = "arm,cortex-a35";
			reg = <0x0 0x0>;
			enable-method = "psci";
		};

		cpu1: cpu@1 {
			device_type = "cpu";
			compatible = "arm,cortex-a35";
			reg = <0x0 0x1>;
			enable-method = "psci";
		};

		cpu2: cpu@2 {
			device_type = "cpu";
			compatible = "arm,cortex-a35";
			reg = <0x0 0x2>;
			enable-method = "psci";
		};

		cpu3: cpu@3 {
			device_type = "cpu";
			compatible = "arm,cortex-a35";
			reg = <0x0 0x3>;
			enable-method = "psci";
		};
	};

	timer {
		compatible = "arm,armv8-timer";
		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
	};

	psci {
		compatible = "arm,psci-1.0";
		method = "smc";
	};

	xtal: xtal-clk {
		compatible = "fixed-clock";
		clock-frequency = <24000000>;
		clock-output-names = "xtal";
		#clock-cells = <0>;
	};

	pwrc: power-controller {
		compatible = "amlogic,meson-s4-pwrc";
		#power-domain-cells = <1>;
		status = "okay";
	};

	soc {
		compatible = "simple-bus";
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		gic: interrupt-controller@fff01000 {
			compatible = "arm,gic-400";
			#interrupt-cells = <3>;
			#address-cells = <0>;
			interrupt-controller;
			reg = <0x0 0xfff01000 0 0x1000>,
			      <0x0 0xfff02000 0 0x2000>,
			      <0x0 0xfff04000 0 0x2000>,
			      <0x0 0xfff06000 0 0x2000>;
			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
		};

		apb4: apb4@fe000000 {
			compatible = "simple-bus";
			reg = <0x0 0xfe000000 0x0 0x480000>;
			#address-cells = <2>;
			#size-cells = <2>;
			ranges = <0x0 0x0 0x0 0xfe000000 0x0 0x480000>;

			periphs_pinctrl: pinctrl@4000 {
				compatible = "amlogic,meson-s4-periphs-pinctrl";
				#address-cells = <2>;
				#size-cells = <2>;
				ranges;

				gpio: bank@4000 {
					reg = <0x0 0x4000 0x0 0x004c>,
					      <0x0 0x40c0 0x0 0x0220>;
					reg-names = "mux", "gpio";
					gpio-controller;
					#gpio-cells = <2>;
					gpio-ranges = <&periphs_pinctrl 0 0 82>;
				};
			};

			gpio_intc: interrupt-controller@4080 {
				compatible = "amlogic,meson-s4-gpio-intc",
					     "amlogic,meson-gpio-intc";
				reg = <0x0 0x4080 0x0 0x20>;
				interrupt-controller;
				#interrupt-cells = <2>;
				amlogic,channel-interrupts =
					<10 11 12 13 14 15 16 17 18 19 20 21>;
			};

			uart_B: serial@7a000 {
				compatible = "amlogic,meson-s4-uart",
					     "amlogic,meson-ao-uart";
				reg = <0x0 0x7a000 0x0 0x18>;
				interrupts = <GIC_SPI 169 IRQ_TYPE_EDGE_RISING>;
				status = "disabled";
				clocks = <&xtal>, <&xtal>, <&xtal>;
				clock-names = "xtal", "pclk", "baud";
			};

			reset: reset-controller@2000 {
				compatible = "amlogic,meson-s4-reset";
				reg = <0x0 0x2000 0x0 0x98>;
				#reset-cells = <1>;
			};
		};
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 * Copyright (c) 2020 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-ac2xx.dtsi"
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "cyx,a95xf3-air-gbit", "amlogic,sm1";
	model = "Shenzhen CYX Industrial Co., Ltd A95XF3-AIR";

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "A95XF3-AIR";
		audio-aux-devs = <&tdmout_b>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* hdmi glue */
		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&ethmac {
	status = "okay";

	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
	pinctrl-names = "default";
	phy-mode = "rgmii-txid";
	phy-handle = <&external_phy>;

	rx-internal-delay-ps = <800>;
};

&ext_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
		max-speed = <1000>;

		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;

		interrupt-parent = <&gpio_intc>;
		/* MAC_INTR on GPIOZ_14 */
		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
	};
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 * Copyright (c) 2020 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-ac2xx.dtsi"
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "cyx,a95xf3-air", "amlogic,sm1";
	model = "Shenzhen CYX Industrial Co., Ltd A95XF3-AIR";

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "A95XF3-AIR";
		audio-aux-devs = <&tdmout_b>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* hdmi glue */
		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&ethmac {
	status = "okay";
	phy-handle = <&internal_ephy>;
	phy-mode = "rmii";
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 * Copyright (c) 2020 Christian Hewitt <christianshewitt@gmail.com>
 *
 * AC200/AC202 = S905D3
 * AC213/AC214 = S905X3
 *
 */

#include "meson-sm1.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/meson-g12a-gpio.h>
#include <dt-bindings/input/input.h>

/ {
	aliases {
		serial0 = &uart_AO;
		ethernet0 = &ethmac;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	emmc_pwrseq: emmc-pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
	};

	cvbs-connector {
		compatible = "composite-video-connector";

		port {
			cvbs_connector_in: endpoint {
				remote-endpoint = <&cvbs_vdac_out>;
			};
		};
	};

	hdmi-connector {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_connector_in: endpoint {
				remote-endpoint = <&hdmi_tx_tmds_out>;
			};
		};
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

	ao_5v: regulator-ao_5v {
		compatible = "regulator-fixed";
		regulator-name = "AO_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&dc_in>;
		regulator-always-on;
	};

	dc_in: regulator-dc_in {
		compatible = "regulator-fixed";
		regulator-name = "DC_IN";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
	};

	emmc_1v8: regulator-emmc_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "EMMC_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	vddao_3v3: regulator-vddao_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&dc_in>;
		regulator-always-on;
	};

	vddcpu: regulator-vddcpu {
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU";
		regulator-min-microvolt = <690000>;
		regulator-max-microvolt = <1050000>;

		vin-supply = <&dc_in>;

		pwms = <&pwm_AO_cd 1 1500 0>;
		pwm-dutycycle-range = <100 0>;

		regulator-boot-on;
		regulator-always-on;
	};

	vddio_ao1v8: regulator-vddio_ao1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
		clocks = <&wifi32k>;
		clock-names = "ext_clock";
	};

	wifi32k: wifi32k {
		compatible = "pwm-clock";
		#clock-cells = <0>;
		clock-frequency = <32768>;
		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
	};
};

&cec_AO {
	pinctrl-0 = <&cec_ao_a_h_pins>;
	pinctrl-names = "default";
	status = "disabled";
	hdmi-phandle = <&hdmi_tx>;
};

&cecb_AO {
	pinctrl-0 = <&cec_ao_b_h_pins>;
	pinctrl-names = "default";
	status = "okay";
	hdmi-phandle = <&hdmi_tx>;
};

&cpu0 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU1_CLK>;
	clock-latency = <50000>;
};

&cpu2 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU2_CLK>;
	clock-latency = <50000>;
};

&cpu3 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU3_CLK>;
	clock-latency = <50000>;
};

&cvbs_vdac_port {
	cvbs_vdac_out: endpoint {
		remote-endpoint = <&cvbs_connector_in>;
	};
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
	pinctrl-names = "default";
};

&hdmi_tx_tmds_port {
	hdmi_tx_tmds_out: endpoint {
		remote-endpoint = <&hdmi_connector_in>;
	};
};

&ir {
	status = "okay";
	pinctrl-0 = <&remote_input_ao_pins>;
	pinctrl-names = "default";
};

&pwm_AO_ab {
	status = "okay";
	pinctrl-0 = <&pwm_ao_a_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin0";
};

&pwm_AO_cd {
	pinctrl-0 = <&pwm_ao_d_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin1";
	status = "okay";
};

&pwm_ef {
	status = "okay";
	pinctrl-0 = <&pwm_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin0";
};

&saradc {
	status = "okay";
	vref-supply = <&vddio_ao1v8>;
};

/* SDIO */
&sd_emmc_a {
	status = "okay";
	pinctrl-0 = <&sdio_pins>;
	pinctrl-1 = <&sdio_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";
	#address-cells = <1>;
	#size-cells = <0>;

	bus-width = <4>;
	cap-sd-highspeed;
	sd-uhs-sdr104;
	max-frequency = <200000000>;

	non-removable;
	disable-wp;

	/* WiFi firmware requires power to be kept while in suspend */
	keep-power-in-suspend;

	mmc-pwrseq = <&sdio_pwrseq>;

	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&vddio_ao1v8>;
};

/* SD Card */
&sd_emmc_b {
	status = "okay";
	pinctrl-0 = <&sdcard_c_pins>;
	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <4>;
	cap-sd-highspeed;
	/* CRC errors are observed at 50MHz */
	max-frequency = <35000000>;
	disable-wp;

	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&vddao_3v3>;
};

/* eMMC */
&sd_emmc_c {
	status = "okay";
	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
	pinctrl-1 = <&emmc_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <8>;
	cap-mmc-highspeed;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	max-frequency = <200000000>;
	non-removable;
	disable-wp;

	mmc-pwrseq = <&emmc_pwrseq>;
	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&emmc_1v8>;
};

&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

&usb {
	status = "okay";
	dr_mode = "otg";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2021 BayLibre SAS
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 */

/dts-v1/;

#include "meson-sm1.dtsi"
#include <dt-bindings/leds/common.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/gpio/meson-g12a-gpio.h>
#include <dt-bindings/sound/meson-g12a-toacodec.h>
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "bananapi,bpi-m5", "amlogic,sm1";
	model = "Banana Pi BPI-M5";

	adc_keys {
		compatible = "adc-keys";
		io-channels = <&saradc 2>;
		io-channel-names = "buttons";
		keyup-threshold-microvolt = <1800000>;

		key {
			label = "SW3";
			linux,code = <BTN_3>;
			press-threshold-microvolt = <1700000>;
		};
	};

	aliases {
		serial0 = &uart_AO;
		ethernet0 = &ethmac;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	/* TOFIX: handle CVBS_DET on SARADC channel 0 */
	cvbs-connector {
		compatible = "composite-video-connector";

		port {
			cvbs_connector_in: endpoint {
				remote-endpoint = <&cvbs_vdac_out>;
			};
		};
	};

	emmc_pwrseq: emmc-pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
	};

	gpio-keys {
		compatible = "gpio-keys";

		key {
			label = "SW1";
			linux,code = <BTN_1>;
			gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&gpio_intc>;
			interrupts = <3 IRQ_TYPE_EDGE_BOTH>;
		};
	};

	hdmi-connector {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_connector_in: endpoint {
				remote-endpoint = <&hdmi_tx_tmds_out>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		green {
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
		};

		blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "heartbeat";
		};
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

	emmc_1v8: regulator-emmc_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "EMMC_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	dc_in: regulator-dc_in {
		compatible = "regulator-fixed";
		regulator-name = "DC_IN";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
	};

	vddio_c: regulator-vddio_c {
		compatible = "regulator-gpio";
		regulator-name = "VDDIO_C";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;

		enable-gpio = <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-always-on;

		gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_DRAIN>;
		gpios-states = <1>;

		states = <1800000 0>,
			 <3300000 1>;
	};

	tflash_vdd: regulator-tflash_vdd {
		compatible = "regulator-fixed";
		regulator-name = "TFLASH_VDD";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&dc_in>;
		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
		enable-active-high;
		regulator-always-on;
	};

	vddao_1v8: regulator-vddao_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	vddao_3v3: regulator-vddao_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&dc_in>;
		regulator-always-on;
	};

	vddcpu: regulator-vddcpu {
		/*
		 * SY8120B1ABC DC/DC Regulator.
		 */
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU";
		regulator-min-microvolt = <690000>;
		regulator-max-microvolt = <1050000>;

		pwm-supply = <&dc_in>;

		pwms = <&pwm_AO_cd 1 1250 0>;
		pwm-dutycycle-range = <100 0>;

		regulator-boot-on;
		regulator-always-on;
	};

	/* USB Hub Power Enable */
	vl_pwr_en: regulator-vl_pwr_en {
		compatible = "regulator-fixed";
		regulator-name = "VL_PWR_EN";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&dc_in>;

		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "BPI-M5";
		audio-widgets = "Line", "Lineout";
		audio-aux-devs = <&tdmout_b>, <&tdmout_c>,
				 <&tdmin_a>, <&tdmin_b>, <&tdmin_c>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT",
				"TDMOUT_C IN 0", "FRDDR_A OUT 2",
				"TDMOUT_C IN 1", "FRDDR_B OUT 2",
				"TDMOUT_C IN 2", "FRDDR_C OUT 2",
				"TDM_C Playback", "TDMOUT_C OUT",
				"TDMIN_A IN 4", "TDM_B Loopback",
				"TDMIN_B IN 4", "TDM_B Loopback",
				"TDMIN_C IN 4", "TDM_B Loopback",
				"TDMIN_A IN 5", "TDM_C Loopback",
				"TDMIN_B IN 5", "TDM_C Loopback",
				"TDMIN_C IN 5", "TDM_C Loopback",
				"TODDR_A IN 0", "TDMIN_A OUT",
				"TODDR_B IN 0", "TDMIN_A OUT",
				"TODDR_C IN 0", "TDMIN_A OUT",
				"TODDR_A IN 1", "TDMIN_B OUT",
				"TODDR_B IN 1", "TDMIN_B OUT",
				"TODDR_C IN 1", "TDMIN_B OUT",
				"TODDR_A IN 2", "TDMIN_C OUT",
				"TODDR_B IN 2", "TDMIN_C OUT",
				"TODDR_C IN 2", "TDMIN_C OUT",
				"Lineout", "ACODEC LOLP",
				"Lineout", "ACODEC LORP";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		dai-link-3 {
			sound-dai = <&toddr_a>;
		};

		dai-link-4 {
			sound-dai = <&toddr_b>;
		};

		dai-link-5 {
			sound-dai = <&toddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-6 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec-0 {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};

			codec-1 {
				sound-dai = <&toacodec TOACODEC_IN_B>;
			};
		};

		/* i2s jack output interface */
		dai-link-7 {
			sound-dai = <&tdmif_c>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			mclk-fs = <256>;

			codec-0 {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
			};

			codec-1 {
				sound-dai = <&toacodec TOACODEC_IN_C>;
			};
		};

		/* hdmi glue */
		dai-link-8 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};

		/* acodec glue */
		dai-link-9 {
			sound-dai = <&toacodec TOACODEC_OUT>;

			codec {
				sound-dai = <&acodec>;
			};
		};
	};
};

&acodec {
	AVDD-supply = <&vddao_1v8>;
	status = "okay";
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&cpu0 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU1_CLK>;
	clock-latency = <50000>;
};

&cpu2 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU2_CLK>;
	clock-latency = <50000>;
};

&cpu3 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU3_CLK>;
	clock-latency = <50000>;
};

&cvbs_vdac_port {
	cvbs_vdac_out: endpoint {
		remote-endpoint = <&cvbs_connector_in>;
	};
};

&ext_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
		max-speed = <1000>;

		interrupt-parent = <&gpio_intc>;
		/* MAC_INTR on GPIOZ_14 */
		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
	};
};

&ethmac {
	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
	pinctrl-names = "default";
	status = "okay";
	phy-mode = "rgmii-txid";
	phy-handle = <&external_phy>;
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&gpio {
	gpio-line-names =
		/* GPIOZ */
		"ETH_MDIO", /* GPIOZ_0 */
		"ETH_MDC", /* GPIOZ_1 */
		"ETH_RXCLK", /* GPIOZ_2 */
		"ETH_RX_DV", /* GPIOZ_3 */
		"ETH_RXD0", /* GPIOZ_4 */
		"ETH_RXD1", /* GPIOZ_5 */
		"ETH_RXD2", /* GPIOZ_6 */
		"ETH_RXD3", /* GPIOZ_7 */
		"ETH_TXCLK", /* GPIOZ_8 */
		"ETH_TXEN", /* GPIOZ_9 */
		"ETH_TXD0", /* GPIOZ_10 */
		"ETH_TXD1", /* GPIOZ_11 */
		"ETH_TXD2", /* GPIOZ_12 */
		"ETH_TXD3", /* GPIOZ_13 */
		"ETH_INTR", /* GPIOZ_14 */
		"ETH_NRST", /* GPIOZ_15 */
		/* GPIOH */
		"HDMI_SDA", /* GPIOH_0 */
		"HDMI_SCL", /* GPIOH_1 */
		"HDMI_HPD", /* GPIOH_2 */
		"HDMI_CEC", /* GPIOH_3 */
		"VL-RST_N", /* GPIOH_4 */
		"CON1-P36", /* GPIOH_5 */
		"VL-PWREN", /* GPIOH_6 */
		"WiFi_3V3_1V8", /* GPIOH_7 */
		"TFLASH_VDD_EN", /* GPIOH_8 */
		/* BOOT */
		"eMMC_D0", /* BOOT_0 */
		"eMMC_D1", /* BOOT_1 */
		"eMMC_D2", /* BOOT_2 */
		"eMMC_D3", /* BOOT_3 */
		"eMMC_D4", /* BOOT_4 */
		"eMMC_D5", /* BOOT_5 */
		"eMMC_D6", /* BOOT_6 */
		"eMMC_D7", /* BOOT_7 */
		"eMMC_CLK", /* BOOT_8 */
		"",
		"eMMC_CMD", /* BOOT_10 */
		"",
		"eMMC_RST#", /* BOOT_12 */
		"eMMC_DS", /* BOOT_13 */
		"", "",
		/* GPIOC */
		"SD_D0_B", /* GPIOC_0 */
		"SD_D1_B", /* GPIOC_1 */
		"SD_D2_B", /* GPIOC_2 */
		"SD_D3_B", /* GPIOC_3 */
		"SD_CLK_B", /* GPIOC_4 */
		"SD_CMD_B", /* GPIOC_5 */
		"CARD_EN_DET", /* GPIOC_6 */
		"",
		/* GPIOA */
		"", "", "", "", "", "", "", "",
		"", "", "", "", "", "",
		"CON1-P27", /* GPIOA_14 */
		"CON1-P28", /* GPIOA_15 */
		/* GPIOX */
		"CON1-P16", /* GPIOX_0 */
		"CON1-P18", /* GPIOX_1 */
		"CON1-P22", /* GPIOX_2 */
		"CON1-P11", /* GPIOX_3 */
		"CON1-P13", /* GPIOX_4 */
		"CON1-P07", /* GPIOX_5 */
		"CON1-P33", /* GPIOX_6 */
		"CON1-P15", /* GPIOX_7 */
		"CON1-P19", /* GPIOX_8 */
		"CON1-P21", /* GPIOX_9 */
		"CON1-P24", /* GPIOX_10 */
		"CON1-P23", /* GPIOX_11 */
		"CON1-P08", /* GPIOX_12 */
		"CON1-P10", /* GPIOX_13 */
		"CON1-P29", /* GPIOX_14 */
		"CON1-P31", /* GPIOX_15 */
		"CON1-P26", /* GPIOX_16 */
		"CON1-P03", /* GPIOX_17 */
		"CON1-P05", /* GPIOX_18 */
		"CON1-P32"; /* GPIOX_19 */

	/*
	 * WARNING: The USB Hub on the BPI-M5 needs a reset signal
	 * to be turned high in order to be detected by the USB Controller
	 * This signal should be handled by a USB specific power sequence
	 * in order to reset the Hub when USB bus is powered down.
	 */
	usb-hub {
		gpio-hog;
		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
		output-high;
		line-name = "usb-hub-reset";
	};
};

&gpio_ao {
	gpio-line-names =
		/* GPIOAO */
		"DEBUG TX", /* GPIOAO_0 */
		"DEBUG RX", /* GPIOAO_1 */
		"SYS_LED2", /* GPIOAO_2 */
		"UPDATE_KEY", /* GPIOAO_3 */
		"CON1-P40", /* GPIOAO_4 */
		"IR_IN", /* GPIOAO_5 */
		"TF_3V3N_1V8_EN", /* GPIOAO_6 */
		"CON1-P35", /* GPIOAO_7 */
		"CON1-P12", /* GPIOAO_8 */
		"CON1-P37", /* GPIOAO_9 */
		"CON1-P38", /* GPIOAO_10 */
		"SYS_LED", /* GPIOAO_11 */
		/* GPIOE */
		"VDDEE_PWM", /* GPIOE_0 */
		"VDDCPU_PWM", /* GPIOE_1 */
		"TF_PWR_EN"; /* GPIOE_2 */
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
	pinctrl-names = "default";
	hdmi-supply = <&dc_in>;
};

&hdmi_tx_tmds_port {
	hdmi_tx_tmds_out: endpoint {
		remote-endpoint = <&hdmi_connector_in>;
	};
};

&ir {
	status = "okay";
	pinctrl-0 = <&remote_input_ao_pins>;
	pinctrl-names = "default";
};

&pwm_AO_cd {
	pinctrl-0 = <&pwm_ao_d_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin1";
	status = "okay";
};

&saradc {
	status = "okay";
	vref-supply = <&vddao_1v8>;
};

/* SD card */
&sd_emmc_b {
	status = "okay";
	pinctrl-0 = <&sdcard_c_pins>;
	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <4>;
	cap-sd-highspeed;
	max-frequency = <50000000>;
	disable-wp;

	/* TOFIX: SD card is barely usable in SDR modes */

	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
	vmmc-supply = <&tflash_vdd>;
	vqmmc-supply = <&vddio_c>;
};

/* eMMC */
&sd_emmc_c {
	status = "okay";
	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
	pinctrl-1 = <&emmc_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <8>;
	cap-mmc-highspeed;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	max-frequency = <200000000>;
	disable-wp;

	mmc-pwrseq = <&emmc_pwrseq>;
	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&emmc_1v8>;
};

&tdmif_b {
	status = "okay";
};

&tdmif_c {
	status = "okay";
};

&tdmin_a {
	status = "okay";
};

&tdmin_b {
	status = "okay";
};

&tdmin_c {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tdmout_c {
	status = "okay";
};

&toacodec {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};

&toddr_a {
	status = "okay";
};

&toddr_b {
	status = "okay";
};

&toddr_c {
	status = "okay";
};

&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

&usb {
	status = "okay";
};

&usb2_phy0 {
	phy-supply = <&dc_in>;
};

&usb2_phy1 {
	/* Enable the hub which is connected to this port */
	phy-supply = <&vl_pwr_en>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 * Copyright (c) 2020 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-ac2xx.dtsi"
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "haochuangyi,h96-max", "amlogic,sm1";
	model = "Shenzhen Haochuangyi Technology Co., Ltd H96 Max";

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "H96-MAX";
		audio-aux-devs = <&tdmout_b>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* hdmi glue */
		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&ethmac {
	status = "okay";

	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
	pinctrl-names = "default";
	phy-mode = "rgmii-txid";
	phy-handle = <&external_phy>;

	rx-internal-delay-ps = <800>;
};

&ext_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
		max-speed = <1000>;

		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;

		interrupt-parent = <&gpio_intc>;
		/* MAC_INTR on GPIOZ_14 */
		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
	};
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};

&uart_A {
	status = "okay";

	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
	pinctrl-names = "default";
	uart-has-rtscts;

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
		max-speed = <2000000>;
		clocks = <&wifi32k>;
		clock-names = "lpo";
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre, SAS
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 */

/dts-v1/;

#include "meson-sm1.dtsi"
#include "meson-khadas-vim3.dtsi"
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "khadas,vim3l", "amlogic,sm1";
	model = "Khadas VIM3L";

	vddcpu: regulator-vddcpu {
		/*
		 * Silergy SY8030DEC Regulator.
		 */
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU";
		regulator-min-microvolt = <690000>;
		regulator-max-microvolt = <1050000>;

		pwm-supply = <&vsys_3v3>;

		pwms = <&pwm_AO_cd 1 1250 0>;
		pwm-dutycycle-range = <100 0>;

		regulator-boot-on;
		regulator-always-on;
	};

	sound {
		model = "G12B-KHADAS-VIM3L";
		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
				"TDMOUT_A IN 1", "FRDDR_B OUT 0",
				"TDMOUT_A IN 2", "FRDDR_C OUT 0",
				"TDM_A Playback", "TDMOUT_A OUT",
				"TDMIN_A IN 0", "TDM_A Capture",
				"TDMIN_A IN 13", "TDM_A Loopback",
				"TODDR_A IN 0", "TDMIN_A OUT",
				"TODDR_B IN 0", "TDMIN_A OUT",
				"TODDR_C IN 0", "TDMIN_A OUT";
	};
};

&cpu0 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU1_CLK>;
	clock-latency = <50000>;
};

&cpu2 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU2_CLK>;
	clock-latency = <50000>;
};

&cpu3 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU3_CLK>;
	clock-latency = <50000>;
};

&pwm_AO_cd {
	pinctrl-0 = <&pwm_ao_d_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin1";
	status = "okay";
};

/*
 * The VIM3 on-board  MCU can mux the PCIe/USB3.0 shared differential
 * lines using a FUSB340TMX USB 3.1 SuperSpeed Data Switch between
 * an USB3.0 Type A connector and a M.2 Key M slot.
 * The PHY driving these differential lines is shared between
 * the USB3.0 controller and the PCIe Controller, thus only
 * a single controller can use it.
 * If the MCU is configured to mux the PCIe/USB3.0 differential lines
 * to the M.2 Key M slot, uncomment the following block to disable
 * USB3.0 from the USB Complex and enable the PCIe controller.
 * The End User is not expected to uncomment the following except for
 * testing purposes, but instead rely on the firmware/bootloader to
 * update these nodes accordingly if PCIe mode is selected by the MCU.
 */
/*
&pcie {
	status = "okay";
};

&usb {
	phys = <&usb2_phy0>, <&usb2_phy1>;
	phy-names = "usb2-phy0", "usb2-phy1";
};
 */

&sd_emmc_a {
	sd-uhs-sdr50;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-odroid.dtsi"

/ {
	compatible = "hardkernel,odroid-c4", "amlogic,sm1";
	model = "Hardkernel ODROID-C4";

	leds {
		compatible = "gpio-leds";

		led-blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			panic-indicator;
		};
	};

	sound {
		model = "ODROID-C4";
	};
};

&gpio {
	/*
	 * WARNING: The USB Hub on the Odroid-C4 needs a reset signal
	 * to be turned high in order to be detected by the USB Controller
	 * This signal should be handled by a USB specific power sequence
	 * in order to reset the Hub when USB bus is powered down.
	 */
	hog-0 {
		gpio-hog;
		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
		output-high;
		line-name = "usb-hub-reset";
	};
};

&ir {
	linux,rc-map-name = "rc-odroid";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-odroid.dtsi"

/ {
	compatible = "hardkernel,odroid-hc4", "amlogic,sm1";
	model = "Hardkernel ODROID-HC4";

	aliases {
		rtc0 = &rtc;
		rtc1 = &vrtc;
	};

	fan0: pwm-fan {
		compatible = "pwm-fan";
		#cooling-cells = <2>;
		cooling-min-state = <0>;
		cooling-max-state = <3>;
		cooling-levels = <0 120 170 220>;
		pwms = <&pwm_cd 1 40000 0>;
	};

	leds {
		compatible = "gpio-leds";

		led-blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
			panic-indicator;
		};

		led-red {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_POWER;
			gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};
	};

	/* Powers the SATA Disk 0 regulator, which is enabled when a disk load is detected */
	p12v_0: regulator-p12v_0 {
		compatible = "regulator-fixed";
		regulator-name = "P12V_0";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		vin-supply = <&main_12v>;

		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
		enable-active-high;
		regulator-always-on;
	};

	/* Powers the SATA Disk 1 regulator, which is enabled when a disk load is detected */
	p12v_1: regulator-p12v_1 {
		compatible = "regulator-fixed";
		regulator-name = "P12V_1";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		vin-supply = <&main_12v>;

		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
		enable-active-high;
		regulator-always-on;
	};

	sound {
		model = "ODROID-HC4";
	};
};

&cpu_thermal {
	cooling-maps {
		map {
			trip = <&cpu_passive>;
			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};

&ir {
	linux,rc-map-name = "rc-odroid";
};

&i2c2 {
	status = "okay";
	pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>;
	pinctrl-names = "default";

	rtc: rtc@51 {
		status = "okay";
		compatible = "nxp,pcf8563";
		reg = <0x51>;
		wakeup-source;
	};
};

&pcie {
	status = "okay";
	reset-gpios = <&gpio GPIOH_4 GPIO_ACTIVE_LOW>;
};

&pwm_cd {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&pwm_d_x6_pins>;
};

&sd_emmc_c {
	status = "disabled";
};

&spifc {
	status = "okay";
	pinctrl-0 = <&nor_pins>;
	pinctrl-names = "default";

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <104000000>;
	};
};

&usb {
	phys = <&usb2_phy1>;
	phy-names = "usb2-phy1";
};

&usb2_phy0 {
	status = "disabled";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
 */

#include "meson-sm1.dtsi"
#include <dt-bindings/gpio/meson-g12a-gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	aliases {
		serial0 = &uart_AO;
		ethernet0 = &ethmac;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

	emmc_pwrseq: emmc-pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
	};

	tflash_vdd: regulator-tflash_vdd {
		compatible = "regulator-fixed";

		regulator-name = "TFLASH_VDD";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;

		gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>;
		enable-active-high;
		regulator-always-on;
	};

	tf_io: gpio-regulator-tf_io {
		compatible = "regulator-gpio";

		regulator-name = "TF_IO";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vcc_5v>;

		enable-gpio = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>;
		enable-active-high;
		regulator-always-on;

		gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_SOURCE>;
		gpios-states = <0>;

		states = <3300000 0>,
			 <1800000 1>;
	};

	flash_1v8: regulator-flash_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "FLASH_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_3v3>;
		regulator-always-on;
	};

	main_12v: regulator-main_12v {
		compatible = "regulator-fixed";
		regulator-name = "12V";
		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
		regulator-always-on;
	};

	vcc_5v: regulator-vcc_5v {
		compatible = "regulator-fixed";
		regulator-name = "5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
		vin-supply = <&main_12v>;
		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
		enable-active-high;
	};

	vcc_1v8: regulator-vcc_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_3v3>;
		regulator-always-on;
	};

	vcc_3v3: regulator-vcc_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
		/* FIXME: actually controlled by VDDCPU_B_EN */
	};

	vddcpu: regulator-vddcpu {
		/*
		 * MP8756GD Regulator.
		 */
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU";
		regulator-min-microvolt = <721000>;
		regulator-max-microvolt = <1022000>;

		pwm-supply = <&main_12v>;

		pwms = <&pwm_AO_cd 1 1250 0>;
		pwm-dutycycle-range = <100 0>;

		regulator-boot-on;
		regulator-always-on;
	};

	usb_pwr_en: regulator-usb_pwr_en {
		compatible = "regulator-fixed";
		regulator-name = "USB_PWR_EN";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc_5v>;

		/* Connected to the microUSB port power enable */
		gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	vddao_1v8: regulator-vddao_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	vddao_3v3: regulator-vddao_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&main_12v>;
		regulator-always-on;
	};

	hdmi-connector {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_connector_in: endpoint {
				remote-endpoint = <&hdmi_tx_tmds_out>;
			};
		};
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		audio-aux-devs = <&tdmout_b>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* hdmi glue */
		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};
};

&arb {
	status = "okay";
};

&cec_AO {
	pinctrl-0 = <&cec_ao_a_h_pins>;
	pinctrl-names = "default";
	status = "disabled";
	hdmi-phandle = <&hdmi_tx>;
};

&cecb_AO {
	pinctrl-0 = <&cec_ao_b_h_pins>;
	pinctrl-names = "default";
	status = "okay";
	hdmi-phandle = <&hdmi_tx>;
};

&clkc_audio {
	status = "okay";
};

&cpu0 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU1_CLK>;
	clock-latency = <50000>;
};

&cpu2 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU2_CLK>;
	clock-latency = <50000>;
};

&cpu3 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU3_CLK>;
	clock-latency = <50000>;
};

&ext_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
		max-speed = <1000>;

		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;

		interrupt-parent = <&gpio_intc>;
		/* MAC_INTR on GPIOZ_14 */
		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
	};
};

&ethmac {
	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
	pinctrl-names = "default";
	status = "okay";
	phy-mode = "rgmii";
	phy-handle = <&external_phy>;
	amlogic,tx-delay-ns = <2>;
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&gpio {
	gpio-line-names =
		/* GPIOZ */
		"", "", "", "", "", "", "", "",
		"", "", "", "", "", "", "", "",
		/* GPIOH */
		"", "", "", "", "",
		"PIN_36", /* GPIOH_5 */
		"PIN_26", /* GPIOH_6 */
		"PIN_32", /* GPIOH_7 */
		"",
		/* BOOT */
		"", "", "", "", "", "", "", "",
		"", "", "", "", "", "", "", "",
		/* GPIOC */
		"", "", "", "", "", "", "", "",
		/* GPIOA */
		"", "", "", "", "", "", "", "",
		"", "", "", "", "", "",
		"PIN_27", /* GPIOA_14 */
		"PIN_28", /* GPIOA_15 */
		/* GPIOX */
		"PIN_16", /* GPIOX_0 */
		"PIN_18", /* GPIOX_1 */
		"PIN_22", /* GPIOX_2 */
		"PIN_11", /* GPIOX_3 */
		"PIN_13", /* GPIOX_4 */
		"PIN_7",  /* GPIOX_5 */
		"PIN_33", /* GPIOX_6 */
		"PIN_15", /* GPIOX_7 */
		"PIN_19", /* GPIOX_8 */
		"PIN_21", /* GPIOX_9 */
		"PIN_24", /* GPIOX_10 */
		"PIN_23", /* GPIOX_11 */
		"PIN_8",  /* GPIOX_12 */
		"PIN_10", /* GPIOX_13 */
		"PIN_29", /* GPIOX_14 */
		"PIN_31", /* GPIOX_15 */
		"PIN_12", /* GPIOX_16 */
		"PIN_3",  /* GPIOX_17 */
		"PIN_5",  /* GPIOX_18 */
		"PIN_35"; /* GPIOX_19 */
};

&gpio_ao {
	gpio-line-names =
		/* GPIOAO */
		"", "", "", "",
		"PIN_47", /* GPIOAO_4 */
		"", "",
		"PIN_45", /* GPIOAO_7 */
		"PIN_46", /* GPIOAO_8 */
		"PIN_44", /* GPIOAO_9 */
		"PIN_42", /* GPIOAO_10 */
		"",
		/* GPIOE */
		"", "", "";
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
	pinctrl-names = "default";
	hdmi-supply = <&vcc_5v>;
};

&hdmi_tx_tmds_port {
	hdmi_tx_tmds_out: endpoint {
		remote-endpoint = <&hdmi_connector_in>;
	};
};

&ir {
	status = "okay";
	pinctrl-0 = <&remote_input_ao_pins>;
	pinctrl-names = "default";
};

&pwm_AO_cd {
	pinctrl-0 = <&pwm_ao_d_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin1";
	status = "okay";
};

&saradc {
	status = "okay";
};

/* SD card */
&sd_emmc_b {
	status = "okay";
	pinctrl-0 = <&sdcard_c_pins>;
	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <4>;
	cap-sd-highspeed;
	max-frequency = <200000000>;
	sd-uhs-sdr12;
	sd-uhs-sdr25;
	sd-uhs-sdr50;
	sd-uhs-sdr104;
	disable-wp;

	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
	vmmc-supply = <&tflash_vdd>;
	vqmmc-supply = <&tf_io>;
};

/* eMMC */
&sd_emmc_c {
	status = "okay";
	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
	pinctrl-1 = <&emmc_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <8>;
	cap-mmc-highspeed;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	max-frequency = <200000000>;
	disable-wp;

	mmc-pwrseq = <&emmc_pwrseq>;
	vmmc-supply = <&vcc_3v3>;
	vqmmc-supply = <&flash_1v8>;
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};

&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

&usb {
	status = "okay";
	vbus-supply = <&usb_pwr_en>;
};

&usb2_phy0 {
	phy-supply = <&vcc_5v>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 */

/dts-v1/;

#include "meson-sm1.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/meson-g12a-gpio.h>
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "seirobotics,sei610", "amlogic,sm1";
	model = "SEI Robotics SEI610";

	aliases {
		serial0 = &uart_AO;
		ethernet0 = &ethmac;
	};

	mono_dac: audio-codec-0 {
		compatible = "maxim,max98357a";
		#sound-dai-cells = <0>;
		sound-name-prefix = "U16";
		sdmode-gpios = <&gpio GPIOX_8 GPIO_ACTIVE_HIGH>;
	};

	dmics: audio-codec-1 {
		#sound-dai-cells = <0>;
		compatible = "dmic-codec";
		num-channels = <2>;
		wakeup-delay-ms = <50>;
		status = "okay";
		sound-name-prefix = "MIC";
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	emmc_pwrseq: emmc-pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
	};

	gpio-keys {
		compatible = "gpio-keys";

		key-1 {
			label = "A";
			linux,code = <BTN_0>;
			gpios = <&gpio GPIOH_6 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&gpio_intc>;
			interrupts = <34 IRQ_TYPE_EDGE_BOTH>;
		};

		key-2 {
			label = "B";
			linux,code = <BTN_1>;
			gpios = <&gpio GPIOH_7 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&gpio_intc>;
			interrupts = <35 IRQ_TYPE_EDGE_BOTH>;
		};

		key-3 {
			label = "C";
			linux,code = <BTN_2>;
			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&gpio_intc>;
			interrupts = <2 IRQ_TYPE_EDGE_BOTH>;
		};

		key-mic-mute {
			label = "MicMute";
			linux,code = <SW_MUTE_DEVICE>;
			linux,input-type = <EV_SW>;
			gpios = <&gpio_ao GPIOE_2 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&gpio_intc>;
			interrupts = <99 IRQ_TYPE_EDGE_BOTH>;
		};

		key-power {
			label = "PowerKey";
			linux,code = <KEY_POWER>;
			gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
			interrupt-parent = <&gpio_intc>;
			interrupts = <3 IRQ_TYPE_EDGE_BOTH>;
		};
	};

	hdmi-connector {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_connector_in: endpoint {
				remote-endpoint = <&hdmi_tx_tmds_out>;
			};
		};
	};

	led-controller-1 {
		compatible = "gpio-leds";

		led-1 {
			label = "sei610:blue:bt";
			gpios = <&gpio GPIOC_7 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
			default-state = "off";
		};
	};

	led-controller-2 {
		compatible = "pwm-leds";

		led-2 {
			label = "sei610:red:power";
			pwms = <&pwm_AO_ab 0 30518 0>;
			max-brightness = <255>;
			linux,default-trigger = "default-on";
			active-low;
		};
	};

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

	ao_5v: regulator-ao_5v {
		compatible = "regulator-fixed";
		regulator-name = "AO_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&dc_in>;
		regulator-always-on;
	};

	dc_in: regulator-dc_in {
		compatible = "regulator-fixed";
		regulator-name = "DC_IN";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-always-on;
	};

	emmc_1v8: regulator-emmc_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "EMMC_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	vddao_3v3: regulator-vddao_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&dc_in>;
		regulator-always-on;
	};

	/* Used by Tuner, RGB Led & IR Emitter LED array */
	vddao_3v3_t: regulator-vddao_3v3_t {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_3V3_T";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vddao_3v3>;
		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
		regulator-always-on;
	};

	vddcpu: regulator-vddcpu {
		/*
		 * SY8120B1ABC DC/DC Regulator.
		 */
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU";
		regulator-min-microvolt = <690000>;
		regulator-max-microvolt = <1050000>;

		pwm-supply = <&dc_in>;

		pwms = <&pwm_AO_cd 1 1500 0>;
		pwm-dutycycle-range = <100 0>;

		regulator-boot-on;
		regulator-always-on;
	};

	vddio_ao1v8: regulator-vddio_ao1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddao_3v3>;
		regulator-always-on;
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
		clocks = <&wifi32k>;
		clock-names = "ext_clock";
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "SEI610";
		audio-aux-devs = <&tdmout_a>, <&tdmout_b>,
				 <&tdmin_a>, <&tdmin_b>;
		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
				"TDMOUT_A IN 1", "FRDDR_B OUT 0",
				"TDMOUT_A IN 2", "FRDDR_C OUT 0",
				"TDM_A Playback", "TDMOUT_A OUT",
				"TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT",
				"TODDR_A IN 4", "PDM Capture",
				"TODDR_B IN 4", "PDM Capture",
				"TODDR_C IN 4", "PDM Capture",
				"TDMIN_A IN 0", "TDM_A Capture",
				"TDMIN_A IN 3", "TDM_A Loopback",
				"TDMIN_B IN 0", "TDM_A Capture",
				"TDMIN_B IN 3", "TDM_A Loopback",
				"TDMIN_A IN 1", "TDM_B Capture",
				"TDMIN_A IN 4", "TDM_B Loopback",
				"TDMIN_B IN 1", "TDM_B Capture",
				"TDMIN_B IN 4", "TDM_B Loopback",
				"TODDR_A IN 0", "TDMIN_A OUT",
				"TODDR_B IN 0", "TDMIN_A OUT",
				"TODDR_C IN 0", "TDMIN_A OUT",
				"TODDR_A IN 1", "TDMIN_B OUT",
				"TODDR_B IN 1", "TDMIN_B OUT",
				"TODDR_C IN 1", "TDMIN_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		dai-link-3 {
			sound-dai = <&toddr_a>;
		};

		dai-link-4 {
			sound-dai = <&toddr_b>;
		};

		dai-link-5 {
			sound-dai = <&toddr_c>;
		};

		/* internal speaker interface */
		dai-link-6 {
			sound-dai = <&tdmif_a>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			mclk-fs = <256>;

			codec-0 {
				sound-dai = <&mono_dac>;
			};

			codec-1 {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
			};
		};

		/* 8ch hdmi interface */
		dai-link-7 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* internal digital mics */
		dai-link-8 {
			sound-dai = <&pdm>;

			codec {
				sound-dai = <&dmics>;
			};
		};

		/* hdmi glue */
		dai-link-9 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};

	wifi32k: wifi32k {
		compatible = "pwm-clock";
		#clock-cells = <0>;
		clock-frequency = <32768>;
		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
	};
};

&arb {
	status = "okay";
};

&cec_AO {
	pinctrl-0 = <&cec_ao_a_h_pins>;
	pinctrl-names = "default";
	status = "disabled";
	hdmi-phandle = <&hdmi_tx>;
};

&cecb_AO {
	pinctrl-0 = <&cec_ao_b_h_pins>;
	pinctrl-names = "default";
	status = "okay";
	hdmi-phandle = <&hdmi_tx>;
};

&clkc_audio {
	status = "okay";
};

&cpu0 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU1_CLK>;
	clock-latency = <50000>;
};

&cpu2 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU2_CLK>;
	clock-latency = <50000>;
};

&cpu3 {
	cpu-supply = <&vddcpu>;
	operating-points-v2 = <&cpu_opp_table>;
	clocks = <&clkc CLKID_CPU3_CLK>;
	clock-latency = <50000>;
};

&ethmac {
	status = "okay";
	phy-handle = <&internal_ephy>;
	phy-mode = "rmii";
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
	pinctrl-names = "default";
};

&hdmi_tx_tmds_port {
	hdmi_tx_tmds_out: endpoint {
		remote-endpoint = <&hdmi_connector_in>;
	};
};

&i2c3 {
	status = "okay";
	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
	pinctrl-names = "default";
};

&ir {
	status = "okay";
	pinctrl-0 = <&remote_input_ao_pins>;
	pinctrl-names = "default";
};

&pdm {
	pinctrl-0 = <&pdm_din0_z_pins>, <&pdm_dclk_z_pins>;
	pinctrl-names = "default";
	status = "okay";
};

&pwm_AO_ab {
	status = "okay";
	pinctrl-0 = <&pwm_ao_a_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin0";
};

&pwm_AO_cd {
	pinctrl-0 = <&pwm_ao_d_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin1";
	status = "okay";
};

&pwm_ef {
	status = "okay";
	pinctrl-0 = <&pwm_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin0";
};

&saradc {
	status = "okay";
	vref-supply = <&vddio_ao1v8>;
};

/* SDIO */
&sd_emmc_a {
	status = "okay";
	pinctrl-0 = <&sdio_pins>;
	pinctrl-1 = <&sdio_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";
	#address-cells = <1>;
	#size-cells = <0>;

	bus-width = <4>;
	cap-sd-highspeed;
	sd-uhs-sdr50;
	max-frequency = <100000000>;

	non-removable;
	disable-wp;

	/* WiFi firmware requires power to be kept while in suspend */
	keep-power-in-suspend;

	mmc-pwrseq = <&sdio_pwrseq>;

	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&vddio_ao1v8>;

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

/* SD card */
&sd_emmc_b {
	status = "okay";
	pinctrl-0 = <&sdcard_c_pins>;
	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <4>;
	cap-sd-highspeed;
	max-frequency = <50000000>;
	disable-wp;

	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&vddao_3v3>;
};

/* eMMC */
&sd_emmc_c {
	status = "okay";
	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
	pinctrl-1 = <&emmc_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";

	bus-width = <8>;
	cap-mmc-highspeed;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	max-frequency = <200000000>;
	non-removable;
	disable-wp;

	mmc-pwrseq = <&emmc_pwrseq>;
	vmmc-supply = <&vddao_3v3>;
	vqmmc-supply = <&emmc_1v8>;
};

&tdmif_a {
	pinctrl-0 = <&tdm_a_dout0_pins>, <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>;
	pinctrl-names = "default";
	status = "okay";

	assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD0>,
			  <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD0>;
	assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
				 <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
	assigned-clock-rates = <0>, <0>;
};

&tdmif_b {
	status = "okay";
};

&tdmin_a {
	status = "okay";
};

&tdmin_b {
	status = "okay";
};

&tdmout_a {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&toddr_a {
	status = "okay";
};

&toddr_b {
	status = "okay";
};

&toddr_c {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};

&uart_A {
	status = "okay";
	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
	pinctrl-names = "default";
	uart-has-rtscts;

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		interrupt-parent = <&gpio_intc>;
		interrupts = <95 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "host-wakeup";
		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
		max-speed = <2000000>;
		clocks = <&wifi32k>;
		clock-names = "lpo";
		vbat-supply = <&vddao_3v3>;
		vddio-supply = <&vddio_ao1v8>;
	};
};

/* Exposed via the on-board USB to Serial FT232RL IC */
&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

&usb {
	status = "okay";
	dr_mode = "otg";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 * Copyright (c) 2020 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-ac2xx.dtsi"
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "amediatech,x96-air-gbit", "amlogic,sm1";
	model = "Shenzhen Amediatech Technology Co., Ltd X96 Air";

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "X96-AIR";
		audio-aux-devs = <&tdmout_b>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* hdmi glue */
		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&ethmac {
	status = "okay";

	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
	pinctrl-names = "default";
	phy-mode = "rgmii-txid";
	phy-handle = <&external_phy>;

	rx-internal-delay-ps = <800>;
};

&ext_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
		max-speed = <1000>;

		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;

		interrupt-parent = <&gpio_intc>;
		/* MAC_INTR on GPIOZ_14 */
		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
	};
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&ir {
	linux,rc-map-name = "rc-x96max";
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre SAS. All rights reserved.
 * Copyright (c) 2020 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-sm1-ac2xx.dtsi"
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "amediatech,x96-air", "amlogic,sm1";
	model = "Shenzhen Amediatech Technology Co., Ltd X96 Air";

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "X96-AIR";
		audio-aux-devs = <&tdmout_b>;
		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT";

		assigned-clocks = <&clkc CLKID_MPLL2>,
				  <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&frddr_a>;
		};

		dai-link-1 {
			sound-dai = <&frddr_b>;
		};

		dai-link-2 {
			sound-dai = <&frddr_c>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			dai-tdm-slot-tx-mask-1 = <1 1>;
			dai-tdm-slot-tx-mask-2 = <1 1>;
			dai-tdm-slot-tx-mask-3 = <1 1>;
			mclk-fs = <256>;

			codec {
				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
			};
		};

		/* hdmi glue */
		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

			codec {
				sound-dai = <&hdmi_tx>;
			};
		};
	};
};

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&ethmac {
	status = "okay";
	phy-handle = <&internal_ephy>;
	phy-mode = "rmii";
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

&ir {
	linux,rc-map-name = "rc-beelink-gs1";
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2019 BayLibre, SAS
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 */

#include "meson-g12-common.dtsi"
#include <dt-bindings/clock/axg-audio-clkc.h>
#include <dt-bindings/power/meson-sm1-power.h>
#include <dt-bindings/reset/amlogic,meson-axg-audio-arb.h>
#include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>

/ {
	compatible = "amlogic,sm1";

	tdmif_a: audio-controller-0 {
		compatible = "amlogic,axg-tdm-iface";
		#sound-dai-cells = <0>;
		sound-name-prefix = "TDM_A";
		clocks = <&clkc_audio AUD_CLKID_MST_A_MCLK>,
			 <&clkc_audio AUD_CLKID_MST_A_SCLK>,
			 <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
		clock-names = "mclk", "sclk", "lrclk";
		status = "disabled";
	};

	tdmif_b: audio-controller-1 {
		compatible = "amlogic,axg-tdm-iface";
		#sound-dai-cells = <0>;
		sound-name-prefix = "TDM_B";
		clocks = <&clkc_audio AUD_CLKID_MST_B_MCLK>,
			 <&clkc_audio AUD_CLKID_MST_B_SCLK>,
			 <&clkc_audio AUD_CLKID_MST_B_LRCLK>;
		clock-names = "mclk", "sclk", "lrclk";
		status = "disabled";
	};

	tdmif_c: audio-controller-2 {
		compatible = "amlogic,axg-tdm-iface";
		#sound-dai-cells = <0>;
		sound-name-prefix = "TDM_C";
		clocks = <&clkc_audio AUD_CLKID_MST_C_MCLK>,
			 <&clkc_audio AUD_CLKID_MST_C_SCLK>,
			 <&clkc_audio AUD_CLKID_MST_C_LRCLK>;
		clock-names = "mclk", "sclk", "lrclk";
		status = "disabled";
	};

	cpus {
		#address-cells = <0x2>;
		#size-cells = <0x0>;

		cpu0: cpu@0 {
			device_type = "cpu";
			compatible = "arm,cortex-a55";
			reg = <0x0 0x0>;
			enable-method = "psci";
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		cpu1: cpu@1 {
			device_type = "cpu";
			compatible = "arm,cortex-a55";
			reg = <0x0 0x1>;
			enable-method = "psci";
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		cpu2: cpu@2 {
			device_type = "cpu";
			compatible = "arm,cortex-a55";
			reg = <0x0 0x2>;
			enable-method = "psci";
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		cpu3: cpu@3 {
			device_type = "cpu";
			compatible = "arm,cortex-a55";
			reg = <0x0 0x3>;
			enable-method = "psci";
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		l2: l2-cache0 {
			compatible = "cache";
			cache-level = <2>;
		};
	};

	cpu_opp_table: opp-table {
		compatible = "operating-points-v2";
		opp-shared;

		opp-1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <770000>;
		};

		opp-1200000000 {
			opp-hz = /bits/ 64 <1200000000>;
			opp-microvolt = <780000>;
		};

		opp-1404000000 {
			opp-hz = /bits/ 64 <1404000000>;
			opp-microvolt = <790000>;
		};

		opp-1500000000 {
			opp-hz = /bits/ 64 <1500000000>;
			opp-microvolt = <800000>;
		};

		opp-1608000000 {
			opp-hz = /bits/ 64 <1608000000>;
			opp-microvolt = <810000>;
		};

		opp-1704000000 {
			opp-hz = /bits/ 64 <1704000000>;
			opp-microvolt = <850000>;
		};

		opp-1800000000 {
			opp-hz = /bits/ 64 <1800000000>;
			opp-microvolt = <900000>;
		};

		opp-1908000000 {
			opp-hz = /bits/ 64 <1908000000>;
			opp-microvolt = <950000>;
		};
	};
};

&apb {
	audio: bus@60000 {
		compatible = "simple-bus";
		reg = <0x0 0x60000 0x0 0x1000>;
		#address-cells = <2>;
		#size-cells = <2>;
		ranges = <0x0 0x0 0x0 0x60000 0x0 0x1000>;

		clkc_audio: clock-controller@0 {
			status = "disabled";
			compatible = "amlogic,sm1-audio-clkc";
			reg = <0x0 0x0 0x0 0xb4>;
			#clock-cells = <1>;
			#reset-cells = <1>;

			clocks = <&clkc CLKID_AUDIO>,
				 <&clkc CLKID_MPLL0>,
				 <&clkc CLKID_MPLL1>,
				 <&clkc CLKID_MPLL2>,
				 <&clkc CLKID_MPLL3>,
				 <&clkc CLKID_HIFI_PLL>,
				 <&clkc CLKID_FCLK_DIV3>,
				 <&clkc CLKID_FCLK_DIV4>,
				 <&clkc CLKID_FCLK_DIV5>;
			clock-names = "pclk",
				      "mst_in0",
				      "mst_in1",
				      "mst_in2",
				      "mst_in3",
				      "mst_in4",
				      "mst_in5",
				      "mst_in6",
				      "mst_in7";

			resets = <&reset RESET_AUDIO>;
		};

		toddr_a: audio-controller@100 {
			compatible = "amlogic,sm1-toddr",
				     "amlogic,axg-toddr";
			reg = <0x0 0x100 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "TODDR_A";
			interrupts = <GIC_SPI 148 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_TODDR_A>;
			resets = <&arb AXG_ARB_TODDR_A>,
				 <&clkc_audio AUD_RESET_TODDR_A>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <8192>;
			status = "disabled";
		};

		toddr_b: audio-controller@140 {
			compatible = "amlogic,sm1-toddr",
				     "amlogic,axg-toddr";
			reg = <0x0 0x140 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "TODDR_B";
			interrupts = <GIC_SPI 149 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_TODDR_B>;
			resets = <&arb AXG_ARB_TODDR_B>,
				 <&clkc_audio AUD_RESET_TODDR_B>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <256>;
			status = "disabled";
		};

		toddr_c: audio-controller@180 {
			compatible = "amlogic,sm1-toddr",
				     "amlogic,axg-toddr";
			reg = <0x0 0x180 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "TODDR_C";
			interrupts = <GIC_SPI 150 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_TODDR_C>;
			resets = <&arb AXG_ARB_TODDR_C>,
				 <&clkc_audio AUD_RESET_TODDR_C>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <256>;
			status = "disabled";
		};

		frddr_a: audio-controller@1c0 {
			compatible = "amlogic,sm1-frddr",
				     "amlogic,axg-frddr";
			reg = <0x0 0x1c0 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "FRDDR_A";
			interrupts = <GIC_SPI 152 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_FRDDR_A>;
			resets = <&arb AXG_ARB_FRDDR_A>,
				 <&clkc_audio AUD_RESET_FRDDR_A>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <512>;
			status = "disabled";
		};

		frddr_b: audio-controller@200 {
			compatible = "amlogic,sm1-frddr",
				     "amlogic,axg-frddr";
			reg = <0x0 0x200 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "FRDDR_B";
			interrupts = <GIC_SPI 153 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_FRDDR_B>;
			resets = <&arb AXG_ARB_FRDDR_B>,
				 <&clkc_audio AUD_RESET_FRDDR_B>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <256>;
			status = "disabled";
		};

		frddr_c: audio-controller@240 {
			compatible = "amlogic,sm1-frddr",
				     "amlogic,axg-frddr";
			reg = <0x0 0x240 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "FRDDR_C";
			interrupts = <GIC_SPI 154 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_FRDDR_C>;
			resets = <&arb AXG_ARB_FRDDR_C>,
				 <&clkc_audio AUD_RESET_FRDDR_C>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <256>;
			status = "disabled";
		};

		arb: reset-controller@280 {
			status = "disabled";
			compatible = "amlogic,meson-sm1-audio-arb";
			reg = <0x0 0x280 0x0 0x4>;
			#reset-cells = <1>;
			clocks = <&clkc_audio AUD_CLKID_DDR_ARB>;
		};

		tdmin_a: audio-controller@300 {
			compatible = "amlogic,sm1-tdmin",
				     "amlogic,axg-tdmin";
			reg = <0x0 0x300 0x0 0x40>;
			sound-name-prefix = "TDMIN_A";
			resets = <&clkc_audio AUD_RESET_TDMIN_A>;
			clocks = <&clkc_audio AUD_CLKID_TDMIN_A>,
				 <&clkc_audio AUD_CLKID_TDMIN_A_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_A_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_A_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		tdmin_b: audio-controller@340 {
			compatible = "amlogic,sm1-tdmin",
				     "amlogic,axg-tdmin";
			reg = <0x0 0x340 0x0 0x40>;
			sound-name-prefix = "TDMIN_B";
			resets = <&clkc_audio AUD_RESET_TDMIN_B>;
			clocks = <&clkc_audio AUD_CLKID_TDMIN_B>,
				 <&clkc_audio AUD_CLKID_TDMIN_B_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_B_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_B_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		tdmin_c: audio-controller@380 {
			compatible = "amlogic,sm1-tdmin",
				     "amlogic,axg-tdmin";
			reg = <0x0 0x380 0x0 0x40>;
			sound-name-prefix = "TDMIN_C";
			resets = <&clkc_audio AUD_RESET_TDMIN_C>;
			clocks = <&clkc_audio AUD_CLKID_TDMIN_C>,
				 <&clkc_audio AUD_CLKID_TDMIN_C_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_C_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_C_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		tdmin_lb: audio-controller@3c0 {
			compatible = "amlogic,sm1-tdmin",
				     "amlogic,axg-tdmin";
			reg = <0x0 0x3c0 0x0 0x40>;
			sound-name-prefix = "TDMIN_LB";
			resets = <&clkc_audio AUD_RESET_TDMIN_LB>;
			clocks = <&clkc_audio AUD_CLKID_TDMIN_LB>,
				 <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_LB_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMIN_LB_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		spdifin: audio-controller@400 {
			compatible = "amlogic,g12a-spdifin",
				     "amlogic,axg-spdifin";
			reg = <0x0 0x400 0x0 0x30>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "SPDIFIN";
			interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
			<&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
			clock-names = "pclk", "refclk";
			resets = <&clkc_audio AUD_RESET_SPDIFIN>;
			status = "disabled";
		};

		spdifout_a: audio-controller@480 {
			compatible = "amlogic,g12a-spdifout",
				     "amlogic,axg-spdifout";
			reg = <0x0 0x480 0x0 0x50>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "SPDIFOUT_A";
			clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
			<&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
			clock-names = "pclk", "mclk";
			resets = <&clkc_audio AUD_RESET_SPDIFOUT>;
			status = "disabled";
		};

		tdmout_a: audio-controller@500 {
			compatible = "amlogic,sm1-tdmout";
			reg = <0x0 0x500 0x0 0x40>;
			sound-name-prefix = "TDMOUT_A";
			resets = <&clkc_audio AUD_RESET_TDMOUT_A>;
			clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>,
				 <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMOUT_A_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		tdmout_b: audio-controller@540 {
			compatible = "amlogic,sm1-tdmout";
			reg = <0x0 0x540 0x0 0x40>;
			sound-name-prefix = "TDMOUT_B";
			resets = <&clkc_audio AUD_RESET_TDMOUT_B>;
			clocks = <&clkc_audio AUD_CLKID_TDMOUT_B>,
				 <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMOUT_B_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMOUT_B_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		tdmout_c: audio-controller@580 {
			compatible = "amlogic,sm1-tdmout";
			reg = <0x0 0x580 0x0 0x40>;
			sound-name-prefix = "TDMOUT_C";
			resets = <&clkc_audio AUD_RESET_TDMOUT_C>;
			clocks = <&clkc_audio AUD_CLKID_TDMOUT_C>,
				 <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK>,
				 <&clkc_audio AUD_CLKID_TDMOUT_C_SCLK_SEL>,
				 <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>,
				 <&clkc_audio AUD_CLKID_TDMOUT_C_LRCLK>;
			clock-names = "pclk", "sclk", "sclk_sel",
				      "lrclk", "lrclk_sel";
			status = "disabled";
		};

		toacodec: audio-controller@740 {
			compatible = "amlogic,sm1-toacodec",
				     "amlogic,g12a-toacodec";
			reg = <0x0 0x740 0x0 0x4>;
			#sound-dai-cells = <1>;
			sound-name-prefix = "TOACODEC";
			resets = <&clkc_audio AUD_RESET_TOACODEC>;
			status = "disabled";
		};

		tohdmitx: audio-controller@744 {
			compatible = "amlogic,sm1-tohdmitx",
				     "amlogic,g12a-tohdmitx";
			reg = <0x0 0x744 0x0 0x4>;
			#sound-dai-cells = <1>;
			sound-name-prefix = "TOHDMITX";
			resets = <&clkc_audio AUD_RESET_TOHDMITX>;
			status = "disabled";
		};

		toddr_d: audio-controller@840 {
			compatible = "amlogic,sm1-toddr",
				     "amlogic,axg-toddr";
			reg = <0x0 0x840 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "TODDR_D";
			interrupts = <GIC_SPI 49 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_TODDR_D>;
			resets = <&arb AXG_ARB_TODDR_D>,
				 <&clkc_audio AUD_RESET_TODDR_D>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <256>;
			status = "disabled";
		};

		frddr_d: audio-controller@880 {
			 compatible = "amlogic,sm1-frddr",
				      "amlogic,axg-frddr";
			reg = <0x0 0x880 0x0 0x2c>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "FRDDR_D";
			interrupts = <GIC_SPI 50 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc_audio AUD_CLKID_FRDDR_D>;
			resets = <&arb AXG_ARB_FRDDR_D>,
				 <&clkc_audio AUD_RESET_FRDDR_D>;
			reset-names = "arb", "rst";
			amlogic,fifo-depth = <256>;
			status = "disabled";
		};
	};

	pdm: audio-controller@61000 {
		compatible = "amlogic,sm1-pdm",
			     "amlogic,axg-pdm";
		reg = <0x0 0x61000 0x0 0x34>;
		#sound-dai-cells = <0>;
		sound-name-prefix = "PDM";
		clocks = <&clkc_audio AUD_CLKID_PDM>,
			 <&clkc_audio AUD_CLKID_PDM_DCLK>,
			 <&clkc_audio AUD_CLKID_PDM_SYSCLK>;
		clock-names = "pclk", "dclk", "sysclk";
		resets = <&clkc_audio AUD_RESET_PDM>;
		status = "disabled";
	};
};

&cecb_AO {
	compatible = "amlogic,meson-sm1-ao-cec";
};

&clk_msr {
	compatible = "amlogic,meson-sm1-clk-measure";
};

&clkc {
	compatible = "amlogic,sm1-clkc";
};

&cpu_thermal {
	cooling-maps {
		map0 {
			trip = <&cpu_passive>;
			cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};

		map1 {
			trip = <&cpu_hot>;
			cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					<&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					<&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};

&ethmac {
	power-domains = <&pwrc PWRC_SM1_ETH_ID>;
};

&gpio_intc {
	compatible = "amlogic,meson-sm1-gpio-intc",
		     "amlogic,meson-gpio-intc";
};

&pcie {
	power-domains = <&pwrc PWRC_SM1_PCIE_ID>;
};

&pmu {
	compatible = "amlogic,sm1-ddr-pmu";
};

&pwrc {
	compatible = "amlogic,meson-sm1-pwrc";
};

&simplefb_cvbs {
	power-domains = <&pwrc PWRC_SM1_VPU_ID>;
};

&simplefb_hdmi {
	power-domains = <&pwrc PWRC_SM1_VPU_ID>;
};

&vdec {
	compatible = "amlogic,sm1-vdec";
};

&vpu {
	power-domains = <&pwrc PWRC_SM1_VPU_ID>;
};

&usb {
	power-domains = <&pwrc PWRC_SM1_USB_ID>;
};


code:
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
dtb-$(CONFIG_ARCH_XGENE) += apm-merlin.dtb


code:
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * dts file for AppliedMicro (APM) Merlin Board
 *
 * Copyright (C) 2015, Applied Micro Circuits Corporation
 */

/dts-v1/;

/include/ "apm-shadowcat.dtsi"

/ {
	model = "APM X-Gene Merlin board";
	compatible = "apm,merlin", "apm,xgene-shadowcat";

	chosen { };

	memory {
		device_type = "memory";
		reg = < 0x1 0x00000000 0x0 0x80000000 >;
	};

	gpio-keys {
		compatible = "gpio-keys";
		button {
			label = "POWER";
			linux,code = <116>;
			linux,input-type = <0x1>;
			interrupt-parent = <&sbgpio>;
			interrupts = <0x0 0x1>;
		};
	};

	poweroff_mbox: poweroff_mbox@10548000 {
		compatible = "syscon";
		reg = <0x0 0x10548000 0x0 0x30>;
	};

	poweroff: poweroff@10548010 {
		compatible = "syscon-poweroff";
		regmap = <&poweroff_mbox>;
		offset = <0x10>;
		mask = <0x1>;
	};
};

&serial0 {
	status = "ok";
};

&sata1 {
	status = "ok";
};

&sata2 {
	status = "ok";
};

&sata3 {
	status = "ok";
};

&sgenet0 {
	status = "ok";
};

&xgenet1 {
	status = "ok";
};

&mmc0 {
	status = "ok";
};

&i2c4 {
	rtc68: rtc@68 {
		compatible = "dallas,ds1337";
		reg = <0x68>;
		status = "ok";
	};
};

&mdio {
	sgenet0phy: phy@0 {
		reg = <0x0>;
	};
};


code:
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * dts file for AppliedMicro (APM) Mustang Board
 *
 * Copyright (C) 2013, Applied Micro Circuits Corporation
 */

/dts-v1/;

/include/ "apm-storm.dtsi"

/ {
	model = "APM X-Gene Mustang board";
	compatible = "apm,mustang", "apm,xgene-storm";

	chosen { };

	memory {
		device_type = "memory";
		reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */
	};

	gpio-keys {
		compatible = "gpio-keys";
		button {
			label = "POWER";
			linux,code = <116>;
			linux,input-type = <0x1>;
			interrupt-parent = <&sbgpio>;
			interrupts = <0x5 0x1>;
		};
	};

	poweroff_mbox: poweroff_mbox@10548000 {
		compatible = "syscon";
		reg = <0x0 0x10548000 0x0 0x30>;
	};

	poweroff: poweroff@10548010 {
		compatible = "syscon-poweroff";
		regmap = <&poweroff_mbox>;
		offset = <0x10>;
		mask = <0x1>;
	};
};

&pcie0clk {
	status = "ok";
};

&pcie0 {
	status = "ok";
};

&serial0 {
	status = "ok";
};

&menet {
	status = "ok";
};

&sgenet0 {
	status = "ok";
};

&sgenet1 {
	status = "ok";
};

&xgenet {
	status = "ok";
	rxlos-gpios = <&sbgpio 12 1>;
};

&mmc0 {
	status = "ok";
};

&mdio {
	menet0phy: phy@3 {
		reg = <0x3>;
	};
	sgenet0phy: phy@4 {
		reg = <0x4>;
	};
	sgenet1phy: phy@5 {
		reg = <0x5>;
	};
};