Skip to contentSkip to conversation

Add Ethernet support on STM32F429

PATCH RESEND In review Alexandre TORGUE 5 participants 14 messages May 9, 2016 – Jun 30, 2016

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

v6 cover Add Ethernet support on STM32F429

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

Changes since v5:
-Fix typo in bindings documentation patch.
-Change clocks names in stm32-dwmac glue driver / Documentation. -After rebase, stm32 ethernet node is now available. It has to be updated
according to new clocks names.

Changes since v4:
-Fix dirty copy/past in bindings documentation patch.

Changes since v3:
-Fix "tx-clk" and "rx-clk" as required clocks. Driver and bindings are
modified.

Changes since v2:
-Fix alphabetic order in Kconfig and Makefile.
-Improve code according to Joachim review.
-Binding: remove useless entry.

Changes since v1:
-Fix Kbuild issue in Kconfig.
-Remove init/exit callbacks. Suspend/Resume and remove driver is no more
driven in stmmac_pltfr but directly in dwmac-stm32 glue driver.
-Take into account Joachim review.

Regards.

Alexandre.

Alexandre TORGUE (6):
net: ethernet: dwmac: add Ethernet glue logic for stm32 chip
Documentation: Bindings: Add STM32 DWMAC glue
net: ethernet: stmmac: add support of Synopsys 3.50a MAC IP
ARM: STM32: Enable Ethernet in stm32_defconfig
ARM: dts: stm32f429: Align Ethernet node with new bindings properties
ARM: dts: stm32f429: Update Ethernet node on Eval board

 .../devicetree/bindings/net/stm32-dwmac.txt        |  32 ++++
 arch/arm/boot/dts/stm32429i-eval.dts               |   4 +-
 arch/arm/boot/dts/stm32f429.dtsi                   |   6 +-
 arch/arm/configs/stm32_defconfig                   |   9 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig        |  12 ++
 drivers/net/ethernet/stmicro/stmmac/Makefile       |   1 +
 drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c  | 193 +++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   1 +
 8 files changed, 253 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/stm32-dwmac.txt
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH RESEND v6 1/6 net: ethernet: dwmac: add Ethernet glue logic for stm32 chip

stm324xx family chips support Synopsys MAC 3.510 IP. This patch adds settings for logical glue logic:
-clocks
-mode selection MII or RMII.

drivers/net/ethernet/stmicro/stmmac/Kconfig +12 -0
index cec147d..235d679 100644
@@ -104,6 +104,18 @@ config DWMAC_STI
 	  device driver. This driver is used on for the STi series
 	  SOCs GMAC ethernet controller.
 
+config DWMAC_STM32
+	tristate "STM32 DWMAC support"
+	default ARCH_STM32
+	depends on OF && HAS_IOMEM
+	select MFD_SYSCON
+	---help---
+	  Support for ethernet controller on STM32 SOCs.
+
+	  This selects STM32 SoC glue layer support for the stmmac
+	  device driver. This driver is used on for the STM32 series
+	  SOCs GMAC ethernet controller.
+
 config DWMAC_SUNXI
 	tristate "Allwinner GMAC support"
 	default ARCH_SUNXI
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
index 0fb362d..8828ada 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_DWMAC_MESON)	+= dwmac-meson.o
 obj-$(CONFIG_DWMAC_ROCKCHIP)	+= dwmac-rk.o
 obj-$(CONFIG_DWMAC_SOCFPGA)	+= dwmac-socfpga.o
 obj-$(CONFIG_DWMAC_STI)		+= dwmac-sti.o
+obj-$(CONFIG_DWMAC_STM32)	+= dwmac-stm32.o
 obj-$(CONFIG_DWMAC_SUNXI)	+= dwmac-sunxi.o
 obj-$(CONFIG_DWMAC_GENERIC)	+= dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c new file +193 -0

193 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH RESEND v6 2/6 Documentation: Bindings: Add STM32 DWMAC glue

