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", "allwinner,sun8i-s3";
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		#address-cells = <1>;
68		#size-cells = <0>;
69
70		csi1_ep: endpoint {
71			remote-endpoint = <&ov5640_ep>;
72			bus-width = <8>;
73			hsync-active = <1>; /* Active high */
74			vsync-active = <0>; /* Active low */
75			data-active = <1>;  /* Active high */
76			pclk-sample = <1>;  /* Rising */
77		};
78	};
79};
80
81&emac {
82	phy-handle = <&int_mii_phy>;
83	phy-mode = "mii";
84	status = "okay";
85};
86
87&i2c0 {
88	status = "okay";
89
90	axp209: pmic@34 {
91		compatible = "x-powers,axp203",
92			     "x-powers,axp209";
93		reg = <0x34>;
94		interrupt-parent = <&gic>;
95		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
96		interrupt-controller;
97		#interrupt-cells = <1>;
98	};
99};
100
101&i2c1 {
102	pinctrl-names = "default";
103	pinctrl-0 = <&i2c1_pe_pins>;
104	status = "okay";
105
106	ov5640: camera@3c {
107		compatible = "ovti,ov5640";
108		reg = <0x3c>;
109		pinctrl-names = "default";
110		pinctrl-0 = <&csi1_mclk_pin>;
111		clocks = <&ccu CLK_CSI1_MCLK>;
112		clock-names = "xclk";
113
114		AVDD-supply = <&reg_ldo3>;
115		DOVDD-supply = <&reg_ldo3>;
116		DVDD-supply = <&reg_ldo4>;
117		reset-gpios = <&pio 4 23 GPIO_ACTIVE_LOW>; /* PE23 */
118		powerdown-gpios = <&pio 4 24 GPIO_ACTIVE_HIGH>; /* PE24 */
119
120		port {
121			ov5640_ep: endpoint {
122				remote-endpoint = <&csi1_ep>;
123				bus-width = <8>;
124				hsync-active = <1>; /* Active high */
125				vsync-active = <0>; /* Active low */
126				data-active = <1>;  /* Active high */
127				pclk-sample = <1>;  /* Rising */
128			};
129		};
130	};
131};
132
133&lradc {
134	vref-supply = <&reg_ldo2>;
135	status = "okay";
136
137	button-200 {
138		label = "Setup";
139		linux,code = <KEY_SETUP>;
140		channel = <0>;
141		voltage = <190000>;
142	};
143};
144
145&mmc0 {
146	vmmc-supply = <&reg_dcdc3>;
147	bus-width = <4>;
148	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
149	status = "okay";
150};
151
152&mmc1 {
153	vmmc-supply = <&reg_vcc_wifi>;
154	vqmmc-supply = <&reg_dcdc3>;
155	mmc-pwrseq = <&wifi_pwrseq>;
156	bus-width = <4>;
157	non-removable;
158	status = "okay";
159};
160
161&pio {
162	vcc-pd-supply = <&reg_dcdc3>;
163	vcc-pe-supply = <&reg_ldo3>;
164};
165
166#include "axp209.dtsi"
167
168&ac_power_supply {
169	status = "okay";
170};
171
172&reg_dcdc2 {
173	regulator-always-on;
174	regulator-min-microvolt = <1250000>;
175	regulator-max-microvolt = <1250000>;
176	regulator-name = "vdd-sys-cpu-ephy";
177};
178
179&reg_dcdc3 {
180	regulator-always-on;
181	regulator-min-microvolt = <3300000>;
182	regulator-max-microvolt = <3300000>;
183	regulator-name = "vcc-3v3";
184};
185
186&reg_ldo1 {
187	regulator-name = "vdd-rtc";
188};
189
190&reg_ldo2 {
191	regulator-always-on;
192	regulator-min-microvolt = <3000000>;
193	regulator-max-microvolt = <3000000>;
194	regulator-name = "avcc";
195};
196
197&reg_ldo3 {
198	regulator-min-microvolt = <2800000>;
199	regulator-max-microvolt = <2800000>;
200	regulator-name = "avdd-dovdd-2v8-csi";
201	regulator-soft-start;
202	regulator-ramp-delay = <1600>;
203};
204
205&reg_ldo4 {
206	regulator-min-microvolt = <1800000>;
207	regulator-max-microvolt = <1800000>;
208	regulator-name = "dvdd-1v8-csi";
209};
210
211&spi0 {
212	status = "okay";
213
214	flash@0 {
215		#address-cells = <1>;
216		#size-cells = <1>;
217		compatible = "winbond,w25q128", "jedec,spi-nor";
218		reg = <0>;
219		spi-max-frequency = <40000000>;
220	};
221};
222
223&uart2 {
224	status = "okay";
225};
226
227&usb_otg {
228	dr_mode = "host";
229	status = "okay";
230};
231
232&usbphy {
233	usb0_vbus-supply = <&reg_vcc5v0>;
234	status = "okay";
235};
236