66 lines
2.4 KiB
Diff
66 lines
2.4 KiB
Diff
From a07bdcc66e753dd1e954c83dce6fe62b0cadd213 Mon Sep 17 00:00:00 2001
|
|
From: Andre Przywara <andre.przywara@arm.com>
|
|
Date: Thu, 10 Dec 2020 14:42:12 +0000
|
|
Subject: [PATCH 011/153] drv:net:stmmac:dwmac-sun8i: second EMAC clock
|
|
register
|
|
|
|
The Allwinner H616 SoC has two EMAC controllers, with the second one
|
|
being tied to the internal PHY, but also using a separate EMAC clock
|
|
register.
|
|
|
|
To tell the driver about which clock register to use, we add a parameter
|
|
to our syscon phandle. The driver will use this value as an index into
|
|
the regmap, so that we can address more than the first register, if
|
|
needed.
|
|
|
|
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|
|
---
|
|
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
index 3fc0fcee4..c830f0584 100644
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
@@ -1145,11 +1145,13 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
|
struct stmmac_resources stmmac_res;
|
|
struct sunxi_priv_data *gmac;
|
|
struct device *dev = &pdev->dev;
|
|
+ struct reg_field syscon_field;
|
|
phy_interface_t interface;
|
|
int ret;
|
|
struct stmmac_priv *priv;
|
|
struct net_device *ndev;
|
|
struct regmap *regmap;
|
|
+ u32 syscon_idx = 0;
|
|
|
|
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
|
|
if (ret)
|
|
@@ -1204,8 +1206,12 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
|
|
return ret;
|
|
}
|
|
|
|
- gmac->regmap_field = devm_regmap_field_alloc(dev, regmap,
|
|
- *gmac->variant->syscon_field);
|
|
+ syscon_field = *gmac->variant->syscon_field;
|
|
+ ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1,
|
|
+ &syscon_idx);
|
|
+ if (!ret)
|
|
+ syscon_field.reg += syscon_idx * sizeof(u32);
|
|
+ gmac->regmap_field = devm_regmap_field_alloc(dev, regmap, syscon_field);
|
|
if (IS_ERR(gmac->regmap_field)) {
|
|
ret = PTR_ERR(gmac->regmap_field);
|
|
dev_err(dev, "Unable to map syscon register: %d\n", ret);
|
|
@@ -1334,6 +1340,8 @@ static const struct of_device_id sun8i_dwmac_match[] = {
|
|
.data = &emac_variant_a64 },
|
|
{ .compatible = "allwinner,sun50i-h6-emac",
|
|
.data = &emac_variant_h6 },
|
|
+ { .compatible = "allwinner,sun50i-h616-emac",
|
|
+ .data = &emac_variant_h6 },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
|
|
--
|
|
2.35.3
|
|
|