Skip to contentSkip to conversation

Add Ether DT support for R8A7778/BOCK-W reference board

PATCH Superseded Sergei Shtylyov 5 participants 16 messages Aug 31, 2013 – Sep 5, 2013

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add Ether DT support for R8A7778/BOCK-W reference board

Hello.

Here's the set of 4 patches against Simon Horman's 'renesas.git' repo,
'renesas-devel-20130830' tag. Here we add the Ether device tree support working on the R8A7778/BOCK-W reference board. The patchset requires the 'sh_eth' driver device tree support posted earlier in order to work.

[1/4] ARM: shmobile: r8a7778: add Ether DT support [2/4] ARM: shmobile: r8a7778: add Ether clock for DT case [3/4] ARM: shmobile: bockw-reference: add Ether DT support [4/4] ARM: shmobile: BOCK-W reference: add Ether PFC settings

WBR, Sergei

#1 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Define the generic R8A777x part of the Ether device node.

---
 arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/r8a7778.dtsi +11 -0
Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================
@@ -98,4 +98,15 @@
 		reg = <0xfffc000 0x118>;
 		#gpio-range-cells = <3>;
 	};
+
+	ether: ethernet at fde00000 {
+		device_type = "network";
+		compatible = "renesas,ether-r8a7779";
+		reg = <0xfde00000 0x400>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 105 0x4>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
 };
#2 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Hi Sergei,

Thank you for the patch.

Quoted 13 lines · On Sunday 01 September 2013 03:15:48 Sergei Shtylyov wrote:

Define the generic R8A777x part of the Ether device node.

---
 arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi line 103

Quoted 6 lines
arch/arm/boot/dts/r8a7778.dtsi +3 -0
@@ -98,4 +98,15 @@
 		reg = <0xfffc000 0x118>;
 		#gpio-range-cells = <3>;
 	};
+
+	ether: ethernet at fde00000 {
+		device_type = "network";

Documentation/devicetree/bindings/net/sh_eth.txt from "[PATCH 2/2] sh_eth: add device tree support" doesn't document this property, should you update it ?

Quoted 9 lines
arch/arm/boot/dts/r8a7778.dtsi +8 -0
+		compatible = "renesas,ether-r8a7779";
+		reg = <0xfde00000 0x400>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 105 0x4>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
 };
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Quoted 8 lines · Laurent Pinchart
Quoted 7 lines

Define the generic R8A777x part of the Ether device node.

---
  arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
  1 file changed, 11 insertions(+)
Quoted 14 lines

arch/arm/boot/dts/r8a7778.dtsi line 103

Quoted 11 lines

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi +3 -0
@@ -98,4 +98,15 @@
  		reg = <0xfffc000 0x118>;
  		#gpio-range-cells = <3>;
  	};
+
+	ether: ethernet at fde00000 {
+		device_type = "network";

Documentation/devicetree/bindings/net/sh_eth.txt from "[PATCH 2/2] sh_eth: add device tree support" doesn't document this property, should you update it ?

It's a standard property but completely optional for non-OF systems. I've
not seen anybody document it but I should grep for it...

WBR, Sergei

#4 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Quoted 28 lines · On Monday 02 September 2013 18:05:10 Sergei Shtylyov wrote:
Quoted 20 lines · Laurent Pinchart
Quoted 20 lines

Define the generic R8A777x part of the Ether device node.

---

  arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
  1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi +0 -0
@@ -98,4 +98,15 @@
 
  		reg = <0xfffc000 0x118>;
  		#gpio-range-cells = <3>;
 
  	};
Quoted 7 lines

arch/arm/boot/dts/r8a7778.dtsi line 103

