code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2017 Andreas Färber
 */

#include <dt-bindings/clock/actions,s700-cmu.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/power/owl-s700-powergate.h>
#include <dt-bindings/reset/actions,s700-reset.h>

/ {
	compatible = "actions,s700";
	interrupt-parent = <&gic>;
	#address-cells = <2>;
	#size-cells = <2>;

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

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

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

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

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

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		secmon@1f000000 {
			reg = <0x0 0x1f000000 0x0 0x1000000>;
			no-map;
		};
	};

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

	arm-pmu {
		compatible = "arm,cortex-a53-pmu";
		interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
		             <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
		             <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
		             <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
	};

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

	hosc: hosc {
		compatible = "fixed-clock";
		clock-frequency = <24000000>;
		#clock-cells = <0>;
	};

	losc: losc {
		compatible = "fixed-clock";
		clock-frequency = <32768>;
		#clock-cells = <0>;
	};

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

		gic: interrupt-controller@e00f1000 {
			compatible = "arm,gic-400";
			reg = <0x0 0xe00f1000 0x0 0x1000>,
			      <0x0 0xe00f2000 0x0 0x2000>,
			      <0x0 0xe00f4000 0x0 0x2000>,
			      <0x0 0xe00f6000 0x0 0x2000>;
			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
			interrupt-controller;
			#interrupt-cells = <3>;
		};

		uart0: serial@e0120000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0120000 0x0 0x2000>;
			clocks = <&cmu CLK_UART0>;
			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart1: serial@e0122000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0122000 0x0 0x2000>;
			clocks = <&cmu CLK_UART1>;
			interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart2: serial@e0124000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0124000 0x0 0x2000>;
			clocks = <&cmu CLK_UART2>;
			interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart3: serial@e0126000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0126000 0x0 0x2000>;
			clocks = <&cmu CLK_UART3>;
			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart4: serial@e0128000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0128000 0x0 0x2000>;
			clocks = <&cmu CLK_UART4>;
			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart5: serial@e012a000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe012a000 0x0 0x2000>;
			clocks = <&cmu CLK_UART5>;
			interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart6: serial@e012c000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe012c000 0x0 0x2000>;
			clocks = <&cmu CLK_UART6>;
			interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		cmu: clock-controller@e0168000 {
			compatible = "actions,s700-cmu";
			reg = <0x0 0xe0168000 0x0 0x1000>;
			clocks = <&hosc>, <&losc>;
			#clock-cells = <1>;
			#reset-cells = <1>;
		};

		i2c0: i2c@e0170000 {
			compatible = "actions,s700-i2c";
			reg = <0 0xe0170000 0 0x1000>;
			clocks = <&cmu CLK_I2C0>;
			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c1: i2c@e0174000 {
			compatible = "actions,s700-i2c";
			reg = <0 0xe0174000 0 0x1000>;
			clocks = <&cmu CLK_I2C1>;
			interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c2: i2c@e0178000 {
			compatible = "actions,s700-i2c";
			reg = <0 0xe0178000 0 0x1000>;
			clocks = <&cmu CLK_I2C2>;
			interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c3: i2c@e017c000 {
			compatible = "actions,s700-i2c";
			reg = <0 0xe017c000 0 0x1000>;
			clocks = <&cmu CLK_I2C3>;
			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		sps: power-controller@e01b0100 {
			compatible = "actions,s700-sps";
			reg = <0x0 0xe01b0100 0x0 0x100>;
			#power-domain-cells = <1>;
		};

		timer: timer@e024c000 {
			compatible = "actions,s700-timer";
			reg = <0x0 0xe024c000 0x0 0x4000>;
			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "timer1";
		};

		pinctrl: pinctrl@e01b0000 {
			compatible = "actions,s700-pinctrl";
			reg = <0x0 0xe01b0000 0x0 0x100>;
			clocks = <&cmu CLK_GPIO>;
			gpio-controller;
			gpio-ranges = <&pinctrl 0 0 136>;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
			interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
		};

		dma: dma-controller@e0230000 {
			compatible = "actions,s700-dma";
			reg = <0x0 0xe0230000 0x0 0x1000>;
			interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
			#dma-cells = <1>;
			dma-channels = <10>;
			dma-requests = <44>;
			clocks = <&cmu CLK_DMAC>;
			power-domains = <&sps S700_PD_DMA>;
		};
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2017 Andreas Färber
 */

/dts-v1/;

#include "s900.dtsi"

/ {
	compatible = "ucrobotics,bubblegum-96", "actions,s900";
	model = "Bubblegum-96";

	aliases {
		mmc0 = &mmc0;
		mmc1 = &mmc1;
		mmc2 = &mmc2;
		serial5 = &uart5;
	};

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

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

	/* Fixed regulator used in the absence of PMIC */
	vcc_3v1: vcc-3v1 {
		compatible = "regulator-fixed";
		regulator-name = "fixed-3.1V";
		regulator-min-microvolt = <3100000>;
		regulator-max-microvolt = <3100000>;
		regulator-always-on;
	};

	/* Fixed regulator used in the absence of PMIC */
	sd_vcc: sd-vcc {
		compatible = "regulator-fixed";
		regulator-name = "fixed-3.1V";
		regulator-min-microvolt = <3100000>;
		regulator-max-microvolt = <3100000>;
		regulator-always-on;
	};
};

&i2c0 {
	status = "disabled";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0_default>;
};

&i2c1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1_default>;
};

&i2c2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&i2c2_default>;
};

/*
 * GPIO name legend: proper name = the GPIO line is used as GPIO
 *         NC = not connected (pin out but not routed from the chip to
 *              anything the board)
 *         "[PER]" = pin is muxed for [peripheral] (not GPIO)
 *         LSEC = Low Speed External Connector
 *         HSEC = High Speed External Connector
 *
 * Line names are taken from the schematic "Schematics Bubblegum96"
 * version v1.0
 *
 * For the lines routed to the external connectors the
 * lines are named after the 96Boards CE Specification 1.0,
 * Appendix "Expansion Connector Signal Description".
 *
 * When the 96Boards naming of a line and the schematic name of
 * the same line are in conflict, the 96Boards specification
 * takes precedence, which means that the external UART on the
 * LSEC is named UART0 while the schematic and SoC names this
 * UART2. Only exception is the I2C lines for which the schematic
 * naming has been preferred. This is only for the informational
 * lines i.e. "[FOO]", the GPIO named lines "GPIO-A" thru "GPIO-L"
 * are the only ones actually used for GPIO.
 */

&pinctrl {
	gpio-line-names =
		"GPIO-A", /* GPIO_0, LSEC pin 23 */
		"GPIO-B", /* GPIO_1, LSEC pin 24 */
		"GPIO-C", /* GPIO_2, LSEC pin 25 */
		"GPIO-D", /* GPIO_3, LSEC pin 26 */
		"GPIO-E", /* GPIO_4, LSEC pin 27 */
		"GPIO-F", /* GPIO_5, LSEC pin 28 */
		"GPIO-G", /* GPIO_6, LSEC pin 29 */
		"GPIO-H", /* GPIO_7, LSEC pin 30 */
		"GPIO-I", /* GPIO_8, LSEC pin 31 */
		"GPIO-J", /* GPIO_9, LSEC pin 32 */
		"NC", /* GPIO_10 */
		"NC", /* GPIO_11 */
		"SIRQ2_1V8", /* GPIO_12 */
		"PCM0_OUT", /* GPIO_13 */
		"WIFI_LED", /* GPIO_14 */
		"PCM0_SYNC", /* GPIO_15 */
		"PCM0_CLK", /* GPIO_16 */
		"PCM0_IN", /* GPIO_17 */
		"BT_LED", /* GPIO_18 */
		"LED0", /* GPIO_19 */
		"LED1", /* GPIO_20 */
		"JTAG_TCK", /* GPIO_21 */
		"JTAG_TMS", /* GPIO_22 */
		"JTAG_TDI", /* GPIO_23 */
		"JTAG_TDO", /* GPIO_24 */
		"[UART1_RxD]", /* GPIO_25, LSEC pin 13 */
		"NC", /* GPIO_26 */
		"[UART1_TxD]", /* GPIO_27, LSEC pin 11 */
		"SD0_D0", /* GPIO_28 */
		"SD0_D1", /* GPIO_29 */
		"SD0_D2", /* GPIO_30 */
		"SD0_D3", /* GPIO_31 */
		"SD1_D0", /* GPIO_32 */
		"SD1_D1", /* GPIO_33 */
		"SD1_D2", /* GPIO_34 */
		"SD1_D3", /* GPIO_35 */
		"SD0_CMD", /* GPIO_36 */
		"SD0_CLK", /* GPIO_37 */
		"SD1_CMD", /* GPIO_38 */
		"SD1_CLK", /* GPIO_39 */
		"SPI0_SCLK", /* GPIO_40, LSEC pin 8 */
		"SPI0_CS", /* GPIO_41, LSEC pin 12 */
		"SPI0_DIN", /* GPIO_42, LSEC pin 10 */
		"SPI0_DOUT", /* GPIO_43, LSEC pin 14 */
		"I2C5_SDATA", /* GPIO_44, HSEC pin 36 */
		"I2C5_SCLK", /* GPIO_45, HSEC pin 38 */
		"UART0_RX", /* GPIO_46, LSEC pin 7 */
		"UART0_TX", /* GPIO_47, LSEC pin 5 */
		"UART0_RTSB", /* GPIO_48, LSEC pin 9 */
		"UART0_CTSB", /* GPIO_49, LSEC pin 3 */
		"I2C4_SCLK", /* GPIO_50, HSEC pin 32 */
		"I2C4_SDATA", /* GPIO_51, HSEC pin 34 */
		"I2C0_SCLK", /* GPIO_52 */
		"I2C0_SDATA", /* GPIO_53 */
		"I2C1_SCLK", /* GPIO_54, LSEC pin 15 */
		"I2C1_SDATA", /* GPIO_55, LSEC pin 17 */
		"I2C2_SCLK", /* GPIO_56, LSEC pin 19 */
		"I2C2_SDATA", /* GPIO_57, LSEC pin 21 */
		"CSI0_DN0", /* GPIO_58, HSEC pin 10 */
		"CSI0_DP0", /* GPIO_59, HSEC pin 8 */
		"CSI0_DN1", /* GPIO_60, HSEC pin 16 */
		"CSI0_DP1", /* GPIO_61, HSEC pin 14 */
		"CSI0_CN", /* GPIO_62, HSEC pin 4 */
		"CSI0_CP", /* GPIO_63, HSEC pin 2 */
		"CSI0_DN2", /* GPIO_64, HSEC pin 22 */
		"CSI0_DP2", /* GPIO_65, HSEC pin 20 */
		"CSI0_DN3", /* GPIO_66, HSEC pin 28 */
		"CSI0_DP3", /* GPIO_67, HSEC pin 26 */
		"[CLK0]", /* GPIO_68, HSEC pin 15 */
		"CSI1_DN0", /* GPIO_69, HSEC pin 44 */
		"CSI1_DP0", /* GPIO_70, HSEC pin 42 */
		"CSI1_DN1", /* GPIO_71, HSEC pin 50 */
		"CSI1_DP1", /* GPIO_72, HSEC pin 48 */
		"CSI1_CN", /* GPIO_73, HSEC pin 56 */
		"CSI1_CP", /* GPIO_74, HSEC pin 54 */
		"[CLK1]", /* GPIO_75, HSEC pin 17 */
		"[GPIOD0]", /* GPIO_76 */
		"[GPIOD1]", /* GPIO_77 */
		"BT_RST_N", /* GPIO_78 */
		"EXT_DC_EN", /* GPIO_79 */
		"[PCM_DI]", /* GPIO_80, LSEC pin 22 */
		"[PCM_DO]", /* GPIO_81, LSEC pin 20 */
		"[PCM_CLK]", /* GPIO_82, LSEC pin 18 */
		"[PCM_FS]", /* GPIO_83, LSEC pin 16 */
		"WAKE_BT", /* GPIO_84 */
		"WL_REG_ON", /* GPIO_85 */
		"NC", /* GPIO_86 */
		"NC", /* GPIO_87 */
		"NC", /* GPIO_88 */
		"NC", /* GPIO_89 */
		"NC", /* GPIO_90 */
		"WIFI_WAKE", /* GPIO_91 */
		"BT_WAKE", /* GPIO_92 */
		"NC", /* GPIO_93 */
		"OTG_EN2", /* GPIO_94 */
		"OTG_EN", /* GPIO_95 */
		"DSI_DP3", /* GPIO_96, HSEC pin 45 */
		"DSI_DN3", /* GPIO_97, HSEC pin 47 */
		"DSI_DP1", /* GPIO_98, HSEC pin 33 */
		"DSI_DN1", /* GPIO_99, HSEC pin 35 */
		"DSI_CP", /* GPIO_100, HSEC pin 21 */
		"DSI_CN", /* GPIO_101, HSEC pin 23 */
		"DSI_DP0", /* GPIO_102, HSEC pin 27 */
		"DSI_DN0", /* GPIO_103, HSEC pin 29 */
		"DSI_DP2", /* GPIO_104, HSEC pin 39 */
		"DSI_DN2", /* GPIO_105, HSEC pin 41 */
		"N0_D0", /* GPIO_106 */
		"N0_D1", /* GPIO_107 */
		"N0_D2", /* GPIO_108 */
		"N0_D3", /* GPIO_109 */
		"N0_D4", /* GPIO_110 */
		"N0_D5", /* GPIO_111 */
		"N0_D6", /* GPIO_112 */
		"N0_D7", /* GPIO_113 */
		"N0_DQS", /* GPIO_114 */
		"N0_DQSN", /* GPIO_115 */
		"NC", /* GPIO_116 */
		"NC", /* GPIO_117 */
		"NC", /* GPIO_118 */
		"N0_CEB1", /* GPIO_119 */
		"CARD_DT", /* GPIO_120 */
		"N0_CEB3", /* GPIO_121 */
		"SD_DAT0", /* GPIO_122, HSEC pin 1 */
		"SD_DAT1", /* GPIO_123, HSEC pin 3 */
		"SD_DAT2", /* GPIO_124, HSEC pin 5 */
		"SD_DAT3", /* GPIO_125, HSEC pin 7 */
		"NC", /* GPIO_126 */
		"NC", /* GPIO_127 */
		"[PWR_BTN_N]", /* GPIO_128, LSEC pin 4 */
		"[RST_BTN_N]", /* GPIO_129, LSEC pin 6 */
		"NC", /* GPIO_130 */
		"SD_CMD", /* GPIO_131 */
		"GPIO-L", /* GPIO_132, LSEC pin 34 */
		"GPIO-K", /* GPIO_133, LSEC pin 33 */
		"NC", /* GPIO_134 */
		"SD_SCLK", /* GPIO_135 */
		"NC", /* GPIO_136 */
		"JTAG_TRST", /* GPIO_137 */
		"I2C3_SCLK", /* GPIO_138 */
		"LED2", /* GPIO_139 */
		"LED3", /* GPIO_140 */
		"I2C3_SDATA", /* GPIO_141 */
		"UART3_RX", /* GPIO_142 */
		"UART3_TX", /* GPIO_143 */
		"UART3_RTSB", /* GPIO_144 */
		"UART3_CTSB"; /* GPIO_145 */

	i2c0_default: i2c0-default {
		pinmux {
			groups = "i2c0_mfp";
			function = "i2c0";
		};
		pinconf {
			pins = "i2c0_sclk", "i2c0_sdata";
			bias-pull-up;
		};
	};

	i2c1_default: i2c1-default {
		pinconf {
			pins = "i2c1_sclk", "i2c1_sdata";
			bias-pull-up;
		};
	};

	i2c2_default: i2c2-default {
		pinconf {
			pins = "i2c2_sclk", "i2c2_sdata";
			bias-pull-up;
		};
	};

	mmc0_default: mmc0_default {
		pinmux {
			groups = "sd0_d0_mfp", "sd0_d1_mfp", "sd0_d2_d3_mfp",
				 "sd0_cmd_mfp", "sd0_clk_mfp";
			function = "sd0";
		};
	};

	mmc2_default: mmc2_default {
		pinmux {
			groups = "nand0_d0_ceb3_mfp";
			function = "sd2";
		};
	};
};

/* uSD */
&mmc0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_default>;
	no-sdio;
	no-mmc;
	no-1-8-v;
	cd-gpios = <&pinctrl 120 GPIO_ACTIVE_LOW>;
	bus-width = <4>;
	vmmc-supply = <&sd_vcc>;
	vqmmc-supply = <&sd_vcc>;
};

/* eMMC */
&mmc2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&mmc2_default>;
	no-sdio;
	no-sd;
	non-removable;
	bus-width = <8>;
	vmmc-supply = <&vcc_3v1>;
};

