xref: /linux/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi (revision e78f70bad29c5ae1e1076698b690b15794e9b81e)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2021 BayLibre SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 */
6
7#include "meson-sm1.dtsi"
8#include <dt-bindings/leds/common.h>
9#include <dt-bindings/input/linux-event-codes.h>
10#include <dt-bindings/gpio/meson-g12a-gpio.h>
11
12/ {
13	adc-keys {
14		compatible = "adc-keys";
15		io-channels = <&saradc 2>;
16		io-channel-names = "buttons";
17		keyup-threshold-microvolt = <1800000>;
18
19		button-sw3 {
20			label = "SW3";
21			linux,code = <BTN_3>;
22			press-threshold-microvolt = <1700000>;
23		};
24	};
25
26	aliases {
27		serial0 = &uart_AO;
28		ethernet0 = &ethmac;
29	};
30
31	chosen {
32		stdout-path = "serial0:115200n8";
33	};
34
35	emmc_pwrseq: emmc-pwrseq {
36		compatible = "mmc-pwrseq-emmc";
37		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
38	};
39
40	gpio-keys {
41		compatible = "gpio-keys";
42
43		key {
44			label = "SW1";
45			linux,code = <BTN_1>;
46			gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
47			interrupt-parent = <&gpio_intc>;
48			interrupts = <IRQID_GPIOAO_3 IRQ_TYPE_EDGE_BOTH>;
49		};
50	};
51
52	hdmi-connector {
53		compatible = "hdmi-connector";
54		type = "a";
55
56		port {
57			hdmi_connector_in: endpoint {
58				remote-endpoint = <&hdmi_tx_tmds_out>;
59			};
60		};
61	};
62
63	leds {
64		compatible = "gpio-leds";
65
66		led-green {
67			color = <LED_COLOR_ID_GREEN>;
68			function = LED_FUNCTION_STATUS;
69			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
70		};
71
72		led-blue {
73			color = <LED_COLOR_ID_BLUE>;
74			function = LED_FUNCTION_STATUS;
75			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>;
76			linux,default-trigger = "heartbeat";
77		};
78	};
79
80	memory@0 {
81		device_type = "memory";
82		reg = <0x0 0x0 0x0 0x40000000>;
83	};
84
85	emmc_1v8: regulator-emmc-1v8 {
86		compatible = "regulator-fixed";
87		regulator-name = "EMMC_1V8";
88		regulator-min-microvolt = <1800000>;
89		regulator-max-microvolt = <1800000>;
90		vin-supply = <&vddao_3v3>;
91		regulator-always-on;
92	};
93
94	dc_in: regulator-dc-in {
95		compatible = "regulator-fixed";
96		regulator-name = "DC_IN";
97		regulator-min-microvolt = <5000000>;
98		regulator-max-microvolt = <5000000>;
99		regulator-always-on;
100	};
101
102	vddio_c: regulator-vddio-c {
103		compatible = "regulator-gpio";
104		regulator-name = "VDDIO_C";
105		regulator-min-microvolt = <1800000>;
106		regulator-max-microvolt = <3300000>;
107
108		enable-gpios = <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>;
109		enable-active-high;
110		regulator-always-on;
111
112		gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_DRAIN>;
113		gpios-states = <1>;
114
115		states = <1800000 0>,
116			 <3300000 1>;
117	};
118
119	tflash_vdd: regulator-tflash-vdd {
120		compatible = "regulator-fixed";
121		regulator-name = "TFLASH_VDD";
122		regulator-min-microvolt = <3300000>;
123		regulator-max-microvolt = <3300000>;
124		vin-supply = <&dc_in>;
125		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
126		enable-active-high;
127		regulator-always-on;
128	};
129
130	vddao_1v8: regulator-vddao-1v8 {
131		compatible = "regulator-fixed";
132		regulator-name = "VDDAO_1V8";
133		regulator-min-microvolt = <1800000>;
134		regulator-max-microvolt = <1800000>;
135		vin-supply = <&vddao_3v3>;
136		regulator-always-on;
137	};
138
139	vddao_3v3: regulator-vddao-3v3 {
140		compatible = "regulator-fixed";
141		regulator-name = "VDDAO_3V3";
142		regulator-min-microvolt = <3300000>;
143		regulator-max-microvolt = <3300000>;
144		vin-supply = <&dc_in>;
145		regulator-always-on;
146	};
147
148	vddcpu: regulator-vddcpu {
149		/*
150		 * SY8120B1ABC DC/DC Regulator.
151		 */
152		compatible = "pwm-regulator";
153
154		regulator-name = "VDDCPU";
155		regulator-min-microvolt = <690000>;
156		regulator-max-microvolt = <1050000>;
157
158		pwm-supply = <&dc_in>;
159
160		pwms = <&pwm_AO_cd 1 1250 0>;
161		pwm-dutycycle-range = <100 0>;
162
163		regulator-boot-on;
164		regulator-always-on;
165	};
166
167	/* USB Hub Power Enable */
168	vl_pwr_en: regulator-vl-pwr-en {
169		compatible = "regulator-fixed";
170		regulator-name = "VL_PWR_EN";
171		regulator-min-microvolt = <5000000>;
172		regulator-max-microvolt = <5000000>;
173		vin-supply = <&dc_in>;
174
175		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
176		enable-active-high;
177	};
178};
179
180&arb {
181	status = "okay";
182};
183
184&cpu0 {
185	cpu-supply = <&vddcpu>;
186	operating-points-v2 = <&cpu_opp_table>;
187	clocks = <&clkc CLKID_CPU_CLK>;
188};
189
190&cpu1 {
191	cpu-supply = <&vddcpu>;
192	operating-points-v2 = <&cpu_opp_table>;
193	clocks = <&clkc CLKID_CPU1_CLK>;
194};
195
196&cpu2 {
197	cpu-supply = <&vddcpu>;
198	operating-points-v2 = <&cpu_opp_table>;
199	clocks = <&clkc CLKID_CPU2_CLK>;
200};
201
202&cpu3 {
203	cpu-supply = <&vddcpu>;
204	operating-points-v2 = <&cpu_opp_table>;
205	clocks = <&clkc CLKID_CPU3_CLK>;
206};
207
208&ext_mdio {
209	external_phy: ethernet-phy@0 {
210		/* Realtek RTL8211F (0x001cc916) */
211		reg = <0>;
212		max-speed = <1000>;
213
214		interrupt-parent = <&gpio_intc>;
215		/* MAC_INTR on GPIOZ_14 */
216		interrupts = <IRQID_GPIOZ_14 IRQ_TYPE_LEVEL_LOW>;
217	};
218};
219
220&ethmac {
221	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
222	pinctrl-names = "default";
223	status = "okay";
224	phy-mode = "rgmii-txid";
225	phy-handle = <&external_phy>;
226};
227
228&gpio {
229	gpio-line-names =
230		/* GPIOZ */
231		"ETH_MDIO", /* GPIOZ_0 */
232		"ETH_MDC", /* GPIOZ_1 */
233		"ETH_RXCLK", /* GPIOZ_2 */
234		"ETH_RX_DV", /* GPIOZ_3 */
235		"ETH_RXD0", /* GPIOZ_4 */
236		"ETH_RXD1", /* GPIOZ_5 */
237		"ETH_RXD2", /* GPIOZ_6 */
238		"ETH_RXD3", /* GPIOZ_7 */
239		"ETH_TXCLK", /* GPIOZ_8 */
240		"ETH_TXEN", /* GPIOZ_9 */
241		"ETH_TXD0", /* GPIOZ_10 */
242		"ETH_TXD1", /* GPIOZ_11 */
243		"ETH_TXD2", /* GPIOZ_12 */
244		"ETH_TXD3", /* GPIOZ_13 */
245		"ETH_INTR", /* GPIOZ_14 */
246		"ETH_NRST", /* GPIOZ_15 */
247		/* GPIOH */
248		"HDMI_SDA", /* GPIOH_0 */
249		"HDMI_SCL", /* GPIOH_1 */
250		"HDMI_HPD", /* GPIOH_2 */
251		"HDMI_CEC", /* GPIOH_3 */
252		"VL-RST_N", /* GPIOH_4 */
253		"CON1-P36", /* GPIOH_5 */
254		"VL-PWREN", /* GPIOH_6 */
255		"WiFi_3V3_1V8", /* GPIOH_7 */
256		"TFLASH_VDD_EN", /* GPIOH_8 */
257		/* BOOT */
258		"eMMC_D0", /* BOOT_0 */
259		"eMMC_D1", /* BOOT_1 */
260		"eMMC_D2", /* BOOT_2 */
261		"eMMC_D3", /* BOOT_3 */
262		"eMMC_D4", /* BOOT_4 */
263		"eMMC_D5", /* BOOT_5 */
264		"eMMC_D6", /* BOOT_6 */
265		"eMMC_D7", /* BOOT_7 */
266		"eMMC_CLK", /* BOOT_8 */
267		"",
268		"eMMC_CMD", /* BOOT_10 */
269		"",
270		"eMMC_RST#", /* BOOT_12 */
271		"eMMC_DS", /* BOOT_13 */
272		"", "",
273		/* GPIOC */
274		"SD_D0_B", /* GPIOC_0 */
275		"SD_D1_B", /* GPIOC_1 */
276		"SD_D2_B", /* GPIOC_2 */
277		"SD_D3_B", /* GPIOC_3 */
278		"SD_CLK_B", /* GPIOC_4 */
279		"SD_CMD_B", /* GPIOC_5 */
280		"CARD_EN_DET", /* GPIOC_6 */
281		"",
282		/* GPIOA */
283		"", "", "", "", "", "", "", "",
284		"", "", "", "", "", "",
285		"CON1-P27", /* GPIOA_14 */
286		"CON1-P28", /* GPIOA_15 */
287		/* GPIOX */
288		"CON1-P16", /* GPIOX_0 */
289		"CON1-P18", /* GPIOX_1 */
290		"CON1-P22", /* GPIOX_2 */
291		"CON1-P11", /* GPIOX_3 */
292		"CON1-P13", /* GPIOX_4 */
293		"CON1-P07", /* GPIOX_5 */
294		"CON1-P33", /* GPIOX_6 */
295		"CON1-P15", /* GPIOX_7 */
296		"CON1-P19", /* GPIOX_8 */
297		"CON1-P21", /* GPIOX_9 */
298		"CON1-P24", /* GPIOX_10 */
299		"CON1-P23", /* GPIOX_11 */
300		"CON1-P08", /* GPIOX_12 */
301		"CON1-P10", /* GPIOX_13 */
302		"CON1-P29", /* GPIOX_14 */
303		"CON1-P31", /* GPIOX_15 */
304		"CON1-P26", /* GPIOX_16 */
305		"CON1-P03", /* GPIOX_17 */
306		"CON1-P05", /* GPIOX_18 */
307		"CON1-P32"; /* GPIOX_19 */
308
309	/*
310	 * WARNING: The USB Hub needs a reset signal to be turned high in
311	 * order to be detected by the USB Controller. This signal should
312	 * be handled by a USB specific power sequence to reset the Hub
313	 * when the USB bus is powered down.
314	 */
315	usb-hub-hog {
316		gpio-hog;
317		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
318		output-high;
319		line-name = "usb-hub-reset";
320	};
321};
322
323&gpio_ao {
324	gpio-line-names =
325		/* GPIOAO */
326		"DEBUG TX", /* GPIOAO_0 */
327		"DEBUG RX", /* GPIOAO_1 */
328		"SYS_LED2", /* GPIOAO_2 */
329		"UPDATE_KEY", /* GPIOAO_3 */
330		"CON1-P40", /* GPIOAO_4 */
331		"IR_IN", /* GPIOAO_5 */
332		"TF_3V3N_1V8_EN", /* GPIOAO_6 */
333		"CON1-P35", /* GPIOAO_7 */
334		"CON1-P12", /* GPIOAO_8 */
335		"CON1-P37", /* GPIOAO_9 */
336		"CON1-P38", /* GPIOAO_10 */
337		"SYS_LED", /* GPIOAO_11 */
338		/* GPIOE */
339		"VDDEE_PWM", /* GPIOE_0 */
340		"VDDCPU_PWM", /* GPIOE_1 */
341		"TF_PWR_EN"; /* GPIOE_2 */
342};
343
344&hdmi_tx {
345	status = "okay";
346	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
347	pinctrl-names = "default";
348	hdmi-supply = <&dc_in>;
349};
350
351&hdmi_tx_tmds_port {
352	hdmi_tx_tmds_out: endpoint {
353		remote-endpoint = <&hdmi_connector_in>;
354	};
355};
356
357&ir {
358	status = "okay";
359	pinctrl-0 = <&remote_input_ao_pins>;
360	pinctrl-names = "default";
361};
362
363&pwm_AO_cd {
364	pinctrl-0 = <&pwm_ao_d_e_pins>;
365	pinctrl-names = "default";
366	status = "okay";
367};
368
369&saradc {
370	status = "okay";
371	vref-supply = <&vddao_1v8>;
372};
373
374/* SD card */
375&sd_emmc_b {
376	status = "okay";
377	pinctrl-0 = <&sdcard_c_pins>;
378	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
379	pinctrl-names = "default", "clk-gate";
380
381	bus-width = <4>;
382	cap-sd-highspeed;
383	max-frequency = <50000000>;
384	disable-wp;
385
386	/* TOFIX: SD card is barely usable in SDR modes */
387
388	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
389	vmmc-supply = <&tflash_vdd>;
390	vqmmc-supply = <&vddio_c>;
391};
392
393/* eMMC */
394&sd_emmc_c {
395	status = "okay";
396	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
397	pinctrl-1 = <&emmc_clk_gate_pins>;
398	pinctrl-names = "default", "clk-gate";
399
400	bus-width = <8>;
401	cap-mmc-highspeed;
402	mmc-ddr-1_8v;
403	mmc-hs200-1_8v;
404	max-frequency = <200000000>;
405	disable-wp;
406
407	mmc-pwrseq = <&emmc_pwrseq>;
408	vmmc-supply = <&vddao_3v3>;
409	vqmmc-supply = <&emmc_1v8>;
410};
411
412&uart_AO {
413	status = "okay";
414	pinctrl-0 = <&uart_ao_a_pins>;
415	pinctrl-names = "default";
416};
417
418&usb {
419	status = "okay";
420};
421
422&usb2_phy0 {
423	phy-supply = <&dc_in>;
424};
425
426&usb2_phy1 {
427	/* Enable the hub which is connected to this port */
428	phy-supply = <&vl_pwr_en>;
429};
430