xref: /linux/scripts/dtc/include-prefixes/arm/allwinner/sun8i-v3s-anbernic-rg-nano.dts (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*ce63e97bSChris Morgan// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2*ce63e97bSChris Morgan
3*ce63e97bSChris Morgan/dts-v1/;
4*ce63e97bSChris Morgan#include <dt-bindings/input/linux-event-codes.h>
5*ce63e97bSChris Morgan#include "sun8i-v3s.dtsi"
6*ce63e97bSChris Morgan#include "sunxi-common-regulators.dtsi"
7*ce63e97bSChris Morgan
8*ce63e97bSChris Morgan/ {
9*ce63e97bSChris Morgan	model = "Anbernic RG Nano";
10*ce63e97bSChris Morgan	compatible = "anbernic,rg-nano", "allwinner,sun8i-v3s";
11*ce63e97bSChris Morgan
12*ce63e97bSChris Morgan	aliases {
13*ce63e97bSChris Morgan		rtc0 = &pcf8563;
14*ce63e97bSChris Morgan		rtc1 = &rtc;
15*ce63e97bSChris Morgan		serial0 = &uart0;
16*ce63e97bSChris Morgan	};
17*ce63e97bSChris Morgan
18*ce63e97bSChris Morgan	backlight: backlight {
19*ce63e97bSChris Morgan		compatible = "pwm-backlight";
20*ce63e97bSChris Morgan		brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>;
21*ce63e97bSChris Morgan		default-brightness-level = <11>;
22*ce63e97bSChris Morgan		power-supply = <&reg_vcc5v0>;
23*ce63e97bSChris Morgan		pwms = <&pwm 0 40000 1>;
24*ce63e97bSChris Morgan	};
25*ce63e97bSChris Morgan
26*ce63e97bSChris Morgan	chosen {
27*ce63e97bSChris Morgan		stdout-path = "serial0:115200n8";
28*ce63e97bSChris Morgan	};
29*ce63e97bSChris Morgan
30*ce63e97bSChris Morgan	gpio_keys: gpio-keys {
31*ce63e97bSChris Morgan		compatible = "gpio-keys";
32*ce63e97bSChris Morgan
33*ce63e97bSChris Morgan		button-a {
34*ce63e97bSChris Morgan			gpios = <&gpio_expander 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
35*ce63e97bSChris Morgan			label = "BTN-A";
36*ce63e97bSChris Morgan			linux,code = <BTN_EAST>;
37*ce63e97bSChris Morgan		};
38*ce63e97bSChris Morgan
39*ce63e97bSChris Morgan		button-b {
40*ce63e97bSChris Morgan			gpios = <&gpio_expander 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
41*ce63e97bSChris Morgan			label = "BTN-B";
42*ce63e97bSChris Morgan			linux,code = <BTN_SOUTH>;
43*ce63e97bSChris Morgan		};
44*ce63e97bSChris Morgan
45*ce63e97bSChris Morgan		button-down {
46*ce63e97bSChris Morgan			gpios = <&gpio_expander 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
47*ce63e97bSChris Morgan			label = "DPAD-DOWN";
48*ce63e97bSChris Morgan			linux,code = <BTN_DPAD_DOWN>;
49*ce63e97bSChris Morgan		};
50*ce63e97bSChris Morgan
51*ce63e97bSChris Morgan		button-left {
52*ce63e97bSChris Morgan			gpios = <&gpio_expander 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
53*ce63e97bSChris Morgan			label = "DPAD-LEFT";
54*ce63e97bSChris Morgan			linux,code = <BTN_DPAD_LEFT>;
55*ce63e97bSChris Morgan		};
56*ce63e97bSChris Morgan
57*ce63e97bSChris Morgan		button-right {
58*ce63e97bSChris Morgan			gpios = <&gpio_expander 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
59*ce63e97bSChris Morgan			label = "DPAD-RIGHT";
60*ce63e97bSChris Morgan			linux,code = <BTN_DPAD_RIGHT>;
61*ce63e97bSChris Morgan		};
62*ce63e97bSChris Morgan
63*ce63e97bSChris Morgan		button-se {
64*ce63e97bSChris Morgan			gpios = <&gpio_expander 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
65*ce63e97bSChris Morgan			label = "BTN-SELECT";
66*ce63e97bSChris Morgan			linux,code = <BTN_SELECT>;
67*ce63e97bSChris Morgan		};
68*ce63e97bSChris Morgan
69*ce63e97bSChris Morgan		button-st {
70*ce63e97bSChris Morgan			gpios = <&gpio_expander 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
71*ce63e97bSChris Morgan			label = "BTN-START";
72*ce63e97bSChris Morgan			linux,code = <BTN_START>;
73*ce63e97bSChris Morgan		};
74*ce63e97bSChris Morgan
75*ce63e97bSChris Morgan		button-tl {
76*ce63e97bSChris Morgan			gpios = <&gpio_expander 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
77*ce63e97bSChris Morgan			label = "BTN-L";
78*ce63e97bSChris Morgan			linux,code = <BTN_TL>;
79*ce63e97bSChris Morgan		};
80*ce63e97bSChris Morgan
81*ce63e97bSChris Morgan		button-tr {
82*ce63e97bSChris Morgan			gpios = <&gpio_expander 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
83*ce63e97bSChris Morgan			label = "BTN-R";
84*ce63e97bSChris Morgan			linux,code = <BTN_TR>;
85*ce63e97bSChris Morgan		};
86*ce63e97bSChris Morgan
87*ce63e97bSChris Morgan		button-up {
88*ce63e97bSChris Morgan			gpios = <&gpio_expander 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
89*ce63e97bSChris Morgan			label = "DPAD-UP";
90*ce63e97bSChris Morgan			linux,code = <BTN_DPAD_UP>;
91*ce63e97bSChris Morgan		};
92*ce63e97bSChris Morgan
93*ce63e97bSChris Morgan		button-x {
94*ce63e97bSChris Morgan			gpios = <&gpio_expander 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
95*ce63e97bSChris Morgan			label = "BTN-X";
96*ce63e97bSChris Morgan			linux,code = <BTN_NORTH>;
97*ce63e97bSChris Morgan		};
98*ce63e97bSChris Morgan
99*ce63e97bSChris Morgan		button-y {
100*ce63e97bSChris Morgan			gpios = <&gpio_expander 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
101*ce63e97bSChris Morgan			label = "BTN-Y";
102*ce63e97bSChris Morgan			linux,code = <BTN_WEST>;
103*ce63e97bSChris Morgan		};
104*ce63e97bSChris Morgan	};
105*ce63e97bSChris Morgan};
106*ce63e97bSChris Morgan
107*ce63e97bSChris Morgan&codec {
108*ce63e97bSChris Morgan	allwinner,audio-routing = "Speaker", "HP",
109*ce63e97bSChris Morgan				  "MIC1", "Mic",
110*ce63e97bSChris Morgan				  "Mic", "HBIAS";
111*ce63e97bSChris Morgan	allwinner,pa-gpios = <&pio 5 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; /* PF6 */
112*ce63e97bSChris Morgan	status = "okay";
113*ce63e97bSChris Morgan};
114*ce63e97bSChris Morgan
115*ce63e97bSChris Morgan&ehci {
116*ce63e97bSChris Morgan	status = "okay";
117*ce63e97bSChris Morgan};
118*ce63e97bSChris Morgan
119*ce63e97bSChris Morgan&i2c0 {
120*ce63e97bSChris Morgan	status = "okay";
121*ce63e97bSChris Morgan
122*ce63e97bSChris Morgan	gpio_expander: gpio@20 {
123*ce63e97bSChris Morgan		compatible = "nxp,pcal6416";
124*ce63e97bSChris Morgan		reg = <0x20>;
125*ce63e97bSChris Morgan		gpio-controller;
126*ce63e97bSChris Morgan		#gpio-cells = <2>;
127*ce63e97bSChris Morgan		#interrupt-cells = <2>;
128*ce63e97bSChris Morgan		interrupt-controller;
129*ce63e97bSChris Morgan		interrupt-parent = <&pio>;
130*ce63e97bSChris Morgan		interrupts = <1 3 IRQ_TYPE_EDGE_BOTH>; /* PB3/EINT3 */
131*ce63e97bSChris Morgan		vcc-supply = <&reg_vcc3v3>;
132*ce63e97bSChris Morgan	};
133*ce63e97bSChris Morgan
134*ce63e97bSChris Morgan	axp209: pmic@34 {
135*ce63e97bSChris Morgan		reg = <0x34>;
136*ce63e97bSChris Morgan		interrupt-parent = <&pio>;
137*ce63e97bSChris Morgan		interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>; /* PB5/EINT5 */
138*ce63e97bSChris Morgan	};
139*ce63e97bSChris Morgan
140*ce63e97bSChris Morgan	pcf8563: rtc@51 {
141*ce63e97bSChris Morgan		compatible = "nxp,pcf8563";
142*ce63e97bSChris Morgan		reg = <0x51>;
143*ce63e97bSChris Morgan	};
144*ce63e97bSChris Morgan};
145*ce63e97bSChris Morgan
146*ce63e97bSChris Morgan#include "axp209.dtsi"
147*ce63e97bSChris Morgan
148*ce63e97bSChris Morgan&battery_power_supply {
149*ce63e97bSChris Morgan	status = "okay";
150*ce63e97bSChris Morgan};
151*ce63e97bSChris Morgan
152*ce63e97bSChris Morgan&mmc0 {
153*ce63e97bSChris Morgan	broken-cd;
154*ce63e97bSChris Morgan	bus-width = <4>;
155*ce63e97bSChris Morgan	disable-wp;
156*ce63e97bSChris Morgan	vmmc-supply = <&reg_vcc3v3>;
157*ce63e97bSChris Morgan	vqmmc-supply = <&reg_vcc3v3>;
158*ce63e97bSChris Morgan	status = "okay";
159*ce63e97bSChris Morgan};
160*ce63e97bSChris Morgan
161*ce63e97bSChris Morgan&ohci {
162*ce63e97bSChris Morgan	status = "okay";
163*ce63e97bSChris Morgan};
164*ce63e97bSChris Morgan
165*ce63e97bSChris Morgan&pio {
166*ce63e97bSChris Morgan	vcc-pb-supply = <&reg_vcc3v3>;
167*ce63e97bSChris Morgan	vcc-pc-supply = <&reg_vcc3v3>;
168*ce63e97bSChris Morgan	vcc-pf-supply = <&reg_vcc3v3>;
169*ce63e97bSChris Morgan	vcc-pg-supply = <&reg_vcc3v3>;
170*ce63e97bSChris Morgan
171*ce63e97bSChris Morgan	spi0_no_miso_pins: spi0-no-miso-pins {
172*ce63e97bSChris Morgan		pins = "PC1", "PC2", "PC3";
173*ce63e97bSChris Morgan		function = "spi0";
174*ce63e97bSChris Morgan	};
175*ce63e97bSChris Morgan};
176*ce63e97bSChris Morgan
177*ce63e97bSChris Morgan&pwm {
178*ce63e97bSChris Morgan	pinctrl-0 = <&pwm0_pin>;
179*ce63e97bSChris Morgan	pinctrl-names = "default";
180*ce63e97bSChris Morgan	status = "okay";
181*ce63e97bSChris Morgan};
182*ce63e97bSChris Morgan
183*ce63e97bSChris Morgan/* DCDC2 wired into vdd-cpu, vdd-sys, and vdd-ephy. */
184*ce63e97bSChris Morgan&reg_dcdc2 {
185*ce63e97bSChris Morgan	regulator-always-on;
186*ce63e97bSChris Morgan	regulator-max-microvolt = <1250000>;
187*ce63e97bSChris Morgan	regulator-min-microvolt = <1250000>;
188*ce63e97bSChris Morgan	regulator-name = "vdd-cpu";
189*ce63e97bSChris Morgan};
190*ce63e97bSChris Morgan
191*ce63e97bSChris Morgan/* DCDC3 wired into every 3.3v input that isn't the RTC. */
192*ce63e97bSChris Morgan&reg_dcdc3 {
193*ce63e97bSChris Morgan	regulator-always-on;
194*ce63e97bSChris Morgan	regulator-max-microvolt = <3300000>;
195*ce63e97bSChris Morgan	regulator-min-microvolt = <3300000>;
196*ce63e97bSChris Morgan	regulator-name = "vcc-io";
197*ce63e97bSChris Morgan};
198*ce63e97bSChris Morgan
199*ce63e97bSChris Morgan/* LDO1 wired into RTC, voltage is hard-wired at 3.3v. */
200*ce63e97bSChris Morgan&reg_ldo1 {
201*ce63e97bSChris Morgan	regulator-always-on;
202*ce63e97bSChris Morgan	regulator-name = "vcc-rtc";
203*ce63e97bSChris Morgan};
204*ce63e97bSChris Morgan
205*ce63e97bSChris Morgan/* LDO2 wired into VCC-PLL and audio codec. */
206*ce63e97bSChris Morgan&reg_ldo2 {
207*ce63e97bSChris Morgan	regulator-always-on;
208*ce63e97bSChris Morgan	regulator-max-microvolt = <3000000>;
209*ce63e97bSChris Morgan	regulator-min-microvolt = <3000000>;
210*ce63e97bSChris Morgan	regulator-name = "vcc-pll";
211*ce63e97bSChris Morgan};
212*ce63e97bSChris Morgan
213*ce63e97bSChris Morgan/* LDO3, LDO4, and LDO5 unused. */
214*ce63e97bSChris Morgan&reg_ldo3 {
215*ce63e97bSChris Morgan	status = "disabled";
216*ce63e97bSChris Morgan};
217*ce63e97bSChris Morgan
218*ce63e97bSChris Morgan&reg_ldo4 {
219*ce63e97bSChris Morgan	status = "disabled";
220*ce63e97bSChris Morgan};
221*ce63e97bSChris Morgan
222*ce63e97bSChris Morgan/* RTC uses internal oscillator */
223*ce63e97bSChris Morgan&rtc {
224*ce63e97bSChris Morgan	/delete-property/ clocks;
225*ce63e97bSChris Morgan};
226*ce63e97bSChris Morgan
227*ce63e97bSChris Morgan&spi0 {
228*ce63e97bSChris Morgan	pinctrl-0 = <&spi0_no_miso_pins>;
229*ce63e97bSChris Morgan	pinctrl-names = "default";
230*ce63e97bSChris Morgan	status = "okay";
231*ce63e97bSChris Morgan
232*ce63e97bSChris Morgan	display@0 {
233*ce63e97bSChris Morgan		compatible = "saef,sftc154b", "panel-mipi-dbi-spi";
234*ce63e97bSChris Morgan		reg = <0>;
235*ce63e97bSChris Morgan		backlight = <&backlight>;
236*ce63e97bSChris Morgan		dc-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */
237*ce63e97bSChris Morgan		reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */
238*ce63e97bSChris Morgan		spi-max-frequency = <100000000>;
239*ce63e97bSChris Morgan
240*ce63e97bSChris Morgan		height-mm = <39>;
241*ce63e97bSChris Morgan		width-mm = <39>;
242*ce63e97bSChris Morgan
243*ce63e97bSChris Morgan		/* Set hb-porch to compensate for non-visible area */
244*ce63e97bSChris Morgan		panel-timing {
245*ce63e97bSChris Morgan			hactive = <240>;
246*ce63e97bSChris Morgan			vactive = <240>;
247*ce63e97bSChris Morgan			hback-porch = <80>;
248*ce63e97bSChris Morgan			vback-porch = <0>;
249*ce63e97bSChris Morgan			clock-frequency = <0>;
250*ce63e97bSChris Morgan			hfront-porch = <0>;
251*ce63e97bSChris Morgan			hsync-len = <0>;
252*ce63e97bSChris Morgan			vfront-porch = <0>;
253*ce63e97bSChris Morgan			vsync-len = <0>;
254*ce63e97bSChris Morgan		};
255*ce63e97bSChris Morgan	};
256*ce63e97bSChris Morgan};
257*ce63e97bSChris Morgan
258*ce63e97bSChris Morgan&uart0 {
259*ce63e97bSChris Morgan	pinctrl-0 = <&uart0_pb_pins>;
260*ce63e97bSChris Morgan	pinctrl-names = "default";
261*ce63e97bSChris Morgan	status = "okay";
262*ce63e97bSChris Morgan};
263*ce63e97bSChris Morgan
264*ce63e97bSChris Morgan&usb_otg {
265*ce63e97bSChris Morgan	dr_mode = "otg";
266*ce63e97bSChris Morgan	status = "okay";
267*ce63e97bSChris Morgan};
268*ce63e97bSChris Morgan
269*ce63e97bSChris Morgan&usb_power_supply {
270*ce63e97bSChris Morgan	status = "okay";
271*ce63e97bSChris Morgan};
272*ce63e97bSChris Morgan
273*ce63e97bSChris Morgan&usbphy {
274*ce63e97bSChris Morgan	usb0_id_det-gpios = <&pio 6 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG5 */
275*ce63e97bSChris Morgan	status = "okay";
276*ce63e97bSChris Morgan};
277