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 <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>
This commit is contained in:
Caleb James DeLisle 2025-09-14 17:23:47 +00:00 committed by Hauke Mehrtens
parent 8dd3ee205a
commit c43925313e
6 changed files with 45 additions and 1 deletions

View 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 \

View 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))

View file

@ -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>;

View 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

View 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

View file

@ -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.