net: sun8i-emac: Add a flag for the internal PHY switch
authorSamuel Holland <samuel@sholland.org>
Sun, 22 Jan 2023 22:51:04 +0000 (16:51 -0600)
committerAndre Przywara <andre.przywara@arm.com>
Tue, 11 Apr 2023 23:17:21 +0000 (00:17 +0100)
Describe this feature instead of using the SoC ID.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
drivers/net/sun8i_emac.c

index f232b8f..36cc249 100644 (file)
@@ -137,6 +137,7 @@ enum emac_variant_id {
 
 struct emac_variant {
        enum emac_variant_id    variant;
+       bool                    soc_has_internal_phy;
        bool                    support_rmii;
 };
 
@@ -860,7 +861,7 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)
        if (pdata->phy_interface == PHY_INTERFACE_MODE_NA)
                return -EINVAL;
 
-       if (priv->variant->variant == H3_EMAC) {
+       if (priv->variant->soc_has_internal_phy) {
                ret = sun8i_handle_internal_phy(dev, priv);
                if (ret)
                        return ret;
@@ -906,6 +907,7 @@ static const struct emac_variant emac_variant_a83t = {
 
 static const struct emac_variant emac_variant_h3 = {
        .variant                = H3_EMAC,
+       .soc_has_internal_phy   = true,
        .support_rmii           = true,
 };