Skip to contentSkip to conversation

net: stmmac: Add SOCFPGA glue driver

PATCH In review [email protected] 4 participants 6 messages Feb 10, 2014 – Feb 26, 2014 1 message not in the archive

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

PATCH v3 1/2 net: stmmac: Add SOCFPGA glue driver

From: Dinh Nguyen <[email protected]>

Like the STi series SOCs, Altera's SOCFPGA also needs a glue layer on top of the Synopsys gmac IP.

This patch adds the platform driver for the glue layer which configures the IP before the generic STMMAC driver takes over.

Cc Giuseppe Cavallaro <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Vince Bridgers <[email protected]>

---
v3: Remove stray empty line at end of dwmac-socfpga.c.
v2: Use the dwmac-sti as an example for a glue layer and split patch up to have dts as a separate patch. Also cc dts maintainers since there is a new binding.

---
 drivers/net/ethernet/stmicro/stmmac/Makefile       |    1 +
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    |  183 ++++++++++++++++++++
 2 files changed, 184 insertions(+)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index ecadece..73df8b6 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_STMMAC_ETH) += stmmac.o
+stmmac-$(CONFIG_ARCH_SOCFPGA) += dwmac-socfpga.o
 stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
 stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
 stmmac-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c new file +183 -0

183 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 2/2 dts: socfpga: Add DTS entry for adding the stmmac glue layer for stmmac.

From: Dinh Nguyen <[email protected]>

This patch adds the dts bindings documenation for the Altera SOCFPGA glue layer for the Synopsys STMMAC ethernet driver.

Cc Giuseppe Cavallaro <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Vince Bridgers <[email protected]>

---
v3: Remove stray empty line at end of socfpga_cyclone5_socdk.dts
v2: Use the dwmac-sti as an example for a glue layer and split patch up to have dts as a separate patch. Also cc dts maintainers since there is a new binding.

---
 .../devicetree/bindings/net/socfpga-dwmac.txt      |   35 ++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   51 +++++++++++++-------
 arch/arm/boot/dts/socfpga_arria5_socdk.dts         |   24 +++++++++
 arch/arm/boot/dts/socfpga_cyclone5.dtsi            |    6 ---
 arch/arm/boot/dts/socfpga_cyclone5_socdk.dts       |   17 +++++++
 arch/arm/boot/dts/socfpga_cyclone5_sockit.dts      |   22 ++++++++-
 arch/arm/boot/dts/socfpga_vt.dts                   |   13 +++--
 7 files changed, 139 insertions(+), 29 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/socfpga-dwmac.txt
Documentation/devicetree/bindings/net/socfpga-dwmac.txt new file +35 -0
new file mode 100644
index 0000000..d53d376
@@ -0,0 +1,35 @@
+Altera SOCFPGA SoC DWMAC controller
+
+The device node has following properties.
+
+Required properties:
+ - compatible	: Should contain "altr,socfpga-stmmac"
+ - altr,sysmgr-syscon : Should be the phandle to the system manager node that
+   encompasses the glue register, and the register offset.
+
+Sub-nodes:
+The dwmac core should be added as subnode to SOCFPGA dwmac glue.
+- dwmac :	The binding details of dwmac can be found in
+  Documentation/devicetree/bindings/net/stmmac.txt
+
+Example:
+
+ethernet0: ethernet0 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	compatible = "altr,socfpga-stmmac";
+	altr,sysmgr-syscon = <&sysmgr 0x60>;
+	status = "disabled";
+	ranges;
+
+	gmac0: gmac0@ff700000 {
+		compatible = "snps,dwmac-3.70a", "snps,dwmac";
+		reg = <0xff700000 0x2000>;
+		interrupts = <0 115 4>;
+		interrupt-names = "macirq";
+		mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
+		clocks = <&emac0_clk>;
+		clock-names = "stmmaceth";
+	};
+};
arch/arm/boot/dts/socfpga.dtsi +34 -17

67 lines not on this page · raw message

arch/arm/boot/dts/socfpga_arria5_socdk.dts +24 -0
index 5beffb2..2d6b38b 100644
@@ -37,4 +37,28 @@
 		*/
 		ethernet0 = &gmac1;
 	};