&timer {
	clocks = <&hosc>;
};

&uart5 {
	status = "okay";
};

repo_name: angery/linux


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2017 Andreas Färber
 */

#include <dt-bindings/clock/actions,s900-cmu.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/reset/actions,s900-reset.h>

/ {
	compatible = "actions,s900";
	interrupt-parent = <&gic>;
	#address-cells = <2>;
	#size-cells = <2>;

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

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

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

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

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

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		secmon@1f000000 {
			reg = <0x0 0x1f000000 0x0 0x1000000>;
			no-map;
		};
	};

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

	arm-pmu {
		compatible = "arm,cortex-a53-pmu";
		interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
		             <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
		             <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
		             <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
	};

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

	hosc: hosc {
		compatible = "fixed-clock";
		clock-frequency = <24000000>;
		#clock-cells = <0>;
	};

	losc: losc {
		compatible = "fixed-clock";
		clock-frequency = <32768>;
		#clock-cells = <0>;
	};

	diff24M: diff24M {
		compatible = "fixed-clock";
		clock-frequency = <24000000>;
		#clock-cells = <0>;
	};

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

		gic: interrupt-controller@e00f1000 {
			compatible = "arm,gic-400";
			reg = <0x0 0xe00f1000 0x0 0x1000>,
			      <0x0 0xe00f2000 0x0 0x2000>,
			      <0x0 0xe00f4000 0x0 0x2000>,
			      <0x0 0xe00f6000 0x0 0x2000>;
			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
			interrupt-controller;
			#interrupt-cells = <3>;
		};

		uart0: serial@e0120000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0120000 0x0 0x2000>;
			clocks = <&cmu CLK_UART0>;
			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart1: serial@e0122000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0122000 0x0 0x2000>;
			clocks = <&cmu CLK_UART1>;
			interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart2: serial@e0124000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0124000 0x0 0x2000>;
			clocks = <&cmu CLK_UART2>;
			interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart3: serial@e0126000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0126000 0x0 0x2000>;
			clocks = <&cmu CLK_UART3>;
			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart4: serial@e0128000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe0128000 0x0 0x2000>;
			clocks = <&cmu CLK_UART4>;
			interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart5: serial@e012a000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe012a000 0x0 0x2000>;
			clocks = <&cmu CLK_UART5>;
			interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		uart6: serial@e012c000 {
			compatible = "actions,s900-uart", "actions,owl-uart";
			reg = <0x0 0xe012c000 0x0 0x2000>;
			clocks = <&cmu CLK_UART6>;
			interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
			status = "disabled";
		};

		sps: power-controller@e012e000 {
			compatible = "actions,s900-sps";
			reg = <0x0 0xe012e000 0x0 0x2000>;
			#power-domain-cells = <1>;
		};

		cmu: clock-controller@e0160000 {
			compatible = "actions,s900-cmu";
			reg = <0x0 0xe0160000 0x0 0x1000>;
			clocks = <&hosc>, <&losc>;
			#clock-cells = <1>;
			#reset-cells = <1>;
		};

		i2c0: i2c@e0170000 {
			compatible = "actions,s900-i2c";
			reg = <0 0xe0170000 0 0x1000>;
			clocks = <&cmu CLK_I2C0>;
			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c1: i2c@e0172000 {
			compatible = "actions,s900-i2c";
			reg = <0 0xe0172000 0 0x1000>;
			clocks = <&cmu CLK_I2C1>;
			interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c2: i2c@e0174000 {
			compatible = "actions,s900-i2c";
			reg = <0 0xe0174000 0 0x1000>;
			clocks = <&cmu CLK_I2C2>;
			interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c3: i2c@e0176000 {
			compatible = "actions,s900-i2c";
			reg = <0 0xe0176000 0 0x1000>;
			clocks = <&cmu CLK_I2C3>;
			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c4: i2c@e0178000 {
			compatible = "actions,s900-i2c";
			reg = <0 0xe0178000 0 0x1000>;
			clocks = <&cmu CLK_I2C4>;
			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		i2c5: i2c@e017a000 {
			compatible = "actions,s900-i2c";
			reg = <0 0xe017a000 0 0x1000>;
			clocks = <&cmu CLK_I2C5>;
			interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "disabled";
		};

		pinctrl: pinctrl@e01b0000 {
			compatible = "actions,s900-pinctrl";
			reg = <0x0 0xe01b0000 0x0 0x1000>;
			clocks = <&cmu CLK_GPIO>;
			gpio-controller;
			gpio-ranges = <&pinctrl 0 0 146>;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
			interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
		};

		timer: timer@e0228000 {
			compatible = "actions,s900-timer";
			reg = <0x0 0xe0228000 0x0 0x8000>;
			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "timer1";
		};

		dma: dma-controller@e0260000 {
			compatible = "actions,s900-dma";
			reg = <0x0 0xe0260000 0x0 0x1000>;
			interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
			#dma-cells = <1>;
			dma-channels = <12>;
			dma-requests = <46>;
			clocks = <&cmu CLK_DMAC>;
		};

		mmc0: mmc@e0330000 {
			compatible = "actions,owl-mmc";
			reg = <0x0 0xe0330000 0x0 0x4000>;
			interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&cmu CLK_SD0>;
			resets = <&cmu RESET_SD0>;
			dmas = <&dma 2>;
			dma-names = "mmc";
			status = "disabled";
		};

		mmc1: mmc@e0334000 {
			compatible = "actions,owl-mmc";
			reg = <0x0 0xe0334000 0x0 0x4000>;
			interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&cmu CLK_SD1>;
			resets = <&cmu RESET_SD1>;
			dmas = <&dma 3>;
			dma-names = "mmc";
			status = "disabled";
		};

		mmc2: mmc@e0338000 {
			compatible = "actions,owl-mmc";
			reg = <0x0 0xe0338000 0x0 0x4000>;
			interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&cmu CLK_SD2>;
			resets = <&cmu RESET_SD2>;
			dmas = <&dma 4>;
			dma-names = "mmc";
			status = "disabled";
		};

		mmc3: mmc@e033c000 {
			compatible = "actions,owl-mmc";
			reg = <0x0 0xe033c000 0x0 0x4000>;
			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&cmu CLK_SD3>;
			resets = <&cmu RESET_SD3>;
			dmas = <&dma 46>;
			dma-names = "mmc";
			status = "disabled";
		};
	};
};


code:
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-amarula-relic.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-bananapi-m64.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-nanopi-a64.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-oceanic-5205-5inmfd.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-olinuxino.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-olinuxino-emmc.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-orangepi-win.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-lts.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-plus.dtb sun50i-a64-pine64.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinebook.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinephone-1.0.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinephone-1.1.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinephone-1.2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinetab.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinetab-early-adopter.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-sopine-baseboard.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-teres-i.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a100-allwinner-perf1.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-bananapi-m2-plus.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-bananapi-m2-plus-v1.2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-emlid-neutis-n5-devboard.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-libretech-all-h3-cc.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-libretech-all-h3-it.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-libretech-all-h5-cc.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-plus2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-r1s-h5.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-beelink-gs1.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-3.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-lite2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-one-plus.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-pine-h64.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-pine-h64-model-b.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-tanix-tx6.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-tanix-tx6-mini.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-x96-mate.dtb


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright 2017 Icenowy Zheng <icenowy@aosc.xyz>

/*
 * AXP803 Integrated Power Management Chip
 * http://files.pine64.org/doc/datasheet/pine64/AXP803_Datasheet_V1.0.pdf
 */

&axp803 {
	interrupt-controller;
	#interrupt-cells = <1>;

	ac_power_supply: ac-power {
		compatible = "x-powers,axp803-ac-power-supply",
			     "x-powers,axp813-ac-power-supply";
		status = "disabled";
	};

	axp_adc: adc {
		compatible = "x-powers,axp803-adc", "x-powers,axp813-adc";
		#io-channel-cells = <1>;
	};

	axp_gpio: gpio {
		compatible = "x-powers,axp803-gpio", "x-powers,axp813-gpio";
		gpio-controller;
		#gpio-cells = <2>;
	};

	battery_power_supply: battery-power {
		compatible = "x-powers,axp803-battery-power-supply",
			     "x-powers,axp813-battery-power-supply";
		status = "disabled";
	};

	regulators {
		/* Default work frequency for buck regulators */
		x-powers,dcdc-freq = <3000>;

		reg_aldo1: aldo1 {
			regulator-name = "aldo1";
		};

		reg_aldo2: aldo2 {
			regulator-name = "aldo2";
		};

		reg_aldo3: aldo3 {
			regulator-name = "aldo3";
		};

		reg_dc1sw: dc1sw {
			regulator-name = "dc1sw";
		};

		reg_dcdc1: dcdc1 {
			regulator-name = "dcdc1";
		};

		reg_dcdc2: dcdc2 {
			regulator-name = "dcdc2";
		};

		reg_dcdc3: dcdc3 {
			regulator-name = "dcdc3";
		};

		reg_dcdc4: dcdc4 {
			regulator-name = "dcdc4";
		};

		reg_dcdc5: dcdc5 {
			regulator-name = "dcdc5";
		};

		reg_dcdc6: dcdc6 {
			regulator-name = "dcdc6";
		};

		reg_dldo1: dldo1 {
			regulator-name = "dldo1";
		};

		reg_dldo2: dldo2 {
			regulator-name = "dldo2";
		};

		reg_dldo3: dldo3 {
			regulator-name = "dldo3";
		};

		reg_dldo4: dldo4 {
			regulator-name = "dldo4";
		};

		reg_eldo1: eldo1 {
			regulator-name = "eldo1";
		};

		reg_eldo2: eldo2 {
			regulator-name = "eldo2";
		};

		reg_eldo3: eldo3 {
			regulator-name = "eldo3";
		};

		reg_fldo1: fldo1 {
			regulator-name = "fldo1";
		};

		reg_fldo2: fldo2 {
			regulator-name = "fldo2";
		};

		reg_ldo_io0: ldo-io0 {
			regulator-name = "ldo-io0";
			status = "disabled";
		};

		reg_ldo_io1: ldo-io1 {
			regulator-name = "ldo-io1";
			status = "disabled";
		};

		reg_rtc_ldo: rtc-ldo {
			/* RTC_LDO is a fixed, always-on regulator */
			regulator-always-on;
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
			regulator-name = "rtc-ldo";
		};

		reg_drivevbus: drivevbus {
			regulator-name = "drivevbus";
			status = "disabled";
		};
	};

	usb_power_supply: usb-power {
		compatible = "x-powers,axp803-usb-power-supply",
			     "x-powers,axp813-usb-power-supply";
		status = "disabled";
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ or MIT)
/*
 * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com>
 */

/dts-v1/;

#include "sun50i-a100.dtsi"

/{
	model = "Allwinner A100 Perf1";
	compatible = "allwinner,a100-perf1", "allwinner,sun50i-a100";

	aliases {
		serial0 = &uart0;
	};

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

&pio {
	vcc-pb-supply = <&reg_dcdc1>;
	vcc-pc-supply = <&reg_eldo1>;
	vcc-pd-supply = <&reg_dcdc1>;
	vcc-pe-supply = <&reg_dldo2>;
	vcc-pf-supply = <&reg_dcdc1>;
	vcc-pg-supply = <&reg_dldo1>;
	vcc-ph-supply = <&reg_dcdc1>;
};

&r_pio {
	/*
	 * FIXME: We can't add that supply for now since it would
	 * create a circular dependency between pinctrl, the regulator
	 * and the RSB Bus.
	 *
	 * vcc-pl-supply = <&reg_aldo3>;
	 */
};

&r_i2c0 {
	status = "okay";

	axp803: pmic@34 {
		compatible = "x-powers,axp803";
		reg = <0x34>;
		interrupt-parent = <&r_intc>;
		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
	};
};

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&reg_aldo1 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "vcc-dram-1";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-usb-pl";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-io-usb-pd-emmc-nand-card";
};

&reg_dcdc2 {
	regulator-always-on;
	/*
	 * FIXME: update min and max before support dvfs.
	 */
	regulator-min-microvolt = <500000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

&reg_dcdc4 {
	regulator-always-on;
	regulator-min-microvolt = <950000>;
	regulator-max-microvolt = <950000>;
	regulator-name = "vdd-sys-usb-dram";
};

&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1500000>;
	regulator-name = "vcc-dram-2";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pg-dcxo-wifi";
};

&reg_dldo2 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "vcc-pe-csi";
};

&reg_dldo3 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "ldo-avdd-csi";
};

&reg_dldo4 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "avcc-csi";
};

&reg_eldo1 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "vcc-pc-lvds-csi-efuse-emmc-nand";
};

