linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Allwinner H6 Ethernet support
@ 2018-11-03 12:32 Icenowy Zheng
  2018-11-03 12:32 ` [PATCH v2 1/3] dt-binding: dwmac-sun8i: add H6 compatible string (w/ A64 fallback) Icenowy Zheng
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Icenowy Zheng @ 2018-11-03 12:32 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Corentin Labbe, Rob Herring,
	David S . Miller
  Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi,
	Icenowy Zheng

This patchset introduces Allwinner H6 Ethernet support with code already
available for A64.

As the EMAC on H6 is similar to A64 ones, support for them are directly
reused, by using fallback compatible strings.

Patches about system controller in v1 is sent by Jernej Skabrec as part
of his H6 display patchset, and already gets applied.

NOTE: This patchset targets the final version of Pine H64, and also
supports the early sample of Pine H64 model B. However, it's not
compatible with the early sample of Pine H64 model A. Please DO NOT test
this patchset on the Pine H64 model A samples.

Icenowy Zheng (3):
  dt-binding: dwmac-sun8i: add H6 compatible string (w/ A64 fallback)
  arm64: allwinner: h6: add EMAC device nodes
  arm64: allwinner: h6: add support for the Ethernet on Pine H64

 .../devicetree/bindings/net/dwmac-sun8i.txt   |  1 +
 .../boot/dts/allwinner/sun50i-h6-pine-h64.dts | 20 +++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 28 +++++++++++++++++++
 3 files changed, 49 insertions(+)

-- 
2.18.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] dt-binding: dwmac-sun8i: add H6 compatible string (w/ A64 fallback)
  2018-11-03 12:32 [PATCH v2 0/3] Allwinner H6 Ethernet support Icenowy Zheng
@ 2018-11-03 12:32 ` Icenowy Zheng
  2018-11-03 12:32 ` [PATCH v2 2/3] arm64: allwinner: h6: add EMAC device nodes Icenowy Zheng
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Icenowy Zheng @ 2018-11-03 12:32 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Corentin Labbe, Rob Herring,
	David S . Miller
  Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi,
	Icenowy Zheng

The Allwinner H6 SoC features a Ethernet MAC that is similar to the one
in A64.

Add a compatible string for it with A64 fallback compatible string, in
this case the A64 driver can be used.

The "internal" PHY is not internal from the perspective of the H6 main
die, instead it's on the co-packaged AC200 chip, and connected to the
main die with RMII at the in-package Port A PIO bank. So from the SoC
driver side it needs no special treatment.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
---
Changes in v2:
- Added ACK tag by Rob and Review tag by Chen-Yu.

 Documentation/devicetree/bindings/net/dwmac-sun8i.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
index 5bb3a18cc38d..54c66d0611cb 100644
--- a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
+++ b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
@@ -10,6 +10,7 @@ Required properties:
 		"allwinner,sun8i-r40-gmac"
 		"allwinner,sun8i-v3s-emac"
 		"allwinner,sun50i-a64-emac"
+		"allwinner,sun50i-h6-emac", "allwinner-sun50i-a64-emac"
 - reg: address and length of the register for the device.
 - interrupts: interrupt for the device
 - interrupt-names: must be "macirq"
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] arm64: allwinner: h6: add EMAC device nodes
  2018-11-03 12:32 [PATCH v2 0/3] Allwinner H6 Ethernet support Icenowy Zheng
  2018-11-03 12:32 ` [PATCH v2 1/3] dt-binding: dwmac-sun8i: add H6 compatible string (w/ A64 fallback) Icenowy Zheng
@ 2018-11-03 12:32 ` Icenowy Zheng
  2018-11-14 10:30   ` [linux-sunxi] " Chen-Yu Tsai
  2018-11-03 12:32 ` [PATCH v2 3/3] arm64: allwinner: h6: add support for the Ethernet on Pine H64 Icenowy Zheng
  2018-11-05  9:00 ` [PATCH v2 0/3] Allwinner H6 Ethernet support Maxime Ripard
  3 siblings, 1 reply; 6+ messages in thread
From: Icenowy Zheng @ 2018-11-03 12:32 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Corentin Labbe, Rob Herring,
	David S . Miller
  Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi,
	Icenowy Zheng

Allwinner H6 SoC has an EMAC like the one in A64.

