Discussion:
[PATCH 0/3] Allwinner V3s EMAC support
(too old to reply)
Icenowy Zheng
2018-02-02 18:04:53 UTC
Permalink
Raw Message
The Allwinner V3/V3s SoCs have EMAC similar to the one in H3, but on V3s
the external MII is not exported due to packaging. (V3s is eLQFP128;
the BGA-packaged V3 exported the external MII bus.)

Add support for the EMAC on V3s. The external bus is not added yet, and
will be added when adding support for V3.

Icenowy Zheng (3):
net: stmmac: dwmac-sun8i: drop V3s compatible and add V3 one
ARM: sun8i: v3s: add V3s EMAC device tree node
ARM: sun8i: v3s: enable Ethernet port on the Lichee Pi Zero Dock

.../devicetree/bindings/net/dwmac-sun8i.txt | 10 ++--
arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 8 ++++
arch/arm/boot/dts/sun8i-v3s.dtsi | 55 ++++++++++++++++++++++
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 10 ++--
4 files changed, 74 insertions(+), 9 deletions(-)
--
2.15.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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Icenowy Zheng
2018-02-02 18:04:54 UTC
Permalink
Raw Message
The V3s is just a differently packaged version of the V3 chip, which has
a MAC with the same capability with H3. The V3s just doesn't wire out
the external MII/RMII/RGMII bus. (V3 wired out it).

Drop the compatible string of V3s in the dwmac-sun8i driver, and add a
V3 compatible string, which has all capabilities.

Signed-off-by: Icenowy Zheng <***@aosc.io>
---
Documentation/devicetree/bindings/net/dwmac-sun8i.txt | 10 +++++-----
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 10 ++++++----
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
index 3d6d5fa0c4d5..158124e8ee71 100644
--- a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
+++ b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
@@ -7,7 +7,7 @@ Required properties:
- compatible: must be one of the following string:
"allwinner,sun8i-a83t-emac"
"allwinner,sun8i-h3-emac"
- "allwinner,sun8i-v3s-emac"
+ "allwinner,sun8i-v3-emac"
"allwinner,sun50i-a64-emac"
- reg: address and length of the register for the device.
- interrupts: interrupt for the device
@@ -23,7 +23,7 @@ Required properties:
- syscon: A phandle to the syscon of the SoC with one of the following
compatible string:
- allwinner,sun8i-h3-system-controller
- - allwinner,sun8i-v3s-system-controller
+ - allwinner,sun8i-v3-system-controller
- allwinner,sun50i-a64-system-controller
- allwinner,sun8i-a83t-system-controller

@@ -35,7 +35,7 @@ external PHY.

Optional properties for the following compatibles:
- "allwinner,sun8i-h3-emac",
- - "allwinner,sun8i-v3s-emac":
+ - "allwinner,sun8i-v3-emac":
- allwinner,leds-active-low: EPHY LEDs are active low

Required child node of emac:
@@ -51,7 +51,7 @@ of the mdio node. See phy.txt for the generic PHY bindings.
The following compatibles require that the emac node have a mdio-mux child
node called "mdio-mux":
- "allwinner,sun8i-h3-emac"
- - "allwinner,sun8i-v3s-emac":
+ - "allwinner,sun8i-v3-emac":
Required properties for the mdio-mux node:
- compatible = "allwinner,sun8i-h3-mdio-mux"
- mdio-parent-bus: a phandle to EMAC mdio
@@ -64,7 +64,7 @@ Required properties for the mdio-mux children node:
The following compatibles require a PHY node representing the integrated
PHY, under the integrated MDIO bus node if an mdio-mux node is used:
- "allwinner,sun8i-h3-emac",
- - "allwinner,sun8i-v3s-emac":
+ - "allwinner,sun8i-v3-emac":

Additional information regarding generic multiplexer properties can be found
at Documentation/devicetree/bindings/net/mdio-mux.txt
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index a3fa65b1ca8e..fd0519cf27b9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -84,10 +84,12 @@ static const struct emac_variant emac_variant_h3 = {
.support_rgmii = true
};