&reg_eldo2 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "dvdd-csi";
};

&reg_eldo3 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "vcc-mipi-lcd";
};

&reg_fldo1 {
	regulator-always-on;
	regulator-min-microvolt = <900000>;
	regulator-max-microvolt = <900000>;
	regulator-name = "vdd-cpus-usb";
};

&reg_ldo_io0 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-ctp";
	status = "okay";
};

&reg_drivevbus {
	regulator-name = "usb0-vbus";
	status = "okay";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ or MIT)
/*
 * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com>
 */

#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/sun50i-a100-ccu.h>
#include <dt-bindings/clock/sun50i-a100-r-ccu.h>
#include <dt-bindings/reset/sun50i-a100-ccu.h>
#include <dt-bindings/reset/sun50i-a100-r-ccu.h>

/ {
	interrupt-parent = <&gic>;
	#address-cells = <2>;
	#size-cells = <2>;

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

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

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

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

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

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

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

	iosc: internal-osc-clk {
		compatible = "fixed-clock";
		clock-frequency = <16000000>;
		clock-accuracy = <300000000>;
		clock-output-names = "iosc";
		#clock-cells = <0>;
	};

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

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

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

		ccu: clock@3001000 {
			compatible = "allwinner,sun50i-a100-ccu";
			reg = <0x03001000 0x1000>;
			clocks = <&dcxo24M>, <&osc32k>, <&iosc>;
			clock-names = "hosc", "losc", "iosc";
			#clock-cells = <1>;
			#reset-cells = <1>;
		};

		dma: dma-controller@3002000 {
			compatible = "allwinner,sun50i-a100-dma";
			reg = <0x03002000 0x1000>;
			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_DMA>, <&ccu CLK_MBUS_DMA>;
			clock-names = "bus", "mbus";
			resets = <&ccu RST_BUS_DMA>;
			dma-channels = <8>;
			dma-requests = <52>;
			#dma-cells = <1>;
		};

		gic: interrupt-controller@3021000 {
			compatible = "arm,gic-400";
			reg = <0x03021000 0x1000>, <0x03022000 0x2000>,
			      <0x03024000 0x2000>, <0x03026000 0x2000>;
			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
						 IRQ_TYPE_LEVEL_HIGH)>;
			interrupt-controller;
			#interrupt-cells = <3>;
		};

		efuse@3006000 {
			compatible = "allwinner,sun50i-a100-sid",
				     "allwinner,sun50i-a64-sid";
			reg = <0x03006000 0x1000>;
			#address-cells = <1>;
			#size-cells = <1>;

			ths_calibration: calib@14 {
				reg = <0x14 8>;
			};
		};

		pio: pinctrl@300b000 {
			compatible = "allwinner,sun50i-a100-pinctrl";
			reg = <0x0300b000 0x400>;
			interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_APB1>, <&dcxo24M>, <&osc32k>;
			clock-names = "apb", "hosc", "losc";
			gpio-controller;
			#gpio-cells = <3>;
			interrupt-controller;
			#interrupt-cells = <3>;

			uart0_pb_pins: uart0-pb-pins {
				pins = "PB9", "PB10";
				function = "uart0";
			};
		};

		uart0: serial@5000000 {
			compatible = "snps,dw-apb-uart";
			reg = <0x05000000 0x400>;
			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART0>;
			resets = <&ccu RST_BUS_UART0>;
			status = "disabled";
		};

		uart1: serial@5000400 {
			compatible = "snps,dw-apb-uart";
			reg = <0x05000400 0x400>;
			interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART1>;
			resets = <&ccu RST_BUS_UART1>;
			status = "disabled";
		};

		uart2: serial@5000800 {
			compatible = "snps,dw-apb-uart";
			reg = <0x05000800 0x400>;
			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART2>;
			resets = <&ccu RST_BUS_UART2>;
			status = "disabled";
		};

		uart3: serial@5000c00 {
			compatible = "snps,dw-apb-uart";
			reg = <0x05000c00 0x400>;
			interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART3>;
			resets = <&ccu RST_BUS_UART3>;
			status = "disabled";
		};

		uart4: serial@5001000 {
			compatible = "snps,dw-apb-uart";
			reg = <0x05001000 0x400>;
			interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&ccu CLK_BUS_UART4>;
			resets = <&ccu RST_BUS_UART4>;
			status = "disabled";
		};

		i2c0: i2c@5002000 {
			compatible = "allwinner,sun50i-a100-i2c",
				     "allwinner,sun8i-v536-i2c",
				     "allwinner,sun6i-a31-i2c";
			reg = <0x05002000 0x400>;
			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_I2C0>;
			resets = <&ccu RST_BUS_I2C0>;
			dmas = <&dma 43>, <&dma 43>;
			dma-names = "rx", "tx";
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		i2c1: i2c@5002400 {
			compatible = "allwinner,sun50i-a100-i2c",
				     "allwinner,sun8i-v536-i2c",
				     "allwinner,sun6i-a31-i2c";
			reg = <0x05002400 0x400>;
			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_I2C1>;
			resets = <&ccu RST_BUS_I2C1>;
			dmas = <&dma 44>, <&dma 44>;
			dma-names = "rx", "tx";
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		i2c2: i2c@5002800 {
			compatible = "allwinner,sun50i-a100-i2c",
				     "allwinner,sun8i-v536-i2c",
				     "allwinner,sun6i-a31-i2c";
			reg = <0x05002800 0x400>;
			interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_I2C2>;
			resets = <&ccu RST_BUS_I2C2>;
			dmas = <&dma 45>, <&dma 45>;
			dma-names = "rx", "tx";
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		i2c3: i2c@5002c00 {
			compatible = "allwinner,sun50i-a100-i2c",
				     "allwinner,sun8i-v536-i2c",
				     "allwinner,sun6i-a31-i2c";
			reg = <0x05002c00 0x400>;
			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_I2C3>;
			resets = <&ccu RST_BUS_I2C3>;
			dmas = <&dma 46>, <&dma 46>;
			dma-names = "rx", "tx";
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		ths: thermal-sensor@5070400 {
			compatible = "allwinner,sun50i-a100-ths";
			reg = <0x05070400 0x100>;
			interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&ccu CLK_BUS_THS>;
			clock-names = "bus";
			resets = <&ccu RST_BUS_THS>;
			nvmem-cells = <&ths_calibration>;
			nvmem-cell-names = "calibration";
			#thermal-sensor-cells = <1>;
		};

		r_ccu: clock@7010000 {
			compatible = "allwinner,sun50i-a100-r-ccu";
			reg = <0x07010000 0x300>;
			clocks = <&dcxo24M>, <&osc32k>, <&iosc>,
				 <&ccu CLK_PLL_PERIPH0>;
			clock-names = "hosc", "losc", "iosc", "pll-periph";
			#clock-cells = <1>;
			#reset-cells = <1>;
		};

		r_intc: interrupt-controller@7010320 {
			compatible = "allwinner,sun50i-a100-nmi",
				     "allwinner,sun9i-a80-nmi";
			interrupt-controller;
			#interrupt-cells = <2>;
			reg = <0x07010320 0xc>;
			interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
		};

		r_pio: pinctrl@7022000 {
			compatible = "allwinner,sun50i-a100-r-pinctrl";
			reg = <0x07022000 0x400>;
			interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&r_ccu CLK_R_APB1>, <&dcxo24M>, <&osc32k>;
			clock-names = "apb", "hosc", "losc";
			gpio-controller;
			#gpio-cells = <3>;
			interrupt-controller;
			#interrupt-cells = <3>;

			r_i2c0_pins: r-i2c0-pins {
				pins = "PL0", "PL1";
				function = "s_i2c0";
			};

			r_i2c1_pins: r-i2c1-pins {
				pins = "PL8", "PL9";
				function = "s_i2c1";
			};
		};

		r_uart: serial@7080000 {
			compatible = "snps,dw-apb-uart";
			reg = <0x07080000 0x400>;
			interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
			reg-shift = <2>;
			reg-io-width = <4>;
			clocks = <&r_ccu CLK_R_APB2_UART>;
			resets = <&r_ccu RST_R_APB2_UART>;
			status = "disabled";
		};

		r_i2c0: i2c@7081400 {
			compatible = "allwinner,sun50i-a100-i2c",
				     "allwinner,sun8i-v536-i2c",
				     "allwinner,sun6i-a31-i2c";
			reg = <0x07081400 0x400>;
			interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&r_ccu CLK_R_APB2_I2C0>;
			resets = <&r_ccu RST_R_APB2_I2C0>;
			dmas = <&dma 50>, <&dma 50>;
			dma-names = "rx", "tx";
			pinctrl-names = "default";
			pinctrl-0 = <&r_i2c0_pins>;
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};

		r_i2c1: i2c@7081800 {
			compatible = "allwinner,sun50i-a100-i2c",
				     "allwinner,sun8i-v536-i2c",
				     "allwinner,sun6i-a31-i2c";
			reg = <0x07081800 0x400>;
			interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
			clocks = <&r_ccu CLK_R_APB2_I2C1>;
			resets = <&r_ccu RST_R_APB2_I2C1>;
			dmas = <&dma 51>, <&dma 51>;
			dma-names = "rx", "tx";
			pinctrl-names = "default";
			pinctrl-0 = <&r_i2c1_pins>;
			status = "disabled";
			#address-cells = <1>;
			#size-cells = <0>;
		};
	};

	thermal-zones {
		cpu-thermal {
			polling-delay-passive = <0>;
			polling-delay = <0>;
			thermal-sensors = <&ths 0>;
		};

		ddr-thermal {
			polling-delay-passive = <0>;
			polling-delay = <0>;
			thermal-sensors = <&ths 2>;
		};

		gpu-thermal {
			polling-delay-passive = <0>;
			polling-delay = <0>;
			thermal-sensors = <&ths 1>;
		};
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2018 Amarula Solutions B.V.
// Author: Jagan Teki <jagan@amarulasolutions.com>

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

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

/ {
	model = "Amarula A64-Relic";
	compatible = "amarula,a64-relic", "allwinner,sun50i-a64";

	aliases {
		serial0 = &uart0;
	};

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

	i2c {
		compatible = "i2c-gpio";
		sda-gpios = <&pio 4 13 GPIO_ACTIVE_HIGH>;
		scl-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>;
		i2c-gpio,delay-us = <5>;
		#address-cells = <1>;
		#size-cells = <0>;

		ov5640: camera@3c {
			compatible = "ovti,ov5640";
			reg = <0x3c>;
			pinctrl-names = "default";
			pinctrl-0 = <&csi_mclk_pin>;
			clocks = <&ccu CLK_CSI_MCLK>;
			clock-names = "xclk";

			AVDD-supply = <&reg_aldo1>;
			DOVDD-supply = <&reg_dldo3>;
			DVDD-supply = <&reg_eldo3>;
			reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* CSI-RST-R: PE14 */
			powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* CSI-STBY-R: PE15 */

			port {
				ov5640_ep: endpoint {
					remote-endpoint = <&csi_ep>;
					bus-width = <8>;
					hsync-active = <1>; /* Active high */
					vsync-active = <0>; /* Active low */
					data-active = <1>;  /* Active high */
					pclk-sample = <1>;  /* Rising */
				};
			};
		};
	};

	wifi_pwrseq: wifi-pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&rtc CLK_OSC32K_FANOUT>;
		clock-names = "ext_clock";
		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* WL-PMU-EN: PL2 */
	};
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&csi {
	status = "okay";

	port {
		csi_ep: endpoint {
			remote-endpoint = <&ov5640_ep>;
			bus-width = <8>;
			hsync-active = <1>; /* Active high */
			vsync-active = <0>; /* Active low */
			data-active = <1>;  /* Active high */
			pclk-sample = <1>;  /* Rising */
		};
	};
};

&ehci0 {
	status = "okay";
};

&i2c0 {
	status = "okay";

	sensor@48 {
		compatible = "st,stlm75";
		reg = <0x48>;
	};
};

&i2c0_pins {
	bias-pull-up;
};

&i2c1 {
	status = "okay";

	touchscreen@5d {
		compatible = "goodix,gt5663";
		reg = <0x5d>;
		AVDD28-supply = <&reg_ldo_io0>;			/* VCC-CTP: GPIO0-LDO */
		interrupt-parent = <&pio>;
		interrupts = <7 4 IRQ_TYPE_EDGE_FALLING>;
		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>;	/* CTP-INT: PH4 */
		reset-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>;	/* CTP-RST: PH8 */
		touchscreen-inverted-x;
		touchscreen-inverted-y;
	};
};

&mmc1 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc1_pins>;
	vmmc-supply = <&reg_dcdc1>;
	/*
	 * Schematic shows both dldo4 and eldo1 connected for vcc-io-wifi, but
	 * dldo4 connection shows DNP(Do Not Populate) and eldo1 connected with
	 * 0Ohm register to vcc-io-wifi so eldo1 is used.
	 */
	vqmmc-supply = <&reg_eldo1>;
	mmc-pwrseq = <&wifi_pwrseq>;
	bus-width = <4>;
	non-removable;
	status = "okay";

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
		interrupt-parent = <&r_pio>;
		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>;	/* WL-WAKE-AP: PL3 */
		interrupt-names = "host-wake";
	};
};

&mmc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc2_pins>;
	vmmc-supply = <&reg_dcdc1>;
	bus-width = <8>;
	non-removable;
	cap-mmc-hw-reset;
	status = "okay";
};

&ohci0 {
	status = "okay";
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
	};
};