In reply to Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +32 -0
new file mode 100644
index 0000000..c35afb7
@@ -0,0 +1,32 @@
+STMicroelectronics STM32 / MCU DWMAC glue layer controller
+
+This file documents platform glue layer for stmmac.
+Please see stmmac.txt for the other unchanged properties.
+
+The device node has following properties.
+
+Required properties:
+- compatible:  Should be "st,stm32-dwmac" to select glue, and
+	       "snps,dwmac-3.50a" to select IP version.
+- clocks: Must contain a phandle for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.
+	       Should be "mac-clk-tx" for the MAC TX clock.
+	       Should be "mac-clk-rx" for the MAC RX clock.
+- st,syscon : Should be phandle/offset pair. The phandle to the syscon node which
+	      encompases the glue register, and the offset of the control register.
+Example:
+
+	ethernet at 40028000 {
+		compatible = "st,stm32-dwmac", "snps,dwmac-3.50a";
+		status = "disabled";
+		reg = <0x40028000 0x8000>;
+		reg-names = "stmmaceth";
+		interrupts = <0 61 0>, <0 62 0>;
+		interrupt-names = "macirq", "eth_wake_irq";
+		clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
+		clocks = <&rcc 0 25>, <&rcc 0 26>, <&rcc 0 27>;
+		st,syscon = <&syscfg 0x4>;
+		snps,pbl = <8>;
+		snps,mixed-burst;
+		dma-ranges;
+	};
Signature · 1 line
1.9.1
#3 lore raw

PATCH RESEND v6 3/6 net: ethernet: stmmac: add support of Synopsys 3.50a MAC IP

In reply to Alexandre TORGUE

