1// SPDX-License-Identifier: (GPL-2.0+ or MIT)
2// Copyright (C) 2022 Arm Ltd.
3/*
4 * Common peripherals and configurations for MangoPi MQ-R boards.
5 */
6
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/leds/common.h>
9
10/ {
11	aliases {
12		serial3 = &uart3;
13	};
14
15	chosen {
16		stdout-path = "serial3:115200n8";
17	};
18
19	leds {
20		compatible = "gpio-leds";
21
22		led-0 {
23			color = <LED_COLOR_ID_BLUE>;
24			function = LED_FUNCTION_STATUS;
25			gpios = <&pio 3 22 GPIO_ACTIVE_LOW>; /* PD22 */
26		};
27	};
28
29	/* board wide 5V supply directly from the USB-C socket */
30	reg_vcc5v: regulator-5v {
31		compatible = "regulator-fixed";
32		regulator-name = "vcc-5v";
33		regulator-min-microvolt = <5000000>;
34		regulator-max-microvolt = <5000000>;
35		regulator-always-on;
36	};
37
38	/* SY8008 DC/DC regulator on the board */
39	reg_3v3: regulator-3v3 {
40		compatible = "regulator-fixed";
41		regulator-name = "vcc-3v3";
42		regulator-min-microvolt = <3300000>;
43		regulator-max-microvolt = <3300000>;
44		vin-supply = <&reg_vcc5v>;
45	};
46
47	/* SY8008 DC/DC regulator on the board, also supplying VDD-SYS */
48	reg_vcc_core: regulator-core {
49		compatible = "regulator-fixed";
50		regulator-name = "vcc-core";
51		regulator-min-microvolt = <880000>;
52		regulator-max-microvolt = <880000>;
53		vin-supply = <&reg_vcc5v>;
54	};
55
56	/* XC6206 LDO on the board */
57	reg_avdd2v8: regulator-avdd {
58		compatible = "regulator-fixed";
59		regulator-name = "avdd2v8";
60		regulator-min-microvolt = <2800000>;
61		regulator-max-microvolt = <2800000>;
62		vin-supply = <&reg_3v3>;
63	};
64
65	wifi_pwrseq: wifi-pwrseq {
66		compatible = "mmc-pwrseq-simple";
67		reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
68	};
69};
70
71&dcxo {
72	clock-frequency = <24000000>;
73};
74
75&ehci1 {
76	status = "okay";
77};
78
79&mmc0 {
80	pinctrl-0 = <&mmc0_pins>;
81	pinctrl-names = "default";
82	vmmc-supply = <&reg_3v3>;
83	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
84	disable-wp;
85	bus-width = <4>;
86	status = "okay";
87};
88
89&mmc1 {
90	pinctrl-0 = <&mmc1_pins>;
91	pinctrl-names = "default";
92	vmmc-supply = <&reg_3v3>;
93	non-removable;
94	bus-width = <4>;
95	mmc-pwrseq = <&wifi_pwrseq>;
96	status = "okay";
97};
98
99&ohci1 {
100	status = "okay";
101};
102
103&pio {
104	vcc-pb-supply = <&reg_3v3>;
105	vcc-pd-supply = <&reg_3v3>;
106	vcc-pe-supply = <&reg_avdd2v8>;
107	vcc-pf-supply = <&reg_3v3>;
108	vcc-pg-supply = <&reg_3v3>;
109};
110
111&uart3 {
112	pinctrl-names = "default";
113	pinctrl-0 = <&uart3_pb_pins>;
114	status = "okay";
115};
116
117/* The USB-C socket has its CC pins pulled to GND, so is hardwired as a UFP. */
118&usb_otg {
119	dr_mode = "peripheral";
120	status = "okay";
121};
122
123&usbphy {
124	usb1_vbus-supply = <&reg_vcc5v>;
125	status = "okay";
126};
127