#include "axp803.dtsi"

&reg_aldo1 {
	regulator-always-on;
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "avdd-csi";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1040000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1500000>;
	regulator-name = "vcc-dram";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi-dsi-sensor";
};

&reg_dldo2 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-mipi";
};

&reg_dldo3 {
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "dovdd-csi";
};

&reg_dldo4 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi-io";
};

&reg_drivevbus {
	regulator-name = "usb0-vbus";
	status = "okay";
};

&reg_eldo1 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_eldo3 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "dvdd-csi";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

/*
 * The A64 chip cannot work without this regulator off, although
 * it seems to be only driving the AR100 core.
 * Maybe we don't still know well about CPUs domain.
 */
&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_ldo_io0 {
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "vcc-ctp";
	status = "okay";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

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

&usbphy {
	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
	usb0_vbus-supply = <&reg_drivevbus>;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (c) 2016 ARM Ltd.

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

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

/ {
	model = "BananaPi-M64";
	compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";

	aliases {
		ethernet0 = &emac;
		serial0 = &uart0;
		serial1 = &uart1;
	};

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

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

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		led-0 {
			label = "bananapi-m64:red:pwr";
			gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
			default-state = "on";
		};

		led-1 {
			label = "bananapi-m64:green:user";
			gpios = <&pio 4 14 GPIO_ACTIVE_HIGH>; /* PE14 */
		};

		led-2 {
			label = "bananapi-m64:blue:user";
			gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */
		};
	};

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
		clocks = <&rtc CLK_OSC32K_FANOUT>;
		clock-names = "ext_clock";
	};
};