Adds support of Synopsys 3.50a MAC IP in stmmac driver.

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -0
index 409db91..7718247 100644
@@ -262,6 +262,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 	 * once needed on other platforms.
 	 */
 	if (of_device_is_compatible(np, "st,spear600-gmac") ||
+		of_device_is_compatible(np, "snps,dwmac-3.50a") ||
 		of_device_is_compatible(np, "snps,dwmac-3.70a") ||
 		of_device_is_compatible(np, "snps,dwmac")) {
 		/* Note that the max-frame-size parameter as defined in the
Signature · 1 line
1.9.1
#4 lore raw

PATCH RESEND v6 4/6 ARM: STM32: Enable Ethernet in stm32_defconfig

In reply to Alexandre TORGUE

Enable basic Ethernet support (IPV4) for stm32 defconfig.

arch/arm/configs/stm32_defconfig +9 -0
index 1e5ec2a..719218b 100644
@@ -33,11 +33,20 @@ CONFIG_XIP_PHYS_ADDR=0x08008000
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_SHARED_FLAT=y
 # CONFIG_COREDUMP is not set
+CONFIG_NET=y
+CONFIG_INET=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_IPV6 is not set
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_BLK_DEV is not set
 CONFIG_EEPROM_93CX6=y
+CONFIG_NETDEVICES=y
+CONFIG_STMMAC_ETH=y
+# CONFIG_WLAN is not set
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
Signature · 1 line
1.9.1
#5 lore raw

PATCH RESEND v6 5/6 ARM: dts: stm32f429: Align Ethernet node with new bindings properties

In reply to Alexandre TORGUE

This patch aligns clocks names and node reference according to new stm32-dwmac glue binding. It also renames Ethernet pinctrl phandle (indeed there is no need to add 0 as Ethernet instance as there is only one IP in SOC).

arch/arm/boot/dts/stm32f429.dtsi +3 -3
index 35df462..5995998 100644
@@ -304,7 +304,7 @@
 				};
 			};
 
-			ethernet0_mii: mii at 0 {
+			ethernet_mii: mii at 0 {
 				pins {
 					pinmux = <STM32F429_PG13_FUNC_ETH_MII_TXD0_ETH_RMII_TXD0>,
 						 <STM32F429_PG14_FUNC_ETH_MII_TXD1_ETH_RMII_TXD1>,
@@ -363,13 +363,13 @@
 			st,mem2mem;
 		};
 
-		ethernet0: dwmac at 40028000 {
+		mac: ethernet at 40028000 {
 			compatible = "st,stm32-dwmac", "snps,dwmac-3.50a";
 			reg = <0x40028000 0x8000>;
 			reg-names = "stmmaceth";
 			interrupts = <61>, <62>;
 			interrupt-names = "macirq", "eth_wake_irq";
-			clock-names = "stmmaceth", "tx-clk", "rx-clk";
+			clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
 			clocks = <&rcc 0 25>, <&rcc 0 26>, <&rcc 0 27>;
 			st,syscon = <&syscfg 0x4>;
 			snps,pbl = <8>;
Signature · 1 line
1.9.1
#6 lore raw

PATCH RESEND v6 6/6 ARM: dts: stm32f429: Update Ethernet node on Eval board

In reply to Alexandre TORGUE

Update new pinctrl phandle name and use new node name.

arch/arm/boot/dts/stm32429i-eval.dts +2 -2
index 6bfc595..9a72445 100644
@@ -94,9 +94,9 @@
 	clock-frequency = <25000000>;
 };
 
-&ethernet0 {
+&mac {
 	status = "okay";
-	pinctrl-0	= <&ethernet0_mii>;
+	pinctrl-0	= <&ethernet_mii>;
 	pinctrl-names	= "default";
 	phy-mode	= "mii-id";
 	mdio0 {
Signature · 1 line
1.9.1
maintainer Acked-by on the v6 series
#7 lore raw
In reply to Alexandre TORGUE

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

I assume this will go via the ARM tree, for the networking bits:

maintainer
#8 lore raw

Hi David,

2016-05-09 21:06 GMT+02:00 David Miller <[email protected]>:

Quoted 10 lines

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

I assume this will go via the ARM tree, for the networking bits:

I would expect patches 1, 2 & 3 to got via your tree, to avoid conflicts.

Quoted 1 line

Thanks,
Maxime

maintainer
#9 lore raw

From: Maxime Coquelin <[email protected]>
Date: Tue, 17 May 2016 11:20:16 +0200

Quoted 6 lines

Hi David,

2016-05-09 21:06 GMT+02:00 David Miller <[email protected]>:

Quoted 3 lines

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

I assume this will go via the ARM tree, for the networking bits:

I would expect patches 1, 2 & 3 to got via your tree, to avoid conflicts.

I don't think putting them all via the ARM tree is going to create much in the way of conflicts, and right now during the merge window offloading that work from me would really help my backlog a lot.

Thanks.

maintainer
#10 lore raw

2016-05-17 18:25 GMT+02:00 David Miller <[email protected]>:

Quoted 15 lines

From: Maxime Coquelin <[email protected]>
Date: Tue, 17 May 2016 11:20:16 +0200

Quoted 12 lines

Hi David,

2016-05-09 21:06 GMT+02:00 David Miller <[email protected]>:

Quoted 9 lines

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

I assume this will go via the ARM tree, for the networking bits:

I would expect patches 1, 2 & 3 to got via your tree, to avoid conflicts.

I don't think putting them all via the ARM tree is going to create much in the way of conflicts, and right now during the merge window offloading that work from me would really help my backlog a lot.

Ok, I understand this is not the best time to pick it.

Arnd, Olof & Kevin, would you accept to pick the series in your tree?

Regards,
Maxime

#11 lore raw
Quoted 19 lines · On Wednesday 18 May 2016 09:48:53 Maxime Coquelin wrote:

2016-05-17 18:25 GMT+02:00 David Miller <[email protected]>:

Quoted 18 lines

From: Maxime Coquelin <[email protected]>
Date: Tue, 17 May 2016 11:20:16 +0200

Quoted 14 lines

Hi David,

2016-05-09 21:06 GMT+02:00 David Miller <[email protected]>:

Quoted 10 lines

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

I assume this will go via the ARM tree, for the networking bits:

I would expect patches 1, 2 & 3 to got via your tree, to avoid conflicts.

Quoted 8 lines
Quoted 3 lines

I don't think putting them all via the ARM tree is going to create much in the way of conflicts, and right now during the merge window offloading that work from me would really help my backlog a lot.

Ok, I understand this is not the best time to pick it.

Arnd, Olof & Kevin, would you accept to pick the series in your tree?

It's too late for v4.7 for us too, please pick up the arch/arm patches in your normal stm32 tree and send them to us along with any other changes you may have, and resend the driver by itself to netdev time after the merge window.

The binding document can go either way, with the dts changes or with the driver. I see no dependencies between the patches, so we just need to land them all in v4.8.

Arnd

maintainer
#12 lore raw

2016-05-18 11:31 GMT+02:00 Arnd Bergmann <[email protected]>:

Quoted 29 lines · On Wednesday 18 May 2016 09:48:53 Maxime Coquelin wrote:
Quoted 19 lines

2016-05-17 18:25 GMT+02:00 David Miller <[email protected]>:

Quoted 18 lines

From: Maxime Coquelin <[email protected]>
Date: Tue, 17 May 2016 11:20:16 +0200

Quoted 14 lines

Hi David,

2016-05-09 21:06 GMT+02:00 David Miller <[email protected]>:

Quoted 10 lines

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

I assume this will go via the ARM tree, for the networking bits:

I would expect patches 1, 2 & 3 to got via your tree, to avoid conflicts.

Quoted 8 lines
Quoted 3 lines

I don't think putting them all via the ARM tree is going to create much in the way of conflicts, and right now during the merge window offloading that work from me would really help my backlog a lot.

Ok, I understand this is not the best time to pick it.

Arnd, Olof & Kevin, would you accept to pick the series in your tree?

Quoted 8 lines

It's too late for v4.7 for us too, please pick up the arch/arm patches in your normal stm32 tree and send them to us along with any other changes you may have, and resend the driver by itself to netdev time after the merge window.

The binding document can go either way, with the dts changes or with the driver. I see no dependencies between the patches, so we just need to land them all in v4.8.

Ok, this is good for me.
No problem to wait for v4.8.
I will take the arch/arm patches, and David the drivers/net/ ones once v4.7-rc1 is out.

Thanks for your time,
Maxime

#13 lore raw

Hi David,

Quoted 35 lines · Maxime Coquelin

2016-05-18 11:31 GMT+02:00 Arnd Bergmann <[email protected]>:

Quoted 34 lines · On Wednesday 18 May 2016 09:48:53 Maxime Coquelin wrote:
Quoted 19 lines

2016-05-17 18:25 GMT+02:00 David Miller <[email protected]>:

Quoted 18 lines

From: Maxime Coquelin <[email protected]>
Date: Tue, 17 May 2016 11:20:16 +0200

Quoted 14 lines

Hi David,

2016-05-09 21:06 GMT+02:00 David Miller <[email protected]>:

Quoted 10 lines

From: Alexandre TORGUE <[email protected]>
Date: Mon, 9 May 2016 12:31:33 +0200

Quoted 5 lines

STM32F429 Chip embeds a Synopsys 3.50a MAC IP. This series:
-enhance current stmmac driver to control it (code already
available) and adds basic glue for STM32F429 chip.
-Enable basic Net config in kernel.

I assume this will go via the ARM tree, for the networking bits:

I would expect patches 1, 2 & 3 to got via your tree, to avoid conflicts.

Quoted 8 lines
Quoted 3 lines

I don't think putting them all via the ARM tree is going to create much in the way of conflicts, and right now during the merge window offloading that work from me would really help my backlog a lot.

Ok, I understand this is not the best time to pick it.

Arnd, Olof & Kevin, would you accept to pick the series in your tree?

It's too late for v4.7 for us too, please pick up the arch/arm patches in your normal stm32 tree and send them to us along with any other changes you may have, and resend the driver by itself to netdev time after the merge window.

Quoted 8 lines
Quoted 3 lines

The binding document can go either way, with the dts changes or with the driver. I see no dependencies between the patches, so we just need to land them all in v4.8.

Ok, this is good for me.
No problem to wait for v4.8.
I will take the arch/arm patches, and David the drivers/net/ ones once v4.7-rc1 is out.

According to this old discussion, could you please take driver patches
+ bindings one (patch 1/2/3) in your net-next tree ?
Do you need I resend them separately ?

Thanks in advance

Alex