sunxi: rework nanopi r1s (h5) compilation for kernel 4.14

Known issues:
 - Wireless not working

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
CN_SZTL 2020-10-17 16:16:17 +00:00
parent 0939a82601
commit aba9592e41
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 99 additions and 42 deletions

View File

@ -159,13 +159,13 @@ endef
define U-Boot/nanopi_r1
BUILD_SUBTARGET:=cortexa7
NAME:=U-Boot for NanoPi R1 (H3)
BUILD_DEVICES:=friendyarm-h3-nanopi-r1
BUILD_DEVICES:=friendlyarm_nanopi-r1
endef
define U-Boot/nanopi_r1s
BUILD_SUBTARGET:=cortexa53
NAME:=NanoPi R1S (H5)
BUILD_DEVICES:=friendlyarm-h5-nanopi-r1s
BUILD_DEVICES:=friendlyarm_nanopi-r1s
DEPENDS:=+PACKAGE_u-boot-nanopi_r1s:arm-trusted-firmware-sunxi
UENV:=a64
endef

View File

@ -28,7 +28,7 @@ new file mode 100644
index 0000000..4992ef5
--- /dev/null
+++ b/arch/arm/dts/sun50i-h5-nanopi-r1s.dts
@@ -0,0 +1,86 @@
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
+ * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
@ -103,7 +103,6 @@ index 0000000..4992ef5
+ "allwinner,sun50i-a64-mmc",
+ "allwinner,sun5i-a13-mmc";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
+ vmmc-supply = <&reg_vcc3v3>;
+ bus-width = <4>;
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */

View File

@ -31,8 +31,7 @@ TARGET_DEVICES += friendlyarm_nanopi-neo2
define Device/friendlyarm_nanopi-r1s
DEVICE_VENDOR := FriendlyARM
DEVICE_MODEL:=Nanopi R1S (H5)
DEVICE_PACKAGES:=kmod-rtc-sunxi \
kmod-leds-gpio kmod-ledtrig-heartbeat \
DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-leds-gpio kmod-ledtrig-heartbeat \
kmod-brcmfmac brcmfmac-firmware-43430-sdio wpad-basic \
kmod-usb-net kmod-usb-net-rtl8152
SUPPORTED_DEVICES:=nanopi-r1s

View File

@ -0,0 +1,33 @@
From a8ec9a8d2247076290e6c8b8f353c948c2a84a62 Mon Sep 17 00:00:00 2001
From: wuweidong <625769020@qq.com>
Date: Wed, 18 Sep 2019 14:32:26 +0800
Subject: [PATCH] r8152: init LED for RTL_VER_09
---
drivers/net/usb/r8152.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 8ccb22b098a6b..a22e113fe17dd 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -4217,6 +4217,10 @@ static void r8153b_init(struct r8152 *tp)
rtl_tally_reset(tp);
tp->coalesce = 15000; /* 15 us */
+
+ ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LEDSEL);
+ ocp_data = 0x78;
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, ocp_data);
}
static int rtl8152_pre_reset(struct usb_interface *intf)
@@ -5141,7 +5145,7 @@ static u8 rtl_get_version(struct usb_interface *intf)
break;
}
- dev_dbg(&intf->dev, "Detected version 0x%04x\n", version);
+ dev_info(&intf->dev, "Detected version 0x%04x\n", version);
return version;
}

View File

@ -10,7 +10,7 @@
subdir-y := $(dts-dirs)
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s.dts
@@ -0,0 +1,232 @@
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
+ *
@ -61,36 +61,19 @@
+#include <dt-bindings/pinctrl/sun4i-a10.h>
+#include <dt-bindings/thermal/thermal.h>
+/ {
+ model = "FriendlyElec NanoPi-R1S-H5";
+ model = "FriendlyElec NanoPi R1S (H5)";
+ compatible = "friendlyelec,nanopi-r1s-h5", "allwinner,sun50i-h5";
+
+ aliases {
+ ethernet0 = &emac;
+ ethernet1 = &emac;
+ ethernet2 = &sdio_wifi;
+ serial0 = &uart0;
+ };
+
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ wifi_pwrseq: wifi_pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wifi_en_npi>;
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+ post-power-on-delay-ms = <200>;
+ };
+
+ r-gpio-keys {
+ compatible = "gpio-keys";
+
+ k1@0 {
+ label = "k1";
+ linux,code = <KEY_POWER>;
+ gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
@ -142,11 +125,26 @@
+ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
+ status = "okay";
+ };
+
+ r-gpio-keys {
+ compatible = "gpio-keys";
+
+ k1@0 {
+ label = "k1";
+ linux,code = <KEY_POWER>;
+ gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ wifi_pwrseq: wifi_pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wifi_en_npi>;
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+ post-power-on-delay-ms = <200>;
+ };
+};
+
+
+
+
+&ehci0 {
+ status = "okay";
+};
@ -185,13 +183,14 @@
+ phy-supply = <&reg_gmac_3v3>;
+ phy-handle = <&ext_rgmii_phy>;
+ phy-mode = "rgmii";
+
+ status = "okay";
+};
+
+&external_mdio {
+ ext_rgmii_phy: ethernet-phy@7 {
+&mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <7>;
+ reg = <0>;
+ };
+};
+
@ -213,12 +212,32 @@
+ bus-width = <4>;
+ non-removable;
+ status = "okay";
+
+ sdio_wifi: sdio_wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ interrupt-parent = <&pio>;
+ interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
+ interrupt-names = "host-wake";
+ };
+};
+&r_pio {
+ wifi_en_npi: wifi_en_pin {
+ pins = "PL7";
+ function = "gpio_out";
+ };
+
+&mmc2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc2_8bit_pins>;
+ vmmc-supply = <&reg_vcc3v3>;
+ vqmmc-supply = <&reg_vcc3v3>;
+ bus-width = <8>;
+ non-removable;
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
+&ohci1 {
+ status = "okay";
+};
+
+&uart0 {
@ -231,10 +250,6 @@
+ dr_mode = "peripheral";
+ status = "okay";
+};
+&reg_usb0_vbus {
+ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
+ status = "okay";
+};
+
+&usbphy {
+ /* USB Type-A port's VBUS is always on */
@ -243,3 +258,14 @@
+ status = "okay";
+};
+
+&r_pio {
+ wifi_en_npi: wifi_en_pin {
+ pins = "PL7";
+ function = "gpio_out";
+ };
+};
+
+&reg_usb0_vbus {
+ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
+ status = "okay";
+};