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

/dts-v1/;

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

/ {
	compatible = "amediatech,x96-max", "amlogic,g12a";
	model = "Shenzhen Amediatech Technology Co., Ltd X96 Max";

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

	spdif_dit: audio-codec-1 {
		#sound-dai-cells = <0>;
		compatible = "linux,spdif-dit";
		status = "okay";
		sound-name-prefix = "DIT";
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};
	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

	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>;
			};
		};
	};

	emmc_pwrseq: emmc-pwrseq {
		compatible = "mmc-pwrseq-emmc";
		reset-gpios = <&gpio BOOT_12 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";
	};

	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;
	};

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

	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 */
	};

	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>;
	};

	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 {
		compatible = "pwm-regulator";

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

		pwm-supply = <&dc_in>;

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

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

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "X96-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",
				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
				"SPDIFOUT IN 2", "FRDDR_C OUT 3";

		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>;
			};
		};

		/* spdif hdmi or toslink interface */
		dai-link-4 {
			sound-dai = <&spdifout>;

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

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

		/* spdif hdmi interface */
		dai-link-5 {
			sound-dai = <&spdifout_b>;

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

		/* hdmi glue */
		dai-link-6 {
			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_CPU_CLK>;
	clock-latency = <50000>;
};

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

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

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

&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>;
	};
};

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

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

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

		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>;
};

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

&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";
};

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

/* 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 = <&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 = <100000000>;
	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;
	max-frequency = <100000000>;
	non-removable;
	disable-wp;

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

&spdifout {
	pinctrl-0 = <&spdif_out_h_pins>;
	pinctrl-names = "default";
	status = "okay";
};

&spdifout_b {
	status = "okay";
};

&tdmif_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&tohdmitx {
	status = "okay";
};


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

#include "meson-g12.dtsi"

/ {
	compatible = "amlogic,g12a";

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

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

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

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

		cpu3: cpu@3 {
			device_type = "cpu";
			compatible = "arm,cortex-a53";
			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-100000000 {
			opp-hz = /bits/ 64 <100000000>;
			opp-microvolt = <731000>;
		};

		opp-250000000 {
			opp-hz = /bits/ 64 <250000000>;
			opp-microvolt = <731000>;
		};

		opp-500000000 {
			opp-hz = /bits/ 64 <500000000>;
			opp-microvolt = <731000>;
		};

		opp-667000000 {
			opp-hz = /bits/ 64 <666666666>;
			opp-microvolt = <731000>;
		};

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

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

		opp-1398000000 {
			opp-hz = /bits/ 64 <1398000000>;
			opp-microvolt = <761000>;
		};

		opp-1512000000 {
			opp-hz = /bits/ 64 <1512000000>;
			opp-microvolt = <791000>;
		};

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

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

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

&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>;
		};
	};
};

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

repo_name: angery/linux


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>
 */

/dts-v1/;

#include "meson-g12b-a311d.dtsi"
#include "meson-khadas-vim3.dtsi"
#include "meson-g12b-khadas-vim3.dtsi"

/ {
	compatible = "khadas,vim3", "amlogic,a311d", "amlogic,g12b";
};

/*
 * 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";
};
 */


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>
 */

/dts-v1/;

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

/ {
	compatible = "azw,gsking-x", "amlogic,s922x", "amlogic,g12b";
	model = "Beelink GS-King X";

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

	gpio_fan: gpio-fan {
		compatible = "gpio-fan";
		gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
		/* Using Dummy Speed */
		gpio-fan,speed-map = <0 0>, <1 1>;
		#cooling-cells = <2>;
	};

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

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

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "GSKING-X";
		audio-aux-devs = <&tdmout_a>;
		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 1",
				"TDMOUT_A IN 1", "FRDDR_B OUT 1",
				"TDMOUT_A IN 2", "FRDDR_C OUT 1",
				"TDM_A Playback", "TDMOUT_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>;
		};

		/* 8ch hdmi interface */
		dai-link-3 {
			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>;
			};
		};

		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

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

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

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

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

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

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

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

&tdmif_a {
	status = "okay";
};