-static const struct emac_variant emac_variant_v3s = {
+static const struct emac_variant emac_variant_v3 = {
.default_syscon_value = 0x38000,
.soc_has_internal_phy = true,
- .support_mii = true
+ .support_mii = true,
+ .support_rmii = true,
+ .support_rgmii = true
};

static const struct emac_variant emac_variant_a83t = {
@@ -1074,8 +1076,8 @@ return ret;
static const struct of_device_id sun8i_dwmac_match[] = {
{ .compatible = "allwinner,sun8i-h3-emac",
.data = &emac_variant_h3 },
- { .compatible = "allwinner,sun8i-v3s-emac",
- .data = &emac_variant_v3s },
+ { .compatible = "allwinner,sun8i-v3-emac",
+ .data = &emac_variant_v3 },
{ .compatible = "allwinner,sun8i-a83t-emac",
.data = &emac_variant_a83t },
{ .compatible = "allwinner,sun50i-a64-emac",
--
2.15.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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Julian Calaby
2018-02-03 06:00:33 UTC
Permalink
Raw Message
Hi Icenowy,
Post by Icenowy Zheng
The V3s is just a differently packaged version of the V3 chip, which has
a MAC with the same capability with H3. The V3s just doesn't wire out
the external MII/RMII/RGMII bus. (V3 wired out it).
Drop the compatible string of V3s in the dwmac-sun8i driver, and add a
V3 compatible string, which has all capabilities.
Aren't compatible strings technically API, so don't we need to support
those that are out in the wild "forever"?

Therefore shouldn't we leave the v3s variant around for compatibility
with existing device trees?

Thanks,
--
Julian Calaby

Email: ***@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Icenowy Zheng
2018-02-03 07:21:42 UTC
Permalink
Raw Message
Post by Julian Calaby
Hi Icenowy,
Post by Icenowy Zheng
The V3s is just a differently packaged version of the V3 chip, which
has
Post by Icenowy Zheng
a MAC with the same capability with H3. The V3s just doesn't wire out
the external MII/RMII/RGMII bus. (V3 wired out it).
Drop the compatible string of V3s in the dwmac-sun8i driver, and add
a
Post by Icenowy Zheng
V3 compatible string, which has all capabilities.
Aren't compatible strings technically API, so don't we need to support
those that are out in the wild "forever"?
Therefore shouldn't we leave the v3s variant around for compatibility
with existing device trees?
You can run grep at arch/arm/boot/dts, this compatible
string is not used at all.
Post by Julian Calaby
Thanks,
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Icenowy Zheng
2018-02-03 07:23:28 UTC
Permalink
Raw Message
Post by Icenowy Zheng
The V3s is just a differently packaged version of the V3 chip, which
has
Post by Icenowy Zheng
a MAC with the same capability with H3. The V3s just doesn't wire out
the external MII/RMII/RGMII bus. (V3 wired out it).
Drop the compatible string of V3s in the dwmac-sun8i driver, and add
a
Post by Icenowy Zheng
V3 compatible string, which has all capabilities.
This breaks the DT ABI, so NAK.
I have asked this at IRC.

The V3s compatible string is never used in any mainline
kernel, even not in any RC version.
Maxime
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Icenowy Zheng
2018-02-02 18:04:55 UTC
Permalink
Raw Message
The V3/V3s EMAC is just similar to the one in H3 SoC, but as the package
of V3s is pin-limited, the external MII/MDIO bus is not wired out.

Add V3s EMAC device tree node. As V3s is only capable of using the
internal PHY, it's hardcoded in the V3s DTSI file.

Signed-off-by: Icenowy Zheng <***@aosc.io>
---
arch/arm/boot/dts/sun8i-v3s.dtsi | 55 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 443b083c6adc..4d49a8b22a1c 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -141,6 +141,12 @@
};
};

+ syscon: ***@1c00000 {
+ compatible = "allwinner,sun8i-v3-system-controller",
+ "syscon";
+ reg = <0x01c00000 0x1000>;
+ };
+
tcon0: lcd-***@1c0c000 {
compatible = "allwinner,sun8i-v3s-tcon";
reg = <0x01c0c000 0x1000>;
@@ -402,6 +408,55 @@
#size-cells = <0>;
};

+ emac: ***@1c30000 {
+ compatible = "allwinner,sun8i-v3-emac";
+ syscon = <&syscon>;
+ reg = <0x01c30000 0x10000>;
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "macirq";
+ resets = <&ccu RST_BUS_EMAC>;
+ reset-names = "stmmaceth";
+ clocks = <&ccu CLK_BUS_EMAC>;
+ clock-names = "stmmaceth";
+ phy-handle = <&int_mii_phy>;
+ phy-mode = "mii";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+
+ mdio: mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "snps,dwmac-mdio";
+ };
+
+ mdio-mux {
+ compatible = "allwinner,sun8i-v3-mdio-mux",
+ "allwinner,sun8i-h3-mdio-mux";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mdio-parent-bus = <&mdio>;
+
+ internal_mdio: ***@1 {
+ compatible = "allwinner,sun8i-v3-mdio-internal",
+ "allwinner,sun8i-h3-mdio-internal";
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ int_mii_phy: ethernet-***@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ clocks = <&ccu CLK_BUS_EPHY>;
+ resets = <&ccu RST_BUS_EPHY>;
+ };
+ };
+
+ /* V3s has no external MDIO bus, but V3 has it */
+ };
+ };
+
spi0: ***@1c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c68000 0x1000>;
--
2.15.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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Icenowy Zheng
2018-02-02 18:04:56 UTC
Permalink
Raw Message
The Lichee Pi Zero Dock has an Ethernet port connected to the internal
PHY of the V3s SoC.

Enable it in the device tree.

Signed-off-by: Icenowy Zheng <***@aosc.io>
---
arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
index d1311098ea45..9b3465cc0dcd 100644
--- a/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
+++ b/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dts
@@ -49,12 +49,20 @@
compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
"allwinner,sun8i-v3s";

+ aliases {
+ ethernet0 = &emac;
+ };
+
leds {
/* The LEDs use PG0~2 pins, which conflict with MMC1 */
status = "disbaled";
};
};

+&emac {
+ status = "okay";
+};
+
&mmc1 {
broken-cd;
bus-width = <4>;
--
2.15.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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...