From c43925313e7179aec7a93aa24a03532f0c1fbaea Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Sun, 14 Sep 2025 17:23:47 +0000 Subject: [PATCH] econet: Add basic USB support with Mass Storage 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 Link: https://github.com/openwrt/openwrt/pull/20050 [Remove usb storage kmod from smartfiber_xp8421-b] Signed-off-by: Hauke Mehrtens --- package/kernel/linux/modules/usb.mk | 1 + target/linux/econet/Makefile | 5 ++++- target/linux/econet/dts/en751221.dtsi | 14 +++++++++++++ target/linux/econet/en751221/config-6.12 | 4 ++++ target/linux/econet/image/en751221.mk | 1 + .../310-usb-enable-econet-usb.patch | 21 +++++++++++++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 target/linux/econet/patches-6.12/310-usb-enable-econet-usb.patch diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 8bf070a047..121e3aed51 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -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 \ diff --git a/target/linux/econet/Makefile b/target/linux/econet/Makefile index e2c15f0a85..28b8ab33ad 100644 --- a/target/linux/econet/Makefile +++ b/target/linux/econet/Makefile @@ -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)) diff --git a/target/linux/econet/dts/en751221.dtsi b/target/linux/econet/dts/en751221.dtsi index 4ef907c57a..d512d0425a 100644 --- a/target/linux/econet/dts/en751221.dtsi +++ b/target/linux/econet/dts/en751221.dtsi @@ -56,6 +56,20 @@ 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>; diff --git a/target/linux/econet/en751221/config-6.12 b/target/linux/econet/en751221/config-6.12 index 80bb91957d..653019f9c5 100644 --- a/target/linux/econet/en751221/config-6.12 +++ b/target/linux/econet/en751221/config-6.12 @@ -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 diff --git a/target/linux/econet/image/en751221.mk b/target/linux/econet/image/en751221.mk index 801af349e0..69d6cebd6c 100644 --- a/target/linux/econet/image/en751221.mk +++ b/target/linux/econet/image/en751221.mk @@ -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 index 0000000000..15deffaa0c --- /dev/null +++ b/target/linux/econet/patches-6.12/310-usb-enable-econet-usb.patch @@ -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. -- 2.30.2