&codec {
	status = "okay";
};

&codec_analog {
	cpvdd-supply = <&reg_eldo1>;
	status = "okay";
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&dai {
	status = "okay";
};

&de {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii_pins>;
	phy-mode = "rgmii-id";
	phy-handle = <&ext_rgmii_phy>;
	phy-supply = <&reg_dc1sw>;
	status = "okay";
};

&hdmi {
	hvcc-supply = <&reg_dldo1>;
	status = "okay";
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&i2c1 {
	status = "okay";
};

&i2c1_pins {
	bias-pull-up;
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>;
	vmmc-supply = <&reg_dcdc1>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
	disable-wp;
	bus-width = <4>;
	status = "okay";
};

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

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
		interrupt-parent = <&r_pio>;
		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
		interrupt-names = "host-wake";
	};
};

&mmc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
	vmmc-supply = <&reg_dcdc1>;
	bus-width = <8>;
	non-removable;
	cap-mmc-hw-reset;
	status = "okay";
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
	};
};

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&battery_power_supply {
	status = "okay";
};

&reg_aldo1 {
	/*
	 * This regulator also drives the PE pingroup GPIOs,
	 * which also controls two LEDs.
	 */
	regulator-always-on;
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "afvcc-csi";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dc1sw {
	/*
	 * This regulator also indirectly drives the PD pingroup GPIOs,
	 * which also controls the power LED.
	 */
	regulator-always-on;
	regulator-name = "vcc-phy";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1040000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1500000>;
	regulator-name = "vcc-dram";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi-dsi";
};

&reg_dldo2 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi";
};

&reg_dldo4 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi-io";
};

&reg_drivevbus {
	regulator-name = "usb0-vbus";
	status = "okay";
};

&reg_eldo1 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

/*
 * The A64 chip cannot work without this regulator off, although
 * it seems to be only driving the AR100 core.
 * Maybe we don't still know well about CPUs domain.
 */
&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&simplefb_hdmi {
	vcc-hdmi-supply = <&reg_dldo1>;
};

&sound {
	status = "okay";
	simple-audio-card,widgets = "Headphone", "Headphone Jack",
				    "Microphone", "Microphone Jack",
				    "Microphone", "Onboard Microphone";
	simple-audio-card,routing =
			"Left DAC", "DACL",
			"Right DAC", "DACR",
			"ADCL", "Left ADC",
			"ADCR", "Right ADC",
			"Headphone Jack", "HP",
			"MIC2", "Microphone Jack",
			"Onboard Microphone", "MBIAS",
			"MIC1", "Onboard Microphone";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

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

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		clocks = <&rtc CLK_OSC32K_FANOUT>;
		clock-names = "lpo";
		vbat-supply = <&reg_dldo2>;
		vddio-supply = <&reg_dldo4>;
		device-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
		host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
		shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
	};
};

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

&usb_power_supply {
	status = "okay";
};

