Skip to contentSkip to conversation

Add Ethernet support on STM32F429

PATCH Superseded Alexandre TORGUE 5 participants 16 messages Mar 18, 2016 – Apr 18, 2016

Subsystems (6)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 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 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 (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        |  32 ++++
 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, 248 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 v5 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 v5 2/4 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..ada2aa4
@@ -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 vesrion.
+- clocks: Must contain a phandle 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
#14 lore raw

PATCH v5 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
#15 lore raw

PATCH v5 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
#3 lore raw

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

In reply to Alexandre TORGUE

Hi,

Quoted 8 lines · Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +0 -0
new file mode 100644
index 0000000..ada2aa4

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

Quoted 10 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +10 -0
@@ -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 vesrion.

If you need have sort of hardware glue, then it is not compatible.

ChenYu

Quoted 30 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +22 -1
+- clocks: Must contain a phandle 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;
+               };
--

1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

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

Hi,

2016-03-18 17:00 GMT+01:00 Chen-Yu Tsai <[email protected]>:

Quoted 16 lines

Hi,

Quoted 12 lines · Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +4 -0
new file mode 100644
index 0000000..ada2aa4
@@ -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.
Quoted 9 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +6 -0
+
+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.

If you need have sort of hardware glue, then it is not compatible.

We could have the case where the glue is set by a bootloader. In this case, we will select IP version in compatible and we will use generic dwmac glue to probe stmmac driver.

Regards

Alex.

Quoted 32 lines

ChenYu

Quoted 30 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +22 -1
+- clocks: Must contain a phandle 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;
+               };
--

1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw

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

Quoted 29 lines · Alexandre Torgue

Hi,

2016-03-18 17:00 GMT+01:00 Chen-Yu Tsai <[email protected]>:

Quoted 16 lines

Hi,

Quoted 12 lines · Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +4 -0
new file mode 100644
index 0000000..ada2aa4
@@ -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.
Quoted 9 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +6 -0
+
+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.

If you need have sort of hardware glue, then it is not compatible.

Quoted 3 lines

We could have the case where the glue is set by a bootloader. In this case, we will select IP version in compatible and we will use generic dwmac glue to probe stmmac driver.

It seems most platforms using DWMAC follow this design set by the original stmmac bindings. I'm arguing that the requirement of setting up the glue makes them incompatible.

What happens when the bootloader didn't setup the glue? And one forgets to build the STM32 driver, only the generic one? The generic driver even matches to some, but not all, version strings.

Maybe it would've been better if the versioned strings were only used to indicate functionality, and not used to bind the drivers. But the bindings were set some time ago.

Regards
ChenYu

Quoted 36 lines

Regards

Alex.

Quoted 32 lines

ChenYu

Quoted 30 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +22 -1
+- clocks: Must contain a phandle 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;
+               };
--

1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

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

Hi Chen-Yu,

Quoted 11 lines · Chen-Yu Tsai
Quoted 9 lines · Alexandre Torgue

Hi,

2016-03-18 17:00 GMT+01:00 Chen-Yu Tsai <[email protected]>:

Quoted 6 lines

Hi,

Quoted 2 lines · Alexandre TORGUE
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
new file mode 100644
index 0000000..ada2aa4
@@ -0,0 +1,32 @@
+STMicroelectronics STM32 / MCU DWMAC glue layer controller
+
Quoted 8 lines
Quoted 8 lines

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

Quoted 8 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +8 -0
+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.

s/vesrion/version

Quoted 12 lines
Quoted 7 lines
Quoted 3 lines

If you need have sort of hardware glue, then it is not compatible.

We could have the case where the glue is set by a bootloader. In this case, we will select IP version in compatible and we will use generic dwmac glue to probe stmmac driver.

It seems most platforms using DWMAC follow this design set by the original stmmac bindings. I'm arguing that the requirement of setting up the glue makes them incompatible.

Quoted 8 lines

What happens when the bootloader didn't setup the glue? And one forgets to build the STM32 driver, only the generic one? The generic driver even matches to some, but not all, version strings.

Maybe it would've been better if the versioned strings were only used to indicate functionality, and not used to bind the drivers. But the bindings were set some time ago.

Since Alexandre has not added "snps,dwmac-3.50a" to dwmac-generic doesn't he use it as you suggest here?

Note that we can not remove all the generic compatible strings from dwmac-generic because there is one platform that depend on one of them.
(see arch/arm/boot/dts/exynos5440.dtsi:190)

So we can not remove "snps,dwmac-3.70a" from the dwmac-generic driver if we want to keep backwards compatibility with exynos5440. But I guess we could remove the others if we want to.

regards,
Joachim Eastwood

maintainer
#9 lore raw

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

In reply to Chen-Yu Tsai
Quoted 16 lines · Chen-Yu Tsai

Hi,

Quoted 12 lines · Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +4 -0
new file mode 100644
index 0000000..ada2aa4
@@ -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.
Quoted 8 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +6 -0
+
+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.

If you need have sort of hardware glue, then it is not compatible.

Hence, the more specific compatible. Having the generic one is still useful.

Quoted 5 lines

ChenYu

Quoted 2 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
+- clocks: Must contain a phandle for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.

This doesn't sound like the clock input signal name...

Quoted 2 lines

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

Quoted 2 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
+              Should be "tx-clk" for the MAC TX clock.
+              Should be "rx-clk" for the MAC RX clock.

How can other DWMAC blocks not have these clocks? The glue can't really add these clocks. It could combine them into one or a new version of DWMAC could have a different number of clock inputs. So if there is variation here, then some of the bindings are probably wrong. I guess the only change I'm suggesting is possibly moving these into common binding doc.

Quoted 5 lines

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

Quoted 5 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +5 -0
+- 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 {

ethernet at ...

Quoted 25 lines
Quoted 17 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +13 -1
+                       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

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

#7 lore raw

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

In reply to Alexandre Torgue
Quoted 9 lines · Alexandre Torgue

Hi,

2016-03-18 17:00 GMT+01:00 Chen-Yu Tsai <[email protected]>:

Quoted 6 lines

Hi,

Quoted 2 lines · Alexandre TORGUE
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
new file mode 100644
index 0000000..ada2aa4
@@ -0,0 +1,32 @@
+STMicroelectronics STM32 / MCU DWMAC glue layer controller
+
Quoted 8 lines

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

Quoted 8 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +8 -0
+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.

Almost all the synp gmac chips have the HW capability register that is used for setting all the parameters at probe time.
This will override fields passed from DT. In theory, it is not necessary to pass: "snps,dwmac-3.50a" from device tree at least there is either no HW cap reg or the glue has some w/a for a specific chip revision.
To be honest, I like to see the "snps,dwmac-3.50a" as compatibility to also have a better readability (that's my personal view ;-) ).

Peppe

Quoted 46 lines
Quoted 3 lines

If you need have sort of hardware glue, then it is not compatible.

We could have the case where the glue is set by a bootloader. In this case, we will select IP version in compatible and we will use generic dwmac glue to probe stmmac driver.

Regards

Alex.

Quoted 32 lines

ChenYu

Quoted 30 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +22 -1
+- clocks: Must contain a phandle 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;
+               };
--

1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#10 lore raw

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

In reply to Rob Herring
Quoted 13 lines · Rob Herring
Quoted 6 lines · Chen-Yu Tsai

Hi,

Quoted 2 lines · Alexandre TORGUE
+- clocks: Must contain a phandle for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.

This doesn't sound like the clock input signal name...

Quoted 2 lines

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

Quoted 2 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
+              Should be "tx-clk" for the MAC TX clock.
+              Should be "rx-clk" for the MAC RX clock.
Quoted 6 lines

How can other DWMAC blocks not have these clocks? The glue can't really add these clocks. It could combine them into one or a new version of DWMAC could have a different number of clock inputs. So if there is variation here, then some of the bindings are probably wrong. I guess the only change I'm suggesting is possibly moving these into common binding doc.

The LPC18xx implementation probably have these clocks as well but the LPC1850 user manual only documents the main clock. Someone with access to the IP block doc from Synopsys should be able to check which clocks the MAC really needs.

Rockchip bindings have two clocks named "mac_clk_rx" and "mac_clk_tx". These are probably the same as stm32 needs so maybe use these names and move them into the main doc and update the rockchip binding.

regards,
Joachim Eastwood

#11 lore raw

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

Hi guys,

I will fix typo issues (s/vesrion/version and ethernet @).

Concerning compatible string. For sure "snps,dwmac-3.50a" string is not used inside glue driver.
I perfere to keep it for information but if you really want that I remove it I will not block ;)

2016-03-21 16:36 GMT+01:00 Joachim Eastwood <[email protected]>:

Quoted 9 lines · Rob Herring
Quoted 8 lines · Chen-Yu Tsai
Quoted 6 lines

Hi,

Quoted 2 lines · Alexandre TORGUE
+- clocks: Must contain a phandle for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.

We can remove host clock (stmmac eth) entry here and refer to stmmac.txt binding for common entry

Quoted 12 lines
Quoted 11 lines

This doesn't sound like the clock input signal name...

Quoted 2 lines

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

Quoted 2 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
+              Should be "tx-clk" for the MAC TX clock.
+              Should be "rx-clk" for the MAC RX clock.

How can other DWMAC blocks not have these clocks? The glue can't really add these clocks. It could combine them into one or a new version of DWMAC could have a different number of clock inputs. So if there is variation here, then some of the bindings are probably wrong. I guess the only change I'm suggesting is possibly moving these into common binding doc.

Quoted 9 lines

The LPC18xx implementation probably have these clocks as well but the LPC1850 user manual only documents the main clock. Someone with access to the IP block doc from Synopsys should be able to check which clocks the MAC really needs.

Rockchip bindings have two clocks named "mac_clk_rx" and "mac_clk_tx". These are probably the same as stm32 needs so maybe use these names and move them into the main doc and update the rockchip binding.

I think we can use same name. But I have a doubt on moving it in a common bindings (maybe I don't well understood). When you say "common binding file" is it "stmmac.txt" binding ? If yes does it mean that we have to control it inside stmmac driver (no more in glue) ? In this case those clocks will become "required" for stm32 and rockship but not for others chip. It could create confusion?

Best regards

Alex

Quoted 3 lines

regards,
Joachim Eastwood

#8 lore raw

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

In reply to Giuseppe CAVALLARO
Quoted 32 lines · Giuseppe CAVALLARO
Quoted 21 lines · Alexandre Torgue

Hi,

2016-03-18 17:00 GMT+01:00 Chen-Yu Tsai <[email protected]>:

Quoted 17 lines

Hi,

Quoted 12 lines · Alexandre TORGUE
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
new file mode 100644
index 0000000..ada2aa4
@@ -0,0 +1,32 @@
+STMicroelectronics STM32 / MCU DWMAC glue layer controller
+
Quoted 8 lines
Quoted 8 lines

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

Quoted 8 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +8 -0
+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.
Quoted 8 lines

Almost all the synp gmac chips have the HW capability register that is used for setting all the parameters at probe time.
This will override fields passed from DT. In theory, it is not necessary to pass: "snps,dwmac-3.50a" from device tree at least there is either no HW cap reg or the glue has some w/a for a specific chip revision.
To be honest, I like to see the "snps,dwmac-3.50a" as compatibility to also have a better readability (that's my personal view ;-) ).

I agree having the versioned strings is good for informational purposes, and to signal hardware capability. It is not so good for directly binding drivers in the implementation though.

Unfortunately, as Joachim pointed out, exynos5440 uses it so we cannot change it.

ChenYu

Quoted 54 lines

Peppe

Quoted 50 lines
Quoted 3 lines

If you need have sort of hardware glue, then it is not compatible.

We could have the case where the glue is set by a bootloader. In this case, we will select IP version in compatible and we will use generic dwmac glue to probe stmmac driver.

Regards

Alex.

Quoted 35 lines

ChenYu

Quoted 33 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +5 -0
+- clocks: Must contain a phandle 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.

Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +4 -0
+Example:
+
+               ethernet0: dwmac at 40028000 {
+                       compatible = "st,stm32-dwmac",

"snps,dwmac-3.50a";

Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +12 -1
+                       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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#12 lore raw

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

In reply to Alexandre Torgue

Hi Rob,

2016-03-22 17:11 GMT+01:00 Alexandre Torgue <[email protected]>:

Quoted 43 lines

Hi guys,

I will fix typo issues (s/vesrion/version and ethernet @).

Concerning compatible string. For sure "snps,dwmac-3.50a" string is not used inside glue driver.
I perfere to keep it for information but if you really want that I remove it I will not block ;)

2016-03-21 16:36 GMT+01:00 Joachim Eastwood <[email protected]>:

Quoted 9 lines · Rob Herring
Quoted 8 lines · Chen-Yu Tsai
Quoted 6 lines

Hi,

Quoted 2 lines · Alexandre TORGUE
+- clocks: Must contain a phandle for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.

We can remove host clock (stmmac eth) entry here and refer to stmmac.txt binding for common entry

Quoted 12 lines
Quoted 11 lines

This doesn't sound like the clock input signal name...

Quoted 2 lines

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

Quoted 2 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
+              Should be "tx-clk" for the MAC TX clock.
+              Should be "rx-clk" for the MAC RX clock.

How can other DWMAC blocks not have these clocks? The glue can't really add these clocks. It could combine them into one or a new version of DWMAC could have a different number of clock inputs. So if there is variation here, then some of the bindings are probably wrong. I guess the only change I'm suggesting is possibly moving these into common binding doc.

Quoted 9 lines

The LPC18xx implementation probably have these clocks as well but the LPC1850 user manual only documents the main clock. Someone with access to the IP block doc from Synopsys should be able to check which clocks the MAC really needs.

Rockchip bindings have two clocks named "mac_clk_rx" and "mac_clk_tx". These are probably the same as stm32 needs so maybe use these names and move them into the main doc and update the rockchip binding.

Quoted 6 lines

I think we can use same name. But I have a doubt on moving it in a common bindings (maybe I don't well understood). When you say "common binding file" is it "stmmac.txt" binding ? If yes does it mean that we have to control it inside stmmac driver (no more in glue) ? In this case those clocks will become "required" for stm32 and rockship but not for others chip. It could create confusion?

A gentle ping. Can you give me your feedback please ? I will send next patchset version according to your answer.

Thanks in advance

Alex

Quoted 8 lines

Best regards

Alex

Quoted 3 lines

regards,
Joachim Eastwood

#13 lore raw

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

In reply to Alexandre Torgue
Quoted 43 lines · Alexandre Torgue

Hi guys,

I will fix typo issues (s/vesrion/version and ethernet @).

Concerning compatible string. For sure "snps,dwmac-3.50a" string is not used inside glue driver.
I perfere to keep it for information but if you really want that I remove it I will not block ;)

2016-03-21 16:36 GMT+01:00 Joachim Eastwood <[email protected]>:

Quoted 9 lines · Rob Herring
Quoted 8 lines · Chen-Yu Tsai
Quoted 6 lines

Hi,

Quoted 2 lines · Alexandre TORGUE
+- clocks: Must contain a phandle for each entry in clock-names.
+- clock-names: Should be "stmmaceth" for the host clock.

We can remove host clock (stmmac eth) entry here and refer to stmmac.txt binding for common entry

Quoted 12 lines
Quoted 11 lines

This doesn't sound like the clock input signal name...

Quoted 2 lines

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

Quoted 2 lines
Documentation/devicetree/bindings/net/stm32-dwmac.txt new file +2 -0
+              Should be "tx-clk" for the MAC TX clock.
+              Should be "rx-clk" for the MAC RX clock.

How can other DWMAC blocks not have these clocks? The glue can't really add these clocks. It could combine them into one or a new version of DWMAC could have a different number of clock inputs. So if there is variation here, then some of the bindings are probably wrong. I guess the only change I'm suggesting is possibly moving these into common binding doc.

Quoted 9 lines

The LPC18xx implementation probably have these clocks as well but the LPC1850 user manual only documents the main clock. Someone with access to the IP block doc from Synopsys should be able to check which clocks the MAC really needs.

Rockchip bindings have two clocks named "mac_clk_rx" and "mac_clk_tx". These are probably the same as stm32 needs so maybe use these names and move them into the main doc and update the rockchip binding.

Quoted 6 lines

I think we can use same name. But I have a doubt on moving it in a common bindings (maybe I don't well understood). When you say "common binding file" is it "stmmac.txt" binding ? If yes does it mean that we have to control it inside stmmac driver (no more in glue) ? In this case those clocks will become "required" for stm32 and rockship but not for others chip. It could create confusion?

Currently we keep the "host" and "csr" " ptp "clock from common bindings because directly connected to the either MAC core or optional internals modules.
Indeed, also clk_tx_i and clk_rx_i could be treated in the same way. but... (my personal view).
Many platforms, also inside STi, have different clock routing schema, so we could relax them giving each glue the way to internally manage all (as done nowadays).
So these clocks can stay inside the glue and documented inside each binding doc. Maybe, it could be not so easy to have generic schema suitable for all the glues so documenting all inside the same binding text file.
We could try to better name these clocks in each glue. For example, for this, although I do not know the clk schema, I can image a single rmii_clk (maybe from internal oscillator) that is connected to clk_tx_i and clk_rx_i. So it could be useless to pass both. Please let me know if I am wrong...
In case of (G)MII, we should use something like (g)mii_tx_clk, (g)mii_rx_clk according to the real connections (if from
an internal oscillator and not from an ext one connected to the phy).

Regards,
Peppe

Quoted 8 lines

Best regards

Alex

Quoted 3 lines

regards,
Joachim Eastwood