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

/dts-v1/;

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

#include "meson-gxl-s905d.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "amlogic,p230", "amlogic,s905d", "amlogic,meson-gxl";
	model = "Amlogic Meson GXL (S905D) P230 Development Board";

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

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

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

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

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

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

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

/* P230 has exclusive choice between internal or external PHY */
&ethmac {
	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	/* Select external PHY by default */
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	/* External PHY is in RGMII */
	phy-mode = "rgmii";
};

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

		/* External PHY reset is shared with internal PHY Led signal */
		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;

		interrupt-parent = <&gpio_intc>;
		interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
		eee-broken-1000t;
	};
};

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

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

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


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

/dts-v1/;

#include "meson-gxl-s905d.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "amlogic,p231", "amlogic,s905d", "amlogic,meson-gxl";
	model = "Amlogic Meson GXL (S905D) P231 Development Board";
};

/* P231 has only internal PHY port */
&ethmac {
	phy-mode = "rmii";
	phy-handle = <&internal_phy>;
};

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

repo_name: angery/linux


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2018 He Yangxuan
 */

/dts-v1/;

#include "meson-gxl-s905d-p230.dts"

/ {
	compatible = "phicomm,n1", "amlogic,s905d", "amlogic,meson-gxl";
	model = "Phicomm N1";

	cvbs-connector {
		status = "disabled";
	};

	leds {
		compatible = "gpio-leds";

		status {
			label = "n1:white:status";
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};
	};
};

&cvbs_vdac_port {
	status = "disabled";
};

&usb {
	dr_mode = "host";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-gxl-s905d.dtsi"
#include "meson-gx-p23x-q20x.dtsi"
#include <dt-bindings/leds/common.h>

/ {
	compatible = "smartlabs,sml5442tw", "amlogic,s905d", "amlogic,meson-gxl";
	model = "SmartLabs SML-5442TW";

	leds {
		compatible = "gpio-leds";

		led-yellow {
			color = <LED_COLOR_ID_YELLOW>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		led-blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		led-green {
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};

		led-red {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};
	};
};

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

&i2c_A {
	status = "okay";
	pinctrl-0 = <&i2c_a_pins>;
	pinctrl-names = "default";
};

&internal_phy {
	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
	pinctrl-names = "default";
};

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

/* This is connected to the Bluetooth module: */
&uart_A {
	status = "okay";
	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
	pinctrl-names = "default";
	uart-has-rtscts;

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


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Author: Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-gxl-s905d.dtsi"
#include "meson-gx-p23x-q20x.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "osmc,vero4k-plus", "amlogic,s905d", "amlogic,meson-gxl";
	model = "OSMC Vero 4K Plus";

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

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

	leds {
		compatible = "gpio-leds";

		led-standby {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_POWER;
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_LOW>;
			default-state = "off";
			panic-indicator;
		};
	};
};

&ethmac {
	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	phy-mode = "rgmii-txid";
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <0>;
};

&external_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		pinctrl-0 = <&eth_phy_irq_pin>;
		pinctrl-names = "default";

		reg = <0>;
		max-speed = <1000>;

		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;

		interrupt-parent = <&gpio_intc>;
		interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
	};
};

&pinctrl_periphs {
	/* Ensure the phy irq pin is properly configured as input */
	eth_phy_irq_pin: eth-phy-irq {
		mux {
			groups = "GPIOZ_15";
			function = "gpio_periphs";
			bias-disable;
			output-disable;
		};
	};
};

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

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

&usb {
	dr_mode = "host";
};

&usb2_phy0 {
	/* HDMI_5V also supplies the USB VBUS */
	phy-supply = <&hdmi_5v>;
};

&usb2_phy0 {
	/* HDMI_5V also supplies the USB VBUS */
	phy-supply = <&hdmi_5v>;
};


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

#include "meson-gxl.dtsi"
#include "meson-gxl-mali.dtsi"

/ {
	compatible = "amlogic,s905d", "amlogic,meson-gxl";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2021 Vyacheslav Bocharov <adeep@lexina.in>
 * Copyright (c) 2020 JetHome
 * Author: Aleksandr Kazantsev <ak@tvip.ru>
 * Author: Alexey Shevelkin <ash@tvip.ru>
 * Author: Vyacheslav Bocharov <adeep@lexina.in>
 */

/dts-v1/;

#include "meson-gxl.dtsi"

/ {
	compatible = "jethome,jethub-j80", "amlogic,s905w", "amlogic,meson-gxl";
	model = "JetHome JetHub J80";
	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>;
	};

	reserved-memory {
		linux,cma {
			size = <0x0 0x1000000>;
		};
	};

	aliases {
		serial0 = &uart_AO;   /* Console */
		serial1 = &uart_A;    /* Bluetooth */
		serial2 = &uart_AO_B; /* Wireless module 1 */
		serial3 = &uart_C;    /* Wireless module 2 */
		ethernet0 = &ethmac;
	};

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

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

&efuse {
	bt_mac: bt_mac@6 {
		reg = <0x6 0x6>;
	};

	wifi_mac: wifi_mac@C {
		reg = <0xc 0x6>;
	};
};

&sn {
	reg = <0x32 0x20>;
};

&eth_mac {
	reg = <0x0 0x6>;
};

&bid {
	reg = <0x12 0x20>;
};

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

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

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

/* S905W only has access to its internal PHY */
&ethmac {
	status = "okay";
	phy-mode = "rmii";
	phy-handle = <&internal_phy>;
};

&internal_phy {
	status = "okay";
	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
	pinctrl-names = "default";
};

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

	bluetooth {
		compatible = "realtek,rtl8822cs-bt";
		enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
		host-wake-gpios = <&gpio GPIOX_18 GPIO_ACTIVE_HIGH>;
       };
};

&uart_C {
	status = "okay";
	pinctrl-0 = <&uart_c_pins>;
	pinctrl-names = "default";
};

&uart_AO_B {
	status = "okay";
	pinctrl-0 = <&uart_ao_b_pins>, <&uart_ao_b_cts_rts_pins>;
	pinctrl-names = "default";
	uart-has-rtscts;
};

&i2c_B {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c_b_pins>;

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


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2018 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
 * Based on meson-gxl-s905d-p231.dts:
 * - Copyright (c) 2016 Endless Computers, Inc.
 *   Author: Carlo Caione <carlo@endlessm.com>
 */

/dts-v1/;

#include "meson-gxl-s905x.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "amlogic,p281", "amlogic,s905w", "amlogic,meson-gxl";
	model = "Amlogic Meson GXL (S905W) P281 Development Board";

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

&usb {
	dr_mode = "host";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2018 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
 * Based on meson-gxl-s905d-p231.dts:
 * - Copyright (c) 2016 Endless Computers, Inc.
 *   Author: Carlo Caione <carlo@endlessm.com>
 */

/dts-v1/;

#include "meson-gxl-s905x.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "oranth,tx3-mini", "amlogic,s905w", "amlogic,meson-gxl";
	model = "Oranth Tanix TX3 Mini";

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x40000000>; /* 1 GiB or 2 GiB */
	};
};

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