Quoted 3 lines
arch/arm/boot/dts/r8a7778.dtsi +3 -0
+
+	ether: ethernet at fde00000 {
+		device_type = "network";

Documentation/devicetree/bindings/net/sh_eth.txt from "[PATCH 2/2] sh_eth:
add device tree support" doesn't document this property, should you update it ?

Quoted 2 lines

It's a standard property but completely optional for non-OF systems.
I've not seen anybody document it but I should grep for it...

Documentation/devicetree/booting-without-of.txt mentions it, as well as a couple of other DT bindings document, but there's no clear documentation of what device_type should be for network device, and whether the property is mandatory or optional. Clarifying the documentation would be great.

Signature · 3 lines
Regards,

Laurent Pinchart
#5 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Quoted 4 lines · Laurent Pinchart

Documentation/devicetree/booting-without-of.txt mentions it, as well as a couple of other DT bindings document, but there's no clear documentation of what device_type should be for network device, and whether the property is mandatory or optional. Clarifying the documentation would be great.

It's documented in the ePAPR spec:

"The device_type property was used in IEEE 1275 to describe the device?s FCode programming model. Because ePAPR does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275?derived device trees."

The bottom line is - don't use it, unless you've good good reasons?

Pawe?

#6 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Hi Pawe?,

Quoted 6 lines · On Monday 02 September 2013 16:32:34 Pawel Moll wrote:
Quoted 4 lines · Laurent Pinchart

Documentation/devicetree/booting-without-of.txt mentions it, as well as a couple of other DT bindings document, but there's no clear documentation of what device_type should be for network device, and whether the property is mandatory or optional. Clarifying the documentation would be great.

Quoted 6 lines

It's documented in the ePAPR spec:

"The device_type property was used in IEEE 1275 to describe the device?s FCode programming model. Because ePAPR does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275?derived device trees."

Thank you for the clarification.

Quoted 1 line

The bottom line is - don't use it, unless you've good good reasons?

I'll let Sergei share his opinion on whether we've got good reasons :-)

Signature · 3 lines
Regards,

Laurent Pinchart
#7 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Hello.

Quoted 12 lines · Laurent Pinchart
Quoted 11 lines
Quoted 4 lines

Documentation/devicetree/booting-without-of.txt mentions it, as well as a couple of other DT bindings document, but there's no clear documentation of what device_type should be for network device, and whether the property is mandatory or optional. Clarifying the documentation would be great.

It's documented in the ePAPR spec:

"The device_type property was used in IEEE 1275 to describe the device?s FCode programming model. Because ePAPR does not have FCode, new use of the property is deprecated, and it should be included only on cpu and memory nodes for compatibility with IEEE 1275?derived device trees."

Quoted 5 lines

Thank you for the clarification.

Quoted 1 line

The bottom line is - don't use it, unless you've good good reasons?

I'll let Sergei share his opinion on whether we've got good reasons :-)

No, we don't, I'll remove the prop.

WBR, Sergei

maintainer
#8 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

In reply to Sergei Shtylyov
Quoted 13 lines · Sergei Shtylyov

Define the generic R8A777x part of the Ether device node.

---
 arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi line 104

Quoted 7 lines
arch/arm/boot/dts/r8a7778.dtsi +4 -0
@@ -98,4 +98,15 @@
                reg = <0xfffc000 0x118>;
                #gpio-range-cells = <3>;
        };
+
+       ether: ethernet at fde00000 {
+               device_type = "network";
+               compatible = "renesas,ether-r8a7779";

Hi Sergei,

Thanks for your patch. What's the reason behind the r8a7778 SoC using a compatible string for r8a7779 like "renesas,ether-r8a7779"?

It seems that you assume that the r8a7778 ethernet controller is 100% compatible with r8a7779. Is that really true? For earlier versions the sh_eth hardware documentation was anything but accurate, so it seems to me that it must be more safe that r8a7778 would be using "renesas,ether-r8a7778". What do you think?

Thanks,

/ magnus

#9 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Hello.

Quoted 23 lines · Magnus Damm
Quoted 13 lines

Define the generic R8A777x part of the Ether device node.

---
  arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
  1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi line 104

Quoted 7 lines
arch/arm/boot/dts/r8a7778.dtsi +4 -0
@@ -98,4 +98,15 @@
                 reg = <0xfffc000 0x118>;
                 #gpio-range-cells = <3>;
         };
+
+       ether: ethernet at fde00000 {
+               device_type = "network";
+               compatible = "renesas,ether-r8a7779";

Hi Sergei,

Quoted 2 lines

Thanks for your patch. What's the reason behind the r8a7778 SoC using a compatible string for r8a7779 like "renesas,ether-r8a7779"?

R8A7779 support has appeared first in Linux and as R8A7778 Ether is
identical to R8A7779 and no wildcards are allowed in the device tree, I decided to use this "compatible" prop.

Quoted 5 lines

It seems that you assume that the r8a7778 ethernet controller is 100% compatible with r8a7779. Is that really true? For earlier versions the sh_eth hardware documentation was anything but accurate, so it seems to me that it must be more safe that r8a7778 would be using "renesas,ether-r8a7778". What do you think?

I think R8A7778 and R8A7779 EtherMACs are identical. I've cross checked
the documentation at the start of the development and the registers appeared to be the same.

Quoted 3 lines

Thanks,

/ magnus

WBR, Sergei

maintainer
#10 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Hi Sergei,

[CC Laurent]

Quoted 32 lines · Sergei Shtylyov

Hello.

Quoted 25 lines · Magnus Damm
Quoted 15 lines

Define the generic R8A777x part of the Ether device node.

---
  arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
  1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi line 104

Quoted 7 lines
arch/arm/boot/dts/r8a7778.dtsi +4 -0
@@ -98,4 +98,15 @@
                 reg = <0xfffc000 0x118>;
                 #gpio-range-cells = <3>;
         };
