5b3a68c602b108ec0657a475b4db9026a669e280
[openwrt/staging/nbd.git] / package / boot / uboot-sunxi / patches / 252-sunxi-h3-add-support-for-nanopi-r1.patch
1 From 0e8043aff1aae95d1f7b7422b91b57d9569860d3 Mon Sep 17 00:00:00 2001
2 From: Jayantajit Gogoi <jayanta.gogoi525@gmail.com>
3 Date: Mon, 12 Oct 2020 18:39:53 +0000
4 Subject: [PATCH] sunxi: add support for FriendlyARM NanoPi R1
5
6 Signed-off-by: Jayantajit Gogoi <jayanta.gogoi525@gmail.com>
7 ---
8 arch/arm/dts/Makefile | 1 +
9 arch/arm/dts/sun8i-h3-nanopi-r1.dts | 146 ++++++++++++++++++++++++++++
10 configs/nanopi_r1_defconfig | 22 +++++
11 3 files changed, 169 insertions(+)
12 create mode 100644 arch/arm/dts/sun8i-h3-nanopi-r1.dts
13 create mode 100644 configs/nanopi_r1_defconfig
14
15 --- a/arch/arm/dts/Makefile
16 +++ b/arch/arm/dts/Makefile
17 @@ -551,6 +551,7 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \
18 sun8i-h3-nanopi-m1-plus.dtb \
19 sun8i-h3-nanopi-neo.dtb \
20 sun8i-h3-nanopi-neo-air.dtb \
21 + sun8i-h3-nanopi-r1.dtb \
22 sun8i-h3-orangepi-2.dtb \
23 sun8i-h3-orangepi-lite.dtb \
24 sun8i-h3-orangepi-one.dtb \
25 --- /dev/null
26 +++ b/arch/arm/dts/sun8i-h3-nanopi-r1.dts
27 @@ -0,0 +1,146 @@
28 +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
29 +/*
30 + * Copyright (C) 2019 Igor Pecovnik <igor@armbian.com>
31 + * Copyright (C) 2020 Jayantajit Gogoi <jayanta.gogoi525@gmail.com>
32 + */
33 +
34 +/* NanoPi R1 is based on the NanoPi-H3 design from FriendlyARM */
35 +#include "sun8i-h3-nanopi.dtsi"
36 +
37 +/ {
38 + model = "FriendlyARM NanoPi R1";
39 + compatible = "friendlyarm,nanopi-r1", "allwinner,sun8i-h3";
40 +
41 + reg_gmac_3v3: gmac-3v3 {
42 + compatible = "regulator-fixed";
43 + regulator-name = "gmac-3v3";
44 + regulator-min-microvolt = <3300000>;
45 + regulator-max-microvolt = <3300000>;
46 + startup-delay-us = <100000>;
47 + enable-active-high;
48 + gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
49 + };
50 +
51 + vdd_cpux: gpio-regulator {
52 + compatible = "regulator-gpio";
53 + pinctrl-names = "default";
54 + regulator-name = "vdd-cpux";
55 + regulator-type = "voltage";
56 + regulator-boot-on;
57 + regulator-always-on;
58 + regulator-min-microvolt = <1100000>;
59 + regulator-max-microvolt = <1300000>;
60 + regulator-ramp-delay = <50>;
61 + gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>;
62 + gpios-states = <0x1>;
63 + states = <1100000 0x0
64 + 1300000 0x1>;
65 + };
66 +
67 + wifi_pwrseq: wifi_pwrseq {
68 + compatible = "mmc-pwrseq-simple";
69 + pinctrl-names = "default";
70 + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
71 + };
72 +
73 + leds {
74 + /delete-node/ pwr;
75 + status {
76 + label = "nanopi:red:status";
77 + gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
78 + linux,default-trigger = "heartbeat";
79 + };
80 +
81 + wan {
82 + label = "nanopi:green:wan";
83 + gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;
84 + };
85 +
86 + lan {
87 + label = "nanopi:green:lan";
88 + gpios = <&pio 0 9 GPIO_ACTIVE_HIGH>;
89 + };
90 + };
91 +
92 + r_gpio_keys {
93 + pinctrl-names = "default";
94 + pinctrl-0 = <&sw_r_npi>;
95 +
96 + /delete-node/ k1;
97 + reset {
98 + label = "reset";
99 + linux,code = <KEY_RESTART>;
100 + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
101 + };
102 + };
103 +};
104 +
105 +&cpu0 {
106 + cpu-supply = <&vdd_cpux>;
107 +};
108 +
109 +&ehci1 {
110 + status = "okay";
111 +};
112 +
113 +&ehci2 {
114 + status = "okay";
115 +};
116 +
117 +&emac {
118 + pinctrl-names = "default";
119 + pinctrl-0 = <&emac_rgmii_pins>;
120 + phy-supply = <&reg_gmac_3v3>;
121 + phy-handle = <&ext_rgmii_phy>;
122 + phy-mode = "rgmii";
123 + status = "okay";
124 +};
125 +
126 +&external_mdio {
127 + ext_rgmii_phy: ethernet-phy@1 {
128 + compatible = "ethernet-phy-ieee802.3-c22";
129 + reg = <7>;
130 + };
131 +};
132 +
133 +&mmc1 {
134 + vmmc-supply = <&reg_vcc3v3>;
135 + vqmmc-supply = <&reg_vcc3v3>;
136 + mmc-pwrseq = <&wifi_pwrseq>;
137 + bus-width = <4>;
138 + non-removable;
139 + status = "okay";
140 +
141 + sdio_wifi: sdio_wifi@1 {
142 + reg = <1>;
143 + compatible = "brcm,bcm4329-fmac";
144 + interrupt-parent = <&pio>;
145 + interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>;
146 + interrupt-names = "host-wake";
147 + };
148 +};
149 +
150 +&mmc2 {
151 + pinctrl-names = "default";
152 + pinctrl-0 = <&mmc2_8bit_pins>;
153 + vmmc-supply = <&reg_vcc3v3>;
154 + vqmmc-supply = <&reg_vcc3v3>;
155 + bus-width = <8>;
156 + non-removable;
157 + status = "okay";
158 +};
159 +
160 +&ohci1 {
161 + status = "okay";
162 +};
163 +
164 +&ohci2 {
165 + status = "okay";
166 +};
167 +
168 +&r_pio {
169 + sw_r_npi: key_pins {
170 + pins = "PL3";
171 + function = "gpio_in";
172 + };
173 +};
174 --- /dev/null
175 +++ b/configs/nanopi_r1_defconfig
176 @@ -0,0 +1,21 @@
177 +CONFIG_ARM=y
178 +CONFIG_ARCH_SUNXI=y
179 +CONFIG_SPL=y
180 +CONFIG_MACH_SUN8I_H3=y
181 +CONFIG_DRAM_CLK=408
182 +CONFIG_DRAM_ZQ=3881979
183 +CONFIG_DRAM_ODT_EN=y
184 +CONFIG_MACPWR="PD6"
185 +# CONFIG_VIDEO_DE2 is not set
186 +CONFIG_NR_DRAM_BANKS=1
187 +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
188 +CONFIG_CONSOLE_MUX=y
189 +# CONFIG_CMD_FLASH is not set
190 +# CONFIG_SPL_DOS_PARTITION is not set
191 +# CONFIG_SPL_EFI_PARTITION is not set
192 +CONFIG_DEFAULT_DEVICE_TREE="sun8i-h3-nanopi-r1"
193 +CONFIG_SUN8I_EMAC=y
194 +CONFIG_USB_EHCI_HCD=y
195 +CONFIG_USB_OHCI_HCD=y
196 +CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
197 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2