&usb {
	dr_mode = "host";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2017 Carlo Caione
 * Copyright (c) 2016 BayLibre, Inc.
 * Author: Neil Armstrong <narmstrong@kernel.org>
 */

/dts-v1/;

#include "meson-gxl-s905x.dtsi"

/ {
	compatible = "hwacom,amazetv", "amlogic,s905x", "amlogic,meson-gxl";
	model = "Hwacom AmazeTV (S905X)";

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

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

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

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

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

		gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
		gpios-states = <1>;

		/* Based on P200 schematics, signal CARD_1.8V/3.3V_CTR */
		states = <1800000 0>,
			 <3300000 1>;
	};

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

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

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

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

/* 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 = <100000000>;
	disable-wp;

	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;

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

/* 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 = <100000000>;
	non-removable;
	disable-wp;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;

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

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


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
 */

/dts-v1/;

#include "meson-gxl-s905x-p212.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/sound/meson-aiu.h>

/ {
	compatible = "khadas,vim", "amlogic,s905x", "amlogic,meson-gxl";
	model = "Khadas VIM";

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

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

	aliases {
		serial2 = &uart_AO_B;
		ethernet0 = &ethmac;
	};

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

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

		led-1 {
			label = "vim:red:power";
			pwms = <&pwm_AO_ab 1 7812500 0>;
			max-brightness = <255>;
			linux,default-trigger = "default-on";
		};
	};

	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 = "KHADAS-VIM";
		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>;
			};
		};

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

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

&aiu {
	status = "okay";
};

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

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

&i2c_A {
	status = "okay";
	pinctrl-0 = <&i2c_a_pins>;
	pinctrl-names = "default";
};

&i2c_B {
	status = "okay";
	pinctrl-0 = <&i2c_b_pins>;
	pinctrl-names = "default";

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

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

&gpio_ao {
	gpio-line-names = "UART TX",
			  "UART RX",
			  "Power Key In",
			  "J9 Header Pin35",
			  "J9 Header Pin16",
			  "J9 Header Pin15",
			  "J9 Header Pin33",
			  "IR In",
			  "HDMI CEC",
			  "SYS LED",
			  /* GPIO_TEST_N */
			  "";
};

&gpio {
	gpio-line-names = /* Bank GPIOZ */
			  "", "", "", "", "", "", "",
			  "", "", "", "", "", "", "",
			  "Power OFF",
			  "VCCK Enable",
			  /* Bank GPIOH */
			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
			  "HDMI_5V_EN", "SPDIF",
			  "J9 Header Pin37",
			  "J9 Header Pin30",
			  "J9 Header Pin29",
			  "J9 Header Pin32",
			  "J9 Header Pin31",
			  /* Bank BOOT */
			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
			  "", "BOOT_MODE", "", "", "eMMC Data Strobe",
			  /* Bank CARD */
			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
			  "SDCard D3", "SDCard D2", "SDCard Det",
			  /* Bank GPIODV */
			  "", "", "", "", "", "", "", "", "", "", "", "",
			  "", "", "", "", "", "", "", "", "", "", "", "",
			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
			  "VCCK Regulator", "VDDEE Regulator",
			  /* Bank GPIOX */
			  "WIFI SDIO D0", "WIFI SDIO D1", "WIFI SDIO D2",
			  "WIFI SDIO D3", "WIFI SDIO CLK", "WIFI SDIO CMD",
			  "WIFI Power Enable", "WIFI WAKE HOST",
			  "Bluetooth PCM DOUT", "Bluetooth PCM DIN",
			  "Bluetooth PCM SYNC", "Bluetooth PCM CLK",
			  "Bluetooth UART TX", "Bluetooth UART RX",
			  "Bluetooth UART CTS", "Bluetooth UART RTS",
			  "WIFI 32K", "Bluetooth Enable",
			  "Bluetooth WAKE HOST",
			  /* Bank GPIOCLK */
			  "", "J9 Header Pin39";
};

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

&pwm_ef {
	pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
};

&sd_emmc_a {
	max-frequency = <100000000>;

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

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

/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
&uart_AO {
	status = "okay";
};

/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
&uart_AO_B {
	status = "okay";
	pinctrl-0 = <&uart_ao_b_pins>;
	pinctrl-names = "default";
};

&usb {
	dr_mode = "peripheral";
};


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

/dts-v1/;

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

#include "meson-gxl-s905x.dtsi"

/ {
	compatible = "libretech,aml-s905x-cc-v2", "amlogic,s905x",
		     "amlogic,meson-gxl";
	model = "Libre Computer AML-S905X-CC V2";

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

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

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

	leds {
		compatible = "gpio-leds";

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

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

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

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

	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 GPIOCLK_1 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_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_card: regulator-vddio-card {
		compatible = "regulator-gpio";
		regulator-name = "VDDIO_CARD";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <3300000>;

		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
		gpios-states = <0>;

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

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

	vddio_ao18: regulator-vddio_ao18 {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_AO18";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vddio_ao3v3>;
		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 = <&vddio_ao3v3>;
		regulator-always-on;
	};

	sound {
		compatible = "amlogic,gx-sound-card";
		model = "LIBRETECH-CC-V2";
		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>;
			};
		};

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

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

&aiu {
	status = "okay";
};

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

&ethmac {
	status = "okay";
};

&internal_phy {
	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
	pinctrl-names = "default";
};

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

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

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

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

/* 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 = <100000000>;
	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-hs200-1_8v;
	max-frequency = <200000000>;
	disable-wp;

	mmc-pwrseq = <&emmc_pwrseq>;
	vmmc-supply = <&vddio_ao3v3>;
	vqmmc-supply = <&vcc_1v8>;

	status = "okay";
};

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

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

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

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

&usb2_phy0 {
	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>
 * Author: Jerome Brunet <jbrunet@baylibre.com>
 */

/dts-v1/;

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

#include "meson-gxl-s905x.dtsi"

/ {
	compatible = "libretech,aml-s905x-cc", "amlogic,s905x",
		     "amlogic,meson-gxl";
	model = "Libre Computer AML-S905X-CC";

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

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

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

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

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

	leds {
		compatible = "gpio-leds";

		led-system {
			label = "librecomputer:system-status";
			gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
			default-state = "on";
			panic-indicator;
		};

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

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

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

	vcc_card: regulator-vcc-card {
		compatible = "regulator-gpio";

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

		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
		gpios-states = <0>;

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

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

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

	/* This is provided by LDOs on the eMMC daugther card */
	vddio_boot: regulator-vddio_boot {
		compatible = "regulator-fixed";
		regulator-name = "VDDIO_BOOT";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		vin-supply = <&vcc_3v3>;
	};

	sound {
		compatible = "amlogic,gx-sound-card";
		model = "LIBRETECH-CC";
		audio-aux-devs = <&dio2133>;
		audio-widgets = "Line", "Lineout";
		audio-routing = "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_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 {
	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";
};

&internal_phy {
	pinctrl-0 = <&eth_link_led_pins>, <&eth_act_led_pins>;
	pinctrl-names = "default";
};

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

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

&gpio_ao {
	gpio-line-names = "UART TX",
			  "UART RX",
			  "Blue LED",
			  "SDCard Voltage Switch",
			  "7J1 Header Pin5",
			  "7J1 Header Pin3",
			  "7J1 Header Pin12",
			  "IR In",
			  "9J3 Switch HDMI CEC/7J1 Header Pin11",
			  "7J1 Header Pin13",
			  /* GPIO_TEST_N */
			  "7J1 Header Pin15";
};

&gpio {
	gpio-line-names = /* Bank GPIOZ */
			  "", "", "", "", "", "", "",
			  "", "", "", "", "", "", "",
			  "Eth Link LED", "Eth Activity LED",
			  /* Bank GPIOH */
			  "HDMI HPD", "HDMI SDA", "HDMI SCL",
			  "HDMI_5V_EN", "9J1 Header Pin2",
			  "Analog Audio Mute",
			  "2J3 Header Pin6",
			  "2J3 Header Pin5",
			  "2J3 Header Pin4",
			  "2J3 Header Pin3",
			  /* Bank BOOT */
			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3",
			  "eMMC D4", "eMMC D5", "eMMC D6", "eMMC D7",
			  "eMMC Clk", "eMMC Reset", "eMMC CMD",
			  "ALT BOOT MODE", "", "", "", "eMMC Data Strobe",
			  /* Bank CARD */
			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
			  "SDCard D3", "SDCard D2", "SDCard Det",
			  /* Bank GPIODV */
			  "", "", "", "", "", "", "", "", "", "", "", "",
			  "", "", "", "", "", "", "", "", "", "", "", "",
			  "Green LED", "VCCK Enable",
			  "7J1 Header Pin27", "7J1 Header Pin28",
			  "VCCK Regulator", "VDDEE Regulator",
			  /* Bank GPIOX */
			  "7J1 Header Pin22", "7J1 Header Pin26",
			  "7J1 Header Pin36", "7J1 Header Pin38",
			  "7J1 Header Pin40", "7J1 Header Pin37",
			  "7J1 Header Pin33", "7J1 Header Pin35",
			  "7J1 Header Pin19", "7J1 Header Pin21",
			  "7J1 Header Pin24", "7J1 Header Pin23",
			  "7J1 Header Pin8", "7J1 Header Pin10",
			  "7J1 Header Pin16", "7J1 Header Pin18",
			  "7J1 Header Pin32", "7J1 Header Pin29",
			  "7J1 Header Pin31",
			  /* Bank GPIOCLK */
			  "7J1 Header Pin7", "";
};

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

/* 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 = <&vcc_3v3>;
	vqmmc-supply = <&vcc_card>;
};

/* 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;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	max-frequency = <200000000>;
	disable-wp;

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

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

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

&usb2_phy0 {
	/*
	 * even though the schematics don't show it:
	 * HDMI_5V is also used as supply for the USB VBUS.
	 */
	phy-supply = <&hdmi_5v>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2016 Andreas Färber
 * Copyright (c) 2016 BayLibre, Inc.
 * Author: Neil Armstrong <narmstrong@kernel.org>
 */

/dts-v1/;

#include "meson-gxl-s905x.dtsi"

/ {
	compatible = "nexbox,a95x", "amlogic,s905x", "amlogic,meson-gxl";
	model = "NEXBOX A95X (S905X)";

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

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

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

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

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

		gpios = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
		gpios-states = <1>;

		/* Based on P200 schematics, signal CARD_1.8V/3.3V_CTR */
		states = <1800000 0>,
			 <3300000 1>;
	};

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

&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";
	phy-mode = "rmii";
	phy-handle = <&internal_phy>;
};

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

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

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

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

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


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

/dts-v1/;

#include "meson-gxl-s905x-p212.dtsi"

/ {
	compatible = "amlogic,p212", "amlogic,s905x", "amlogic,meson-gxl";
	model = "Amlogic Meson GXL (S905X) P212 Development Board";

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

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

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

/* This UART is brought out to the DB9 connector */
&uart_AO {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2016 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
 * Based on meson-gx-p23x-q20x.dtsi:
 * - Copyright (c) 2016 Endless Computers, Inc.
 *   Author: Carlo Caione <carlo@endlessm.com>
 * - Copyright (c) 2016 BayLibre, SAS.
 *   Author: Neil Armstrong <narmstrong@baylibre.com>
 */

/* Common DTSI for devices which are based on the P212 reference board. */

#include "meson-gxl-s905x.dtsi"

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

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

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

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

&ethmac {
	status = "okay";
};

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

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

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

/* This is connected to the Bluetooth module: */
&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";
};

&usb2_phy0 {
	/*
	 * HDMI_5V is also used as supply for the USB VBUS.
	 */
	phy-supply = <&hdmi_5v>;
};


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

#include "meson-gxl.dtsi"
#include "meson-gxl-mali.dtsi"

/ {
	compatible = "amlogic,s905x", "amlogic,meson-gxl";
};

/* S905X only has access to its internal PHY */
&ethmac {
	phy-mode = "rmii";
	phy-handle = <&internal_phy>;
};


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

#include "meson-gx.dtsi"
#include <dt-bindings/clock/gxbb-clkc.h>
#include <dt-bindings/clock/gxbb-aoclkc.h>
#include <dt-bindings/gpio/meson-gxl-gpio.h>
#include <dt-bindings/reset/amlogic,meson-gxbb-reset.h>

/ {
	compatible = "amlogic,meson-gxl";

	soc {
		usb: usb@d0078080 {
			compatible = "amlogic,meson-gxl-usb-ctrl";
			reg = <0x0 0xd0078080 0x0 0x20>;
			interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <2>;
			#size-cells = <2>;
			ranges;

			clocks = <&clkc CLKID_USB>, <&clkc CLKID_USB1_DDR_BRIDGE>;
			clock-names = "usb_ctrl", "ddr";
			resets = <&reset RESET_USB_OTG>;

			dr_mode = "otg";

			phys = <&usb2_phy0>, <&usb2_phy1>;
			phy-names = "usb2-phy0", "usb2-phy1";

			dwc2: usb@c9100000 {
				compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
				reg = <0x0 0xc9100000 0x0 0x40000>;
				interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
				clocks = <&clkc CLKID_USB1>;
				clock-names = "otg";
				phys = <&usb2_phy1>;
				dr_mode = "peripheral";
				g-rx-fifo-size = <192>;
				g-np-tx-fifo-size = <128>;
				g-tx-fifo-size = <128 128 16 16 16>;
			};

			dwc3: usb@c9000000 {
				compatible = "snps,dwc3";
				reg = <0x0 0xc9000000 0x0 0x100000>;
				interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
				dr_mode = "host";
				maximum-speed = "high-speed";
				snps,dis_u2_susphy_quirk;
			};
		};

		acodec: audio-controller@c8832000 {
			compatible = "amlogic,t9015";
			reg = <0x0 0xc8832000 0x0 0x14>;
			#sound-dai-cells = <0>;
			sound-name-prefix = "ACODEC";
			clocks = <&clkc CLKID_ACODEC>;
			clock-names = "pclk";
			resets = <&reset RESET_ACODEC>;
			status = "disabled";
		};

		crypto: crypto@c883e000 {
			compatible = "amlogic,gxl-crypto";
			reg = <0x0 0xc883e000 0x0 0x36>;
			interrupts = <GIC_SPI 188 IRQ_TYPE_EDGE_RISING>,
				     <GIC_SPI 189 IRQ_TYPE_EDGE_RISING>;
			clocks = <&clkc CLKID_BLKMV>;
			clock-names = "blkmv";
			status = "okay";
		};
	};
};

&aiu {
	compatible = "amlogic,aiu-gxl", "amlogic,aiu";
	clocks = <&clkc CLKID_AIU_GLUE>,
		 <&clkc CLKID_I2S_OUT>,
		 <&clkc CLKID_AOCLK_GATE>,
		 <&clkc CLKID_CTS_AMCLK>,
		 <&clkc CLKID_MIXER_IFACE>,
		 <&clkc CLKID_IEC958>,
		 <&clkc CLKID_IEC958_GATE>,
		 <&clkc CLKID_CTS_MCLK_I958>,
		 <&clkc CLKID_CTS_I958>;
	clock-names = "pclk",
		      "i2s_pclk",
		      "i2s_aoclk",
		      "i2s_mclk",
		      "i2s_mixer",
		      "spdif_pclk",
		      "spdif_aoclk",
		      "spdif_mclk",
		      "spdif_mclk_sel";
	resets = <&reset RESET_AIU>;
};

&apb {
	usb2_phy0: phy@78000 {
		compatible = "amlogic,meson-gxl-usb2-phy";
		#phy-cells = <0>;
		reg = <0x0 0x78000 0x0 0x20>;
		clocks = <&clkc CLKID_USB>;
		clock-names = "phy";
		resets = <&reset RESET_USB_OTG>;
		reset-names = "phy";
		status = "okay";
	};

	usb2_phy1: phy@78020 {
		compatible = "amlogic,meson-gxl-usb2-phy";
		#phy-cells = <0>;
		reg = <0x0 0x78020 0x0 0x20>;
		clocks = <&clkc CLKID_USB>;
		clock-names = "phy";
		resets = <&reset RESET_USB_OTG>;
		reset-names = "phy";
		status = "okay";
	};
};

&efuse {
	clocks = <&clkc CLKID_EFUSE>;
};

&ethmac {
	clocks = <&clkc CLKID_ETH>,
		 <&clkc CLKID_FCLK_DIV2>,
		 <&clkc CLKID_MPLL2>,
		 <&clkc CLKID_FCLK_DIV2>;
	clock-names = "stmmaceth", "clkin0", "clkin1", "timing-adjustment";

	mdio0: mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
	};
};

&aobus {
	pinctrl_aobus: pinctrl@14 {
		compatible = "amlogic,meson-gxl-aobus-pinctrl";
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		gpio_ao: bank@14 {
			reg = <0x0 0x00014 0x0 0x8>,
			      <0x0 0x0002c 0x0 0x4>,
			      <0x0 0x00024 0x0 0x8>;
			reg-names = "mux", "pull", "gpio";
			gpio-controller;
			#gpio-cells = <2>;
			gpio-ranges = <&pinctrl_aobus 0 0 14>;
		};

		uart_ao_a_pins: uart_ao_a {
			mux {
				groups = "uart_tx_ao_a", "uart_rx_ao_a";
				function = "uart_ao";
				bias-disable;
			};
		};

		uart_ao_a_cts_rts_pins: uart_ao_a_cts_rts {
			mux {
				groups = "uart_cts_ao_a",
				       "uart_rts_ao_a";
				function = "uart_ao";
				bias-disable;
			};
		};

		uart_ao_b_pins: uart_ao_b {
			mux {
				groups = "uart_tx_ao_b", "uart_rx_ao_b";
				function = "uart_ao_b";
				bias-disable;
			};
		};

		uart_ao_b_0_1_pins: uart_ao_b_0_1 {
			mux {
				groups = "uart_tx_ao_b_0", "uart_rx_ao_b_1";
				function = "uart_ao_b";
				bias-disable;
			};
		};

		uart_ao_b_cts_rts_pins: uart_ao_b_cts_rts {
			mux {
				groups = "uart_cts_ao_b",
				       "uart_rts_ao_b";
				function = "uart_ao_b";
				bias-disable;
			};
		};

		remote_input_ao_pins: remote_input_ao {
			mux {
				groups = "remote_input_ao";
				function = "remote_input_ao";
				bias-disable;
			};
		};

		i2c_ao_pins: i2c_ao {
			mux {
				groups = "i2c_sck_ao",
				       "i2c_sda_ao";
				function = "i2c_ao";
				bias-disable;
			};
		};

		pwm_ao_a_3_pins: pwm_ao_a_3 {
			mux {
				groups = "pwm_ao_a_3";
				function = "pwm_ao_a";
				bias-disable;
			};
		};

		pwm_ao_a_8_pins: pwm_ao_a_8 {
			mux {
				groups = "pwm_ao_a_8";
				function = "pwm_ao_a";
				bias-disable;
			};
		};

		pwm_ao_b_pins: pwm_ao_b {
			mux {
				groups = "pwm_ao_b";
				function = "pwm_ao_b";
				bias-disable;
			};
		};

		pwm_ao_b_6_pins: pwm_ao_b_6 {
			mux {
				groups = "pwm_ao_b_6";
				function = "pwm_ao_b";
				bias-disable;
			};
		};

		i2s_out_ch23_ao_pins: i2s_out_ch23_ao {
			mux {
				groups = "i2s_out_ch23_ao";
				function = "i2s_out_ao";
				bias-disable;
			};
		};

		i2s_out_ch45_ao_pins: i2s_out_ch45_ao {
			mux {
				groups = "i2s_out_ch45_ao";
				function = "i2s_out_ao";
				bias-disable;
			};
		};

		spdif_out_ao_6_pins: spdif_out_ao_6 {
			mux {
				groups = "spdif_out_ao_6";
				function = "spdif_out_ao";
				bias-disable;
			};
		};

		spdif_out_ao_9_pins: spdif_out_ao_9 {
			mux {
				groups = "spdif_out_ao_9";
				function = "spdif_out_ao";
				bias-disable;
			};
		};

		ao_cec_pins: ao_cec {
			mux {
				groups = "ao_cec";
				function = "cec_ao";
				bias-disable;
			};
		};

		ee_cec_pins: ee_cec {
			mux {
				groups = "ee_cec";
				function = "cec_ao";
				bias-disable;
			};
		};
	};
};

&cec_AO {
	clocks = <&clkc_AO CLKID_AO_CEC_32K>;
	clock-names = "core";
};

&clkc_AO {
	compatible = "amlogic,meson-gxl-aoclkc", "amlogic,meson-gx-aoclkc";
	clocks = <&xtal>, <&clkc CLKID_CLK81>;
	clock-names = "xtal", "mpeg-clk";
};

&gpio_intc {
	compatible = "amlogic,meson-gpio-intc",
		     "amlogic,meson-gxl-gpio-intc";
	status = "okay";
};

&hdmi_tx {
	compatible = "amlogic,meson-gxl-dw-hdmi", "amlogic,meson-gx-dw-hdmi";
	resets = <&reset RESET_HDMITX_CAPB3>,
		 <&reset RESET_HDMI_SYSTEM_RESET>,
		 <&reset RESET_HDMI_TX>;
	reset-names = "hdmitx_apb", "hdmitx", "hdmitx_phy";
	clocks = <&clkc CLKID_HDMI_PCLK>,
		 <&clkc CLKID_CLK81>,
		 <&clkc CLKID_GCLK_VENCI_INT0>;
	clock-names = "isfr", "iahb", "venci";
};

&sysctrl {
	clkc: clock-controller {
		compatible = "amlogic,gxl-clkc";
		#clock-cells = <1>;
		clocks = <&xtal>;
		clock-names = "xtal";
	};
};

&hwrng {
	clocks = <&clkc CLKID_RNG0>;
	clock-names = "core";
};

&i2c_A {
	clocks = <&clkc CLKID_I2C>;
};

&i2c_AO {
	clocks = <&clkc CLKID_AO_I2C>;
};

&i2c_B {
	clocks = <&clkc CLKID_I2C>;
};

&i2c_C {
	clocks = <&clkc CLKID_I2C>;
};

&periphs {
	pinctrl_periphs: pinctrl@4b0 {
		compatible = "amlogic,meson-gxl-periphs-pinctrl";
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		gpio: bank@4b0 {
			reg = <0x0 0x004b0 0x0 0x28>,
			      <0x0 0x004e8 0x0 0x14>,
			      <0x0 0x00520 0x0 0x14>,
			      <0x0 0x00430 0x0 0x40>;
			reg-names = "mux", "pull", "pull-enable", "gpio";
			gpio-controller;
			#gpio-cells = <2>;
			gpio-ranges = <&pinctrl_periphs 0 0 100>;
		};

		emmc_pins: emmc {
			mux-0 {
				groups = "emmc_nand_d07",
				       "emmc_cmd";
				function = "emmc";
				bias-pull-up;
			};

			mux-1 {
				groups = "emmc_clk";
				function = "emmc";
				bias-disable;
			};
		};

		emmc_ds_pins: emmc-ds {
			mux {
				groups = "emmc_ds";
				function = "emmc";
				bias-pull-down;
			};
		};

		emmc_clk_gate_pins: emmc_clk_gate {
			mux {
				groups = "BOOT_8";
				function = "gpio_periphs";
				bias-pull-down;
			};
		};

		nor_pins: nor {
			mux {
				groups = "nor_d",
				       "nor_q",
				       "nor_c",
				       "nor_cs";
				function = "nor";
				bias-disable;
			};
		};

		spi_pins: spi-pins {
			mux {
				groups = "spi_miso",
					"spi_mosi",
					"spi_sclk";
				function = "spi";
				bias-disable;
			};
		};

		spi_idle_high_pins: spi-idle-high-pins {
			mux {
				groups = "spi_sclk";
				bias-pull-up;
			};
		};

		spi_idle_low_pins: spi-idle-low-pins {
			mux {
				groups = "spi_sclk";
				bias-pull-down;
			};
		};

		spi_ss0_pins: spi-ss0 {
			mux {
				groups = "spi_ss0";
				function = "spi";
				bias-disable;
			};
		};

		sdcard_pins: sdcard {
			mux-0 {
				groups = "sdcard_d0",
				       "sdcard_d1",
				       "sdcard_d2",
				       "sdcard_d3",
				       "sdcard_cmd";
				function = "sdcard";
				bias-pull-up;
			};

			mux-1 {
				groups = "sdcard_clk";
				function = "sdcard";
				bias-disable;
			};
		};

		sdcard_clk_gate_pins: sdcard_clk_gate {
			mux {
				groups = "CARD_2";
				function = "gpio_periphs";
				bias-pull-down;
			};
		};

		sdio_pins: sdio {
			mux-0 {
				groups = "sdio_d0",
				       "sdio_d1",
				       "sdio_d2",
				       "sdio_d3",
				       "sdio_cmd";
				function = "sdio";
				bias-pull-up;
			};

			mux-1 {
				groups = "sdio_clk";
				function = "sdio";
				bias-disable;
			};
		};

		sdio_clk_gate_pins: sdio_clk_gate {
			mux {
				groups = "GPIOX_4";
				function = "gpio_periphs";
				bias-pull-down;
			};
		};

		sdio_irq_pins: sdio_irq {
			mux {
				groups = "sdio_irq";
				function = "sdio";
				bias-disable;
			};
		};

		uart_a_pins: uart_a {
			mux {
				groups = "uart_tx_a",
				       "uart_rx_a";
				function = "uart_a";
				bias-disable;
			};
		};

		uart_a_cts_rts_pins: uart_a_cts_rts {
			mux {
				groups = "uart_cts_a",
				       "uart_rts_a";
				function = "uart_a";
				bias-disable;
			};
		};

		uart_b_pins: uart_b {
			mux {
				groups = "uart_tx_b",
				       "uart_rx_b";
				function = "uart_b";
				bias-disable;
			};
		};

		uart_b_cts_rts_pins: uart_b_cts_rts {
			mux {
				groups = "uart_cts_b",
				       "uart_rts_b";
				function = "uart_b";
				bias-disable;
			};
		};

		uart_c_pins: uart_c {
			mux {
				groups = "uart_tx_c",
				       "uart_rx_c";
				function = "uart_c";
				bias-disable;
			};
		};

		uart_c_cts_rts_pins: uart_c_cts_rts {
			mux {
				groups = "uart_cts_c",
				       "uart_rts_c";
				function = "uart_c";
				bias-disable;
			};
		};

		i2c_a_pins: i2c_a {
			mux {
				groups = "i2c_sck_a",
				     "i2c_sda_a";
				function = "i2c_a";
				bias-disable;
			};
		};

		i2c_b_pins: i2c_b {
			mux {
				groups = "i2c_sck_b",
				      "i2c_sda_b";
				function = "i2c_b";
				bias-disable;
			};
		};

		i2c_c_pins: i2c_c {
			mux {
				groups = "i2c_sck_c",
				      "i2c_sda_c";
				function = "i2c_c";
				bias-disable;
			};
		};

		i2c_c_dv18_pins: i2c_c_dv18 {
			mux {
				groups = "i2c_sck_c_dv19",
				      "i2c_sda_c_dv18";
				function = "i2c_c";
				bias-disable;
			};
		};

		eth_pins: eth_c {
			mux {
				groups = "eth_mdio",
				       "eth_mdc",
				       "eth_clk_rx_clk",
				       "eth_rx_dv",
				       "eth_rxd0",
				       "eth_rxd1",
				       "eth_rxd2",
				       "eth_rxd3",
				       "eth_rgmii_tx_clk",
				       "eth_tx_en",
				       "eth_txd0",
				       "eth_txd1",
				       "eth_txd2",
				       "eth_txd3";
				function = "eth";
				bias-disable;
			};
		};

		eth_link_led_pins: eth_link_led {
			mux {
				groups = "eth_link_led";
				function = "eth_led";
				bias-disable;
			};
		};

		eth_act_led_pins: eth_act_led {
			mux {
				groups = "eth_act_led";
				function = "eth_led";
			};
		};

		pwm_a_pins: pwm_a {
			mux {
				groups = "pwm_a";
				function = "pwm_a";
				bias-disable;
			};
		};

		pwm_b_pins: pwm_b {
			mux {
				groups = "pwm_b";
				function = "pwm_b";
				bias-disable;
			};
		};

		pwm_c_pins: pwm_c {
			mux {
				groups = "pwm_c";
				function = "pwm_c";
				bias-disable;
			};
		};

		pwm_d_pins: pwm_d {
			mux {
				groups = "pwm_d";
				function = "pwm_d";
				bias-disable;
			};
		};

		pwm_e_pins: pwm_e {
			mux {
				groups = "pwm_e";
				function = "pwm_e";
				bias-disable;
			};
		};

		pwm_f_clk_pins: pwm_f_clk {
			mux {
				groups = "pwm_f_clk";
				function = "pwm_f";
				bias-disable;
			};
		};

		pwm_f_x_pins: pwm_f_x {
			mux {
				groups = "pwm_f_x";
				function = "pwm_f";
				bias-disable;
			};
		};

		hdmi_hpd_pins: hdmi_hpd {
			mux {
				groups = "hdmi_hpd";
				function = "hdmi_hpd";
				bias-disable;
			};
		};

		hdmi_i2c_pins: hdmi_i2c {
			mux {
				groups = "hdmi_sda", "hdmi_scl";
				function = "hdmi_i2c";
				bias-disable;
			};
		};

		i2s_am_clk_pins: i2s_am_clk {
			mux {
				groups = "i2s_am_clk";
				function = "i2s_out";
				bias-disable;
			};
		};

		i2s_out_ao_clk_pins: i2s_out_ao_clk {
			mux {
				groups = "i2s_out_ao_clk";
				function = "i2s_out";
				bias-disable;
			};
		};

		i2s_out_lr_clk_pins: i2s_out_lr_clk {
			mux {
				groups = "i2s_out_lr_clk";
				function = "i2s_out";
				bias-disable;
			};
		};

		i2s_out_ch01_pins: i2s_out_ch01 {
			mux {
				groups = "i2s_out_ch01";
				function = "i2s_out";
				bias-disable;
			};
		};
		i2sout_ch23_z_pins: i2sout_ch23_z {
			mux {
				groups = "i2sout_ch23_z";
				function = "i2s_out";
				bias-disable;
			};
		};

		i2sout_ch45_z_pins: i2sout_ch45_z {
			mux {
				groups = "i2sout_ch45_z";
				function = "i2s_out";
				bias-disable;
			};
		};

		i2sout_ch67_z_pins: i2sout_ch67_z {
			mux {
				groups = "i2sout_ch67_z";
				function = "i2s_out";
				bias-disable;
			};
		};

		spdif_out_h_pins: spdif_out_ao_h {
			mux {
				groups = "spdif_out_h";
				function = "spdif_out";
				bias-disable;
			};
		};
	};

	eth-phy-mux {
		compatible = "mdio-mux-mmioreg", "mdio-mux";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x0 0x55c 0x0 0x4>;
		mux-mask = <0xffffffff>;
		mdio-parent-bus = <&mdio0>;

		internal_mdio: mdio@e40908ff {
			reg = <0xe40908ff>;
			#address-cells = <1>;
			#size-cells = <0>;

			internal_phy: ethernet-phy@8 {
				compatible = "ethernet-phy-id0181.4400";
				interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
				reg = <8>;
				max-speed = <100>;
			};
		};

		external_mdio: mdio@2009087f {
			reg = <0x2009087f>;
			#address-cells = <1>;
			#size-cells = <0>;
		};
	};
};

&pwrc {
	resets = <&reset RESET_VIU>,
		 <&reset RESET_VENC>,
		 <&reset RESET_VCBUS>,
		 <&reset RESET_BT656>,
		 <&reset RESET_DVIN_RESET>,
		 <&reset RESET_RDMA>,
		 <&reset RESET_VENCI>,
		 <&reset RESET_VENCP>,
		 <&reset RESET_VDAC>,
		 <&reset RESET_VDI6>,
		 <&reset RESET_VENCL>,
		 <&reset RESET_VID_LOCK>;
	reset-names = "viu", "venc", "vcbus", "bt656",
		      "dvin", "rdma", "venci", "vencp",
		      "vdac", "vdi6", "vencl", "vid_lock";
	clocks = <&clkc CLKID_VPU>,
	         <&clkc CLKID_VAPB>;
	clock-names = "vpu", "vapb";
	/*
	 * VPU clocking is provided by two identical clock paths
	 * VPU_0 and VPU_1 muxed to a single clock by a glitch
	 * free mux to safely change frequency while running.
	 * Same for VAPB but with a final gate after the glitch free mux.
	 */
	assigned-clocks = <&clkc CLKID_VPU_0_SEL>,
			  <&clkc CLKID_VPU_0>,
			  <&clkc CLKID_VPU>, /* Glitch free mux */
			  <&clkc CLKID_VAPB_0_SEL>,
			  <&clkc CLKID_VAPB_0>,
			  <&clkc CLKID_VAPB_SEL>; /* Glitch free mux */
	assigned-clock-parents = <&clkc CLKID_FCLK_DIV3>,
				 <0>, /* Do Nothing */
				 <&clkc CLKID_VPU_0>,
				 <&clkc CLKID_FCLK_DIV4>,
				 <0>, /* Do Nothing */
				 <&clkc CLKID_VAPB_0>;
	assigned-clock-rates = <0>, /* Do Nothing */
			       <666666666>,
			       <0>, /* Do Nothing */
			       <0>, /* Do Nothing */
			       <250000000>,
			       <0>; /* Do Nothing */
};

&saradc {
	compatible = "amlogic,meson-gxl-saradc", "amlogic,meson-saradc";
	clocks = <&xtal>,
		 <&clkc CLKID_SAR_ADC>,
		 <&clkc CLKID_SAR_ADC_CLK>,
		 <&clkc CLKID_SAR_ADC_SEL>;
	clock-names = "clkin", "core", "adc_clk", "adc_sel";
};

&sd_emmc_a {
	clocks = <&clkc CLKID_SD_EMMC_A>,
		 <&clkc CLKID_SD_EMMC_A_CLK0>,
		 <&clkc CLKID_FCLK_DIV2>;
	clock-names = "core", "clkin0", "clkin1";
	resets = <&reset RESET_SD_EMMC_A>;
};

&sd_emmc_b {
	clocks = <&clkc CLKID_SD_EMMC_B>,
		 <&clkc CLKID_SD_EMMC_B_CLK0>,
		 <&clkc CLKID_FCLK_DIV2>;
	clock-names = "core", "clkin0", "clkin1";
	resets = <&reset RESET_SD_EMMC_B>;
};

&sd_emmc_c {
	clocks = <&clkc CLKID_SD_EMMC_C>,
		 <&clkc CLKID_SD_EMMC_C_CLK0>,
		 <&clkc CLKID_FCLK_DIV2>;
	clock-names = "core", "clkin0", "clkin1";
	resets = <&reset RESET_SD_EMMC_C>;
};

&simplefb_hdmi {
	clocks = <&clkc CLKID_HDMI_PCLK>,
		 <&clkc CLKID_CLK81>,
		 <&clkc CLKID_GCLK_VENCI_INT0>;
};

&spicc {
	clocks = <&clkc CLKID_SPICC>;
	clock-names = "core";
	resets = <&reset RESET_PERIPHS_SPICC>;
	num-cs = <1>;
};

&spifc {
	clocks = <&clkc CLKID_SPI>;
};

&uart_A {
	clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
	clock-names = "xtal", "pclk", "baud";
};

&uart_AO {
	clocks = <&xtal>, <&clkc_AO CLKID_AO_UART1>, <&xtal>;
	clock-names = "xtal", "pclk", "baud";
};

&uart_AO_B {
	clocks = <&xtal>, <&clkc_AO CLKID_AO_UART2>, <&xtal>;
	clock-names = "xtal", "pclk", "baud";
};

&uart_B {
	clocks = <&xtal>, <&clkc CLKID_UART1>, <&xtal>;
	clock-names = "xtal", "pclk", "baud";
};

&uart_C {
	clocks = <&xtal>, <&clkc CLKID_UART2>, <&xtal>;
	clock-names = "xtal", "pclk", "baud";
};

&vpu {
	compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
	power-domains = <&pwrc PWRC_GXBB_VPU_ID>;
};

&vdec {
	compatible = "amlogic,gxl-vdec", "amlogic,gx-vdec";
	clocks = <&clkc CLKID_DOS_PARSER>,
		 <&clkc CLKID_DOS>,
		 <&clkc CLKID_VDEC_1>,
		 <&clkc CLKID_VDEC_HEVC>;
	clock-names = "dos_parser", "dos", "vdec_1", "vdec_hevc";
	resets = <&reset RESET_PARSER>;
	reset-names = "esparser";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "azw,gt1-ultimate", "amlogic,s912", "amlogic,meson-gxm";
	model = "Beelink GT1 Ultimate";

	leds {
		compatible = "gpio-leds";

		led-white {
			color = <LED_COLOR_ID_WHITE>;
			function = LED_FUNCTION_POWER;
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
			default-state = "on";
			panic-indicator;
		};
	};

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

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

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

&external_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_14 GPIO_ACTIVE_LOW>;

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

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

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

&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) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
 * Copyright (c) 2017 BayLibre, SAS
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 */

/dts-v1/;

#include "meson-gxm.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/sound/meson-aiu.h>

/ {
	compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
	model = "Khadas VIM2";

	aliases {
		serial0 = &uart_AO;
		serial2 = &uart_AO_B;
	};

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

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

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

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

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

	gpio_fan: gpio-fan {
		compatible = "gpio-fan";
		gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
			 &gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
		/* Dummy RPM values since fan is optional */
		gpio-fan,speed-map = <0 0
				      1 1
				      2 2
				      3 3>;
		#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_2 GPIO_ACTIVE_LOW>;
		};
	};

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

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

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

		led-1 {
			label = "vim:red:power";
			pwms = <&pwm_AO_ab 1 7812500 0>;
			max-brightness = <255>;
			linux,default-trigger = "default-on";
		};
	};

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

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

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

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

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

	sound {
		compatible = "amlogic,gx-sound-card";
		model = "KHADAS-VIM2";
		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>;
			};
		};

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

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

&aiu {
	status = "okay";
};

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

&cpu_cooling_maps {
	map0 {
		cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
	};

	map1 {
		cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>,
				 <&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>,
				 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
	};
};

&ethmac {
	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	/* Select external PHY by default */
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	/* External PHY is in RGMII */
	phy-mode = "rgmii";

	status = "okay";
};

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

		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;

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

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

&i2c_A {
	status = "okay";
	pinctrl-0 = <&i2c_a_pins>;
	pinctrl-names = "default";
};

&i2c_B {
	status = "okay";
	pinctrl-0 = <&i2c_b_pins>;
	pinctrl-names = "default";

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

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

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

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

&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 = <&vddao_3v3>;
	vqmmc-supply = <&vddio_boot>;

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

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

/*
 * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
 * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
 */
&spifc {
	status = "disabled";
	pinctrl-0 = <&nor_pins>;
	pinctrl-names = "default";

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

/* This one is connected to the Bluetooth module */
&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";
	};
};

/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
&uart_AO {
	status = "okay";
	pinctrl-0 = <&uart_ao_a_pins>;
	pinctrl-names = "default";
};

/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
&uart_AO_B {
	status = "okay";
	pinctrl-0 = <&uart_ao_b_pins>;
	pinctrl-names = "default";
};

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

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


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

/*
 * Author: Christian Hewitt <christianshewitt@gmail.com>
 */

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "videostrong,gxm-kiii-pro", "amlogic,s912", "amlogic,meson-gxm";
	model = "MeCool KIII Pro";

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

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

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

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

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

	leds {
		compatible = "gpio-leds";

		led-blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_POWER;
			gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
			default-state = "on";
			panic-indicator;
		};
	};
};

&ethmac {
	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	phy-mode = "rgmii";
};

&external_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_14 GPIO_ACTIVE_LOW>;

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

&ir {
	linux,rc-map-name = "rc-mecool-kiii-pro";
};

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

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

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "minix,neo-u9h", "amlogic,s912", "amlogic,meson-gxm";
	model = "Minix Neo U9-H";

	leds {
		compatible = "gpio-leds";

		led-white {
			color = <LED_COLOR_ID_WHITE>;
			function = LED_FUNCTION_POWER;
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
			default-state = "on";
			panic-indicator;
		};
	};

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

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

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

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

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

&external_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_14 GPIO_ACTIVE_LOW>;

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

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

&i2c_B {
	status = "okay";
	pinctrl-0 = <&i2c_b_pins>;
	pinctrl-names = "default";

	rtc: rtc@51 {
		status = "okay";
		compatible = "haoyu,hym8563";
		reg = <0x51>;
		#clock-cells = <0>;
		clock-output-names = "xin32k";
		wakeup-source;
	};
};

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

&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) 2016 BayLibre, SAS.
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 *
 * Copyright (c) 2016 Endless Computers, Inc.
 * Author: Carlo Caione <carlo@endlessm.com>
 */

/dts-v1/;

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

/ {
	compatible = "nexbox,a1", "amlogic,s912", "amlogic,meson-gxm";
	model = "NEXBOX A1";

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

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

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

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

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

	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 = "NEXBOX-A1";
		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>;
			};
		};

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

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

	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	/* Select external PHY by default */
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	/* External PHY is in RGMII */
	phy-mode = "rgmii";
};