&tdmout_a {
	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>
 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

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

/ {
	compatible = "azw,gtking", "amlogic,s922x", "amlogic,g12b";
	model = "Beelink GT-King Pro";

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

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

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

	leds {
		compatible = "gpio-leds";

		led-white {
			label = "power:white";
			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "GTKING-PRO";
		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>;
			};
		};

		dai-link-4 {
			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;

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

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

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

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

&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>
 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

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

/ {
	compatible = "azw,gtking", "amlogic,s922x", "amlogic,g12b";
	model = "Beelink GT-King";

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

	spdif_dit: audio-codec-1 {
		#sound-dai-cells = <0>;
		compatible = "linux,spdif-dit";
		status = "okay";
		sound-name-prefix = "DIT";
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "GTKING";
		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",
				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
				"SPDIFOUT IN 2", "FRDDR_C OUT 3";

		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>;
			};
		};

		/* spdif hdmi or toslink interface */
		dai-link-4 {
			sound-dai = <&spdifout>;

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

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

		/* spdif hdmi interface */
		dai-link-5 {
			sound-dai = <&spdifout_b>;

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

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

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

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

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

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

&spdifout {
	pinctrl-0 = <&spdif_out_h_pins>;
	pinctrl-names = "default";
	status = "okay";
};

&spdifout_b {
	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
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
 */

/ {
	model = "Khadas VIM3";

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

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

		pwm-supply = <&dc_in>;

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

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

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

		regulator-name = "VDDCPU_B";
		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;
	};
};

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

&cpu1 {
	cpu-supply = <&vddcpu_b>;
	operating-points-v2 = <&cpu_opp_table_0>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu100 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu101 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu102 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu103 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

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

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


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2022 Neil Armstrong <neil.armstrong@linaro.org>
 */

/dts-v1/;

#include "meson-g12b-s922x.dtsi"
#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-toacodec.h>
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>

/ {
	compatible = "hardkernel,odroid-go-ultra", "amlogic,s922x", "amlogic,g12b";
	model = "Hardkernel ODROID-GO-Ultra";

	aliases {
		serial0 = &uart_AO;
		rtc0 = &vrtc;
	};

	adc-joystick-left {
		compatible = "adc-joystick";
		io-channels = <&saradc 2>, <&saradc 3>;
		poll-interval = <10>;
		#address-cells = <1>;
		#size-cells = <0>;

		axis@0 {
			reg = <0>;
			linux,code = <ABS_Y>;
			abs-range = <3150 950>;
			abs-fuzz = <32>;
			abs-flat = <64>;
		};
		axis@1 {
			reg = <1>;
			linux,code = <ABS_X>;
			abs-range = <700 2900>;
			abs-fuzz = <32>;
			abs-flat = <64>;
		};
	};

	adc-joystick-right {
		compatible = "adc-joystick";
		io-channels = <&saradc 0>, <&saradc 1>;
		poll-interval = <10>;
		#address-cells = <1>;
		#size-cells = <0>;

		axis@0 {
			reg = <0>;
			linux,code = <ABS_RY>;
			abs-range = <3150 950>;
			abs-fuzz = <32>;
			abs-flat = <64>;
		};
		axis@1 {
			reg = <1>;
			linux,code = <ABS_RX>;
			abs-range = <800 3000>;
			abs-fuzz = <32>;
			abs-flat = <64>;
		};
	};

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

	codec_clk: codec-clk {
		compatible = "fixed-clock";
		clock-frequency = <12288000>;
		clock-output-names = "codec_clk";
		#clock-cells = <0>;
	};

	gpio-keys {
		compatible = "gpio-keys-polled";
		poll-interval = <10>;
		pinctrl-0 = <&keypad_gpio_pins>;
		pinctrl-names = "default";

		volume-up-button {
			label = "VOLUME-UP";
			linux,code = <KEY_VOLUMEUP>;
			gpios = <&gpio GPIOX_8 GPIO_ACTIVE_LOW>;
		};
		volume-down-button {
			label = "VOLUME-DOWN";
			linux,code = <KEY_VOLUMEDOWN>;
			gpios = <&gpio GPIOX_9 GPIO_ACTIVE_LOW>;
		};
		dpad-up-button {
			label = "DPAD-UP";
			linux,code = <BTN_DPAD_UP>;
			gpios = <&gpio GPIOX_0 GPIO_ACTIVE_LOW>;
		};
		dpad-down-button {
			label = "DPAD-DOWN";
			linux,code = <BTN_DPAD_DOWN>;
			gpios = <&gpio GPIOX_1 GPIO_ACTIVE_LOW>;
		};
		dpad-left-button {
			label = "DPAD-LEFT";
			linux,code = <BTN_DPAD_LEFT>;
			gpios = <&gpio GPIOX_2 GPIO_ACTIVE_LOW>;
		};
		dpad-right-button {
			label = "DPAD-RIGHT";
			linux,code = <BTN_DPAD_RIGHT>;
			gpios = <&gpio GPIOX_3 GPIO_ACTIVE_LOW>;
		};
		a-button {
			label = "A";
			linux,code = <BTN_EAST>;
			gpios = <&gpio GPIOX_4 GPIO_ACTIVE_LOW>;
		};
		b-button {
			label = "B";
			linux,code = <BTN_SOUTH>;
			gpios = <&gpio GPIOX_5 GPIO_ACTIVE_LOW>;
		};
		y-button {
			label = "Y";
			linux,code = <BTN_WEST>;
			gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
		};
		x-button {
			label = "X";
			linux,code = <BTN_NORTH>;
			gpios = <&gpio GPIOX_7 GPIO_ACTIVE_LOW>;
		};
		f1-button {
			label = "F1";
			linux,code = <BTN_TRIGGER_HAPPY1>;
			gpios = <&gpio GPIOX_17 GPIO_ACTIVE_LOW>;
		};
		f2-button {
			label = "F2";
			linux,code = <BTN_TRIGGER_HAPPY2>;
			gpios = <&gpio GPIOX_10 GPIO_ACTIVE_LOW>;
		};
		f3-button {
			label = "F3";
			linux,code = <BTN_TRIGGER_HAPPY3>;
			gpios = <&gpio GPIOX_11 GPIO_ACTIVE_LOW>;
		};
		f4-button {
			label = "F4";
			linux,code = <BTN_TRIGGER_HAPPY4>;
			gpios = <&gpio GPIOX_12 GPIO_ACTIVE_LOW>;
		};
		f5-button {
			label = "F5";
			linux,code = <BTN_TRIGGER_HAPPY5>;
			gpios = <&gpio GPIOX_13 GPIO_ACTIVE_LOW>;
		};
		f6-button {
			label = "F6";
			linux,code = <BTN_TRIGGER_HAPPY6>;
			gpios = <&gpio GPIOX_16 GPIO_ACTIVE_LOW>;
		};
		top-left-button {
			label = "TOP Left";
			linux,code = <BTN_TL>;
			gpios = <&gpio GPIOX_14 GPIO_ACTIVE_LOW>;
		};
		top-left2-button {
			label = "TOP Left 2";
			linux,code = <BTN_TL2>;
			gpios = <&gpio GPIOX_19 GPIO_ACTIVE_LOW>;
		};
		top-right-button {
			label = "TOP Right";
			linux,code = <BTN_TR>;
			gpios = <&gpio GPIOX_15 GPIO_ACTIVE_LOW>;
		};
		top-right2-button {
			label = "TOP Right 2";
			linux,code = <BTN_TR2>;
			gpios = <&gpio GPIOX_18 GPIO_ACTIVE_LOW>;
		};
	};

	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>;
	};

	leds {
		compatible = "gpio-leds";

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

	vdd_sys: regulator-vdd-sys {
		compatible = "regulator-fixed";
		regulator-name = "VDD_SYS";
		regulator-min-microvolt = <3800000>;
		regulator-max-microvolt = <3800000>;
		regulator-always-on;
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "Odroid GO Ultra";
		audio-widgets = "Microphone", "Mic Jack",
				"Headphone", "Headphones",
				"Speaker", "Internal Speakers";
		audio-aux-devs = <&tdmout_b>, <&tdmin_b>, <&speaker_amp>;
		audio-routing =	"TDMOUT_B IN 0", "FRDDR_A OUT 1",
				"TDM_B Playback", "TDMOUT_B OUT",
				"TDMIN_B IN 1", "TDM_B Capture",
				"TDMIN_B IN 4", "TDM_B Loopback",
				"TODDR_A IN 1", "TDMIN_B OUT",
				"MICL", "Mic Jack",
				"Headphones", "HPOL",
				"Headphones", "HPOR",
				"Speaker Amplifier INL", "HPOL",
				"Speaker Amplifier INR", "HPOR",
				"Internal Speakers", "Speaker Amplifier OUTL",
				"Internal Speakers", "Speaker Amplifier OUTR";

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

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

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

		dai-link-2 {
			sound-dai = <&tdmif_b>;
			dai-format = "i2s";
			dai-tdm-slot-tx-mask-0 = <1 1>;
			mclk-fs = <256>;

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

	speaker_amp: speaker-amplifier {
		compatible = "simple-audio-amplifier";
		sound-name-prefix = "Speaker Amplifier";
		VCC-supply = <&hp_5v>;
	};
};

&arb {
	status = "okay";
};

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

&cpu1 {
	cpu-supply = <&vddcpu_b>;
	operating-points-v2 = <&cpu_opp_table_0>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu100 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu101 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu102 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu103 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

/* RK817 only supports 12.5mV steps, round up the values */
&cpu_opp_table_0 {
	opp-1000000000 {
		opp-microvolt = <737500>;
	};
	opp-1200000000 {
		opp-microvolt = <737500>;
	};
	opp-1398000000 {
		opp-microvolt = <762500>;
	};
	opp-1512000000 {
		opp-microvolt = <800000>;
	};
	opp-1608000000 {
		opp-microvolt = <837500>;
	};
	opp-1704000000 {
		opp-microvolt = <862500>;
	};
	opp-1896000000 {
		opp-microvolt = <987500>;
	};
	opp-1992000000 {
		opp-microvolt = <1012500>;
	};
};

/* RK818 only supports 12.5mV steps, round up the values */
&cpub_opp_table_1 {
	opp-1000000000 {
		opp-microvolt = <775000>;
	};
	opp-1200000000 {
		opp-microvolt = <775000>;
	};
	opp-1398000000 {
		opp-microvolt = <800000>;
	};
	opp-1512000000 {
		opp-microvolt = <825000>;
	};
	opp-1608000000 {
		opp-microvolt = <862500>;
	};
	opp-1704000000 {
		opp-microvolt = <900000>;
	};
	opp-1800000000 {
		opp-microvolt = <987500>;
	};
	opp-1908000000 {
		opp-microvolt = <1025000>;
	};
};

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

	rk818: pmic@1c {
		compatible = "rockchip,rk818";
		reg = <0x1c>;
		interrupt-parent = <&gpio_intc>;
		interrupts = <7 IRQ_TYPE_LEVEL_LOW>; /* GPIOAO_7 */

		vcc1-supply = <&vdd_sys>;
		vcc2-supply = <&vdd_sys>;
		vcc3-supply = <&vdd_sys>;
		vcc4-supply = <&vdd_sys>;
		vcc6-supply = <&vdd_sys>;
		vcc7-supply = <&vcc_2v3>;
		vcc8-supply = <&vcc_2v3>;
		vcc9-supply = <&vddao_3v3>;
		boost-supply = <&vdd_sys>;
		switch-supply = <&vdd_sys>;

		regulators {
			vddcpu_a: DCDC_REG1 {
				regulator-name = "vddcpu_a";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <775000>;
				regulator-max-microvolt = <1025000>;
				regulator-ramp-delay = <6001>;
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <775000>;
				};
			};

			vdd_ee: DCDC_REG2 {
				regulator-name = "vdd_ee";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <875000>;
				regulator-max-microvolt = <1250000>;
				regulator-ramp-delay = <6001>;
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <875000>;
				};
			};

			vddq_1v1: DCDC_REG3 {
				regulator-name = "vddq_1v1";
				regulator-always-on;
				regulator-boot-on;
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};

			vddao_3v3: DCDC_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vddao_3v3";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			hp_5v: DCDC_BOOST {
				regulator-always-on;
				regulator-boot-on;
				regulator-name = "hp_5v";
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5000000>;
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vddio_ao1v8: LDO_REG5 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vddio_ao1v8";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vddq_1v8: LDO_REG7 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-name = "vddq_1v8";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
				};
			};

			vddio_c: LDO_REG9 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vddio_c";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <3300000>;
				};
			};

			vcc_sd: SWITCH_REG {
				regulator-name = "vcc_sd";
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};

			OTG_SWITCH {
				regulator-name = "otg_switch";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};
	};
};

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

	rk817: pmic@20 {
		compatible = "rockchip,rk817";
		reg = <0x20>;
		interrupt-parent = <&gpio_intc>;

		interrupts = <5 IRQ_TYPE_LEVEL_LOW>; /* GPIOAO_5 */

		vcc1-supply = <&vdd_sys>;
		vcc2-supply = <&vdd_sys>;
		vcc3-supply = <&vdd_sys>;
		vcc4-supply = <&vdd_sys>;
		vcc5-supply = <&vdd_sys>;
		vcc6-supply = <&vdd_sys>;
		vcc7-supply = <&vdd_sys>;
		vcc8-supply = <&vdd_sys>;
		vcc9-supply = <&rk817_boost>;

		#sound-dai-cells = <0>;
		clocks = <&codec_clk>;
		clock-names = "mclk";

		#clock-cells = <1>;

		regulators {
			vddcpu_b: DCDC_REG2 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <737500>;
				regulator-max-microvolt = <1012500>;
				regulator-ramp-delay = <6001>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vddcpu_b";
				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1000000>;
				};
			};

			vcc_2v3: DCDC_REG3 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <2300000>;
				regulator-max-microvolt = <2400000>;
				regulator-initial-mode = <0x2>;
				regulator-name = "vcc_2v3";
				regulator-state-mem {
					regulator-on-in-suspend;
				};
			};

			LDO_REG4 {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vdd_codec";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			vcc_lcd: LDO_REG8 {
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-name = "vcc_lcd";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			rk817_boost: BOOST {
				regulator-always-on;
				regulator-boot-on;
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5400000>;
				regulator-name = "rk817_boost";
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			usb_host: OTG_SWITCH {
				regulator-name = "usb_host";
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5000000>;
				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};
	};
};

&clkc_audio {
	status = "okay";
};

&eth_phy {
	status = "disabled";
};

&frddr_a {
	status = "okay";
};

&periphs_pinctrl {
	keypad_gpio_pins: keypad-gpio {
		mux {
			groups = "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3",
			         "GPIOX_4", "GPIOX_5", "GPIOX_6", "GPIOX_7",
				 "GPIOX_8", "GPIOX_9", "GPIOX_10", "GPIOX_11",
				 "GPIOX_12", "GPIOX_13", "GPIOX_14",  "GPIOX_15",
				 "GPIOX_16", "GPIOX_17", "GPIOX_18",  "GPIOX_19";
			function = "gpio_periphs";
			bias-pull-up;
			output-disable;
		};
	};
};

&saradc {
	status = "okay";
	vref-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;
	max-frequency = <50000000>;
	disable-wp;

	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
	vmmc-supply = <&vcc_sd>;
	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 = <&vcc_sd>;
	vqmmc-supply = <&vddio_ao1v8>;
};

&tdmif_b {
	pinctrl-0 = <&tdm_b_dout0_pins>, <&tdm_b_fs_pins>, <&tdm_b_sclk_pins>, <&tdm_b_din1_pins>;
	pinctrl-names = "default";
	status = "okay";

	assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD1>,
			  <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD1>;
	assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_B_SCLK>,
				 <&clkc_audio AUD_CLKID_MST_B_LRCLK>;
	assigned-clock-rates = <0>, <0>;
};

&tdmin_b {
	status = "okay";
};

&tdmout_b {
	status = "okay";
};

&toddr_a {
	status = "okay";
};

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

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

&usb2_phy0 {
	status = "okay";
};

&usb2_phy1 {
	status = "okay";
	phy-supply = <&usb_host>;
};


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

/dts-v1/;

/* The Amlogic S922X Rev. C supports the same OPPs as the A311D variant */
#include "meson-g12b-a311d.dtsi"
#include "meson-g12b-odroid-n2.dtsi"

/ {
	compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", "amlogic,g12b";
	model = "Hardkernel ODROID-N2Plus";
};

&vddcpu_a {
	regulator-min-microvolt = <680000>;
	regulator-max-microvolt = <1040000>;

	pwms = <&pwm_ab 0 1500 0>;
};

&vddcpu_b {
	regulator-min-microvolt = <680000>;
	regulator-max-microvolt = <1040000>;

	pwms = <&pwm_AO_cd 1 1500 0>;
};


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

/dts-v1/;

#include "meson-g12b-s922x.dtsi"
#include "meson-g12b-odroid-n2.dtsi"

/ {
	compatible = "hardkernel,odroid-n2", "amlogic,s922x", "amlogic,g12b";
	model = "Hardkernel ODROID-N2";
};


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

#include <dt-bindings/input/input.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>

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

	dio2133: audio-amplifier-0 {
		compatible = "simple-audio-amplifier";
		enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
		VCC-supply = <&vcc_5v>;
		sound-name-prefix = "U19";
		status = "okay";
	};

	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>;
	};

	fan: gpio-fan {
		compatible = "gpio-fan";
		gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>;
		/* Using Dummy Speed */
		gpio-fan,speed-map = <0 0>, <1 1>;
		#cooling-cells = <2>;
	};

	leds {
		compatible = "gpio-leds";

		led-blue {
			label = "n2:blue";
			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};

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

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

		gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
		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>;

		gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
		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_a: regulator-vddcpu-a {
		/*
		 * MP8756GD Regulator.
		 */
		compatible = "pwm-regulator";

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

		pwm-supply = <&main_12v>;

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

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

	vddcpu_b: regulator-vddcpu-b {
		/*
		 * Silergy SY8120B1ABC Regulator.
		 */
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU_B";
		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;
	};

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

		/* Connected to the Hub CHIPENABLE, LOW sets low power state */
		gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	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 GPIOH_6 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";
		model = "ODROID-N2";
		audio-widgets = "Line", "Lineout";
		audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
				 <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
				 <&dio2133>;
		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_LB IN 1", "TDM_B Loopback",
				"TDMIN_A IN 5", "TDM_C Loopback",
				"TDMIN_B IN 5", "TDM_C Loopback",
				"TDMIN_C IN 5", "TDM_C Loopback",
				"TDMIN_LB IN 2", "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",
				"TODDR_A IN 6", "TDMIN_LB OUT",
				"TODDR_B IN 6", "TDMIN_LB OUT",
				"TODDR_C IN 6", "TDMIN_LB OUT",
				"U19 INL", "ACODEC LOLP",
				"U19 INR", "ACODEC LORP",
				"Lineout", "U19 OUTL",
				"Lineout", "U19 OUTR";

		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";
};

&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_b>;
	operating-points-v2 = <&cpu_opp_table_0>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu_b>;
	operating-points-v2 = <&cpu_opp_table_0>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu100 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu101 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu102 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu103 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

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

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

&ddr_thermal {
	trips {
		ddr_active: ddr-active {
			temperature = <60000>; /* millicelsius */
			hysteresis = <2000>; /* millicelsius */
			type = "active";
		};
	};

	cooling-maps {
		map {
			trip = <&ddr_active>;
			cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};

&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 */
		"", "", "", "", "", "", "", "",
		"",
		/* BOOT */
		"", "", "", "", "", "", "", "",
		"", "", "", "", "", "", "", "",
		/* GPIOC */
		"", "", "", "", "", "", "", "",
		/* GPIOA */
		"PIN_44", /* GPIOA_0 */
		"PIN_46", /* GPIOA_1 */
		"PIN_45", /* GPIOA_2 */
		"PIN_47", /* GPIOA_3 */
		"PIN_26", /* GPIOA_4 */
		"", "", "", "", "", "",
		"PIN_42", /* GPIOA_11 */
		"PIN_32", /* GPIOA_12 */
		"PIN_7",  /* GPIOA_13 */
		"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_33", /* GPIOX_5 */
		"PIN_35", /* 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_36"; /* GPIOX_19 */
	/*
	 * WARNING: The USB Hub on the Odroid-N2 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";
	};
};

&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";
	linux,rc-map-name = "rc-odroid";
};

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

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

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

&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;

	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>;
};

/*
 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR pins
 * 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.
 * The SW1 slide should also be set to the correct position.
 */
&spifc {
	status = "disabled";
	pinctrl-0 = <&nor_pins>;
	pinctrl-names = "default";

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

&tdmif_b {
	status = "okay";
};

&tdmif_c {
	status = "okay";
};

&tdmin_a {
	status = "okay";
};

&tdmin_b {
	status = "okay";
};

&tdmin_c {
	status = "okay";
};

&tdmin_lb {
	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";
	vbus-supply = <&usb_pwr_en>;
};

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

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


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>
 */

/dts-v1/;

#include "meson-g12b-s922x.dtsi"
#include "meson-khadas-vim3.dtsi"
#include "meson-g12b-khadas-vim3.dtsi"

/ {
	compatible = "khadas,vim3", "amlogic,s922x", "amlogic,g12b";
};

/*
 * 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";
};
 */


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>
 */

/dts-v1/;

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

/ {
	compatible = "ugoos,am6", "amlogic,s922x", "amlogic,g12b";
	model = "Ugoos AM6";

	spdif_dit: audio-codec-1 {
		#sound-dai-cells = <0>;
		compatible = "linux,spdif-dit";
		status = "okay";
		sound-name-prefix = "DIT";
	};

	sound {
		compatible = "amlogic,axg-sound-card";
		model = "UGOOS-AM6";
		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",
				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
				"SPDIFOUT IN 2", "FRDDR_C OUT 3";

		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>;
			};
		};

		/* spdif hdmi or toslink interface */
		dai-link-4 {
			sound-dai = <&spdifout>;

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

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

		/* spdif hdmi interface */
		dai-link-5 {
			sound-dai = <&spdifout_b>;

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

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

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

&arb {
	status = "okay";
};

&clkc_audio {
	status = "okay";
};

&frddr_a {
	status = "okay";
};

&frddr_b {
	status = "okay";
};

&frddr_c {
	status = "okay";
};

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

&spdifout {
	pinctrl-0 = <&spdif_out_h_pins>;
	pinctrl-names = "default";
	status = "okay";
};

&spdifout_b {
	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";
	};
};

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

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

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

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


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>
 */

/dts-v1/;

#include "meson-g12b.dtsi"
#include "meson-g12b-s922x.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/meson-g12a-gpio.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>;
	};

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

	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 = "VCC_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		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_a: regulator-vddcpu-a {
		/*
		 * MP1653 Regulator.
		 */
		compatible = "pwm-regulator";

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

		pwm-supply = <&main_12v>;

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

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

	vddcpu_b: regulator-vddcpu-b {
		/*
		 * MP1652 Regulator.
		 */
		compatible = "pwm-regulator";

		regulator-name = "VDDCPU_B";
		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;
	};

	usb1_pow: regulator-usb1-pow {
		compatible = "regulator-fixed";
		regulator-name = "USB1_POW";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&vcc_5v>;

		/* connected to SY6280A Power Switch */
		gpio = <&gpio GPIOA_8 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	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 USB3 Type-A Port power enable */
		gpio = <&gpio GPIOAO_7 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;
	};

	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>;
			};
		};
	};

	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_b>;
	operating-points-v2 = <&cpu_opp_table_0>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu1 {
	cpu-supply = <&vddcpu_b>;
	operating-points-v2 = <&cpu_opp_table_0>;
	clocks = <&clkc CLKID_CPU_CLK>;
	clock-latency = <50000>;
};

&cpu100 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu101 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu102 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_CLK>;
	clock-latency = <50000>;
};

&cpu103 {
	cpu-supply = <&vddcpu_a>;
	operating-points-v2 = <&cpub_opp_table_1>;
	clocks = <&clkc CLKID_CPUB_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>;

		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>;
};

&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_ab {
	pinctrl-0 = <&pwm_a_e_pins>;
	pinctrl-names = "default";
	clocks = <&xtal>;
	clock-names = "clkin0";
	status = "okay";
};

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

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

/* 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>;

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

	non-removable;
	disable-wp;

	mmc-pwrseq = <&sdio_pwrseq>;

	vmmc-supply = <&vddao_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 = <&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;
	max-frequency = <100000000>;
	disable-wp;

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

&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";
};

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

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

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


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

#include "meson-g12.dtsi"

/ {
	compatible = "amlogic,g12b";

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

		cpu-map {
			cluster0 {
				core0 {
					cpu = <&cpu0>;
				};

				core1 {
					cpu = <&cpu1>;
				};
			};

			cluster1 {
				core0 {
					cpu = <&cpu100>;
				};

				core1 {
					cpu = <&cpu101>;
				};

				core2 {
					cpu = <&cpu102>;
				};

				core3 {
					cpu = <&cpu103>;
				};
			};
		};

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

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

		cpu100: cpu@100 {
			device_type = "cpu";
			compatible = "arm,cortex-a73";
			reg = <0x0 0x100>;
			enable-method = "psci";
			capacity-dmips-mhz = <1024>;
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		cpu101: cpu@101 {
			device_type = "cpu";
			compatible = "arm,cortex-a73";
			reg = <0x0 0x101>;
			enable-method = "psci";
			capacity-dmips-mhz = <1024>;
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		cpu102: cpu@102 {
			device_type = "cpu";
			compatible = "arm,cortex-a73";
			reg = <0x0 0x102>;
			enable-method = "psci";
			capacity-dmips-mhz = <1024>;
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

		cpu103: cpu@103 {
			device_type = "cpu";
			compatible = "arm,cortex-a73";
			reg = <0x0 0x103>;
			enable-method = "psci";
			capacity-dmips-mhz = <1024>;
			next-level-cache = <&l2>;
			#cooling-cells = <2>;
		};

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

&clkc {
	compatible = "amlogic,g12b-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>,
					 <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					 <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					 <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					 <&cpu103 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>,
					 <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					 <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					 <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
					 <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};

&mali {
	dma-coherent;
};

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


code:
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2019 BayLibre SAS.
 * Author: Jerome Brunet <jbrunet@baylibre.com>
 */

/* Libretech Amlogic GX PC form factor - AKA: Tartiflette */

#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/sound/meson-aiu.h>

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

		update-button {
			label = "update";
			linux,code = <KEY_VENDOR>;
			press-threshold-microvolt = <1300000>;
		};
	};

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

	dio2133: analog-amplifier {
		compatible = "simple-audio-amplifier";
		sound-name-prefix = "AU2";
		VCC-supply = <&vcc5v>;
		enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
	};

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

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

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

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

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

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

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

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

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

	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;
	};

	leds {
		compatible = "gpio-leds";

		led-green {
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_DISK_ACTIVITY;
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "disk-activity";
		};

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

	vcc_card: regulator-vcc_card {
		compatible = "regulator-fixed";
		regulator-name = "VCC_CARD";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&vddio_ao3v3>;

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

	vcc5v: regulator-vcc5v {
		compatible = "regulator-fixed";
		regulator-name = "VCC5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		vin-supply = <&ao_5v>;

		gpio = <&gpio GPIOH_3 GPIO_OPEN_DRAIN>;
	};

	vddio_ao18: regulator-vddio_ao18 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO18";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&ao_5v>;
		regulator-always-on;
	};

	vddio_ao3v3: regulator-vddio_ao3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		vin-supply = <&ao_5v>;
		regulator-always-on;
	};

	vddio_boot: regulator-vddio_boot {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_BOOT";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddio_ao3v3>;
		regulator-always-on;
	};

	vddio_card: regulator-vddio-card {
		compatible = "regulator-gpio";
		regulator-name = "VDDIO_CARD";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;

		gpios = <&gpio GPIODV_5 GPIO_ACTIVE_HIGH>;
		gpios-states = <0>;

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

		regulator-settling-time-up-us = <200>;
		regulator-settling-time-down-us = <50000>;
	};

	sound {
		compatible = "amlogic,gx-sound-card";
		model = "LIBRETECH-PC";
		audio-aux-devs = <&dio2133>;
		audio-widgets = "Speaker", "7J4-14 LEFT",
				"Speaker", "7J4-11 RIGHT";
		audio-routing = "AU2 INL", "ACODEC LOLN",
				"AU2 INR", "ACODEC LORN",
				"7J4-14 LEFT", "AU2 OUTL",
				"7J4-11 RIGHT", "AU2 OUTR";
		assigned-clocks = <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>,
				  <&clkc CLKID_MPLL2>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
		};

		dai-link-1 {
			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
			dai-format = "i2s";
			mclk-fs = <256>;

			codec-0 {
				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
			};

			codec-1 {
				sound-dai = <&aiu AIU_ACODEC CTRL_I2S>;
			};
		};

		dai-link-2 {
			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;

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

		dai-link-3 {
			sound-dai = <&aiu AIU_ACODEC CTRL_OUT>;

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

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

&aiu {
	status = "okay";
};

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

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

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

&external_mdio {
	external_phy: ethernet-phy@0 {
		reg = <0>;
		max-speed = <1000>;
		reset-assert-us = <10000>;
		reset-deassert-us = <30000>;
		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
		interrupt-parent = <&gpio_intc>;
		interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
	};
};

&pinctrl_periphs {
	/*
	 * Make sure the reset pin of the usb HUB is driven high to take
	 * it out of reset.
	 */
	usb1_rst_pins: usb1_rst_irq {
		mux {
			groups = "GPIODV_3";
			function = "gpio_periphs";
			bias-disable;
			output-high;
		};
	};

	/* Make sure the phy irq pin is properly configured as input */
	eth_phy_irq_pins: eth_phy_irq {
		mux {
			groups = "GPIOZ_15";
			function = "gpio_periphs";
			bias-disable;
			output-disable;
		};
	};
};

&hdmi_tx {
	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
	pinctrl-names = "default";
	hdmi-supply = <&vcc5v>;
	status = "okay";
};

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

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

&i2c_C {
	pinctrl-0 = <&i2c_c_dv18_pins>;
	pinctrl-names = "default";
	status = "okay";

	rtc: rtc@51 {
		reg = <0x51>;
		compatible = "nxp,pcf8563";
		#clock-cells = <0>;
		clock-output-names = "rtc_clkout";
	};
};

&pwm_AO_ab {
	pinctrl-0 = <&pwm_ao_a_3_pins>;
	pinctrl-names = "default";
	clocks = <&clkc CLKID_FCLK_DIV4>;
	clock-names = "clkin0";
	status = "okay";
};

&pwm_ab {
	pinctrl-0 = <&pwm_b_pins>;
	pinctrl-names = "default";
	clocks = <&clkc CLKID_FCLK_DIV4>;
	clock-names = "clkin0";
	status = "okay";
};

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

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

/* SD card */
&sd_emmc_b {
	pinctrl-0 = <&sdcard_pins>;
	pinctrl-1 = <&sdcard_clk_gate_pins>;
	pinctrl-names = "default", "clk-gate";

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

	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;

	vmmc-supply = <&vcc_card>;
	vqmmc-supply = <&vddio_card>;

	status = "okay";
};

/* eMMC */
&sd_emmc_c {
	pinctrl-0 = <&emmc_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 = <&vddio_ao3v3>;
	vqmmc-supply = <&vddio_boot>;

	status = "okay";
};

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

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

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

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

&usb2_phy0 {
	pinctrl-0 = <&usb1_rst_pins>;
	pinctrl-names = "default";
	phy-supply = <&vcc5v>;
};

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


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

/ {
	gpu_opp_table: opp-table {
		compatible = "operating-points-v2";

		opp-125000000 {
			opp-hz = /bits/ 64 <125000000>;
			opp-microvolt = <950000>;
		};
		opp-250000000 {
			opp-hz = /bits/ 64 <250000000>;
			opp-microvolt = <950000>;
		};
		opp-285714285 {
			opp-hz = /bits/ 64 <285714285>;
			opp-microvolt = <950000>;
		};
		opp-400000000 {
			opp-hz = /bits/ 64 <400000000>;
			opp-microvolt = <950000>;
		};
		opp-500000000 {
			opp-hz = /bits/ 64 <500000000>;
			opp-microvolt = <950000>;
		};
		opp-666666666 {
			opp-hz = /bits/ 64 <666666666>;
			opp-microvolt = <950000>;
		};
		opp-744000000 {
			opp-hz = /bits/ 64 <744000000>;
			opp-microvolt = <950000>;
		};
	};
};

&apb {
	mali: gpu@c0000 {
		compatible = "arm,mali-450";
		reg = <0x0 0xc0000 0x0 0x40000>;
		interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "gp", "gpmmu", "pp", "pmu",
			"pp0", "ppmmu0", "pp1", "ppmmu1",
			"pp2", "ppmmu2";
		operating-points-v2 = <&gpu_opp_table>;
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2016 Endless Computers, Inc.
 * Author: Carlo Caione <carlo@endlessm.com>
 */

/* Common DTSI for same Amlogic Q200/Q201 and P230/P231 boards using either
 * the pin-compatible S912 (GXM) or S905D (GXL) SoCs.
 */

#include <dt-bindings/sound/meson-aiu.h>

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

	dio2133: analog-amplifier {
		compatible = "simple-audio-amplifier";
		sound-name-prefix = "AU2";
		VCC-supply = <&hdmi_5v>;
		enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
	};

	spdif_dit: audio-codec-0 {
		#sound-dai-cells = <0>;
		compatible = "linux,spdif-dit";
		status = "okay";
		sound-name-prefix = "DIT";
	};

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

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

	hdmi_5v: regulator-hdmi-5v {
		compatible = "regulator-fixed";

		regulator-name = "HDMI_5V";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;

		gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		regulator-always-on;
	};

	vddio_ao18: regulator-vddio_ao18 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO18";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
	};

	vddio_boot: regulator-vddio_boot {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_BOOT";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
	};

	vddao_3v3: regulator-vddao_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDDAO_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};

	vcc_3v3: regulator-vcc_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
	};

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

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

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

	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>;
			};
		};
	};

	sound {
		compatible = "amlogic,gx-sound-card";
		model = "P230-Q200";
		audio-aux-devs = <&dio2133>;
		audio-widgets = "Line", "Lineout";
		audio-routing = "AU2 INL", "ACODEC LOLP",
				"AU2 INR", "ACODEC LORP",
				"AU2 INL", "ACODEC LOLN",
				"AU2 INR", "ACODEC LORN",
				"Lineout", "AU2 OUTL",
				"Lineout", "AU2 OUTR";
		assigned-clocks = <&clkc CLKID_MPLL0>,
				  <&clkc CLKID_MPLL1>,
				  <&clkc CLKID_MPLL2>;
		assigned-clock-parents = <0>, <0>, <0>;
		assigned-clock-rates = <294912000>,
				       <270950400>,
				       <393216000>;
		status = "okay";

		dai-link-0 {
			sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
		};

		dai-link-1 {
			sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>;
		};

		dai-link-2 {
			sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
			dai-format = "i2s";
			mclk-fs = <256>;

			codec-0 {
				sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
			};

			codec-1 {
				sound-dai = <&aiu AIU_ACODEC CTRL_I2S>;
			};
		};

		dai-link-3 {
			sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>;

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

		dai-link-4 {
			sound-dai = <&aiu AIU_HDMI CTRL_OUT>;

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

		dai-link-5 {
			sound-dai = <&aiu AIU_ACODEC CTRL_OUT>;

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

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

&aiu {
	status = "okay";
	pinctrl-0 = <&spdif_out_h_pins>;
	pinctrl-names = "default";

};

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

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

&ethmac {
	status = "okay";
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
	pinctrl-names = "default";
	hdmi-supply = <&hdmi_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_ef {
	status = "okay";
	pinctrl-0 = <&pwm_e_pins>;
	pinctrl-names = "default";
	clocks = <&clkc CLKID_FCLK_DIV4>;
	clock-names = "clkin0";
};

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

/* Wireless SDIO Module */
&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 = <50000000>;

	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_boot>;
};

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

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

	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;

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

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

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

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

/* This UART is brought out to the DB9 connector */
&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

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