Ath79: Fix GL-AR300M USB power issue

Hello all.

I have a GL.iNet AR300M router and build ath79 firmware from sources. All system works fine except USB - any kind of usb device (modem, storage, wi-fi adapter) on plug start a "infinite loop" - connect-disconnect-connect-disconnect... Cause - in dtsi file qca9533_glinet_ar300m.dtsi GPIO for usb power has been incorrectly configured - as a status led for connected device itself. I'm fixes config file and USB also works fine.

Here is a patch:

--- a/target/linux/ath79/dts/qca9533_glinet_ar300m.dtsi	2018-10-24 20:42:40.574552115 +0300
+++ b/target/linux/ath79/dts/qca9533_glinet_ar300m.dtsi	2018-10-24 21:20:20.264713277 +0300
@@ -37,13 +37,6 @@
 	leds {
 		compatible = "gpio-leds";
 
-		usb {
-			label = "gl-ar300m:green:usb";
-			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
-			trigger-sources = <&hub_port>;
-			linux,default-trigger = "usbport";
-		};
-
 		wlan {
 			label = "gl-ar300m:green:wlan";
 			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
@@ -60,6 +53,18 @@
 			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	gpio-export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		gpio_usb_power {
+			gpio-export,name = "gl-ar300m:power:usb";
+			gpio-export,output = <1>;
+			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+		};
+	};
+
 };
 
 &pcie0 {
@@ -70,20 +75,25 @@
 	status = "okay";
 };
 
+&gpio {
+	status = "okay";
+};
+
+&usb_phy {
+	status = "okay";
+};
+
 &usb0 {
 	#address-cells = <1>;
 	#size-cells = <0>;
 	status = "okay";
 
-	hub_port: port@1 {
+	hub_port0: port@1 {
 		reg = <1>;
 		#trigger-source-cells = <0>;
 	};
 };
 
-&usb_phy {
-	status = "okay";
-};
 
 &eth0 {
 	status = "okay";

PS: sorry for bad english

1 Like