&external_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_14 GPIO_ACTIVE_LOW>;
	};
};

&hdmi_tx {
	status = "okay";
	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_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";
};

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

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

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


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

/dts-v1/;

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

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "amlogic,q200", "amlogic,s912", "amlogic,meson-gxm";
	model = "Amlogic Meson GXM (S912) Q200 Development Board";

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

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

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

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

/* Q200 has exclusive choice between internal or external PHY */
&ethmac {
	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	/* Select external PHY by default */
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	/* External PHY is in RGMII */
	phy-mode = "rgmii";
};

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

		/* External PHY reset is shared with internal PHY Led signal */
		reset-assert-us = <10000>;
		reset-deassert-us = <80000>;
		reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;

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

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


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

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "amlogic,q201", "amlogic,s912", "amlogic,meson-gxm";
	model = "Amlogic Meson GXM (S912) Q201 Development Board";
};

/* Q201 has only internal PHY port */
&ethmac {
	phy-mode = "rmii";
	phy-handle = <&internal_phy>;
};

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


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2016-2017 Andreas Färber
 *
 * Based on nexbox-a1:
 *
 * Copyright (c) 2016 BayLibre, SAS.
 * Author: Neil Armstrong <narmstrong@baylibre.com>
 *
 * Copyright (c) 2016 Endless Computers, Inc.
 * Author: Carlo Caione <carlo@endlessm.com>
 */

