Skip to contentSkip to conversation

Add Ethernet support on STM32F429

PATCH Superseded Alexandre TORGUE 2 participants 7 messages Mar 4, 2016 – Mar 7, 2016

Subsystems (6)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 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.

Note that DT patches are not present because STM32 pinctrl code is not yet avalaible.

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 (4):
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

 .../devicetree/bindings/net/stm32-dwmac.txt        |  35 ++++
 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 +
 6 files changed, 251 insertions(+)
 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 v4 1/4 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 b390161..5f7ff0a 100644
@@ -12,6 +12,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 v4 2/4 Documentation: Bindings: Add STM32 DWMAC glue

In reply to Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +35 -0
new file mode 100644
index 0000000..fd3566f
@@ -0,0 +1,35 @@
+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 vesrion.
+- clocks: Should contain the GMAC main clock, and tx clock
+- compatible:  Should be "st,stm32-dwmac" to select glue and
+	       "snps,dwmac-3.50a" to select IP version.
+- clocks: Must contain an entry for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.
+	       Should be "tx-clk" for the MAC TX clock.
+	       Should be "rx-clk" 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:
+
+		ethernet0: dwmac 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", "tx-clk", "rx-clk";
+			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
maintainer
#3 lore raw

Re: [PATCH v4 2/4] Documentation: Bindings: Add STM32 DWMAC glue

Quoted 14 lines · Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +6 -0
new file mode 100644
index 0000000..fd3566f
@@ -0,0 +1,35 @@
+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.

Documentation/devicetree/bindings/net/stm32-dwmac.txt line 14

Quoted 10 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +8 -0
+
+Required properties:
 
+- compatible:  Should be "st,stm32-dwmac" to select glue, and
+	       "snps,dwmac-3.50a" to select IP vesrion.
+- clocks: Should contain the GMAC main clock, and tx clock
 
+- compatible:  Should be "st,stm32-dwmac" to select glue and
+	       "snps,dwmac-3.50a" to select IP version.
+- clocks: Must contain an entry for each entry in clock-names.

???

Quoted 24 lines

+- clock-names: Should be "stmmaceth" for the host clock.

Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +20 -0
+	       Should be "tx-clk" for the MAC TX clock.
+	       Should be "rx-clk" 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:
+
+		ethernet0: dwmac 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", "tx-clk", "rx-clk";
+			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
#4 lore raw

Re: [PATCH v4 2/4] Documentation: Bindings: Add STM32 DWMAC glue

Hi Rob,

2016-03-05 5:31 GMT+01:00 Rob Herring <[email protected]>:

Quoted 22 lines · Alexandre TORGUE
Quoted 20 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +11 -0
new file mode 100644
index 0000000..fd3566f
@@ -0,0 +1,35 @@
+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 vesrion.
+- clocks: Should contain the GMAC main clock, and tx clock
Quoted 5 lines
Quoted 3 lines
+- compatible:  Should be "st,stm32-dwmac" to select glue and
+            "snps,dwmac-3.50a" to select IP version.
+- clocks: Must contain an entry for each entry in clock-names.

???

Shame on me, it is a stupid copy/paste issue. For clocks, final description could be:

clocks: Must contain an entry for each entry in clock-names.
clock-names: Should be "stmmaceth" for the host clock.
Should be "tx-clk" for the MAC TX clock. Should be "rx-clk" for the MAC RX clock.

Does it seem good for you ?

Regards.

Alex

Quoted 25 lines
Quoted 25 lines

+- clock-names: Should be "stmmaceth" for the host clock.

Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +20 -1
+            Should be "tx-clk" for the MAC TX clock.
+            Should be "rx-clk" 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:
+
+             ethernet0: dwmac 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", "tx-clk", "rx-clk";
+                     clocks = <&rcc 0 25>, <&rcc 0 26>, <&rcc 0 27>;
+                     st,syscon = <&syscfg 0x4>;
+                     snps,pbl = <8>;
+                     snps,mixed-burst;
+                     dma-ranges;
+             };
--

1.9.1

#5 lore raw

PATCH v4 3/4 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 6a52fa1..6cca626 100644
@@ -178,6 +178,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
#6 lore raw

PATCH v4 4/4 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 ec52505..8b8abe0 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