From: Caleb James DeLisle Date: Fri, 7 Nov 2025 17:45:01 +0000 (+0000) Subject: econet: basic Ethernet support X-Git-Tag: v25.12.0-rc1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F20685%2Fhead;p=thirdparty%2Fopenwrt.git econet: basic Ethernet support This is about as simple as it gets, it's able to start up and put the onboard switch into dumb switch mode and then send untagged frames which become available on every switch port. It is out-of-tree to allow for rapid development and it is being proposed now because even in this state it brings a lot of value to the EcoNet platform and it is a fairly complex ethernet system so it will take some time before the driver is in a state that may be considered for upstreaming. Signed-off-by: Caleb James DeLisle Link: https://github.com/openwrt/openwrt/pull/20685 Signed-off-by: Hauke Mehrtens --- diff --git a/package/kernel/econet-eth/Makefile b/package/kernel/econet-eth/Makefile new file mode 100644 index 00000000000..1de42b52f3a --- /dev/null +++ b/package/kernel/econet-eth/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=econet-eth +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/cjdelisle/econet_eth.git +PKG_MIRROR_HASH:=764e18fe2f87cb0c742711c18ed995a2270b02f0072e7a0938906d0246287111 +PKG_SOURCE_DATE:=2025-11-07 +PKG_SOURCE_VERSION:=40aac736a46fec0d96beadd7513c53d1f0459737 + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/econet-eth + SUBMENU:=Network Devices + TITLE:=EcoNet EN751221 Ethernet Driver + DEPENDS:=@TARGET_econet + FILES:=$(PKG_BUILD_DIR)/econet-eth.ko + AUTOLOAD:=$(call AutoLoad,90,econet-eth) +endef + +define KernelPackage/econet-eth/description + Out-of-tree ethernet driver for EcoNet EN751221 devices. +endef + +define Build/Prepare + $(call Build/Prepare/Default) +endef + +define Build/Compile + $(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules +endef + +$(eval $(call KernelPackage,econet-eth)) diff --git a/target/linux/econet/dts/en751221.dtsi b/target/linux/econet/dts/en751221.dtsi index d512d0425ad..0a2448cd1ca 100644 --- a/target/linux/econet/dts/en751221.dtsi +++ b/target/linux/econet/dts/en751221.dtsi @@ -56,6 +56,93 @@ econet,shadow-interrupts = <7 2>, <8 3>, <13 12>, <30 29>; }; + ethernet: ethernet@1fb50000 { + compatible = "econet,en751221-eth"; + reg = <0x1fb50000 0x10000>; + + #address-cells = <1>; + #size-cells = <0>; + + interrupt-parent = <&intc>; + interrupts = <21>, <22>; + + gmac0: mac@0 { + compatible = "econet,eth-mac"; + reg = <0>; + phy-mode = "trgmii"; + status = "disabled"; + + fixed-link { + speed = <1000>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "econet,eth-mac"; + reg = <1>; + status = "disabled"; + phy-mode = "rgmii-rxid"; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch0: switch@1f { + compatible = "mediatek,mt7530"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1f>; + mediatek,mcm; + reset-names = "mcm"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + port@0 { + status = "disabled"; + reg = <0>; + label = "lan0"; + }; + + port@1 { + status = "disabled"; + reg = <1>; + label = "lan1"; + }; + + port@2 { + status = "disabled"; + reg = <2>; + label = "lan2"; + }; + + port@3 { + status = "disabled"; + reg = <3>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "trgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; + }; + }; + usb: usb@1fb90000 { compatible = "mediatek,mt8173-xhci", "mediatek,mtk-xhci"; reg = <0x1fb90000 0x4000>, diff --git a/target/linux/econet/dts/en751221_generic.dts b/target/linux/econet/dts/en751221_generic.dts index 375b9ebd3a5..026f3e37391 100644 --- a/target/linux/econet/dts/en751221_generic.dts +++ b/target/linux/econet/dts/en751221_generic.dts @@ -50,3 +50,7 @@ }; }; }; + +&gmac0 { + status = "okay"; +}; diff --git a/target/linux/econet/dts/en751221_nokia_g240g-e.dts b/target/linux/econet/dts/en751221_nokia_g240g-e.dts index bea569cdbc2..68c314dbd9a 100644 --- a/target/linux/econet/dts/en751221_nokia_g240g-e.dts +++ b/target/linux/econet/dts/en751221_nokia_g240g-e.dts @@ -123,3 +123,9 @@ }; }; }; + +&gmac0 { + status = "okay"; + nvmem-cells = <&macaddr_ri_3e 0>; + nvmem-cell-names = "mac-address"; +}; diff --git a/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts b/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts index 314c98fc5eb..4599d340535 100644 --- a/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts +++ b/target/linux/econet/dts/en751221_smartfiber_xp8421-b.dts @@ -104,3 +104,9 @@ }; }; }; + +&gmac0 { + status = "okay"; + nvmem-cells = <&macaddr_bootloader_ff48 0>; + nvmem-cell-names = "mac-address"; +}; diff --git a/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts b/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts index 56dec97c271..2bc44d11cd5 100644 --- a/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts +++ b/target/linux/econet/dts/en751221_tplink_archer-vr1200v-v2.dts @@ -96,3 +96,9 @@ }; }; }; + +&gmac0 { + status = "okay"; + nvmem-cells = <&macaddr_misc_8f100 0>; + nvmem-cell-names = "mac-address"; +};