Skip to contentSkip to conversation

net: Add MT76xx ethernet driver

PATCH Superseded Stefan Roese 1 participant 1 message Oct 23, 2018

Subsystems (2)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: Add MT76xx ethernet driver

This patch adds ethernet support for the Mediatek MT76xx SoC, 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.

---
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,mt76xx-eth.txt               |  17 +
 drivers/net/Kconfig                           |   7 +
 drivers/net/Makefile                          |   1 +
 drivers/net/mt76xx-eth.c                      | 635 ++++++++++++++++++
 4 files changed, 660 insertions(+)
 create mode 100644 doc/device-tree-bindings/net/mediatek,mt76xx-eth.txt
 create mode 100644 drivers/net/mt76xx-eth.c
doc/device-tree-bindings/net/mediatek,mt76xx-eth.txt new file +17 -0
new file mode 100644
index 0000000000..db035c99d4
@@ -0,0 +1,17 @@
+* MediaTek Frame Engine Ethernet controller
+
+Required properties:
+- compatible: should be "mediatek,mt7622-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,mt7622-eth";
+	reg = <0x10100000 0x10000
+	       0x10110000 0x8000>;
+
+	syscon = <&sysc>;
+};
drivers/net/Kconfig +7 -0
index f1f0e2d94e..d3ed1c2857 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 MT76XX_ETH
+	bool "MediaTek MT76xx Ethernet Interface"
+	depends on ARCH_MT7620
+	help
+	  The MediaTek MT76xx ethernet interface is used on 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..05189514b7 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_MT76XX_ETH) += mt76xx-eth.o
 obj-$(CONFIG_MVGBE) += mvgbe.o
 obj-$(CONFIG_MVNETA) += mvneta.o
 obj-$(CONFIG_MVPP2) += mvpp2.o
drivers/net/mt76xx-eth.c new file +635 -0

635 lines not on this page · raw message

Signature · 1 line
2.19.1