&usbphy {
	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
	usb0_vbus_power-supply = <&usb_power_supply>;
	usb0_vbus-supply = <&reg_drivevbus>;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2017 Jagan Teki <jteki@openedev.com>

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

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

/ {
	model = "FriendlyARM NanoPi A64";
	compatible = "friendlyarm,nanopi-a64", "allwinner,sun50i-a64";

	aliases {
		ethernet0 = &emac;
		serial0 = &uart0;
	};

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

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

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		led {
			label = "nanopi-a64:blue:status";
			gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
		};
	};

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&rtc CLK_OSC32K_FANOUT>;
		clock-names = "ext_clock";
		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
	};
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&de {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii_pins>;
	phy-mode = "rgmii";
	phy-handle = <&ext_rgmii_phy>;
	phy-supply = <&reg_dcdc1>;
	status = "okay";
};

&hdmi {
	hvcc-supply = <&reg_dldo1>;
	status = "okay";
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

/* i2c1 connected with gpio headers like pine64, bananapi */
&i2c1_pins {
	bias-pull-up;
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <7>;
	};
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>;
	vmmc-supply = <&reg_dcdc1>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
	disable-wp;
	bus-width = <4>;
	status = "okay";
};

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

	rtl8189etv: wifi@1 {
		reg = <1>;
		interrupt-parent = <&r_pio>;
		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
		interrupt-names = "host-wake";
	};
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
	};
};

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1040000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1500000>;
	regulator-name = "vcc-dram";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi-dsi";
};

&reg_dldo4 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pg-wifi-io";
};

&reg_eldo1 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

/*
 * The A64 chip cannot work without this regulator off, although
 * it seems to be only driving the AR100 core.
 * Maybe we don't still know well about CPUs domain.
 */
&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&simplefb_hdmi {
	vcc-hdmi-supply = <&reg_dldo1>;
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

&usbphy {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2019 Oceanic Systems (UK) Ltd.
// Copyright (C) 2019 Amarula Solutions B.V.
// Author: Jagan Teki <jagan@amarulasolutions.com>

/dts-v1/;

#include "sun50i-a64-sopine.dtsi"

/ {
	model = "Oceanic 5205 5inMFD";
	compatible = "oceanic,5205-5inmfd", "allwinner,sun50i-a64";

	aliases {
		ethernet0 = &emac;
		serial0 = &uart0;
	};

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

&ehci0 {
	status = "okay";
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii_pins>;
	phy-mode = "rgmii";
	phy-handle = <&ext_rgmii_phy>;
	phy-supply = <&reg_dc1sw>;
	allwinner,tx-delay-ps = <600>;
	status = "okay";
};

&i2c0 {
	status = "okay";

	touchscreen@5d {
		compatible = "goodix,gt911";
		reg = <0x5d>;
		AVDD28-supply = <&reg_ldo_io0>;			/* VDD_CTP: GPIO0-LDO */
		interrupt-parent = <&pio>;
		interrupts = <7 4 IRQ_TYPE_EDGE_FALLING>;
		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>;	/* CTP-INT: PH4 */
		reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>;	/* CTP-RST: PH11 */
		touchscreen-inverted-x;
		touchscreen-inverted-y;
	};
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

&ohci0 {
	status = "okay";
};

&reg_dc1sw {
	regulator-name = "vcc-phy";
};

&reg_ldo_io0 {
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "vdd-ctp";
	status = "okay";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

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

&usbphy {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2018 Martin Ayotte <martinayotte@gmail.com>
// Copyright (C) 2019 Sunil Mohan Adapa <sunil@medhas.org>

#include "sun50i-a64-olinuxino.dts"

/ {
	model = "Olimex A64-Olinuxino-eMMC";
	compatible = "olimex,a64-olinuxino-emmc", "allwinner,sun50i-a64";
};

&mmc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc2_pins>;
	vmmc-supply = <&reg_dcdc1>;
	vqmmc-supply = <&reg_eldo1>;
	bus-width = <8>;
	non-removable;
	cap-mmc-hw-reset;
	status = "okay";
};

&pio {
	vcc-pc-supply = <&reg_eldo1>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2017 Jagan Teki <jteki@openedev.com>

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

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

/ {
	model = "Olimex A64-Olinuxino";
	compatible = "olimex,a64-olinuxino", "allwinner,sun50i-a64";

	aliases {
		ethernet0 = &emac;
		serial0 = &uart0;
	};

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

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

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		led-0 {
			label = "a64-olinuxino:red:user";
			gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* PE17 */
		};
	};

	reg_usb1_vbus: usb1-vbus {
		compatible = "regulator-fixed";
		regulator-name = "usb1-vbus";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-boot-on;
		enable-active-high;
		gpio = <&pio 6 9 GPIO_ACTIVE_HIGH>; /* PG9 */
		status = "okay";
	};

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
	};
};

&codec {
	status = "okay";
};

&codec_analog {
	cpvdd-supply = <&reg_eldo1>;
	status = "okay";
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&dai {
	status = "okay";
};

&de {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii_pins>;
	phy-mode = "rgmii";
	phy-handle = <&ext_rgmii_phy>;
	phy-supply = <&reg_dcdc1>;
	allwinner,tx-delay-ps = <600>;
	status = "okay";
};

&hdmi {
	hvcc-supply = <&reg_dldo1>;
	status = "okay";
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>;
	vmmc-supply = <&reg_dcdc1>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
	disable-wp;
	bus-width = <4>;
	status = "okay";
};

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

	rtl8723bs: wifi@1 {
		reg = <1>;
		interrupt-parent = <&r_pio>;
		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
		interrupt-names = "host-wake";
	};
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&pio {
	vcc-pc-supply = <&reg_dcdc1>;
	vcc-pd-supply = <&reg_dcdc1>;
	vcc-pe-supply = <&reg_aldo1>;
	vcc-pg-supply = <&reg_dldo4>;
};

&r_pio {
	/*
	 * FIXME: We can't add that supply for now since it would
	 * create a circular dependency between pinctrl, the regulator
	 * and the RSB Bus.
	 *
	 * vcc-pl-supply = <&reg_aldo2>;
	 */
};

&pio {
	vcc-pa-supply = <&reg_dcdc1>;
	vcc-pb-supply = <&reg_dcdc1>;
	vcc-pc-supply = <&reg_dcdc1>;
	vcc-pd-supply = <&reg_dcdc1>;
	vcc-pe-supply = <&reg_aldo1>;
	vcc-pf-supply = <&reg_dcdc1>;
	vcc-pg-supply = <&reg_dldo4>;
	vcc-ph-supply = <&reg_dcdc1>;
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
		x-powers,drive-vbus-en;	/* set N_VBUSEN as output pin */
	};
};

/* VCC-PL is powered by aldo2 but we cannot add it as the RSB */
/* interface used to talk to the PMIC in on the PL pins */
/* &r_pio { */
/*	vcc-pl-supply = <&reg_aldo2>; */
/* }; */

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&battery_power_supply {
	status = "okay";
};

&reg_aldo1 {
	regulator-always-on;
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "vcc-pe";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1040000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

/*
 * The board uses DDR3L DRAM chips. 1.36V is the closest to the nominal
 * 1.35V that the PMIC can drive.
 */
&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1360000>;
	regulator-max-microvolt = <1360000>;
	regulator-name = "vcc-ddr3";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi";
};

&reg_dldo2 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-mipi";
};

&reg_dldo3 {
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "vcc-avdd-csi";
};

&reg_dldo4 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi-io";
};

&reg_drivevbus {
	regulator-name = "usb0-vbus";
	status = "okay";
};

&reg_eldo1 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_eldo2 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "vcc-dvdd-csi";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

/*
 * The A64 chip cannot work without this regulator off, although
 * it seems to be only driving the AR100 core.
 * Maybe we don't still know well about CPUs domain.
 */
&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&simplefb_hdmi {
	vcc-hdmi-supply = <&reg_dldo1>;
};

&sound {
	simple-audio-card,aux-devs = <&codec_analog>;
	simple-audio-card,widgets = "Microphone", "Microphone Jack Left",
		    "Microphone", "Microphone Jack Right",
		    "Headphone", "Headphone Jack";
	simple-audio-card,routing = "Left DAC", "DACL",
		    "Right DAC", "DACR",
		    "Headphone Jack", "HP",
		    "ADCL", "Left ADC",
		    "ADCR", "Right ADC",
		    "Microphone Jack Left", "MBIAS",
		    "MIC1", "Microphone Jack Left",
		    "Microphone Jack Right", "MBIAS",
		    "MIC2", "Microphone Jack Right";
	status = "okay";
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

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

&usbphy {
	status = "okay";
	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
	usb0_vbus-supply = <&reg_drivevbus>;
	usb1_vbus-supply = <&reg_usb1_vbus>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
// Copyright (C) 2017-2018 Samuel Holland <samuel@sholland.org>

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

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

/ {
	model = "OrangePi Win/Win Plus";
	compatible = "xunlong,orangepi-win", "allwinner,sun50i-a64";

	aliases {
		ethernet0 = &emac;
		serial0 = &uart0;
		serial1 = &uart1;
		serial2 = &uart2;
		serial3 = &uart3;
		serial4 = &uart4;
	};

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

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

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};

	leds {
		compatible = "gpio-leds";

		led-0 {
			label = "orangepi:green:status";
			gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
		};
	};

	reg_gmac_3v3: gmac-3v3 {
		compatible = "regulator-fixed";
		regulator-name = "gmac-3v3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-boot-on;
		enable-active-high;
		gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
		status = "okay";
	};

	reg_usb1_vbus: usb1-vbus {
		compatible = "regulator-fixed";
		regulator-name = "usb1-vbus";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		regulator-boot-on;
		enable-active-high;
		gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* PD7 */
		status = "okay";
	};

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
		clocks = <&rtc CLK_OSC32K_FANOUT>;
		clock-names = "ext_clock";
	};
};

&codec {
	status = "okay";
};

&codec_analog {
	cpvdd-supply = <&reg_eldo1>;
	status = "okay";
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&dai {
	status = "okay";
};

&de {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii_pins>;
	phy-mode = "rgmii-id";
	phy-handle = <&ext_rgmii_phy>;
	phy-supply = <&reg_gmac_3v3>;
	status = "okay";
};

&hdmi {
	hvcc-supply = <&reg_dldo1>;
	status = "okay";
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>;
	vmmc-supply = <&reg_dcdc1>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
	disable-wp;
	bus-width = <4>;
	status = "okay";
};

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

	brcmf: wifi@1 {
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
		interrupt-parent = <&r_pio>;
		interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>; /* PL7 */
		interrupt-names = "host-wake";
	};
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&r_ir {
	status = "okay";
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
	};
};

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&battery_power_supply {
	status = "okay";
};

&reg_aldo1 {
	regulator-min-microvolt = <2800000>;
	regulator-max-microvolt = <2800000>;
	regulator-name = "afvcc-csi";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1040000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1500000>;
	regulator-name = "vcc-dram";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi-dsi";
};

&reg_dldo2 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi";
};

&reg_dldo3 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "avdd-csi";
};

