diff --git a/Documentation/devicetree/bindings/misc/allwinner,syscon.txt b/Documentation/devicetree/bindings/misc/allwinner,syscon.txt index cb5769137c6c3bc135569a5ed0bf65909d6e0f69..31494a24fe6989a9d8f384900366b744e37becc6 100644 --- a/Documentation/devicetree/bindings/misc/allwinner,syscon.txt +++ b/Documentation/devicetree/bindings/misc/allwinner,syscon.txt @@ -9,6 +9,7 @@ Required properties for the system controller: - reg: address and length of the register for the device. - compatible: should be "syscon" and one of the following string: "allwinner,sun8i-h3-system-controller" + "allwinner,sun8i-v3s-system-controller" "allwinner,sun50i-a64-system-controller" "allwinner,sun8i-a83t-system-controller" diff --git a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt index 08e708c731931a319b80b40ee2f3f59c80d5980b..725f3b18788614f2d7bd8abdb2201d5d216ed7be 100644 --- a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt +++ b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt @@ -7,6 +7,7 @@ Required properties: - compatible: should be one of the following string: "allwinner,sun8i-a83t-emac" "allwinner,sun8i-h3-emac" + "allwinner,sun8i-v3s-emac" "allwinner,sun50i-a64-emac" - reg: address and length of the register for the device. - interrupts: interrupt for the device @@ -22,6 +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,sun50i-a64-system-controller - allwinner,sun8i-a83t-system-controller @@ -31,7 +33,9 @@ Optional properties: Both delay properties need to be a multiple of 100. They control the delay for external PHY. -Optional properties for "allwinner,sun8i-h3-emac": +Optional properties for the following compatibles: + - "allwinner,sun8i-h3-emac", + - "allwinner,sun8i-v3s-emac": - allwinner,leds-active-low: EPHY LEDs are active low Required child node of emac: @@ -44,7 +48,9 @@ Required properties of the mdio node: The device node referenced by "phy" or "phy-handle" should be a child node of the mdio node. See phy.txt for the generic PHY bindings. -Required properties of the phy node with "allwinner,sun8i-h3-emac": +Required properties of the phy node with the following compatibles: + - "allwinner,sun8i-h3-emac", + - "allwinner,sun8i-v3s-emac": - clocks: a phandle to the reference clock for the EPHY - resets: a phandle to the reset control for the EPHY diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 54f93ee53ef720f356ac34ebb2426924370888e2..fffd6d5fc907b01d2277370f80b23af5a9288e8d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -81,6 +81,12 @@ static const struct emac_variant emac_variant_h3 = { .support_rgmii = true }; +static const struct emac_variant emac_variant_v3s = { + .default_syscon_value = 0x38000, + .internal_phy = PHY_INTERFACE_MODE_MII, + .support_mii = true +}; + static const struct emac_variant emac_variant_a83t = { .default_syscon_value = 0, .internal_phy = 0, @@ -185,6 +191,7 @@ static const struct emac_variant emac_variant_a64 = { /* H3 specific bits for EPHY */ #define H3_EPHY_ADDR_SHIFT 20 +#define H3_EPHY_CLK_SEL BIT(18) /* 1: 24MHz, 0: 25MHz */ #define H3_EPHY_LED_POL BIT(17) /* 1: active low, 0: active high */ #define H3_EPHY_SHUTDOWN BIT(16) /* 1: shutdown, 0: power up */ #define H3_EPHY_SELECT BIT(15) /* 1: internal PHY, 0: external PHY */ @@ -656,6 +663,9 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv) else reg &= ~H3_EPHY_LED_POL; + /* Force EPHY xtal frequency to 24MHz. */ + reg |= H3_EPHY_CLK_SEL; + ret = of_mdio_parse_addr(priv->device, priv->plat->phy_node); if (ret < 0) { @@ -971,6 +981,8 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) 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-a83t-emac", .data = &emac_variant_a83t }, { .compatible = "allwinner,sun50i-a64-emac", diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3840529344ed7c94a7efcb5fc99026f942a56e28..a366b3747eeb58aebf730fde9c44c0a94af70491 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -313,6 +313,7 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat, { .compatible = "snps,dwc-qos-ethernet-4.10" }, { .compatible = "allwinner,sun8i-a83t-emac" }, { .compatible = "allwinner,sun8i-h3-emac" }, + { .compatible = "allwinner,sun8i-v3s-emac" }, { .compatible = "allwinner,sun50i-a64-emac" }, };