]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
airoha: an7583: enable USB on Nokia XG-040G-MF 14052/head 24609/head
authorVitaliy Sochnev <sochnev.v.74@gmail.com>
Fri, 7 Aug 2026 20:02:02 +0000 (21:02 +0100)
committerRobert Marko <robimarko@gmail.com>
Thu, 13 Aug 2026 08:44:41 +0000 (10:44 +0200)
The board has one USB 2.0 and one USB 3.0 port, both powered from a
5V rail switched by GPIO 30. The device tree already carried the whole
USB description commented out, waiting for SoC support.

Uncomment the 3.3V/5V regulators, the usbport LED triggers and the xHCI
node, enable the USB PHY, and add the LED trigger and regulator kmods to
the image.

Signed-off-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24609
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/airoha/dts/an7583-nokia_xg-040g-mf-common.dtsi
target/linux/airoha/image/an7583.mk

index 317ee4b621077f5a13b63ed27d9c76b5e86000d6..03b1c05d9219b494a97aa23064baf20da839db31 100644 (file)
                        function = LED_FUNCTION_USB;
                        function-enumerator = <1>;
                        gpios = <&an7583_pinctrl 26 GPIO_ACTIVE_LOW>;
-                       /*
-                        * AN7583 SoC doesn't support USB at this time
-                        *
-                        * linux,default-trigger = "usbport";
-                        * trigger-sources = <&usb_port1>;
-                        */
+                       linux,default-trigger = "usbport";
+                       trigger-sources = <&usb_port1>;
                };
 
                led-4 {
                        function = LED_FUNCTION_USB;
                        function-enumerator = <2>;
                        gpios = <&an7583_pinctrl 33 GPIO_ACTIVE_LOW>;
-                       /*
-                        * AN7583 SoC doesn't support USB at this time
-                        *
-                        * linux,default-trigger = "usbport";
-                        * trigger-sources = <&usb_port2>;
-                        */
+                       linux,default-trigger = "usbport";
+                       trigger-sources = <&usb_port2>;
                };
        };
 
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-always-on;
+               regulator-boot-on;
+               regulator-max-microvolt = <3300000>;
+               regulator-min-microvolt = <3300000>;
+               regulator-name = "fixed-3.3V";
+       };
+
+       reg_usb_5v: regulator-usb-5v {
+               compatible = "regulator-fixed";
+               enable-active-high;
+               gpio = <&an7583_pinctrl 30 GPIO_ACTIVE_HIGH>;
+               regulator-boot-on;
+               regulator-max-microvolt = <5000000>;
+               regulator-min-microvolt = <5000000>;
+               regulator-name = "usb-5v";
+       };
+
        /*
-        * AN7583 SoC doesn't support USB at this time
-        *
-        * reg_3p3v: regulator-3p3v {
-        *      compatible = "regulator-fixed";
-        *      regulator-always-on;
-        *      regulator-boot-on;
-        *      regulator-max-microvolt = <3300000>;
-        *      regulator-min-microvolt = <3300000>;
-        *      regulator-name = "fixed-3.3V";
-        * };
-        *
-        * reg_usb_5v: regulator-usb-5v {
-        *      compatible = "regulator-fixed";
-        *      enable-active-high;
-        *      gpio = <&an7583_pinctrl 30 GPIO_ACTIVE_HIGH>;
-        *      regulator-boot-on;
-        *      regulator-max-microvolt = <5000000>;
-        *      regulator-min-microvolt = <5000000>;
-        *      regulator-name = "usb-5v";
-        * };
-        *
-        *  *
-        *  * Controls both USB ports at once
-        *  *
-        * usb-power {
-        *      compatible = "regulator-output";
-        *      vout-supply = <&reg_usb_5v>;
-        * };
+        * Controls both USB ports at once
         */
+       usb-power {
+               compatible = "regulator-output";
+               vout-supply = <&reg_usb_5v>;
+       };
 };
 
 &an7583_pinctrl {
        nvmem-cells = <&macaddr_factory_3e (0)>;
 };
 
-/*
- * AN7583 SoC doesn't support USB at this time
- *
- * &usb0 {
- *     status = "okay";
- *     #address-cells = <1>;
- *     #size-cells = <0>;
- *
- *     vusb33-supply = <&reg_3p3v>;
- *
- *     usb_port1: port@1 {
- *             reg = <1>;
- *             #trigger-source-cells = <0>;
- *     };
- *
- *     usb_port2: port@2 {
- *             reg = <2>;
- *             #trigger-source-cells = <0>;
- *     };
- * };
- */
+&usb_phy {
+       status = "okay";
+};
+
+&usb0 {
+       status = "okay";
+
+       vusb33-supply = <&reg_3p3v>;
+
+       #address-cells = <1>;
+       #size-cells = <0>;
+
+       usb_port1: port@1 {
+               reg = <1>;
+               #trigger-source-cells = <0>;
+       };
+
+       usb_port2: port@2 {
+               reg = <2>;
+               #trigger-source-cells = <0>;
+       };
+};
index fe9dc092b3112f358dd02c79c5ca07b74897df17..d97debb6bc657f511b07257f18f7264a96f1f5e2 100644 (file)
@@ -62,6 +62,7 @@ define Device/nokia_xg-040g-mf
   IMAGE/factory-kernel.bin := append-kernel
   IMAGE/factory-rootfs.bin := append-ubi | check-size
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
-  DEVICE_PACKAGES := kmod-phy-airoha-en8811h
+  DEVICE_PACKAGES := kmod-phy-airoha-en8811h kmod-regulator-userspace-consumer \
+       kmod-usb-ledtrig-usbport
 endef
 TARGET_DEVICES += nokia_xg-040g-mf