1// SPDX-License-Identifier: (GPL-2.0+ OR X11)
2/*
3 * Copyright 2019 Icenowy Zheng <icenowy@aosc.io>
4 */
5
6/dts-v1/;
7#include "sun8i-v3.dtsi"
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10
11/ {
12	model = "PineCube IP Camera";
13	compatible = "pine64,pinecube", "sochip,s3", "allwinner,sun8i-v3";
14
15	aliases {
16		serial0 = &uart2;
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	leds {
24		compatible = "gpio-leds";
25
26		led1 {
27			label = "pine64:ir:led1";
28			gpios = <&pio 1 10 GPIO_ACTIVE_LOW>; /* PB10 */
29		};
30
31		led2 {
32			label = "pine64:ir:led2";
33			gpios = <&pio 1 12 GPIO_ACTIVE_LOW>; /* PB12 */
34		};
35	};
36
37	reg_vcc5v0: vcc5v0 {
38		compatible = "regulator-fixed";
39		regulator-name = "vcc5v0";
40		regulator-min-microvolt = <5000000>;
41		regulator-max-microvolt = <5000000>;
42	};
43
44	reg_vcc_wifi: vcc-wifi {
45		compatible = "regulator-fixed";
46		regulator-name = "vcc-wifi";
47		regulator-min-microvolt = <3300000>;
48		regulator-max-microvolt = <3300000>;
49		gpio = <&pio 1 2 GPIO_ACTIVE_LOW>; /* PB2 WIFI-EN */
50		vin-supply = <&reg_dcdc3>;
51		startup-delay-us = <200000>;
52	};
53
54	wifi_pwrseq: wifi_pwrseq {
55		compatible = "mmc-pwrseq-simple";
56		reset-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 WIFI-RST */
57		post-power-on-delay-ms = <200>;
58	};
59};
60
61&csi1 {
62	pinctrl-names = "default";
63	pinctrl-0 = <&csi1_8bit_pins>;
64	status = "okay";
65
66	port {
67		csi1_ep: endpoint {
68			remote-endpoint = <&ov5640_ep>;
69			bus-width = <8>;
70			hsync-active = <1>; /* Active high */
71			vsync-active = <0>; /* Active low */
72			data-active = <1>;  /* Active high */
73			pclk-sample = <1>;  /* Rising */
74		};
75	};
76};
77
78&emac {
79	phy-handle = <&int_mii_phy>;
80	phy-mode = "mii";
81	status = "okay";
82};
83
84&i2c0 {
85	status = "okay";
86
87	axp209: pmic@34 {
88		reg = <0x34>;
89		interrupt-parent = <&nmi_intc>;
90		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
91	};
92};
93
94&i2c1 {
95	pinctrl-names = "default";
96	pinctrl-0 = <&i2c1_pe_pins>;
97	status = "okay";
98
99	ov5640: camera@3c {
100		compatible = "ovti,ov5640";
101		reg = <0x3c>;
102		pinctrl-names = "default";
103		pinctrl-0 = <&csi1_mclk_pin>;
104		clocks = <&ccu CLK_CSI1_MCLK>;
105		clock-names = "xclk";
106
107		AVDD-supply = <&reg_ldo3>;
108		DOVDD-supply = <&reg_ldo3>;
109		DVDD-supply = <&reg_ldo4>;
110		reset-gpios = <&pio 4 23 GPIO_ACTIVE_LOW>; /* PE23 */
111		powerdown-gpios = <&pio 4 24 GPIO_ACTIVE_HIGH>; /* PE24 */
112
113		port {
114			ov5640_ep: endpoint {
115				remote-endpoint = <&csi1_ep>;
116				bus-width = <8>;
117				hsync-active = <1>; /* Active high */
118				vsync-active = <0>; /* Active low */
119				data-active = <1>;  /* Active high */
120				pclk-sample = <1>;  /* Rising */
121			};
122		};
123	};
124};
125
126&lradc {
127	vref-supply = <&reg_ldo2>;
128	status = "okay";
129
130	button-200 {
131		label = "Setup";
132		linux,code = <KEY_SETUP>;
133		channel = <0>;
134		voltage = <190000>;
135	};
136};
137
138&mmc0 {
139	vmmc-supply = <&reg_dcdc3>;
140	bus-width = <4>;
141	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
142	status = "okay";
143};
144
145&mmc1 {
146	vmmc-supply = <&reg_vcc_wifi>;
147	vqmmc-supply = <&reg_dcdc3>;
148	mmc-pwrseq = <&wifi_pwrseq>;
149	bus-width = <4>;
150	non-removable;
151	status = "okay";
152};
153
154&pio {
155	vcc-pd-supply = <&reg_dcdc3>;
156	vcc-pe-supply = <&reg_ldo3>;
157};
158
159#include "axp209.dtsi"
160
161&ac_power_supply {
162	status = "okay";
163};
164
165&reg_dcdc2 {
166	regulator-always-on;
167	regulator-min-microvolt = <1250000>;
168	regulator-max-microvolt = <1250000>;
169	regulator-name = "vdd-sys-cpu-ephy";
170};
171
172&reg_dcdc3 {
173	regulator-always-on;
174	regulator-min-microvolt = <3300000>;
175	regulator-max-microvolt = <3300000>;
176	regulator-name = "vcc-3v3";
177};
178
179&reg_ldo1 {
180	regulator-name = "vdd-rtc";
181};
182
183&reg_ldo2 {
184	regulator-always-on;
185	regulator-min-microvolt = <3000000>;
186	regulator-max-microvolt = <3000000>;
187	regulator-name = "avcc";
188};
189
190&reg_ldo3 {
191	regulator-min-microvolt = <2800000>;
192	regulator-max-microvolt = <2800000>;
193	regulator-name = "avdd-dovdd-2v8-csi";
194	regulator-soft-start;
195	regulator-ramp-delay = <1600>;
196};
197
198&reg_ldo4 {
199	regulator-min-microvolt = <1800000>;
200	regulator-max-microvolt = <1800000>;
201	regulator-name = "dvdd-1v8-csi";
202};
203
204&spi0 {
205	status = "okay";
206
207	flash@0 {
208		#address-cells = <1>;
209		#size-cells = <1>;
210		compatible = "winbond,w25q128", "jedec,spi-nor";
211		reg = <0>;
212		spi-max-frequency = <40000000>;
213	};
214};
215
216&uart2 {
217	status = "okay";
218};
219
220&usb_otg {
221	dr_mode = "host";
222	status = "okay";
223};
224
225&usbphy {
226	usb0_vbus-supply = <&reg_vcc5v0>;
227	status = "okay";
228};
229