+
+	aliases {
+		/* this allow the ethaddr uboot environmnet variable contents
+		 * to be added to the gmac1 device tree blob.
+		 */
+		ethernet0 = &gmac1;
+	};
+};
+
+&ethernet1 {
+	status = "okay";
+};
+
+&gmac1 {
+	phy-mode = "rgmii";
+
+	rxd0-skew-ps = <0>;
+	rxd1-skew-ps = <0>;
+	rxd2-skew-ps = <0>;
+	rxd3-skew-ps = <0>;
+	txen-skew-ps = <0>;
+	txc-skew-ps = <2600>;
+	rxdv-skew-ps = <0>;
+	rxc-skew-ps = <2000>;
 };
arch/arm/boot/dts/socfpga_cyclone5.dtsi +0 -6
index ca41b0e..454148d 100644
@@ -39,12 +39,6 @@
 			};
 		};
 
-		ethernet@ff702000 {
-			phy-mode = "rgmii";
-			phy-addr = <0xffffffff>; /* probe for phy addr */
-			status = "okay";
-		};
-
 		timer0@ffc08000 {
 			clock-frequency = <100000000>;
 		};
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +17 -0
index 2ee52ab..26c63a0 100644
@@ -38,3 +38,20 @@
 		ethernet0 = &gmac1;
 	};
 };
+
+&ethernet1 {
+	status = "okay";
+};
+
+&gmac1 {
+	phy-mode = "rgmii";
+
+	rxd0-skew-ps = <0>;
+	rxd1-skew-ps = <0>;
+	rxd2-skew-ps = <0>;
+	rxd3-skew-ps = <0>;
+	txen-skew-ps = <0>;
+	txc-skew-ps = <2600>;
+	rxdv-skew-ps = <0>;
+	rxc-skew-ps = <2000>;
+};
arch/arm/boot/dts/socfpga_cyclone5_sockit.dts +21 -1
index 50b99a2..469bb5c 100644
@@ -30,8 +30,28 @@
 		device_type = "memory";
 		reg = <0x0 0x40000000>; /* 1GB */
 	};
+
+	aliases {
+		/* this allow the ethaddr uboot environmnet variable contents
+		 * to be added to the gmac1 device tree blob.
+		 */
+		ethernet0 = &gmac1;
+	};
 };
 
-&gmac1 {
+&ethernet1 {
 	status = "okay";
 };
+
+&gmac1 {
+	phy-mode = "rgmii";
+
+	rxd0-skew-ps = <0>;
+	rxd1-skew-ps = <0>;
+	rxd2-skew-ps = <0>;
+	rxd3-skew-ps = <0>;
+	txen-skew-ps = <0>;
+	txc-skew-ps = <2600>;
+	rxdv-skew-ps = <0>;
+	rxc-skew-ps = <2000>;
+};
arch/arm/boot/dts/socfpga_vt.dts +8 -5
index 222313f..418472c 100644
@@ -52,11 +52,6 @@
 			};
 		};
 
-		ethernet@ff700000 {
-			phy-mode = "gmii";
-			status = "okay";
-		};
-
 		timer0@ffc08000 {
 			clock-frequency = <7000000>;
 		};
@@ -86,3 +81,11 @@
 		};
 	};
 };
+
+&ethernet0 {
+        status = "okay";
+};
+
+&gmac0 {
+	phy-mode = "gmii";
+};
Signature · 1 line
1.7.9.5
maintainer Acked-by on v3 1/2
#2 lore raw
In reply to [email protected]

From: <[email protected]>
Date: Mon, 10 Feb 2014 13:48:16 -0600

Quoted 16 lines

From: Dinh Nguyen <[email protected]>

Like the STi series SOCs, Altera's SOCFPGA also needs a glue layer on top of the Synopsys gmac IP.

This patch adds the platform driver for the glue layer which configures the IP before the generic STMMAC driver takes over.

Cc Giuseppe Cavallaro <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Vince Bridgers <[email protected]>
Quoted 5 lines