&reg_dldo4 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi-io";
};

&reg_drivevbus {
	regulator-name = "usb0-vbus";
	status = "okay";
};

&reg_eldo1 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_eldo3 {
	regulator-min-microvolt = <1500000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "dvdd-csi";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

/*
 * The A64 chip cannot work without this regulator off, although
 * it seems to be only driving the AR100 core.
 * Maybe we don't still know well about CPUs domain.
 */
&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&simplefb_hdmi {
	vcc-hdmi-supply = <&reg_dldo1>;
};

&sound {
	status = "okay";
	simple-audio-card,widgets = "Headphone", "Headphone Jack",
				    "Microphone", "Microphone Jack",
				    "Microphone", "Onboard Microphone";
	simple-audio-card,routing =
			"Left DAC", "DACL",
			"Right DAC", "DACR",
			"ADCL", "Left ADC",
			"ADCR", "Right ADC",
			"Headphone Jack", "HP",
			"MIC2", "Microphone Jack",
			"Onboard Microphone", "MBIAS",
			"MIC1", "Onboard Microphone";
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		m25p,fast-read;
		status = "okay";
	};
};

/* On debug connector */
&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

/* Bluetooth */
&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
	uart-has-rtscts;
	status = "okay";

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		max-speed = <1500000>;
		clocks = <&rtc CLK_OSC32K_FANOUT>;
		clock-names = "lpo";
		vbat-supply = <&reg_dldo2>;
		vddio-supply = <&reg_dldo4>;
		device-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
		host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
		shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
	};
};

/* On Pi-2 connector, RTS/CTS optional */
&uart2 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart2_pins>;
	status = "disabled";
};

/* On Pi-2 connector, RTS/CTS optional */
&uart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart3_pins>;
	status = "disabled";
};

/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins>;
	status = "disabled";
};

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

&usbphy {
	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
	usb0_vbus-supply = <&reg_drivevbus>;
	usb1_vbus-supply = <&reg_usb1_vbus>;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (c) 2018 ARM Ltd.

#include <dt-bindings/leds/common.h>
#include "sun50i-a64-sopine-baseboard.dts"

/ {
	model = "Pine64 LTS";
	compatible = "pine64,pine64-lts", "allwinner,sun50i-r18",
		     "allwinner,sun50i-a64";

	leds {
		compatible = "gpio-leds";

		led {
			function = LED_FUNCTION_STATUS;
			color = <LED_COLOR_ID_BLUE>;
			gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
		};
	};
};

&mmc0 {
	broken-cd;		/* card detect is broken on *some* boards */
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (c) 2016 ARM Ltd.

#include "sun50i-a64-pine64.dts"

/ {
	model = "Pine64+";
	compatible = "pine64,pine64-plus", "allwinner,sun50i-a64";

	/* TODO: Camera, touchscreen, etc. */
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rgmii_pins>;
	phy-mode = "rgmii-txid";
	phy-handle = <&ext_rgmii_phy>;
	status = "okay";
};

&mdio {
	ext_rgmii_phy: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

&reg_dc1sw {
	/*
	 * Ethernet PHY needs 30ms to properly power up and some more
	 * to initialize. 100ms should be plenty of time to finish
	 * whole process.
	 */
	regulator-enable-ramp-delay = <100000>;
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (c) 2016 ARM Ltd.

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

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

/ {
	model = "Pine64";
	compatible = "pine64,pine64", "allwinner,sun50i-a64";

	aliases {
		ethernet0 = &emac;
		serial0 = &uart0;
		serial1 = &uart1;
		serial2 = &uart2;
		serial3 = &uart3;
		serial4 = &uart4;
	};

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

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

		port {
			hdmi_con_in: endpoint {
				remote-endpoint = <&hdmi_out_con>;
			};
		};
	};
};

&codec {
	status = "okay";
};

&codec_analog {
	cpvdd-supply = <&reg_eldo1>;
	status = "okay";
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&dai {
	status = "okay";
};

&de {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&emac {
	pinctrl-names = "default";
	pinctrl-0 = <&rmii_pins>;
	phy-mode = "rmii";
	phy-handle = <&ext_rmii_phy1>;
	phy-supply = <&reg_dc1sw>;
	status = "okay";

};

&hdmi {
	hvcc-supply = <&reg_dldo1>;
	status = "okay";
};

&hdmi_out {
	hdmi_out_con: endpoint {
		remote-endpoint = <&hdmi_con_in>;
	};
};

&i2c1 {
	status = "okay";
};

&i2c1_pins {
	bias-pull-up;
};

&mdio {
	ext_rmii_phy1: ethernet-phy@1 {
		compatible = "ethernet-phy-ieee802.3-c22";
		reg = <1>;
	};
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>;
	vmmc-supply = <&reg_dcdc1>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
	disable-wp;
	bus-width = <4>;
	status = "okay";
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
	};
};

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&battery_power_supply {
	status = "okay";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <3000000>;
	regulator-max-microvolt = <3000000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dc1sw {
	regulator-name = "vcc-phy";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1040000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

/*
 * The DRAM chips used by Pine64 boards are DDR3L-compatible, so they can
 * work at 1.35V with less power consumption.
 * As AXP803 DCDC5 cannot reach 1.35V accurately, use 1.36V instead.
 */
&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1360000>;
	regulator-max-microvolt = <1360000>;
	regulator-name = "vcc-dram";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi";
};

&reg_dldo2 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-mipi";
};

&reg_dldo4 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi";
};

&reg_eldo1 {
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

/*
 * The A64 chip cannot work without this regulator off, although
 * it seems to be only driving the AR100 core.
 * Maybe we don't still know well about CPUs domain.
 */
&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&simplefb_hdmi {
	vcc-hdmi-supply = <&reg_dldo1>;
};

&sound {
	simple-audio-card,aux-devs = <&codec_analog>;
	simple-audio-card,widgets = "Microphone", "Microphone Jack",
				    "Headphone", "Headphone Jack";
	simple-audio-card,routing =
			"Left DAC", "DACL",
			"Right DAC", "DACR",
			"Headphone Jack", "HP",
			"ADCL", "Left ADC",
			"ADCR", "Right ADC",
			"MIC2", "Microphone Jack";
	status = "okay";
};

/* On Euler connector */
&spdif {
	status = "disabled";
};

/* On Exp and Euler connectors */
&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

/* On Wifi/BT connector, with RTS/CTS */
&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
	status = "disabled";
};

/* On Pi-2 connector */
&uart2 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart2_pins>;
	status = "disabled";
};

/* On Euler connector */
&uart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart3_pins>;
	status = "disabled";
};

/* On Euler connector, RTS/CTS optional */
&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins>;
	status = "disabled";
};

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

&usbphy {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
// Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>

/dts-v1/;

#include "sun50i-a64.dtsi"
#include "sun50i-a64-cpu-opp.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/gpio-keys.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pwm/pwm.h>

/ {
	model = "Pinebook";
	compatible = "pine64,pinebook", "allwinner,sun50i-a64";
	chassis-type = "laptop";

	aliases {
		serial0 = &uart0;
		ethernet0 = &rtl8723cs;
	};

	backlight: backlight {
		compatible = "pwm-backlight";
		pwms = <&pwm 0 50000 0>;
		brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
		default-brightness-level = <2>;
		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
		power-supply = <&reg_vbklt>;
	};

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

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

		lid-switch {
			label = "Lid Switch";
			gpios = <&r_pio 0 12 GPIO_ACTIVE_LOW>; /* PL12 */
			linux,input-type = <EV_SW>;
			linux,code = <SW_LID>;
			linux,can-disable;
			wakeup-source;
			wakeup-event-action = <EV_ACT_DEASSERTED>;
		};
	};

	panel_edp: panel-edp {
		compatible = "neweast,wjfh116008a";
		backlight = <&backlight>;
		power-supply = <&reg_dc1sw>;

		port {
			panel_edp_in: endpoint {
				remote-endpoint = <&anx6345_out_edp>;
			};
		};
	};

	reg_vbklt: vbklt {
		compatible = "regulator-fixed";
		regulator-name = "vbklt";
		regulator-min-microvolt = <18000000>;
		regulator-max-microvolt = <18000000>;
		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
		enable-active-high;
	};

	reg_vcc5v0: vcc5v0 {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpio = <&axp_gpio 0 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
	};

	speaker_amp: audio-amplifier {
		compatible = "simple-audio-amplifier";
		VCC-supply = <&reg_vcc5v0>;
		enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
		sound-name-prefix = "Speaker Amp";
	};

};

&codec {
	status = "okay";
};

&codec_analog {
	cpvdd-supply = <&reg_eldo1>;
	status = "okay";
};

&cpu0 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu1 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu2 {
	cpu-supply = <&reg_dcdc2>;
};

&cpu3 {
	cpu-supply = <&reg_dcdc2>;
};

&dai {
	status = "okay";
};

&de {
	status = "okay";
};

&ehci0 {
	status = "okay";
};

&ehci1 {
	status = "okay";
};

&mixer0 {
	status = "okay";
};

&mmc0 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>;
	vmmc-supply = <&reg_dcdc1>;
	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
	disable-wp;
	bus-width = <4>;
	status = "okay";
};

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

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

&mmc2 {
	pinctrl-names = "default";
	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
	vmmc-supply = <&reg_dcdc1>;
	vqmmc-supply = <&reg_eldo1>;
	max-frequency = <200000000>;
	bus-width = <8>;
	non-removable;
	cap-mmc-hw-reset;
	mmc-hs200-1_8v;
	status = "okay";
};

&ohci0 {
	status = "okay";
};

&ohci1 {
	status = "okay";
};

&pio {
	vcc-pc-supply = <&reg_eldo1>;
	vcc-pd-supply = <&reg_dcdc1>;
	vcc-pe-supply = <&reg_aldo1>;
	vcc-pg-supply = <&reg_eldo1>;
};

&pwm {
	status = "okay";
};

&r_i2c {
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&r_i2c_pl89_pins>;
	status = "okay";

	anx6345: anx6345@38 {
		compatible = "analogix,anx6345";
		reg = <0x38>;
		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
		dvdd25-supply = <&reg_dldo2>;
		dvdd12-supply = <&reg_fldo1>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			anx6345_in: port@0 {
				reg = <0>;
				anx6345_in_tcon0: endpoint {
					remote-endpoint = <&tcon0_out_anx6345>;
				};
			};

			anx6345_out: port@1 {
				reg = <1>;
				anx6345_out_edp: endpoint {
					remote-endpoint = <&panel_edp_in>;
				};
			};
		};
	};
};

&r_pio {
	/*
	 * FIXME: We can't add that supply for now since it would
	 * create a circular dependency between pinctrl, the regulator
	 * and the RSB Bus.
	 *
	 * vcc-pl-supply = <&reg_aldo2>;
	 */
};

&r_rsb {
	status = "okay";

	axp803: pmic@3a3 {
		compatible = "x-powers,axp803";
		reg = <0x3a3>;
		interrupt-parent = <&r_intc>;
		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
	};
};

#include "axp803.dtsi"

&ac_power_supply {
	status = "okay";
};

&battery_power_supply {
	status = "okay";
};

&reg_aldo1 {
	regulator-name = "vcc-pe";
};

&reg_aldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pl";
};

&reg_aldo3 {
	regulator-always-on;
	regulator-min-microvolt = <2700000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-pll-avcc";
};

&reg_dc1sw {
	regulator-name = "vcc-lcd";
};

&reg_dcdc1 {
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-3v3";
};

&reg_dcdc2 {
	regulator-always-on;
	regulator-min-microvolt = <1000000>;
	regulator-max-microvolt = <1300000>;
	regulator-name = "vdd-cpux";
};

/* DCDC3 is polyphased with DCDC2 */

&reg_dcdc5 {
	regulator-always-on;
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-dram";
};

&reg_dcdc6 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-sys";
};

&reg_dldo1 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-hdmi";
};

&reg_dldo2 {
	regulator-min-microvolt = <2500000>;
	regulator-max-microvolt = <2500000>;
	regulator-name = "vcc-edp";
};

&reg_dldo4 {
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	regulator-name = "vcc-wifi";
};

&reg_eldo1 {
	regulator-always-on;
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
	regulator-name = "cpvdd";
};

&reg_fldo1 {
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <1200000>;
	regulator-name = "vcc-1v2-hsic";
};

&reg_fldo2 {
	regulator-always-on;
	regulator-min-microvolt = <1100000>;
	regulator-max-microvolt = <1100000>;
	regulator-name = "vdd-cpus";
};

&reg_rtc_ldo {
	regulator-name = "vcc-rtc";
};

&simplefb_lcd {
	panel-supply = <&reg_dc1sw>;
	dvdd25-supply = <&reg_dldo2>;
	dvdd12-supply = <&reg_fldo1>;
};

&simplefb_hdmi {
	vcc-hdmi-supply = <&reg_dldo1>;
};

&sound {
	status = "okay";
	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
	simple-audio-card,widgets = "Microphone", "Internal Microphone Left",
				    "Microphone", "Internal Microphone Right",
				    "Headphone", "Headphone Jack",
				    "Speaker", "Internal Speaker";
	simple-audio-card,routing =
			"Left DAC", "DACL",
			"Right DAC", "DACR",
			"Speaker Amp INL", "LINEOUT",
			"Speaker Amp INR", "LINEOUT",
			"Internal Speaker", "Speaker Amp OUTL",
			"Internal Speaker", "Speaker Amp OUTR",
			"Headphone Jack", "HP",
			"ADCL", "Left ADC",
			"ADCR", "Right ADC",
			"Internal Microphone Left", "MBIAS",
			"MIC1", "Internal Microphone Left",
			"Internal Microphone Right", "HBIAS",
			"MIC2", "Internal Microphone Right";
};

&tcon0 {
	pinctrl-names = "default";
	pinctrl-0 = <&lcd_rgb666_pins>;

	status = "okay";
};

&tcon0_out {
	tcon0_out_anx6345: endpoint {
		remote-endpoint = <&anx6345_in_tcon0>;
	};
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart0_pb_pins>;
	status = "okay";
};

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

	bluetooth {
		compatible = "realtek,rtl8723cs-bt";
		device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
		enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
		host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
	};
};

&usb_otg {
	dr_mode = "host";
};

&usbphy {
	usb0_vbus-supply = <&reg_vcc5v0>;
	usb1_vbus-supply = <&reg_vcc5v0>;
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2020 Ondrej Jirman <megous@megous.com>

/dts-v1/;

#include "sun50i-a64-pinephone.dtsi"

/ {
	model = "Pine64 PinePhone Developer Batch (1.0)";
	compatible = "pine64,pinephone-1.0", "pine64,pinephone", "allwinner,sun50i-a64";
};

&codec_analog {
	allwinner,internal-bias-resistor;
};

&sgm3140 {
	enable-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
	flash-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2020 Ondrej Jirman <megous@megous.com>

/dts-v1/;

#include "sun50i-a64-pinephone.dtsi"

/ {
	model = "Pine64 PinePhone Braveheart (1.1)";
	compatible = "pine64,pinephone-1.1", "pine64,pinephone", "allwinner,sun50i-a64";
};

&backlight {
	power-supply = <&reg_ldo_io0>;
	/*
	 * PWM backlight circuit on this PinePhone revision was changed since
	 * 1.0, and the lowest PWM duty cycle that doesn't lead to backlight
	 * being off is around 20%. Duty cycle for the lowest brightness level
	 * also varries quite a bit between individual boards, so the lowest
	 * value here was chosen as a safe default.
	 */
	brightness-levels = <
		774  793  814  842
		882  935  1003 1088
		1192 1316 1462 1633
		1830 2054 2309 2596
		2916 3271 3664 4096>;
	num-interpolated-steps = <50>;
	default-brightness-level = <400>;
};

&codec_analog {
	allwinner,internal-bias-resistor;
};

&sgm3140 {
	enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
	flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
// Copyright (C) 2020 Ondrej Jirman <megous@megous.com>

/dts-v1/;

#include "sun50i-a64-pinephone.dtsi"

/ {
	model = "Pine64 PinePhone (1.2)";
	compatible = "pine64,pinephone-1.2", "pine64,pinephone", "allwinner,sun50i-a64";

	wifi_pwrseq: wifi-pwrseq {
		compatible = "mmc-pwrseq-simple";
		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
	};
};

&backlight {
	power-supply = <&reg_ldo_io0>;
	/*
	 * PWM backlight circuit on this PinePhone revision was changed since 1.0,
	 * and the lowest PWM duty cycle that doesn't lead to backlight being off
	 * is around 10%. Duty cycle for the lowest brightness level also varries
	 * quite a bit between individual boards, so the lowest value here was
	 * chosen as a safe default.
	 */
	brightness-levels = <
		5000 5248 5506 5858 6345
		6987 7805 8823 10062 11543
		13287 15317 17654 20319 23336
		26724 30505 34702 39335 44427
		50000
	>;
	num-interpolated-steps = <50>;
	default-brightness-level = <500>;
};

&lis3mdl {
	/*
	 * Board revision 1.2 fixed routing of the interrupt to DRDY pin,
	 * enable interrupts.
	 */
	interrupt-parent = <&pio>;
	interrupts = <1 1 IRQ_TYPE_EDGE_RISING>; /* PB1 */
};

&mmc1 {
	mmc-pwrseq = <&wifi_pwrseq>;
};

&sgm3140 {
	enable-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
	flash-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */
};