]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
econet: Add basic USB support with Mass Storage 20050/head
authorCaleb James DeLisle <cjd@cjdns.fr>
Sun, 14 Sep 2025 17:23:47 +0000 (17:23 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 18 Sep 2025 20:36:28 +0000 (22:36 +0200)
The EN751221 has an XHCI that is compatible with MT7621.
While there is setup logic in the vendor code for both
EN751221 and MT7621, but MT7621 does not use it in mainline
or OpenWRT, and it appears to work correctly with EN751221.

Include SCSI / Mass Storage because many EcoNet devices
contain a builtin USB SD-Card reader.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
Link: https://github.com/openwrt/openwrt/pull/20050
[Remove usb storage kmod from smartfiber_xp8421-b]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/linux/modules/usb.mk
target/linux/econet/Makefile
target/linux/econet/dts/en751221.dtsi
target/linux/econet/en751221/config-6.12
target/linux/econet/image/en751221.mk
target/linux/econet/patches-6.12/310-usb-enable-econet-usb.patch [new file with mode: 0644]

index 8bf070a047175769beae5113e735373a8892eed4..121e3aed513d14f5ae9a563a3204f8943f686995 100644 (file)
@@ -1845,6 +1845,7 @@ define KernelPackage/usb3
        +TARGET_bcm53xx:kmod-usb-bcma \
        +TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \
        +TARGET_ramips_mt7621:kmod-usb-xhci-mtk \
+       +TARGET_econet_en751221:kmod-usb-xhci-mtk \
        +TARGET_mediatek:kmod-usb-xhci-mtk
   KCONFIG:= \
        CONFIG_USB_PCI=y \
index e2c15f0a85302e77dc792e84c6d2993de5f37abd..28b8ab33adb6d139ba1fa4110a05682a01c18828 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=mips
 BOARD:=econet
 BOARDNAME:=EcoNet EN75xx MIPS
-FEATURES:=dt source-only squashfs nand
+FEATURES:=dt source-only squashfs nand usb
 SUBTARGETS:=en751221
 
 KERNEL_PATCHVER:=6.12
@@ -19,4 +19,7 @@ endef
 # include the profiles
 include $(INCLUDE_DIR)/target.mk
 
+# nand-utils is used by base-files/sbin/en75_chboot
+DEFAULT_PACKAGES += nand-utils
+
 $(eval $(call BuildTarget))
index 4ef907c57a4e293275ac9ad1251fcc8c610c067e..d512d0425ad9e1821e75f5b08d4675335ee99fa9 100644 (file)
                econet,shadow-interrupts = <7 2>, <8 3>, <13 12>, <30 29>;
        };
 
+    usb: usb@1fb90000 {
+            compatible = "mediatek,mt8173-xhci", "mediatek,mtk-xhci";
+            reg = <0x1fb90000 0x4000>,
+                  <0x1fa80700 0x100>;
+            reg-names = "mac", "ippc";
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            interrupt-parent = <&intc>;
+            interrupts = <17>;
+            usb3-lpm-capable;
+    };
+
        uart: serial@1fbf0000 {
                compatible = "ns16550";
                reg = <0x1fbf0000 0x30>;
index 80bb91957d8708ce106af3588fedfcfd8bbcf8e0..653019f9c5f54abc9fa3b19db097e80662d38d8e 100644 (file)
@@ -39,6 +39,8 @@ CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_ZBOOT=y
+CONFIG_DMA_NEED_SYNC=y
+CONFIG_DMA_NONCOHERENT=y
 CONFIG_DTB_ECONET_NONE=y
 # CONFIG_DTB_ECONET_SMARTFIBER_XP8421_B is not set
 CONFIG_DTC=y
@@ -110,6 +112,7 @@ CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=13
 CONFIG_MTD_UBI_BLOCK=y
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_SRCU_NMI_SAFE=y
 CONFIG_NET_EGRESS=y
 CONFIG_NET_FLOW_LIMIT=y
@@ -168,6 +171,7 @@ CONFIG_TIMER_PROBE=y
 CONFIG_TREE_RCU=y
 CONFIG_TREE_SRCU=y
 CONFIG_UBIFS_FS=y
+CONFIG_USB_SUPPORT=y
 CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y
 CONFIG_USE_OF=y
 CONFIG_XPS=y
index 801af349e070bce928c4af1cdfc5bb5ab473a78a..69d6cebd6c8632f6cbe9ba7080dbc0fc0b6d8767 100644 (file)
@@ -4,6 +4,7 @@ define Device/smartfiber_xp8421-b
   DEVICE_DTS := en751221_smartfiber_xp8421-b
   IMAGES := tclinux.trx
   IMAGE/tclinux.trx := append-kernel | lzma | tclinux-trx
+  DEVICE_PACKAGES := kmod-usb3
 endef
 TARGET_DEVICES += smartfiber_xp8421-b
 
diff --git a/target/linux/econet/patches-6.12/310-usb-enable-econet-usb.patch b/target/linux/econet/patches-6.12/310-usb-enable-econet-usb.patch
new file mode 100644 (file)
index 0000000..15deffa
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -392,6 +392,7 @@ config ECONET
+       bool "EcoNet MIPS family"
+       select BOOT_RAW
+       select CPU_BIG_ENDIAN
++      select DMA_NONCOHERENT
+       select DEBUG_ZBOOT if DEBUG_KERNEL
+       select EARLY_PRINTK_8250
+       select ECONET_EN751221_TIMER
+--- a/drivers/usb/host/Kconfig
++++ b/drivers/usb/host/Kconfig
+@@ -71,7 +71,7 @@ config USB_XHCI_HISTB
+ config USB_XHCI_MTK
+       tristate "xHCI support for MediaTek SoCs"
+       select MFD_SYSCON
+-      depends on (MIPS && SOC_MT7621) || ARCH_MEDIATEK || COMPILE_TEST
++      depends on (MIPS && SOC_MT7621) || ECONET || ARCH_MEDIATEK || COMPILE_TEST
+       help
+         Say 'Y' to enable the support for the xHCI host controller
+         found in MediaTek SoCs.