Jump to content

USB on Nanopi Neo air with mainline kernel


jts

Recommended Posts

Hi all, 

 

I applied aptches to the dts file and finally USB worked. Kernel version 4.12.12.  These patches enable both wifi and USB.  I copied wifi patch from other sources. But for USB, I had to to patch  sunxi-h3-h5.dtsi or USB wouldn't work. Is it worth applying this patch to the mainline kernel?

 

The source I worked on : https://github.com/torvalds/linux/tree/v4.12

 

 

Here are the patches:

 

--- linux-4.12/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts    2017-07-03 01:07:02.000000000 +0200
+++ /home/nuvo/air-kernel/linux-4.12/linux-4.12.12/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts    2018-01-05 11:13:26.083622528 +0100
@@ -45,7 +45,7 @@
 #include "sunxi-common-regulators.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
-
+#include <dt-bindings/pinctrl/sun4i-a10.h>
 / {
     model = "FriendlyARM NanoPi NEO Air";
     compatible = "friendlyarm,nanopi-neo-air", "allwinner,sun8i-h3";
@@ -72,6 +72,16 @@
             gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */
         };
     };
+    wifi_pwrseq: wifi_pwrseq {
+        compatible = "mmc-pwrseq-simple";
+        pinctrl-names = "default";
+        pinctrl-0 = <&wifi_en_nanopi_neo_air>;
+        reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+    };
+};
+
+&ehci3 {
+    status = "okay";
 };
 
 &mmc0 {
@@ -84,13 +94,61 @@
     status = "okay";
 };
 
+&ohci3 {
+    status = "okay";
+};
+
+&mmc1 {
+    pinctrl-names = "default";
+    pinctrl-0 = <&mmc1_pins_a>;
+    vmmc-supply = <&reg_vcc3v3>;
+    vqmmc-supply = <&reg_vcc3v3>;
+    mmc-pwrseq = <&wifi_pwrseq>;
+    bus-width = <4>;
+    non-removable;
+    status = "okay";
+
+    brcmf: bcrmf@1 {
+        reg = <1>;
+        compatible = "brcm,brcmfmac";
+        interrupt-parent = <&pio>;
+        interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
+        interrupt-names = "host-wake";
+    };
+};
+
+&mmc2 {
+    pinctrl-names = "default";
+    pinctrl-0 = <&mmc2_8bit_pins>;
+    vmmc-supply = <&reg_vcc3v3>;
+    vqmmc-supply = <&reg_vcc3v3>;
+    bus-width = <8>;
+    non-removable;
+    status = "okay";
+};
+
+&r_pio {
+    wifi_en_nanopi_neo_air: wifi_en_pin {
+        allwinner,pins = "PL7";
+        allwinner,function = "gpio_out";
+        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+        allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+    };
+};
+
 &uart0 {
     pinctrl-names = "default";
     pinctrl-0 = <&uart0_pins_a>;
     status = "okay";
 };
 
+/*&usb_otg {
+    dr_mode = "otg";
+    status = "okay";
+};
+*/
 &usbphy {
     /* USB VBUS is always on */
     status = "okay";
 };
+

and 

--- linux-4.12/arch/arm/boot/dts/sunxi-h3-h5.dtsi	2017-07-03 01:07:02.000000000 +0200
+++ /home/nuvo/air-kernel/linux-4.12/linux-4.12.12/arch/arm/boot/dts/sunxi-h3-h5.dtsi	2018-01-05 11:30:32.891423644 +0100
@@ -176,7 +176,7 @@
 			interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>;
 			resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
-			status = "disabled";
+			status = "okay";
 		};
 
 		ohci0: usb@01c1a400 {
@@ -186,7 +186,7 @@
 			clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>,
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
-			status = "disabled";
+			status = "okay";
 		};
 
 		ehci1: usb@01c1b000 {
@@ -197,7 +197,7 @@
 			resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>;
 			phys = <&usbphy 1>;
 			phy-names = "usb";
-			status = "disabled";
+			status = "okay";
 		};
 
 		ohci1: usb@01c1b400 {
@@ -209,7 +209,7 @@
 			resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>;
 			phys = <&usbphy 1>;
 			phy-names = "usb";
-			status = "disabled";
+			status = "okay";
 		};
 
 		ehci2: usb@01c1c000 {
@@ -220,7 +220,8 @@
 			resets = <&ccu RST_BUS_EHCI2>, <&ccu RST_BUS_OHCI2>;
 			phys = <&usbphy 2>;
 			phy-names = "usb";
-			status = "disabled";
+			status = "okay";
+
 		};
 
 		ohci2: usb@01c1c400 {
@@ -232,7 +233,7 @@
 			resets = <&ccu RST_BUS_EHCI2>, <&ccu RST_BUS_OHCI2>;
 			phys = <&usbphy 2>;
 			phy-names = "usb";
-			status = "disabled";
+			status = "okay";
 		};
 
 		ehci3: usb@01c1d000 {
@@ -243,7 +244,7 @@
 			resets = <&ccu RST_BUS_EHCI3>, <&ccu RST_BUS_OHCI3>;
 			phys = <&usbphy 3>;
 			phy-names = "usb";
-			status = "disabled";
+			status = "okay";
 		};
 
 		ohci3: usb@01c1d400 {
@@ -255,7 +256,7 @@
 			resets = <&ccu RST_BUS_EHCI3>, <&ccu RST_BUS_OHCI3>;
 			phys = <&usbphy 3>;
 			phy-names = "usb";
-			status = "disabled";
+			status = "okay";
 		};
 
 		ccu: clock@01c20000 {

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines