Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1351398 > unrolled thread

[PATCH V4 0/4] net-next: mediatek: add ethernet driver

Started byJohn Crispin <blogic@openwrt.org>
First post2016-03-07 10:00 +0100
Last post2016-03-07 17:40 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V4 0/4] net-next: mediatek: add ethernet driver John Crispin <blogic@openwrt.org> - 2016-03-07 10:00 +0100
    [PATCH V4 3/4] net-next: mediatek: add Kconfig and Makefile John Crispin <blogic@openwrt.org> - 2016-03-07 10:00 +0100
    [PATCH V4 1/4] net-next: mediatek: document MediaTek SoC ethernet binding John Crispin <blogic@openwrt.org> - 2016-03-07 10:00 +0100
    Re: [PATCH V4 2/4] net-next: mediatek: add support for MT7623  ethernet David Miller <davem@davemloft.net> - 2016-03-07 17:40 +0100

#1351398 — [PATCH V4 0/4] net-next: mediatek: add ethernet driver

FromJohn Crispin <blogic@openwrt.org>
Date2016-03-07 10:00 +0100
Subject[PATCH V4 0/4] net-next: mediatek: add ethernet driver
Message-ID<r9Zbc-yj-3@gated-at.bofh.it>
This series adds support for the Mediatek ethernet core found on current ARM
based SoCs. The driver works on MT2701 and MT7623 SoCs

Instead of trying to upstream everything at once I decided to concentrate on
the important parts required to make current generation silicon work. The V3
series only includes the code required to make dual MAC setups work and only
supports the newer QDMA engine.

Changes in V4
* remove ugly _FE macro, use offsetof() instead

Changes in V3
* only include code for MT2701/7623 support
* drop support for PDMA and older MIPS based SoCs
* drop switch support

Changes in V2
* change the namespace of the functions from fe_* to mtk_*
* add support for the latest generation of ARM SoCs
* add dual MAC support
* remove the swconfig specific bits
* remove most of the magic values and replace them with defines
* add verbose descriptions to the patches

John Crispin (4):
  net-next: mediatek: document MediaTek SoC ethernet binding
  net-next: mediatek: add support for MT7623 ethernet
  net-next: mediatek: add Kconfig and Makefile
  net-next: mediatek: add an entry to MAINTAINERS

 .../devicetree/bindings/net/mediatek-net.txt       |   77 +
 MAINTAINERS                                        |    7 +
 drivers/net/ethernet/Kconfig                       |    1 +
 drivers/net/ethernet/Makefile                      |    1 +
 drivers/net/ethernet/mediatek/Kconfig              |   17 +
 drivers/net/ethernet/mediatek/Makefile             |    5 +
 drivers/net/ethernet/mediatek/mtk_eth_soc.c        | 1806 ++++++++++++++++++++
 drivers/net/ethernet/mediatek/mtk_eth_soc.h        |  421 +++++
 8 files changed, 2335 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mediatek-net.txt
 create mode 100644 drivers/net/ethernet/mediatek/Kconfig
 create mode 100644 drivers/net/ethernet/mediatek/Makefile
 create mode 100644 drivers/net/ethernet/mediatek/mtk_eth_soc.c
 create mode 100644 drivers/net/ethernet/mediatek/mtk_eth_soc.h

-- 
1.7.10.4

[toc] | [next] | [standalone]


#1351405 — [PATCH V4 3/4] net-next: mediatek: add Kconfig and Makefile

FromJohn Crispin <blogic@openwrt.org>
Date2016-03-07 10:00 +0100
Subject[PATCH V4 3/4] net-next: mediatek: add Kconfig and Makefile
Message-ID<r9Zbe-yj-31@gated-at.bofh.it>
In reply to#1351398
This patch adds the Makefile and Kconfig required to make the driver build.

Signed-off-by: John Crispin <blogic@openwrt.org>
---
 drivers/net/ethernet/Kconfig           |    1 +
 drivers/net/ethernet/Makefile          |    1 +
 drivers/net/ethernet/mediatek/Kconfig  |   17 +++++++++++++++++
 drivers/net/ethernet/mediatek/Makefile |    5 +++++
 4 files changed, 24 insertions(+)
 create mode 100644 drivers/net/ethernet/mediatek/Kconfig
 create mode 100644 drivers/net/ethernet/mediatek/Makefile

diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index 0b13af8..be67a19 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -106,6 +106,7 @@ config LANTIQ_ETOP
 	  Support for the MII0 inside the Lantiq SoC
 
 source "drivers/net/ethernet/marvell/Kconfig"
+source "drivers/net/ethernet/mediatek/Kconfig"
 source "drivers/net/ethernet/mellanox/Kconfig"
 source "drivers/net/ethernet/micrel/Kconfig"
 source "drivers/net/ethernet/microchip/Kconfig"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 38dc1a7..6ffcc80 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_JME) += jme.o
 obj-$(CONFIG_KORINA) += korina.o
 obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o
 obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/
+obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/
 obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/
 obj-$(CONFIG_NET_VENDOR_MICREL) += micrel/
 obj-$(CONFIG_NET_VENDOR_MICROCHIP) += microchip/
diff --git a/drivers/net/ethernet/mediatek/Kconfig b/drivers/net/ethernet/mediatek/Kconfig
new file mode 100644
index 0000000..b0229f4
--- /dev/null
+++ b/drivers/net/ethernet/mediatek/Kconfig
@@ -0,0 +1,17 @@
+config NET_VENDOR_MEDIATEK
+	bool "MediaTek ethernet driver"
+	depends on ARCH_MEDIATEK
+	---help---
+	  If you have a Mediatek SoC with ethernet, say Y.
+
+if NET_VENDOR_MEDIATEK
+
+config NET_MEDIATEK_SOC
+	tristate "MediaTek MT7623 Gigabit ethernet support"
+	depends on NET_VENDOR_MEDIATEK #&& (MACH_MT7623 || MACH_MT2701)
+	select PHYLIB
+	---help---
+	  This driver supports the gigabit ethernet MACs in the
+	  MediaTek MT2701/MT7623 chipset family.
+
+endif #NET_VENDOR_MEDIATEK
diff --git a/drivers/net/ethernet/mediatek/Makefile b/drivers/net/ethernet/mediatek/Makefile
new file mode 100644
index 0000000..aa3f1c8
--- /dev/null
+++ b/drivers/net/ethernet/mediatek/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the Mediatek SoCs built-in ethernet macs
+#
+
+obj-$(CONFIG_NET_MEDIATEK_SOC)			+= mtk_eth_soc.o
-- 
1.7.10.4

[toc] | [prev] | [next] | [standalone]


#1351409 — [PATCH V4 1/4] net-next: mediatek: document MediaTek SoC ethernet binding

FromJohn Crispin <blogic@openwrt.org>
Date2016-03-07 10:00 +0100
Subject[PATCH V4 1/4] net-next: mediatek: document MediaTek SoC ethernet binding
Message-ID<r9Zbe-yj-37@gated-at.bofh.it>
In reply to#1351398
This adds the binding documentation for the MediaTek Ethernet
controller.

Signed-off-by: John Crispin <blogic@openwrt.org>
Acked-by: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
---
 .../devicetree/bindings/net/mediatek-net.txt       |   77 ++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mediatek-net.txt

diff --git a/Documentation/devicetree/bindings/net/mediatek-net.txt b/Documentation/devicetree/bindings/net/mediatek-net.txt
new file mode 100644
index 0000000..5ca7929
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mediatek-net.txt
@@ -0,0 +1,77 @@
+MediaTek Frame Engine Ethernet controller
+=========================================
+
+The frame engine ethernet controller can be found on MediaTek SoCs. These SoCs
+have dual GMAC each represented by a child node..
+
+* Ethernet controller node
+
+Required properties:
+- compatible: Should be "mediatek,mt7623-eth"
+- reg: Address and length of the register set for the device
+- interrupts: Should contain the frame engines interrupt
+- clocks: the clock used by the core
+- clock-names: the names of the clock listed in the clocks property. These are
+	"ethif", "esw", "gp2", "gp1"
+- power-domains: phandle to the power domain that the ethernet is part of
+- resets: Should contain a phandle to the ethsys reset signal
+- reset-names: Should contain the reset signal name "eth"
+- mediatek,ethsys: phandle to the syscon node that handles the port setup
+- mediatek,pctl: phandle to the syscon node that handles the ports slew rate
+	and driver current
+
+Optional properties:
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+
+
+* Ethernet MAC node
+
+Required properties:
+- compatible: Should be "mediatek,eth-mac"
+- reg: The number of the MAC
+- phy-handle: see ethernet.txt file in the same directory.
+
+Example:
+
+eth: ethernet@1b100000 {
+	compatible = "mediatek,mt7623-eth";
+	reg = <0 0x1b100000 0 0x20000>;
+	clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
+		 <&ethsys CLK_ETHSYS_ESW>,
+		 <&ethsys CLK_ETHSYS_GP2>,
+		 <&ethsys CLK_ETHSYS_GP1>;
+	clock-names = "ethif", "esw", "gp2", "gp1";
+	interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_LOW>;
+	power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;
+	resets = <&ethsys MT2701_ETHSYS_ETH_RST>;
+	reset-names = "eth";
+	mediatek,ethsys = <&ethsys>;
+	mediatek,pctl = <&syscfg_pctl_a>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	gmac1: mac@0 {
+		compatible = "mediatek,eth-mac";
+		reg = <0>;
+		phy-handle = <&phy0>;
+	};
+
+	gmac2: mac@1 {
+		compatible = "mediatek,eth-mac";
+		reg = <1>;
+		phy-handle = <&phy1>;
+	};
+
+	mdio-bus {
+		phy0: ethernet-phy@0 {
+			reg = <0>;
+			phy-mode = "rgmii";
+		};
+
+		phy1: ethernet-phy@1 {
+			reg = <1>;
+			phy-mode = "rgmii";
+		};
+	};
+};
-- 
1.7.10.4

[toc] | [prev] | [next] | [standalone]


#1351780 — Re: [PATCH V4 2/4] net-next: mediatek: add support for MT7623 ethernet

FromDavid Miller <davem@davemloft.net>
Date2016-03-07 17:40 +0100
SubjectRe: [PATCH V4 2/4] net-next: mediatek: add support for MT7623 ethernet
Message-ID<ra6mm-5hg-15@gated-at.bofh.it>
In reply to#1351398
From: John Crispin <blogic@openwrt.org>
Date: Mon,  7 Mar 2016 09:56:35 +0100

> +static int mtk_mdio_busy_wait(struct mtk_eth *eth)
> +{
> +	unsigned long t_start = jiffies;
> +
> +	while (1) {
> +		if (!(mtk_r32(eth, MTK_PHY_IAC) & PHY_IAC_ACCESS))
> +			return 0;
> +		if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
> +			break;
> +	}
> +
> +	dev_err(eth->dev, "mdio: MDIO timeout\n");
> +	return -1;
> +}

Busy polling in a loop for up to 5 seconds with no preemption points
is not something you can do, sorry.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web