aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-06-20 13:23:06 -0400
committerDavid S. Miller <davem@davemloft.net>2017-06-20 13:23:06 -0400
commitcc07cb935aec4f608e059f3dcd6242a7ecc4a59b (patch)
tree78705413a99e6ac6e90fc11f524fb0715ff5e719 /drivers/net
parentMerge branch 'net-Introduction-of-the-tc-tests' (diff)
parentnet-next: stmmac: dwmac-sun8i: add support for V3s EMAC (diff)
downloadlinux-dev-cc07cb935aec4f608e059f3dcd6242a7ecc4a59b.tar.xz
linux-dev-cc07cb935aec4f608e059f3dcd6242a7ecc4a59b.zip
Merge branch 'net-next-stmmac-dwmac-sun8i-add-support-for-V3s'
Icenowy Zheng says: ==================== net-next: stmmac: dwmac-sun8i: add support for V3s Allwinner V3s features an EMAC like the on in H3, but without external MII interfaces, so being not able really to use RMII/RGMII. And it has a different default value of syscon (0x38000 instead of 0x58000 on H3), which shows a problem that the EMAC clock freq should be 24MHz. (Both H3 and V3s SoCs doesn't have extra xtal input for EPHY, and the main xtal is 24MHz. The default value of H3 is set to 24MHz, but the V3s default value is set to 25MHz). First two patches are device tree binding patches, the third forces the frequency to 24MHz and the fourth really add the V3s support. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c12
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c1
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 54f93ee53ef7..fffd6d5fc907 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 3840529344ed..a366b3747eeb 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" },
};