summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorVagrant Cascadian <vagrant@debian.org>2018-11-20 16:32:16 -0800
committerDanny Milosavljevic <dannym@scratchpost.org>2018-11-22 21:59:05 +0100
commit74e35e8c94193a03cb1db61934340540ce0884a3 (patch)
tree4e94ca14c1977c2661d6dd857fbd3d78990c783a /gnu
parenteff8e0b4d9d4b818150f64e151227e03fdcb5aab (diff)
gnu: Add u-boot-pinebook.
* gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch: New file. * gnu/packages/patches/u-boot-pinebook-syscon-node.patch: New file. * gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch: New file. * gnu/packages/patches/u-boot-pinebook-video-bridge.patch: New file. * gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch: New file. * gnu/packages/patches/u-boot-pinebook-dts.patch: New file. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/bootloaders.scm (u-boot-pinebook): New exported variable. * gnu/bootloader/u-boot.scm (u-boot-pinebook-bootloader): New exported variable. * gnu/system/install.scm (pinebook-installation-os): New exported variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/bootloader/u-boot.scm6
-rw-r--r--gnu/local.mk6
-rw-r--r--gnu/packages/bootloaders.scm16
-rw-r--r--gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch1485
-rw-r--r--gnu/packages/patches/u-boot-pinebook-dts.patch388
-rw-r--r--gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch98
-rw-r--r--gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch70
-rw-r--r--gnu/packages/patches/u-boot-pinebook-syscon-node.patch38
-rw-r--r--gnu/packages/patches/u-boot-pinebook-video-bridge.patch50
-rw-r--r--gnu/system/install.scm6
10 files changed, 2163 insertions, 0 deletions
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index b5fab14e147..1c6f322bc44 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -32,6 +32,7 @@
32 u-boot-nintendo-nes-classic-edition-bootloader 32 u-boot-nintendo-nes-classic-edition-bootloader
33 u-boot-novena-bootloader 33 u-boot-novena-bootloader
34 u-boot-pine64-plus-bootloader 34 u-boot-pine64-plus-bootloader
35 u-boot-pinebook-bootloader
35 u-boot-puma-rk3399-bootloader 36 u-boot-puma-rk3399-bootloader
36 u-boot-wandboard-bootloader)) 37 u-boot-wandboard-bootloader))
37 38
@@ -168,6 +169,11 @@
168 (inherit u-boot-allwinner64-bootloader) 169 (inherit u-boot-allwinner64-bootloader)
169 (package u-boot-pine64-plus))) 170 (package u-boot-pine64-plus)))
170 171
172(define u-boot-pinebook-bootloader
173 (bootloader
174 (inherit u-boot-allwinner64-bootloader)
175 (package u-boot-pinebook)))
176
171(define u-boot-puma-rk3399-bootloader 177(define u-boot-puma-rk3399-bootloader
172 (bootloader 178 (bootloader
173 (inherit u-boot-bootloader) 179 (inherit u-boot-bootloader)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7fc8fb06207..c56278e933c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1186,6 +1186,12 @@ dist_patch_DATA = \
1186 %D%/packages/patches/totem-meson-easy-codec.patch \ 1186 %D%/packages/patches/totem-meson-easy-codec.patch \
1187 %D%/packages/patches/tuxpaint-stamps-path.patch \ 1187 %D%/packages/patches/tuxpaint-stamps-path.patch \
1188 %D%/packages/patches/twinkle-include-qregexpvalidator.patch \ 1188 %D%/packages/patches/twinkle-include-qregexpvalidator.patch \
1189 %D%/packages/patches/u-boot-pinebook-a64-update-dts.patch \
1190 %D%/packages/patches/u-boot-pinebook-mmc-calibration.patch \
1191 %D%/packages/patches/u-boot-pinebook-r_i2c-controller.patch \
1192 %D%/packages/patches/u-boot-pinebook-dts.patch \
1193 %D%/packages/patches/u-boot-pinebook-syscon-node.patch \
1194 %D%/packages/patches/u-boot-pinebook-video-bridge.patch \
1189 %D%/packages/patches/unrtf-CVE-2016-10091.patch \ 1195 %D%/packages/patches/unrtf-CVE-2016-10091.patch \
1190 %D%/packages/patches/unzip-CVE-2014-8139.patch \ 1196 %D%/packages/patches/unzip-CVE-2014-8139.patch \
1191 %D%/packages/patches/unzip-CVE-2014-8140.patch \ 1197 %D%/packages/patches/unzip-CVE-2014-8140.patch \
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 328e834bc21..0c116391507 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -579,6 +579,22 @@ board-independent tools.")))
579(define-public u-boot-pine64-plus 579(define-public u-boot-pine64-plus
580 (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu")) 580 (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
581 581
582(define-public u-boot-pinebook
583 (let ((base (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu")))
584 (package
585 (inherit base)
586 (source (origin
587 (inherit (package-source u-boot))
588 (patches (search-patches
589 ;; Add patches to enable Pinebook support from sunxi
590 ;; maintainer tree: git://git.denx.de/u-boot-sunxi.git
591 "u-boot-pinebook-a64-update-dts.patch"
592 "u-boot-pinebook-syscon-node.patch"
593 "u-boot-pinebook-mmc-calibration.patch"
594 "u-boot-pinebook-video-bridge.patch"
595 "u-boot-pinebook-r_i2c-controller.patch"
596 "u-boot-pinebook-dts.patch")))))))
597
582(define-public u-boot-bananapi-m2-ultra 598(define-public u-boot-bananapi-m2-ultra
583 (make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf")) 599 (make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf"))
584 600
diff --git a/gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch b/gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch
new file mode 100644
index 00000000000..9d0a08c8bfe
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch
@@ -0,0 +1,1485 @@
1From 1b39a1834ed182bbd8036a5cd74a9ea111fa4691 Mon Sep 17 00:00:00 2001
2From: Andre Przywara <andre.przywara@arm.com>
3Date: Mon, 29 Oct 2018 00:56:47 +0000
4Subject: [PATCH 03/13] sunxi: A64: Update .dts/.dtsi files
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Update the .dts/.dtsi file from the Linux sunxi/dt64-for-4.20 tree:
10commit 679294497be31596e1c9c61507746d72b6b05f26
11Author: Rodrigo Exterckötter Tjäder <rodrigo@tjader.xyz>
12Date: Wed Sep 26 19:48:24 2018 +0000
13 arm64: dts: allwinner: a64: a64-olinuxino: set the PHY TX delay
14
15Signed-off-by: Andre Przywara <andre.przywara@arm.com>
16Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
17Reviewed-by: Jagan Teki <jagan@openedev.com>
18---
19 arch/arm/dts/sun50i-a64-amarula-relic.dts | 168 +++++++++++++-
20 arch/arm/dts/sun50i-a64-bananapi-m64.dts | 34 ++-
21 arch/arm/dts/sun50i-a64-nanopi-a64.dts | 89 +++++++-
22 arch/arm/dts/sun50i-a64-olinuxino.dts | 103 ++++++++-
23 arch/arm/dts/sun50i-a64-orangepi-win.dts | 179 ++++++++++++++-
24 arch/arm/dts/sun50i-a64-pine64.dts | 32 ++-
25 arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 32 ++-
26 arch/arm/dts/sun50i-a64-sopine.dtsi | 15 ++
27 arch/arm/dts/sun50i-a64.dtsi | 313 +++++++++++++++++++++++++--
28 9 files changed, 920 insertions(+), 45 deletions(-)
29
30diff --git a/arch/arm/dts/sun50i-a64-amarula-relic.dts b/arch/arm/dts/sun50i-a64-amarula-relic.dts
31index f3b4e93ece..6cb2b7f0c8 100644
32--- a/arch/arm/dts/sun50i-a64-amarula-relic.dts
33+++ b/arch/arm/dts/sun50i-a64-amarula-relic.dts
34@@ -22,11 +22,11 @@
35 stdout-path = "serial0:115200n8";
36 };
37
38- reg_vcc3v3: vcc3v3 {
39- compatible = "regulator-fixed";
40- regulator-name = "vcc3v3";
41- regulator-min-microvolt = <3300000>;
42- regulator-max-microvolt = <3300000>;
43+ wifi_pwrseq: wifi-pwrseq {
44+ compatible = "mmc-pwrseq-simple";
45+ clocks = <&rtc 1>;
46+ clock-names = "ext_clock";
47+ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* WL-PMU-EN: PL2 */
48 };
49 };
50
51@@ -34,10 +34,34 @@
52 status = "okay";
53 };
54
55+&mmc1 {
56+ pinctrl-names = "default";
57+ pinctrl-0 = <&mmc1_pins>;
58+ vmmc-supply = <&reg_dcdc1>;
59+ /*
60+ * Schematic shows both dldo4 and eldo1 connected for vcc-io-wifi, but
61+ * dldo4 connection shows DNP(Do Not Populate) and eldo1 connected with
62+ * 0Ohm register to vcc-io-wifi so eldo1 is used.
63+ */
64+ vqmmc-supply = <&reg_eldo1>;
65+ mmc-pwrseq = <&wifi_pwrseq>;
66+ bus-width = <4>;
67+ non-removable;
68+ status = "okay";
69+
70+ brcmf: wifi@1 {
71+ reg = <1>;
72+ compatible = "brcm,bcm4329-fmac";
73+ interrupt-parent = <&r_pio>;
74+ interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* WL-WAKE-AP: PL3 */
75+ interrupt-names = "host-wake";
76+ };
77+};
78+
79 &mmc2 {
80 pinctrl-names = "default";
81 pinctrl-0 = <&mmc2_pins>;
82- vmmc-supply = <&reg_vcc3v3>;
83+ vmmc-supply = <&reg_dcdc1>;
84 bus-width = <8>;
85 non-removable;
86 cap-mmc-hw-reset;
87@@ -48,9 +72,138 @@
88 status = "okay";
89 };
90
91+&r_rsb {
92+ status = "okay";
93+
94+ axp803: pmic@3a3 {
95+ compatible = "x-powers,axp803";
96+ reg = <0x3a3>;
97+ interrupt-parent = <&r_intc>;
98+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
99+ x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
100+ };
101+};
102+
103+#include "axp803.dtsi"
104+
105+&reg_aldo1 {
106+ regulator-always-on;
107+ regulator-min-microvolt = <2800000>;
108+ regulator-max-microvolt = <2800000>;
109+ regulator-name = "avdd-csi";
110+};
111+
112+&reg_aldo2 {
113+ regulator-always-on;
114+ regulator-min-microvolt = <1800000>;
115+ regulator-max-microvolt = <3300000>;
116+ regulator-name = "vcc-pl";
117+};
118+
119+&reg_aldo3 {
120+ regulator-always-on;
121+ regulator-min-microvolt = <3000000>;
122+ regulator-max-microvolt = <3000000>;
123+ regulator-name = "vcc-pll-avcc";
124+};
125+
126+&reg_dcdc1 {
127+ regulator-always-on;
128+ regulator-min-microvolt = <3300000>;
129+ regulator-max-microvolt = <3300000>;
130+ regulator-name = "vcc-3v3";
131+};
132+
133+&reg_dcdc2 {
134+ regulator-always-on;
135+ regulator-min-microvolt = <1040000>;
136+ regulator-max-microvolt = <1300000>;
137+ regulator-name = "vdd-cpux";
138+};
139+
140+/* DCDC3 is polyphased with DCDC2 */
141+
142+&reg_dcdc5 {
143+ regulator-always-on;
144+ regulator-min-microvolt = <1500000>;
145+ regulator-max-microvolt = <1500000>;
146+ regulator-name = "vcc-dram";
147+};
148+
149+&reg_dcdc6 {
150+ regulator-always-on;
151+ regulator-min-microvolt = <1100000>;
152+ regulator-max-microvolt = <1100000>;
153+ regulator-name = "vdd-sys";
154+};
155+
156+&reg_dldo1 {
157+ regulator-min-microvolt = <3300000>;
158+ regulator-max-microvolt = <3300000>;
159+ regulator-name = "vcc-hdmi-dsi-sensor";
160+};
161+
162+&reg_dldo2 {
163+ regulator-min-microvolt = <3300000>;
164+ regulator-max-microvolt = <3300000>;
165+ regulator-name = "vcc-mipi";
166+};
167+
168+&reg_dldo3 {
169+ regulator-min-microvolt = <2800000>;
170+ regulator-max-microvolt = <2800000>;
171+ regulator-name = "dovdd-csi";
172+};
173+
174+&reg_dldo4 {
175+ regulator-min-microvolt = <3300000>;
176+ regulator-max-microvolt = <3300000>;
177+ regulator-name = "vcc-wifi-io";
178+};
179+
180+&reg_drivevbus {
181+ regulator-name = "usb0-vbus";
182+ status = "okay";
183+};
184+
185+&reg_eldo1 {
186+ regulator-always-on;
187+ regulator-min-microvolt = <1800000>;
188+ regulator-max-microvolt = <1800000>;
189+ regulator-name = "cpvdd";
190+};
191+
192+&reg_eldo3 {
193+ regulator-min-microvolt = <1800000>;
194+ regulator-max-microvolt = <1800000>;
195+ regulator-name = "dvdd-csi";
196+};
197+
198+&reg_fldo1 {
199+ regulator-min-microvolt = <1200000>;
200+ regulator-max-microvolt = <1200000>;
201+ regulator-name = "vcc-1v2-hsic";
202+};
203+
204+/*
205+ * The A64 chip cannot work without this regulator off, although
206+ * it seems to be only driving the AR100 core.
207+ * Maybe we don't still know well about CPUs domain.
208+ */
209+&reg_fldo2 {
210+ regulator-always-on;
211+ regulator-min-microvolt = <1100000>;
212+ regulator-max-microvolt = <1100000>;
213+ regulator-name = "vdd-cpus";
214+};
215+
216+&reg_rtc_ldo {
217+ regulator-name = "vcc-rtc";
218+};
219+
220 &uart0 {
221 pinctrl-names = "default";
222- pinctrl-0 = <&uart0_pins_a>;
223+ pinctrl-0 = <&uart0_pb_pins>;
224 status = "okay";
225 };
226
227@@ -61,5 +214,6 @@
228
229 &usbphy {
230 usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
231+ usb0_vbus-supply = <&reg_drivevbus>;
232 status = "okay";
233 };
234diff --git a/arch/arm/dts/sun50i-a64-bananapi-m64.dts b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
235index 0716b14411..ef1c90401b 100644
236--- a/arch/arm/dts/sun50i-a64-bananapi-m64.dts
237+++ b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
238@@ -60,6 +60,17 @@
239 stdout-path = "serial0:115200n8";
240 };
241
242+ hdmi-connector {
243+ compatible = "hdmi-connector";
244+ type = "a";
245+
246+ port {
247+ hdmi_con_in: endpoint {
248+ remote-endpoint = <&hdmi_out_con>;
249+ };
250+ };
251+ };
252+
253 leds {
254 compatible = "gpio-leds";
255
256@@ -86,6 +97,10 @@
257 };
258 };
259
260+&de {
261+ status = "okay";
262+};
263+
264 &ehci0 {
265 status = "okay";
266 };
267@@ -103,6 +118,17 @@
268 status = "okay";
269 };
270
271+&hdmi {
272+ hvcc-supply = <&reg_dldo1>;
273+ status = "okay";
274+};
275+
276+&hdmi_out {
277+ hdmi_out_con: endpoint {
278+ remote-endpoint = <&hdmi_con_in>;
279+ };
280+};
281+
282 &i2c1 {
283 pinctrl-names = "default";
284 pinctrl-0 = <&i2c1_pins>;
285@@ -151,7 +177,7 @@
286
287 &mmc2 {
288 pinctrl-names = "default";
289- pinctrl-0 = <&mmc2_pins>;
290+ pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
291 vmmc-supply = <&reg_dcdc1>;
292 bus-width = <8>;
293 non-removable;
294@@ -296,9 +322,13 @@
295 regulator-name = "vcc-rtc";
296 };
297
298+&simplefb_hdmi {
299+ vcc-hdmi-supply = <&reg_dldo1>;
300+};
301+
302 &uart0 {
303 pinctrl-names = "default";
304- pinctrl-0 = <&uart0_pins_a>;
305+ pinctrl-0 = <&uart0_pb_pins>;
306 status = "okay";
307 };
308
309diff --git a/arch/arm/dts/sun50i-a64-nanopi-a64.dts b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
310index e2dce48fa2..31884dbc88 100644
311--- a/arch/arm/dts/sun50i-a64-nanopi-a64.dts
312+++ b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
313@@ -51,12 +51,44 @@
314 compatible = "friendlyarm,nanopi-a64", "allwinner,sun50i-a64";
315
316 aliases {
317+ ethernet0 = &emac;
318 serial0 = &uart0;
319 };
320
321 chosen {
322 stdout-path = "serial0:115200n8";
323 };
324+
325+ hdmi-connector {
326+ compatible = "hdmi-connector";
327+ type = "a";
328+
329+ port {
330+ hdmi_con_in: endpoint {
331+ remote-endpoint = <&hdmi_out_con>;
332+ };
333+ };
334+ };
335+
336+ leds {
337+ compatible = "gpio-leds";
338+
339+ blue {
340+ label = "nanopi-a64:blue:status";
341+ gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
342+ };
343+ };
344+
345+ wifi_pwrseq: wifi_pwrseq {
346+ compatible = "mmc-pwrseq-simple";
347+ clocks = <&rtc 1>;
348+ clock-names = "ext_clock";
349+ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
350+ };
351+};
352+
353+&de {
354+ status = "okay";
355 };
356
357 &ehci0 {
358@@ -67,6 +99,26 @@
359 status = "okay";
360 };
361
362+&emac {
363+ pinctrl-names = "default";
364+ pinctrl-0 = <&rgmii_pins>;
365+ phy-mode = "rgmii";
366+ phy-handle = <&ext_rgmii_phy>;
367+ phy-supply = <&reg_dcdc1>;
368+ status = "okay";
369+};
370+
371+&hdmi {
372+ hvcc-supply = <&reg_dldo1>;
373+ status = "okay";
374+};
375+
376+&hdmi_out {
377+ hdmi_out_con: endpoint {
378+ remote-endpoint = <&hdmi_con_in>;
379+ };
380+};
381+
382 /* i2c1 connected with gpio headers like pine64, bananapi */
383 &i2c1 {
384 pinctrl-names = "default";
385@@ -78,6 +130,13 @@
386 bias-pull-up;
387 };
388
389+&mdio {
390+ ext_rgmii_phy: ethernet-phy@1 {
391+ compatible = "ethernet-phy-ieee802.3-c22";
392+ reg = <7>;
393+ };
394+};
395+
396 &mmc0 {
397 pinctrl-names = "default";
398 pinctrl-0 = <&mmc0_pins>;
399@@ -88,6 +147,24 @@
400 status = "okay";
401 };
402
403+&mmc1 {
404+ pinctrl-names = "default";
405+ pinctrl-0 = <&mmc1_pins>;
406+ vmmc-supply = <&reg_dcdc1>;
407+ vqmmc-supply = <&reg_dldo4>;
408+ mmc-pwrseq = <&wifi_pwrseq>;
409+ bus-width = <4>;
410+ non-removable;
411+ status = "okay";
412+
413+ rtl8189etv: wifi@1 {
414+ reg = <1>;
415+ interrupt-parent = <&r_pio>;
416+ interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
417+ interrupt-names = "host-wake";
418+ };
419+};
420+
421 &ohci0 {
422 status = "okay";
423 };
424@@ -125,9 +202,9 @@
425
426 &reg_dcdc1 {
427 regulator-always-on;
428- regulator-min-microvolt = <3000000>;
429- regulator-max-microvolt = <3000000>;
430- regulator-name = "vcc-3v";
431+ regulator-min-microvolt = <3300000>;
432+ regulator-max-microvolt = <3300000>;
433+ regulator-name = "vcc-3v3";
434 };
435
436 &reg_dcdc2 {
437@@ -195,9 +272,13 @@
438 regulator-name = "vcc-rtc";
439 };
440
441+&simplefb_hdmi {
442+ vcc-hdmi-supply = <&reg_dldo1>;
443+};
444+
445 &uart0 {
446 pinctrl-names = "default";
447- pinctrl-0 = <&uart0_pins_a>;
448+ pinctrl-0 = <&uart0_pb_pins>;
449 status = "okay";
450 };
451
452diff --git a/arch/arm/dts/sun50i-a64-olinuxino.dts b/arch/arm/dts/sun50i-a64-olinuxino.dts
453index 3b3081b10e..f7a4bccaa5 100644
454--- a/arch/arm/dts/sun50i-a64-olinuxino.dts
455+++ b/arch/arm/dts/sun50i-a64-olinuxino.dts
456@@ -51,6 +51,7 @@
457 compatible = "olimex,a64-olinuxino", "allwinner,sun50i-a64";
458
459 aliases {
460+ ethernet0 = &emac;
461 serial0 = &uart0;
462 };
463
464@@ -58,12 +59,74 @@
465 stdout-path = "serial0:115200n8";
466 };
467
468+ hdmi-connector {
469+ compatible = "hdmi-connector";
470+ type = "a";
471+
472+ port {
473+ hdmi_con_in: endpoint {
474+ remote-endpoint = <&hdmi_out_con>;
475+ };
476+ };
477+ };
478+
479+ reg_usb1_vbus: usb1-vbus {
480+ compatible = "regulator-fixed";
481+ regulator-name = "usb1-vbus";
482+ regulator-min-microvolt = <5000000>;
483+ regulator-max-microvolt = <5000000>;
484+ regulator-boot-on;
485+ enable-active-high;
486+ gpio = <&pio 6 9 GPIO_ACTIVE_HIGH>; /* PG9 */
487+ status = "okay";
488+ };
489+
490 wifi_pwrseq: wifi_pwrseq {
491 compatible = "mmc-pwrseq-simple";
492 reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
493 };
494 };
495
496+&de {
497+ status = "okay";
498+};
499+
500+&ehci0 {
501+ status = "okay";
502+};
503+
504+&ehci1 {
505+ status = "okay";
506+};
507+
508+&emac {
509+ pinctrl-names = "default";
510+ pinctrl-0 = <&rgmii_pins>;
511+ phy-mode = "rgmii";
512+ phy-handle = <&ext_rgmii_phy>;
513+ phy-supply = <&reg_dcdc1>;
514+ allwinner,tx-delay-ps = <600>;
515+ status = "okay";
516+};
517+
518+&hdmi {
519+ hvcc-supply = <&reg_dldo1>;
520+ status = "okay";
521+};
522+
523+&hdmi_out {
524+ hdmi_out_con: endpoint {
525+ remote-endpoint = <&hdmi_con_in>;
526+ };
527+};
528+
529+&mdio {
530+ ext_rgmii_phy: ethernet-phy@1 {
531+ compatible = "ethernet-phy-ieee802.3-c22";
532+ reg = <1>;
533+ };
534+};
535+
536 &mmc0 {
537 pinctrl-names = "default";
538 pinctrl-0 = <&mmc0_pins>;
539@@ -92,6 +155,14 @@
540 };
541 };
542
543+&ohci0 {
544+ status = "okay";
545+};
546+
547+&ohci1 {
548+ status = "okay";
549+};
550+
551 &r_rsb {
552 status = "okay";
553
554@@ -100,6 +171,7 @@
555 reg = <0x3a3>;
556 interrupt-parent = <&r_intc>;
557 interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
558+ x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
559 };
560 };
561
562@@ -142,10 +214,14 @@
563
564 /* DCDC3 is polyphased with DCDC2 */
565
566+/*
567+ * The board uses DDR3L DRAM chips. 1.36V is the closest to the nominal
568+ * 1.35V that the PMIC can drive.
569+ */
570 &reg_dcdc5 {
571 regulator-always-on;
572- regulator-min-microvolt = <1500000>;
573- regulator-max-microvolt = <1500000>;
574+ regulator-min-microvolt = <1360000>;
575+ regulator-max-microvolt = <1360000>;
576 regulator-name = "vcc-ddr3";
577 };
578
579@@ -180,6 +256,11 @@
580 regulator-name = "vcc-wifi-io";
581 };
582
583+&reg_drivevbus {
584+ regulator-name = "usb0-vbus";
585+ status = "okay";
586+};
587+
588 &reg_eldo1 {
589 regulator-min-microvolt = <1800000>;
590 regulator-max-microvolt = <1800000>;
591@@ -214,8 +295,24 @@
592 regulator-name = "vcc-rtc";
593 };
594
595+&simplefb_hdmi {
596+ vcc-hdmi-supply = <&reg_dldo1>;
597+};
598+
599 &uart0 {
600 pinctrl-names = "default";
601- pinctrl-0 = <&uart0_pins_a>;
602+ pinctrl-0 = <&uart0_pb_pins>;
603+ status = "okay";
604+};
605+
606+&usb_otg {
607+ dr_mode = "otg";
608+ status = "okay";
609+};
610+
611+&usbphy {
612 status = "okay";
613+ usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
614+ usb0_vbus-supply = <&reg_drivevbus>;
615+ usb1_vbus-supply = <&reg_usb1_vbus>;
616 };
617diff --git a/arch/arm/dts/sun50i-a64-orangepi-win.dts b/arch/arm/dts/sun50i-a64-orangepi-win.dts
618index bf42690a33..b0c64f7579 100644
619--- a/arch/arm/dts/sun50i-a64-orangepi-win.dts
620+++ b/arch/arm/dts/sun50i-a64-orangepi-win.dts
621@@ -1,5 +1,6 @@
622 /*
623 * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
624+ * Copyright (C) 2017-2018 Samuel Holland <samuel@sholland.org>
625 *
626 * This file is dual-licensed: you can use it either under the terms
627 * of the GPL or the X11 license, at your option. Note that this dual
628@@ -51,23 +52,127 @@
629 compatible = "xunlong,orangepi-win", "allwinner,sun50i-a64";
630
631 aliases {
632+ ethernet0 = &emac;
633 serial0 = &uart0;
634+ serial1 = &uart1;
635+ serial2 = &uart2;
636+ serial3 = &uart3;
637+ serial4 = &uart4;
638 };
639
640 chosen {
641 stdout-path = "serial0:115200n8";
642 };
643+
644+ hdmi-connector {
645+ compatible = "hdmi-connector";
646+ type = "a";
647+
648+ port {
649+ hdmi_con_in: endpoint {
650+ remote-endpoint = <&hdmi_out_con>;
651+ };
652+ };
653+ };
654+
655+ leds {
656+ compatible = "gpio-leds";
657+
658+ status {
659+ label = "orangepi:green:status";
660+ gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
661+ };
662+ };
663+
664+ reg_gmac_3v3: gmac-3v3 {
665+ compatible = "regulator-fixed";
666+ regulator-name = "gmac-3v3";
667+ regulator-min-microvolt = <3300000>;
668+ regulator-max-microvolt = <3300000>;
669+ regulator-boot-on;
670+ enable-active-high;
671+ gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
672+ status = "okay";
673+ };
674+
675+ reg_usb1_vbus: usb1-vbus {
676+ compatible = "regulator-fixed";
677+ regulator-name = "usb1-vbus";
678+ regulator-min-microvolt = <5000000>;
679+ regulator-max-microvolt = <5000000>;
680+ regulator-boot-on;
681+ enable-active-high;
682+ gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* PD7 */
683+ status = "okay";
684+ };
685+
686+ wifi_pwrseq: wifi_pwrseq {
687+ compatible = "mmc-pwrseq-simple";
688+ reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
689+ };
690+};
691+
692+&de {
693+ status = "okay";
694+};
695+
696+&ehci0 {
697+ status = "okay";
698 };
699
700 &ehci1 {
701 status = "okay";
702 };
703
704+&emac {
705+ pinctrl-names = "default";
706+ pinctrl-0 = <&rgmii_pins>;
707+ phy-mode = "rgmii";
708+ phy-handle = <&ext_rgmii_phy>;
709+ phy-supply = <&reg_gmac_3v3>;
710+ status = "okay";
711+};
712+
713+&hdmi {
714+ hvcc-supply = <&reg_dldo1>;
715+ status = "okay";
716+};
717+
718+&hdmi_out {
719+ hdmi_out_con: endpoint {
720+ remote-endpoint = <&hdmi_con_in>;
721+ };
722+};
723+
724+&mdio {
725+ ext_rgmii_phy: ethernet-phy@1 {
726+ compatible = "ethernet-phy-ieee802.3-c22";
727+ reg = <1>;
728+ };
729+};
730+
731 &mmc0 {
732 pinctrl-names = "default";
733 pinctrl-0 = <&mmc0_pins>;
734 vmmc-supply = <&reg_dcdc1>;
735- cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
736+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
737+ disable-wp;
738+ bus-width = <4>;
739+ status = "okay";
740+};
741+
742+&mmc1 {
743+ pinctrl-names = "default";
744+ pinctrl-0 = <&mmc1_pins>;
745+ vmmc-supply = <&reg_dldo2>;
746+ vqmmc-supply = <&reg_dldo4>;
747+ mmc-pwrseq = <&wifi_pwrseq>;
748+ bus-width = <4>;
749+ non-removable;
750+ status = "okay";
751+};
752+
753+&ohci0 {
754 status = "okay";
755 };
756
757@@ -89,9 +194,8 @@
758 #include "axp803.dtsi"
759
760 &reg_aldo1 {
761- regulator-always-on;
762- regulator-min-microvolt = <1800000>;
763- regulator-max-microvolt = <3300000>;
764+ regulator-min-microvolt = <2800000>;
765+ regulator-max-microvolt = <2800000>;
766 regulator-name = "afvcc-csi";
767 };
768
769@@ -163,12 +267,23 @@
770 regulator-name = "vcc-wifi-io";
771 };
772
773+&reg_drivevbus {
774+ regulator-name = "usb0-vbus";
775+ status = "okay";
776+};
777+
778 &reg_eldo1 {
779 regulator-min-microvolt = <1800000>;
780 regulator-max-microvolt = <1800000>;
781 regulator-name = "cpvdd";
782 };
783
784+&reg_eldo3 {
785+ regulator-min-microvolt = <1500000>;
786+ regulator-max-microvolt = <1800000>;
787+ regulator-name = "dvdd-csi";
788+};
789+
790 &reg_fldo1 {
791 regulator-min-microvolt = <1200000>;
792 regulator-max-microvolt = <1200000>;
793@@ -191,13 +306,65 @@
794 regulator-name = "vcc-rtc";
795 };
796
797+&simplefb_hdmi {
798+ vcc-hdmi-supply = <&reg_dldo1>;
799+};
800+
801+&spi0 {
802+ status = "okay";
803+
804+ spi-flash@0 {
805+ compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
806+ reg = <0>;
807+ spi-max-frequency = <80000000>;
808+ m25p,fast-read;
809+ status = "okay";
810+ };
811+};
812+
813+/* On debug connector */
814 &uart0 {
815 pinctrl-names = "default";
816- pinctrl-0 = <&uart0_pins_a>;
817+ pinctrl-0 = <&uart0_pb_pins>;
818 status = "okay";
819 };
820
821-&usbphy {
822+/* Bluetooth */
823+&uart1 {
824+ pinctrl-names = "default";
825+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
826+ status = "okay";
827+};
828+
829+/* On Pi-2 connector, RTS/CTS optional */
830+&uart2 {
831+ pinctrl-names = "default";
832+ pinctrl-0 = <&uart2_pins>;
833+ status = "disabled";
834+};
835+
836+/* On Pi-2 connector, RTS/CTS optional */
837+&uart3 {
838+ pinctrl-names = "default";
839+ pinctrl-0 = <&uart3_pins>;
840+ status = "disabled";
841+};
842+
843+/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
844+&uart4 {
845+ pinctrl-names = "default";
846+ pinctrl-0 = <&uart4_pins>;
847+ status = "disabled";
848+};
849+
850+&usb_otg {
851+ dr_mode = "otg";
852 status = "okay";
853 };
854
855+&usbphy {
856+ usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
857+ usb0_vbus-supply = <&reg_drivevbus>;
858+ usb1_vbus-supply = <&reg_usb1_vbus>;
859+ status = "okay";
860+};
861diff --git a/arch/arm/dts/sun50i-a64-pine64.dts b/arch/arm/dts/sun50i-a64-pine64.dts
862index a75825798a..c077b6c1f4 100644
863--- a/arch/arm/dts/sun50i-a64-pine64.dts
864+++ b/arch/arm/dts/sun50i-a64-pine64.dts
865@@ -62,6 +62,21 @@
866 chosen {
867 stdout-path = "serial0:115200n8";
868 };
869+
870+ hdmi-connector {
871+ compatible = "hdmi-connector";
872+ type = "a";
873+
874+ port {
875+ hdmi_con_in: endpoint {
876+ remote-endpoint = <&hdmi_out_con>;
877+ };
878+ };
879+ };
880+};
881+
882+&de {
883+ status = "okay";
884 };
885
886 &ehci0 {
887@@ -82,6 +97,17 @@
888
889 };
890
891+&hdmi {
892+ hvcc-supply = <&reg_dldo1>;
893+ status = "okay";
894+};
895+
896+&hdmi_out {
897+ hdmi_out_con: endpoint {
898+ remote-endpoint = <&hdmi_con_in>;
899+ };
900+};
901+
902 &i2c1 {
903 pinctrl-names = "default";
904 pinctrl-0 = <&i2c1_pins>;
905@@ -229,6 +255,10 @@
906 regulator-name = "vcc-rtc";
907 };
908
909+&simplefb_hdmi {
910+ vcc-hdmi-supply = <&reg_dldo1>;
911+};
912+
913 /* On Euler connector */
914 &spdif {
915 status = "disabled";
916@@ -237,7 +267,7 @@
917 /* On Exp and Euler connectors */
918 &uart0 {
919 pinctrl-names = "default";
920- pinctrl-0 = <&uart0_pins_a>;
921+ pinctrl-0 = <&uart0_pb_pins>;
922 status = "okay";
923 };
924
925diff --git a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
926index abe179de35..53fcc9098d 100644
927--- a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
928+++ b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
929@@ -61,6 +61,17 @@
930 stdout-path = "serial0:115200n8";
931 };
932
933+ hdmi-connector {
934+ compatible = "hdmi-connector";
935+ type = "a";
936+
937+ port {
938+ hdmi_con_in: endpoint {
939+ remote-endpoint = <&hdmi_out_con>;
940+ };
941+ };
942+ };
943+
944 reg_vcc1v8: vcc1v8 {
945 compatible = "regulator-fixed";
946 regulator-name = "vcc1v8";
947@@ -69,6 +80,10 @@
948 };
949 };
950
951+&de {
952+ status = "okay";
953+};
954+
955 &ehci0 {
956 status = "okay";
957 };
958@@ -86,6 +101,17 @@
959 status = "okay";
960 };
961
962+&hdmi {
963+ hvcc-supply = <&reg_dldo1>;
964+ status = "okay";
965+};
966+
967+&hdmi_out {
968+ hdmi_out_con: endpoint {
969+ remote-endpoint = <&hdmi_con_in>;
970+ };
971+};
972+
973 &mdio {
974 ext_rgmii_phy: ethernet-phy@1 {
975 compatible = "ethernet-phy-ieee802.3-c22";
976@@ -134,9 +160,13 @@
977 regulator-name = "vcc-wifi";
978 };
979
980+&simplefb_hdmi {
981+ vcc-hdmi-supply = <&reg_dldo1>;
982+};
983+
984 &uart0 {
985 pinctrl-names = "default";
986- pinctrl-0 = <&uart0_pins_a>;
987+ pinctrl-0 = <&uart0_pb_pins>;
988 status = "okay";
989 };
990
991diff --git a/arch/arm/dts/sun50i-a64-sopine.dtsi b/arch/arm/dts/sun50i-a64-sopine.dtsi
992index 43418bd881..6723b8695e 100644
993--- a/arch/arm/dts/sun50i-a64-sopine.dtsi
994+++ b/arch/arm/dts/sun50i-a64-sopine.dtsi
995@@ -45,6 +45,8 @@
996
997 #include "sun50i-a64.dtsi"
998
999+#include <dt-bindings/gpio/gpio.h>
1000+
1001 &mmc0 {
1002 pinctrl-names = "default";
1003 pinctrl-0 = <&mmc0_pins>;
1004@@ -52,6 +54,7 @@
1005 non-removable;
1006 disable-wp;
1007 bus-width = <4>;
1008+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
1009 status = "okay";
1010 };
1011
1012@@ -66,6 +69,18 @@
1013 };
1014 };
1015
1016+&spi0 {
1017+ status = "okay";
1018+
1019+ flash@0 {
1020+ #address-cells = <1>;
1021+ #size-cells = <1>;
1022+ compatible = "jedec,spi-nor";
1023+ reg = <0>;
1024+ spi-max-frequency = <40000000>;
1025+ };
1026+};
1027+
1028 #include "axp803.dtsi"
1029
1030 &reg_aldo2 {
1031diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi
1032index 7a083637c4..f3a66f8882 100644
1033--- a/arch/arm/dts/sun50i-a64.dtsi
1034+++ b/arch/arm/dts/sun50i-a64.dtsi
1035@@ -43,9 +43,12 @@
1036 */
1037
1038 #include <dt-bindings/clock/sun50i-a64-ccu.h>
1039+#include <dt-bindings/clock/sun8i-de2.h>
1040 #include <dt-bindings/clock/sun8i-r-ccu.h>
1041 #include <dt-bindings/interrupt-controller/arm-gic.h>
1042 #include <dt-bindings/reset/sun50i-a64-ccu.h>
1043+#include <dt-bindings/reset/sun8i-de2.h>
1044+#include <dt-bindings/reset/sun8i-r-ccu.h>
1045
1046 / {
1047 interrupt-parent = <&gic>;
1048@@ -57,17 +60,21 @@
1049 #size-cells = <1>;
1050 ranges;
1051
1052-/*
1053- * The pipeline mixer0-lcd0 depends on clock CLK_MIXER0 from DE2 CCU.
1054- * However there is no support for this clock on A64 yet, so we depend
1055- * on the upstream clocks here to keep them (and thus CLK_MIXER0) up.
1056- */
1057 simplefb_lcd: framebuffer-lcd {
1058 compatible = "allwinner,simple-framebuffer",
1059 "simple-framebuffer";
1060 allwinner,pipeline = "mixer0-lcd0";
1061 clocks = <&ccu CLK_TCON0>,
1062- <&ccu CLK_DE>, <&ccu CLK_BUS_DE>;
1063+ <&display_clocks CLK_MIXER0>;
1064+ status = "disabled";
1065+ };
1066+
1067+ simplefb_hdmi: framebuffer-hdmi {
1068+ compatible = "allwinner,simple-framebuffer",
1069+ "simple-framebuffer";
1070+ allwinner,pipeline = "mixer1-lcd1-hdmi";
1071+ clocks = <&display_clocks CLK_MIXER1>,
1072+ <&ccu CLK_TCON1>, <&ccu CLK_HDMI>;
1073 status = "disabled";
1074 };
1075 };
1076@@ -81,6 +88,7 @@
1077 device_type = "cpu";
1078 reg = <0>;
1079 enable-method = "psci";
1080+ next-level-cache = <&L2>;
1081 };
1082
1083 cpu1: cpu@1 {
1084@@ -88,6 +96,7 @@
1085 device_type = "cpu";
1086 reg = <1>;
1087 enable-method = "psci";
1088+ next-level-cache = <&L2>;
1089 };
1090
1091 cpu2: cpu@2 {
1092@@ -95,6 +104,7 @@
1093 device_type = "cpu";
1094 reg = <2>;
1095 enable-method = "psci";
1096+ next-level-cache = <&L2>;
1097 };
1098
1099 cpu3: cpu@3 {
1100@@ -102,7 +112,20 @@
1101 device_type = "cpu";
1102 reg = <3>;
1103 enable-method = "psci";
1104+ next-level-cache = <&L2>;
1105 };
1106+
1107+ L2: l2-cache {
1108+ compatible = "cache";
1109+ cache-level = <2>;
1110+ };
1111+ };
1112+
1113+ de: display-engine {
1114+ compatible = "allwinner,sun50i-a64-display-engine";
1115+ allwinner,pipelines = <&mixer0>,
1116+ <&mixer1>;
1117+ status = "disabled";
1118 };
1119
1120 osc24M: osc24M_clk {
1121@@ -168,10 +191,92 @@
1122 #size-cells = <1>;
1123 ranges;
1124
1125+ de2@1000000 {
1126+ compatible = "allwinner,sun50i-a64-de2";
1127+ reg = <0x1000000 0x400000>;
1128+ allwinner,sram = <&de2_sram 1>;
1129+ #address-cells = <1>;
1130+ #size-cells = <1>;
1131+ ranges = <0 0x1000000 0x400000>;
1132+
1133+ display_clocks: clock@0 {
1134+ compatible = "allwinner,sun50i-a64-de2-clk";
1135+ reg = <0x0 0x100000>;
1136+ clocks = <&ccu CLK_DE>,
1137+ <&ccu CLK_BUS_DE>;
1138+ clock-names = "mod",
1139+ "bus";
1140+ resets = <&ccu RST_BUS_DE>;
1141+ #clock-cells = <1>;
1142+ #reset-cells = <1>;
1143+ };
1144+
1145+ mixer0: mixer@100000 {
1146+ compatible = "allwinner,sun50i-a64-de2-mixer-0";
1147+ reg = <0x100000 0x100000>;
1148+ clocks = <&display_clocks CLK_BUS_MIXER0>,
1149+ <&display_clocks CLK_MIXER0>;
1150+ clock-names = "bus",
1151+ "mod";
1152+ resets = <&display_clocks RST_MIXER0>;
1153+
1154+ ports {
1155+ #address-cells = <1>;
1156+ #size-cells = <0>;
1157+
1158+ mixer0_out: port@1 {
1159+ reg = <1>;
1160+
1161+ mixer0_out_tcon0: endpoint {
1162+ remote-endpoint = <&tcon0_in_mixer0>;
1163+ };
1164+ };
1165+ };
1166+ };
1167+
1168+ mixer1: mixer@200000 {
1169+ compatible = "allwinner,sun50i-a64-de2-mixer-1";
1170+ reg = <0x200000 0x100000>;
1171+ clocks = <&display_clocks CLK_BUS_MIXER1>,
1172+ <&display_clocks CLK_MIXER1>;
1173+ clock-names = "bus",
1174+ "mod";
1175+ resets = <&display_clocks RST_MIXER1>;
1176+
1177+ ports {
1178+ #address-cells = <1>;
1179+ #size-cells = <0>;
1180+
1181+ mixer1_out: port@1 {
1182+ reg = <1>;
1183+
1184+ mixer1_out_tcon1: endpoint {
1185+ remote-endpoint = <&tcon1_in_mixer1>;
1186+ };
1187+ };
1188+ };
1189+ };
1190+ };
1191+
1192 syscon: syscon@1c00000 {
1193- compatible = "allwinner,sun50i-a64-system-controller",
1194- "syscon";
1195+ compatible = "allwinner,sun50i-a64-system-control";
1196 reg = <0x01c00000 0x1000>;
1197+ #address-cells = <1>;
1198+ #size-cells = <1>;
1199+ ranges;
1200+
1201+ sram_c: sram@18000 {
1202+ compatible = "mmio-sram";
1203+ reg = <0x00018000 0x28000>;
1204+ #address-cells = <1>;
1205+ #size-cells = <1>;
1206+ ranges = <0 0x00018000 0x28000>;
1207+
1208+ de2_sram: sram-section@0 {
1209+ compatible = "allwinner,sun50i-a64-sram-c";
1210+ reg = <0x0000 0x28000>;
1211+ };
1212+ };
1213 };
1214
1215 dma: dma-controller@1c02000 {
1216@@ -185,6 +290,75 @@
1217 #dma-cells = <1>;
1218 };
1219
1220+ tcon0: lcd-controller@1c0c000 {
1221+ compatible = "allwinner,sun50i-a64-tcon-lcd",
1222+ "allwinner,sun8i-a83t-tcon-lcd";
1223+ reg = <0x01c0c000 0x1000>;
1224+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
1225+ clocks = <&ccu CLK_BUS_TCON0>, <&ccu CLK_TCON0>;
1226+ clock-names = "ahb", "tcon-ch0";
1227+ clock-output-names = "tcon-pixel-clock";
1228+ resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>;
1229+ reset-names = "lcd", "lvds";
1230+
1231+ ports {
1232+ #address-cells = <1>;
1233+ #size-cells = <0>;
1234+
1235+ tcon0_in: port@0 {
1236+ #address-cells = <1>;
1237+ #size-cells = <0>;
1238+ reg = <0>;
1239+
1240+ tcon0_in_mixer0: endpoint@0 {
1241+ reg = <0>;
1242+ remote-endpoint = <&mixer0_out_tcon0>;
1243+ };
1244+ };
1245+
1246+ tcon0_out: port@1 {
1247+ #address-cells = <1>;
1248+ #size-cells = <0>;
1249+ reg = <1>;
1250+ };
1251+ };
1252+ };
1253+
1254+ tcon1: lcd-controller@1c0d000 {
1255+ compatible = "allwinner,sun50i-a64-tcon-tv",
1256+ "allwinner,sun8i-a83t-tcon-tv";
1257+ reg = <0x01c0d000 0x1000>;
1258+ interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
1259+ clocks = <&ccu CLK_BUS_TCON1>, <&ccu CLK_TCON1>;
1260+ clock-names = "ahb", "tcon-ch1";
1261+ resets = <&ccu RST_BUS_TCON1>;
1262+ reset-names = "lcd";
1263+
1264+ ports {
1265+ #address-cells = <1>;
1266+ #size-cells = <0>;
1267+
1268+ tcon1_in: port@0 {
1269+ reg = <0>;
1270+
1271+ tcon1_in_mixer1: endpoint {
1272+ remote-endpoint = <&mixer1_out_tcon1>;
1273+ };
1274+ };
1275+
1276+ tcon1_out: port@1 {
1277+ #address-cells = <1>;
1278+ #size-cells = <0>;
1279+ reg = <1>;
1280+
1281+ tcon1_out_hdmi: endpoint@1 {
1282+ reg = <1>;
1283+ remote-endpoint = <&hdmi_in_tcon1>;
1284+ };
1285+ };
1286+ };
1287+ };
1288+
1289 mmc0: mmc@1c0f000 {
1290 compatible = "allwinner,sun50i-a64-mmc";
1291 reg = <0x01c0f000 0x1000>;
1292@@ -227,6 +401,11 @@
1293 #size-cells = <0>;
1294 };
1295
1296+ sid: eeprom@1c14000 {
1297+ compatible = "allwinner,sun50i-a64-sid";
1298+ reg = <0x1c14000 0x400>;
1299+ };
1300+
1301 usb_otg: usb@1c19000 {
1302 compatible = "allwinner,sun8i-a33-musb";
1303 reg = <0x01c19000 0x0400>;
1304@@ -356,7 +535,7 @@
1305 };
1306
1307 mmc2_pins: mmc2-pins {
1308- pins = "PC1", "PC5", "PC6", "PC8", "PC9",
1309+ pins = "PC5", "PC6", "PC8", "PC9",
1310 "PC10","PC11", "PC12", "PC13",
1311 "PC14", "PC15", "PC16";
1312 function = "mmc2";
1313@@ -364,6 +543,18 @@
1314 bias-pull-up;
1315 };
1316
1317+ mmc2_ds_pin: mmc2-ds-pin {
1318+ pins = "PC1";
1319+ function = "mmc2";
1320+ drive-strength = <30>;
1321+ bias-pull-up;
1322+ };
1323+
1324+ pwm_pin: pwm_pin {
1325+ pins = "PD22";
1326+ function = "pwm";
1327+ };
1328+
1329 rmii_pins: rmii_pins {
1330 pins = "PD10", "PD11", "PD13", "PD14", "PD17",
1331 "PD18", "PD19", "PD20", "PD22", "PD23";
1332@@ -394,7 +585,7 @@
1333 function = "spi1";
1334 };
1335
1336- uart0_pins_a: uart0 {
1337+ uart0_pb_pins: uart0-pb-pins {
1338 pins = "PB8", "PB9";
1339 function = "uart0";
1340 };
1341@@ -474,15 +665,6 @@
1342 status = "disabled";
1343 };
1344
1345- pwm: pwm@1c21400 {
1346- compatible = "allwinner,sun50i-a64-pwm",
1347- "allwinner,sun5i-a13-pwm";
1348- reg = <0x01c21400 0x8>;
1349- clocks = <&osc24M>;
1350- #pwm-cells = <3>;
1351- status = "disabled";
1352- };
1353-
1354 uart0: serial@1c28000 {
1355 compatible = "snps,dw-apb-uart";
1356 reg = <0x01c28000 0x400>;
1357@@ -617,8 +799,6 @@
1358 clocks = <&ccu CLK_BUS_EMAC>;
1359 clock-names = "stmmaceth";
1360 status = "disabled";
1361- #address-cells = <1>;
1362- #size-cells = <0>;
1363
1364 mdio: mdio {
1365 compatible = "snps,dwmac-mdio";
1366@@ -638,11 +818,69 @@
1367 #interrupt-cells = <3>;
1368 };
1369
1370+ pwm: pwm@1c21400 {
1371+ compatible = "allwinner,sun50i-a64-pwm",
1372+ "allwinner,sun5i-a13-pwm";
1373+ reg = <0x01c21400 0x400>;
1374+ clocks = <&osc24M>;
1375+ pinctrl-names = "default";
1376+ pinctrl-0 = <&pwm_pin>;
1377+ #pwm-cells = <3>;
1378+ status = "disabled";
1379+ };
1380+
1381+ hdmi: hdmi@1ee0000 {
1382+ compatible = "allwinner,sun50i-a64-dw-hdmi",
1383+ "allwinner,sun8i-a83t-dw-hdmi";
1384+ reg = <0x01ee0000 0x10000>;
1385+ reg-io-width = <1>;
1386+ interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
1387+ clocks = <&ccu CLK_BUS_HDMI>, <&ccu CLK_HDMI_DDC>,
1388+ <&ccu CLK_HDMI>;
1389+ clock-names = "iahb", "isfr", "tmds";
1390+ resets = <&ccu RST_BUS_HDMI1>;
1391+ reset-names = "ctrl";
1392+ phys = <&hdmi_phy>;
1393+ phy-names = "hdmi-phy";
1394+ status = "disabled";
1395+
1396+ ports {
1397+ #address-cells = <1>;
1398+ #size-cells = <0>;
1399+
1400+ hdmi_in: port@0 {
1401+ reg = <0>;
1402+
1403+ hdmi_in_tcon1: endpoint {
1404+ remote-endpoint = <&tcon1_out_hdmi>;
1405+ };
1406+ };
1407+
1408+ hdmi_out: port@1 {
1409+ reg = <1>;
1410+ };
1411+ };
1412+ };
1413+
1414+ hdmi_phy: hdmi-phy@1ef0000 {
1415+ compatible = "allwinner,sun50i-a64-hdmi-phy";
1416+ reg = <0x01ef0000 0x10000>;
1417+ clocks = <&ccu CLK_BUS_HDMI>, <&ccu CLK_HDMI_DDC>,
1418+ <&ccu 7>;
1419+ clock-names = "bus", "mod", "pll-0";
1420+ resets = <&ccu RST_BUS_HDMI0>;
1421+ reset-names = "phy";
1422+ #phy-cells = <0>;
1423+ };
1424+
1425 rtc: rtc@1f00000 {
1426 compatible = "allwinner,sun6i-a31-rtc";
1427 reg = <0x01f00000 0x54>;
1428 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
1429 <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
1430+ clock-output-names = "rtc-osc32k", "rtc-osc32k-out";
1431+ clocks = <&osc32k>;
1432+ #clock-cells = <1>;
1433 };
1434
1435 r_intc: interrupt-controller@1f00c00 {
1436@@ -664,6 +902,29 @@
1437 #reset-cells = <1>;
1438 };
1439
1440+ r_i2c: i2c@1f02400 {
1441+ compatible = "allwinner,sun50i-a64-i2c",
1442+ "allwinner,sun6i-a31-i2c";
1443+ reg = <0x01f02400 0x400>;
1444+ interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
1445+ clocks = <&r_ccu CLK_APB0_I2C>;
1446+ resets = <&r_ccu RST_APB0_I2C>;
1447+ status = "disabled";
1448+ #address-cells = <1>;
1449+ #size-cells = <0>;
1450+ };
1451+
1452+ r_pwm: pwm@1f03800 {
1453+ compatible = "allwinner,sun50i-a64-pwm",
1454+ "allwinner,sun5i-a13-pwm";
1455+ reg = <0x01f03800 0x400>;
1456+ clocks = <&osc24M>;
1457+ pinctrl-names = "default";
1458+ pinctrl-0 = <&r_pwm_pin>;
1459+ #pwm-cells = <3>;
1460+ status = "disabled";
1461+ };
1462+
1463 r_pio: pinctrl@1f02c00 {
1464 compatible = "allwinner,sun50i-a64-r-pinctrl";
1465 reg = <0x01f02c00 0x400>;
1466@@ -675,6 +936,16 @@
1467 interrupt-controller;
1468 #interrupt-cells = <3>;
1469
1470+ r_i2c_pl89_pins: r-i2c-pl89-pins {
1471+ pins = "PL8", "PL9";
1472+ function = "s_i2c";
1473+ };
1474+
1475+ r_pwm_pin: pwm {
1476+ pins = "PL10";
1477+ function = "s_pwm";
1478+ };
1479+
1480 r_rsb_pins: rsb {
1481 pins = "PL0", "PL1";
1482 function = "s_rsb";
1483--
14842.11.0
1485
diff --git a/gnu/packages/patches/u-boot-pinebook-dts.patch b/gnu/packages/patches/u-boot-pinebook-dts.patch
new file mode 100644
index 00000000000..48c004fdfc8
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-dts.patch
@@ -0,0 +1,388 @@
1From b972831c3cd24f3c9bb0995ed61db8f8239f3391 Mon Sep 17 00:00:00 2001
2From: Vasily Khoruzhick <anarsoul@gmail.com>
3Date: Mon, 5 Nov 2018 20:24:31 -0800
4Subject: [PATCH 10/13] sunxi: DT: add support for Pinebook
5
6Pinebook is a laptop produced by Pine64, with USB-connected keyboard,
7USB-connected touchpad and an eDP LCD panel connected via a RGB-eDP
8bridge from Analogix.
9
10Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
12Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
13Cc: Vagrant Cascadian <vagrant@debian.org>
14Reviewed-by: Jagan Teki <jagan@openedev.com>
15---
16 arch/arm/dts/Makefile | 1 +
17 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi | 15 ++
18 arch/arm/dts/sun50i-a64-pinebook.dts | 294 +++++++++++++++++++++++++++
19 configs/pinebook_defconfig | 22 ++
20 4 files changed, 332 insertions(+)
21 create mode 100644 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
22 create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts
23 create mode 100644 configs/pinebook_defconfig
24
25diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
26index 3093c1185e..eae6b9ee5d 100644
27--- a/arch/arm/dts/Makefile
28+++ b/arch/arm/dts/Makefile
29@@ -406,6 +406,7 @@ dtb-$(CONFIG_MACH_SUN50I) += \
30 sun50i-a64-orangepi-win.dtb \
31 sun50i-a64-pine64-plus.dtb \
32 sun50i-a64-pine64.dtb \
33+ sun50i-a64-pinebook.dtb \
34 sun50i-a64-sopine-baseboard.dtb
35 dtb-$(CONFIG_MACH_SUN9I) += \
36 sun9i-a80-optimus.dtb \
37diff --git a/arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi b/arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
38new file mode 100644
39index 0000000000..a99b7171d0
40--- /dev/null
41+++ b/arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
42@@ -0,0 +1,15 @@
43+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
44+/*
45+ * Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
46+ *
47+ */
48+
49+/* The ANX6345 eDP-bridge is on r_i2c */
50+&r_i2c {
51+ anx6345: edp-bridge@38 {
52+ compatible = "analogix,anx6345";
53+ reg = <0x38>;
54+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
55+ status = "okay";
56+ };
57+};
58diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts b/arch/arm/dts/sun50i-a64-pinebook.dts
59new file mode 100644
60index 0000000000..ec537c5297
61--- /dev/null
62+++ b/arch/arm/dts/sun50i-a64-pinebook.dts
63@@ -0,0 +1,294 @@
64+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
65+/*
66+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
67+ * Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
68+ *
69+ */
70+
71+/dts-v1/;
72+
73+#include "sun50i-a64.dtsi"
74+
75+#include <dt-bindings/gpio/gpio.h>
76+#include <dt-bindings/input/input.h>
77+#include <dt-bindings/pwm/pwm.h>
78+
79+/ {
80+ model = "Pinebook";
81+ compatible = "pine64,pinebook", "allwinner,sun50i-a64";
82+
83+ aliases {
84+ serial0 = &uart0;
85+ ethernet0 = &rtl8723cs;
86+ };
87+
88+ vdd_bl: regulator@0 {
89+ compatible = "regulator-fixed";
90+ regulator-name = "bl-3v3";
91+ regulator-min-microvolt = <3300000>;
92+ regulator-max-microvolt = <3300000>;
93+ gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
94+ enable-active-high;
95+ };
96+
97+ backlight: backlight {
98+ compatible = "pwm-backlight";
99+ pwms = <&pwm 0 50000 0>;
100+ brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
101+ default-brightness-level = <2>;
102+ enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
103+ power-supply = <&vdd_bl>;
104+ };
105+
106+ chosen {
107+ stdout-path = "serial0:115200n8";
108+
109+ framebuffer-lcd {
110+ panel-supply = <&reg_dc1sw>;
111+ dvdd25-supply = <&reg_dldo2>;
112+ dvdd12-supply = <&reg_fldo1>;
113+ };
114+ };
115+
116+ gpio_keys {
117+ compatible = "gpio-keys";
118+
119+ lid_switch {
120+ label = "Lid Switch";
121+ gpios = <&r_pio 0 12 GPIO_ACTIVE_LOW>; /* PL12 */
122+ linux,input-type = <EV_SW>;
123+ linux,code = <SW_LID>;
124+ linux,can-disable;
125+ wakeup-source;
126+ };
127+ };
128+
129+ reg_vcc3v3: vcc3v3 {
130+ compatible = "regulator-fixed";
131+ regulator-name = "vcc3v3";
132+ regulator-min-microvolt = <3300000>;
133+ regulator-max-microvolt = <3300000>;
134+ };
135+
136+ wifi_pwrseq: wifi_pwrseq {
137+ compatible = "mmc-pwrseq-simple";
138+ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
139+ };
140+};
141+
142+&ehci0 {
143+ phys = <&usbphy 0>;
144+ phy-names = "usb";
145+ status = "okay";
146+};
147+
148+&ehci1 {
149+ status = "okay";
150+};
151+
152+&mmc0 {
153+ pinctrl-names = "default";
154+ pinctrl-0 = <&mmc0_pins>;
155+ vmmc-supply = <&reg_dcdc1>;
156+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
157+ disable-wp;
158+ bus-width = <4>;
159+ status = "okay";
160+};
161+
162+&mmc1 {
163+ pinctrl-names = "default";
164+ pinctrl-0 = <&mmc1_pins>;
165+ vmmc-supply = <&reg_dldo4>;
166+ vqmmc-supply = <&reg_eldo1>;
167+ mmc-pwrseq = <&wifi_pwrseq>;
168+ bus-width = <4>;
169+ non-removable;
170+ status = "okay";
171+
172+ rtl8723cs: wifi@1 {
173+ reg = <1>;
174+ };
175+};
176+
177+&mmc2 {
178+ pinctrl-names = "default";
179+ pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
180+ vmmc-supply = <&reg_dcdc1>;
181+ vqmmc-supply = <&reg_eldo1>;
182+ bus-width = <8>;
183+ non-removable;
184+ cap-mmc-hw-reset;
185+ mmc-hs200-1_8v;
186+ status = "okay";
187+};
188+
189+&ohci0 {
190+ phys = <&usbphy 0>;
191+ phy-names = "usb";
192+ status = "okay";
193+};
194+
195+&ohci1 {
196+ status = "okay";
197+};
198+
199+&pwm {
200+ status = "okay";
201+};
202+
203+&r_rsb {
204+ status = "okay";
205+
206+ axp803: pmic@3a3 {
207+ compatible = "x-powers,axp803";
208+ reg = <0x3a3>;
209+ interrupt-parent = <&r_intc>;
210+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
211+ };
212+};
213+
214+/* The ANX6345 eDP-bridge is on r_i2c */
215+&r_i2c {
216+ clock-frequency = <100000>;
217+ pinctrl-names = "default";
218+ pinctrl-0 = <&r_i2c_pl89_pins>;
219+ status = "okay";
220+};
221+
222+#include "axp803.dtsi"
223+
224+&reg_aldo1 {
225+ regulator-min-microvolt = <2800000>;
226+ regulator-max-microvolt = <2800000>;
227+ regulator-name = "vcc-csi";
228+};
229+
230+&reg_aldo2 {
231+ regulator-always-on;
232+ regulator-min-microvolt = <1800000>;
233+ regulator-max-microvolt = <3300000>;
234+ regulator-name = "vcc-pl";
235+};
236+
237+&reg_aldo3 {
238+ regulator-always-on;
239+ regulator-min-microvolt = <2700000>;
240+ regulator-max-microvolt = <3300000>;
241+ regulator-name = "vcc-pll-avcc";
242+};
243+
244+&reg_dc1sw {
245+ regulator-name = "vcc-lcd";
246+};
247+
248+&reg_dcdc1 {
249+ regulator-always-on;
250+ regulator-min-microvolt = <3300000>;
251+ regulator-max-microvolt = <3300000>;
252+ regulator-name = "vcc-3v3";
253+};
254+
255+&reg_dcdc2 {
256+ regulator-always-on;
257+ regulator-min-microvolt = <1000000>;
258+ regulator-max-microvolt = <1300000>;
259+ regulator-name = "vdd-cpux";
260+};
261+
262+/* DCDC3 is polyphased with DCDC2 */
263+
264+&reg_dcdc5 {
265+ regulator-always-on;
266+ regulator-min-microvolt = <1200000>;
267+ regulator-max-microvolt = <1200000>;
268+ regulator-name = "vcc-dram";
269+};
270+
271+&reg_dcdc6 {
272+ regulator-always-on;
273+ regulator-min-microvolt = <1100000>;
274+ regulator-max-microvolt = <1100000>;
275+ regulator-name = "vdd-sys";
276+};
277+
278+&reg_dldo1 {
279+ regulator-min-microvolt = <3300000>;
280+ regulator-max-microvolt = <3300000>;
281+ regulator-name = "vcc-hdmi";
282+};
283+
284+&reg_dldo2 {
285+ regulator-min-microvolt = <2500000>;
286+ regulator-max-microvolt = <2500000>;
287+ regulator-name = "vcc-edp";
288+};
289+
290+&reg_dldo3 {
291+ regulator-min-microvolt = <3300000>;
292+ regulator-max-microvolt = <3300000>;
293+ regulator-name = "avdd-csi";
294+};
295+
296+&reg_dldo4 {
297+ regulator-min-microvolt = <3300000>;
298+ regulator-max-microvolt = <3300000>;
299+ regulator-name = "vcc-wifi";
300+};
301+
302+&reg_eldo1 {
303+ regulator-always-on;
304+ regulator-min-microvolt = <1800000>;
305+ regulator-max-microvolt = <1800000>;
306+ regulator-name = "cpvdd";
307+};
308+
309+&reg_eldo3 {
310+ regulator-min-microvolt = <1800000>;
311+ regulator-max-microvolt = <1800000>;
312+ regulator-name = "vdd-1v8-csi";
313+};
314+
315+&reg_fldo1 {
316+ regulator-min-microvolt = <1200000>;
317+ regulator-max-microvolt = <1200000>;
318+ regulator-name = "vcc-1v2-hsic";
319+};
320+
321+&reg_fldo2 {
322+ regulator-always-on;
323+ regulator-min-microvolt = <1100000>;
324+ regulator-max-microvolt = <1100000>;
325+ regulator-name = "vdd-cpus";
326+};
327+
328+&reg_ldo_io0 {
329+ regulator-min-microvolt = <3300000>;
330+ regulator-max-microvolt = <3300000>;
331+ regulator-name = "vcc-usb";
332+ status = "okay";
333+};
334+
335+&reg_rtc_ldo {
336+ regulator-name = "vcc-rtc";
337+};
338+
339+&simplefb_hdmi {
340+ vcc-hdmi-supply = <&reg_dldo1>;
341+};
342+
343+&uart0 {
344+ pinctrl-names = "default";
345+ pinctrl-0 = <&uart0_pb_pins>;
346+ status = "okay";
347+};
348+
349+&usb_otg {
350+ dr_mode = "host";
351+};
352+
353+&usbphy {
354+ usb0_vbus-supply = <&reg_ldo_io0>;
355+ usb1_vbus-supply = <&reg_ldo_io0>;
356+ status = "okay";
357+};
358diff --git a/configs/pinebook_defconfig b/configs/pinebook_defconfig
359new file mode 100644
360index 0000000000..5294dbd2eb
361--- /dev/null
362+++ b/configs/pinebook_defconfig
363@@ -0,0 +1,22 @@
364+CONFIG_ARM=y
365+CONFIG_ARCH_SUNXI=y
366+CONFIG_SPL=y
367+CONFIG_MACH_SUN50I=y
368+CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
369+CONFIG_DRAM_CLK=552
370+CONFIG_DRAM_ZQ=3881949
371+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
372+CONFIG_R_I2C_ENABLE=y
373+# CONFIG_CMD_FLASH is not set
374+# CONFIG_SPL_DOS_PARTITION is not set
375+# CONFIG_SPL_EFI_PARTITION is not set
376+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook"
377+CONFIG_DM_REGULATOR=y
378+CONFIG_DM_REGULATOR_FIXED=y
379+CONFIG_DM_PWM=y
380+CONFIG_PWM_SUNXI=y
381+CONFIG_USB_EHCI_HCD=y
382+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
383+# CONFIG_USB_GADGET is not set
384+CONFIG_VIDEO_BRIDGE=y
385+CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345=y
386--
3872.11.0
388
diff --git a/gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch b/gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch
new file mode 100644
index 00000000000..118bdf8e0cf
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch
@@ -0,0 +1,98 @@
1From 20940ef2a397446a209350900d3bd618c3fd5b94 Mon Sep 17 00:00:00 2001
2From: Vasily Khoruzhick <anarsoul@gmail.com>
3Date: Mon, 5 Nov 2018 20:24:28 -0800
4Subject: [PATCH 07/13] mmc: sunxi: add support for automatic delay calibration
5
6A64 and H6 support automatic delay calibration and Linux driver uses it
7instead of hardcoded delays. Add support for it to u-boot driver.
8
9Fixes eMMC instability on Pinebook
10
11Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
12Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
13Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
14Reviewed-by: Andre Przywara <andre.przywara@arm.com>
15Cc: Vagrant Cascadian <vagrant@debian.org>
16Reviewed-by: Jagan Teki <jagan@openedev.com>
17---
18 arch/arm/include/asm/arch-sunxi/mmc.h | 6 +++++-
19 drivers/mmc/sunxi_mmc.c | 21 ++++++++++++++++++++-
20 2 files changed, 25 insertions(+), 2 deletions(-)
21
22diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h
23index d98c53faaa..f2deafddd2 100644
24--- a/arch/arm/include/asm/arch-sunxi/mmc.h
25+++ b/arch/arm/include/asm/arch-sunxi/mmc.h
26@@ -46,7 +46,9 @@ struct sunxi_mmc {
27 u32 cbda; /* 0x94 */
28 u32 res2[26];
29 #if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6)
30- u32 res3[64];
31+ u32 res3[17];
32+ u32 samp_dl;
33+ u32 res4[46];
34 #endif
35 u32 fifo; /* 0x100 / 0x200 FIFO access address */
36 };
37@@ -130,5 +132,7 @@ struct sunxi_mmc {
38 #define SUNXI_MMC_COMMON_CLK_GATE (1 << 16)
39 #define SUNXI_MMC_COMMON_RESET (1 << 18)
40
41+#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7)
42+
43 struct mmc *sunxi_mmc_init(int sdc_no);
44 #endif /* _SUNXI_MMC_H */
45diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
46index 39f15eb423..147eb9b4d5 100644
47--- a/drivers/mmc/sunxi_mmc.c
48+++ b/drivers/mmc/sunxi_mmc.c
49@@ -99,11 +99,16 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
50 {
51 unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly;
52 bool new_mode = false;
53+ bool calibrate = false;
54 u32 val = 0;
55
56 if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2))
57 new_mode = true;
58
59+#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6)
60+ calibrate = true;
61+#endif
62+
63 /*
64 * The MMC clock has an extra /2 post-divider when operating in the new
65 * mode.
66@@ -174,7 +179,11 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
67 val = CCM_MMC_CTRL_MODE_SEL_NEW;
68 setbits_le32(&priv->reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW);
69 #endif
70- } else {
71+ } else if (!calibrate) {
72+ /*
73+ * Use hardcoded delay values if controller doesn't support
74+ * calibration
75+ */
76 val = CCM_MMC_CTRL_OCLK_DLY(oclk_dly) |
77 CCM_MMC_CTRL_SCLK_DLY(sclk_dly);
78 }
79@@ -228,6 +237,16 @@ static int mmc_config_clock(struct sunxi_mmc_priv *priv, struct mmc *mmc)
80 rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK;
81 writel(rval, &priv->reg->clkcr);
82
83+#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6)
84+ /* A64 supports calibration of delays on MMC controller and we
85+ * have to set delay of zero before starting calibration.
86+ * Allwinner BSP driver sets a delay only in the case of
87+ * using HS400 which is not supported by mainline U-Boot or
88+ * Linux at the moment
89+ */
90+ writel(SUNXI_MMC_CAL_DL_SW_EN, &priv->reg->samp_dl);
91+#endif
92+
93 /* Re-enable Clock */
94 rval |= SUNXI_MMC_CLK_ENABLE;
95 writel(rval, &priv->reg->clkcr);
96--
972.11.0
98
diff --git a/gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch b/gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch
new file mode 100644
index 00000000000..824a16b9dbb
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch
@@ -0,0 +1,70 @@
1From 31a4ac4d79d75baeede3edfa95515fd4169ef502 Mon Sep 17 00:00:00 2001
2From: Vasily Khoruzhick <anarsoul@gmail.com>
3Date: Mon, 5 Nov 2018 20:24:30 -0800
4Subject: [PATCH 09/13] sun50i: A64: add support for R_I2C controller
5
6Allwinner A64 has a I2C controller, which is in the R_ MMIO zone and has
7two groups of pinmuxes on PL bank, so it's called R_I2C.
8
9Add support for this I2C controller and the pinmux which doesn't conflict
10with RSB.
11
12Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
13Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
14Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
15Cc: Vagrant Cascadian <vagrant@debian.org>
16Acked-by: Jagan Teki <jagan@openedev.com>
17---
18 arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
19 arch/arm/mach-sunxi/Kconfig | 1 +
20 board/sunxi/board.c | 6 ++++++
21 3 files changed, 8 insertions(+)
22
23diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
24index 6a5eafc3d3..2daf23f6f5 100644
25--- a/arch/arm/include/asm/arch-sunxi/gpio.h
26+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
27@@ -211,6 +211,7 @@ enum sunxi_gpio_number {
28 #define SUN8I_H3_GPL_R_TWI 2
29 #define SUN8I_A23_GPL_R_TWI 3
30 #define SUN8I_GPL_R_UART 2
31+#define SUN50I_GPL_R_TWI 2
32
33 #define SUN9I_GPN_R_RSB 3
34
35diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
36index 6277abc3cc..560dc9b25d 100644
37--- a/arch/arm/mach-sunxi/Kconfig
38+++ b/arch/arm/mach-sunxi/Kconfig
39@@ -278,6 +278,7 @@ config MACH_SUN50I
40 select ARM64
41 select DM_I2C
42 select PHY_SUN4I_USB
43+ select SUN6I_PRCM
44 select SUNXI_DE2
45 select SUNXI_GEN_SUN6I
46 select SUPPORT_SPL
47diff --git a/board/sunxi/board.c b/board/sunxi/board.c
48index b196d48674..64ccbc7245 100644
49--- a/board/sunxi/board.c
50+++ b/board/sunxi/board.c
51@@ -168,10 +168,16 @@ void i2c_init_board(void)
52 #endif
53
54 #ifdef CONFIG_R_I2C_ENABLE
55+#ifdef CONFIG_MACH_SUN50I
56+ clock_twi_onoff(5, 1);
57+ sunxi_gpio_set_cfgpin(SUNXI_GPL(8), SUN50I_GPL_R_TWI);
58+ sunxi_gpio_set_cfgpin(SUNXI_GPL(9), SUN50I_GPL_R_TWI);
59+#else
60 clock_twi_onoff(5, 1);
61 sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
62 sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
63 #endif
64+#endif
65 }
66
67 #if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)
68--
692.11.0
70
diff --git a/gnu/packages/patches/u-boot-pinebook-syscon-node.patch b/gnu/packages/patches/u-boot-pinebook-syscon-node.patch
new file mode 100644
index 00000000000..9289645becb
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-syscon-node.patch
@@ -0,0 +1,38 @@
1From ababb5920e8992c9bb7956df3cc85dc68d27dfe8 Mon Sep 17 00:00:00 2001
2From: Andre Przywara <andre.przywara@arm.com>
3Date: Mon, 29 Oct 2018 00:56:48 +0000
4Subject: [PATCH 04/13] sunxi: A64: Re-add syscon to DT node
5
6The sun50i-a64.dtsi changes introduced in Linux v4.19-rc1 changed the
7compatible name for the syscon controller, dropping the generic "syscon"
8fallback. Using this new DT node will make the Ethernet driver in every
9older kernel (or non-Linux kernels) fail to initialise the MAC device.
10
11To allow booting distribution kernels (from installer images via UEFI,
12for instance), re-add the syscon compatible string as a fallback. This
13works with both older and newer kernels.
14
15Signed-off-by: Andre Przywara <andre.przywara@arm.com>
16Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
17Reviewed-by: Jagan Teki <jagan@openedev.com>
18---
19 arch/arm/dts/sun50i-a64.dtsi | 3 ++-
20 1 file changed, 2 insertions(+), 1 deletion(-)
21
22diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi
23index f3a66f8882..ff41abc96a 100644
24--- a/arch/arm/dts/sun50i-a64.dtsi
25+++ b/arch/arm/dts/sun50i-a64.dtsi
26@@ -259,7 +259,8 @@
27 };
28
29 syscon: syscon@1c00000 {
30- compatible = "allwinner,sun50i-a64-system-control";
31+ compatible = "allwinner,sun50i-a64-system-control",
32+ "syscon";
33 reg = <0x01c00000 0x1000>;
34 #address-cells = <1>;
35 #size-cells = <1>;
36--
372.11.0
38
diff --git a/gnu/packages/patches/u-boot-pinebook-video-bridge.patch b/gnu/packages/patches/u-boot-pinebook-video-bridge.patch
new file mode 100644
index 00000000000..8c6ca8a9928
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-video-bridge.patch
@@ -0,0 +1,50 @@
1From 8336a43792a103c13d939b3925cb75322911f7fb Mon Sep 17 00:00:00 2001
2From: Vasily Khoruzhick <anarsoul@gmail.com>
3Date: Mon, 5 Nov 2018 20:24:29 -0800
4Subject: [PATCH 08/13] dm: video: bridge: don't fail to activate bridge if
5 reset or sleep GPIO is missing
6
7Both GPIOs are optional, so we shouldn't fail if any is missing.
8Without this fix reset is not deasserted if sleep GPIO is missing.
9
10Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
11Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
12Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
13Reviewed-by: Andre Przywara <andre.przywara@arm.com>
14Cc: Vagrant Cascadian <vagrant@debian.org>
15---
16 drivers/video/bridge/video-bridge-uclass.c | 16 +++++++++++-----
17 1 file changed, 11 insertions(+), 5 deletions(-)
18
19diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c
20index cd4959cc71..5fecb4cfd5 100644
21--- a/drivers/video/bridge/video-bridge-uclass.c
22+++ b/drivers/video/bridge/video-bridge-uclass.c
23@@ -106,13 +106,19 @@ static int video_bridge_pre_probe(struct udevice *dev)
24 int video_bridge_set_active(struct udevice *dev, bool active)
25 {
26 struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
27- int ret;
28+ int ret = 0;
29
30 debug("%s: %d\n", __func__, active);
31- ret = dm_gpio_set_value(&uc_priv->sleep, !active);
32- if (ret)
33- return ret;
34- if (active) {
35+ if (uc_priv->sleep.dev) {
36+ ret = dm_gpio_set_value(&uc_priv->sleep, !active);
37+ if (ret)
38+ return ret;
39+ }
40+
41+ if (!active)
42+ return 0;
43+
44+ if (uc_priv->reset.dev) {
45 ret = dm_gpio_set_value(&uc_priv->reset, true);
46 if (ret)
47 return ret;
48--
492.11.0
50
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index a648ddf95e5..45b3a0c839f 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -53,6 +53,7 @@
53 nintendo-nes-classic-edition-installation-os 53 nintendo-nes-classic-edition-installation-os
54 novena-installation-os 54 novena-installation-os
55 pine64-plus-installation-os 55 pine64-plus-installation-os
56 pinebook-installation-os
56 rk3399-puma-installation-os 57 rk3399-puma-installation-os
57 wandboard-installation-os 58 wandboard-installation-os
58 os-with-u-boot)) 59 os-with-u-boot))
@@ -473,6 +474,11 @@ The bootloader BOOTLOADER is installed to BOOTLOADER-TARGET."
473 "/dev/mmcblk0" ; SD card storage 474 "/dev/mmcblk0" ; SD card storage
474 "ttyS0")) 475 "ttyS0"))
475 476
477(define pinebook-installation-os
478 (embedded-installation-os u-boot-pinebook-bootloader
479 "/dev/mmcblk0" ; SD card storage
480 "ttyS0"))
481
476(define rk3399-puma-installation-os 482(define rk3399-puma-installation-os
477 (embedded-installation-os u-boot-puma-rk3399-bootloader 483 (embedded-installation-os u-boot-puma-rk3399-bootloader
478 "/dev/mmcblk0" ; SD card storage 484 "/dev/mmcblk0" ; SD card storage