/dts-v1/;

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

/ {
	compatible = "kingnovel,r-box-pro", "amlogic,s912", "amlogic,meson-gxm";
	model = "R-Box Pro";

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

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

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */
	};

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

	leds {
		compatible = "gpio-leds";

		led-blue {
			label = "rbox-pro:blue:on";
			gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};

		led-red {
			label = "rbox-pro:red:standby";
			gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
			default-state = "off";
			retain-state-suspended;
			panic-indicator;
		};
	};

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

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

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

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

&ethmac {
	status = "okay";

	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	/* Select external PHY by default */
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	/* External PHY is in RGMII */
	phy-mode = "rgmii";
};

&external_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_14 GPIO_ACTIVE_LOW>;
	};
};

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

/* Wireless SDIO Module */
&sd_emmc_a {
	status = "okay";
	pinctrl-0 = <&sdio_pins>;
	pinctrl-names = "default";
	#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>;

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

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

	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-names = "default";

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

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


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

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-libretech-pc.dtsi"

/ {
	compatible = "libretech,aml-s912-pc", "amlogic,s912",
		     "amlogic,meson-gxm";
	model = "Libre Computer AML-S912-PC";

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

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

&pinctrl_periphs {
	/*
	 * Make sure the irq pin of the TYPE C controller is not driven
	 * by the SoC.
	 */
	fusb302_irq_pins: fusb302_irq {
		mux {
			groups = "GPIODV_0";
			function = "gpio_periphs";
			bias-pull-up;
			output-disable;
		};
	};
};

&i2c_C {
	fusb302@22 {
		compatible = "fcs,fusb302";
		reg = <0x22>;

		pinctrl-0 = <&fusb302_irq_pins>;
		pinctrl-names = "default";
		interrupt-parent = <&gpio_intc>;
		interrupts = <59 IRQ_TYPE_LEVEL_LOW>;

		vbus-supply = <&typec2_vbus>;

		status = "okay";
	};
};

&usb2_phy2 {
	phy-supply = <&typec2_vbus>;
};


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

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"

/ {
	compatible = "tronsmart,vega-s96", "amlogic,s912", "amlogic,meson-gxm";
	model = "Tronsmart Vega S96";

};

&ethmac {
	pinctrl-0 = <&eth_pins>;
	pinctrl-names = "default";

	/* Select external PHY by default */
	phy-handle = <&external_phy>;

	amlogic,tx-delay-ns = <2>;

	/* External PHY is in RGMII */
	phy-mode = "rgmii";
};

&external_mdio {
	external_phy: ethernet-phy@0 {
		/* Realtek RTL8211F (0x001cc916) */
		reg = <0>;
	};
};

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

&usb {
	dr_mode = "host";
};


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

/dts-v1/;

#include "meson-gxm.dtsi"
#include "meson-gx-p23x-q20x.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "wetek,core2", "amlogic,s912", "amlogic,meson-gxm";
	model = "WeTek Core 2";

	memory@0 {
		device_type = "memory";
		reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 3 GiB */
	};

	leds {
		compatible = "gpio-leds";

		led-blue {
			color = <LED_COLOR_ID_BLUE>;
			function = LED_FUNCTION_STATUS;
			gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};
	};

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

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

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

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

/* Disabled as Realtek RTL8152 USB provides Ethernet */
&ethmac {
	status = "disabled";
};

&internal_phy {
	status = "disabled";
};

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

/* This is connected to the Bluetooth module: */
&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) 2016 Endless Computers, Inc.
 * Author: Carlo Caione <carlo@endlessm.com>
 */

#include "meson-gxl.dtsi"

/ {
	compatible = "amlogic,meson-gxm";

	cpus {
		cpu-map {
			cluster0 {
				core0 {
					cpu = <&cpu0>;
				};
				core1 {
					cpu = <&cpu1>;
				};
				core2 {
					cpu = <&cpu2>;
				};
				core3 {
					cpu = <&cpu3>;
				};
			};

			cluster1 {
				core0 {
					cpu = <&cpu4>;
				};
				core1 {
					cpu = <&cpu5>;
				};
				core2 {
					cpu = <&cpu6>;
				};
				core3 {
					cpu = <&cpu7>;
				};
			};
		};

		cpu0: cpu@0 {
			capacity-dmips-mhz = <1024>;
		};

		cpu1: cpu@1 {
			capacity-dmips-mhz = <1024>;
		};

		cpu2: cpu@2 {
			capacity-dmips-mhz = <1024>;
		};

		cpu3: cpu@3 {
			capacity-dmips-mhz = <1024>;
		};

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

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

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

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

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

&apb {
	usb2_phy2: phy@78040 {
		compatible = "amlogic,meson-gxl-usb2-phy";
		#phy-cells = <0>;
		reg = <0x0 0x78040 0x0 0x20>;
		clocks = <&clkc CLKID_USB>;
		clock-names = "phy";
		resets = <&reset RESET_USB_OTG>;
		reset-names = "phy";
		status = "okay";
	};

	mali: gpu@c0000 {
		compatible = "amlogic,meson-gxm-mali", "arm,mali-t820";
		reg = <0x0 0xc0000 0x0 0x40000>;
		interrupt-parent = <&gic>;
		interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "job", "mmu", "gpu";
		clocks = <&clkc CLKID_MALI>;
		resets = <&reset RESET_MALI_CAPB3>, <&reset RESET_MALI>;
		operating-points-v2 = <&gpu_opp_table>;
	};
};

&clkc_AO {
	compatible = "amlogic,meson-gxm-aoclkc", "amlogic,meson-gx-aoclkc";
};

&cpu_cooling_maps {
	map0 {
		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>,
				 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
	};

	map1 {
		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>,
				 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
				 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
	};
};

&saradc {
	compatible = "amlogic,meson-gxm-saradc", "amlogic,meson-saradc";
};

&scpi_dvfs {
	clock-indices = <0 1>;
	clock-output-names = "vbig", "vlittle";
};

&vpu {
	compatible = "amlogic,meson-gxm-vpu", "amlogic,meson-gx-vpu";
};

&hdmi_tx {
	compatible = "amlogic,meson-gxm-dw-hdmi", "amlogic,meson-gx-dw-hdmi";
};

&usb {
	compatible = "amlogic,meson-gxm-usb-ctrl";

	phy-names = "usb2-phy0", "usb2-phy1", "usb2-phy2";
	phys = <&usb2_phy0>, <&usb2_phy1>, <&usb2_phy2>;
};

&vdec {
	compatible = "amlogic,gxm-vdec", "amlogic,gx-vdec";
};