xref: /linux/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi.dtsi (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
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	clock-latency = <50000>;
189};
190
191&cpu1 {
192	cpu-supply = <&vddcpu>;
193	operating-points-v2 = <&cpu_opp_table>;
194	clocks = <&clkc CLKID_CPU1_CLK>;
195	clock-latency = <50000>;
196};
197
198&cpu2 {
199	cpu-supply = <&vddcpu>;
200	operating-points-v2 = <&cpu_opp_table>;
201	clocks = <&clkc CLKID_CPU2_CLK>;
202	clock-latency = <50000>;
203};
204
205&cpu3 {
206	cpu-supply = <&vddcpu>;
207	operating-points-v2 = <&cpu_opp_table>;
208	clocks = <&clkc CLKID_CPU3_CLK>;
209	clock-latency = <50000>;
210};
211
212&ext_mdio {
213	external_phy: ethernet-phy@0 {
214		/* Realtek RTL8211F (0x001cc916) */
215		reg = <0>;
216		max-speed = <1000>;
217
218		interrupt-parent = <&gpio_intc>;
219		/* MAC_INTR on GPIOZ_14 */
220		interrupts = <IRQID_GPIOZ_14 IRQ_TYPE_LEVEL_LOW>;
221	};
222};
223
224&ethmac {
225	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
226	pinctrl-names = "default";
227	status = "okay";
228	phy-mode = "rgmii-txid";
229	phy-handle = <&external_phy>;
230};
231
232&gpio {
233	gpio-line-names =
234		/* GPIOZ */
235		"ETH_MDIO", /* GPIOZ_0 */
236		"ETH_MDC", /* GPIOZ_1 */
237		"ETH_RXCLK", /* GPIOZ_2 */
238		"ETH_RX_DV", /* GPIOZ_3 */
239		"ETH_RXD0", /* GPIOZ_4 */
240		"ETH_RXD1", /* GPIOZ_5 */
241		"ETH_RXD2", /* GPIOZ_6 */
242		"ETH_RXD3", /* GPIOZ_7 */
243		"ETH_TXCLK", /* GPIOZ_8 */
244		"ETH_TXEN", /* GPIOZ_9 */
245		"ETH_TXD0", /* GPIOZ_10 */
246		"ETH_TXD1", /* GPIOZ_11 */
247		"ETH_TXD2", /* GPIOZ_12 */
248		"ETH_TXD3", /* GPIOZ_13 */
249		"ETH_INTR", /* GPIOZ_14 */
250		"ETH_NRST", /* GPIOZ_15 */
251		/* GPIOH */
252		"HDMI_SDA", /* GPIOH_0 */
253		"HDMI_SCL", /* GPIOH_1 */
254		"HDMI_HPD", /* GPIOH_2 */
255		"HDMI_CEC", /* GPIOH_3 */
256		"VL-RST_N", /* GPIOH_4 */
257		"CON1-P36", /* GPIOH_5 */
258		"VL-PWREN", /* GPIOH_6 */
259		"WiFi_3V3_1V8", /* GPIOH_7 */
260		"TFLASH_VDD_EN", /* GPIOH_8 */
261		/* BOOT */
262		"eMMC_D0", /* BOOT_0 */
263		"eMMC_D1", /* BOOT_1 */
264		"eMMC_D2", /* BOOT_2 */
265		"eMMC_D3", /* BOOT_3 */
266		"eMMC_D4", /* BOOT_4 */
267		"eMMC_D5", /* BOOT_5 */
268		"eMMC_D6", /* BOOT_6 */
269		"eMMC_D7", /* BOOT_7 */
270		"eMMC_CLK", /* BOOT_8 */
271		"",
272		"eMMC_CMD", /* BOOT_10 */
273		"",
274		"eMMC_RST#", /* BOOT_12 */
275		"eMMC_DS", /* BOOT_13 */
276		"", "",
277		/* GPIOC */
278		"SD_D0_B", /* GPIOC_0 */
279		"SD_D1_B", /* GPIOC_1 */
280		"SD_D2_B", /* GPIOC_2 */
281		"SD_D3_B", /* GPIOC_3 */
282		"SD_CLK_B", /* GPIOC_4 */
283		"SD_CMD_B", /* GPIOC_5 */
284		"CARD_EN_DET", /* GPIOC_6 */
285		"",
286		/* GPIOA */
287		"", "", "", "", "", "", "", "",
288		"", "", "", "", "", "",
289		"CON1-P27", /* GPIOA_14 */
290		"CON1-P28", /* GPIOA_15 */
291		/* GPIOX */
292		"CON1-P16", /* GPIOX_0 */
293		"CON1-P18", /* GPIOX_1 */
294		"CON1-P22", /* GPIOX_2 */
295		"CON1-P11", /* GPIOX_3 */
296		"CON1-P13", /* GPIOX_4 */
297		"CON1-P07", /* GPIOX_5 */
298		"CON1-P33", /* GPIOX_6 */
299		"CON1-P15", /* GPIOX_7 */
300		"CON1-P19", /* GPIOX_8 */
301		"CON1-P21", /* GPIOX_9 */
302		"CON1-P24", /* GPIOX_10 */
303		"CON1-P23", /* GPIOX_11 */
304		"CON1-P08", /* GPIOX_12 */
305		"CON1-P10", /* GPIOX_13 */
306		"CON1-P29", /* GPIOX_14 */
307		"CON1-P31", /* GPIOX_15 */
308		"CON1-P26", /* GPIOX_16 */
309		"CON1-P03", /* GPIOX_17 */
310		"CON1-P05", /* GPIOX_18 */
311		"CON1-P32"; /* GPIOX_19 */
312
313	/*
314	 * WARNING: The USB Hub needs a reset signal to be turned high in
315	 * order to be detected by the USB Controller. This signal should
316	 * be handled by a USB specific power sequence to reset the Hub
317	 * when the USB bus is powered down.
318	 */
319	usb-hub-hog {
320		gpio-hog;
321		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
322		output-high;
323		line-name = "usb-hub-reset";
324	};
325};
326
327&gpio_ao {
328	gpio-line-names =
329		/* GPIOAO */
330		"DEBUG TX", /* GPIOAO_0 */
331		"DEBUG RX", /* GPIOAO_1 */
332		"SYS_LED2", /* GPIOAO_2 */
333		"UPDATE_KEY", /* GPIOAO_3 */
334		"CON1-P40", /* GPIOAO_4 */
335		"IR_IN", /* GPIOAO_5 */
336		"TF_3V3N_1V8_EN", /* GPIOAO_6 */
337		"CON1-P35", /* GPIOAO_7 */
338		"CON1-P12", /* GPIOAO_8 */
339		"CON1-P37", /* GPIOAO_9 */
340		"CON1-P38", /* GPIOAO_10 */
341		"SYS_LED", /* GPIOAO_11 */
342		/* GPIOE */
343		"VDDEE_PWM", /* GPIOE_0 */
344		"VDDCPU_PWM", /* GPIOE_1 */
345		"TF_PWR_EN"; /* GPIOE_2 */
346};
347
348&hdmi_tx {
349	status = "okay";
350	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
351	pinctrl-names = "default";
352	hdmi-supply = <&dc_in>;
353};
354
355&hdmi_tx_tmds_port {
356	hdmi_tx_tmds_out: endpoint {
357		remote-endpoint = <&hdmi_connector_in>;
358	};
359};
360
361&ir {
362	status = "okay";
363	pinctrl-0 = <&remote_input_ao_pins>;
364	pinctrl-names = "default";
365};
366
367&pwm_AO_cd {
368	pinctrl-0 = <&pwm_ao_d_e_pins>;
369	pinctrl-names = "default";
370	clocks = <&xtal>;
371	clock-names = "clkin1";
372	status = "okay";
373};
374
375&saradc {
376	status = "okay";
377	vref-supply = <&vddao_1v8>;
378};
379
380/* SD card */
381&sd_emmc_b {
382	status = "okay";
383	pinctrl-0 = <&sdcard_c_pins>;
384	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
385	pinctrl-names = "default", "clk-gate";
386
387	bus-width = <4>;
388	cap-sd-highspeed;
389	max-frequency = <50000000>;
390	disable-wp;
391
392	/* TOFIX: SD card is barely usable in SDR modes */
393
394	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
395	vmmc-supply = <&tflash_vdd>;
396	vqmmc-supply = <&vddio_c>;
397};
398
399/* eMMC */
400&sd_emmc_c {
401	status = "okay";
402	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
403	pinctrl-1 = <&emmc_clk_gate_pins>;
404	pinctrl-names = "default", "clk-gate";
405
406	bus-width = <8>;
407	cap-mmc-highspeed;
408	mmc-ddr-1_8v;
409	mmc-hs200-1_8v;
410	max-frequency = <200000000>;
411	disable-wp;
412
413	mmc-pwrseq = <&emmc_pwrseq>;
414	vmmc-supply = <&vddao_3v3>;
415	vqmmc-supply = <&emmc_1v8>;
416};
417
418&uart_AO {
419	status = "okay";
420	pinctrl-0 = <&uart_ao_a_pins>;
421	pinctrl-names = "default";
422};
423
424&usb {
425	status = "okay";
426};
427
428&usb2_phy0 {
429	phy-supply = <&dc_in>;
430};
431
432&usb2_phy1 {
433	/* Enable the hub which is connected to this port */
434	phy-supply = <&vl_pwr_en>;
435};
436