Add device tree nodes for the H6 DTSI file.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Dropped unneeded cells property.

 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 040828d2e2c0..11f7ce7d1876 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -149,6 +149,14 @@
 			interrupt-controller;
 			#interrupt-cells = <3>;
 
+			ext_rgmii_pins: rgmii_pins {
+				pins = "PD0", "PD1", "PD2", "PD3", "PD4",
+				       "PD5", "PD7", "PD8", "PD9", "PD10",
+				       "PD11", "PD12", "PD13", "PD19", "PD20";
+				function = "emac";
+				drive-strength = <40>;
+			};
+
 			mmc0_pins: mmc0-pins {
 				pins = "PF0", "PF1", "PF2", "PF3",
 				       "PF4", "PF5";
@@ -258,6 +266,26 @@
 			status = "disabled";
 		};
 
+		emac: ethernet@5020000 {
+			compatible = "allwinner,sun50i-a64-emac",
+				     "allwinner,sun50i-h6-emac";
+			syscon = <&syscon>;
+			reg = <0x05020000 0x10000>;
+			interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "macirq";
+			resets = <&ccu RST_BUS_EMAC>;
+			reset-names = "stmmaceth";
+			clocks = <&ccu CLK_BUS_EMAC>;
+			clock-names = "stmmaceth";
+			status = "disabled";
+
+			mdio: mdio {
+				compatible = "snps,dwmac-mdio";
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};
+
 		r_ccu: clock@7010000 {
 			compatible = "allwinner,sun50i-h6-r-ccu";
 			reg = <0x07010000 0x400>;
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] arm64: allwinner: h6: add support for the Ethernet on Pine H64
  2018-11-03 12:32 [PATCH v2 0/3] Allwinner H6 Ethernet support Icenowy Zheng
  2018-11-03 12:32 ` [PATCH v2 1/3] dt-binding: dwmac-sun8i: add H6 compatible string (w/ A64 fallback) Icenowy Zheng
  2018-11-03 12:32 ` [PATCH v2 2/3] arm64: allwinner: h6: add EMAC device nodes Icenowy Zheng
@ 2018-11-03 12:32 ` Icenowy Zheng
  2018-11-05  9:00 ` [PATCH v2 0/3] Allwinner H6 Ethernet support Maxime Ripard
  3 siblings, 0 replies; 6+ messages in thread
From: Icenowy Zheng @ 2018-11-03 12:32 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Corentin Labbe, Rob Herring,
	David S . Miller
  Cc: netdev, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi,
	Icenowy Zheng

The Pine H64 board has an Ethernet port, which is connected to a
RTL8211E PHY, then the PHY is connected to the MAC on H6 SoC.

Add support for the Ethernet port.

The PHY needs some time to start up, and the time is modelled as enable
ramp delay of the regulator.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
Changes in v2:
- Adapted the decision by Pine64 on the final version of Pine H64 (the
  current scheme on model B's).

 .../boot/dts/allwinner/sun50i-h6-pine-h64.dts | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
index 48daec7f78ba..fcf3c1de4aa2 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts
@@ -14,6 +14,7 @@
 	compatible = "pine64,pine-h64", "allwinner,sun50i-h6";
 
 	aliases {
+		ethernet0 = &emac;
 		serial0 = &uart0;
 	};
 
@@ -41,6 +42,24 @@
 	};
 };
 
+&emac {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ext_rgmii_pins>;
+	phy-mode = "rgmii";
+	phy-handle = <&ext_rgmii_phy>;
+	phy-supply = <&reg_aldo2>;
+	allwinner,rx-delay-ps = <200>;
+	allwinner,tx-delay-ps = <200>;
+	status = "okay";
+};
+
+&mdio {
+	ext_rgmii_phy: ethernet-phy@1 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <1>;
+	};
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
@@ -85,6 +104,7 @@
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-name = "vcc-ac200";
+				regulator-enable-ramp-delay = <100000>;
 			};
 
 			reg_aldo3: aldo3 {
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/3] Allwinner H6 Ethernet support
  2018-11-03 12:32 [PATCH v2 0/3] Allwinner H6 Ethernet support Icenowy Zheng
                   ` (2 preceding siblings ...)
  2018-11-03 12:32 ` [PATCH v2 3/3] arm64: allwinner: h6: add support for the Ethernet on Pine H64 Icenowy Zheng
