From 91a1245ad74b7c2882a53dac3b84ef90abfbc906 Mon Sep 17 00:00:00 2001 From: Vitaliy Sochnev Date: Fri, 7 Aug 2026 21:02:02 +0100 Subject: [PATCH] airoha: an7583: enable USB on Nokia XG-040G-MF 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 Link: https://github.com/openwrt/openwrt/pull/24609 Signed-off-by: Robert Marko --- .../dts/an7583-nokia_xg-040g-mf-common.dtsi | 111 ++++++++---------- target/linux/airoha/image/an7583.mk | 3 +- 2 files changed, 52 insertions(+), 62 deletions(-) diff --git a/target/linux/airoha/dts/an7583-nokia_xg-040g-mf-common.dtsi b/target/linux/airoha/dts/an7583-nokia_xg-040g-mf-common.dtsi index 317ee4b6210..03b1c05d921 100644 --- a/target/linux/airoha/dts/an7583-nokia_xg-040g-mf-common.dtsi +++ b/target/linux/airoha/dts/an7583-nokia_xg-040g-mf-common.dtsi @@ -46,12 +46,8 @@ 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 { @@ -65,45 +61,37 @@ 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 = <®_usb_5v>; - * }; + * Controls both USB ports at once */ + usb-power { + compatible = "regulator-output"; + vout-supply = <®_usb_5v>; + }; }; &an7583_pinctrl { @@ -285,24 +273,25 @@ 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 = <®_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 = <®_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>; + }; +}; diff --git a/target/linux/airoha/image/an7583.mk b/target/linux/airoha/image/an7583.mk index fe9dc092b31..d97debb6bc6 100644 --- a/target/linux/airoha/image/an7583.mk +++ b/target/linux/airoha/image/an7583.mk @@ -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 -- 2.47.3