+
+       ether: ethernet at fde00000 {
+               device_type = "network";
+               compatible = "renesas,ether-r8a7779";

Hi Sergei,

Quoted 7 lines
Quoted 2 lines

Thanks for your patch. What's the reason behind the r8a7778 SoC using a compatible string for r8a7779 like "renesas,ether-r8a7779"?

R8A7779 support has appeared first in Linux and as R8A7778 Ether is
identical to R8A7779 and no wildcards are allowed in the device tree, I decided to use this "compatible" prop.

Thanks for your reply, I see.

Quoted 10 lines
Quoted 5 lines

It seems that you assume that the r8a7778 ethernet controller is 100% compatible with r8a7779. Is that really true? For earlier versions the sh_eth hardware documentation was anything but accurate, so it seems to me that it must be more safe that r8a7778 would be using "renesas,ether-r8a7778". What do you think?

I think R8A7778 and R8A7779 EtherMACs are identical. I've cross checked
the documentation at the start of the development and the registers appeared to be the same.

But even if the current version of the documentation happens to be similar in it still doesn't guarantee that the IP is the same. And using the "correct" SoC compatible value doesn't really hurt in any way, does it?

My feeling is that using the identical SoC as compatible value must be the best option - unless we know for sure they are identical that is.

So unless we're 100% certain about IP compatibility I'm trying to enforce that we either use a strict matching for exactly the same SoC version or IP block. Using a different maybe-compatible SoC string seems to be begging for future trouble IMO.

Laurent, any opinion?

Cheers,

/ manus

#11 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Quoted 53 lines · On Wednesday 04 September 2013 14:35:14 Magnus Damm wrote:
Quoted 25 lines · Sergei Shtylyov
Quoted 24 lines · Magnus Damm
Quoted 14 lines

Define the generic R8A777x part of the Ether device node.

---

  arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
  1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi line 104

Quoted 7 lines
arch/arm/boot/dts/r8a7778.dtsi +4 -0
@@ -98,4 +98,15 @@
                 reg = <0xfffc000 0x118>;
                 #gpio-range-cells = <3>;
         };
+
+       ether: ethernet at fde00000 {
+               device_type = "network";
+               compatible = "renesas,ether-r8a7779";

Hi Sergei,

Quoted 6 lines
Quoted 2 lines

Thanks for your patch. What's the reason behind the r8a7778 SoC using a compatible string for r8a7779 like "renesas,ether-r8a7779"?

R8A7779 support has appeared first in Linux and as R8A7778 Ether is identical to R8A7779 and no wildcards are allowed in the device tree, I decided to use this "compatible" prop.

Thanks for your reply, I see.

Quoted 9 lines
Quoted 5 lines

It seems that you assume that the r8a7778 ethernet controller is 100% compatible with r8a7779. Is that really true? For earlier versions the sh_eth hardware documentation was anything but accurate, so it seems to me that it must be more safe that r8a7778 would be using "renesas,ether-r8a7778". What do you think?

I think R8A7778 and R8A7779 EtherMACs are identical. I've cross checked the documentation at the start of the development and the registers appeared to be the same.

But even if the current version of the documentation happens to be similar in it still doesn't guarantee that the IP is the same. And using the "correct" SoC compatible value doesn't really hurt in any way, does it?

My feeling is that using the identical SoC as compatible value must be the best option - unless we know for sure they are identical that is.

Quoted 6 lines

So unless we're 100% certain about IP compatibility I'm trying to enforce that we either use a strict matching for exactly the same SoC version or IP block. Using a different maybe-compatible SoC string seems to be begging for future trouble IMO.

Laurent, any opinion?

I agree. If we had access to IP version information we could use that to construct the compatible name. As we don't, the SoC name is the best option, and to ensure future compatibility we should use the exact SoC version.

Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

PATCH 1/4 ARM: shmobile: r8a7778: add Ether DT support

Quoted 59 lines · Laurent Pinchart
Quoted 58 lines · On Wednesday 04 September 2013 14:35:14 Magnus Damm wrote:
Quoted 25 lines · Sergei Shtylyov
Quoted 24 lines · Magnus Damm
Quoted 14 lines

Define the generic R8A777x part of the Ether device node.

---

  arch/arm/boot/dts/r8a7778.dtsi |   11 +++++++++++
  1 file changed, 11 insertions(+)

Index: renesas/arch/arm/boot/dts/r8a7778.dtsi
===================================================================

arch/arm/boot/dts/r8a7778.dtsi line 104

Quoted 7 lines
arch/arm/boot/dts/r8a7778.dtsi +4 -0
@@ -98,4 +98,15 @@
                 reg = <0xfffc000 0x118>;
                 #gpio-range-cells = <3>;
         };