---
v3: Remove stray empty line at end of dwmac-socfpga.c.
v2: Use the dwmac-sti as an example for a glue layer and split patch up to have dts as a separate patch. Also cc dts maintainers since there is a new binding.

The second patch for the DTS update doesn't apply cleanly at all to mainline.

Why don't you push both of these patches through whatever tree that file is maintained under. You can add my ack:

A message that is not in the archive (sent off-list or not yet received): 20140212.193539.38124529344029793.davem-fT/PcQaiUtIeIZ0/[email protected]

#4 lore raw
Quoted 24 lines · David Miller

From: <[email protected]>
Date: Mon, 10 Feb 2014 13:48:16 -0600

Quoted 16 lines

From: Dinh Nguyen <[email protected]>

Like the STi series SOCs, Altera's SOCFPGA also needs a glue layer on top of the Synopsys gmac IP.

This patch adds the platform driver for the glue layer which configures the IP before the generic STMMAC driver takes over.

Cc Giuseppe Cavallaro <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Vince Bridgers <[email protected]>
Quoted 5 lines

---
v3: Remove stray empty line at end of dwmac-socfpga.c.
v2: Use the dwmac-sti as an example for a glue layer and split patch up to have dts as a separate patch. Also cc dts maintainers since there is a new binding.

Quoted 2 lines

The second patch for the DTS update doesn't apply cleanly at all to mainline.

Yes, I'm planning to take the DTS bindings patch through arm-soc/next-dt tree, so that is where patch 2 is based on.

Quoted 3 lines

Why don't you push both of these patches through whatever tree that file is maintained under. You can add my ack:

I'm not sure if Peppe has a tree, but it should go into his tree if there is one. If not, can you apply patch 1 to your tree?

Quoted 2 lines

Thanks,
Dinh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#5 lore raw

From: Dinh Nguyen <[email protected]>
Date: Wed, 12 Feb 2014 22:33:14 -0600

Quoted 9 lines · David Miller
Quoted 4 lines

From: <[email protected]>
Date: Mon, 10 Feb 2014 13:48:16 -0600
Why don't you push both of these patches through whatever tree that file is maintained under. You can add my ack:

I'm not sure if Peppe has a tree, but it should go into his tree if there is one. If not, can you apply patch 1 to your tree?

Quoted 2 lines

You're going to have to send patch #2 somewhere, so for the second time I'm going to ask you to please send #1 to the same place.

Thanks.

#6 lore raw
In reply to Dinh Nguyen
Quoted 28 lines · Dinh Nguyen
Quoted 24 lines · David Miller

From: <[email protected]>
Date: Mon, 10 Feb 2014 13:48:16 -0600

Quoted 16 lines

From: Dinh Nguyen <[email protected]>

Like the STi series SOCs, Altera's SOCFPGA also needs a glue layer on top of the Synopsys gmac IP.

This patch adds the platform driver for the glue layer which configures the IP before the generic STMMAC driver takes over.

Cc Giuseppe Cavallaro <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Vince Bridgers <[email protected]>
Quoted 5 lines

---
v3: Remove stray empty line at end of dwmac-socfpga.c.
v2: Use the dwmac-sti as an example for a glue layer and split patch up to have dts as a separate patch. Also cc dts maintainers since there is a new binding.

Quoted 2 lines

The second patch for the DTS update doesn't apply cleanly at all to mainline.

Quoted 7 lines

Yes, I'm planning to take the DTS bindings patch through arm-soc/next-dt tree, so that is where patch 2 is based on.

Quoted 3 lines

Why don't you push both of these patches through whatever tree that file is maintained under. You can add my ack:

I'm not sure if Peppe has a tree, but it should go into his tree if there is one. If not, can you apply patch 1 to your tree?

Hello

I have not own tree but I am using net.git and net-next to do my patches and experiments.

I ask you to keep these patches aligned to net-next.

Also I ask you to review the glue-layer that is not in-line with what have been currently added for dwmac-sti and dwmac-sunxi.c.

BR
Peppe

Quoted 5 lines
Quoted 2 lines

Thanks,
Dinh