@ 2018-11-05  9:00 ` Maxime Ripard
  3 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2018-11-05  9:00 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, Corentin Labbe, Rob Herring, David S . Miller,
	netdev, devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

On Sat, Nov 03, 2018 at 08:32:35PM +0800, Icenowy Zheng wrote:
> This patchset introduces Allwinner H6 Ethernet support with code already
> available for A64.
> 
> As the EMAC on H6 is similar to A64 ones, support for them are directly
> reused, by using fallback compatible strings.
> 
> Patches about system controller in v1 is sent by Jernej Skabrec as part
> of his H6 display patchset, and already gets applied.
> 
> NOTE: This patchset targets the final version of Pine H64, and also
> supports the early sample of Pine H64 model B. However, it's not
> compatible with the early sample of Pine H64 model A. Please DO NOT test
> this patchset on the Pine H64 model A samples.

Applied thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [linux-sunxi] [PATCH v2 2/3] arm64: allwinner: h6: add EMAC device nodes
  2018-11-03 12:32 ` [PATCH v2 2/3] arm64: allwinner: h6: add EMAC device nodes Icenowy Zheng
@ 2018-11-14 10:30   ` Chen-Yu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: Chen-Yu Tsai @ 2018-11-14 10:30 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Maxime Ripard, Corentin Labbe, Rob Herring, David Miller, netdev,
	devicetree, linux-arm-kernel, linux-kernel, linux-sunxi

On Sat, Nov 3, 2018 at 8:33 PM Icenowy Zheng <icenowy@aosc.io> wrote:
>
> Allwinner H6 SoC has an EMAC like the one in A64.
>
> Add device tree nodes for the H6 DTSI file.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
> Changes in v2:
> - Dropped unneeded cells property.
>
>  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 28 ++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> index 040828d2e2c0..11f7ce7d1876 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> @@ -149,6 +149,14 @@
>                         interrupt-controller;
>                         #interrupt-cells = <3>;
>
> +                       ext_rgmii_pins: rgmii_pins {
> +                               pins = "PD0", "PD1", "PD2", "PD3", "PD4",
> +                                      "PD5", "PD7", "PD8", "PD9", "PD10",
> +                                      "PD11", "PD12", "PD13", "PD19", "PD20";
> +                               function = "emac";
> +                               drive-strength = <40>;
> +                       };
> +
>                         mmc0_pins: mmc0-pins {
>                                 pins = "PF0", "PF1", "PF2", "PF3",
>                                        "PF4", "PF5";
> @@ -258,6 +266,26 @@
>                         status = "disabled";
>                 };
>
> +               emac: ethernet@5020000 {
> +                       compatible = "allwinner,sun50i-a64-emac",
> +                                    "allwinner,sun50i-h6-emac";

These are in the wrong order. Since this is already merged, please send
a fix for it.

ChenYu

> +                       syscon = <&syscon>;
> +                       reg = <0x05020000 0x10000>;
> +                       interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
> +                       interrupt-names = "macirq";
> +                       resets = <&ccu RST_BUS_EMAC>;
> +                       reset-names = "stmmaceth";
> +                       clocks = <&ccu CLK_BUS_EMAC>;
> +                       clock-names = "stmmaceth";
> +                       status = "disabled";
> +
> +                       mdio: mdio {
> +                               compatible = "snps,dwmac-mdio";
> +                               #address-cells = <1>;
> +                               #size-cells = <0>;
> +                       };
> +               };
> +
>                 r_ccu: clock@7010000 {
>                         compatible = "allwinner,sun50i-h6-r-ccu";
>                         reg = <0x07010000 0x400>;
> --
> 2.18.1
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-14 10:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-03 12:32 [PATCH v2 0/3] Allwinner H6 Ethernet support Icenowy Zheng
2018-11-03 12:32 ` [PATCH v2 1/3] dt-binding: dwmac-sun8i: add H6 compatible string (w/ A64 fallback) Icenowy Zheng
2018-11-03 12:32 ` [PATCH v2 2/3] arm64: allwinner: h6: add EMAC device nodes Icenowy Zheng
2018-11-14 10:30   ` [linux-sunxi] " Chen-Yu Tsai
2018-11-03 12:32 ` [PATCH v2 3/3] arm64: allwinner: h6: add support for the Ethernet on Pine H64 Icenowy Zheng
2018-11-05  9:00 ` [PATCH v2 0/3] Allwinner H6 Ethernet support Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).