+
+       ether: ethernet at fde00000 {
+               device_type = "network";
+               compatible = "renesas,ether-r8a7779";

Hi Sergei,

Quoted 6 lines
Quoted 2 lines

Thanks for your patch. What's the reason behind the r8a7778 SoC using a compatible string for r8a7779 like "renesas,ether-r8a7779"?

R8A7779 support has appeared first in Linux and as R8A7778 Ether is identical to R8A7779 and no wildcards are allowed in the device tree, I decided to use this "compatible" prop.

Thanks for your reply, I see.

Quoted 9 lines
Quoted 5 lines

It seems that you assume that the r8a7778 ethernet controller is 100% compatible with r8a7779. Is that really true? For earlier versions the sh_eth hardware documentation was anything but accurate, so it seems to me that it must be more safe that r8a7778 would be using "renesas,ether-r8a7778". What do you think?

I think R8A7778 and R8A7779 EtherMACs are identical. I've cross checked the documentation at the start of the development and the registers appeared to be the same.

But even if the current version of the documentation happens to be similar in it still doesn't guarantee that the IP is the same. And using the "correct" SoC compatible value doesn't really hurt in any way, does it?

My feeling is that using the identical SoC as compatible value must be the best option - unless we know for sure they are identical that is.

So unless we're 100% certain about IP compatibility I'm trying to enforce that we either use a strict matching for exactly the same SoC version or IP block. Using a different maybe-compatible SoC string seems to be begging for future trouble IMO.

Quoted 5 lines
Quoted 1 line

Laurent, any opinion?

I agree. If we had access to IP version information we could use that to construct the compatible name. As we don't, the SoC name is the best option, and to ensure future compatibility we should use the exact SoC version.

Using the SoC name is in keeping with recent discussions that we have had about compat string names for shmobile. So I agree with both Magnus and Laurent here (no surprise!).

#13 lore raw

PATCH 2/4 ARM: shmobile: r8a7778: add Ether clock for DT case

In reply to Sergei Shtylyov

Add extra Ether clock lookup entry in the device tree case.

---
 arch/arm/mach-shmobile/clock-r8a7778.c |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/clock-r8a7778.c +1 -0
Index: renesas/arch/arm/mach-shmobile/clock-r8a7778.c
===================================================================
@@ -146,6 +146,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
 	CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
+	CLKDEV_DEV_ID("fde00000.ethernet", &mstp_clks[MSTP114]), /* Ether w/DT */
 	CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
 	CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
 	CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
#14 lore raw

PATCH 3/4 ARM: shmobile: bockw-reference: add Ether DT support

In reply to Sergei Shtylyov

Define the BOCK-W board dependent part of the Ether device node.

---
 arch/arm/boot/dts/r8a7778-bockw-reference.dts |   11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/r8a7778-bockw-reference.dts +11 -0
Index: renesas/arch/arm/boot/dts/r8a7778-bockw-reference.dts
===================================================================
@@ -30,3 +30,14 @@
 		reg = <0x60000000 0x10000000>;
 	};
 };
+
+&ether {
+	status = "ok";
+	phy-mode = "rmii";
+	phy-handle = <&phy1>;
+	renesas,no-ether-link;
+
+	phy1: ethernet-phy at 1 {
+		reg = <1>;
+	};
+};
#15 lore raw

PATCH 4/4 ARM: shmobile: BOCK-W reference: add Ether PFC settings

In reply to Sergei Shtylyov

Add the Ether pin group to bockw_pinctrl_map[].

---
 arch/arm/mach-shmobile/board-bockw-reference.c |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-shmobile/board-bockw-reference.c +3 -0
Index: renesas/arch/arm/mach-shmobile/board-bockw-reference.c
===================================================================
@@ -29,6 +29,9 @@
  */
 
 static const struct pinctrl_map bockw_pinctrl_map[] = {
+	/* Ether */
+	PIN_MAP_MUX_GROUP_DEFAULT("fde00000.ethernet", "pfc-r8a7778",
+				  "ether_rmii", "ether"),
 	/* SCIF0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
 				  "scif0_data_a", "scif0"),