Skip to contentSkip to conversation

net: Add MT7628 ethernet driver

PATCH In review Stefan Roese 2 participants 3 messages Oct 26, 2018 – Nov 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 net: Add MT7628 ethernet driver

This patch adds ethernet support for the MIPS based Mediatek MT76xx SoCs (e.g. MT7628 and MT7688), including a minimum setup of the integrated switch. This driver is loosly based on the driver version included in this MediaTek github repository:

https://github.com/MediaTek-Labs/linkit-smart-uboot.git

Tested on the MT7688 LinkIt smart-gateway and on the Gardena-smart-gateway.

Cc Joe Hershberger <[email protected]>
Cc Frank Wunderlich <[email protected]>
Cc Weijie Gao <[email protected]>

---
v6:
- Simplified MAC address assignment
- Added free_pkt functions as suggested by Joe

v5:
- Rename driver and Kconfig and functions names again to avoid mix-up with the MT76xx ARM SoCs

v4:
- Rename driver and Kconfig to avoid mix-up with the MT76xx ARM SoCs

v3:
- Add Reviewed-by from Daniel
- Address review comments from Joe:
- Use more macros / defines instead of magic values, especially in the MDIO functions
- Use FIELD_xxx from include/linux/bitfield.h whereever possible
- Remove some unreferenced defines
- Remove some unnecessary casts
- Spelling fixes
- Add documentation in doc/device-tree-bindings/net/

v2:
- Use wait_for_bit_le32() in more places
- Use syscon / regmap to access the system-controller registers needed in this driver instead of finding and mapping this area

 .../net/mediatek,mt7628-eth.txt               |  17 +
 drivers/net/Kconfig                           |   7 +
 drivers/net/Makefile                          |   1 +
 drivers/net/mt7628-eth.c                      | 644 ++++++++++++++++++
 4 files changed, 669 insertions(+)
 create mode 100644 doc/device-tree-bindings/net/mediatek,mt7628-eth.txt
 create mode 100644 drivers/net/mt7628-eth.c
doc/device-tree-bindings/net/mediatek,mt7628-eth.txt new file +17 -0
new file mode 100644
index 0000000000..ec97504a3f
@@ -0,0 +1,17 @@
+* MediaTek Frame Engine Ethernet controller
+
+Required properties:
+- compatible: should be "mediatek,mt7628-eth"
+- reg: address and length of the register set for the frame
+       engine ethernet controller and the internal switch.
+- syscon: phandle to the system controller
+
+Example:
+
+eth at 10100000 {
+	compatible = "mediatek,mt7628-eth";
+	reg = <0x10100000 0x10000
+	       0x10110000 0x8000>;
+
+	syscon = <&sysc>;
+};
drivers/net/Kconfig +7 -0
index f1f0e2d94e..fba9d7c31c 100644
@@ -227,6 +227,13 @@ config MACB_ZYNQ
 	  The Cadence MACB ethernet interface was used on Zynq platform.
 	  Say Y to enable support for the MACB/GEM in Zynq chip.
 
+config MT7628_ETH
+	bool "MediaTek MT7628 Ethernet Interface"
+	depends on ARCH_MT7620
+	help
+	  The MediaTek MT7628 ethernet interface is used on MT7628 and
+	  MT7688 based boards.
+
 config PCH_GBE
 	bool "Intel Platform Controller Hub EG20T GMAC driver"
 	depends on DM_ETH && DM_PCI
drivers/net/Makefile +1 -0
index 48a2878071..cc0971c614 100644
@@ -37,6 +37,7 @@ obj-$(CONFIG_LPC32XX_ETH) += lpc32xx_eth.o
 obj-$(CONFIG_MACB) += macb.o
 obj-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o
 obj-$(CONFIG_MPC8XX_FEC) += mpc8xx_fec.o
+obj-$(CONFIG_MT7628_ETH) += mt7628-eth.o
 obj-$(CONFIG_MVGBE) += mvgbe.o
 obj-$(CONFIG_MVNETA) += mvneta.o
 obj-$(CONFIG_MVPP2) += mvpp2.o
drivers/net/mt7628-eth.c new file +644 -0

644 lines not on this page · raw message

Signature · 1 line
2.19.1
#1 lore raw

PATCH v6 1/1 net: Add MT7628 ethernet driver

Quoted 8 lines · Stefan Roese

This patch adds ethernet support for the MIPS based Mediatek MT76xx SoCs (e.g. MT7628 and MT7688), including a minimum setup of the integrated switch. This driver is loosly based on the driver version included in this MediaTek github repository:

https://github.com/MediaTek-Labs/linkit-smart-uboot.git

Quoted 8 lines

Tested on the MT7688 LinkIt smart-gateway and on the Gardena-smart-gateway.

Cc Joe Hershberger <[email protected]>
Cc Frank Wunderlich <[email protected]>
Cc Weijie Gao <[email protected]>