Commit 57f39862 authored by jbrunet's avatar jbrunet Committed by David S. Miller

net: phy: use boolean dt properties for eee broken modes

The patches regarding eee-broken-modes was merged before all people
involved could find an agreement on the best way to move forward.

While we agreed on having a DT property to mark particular modes as broken,
the value used for eee-broken-modes mapped the phy register in very direct
way. Because of this, the concern is that it could be used to implement
configuration policies instead of describing a broken HW.

In the end, having a boolean property for each mode seems to be preferred
over one bit field value mapping the register (too) directly.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3bb9ab63
...@@ -1665,7 +1665,7 @@ static void of_set_phy_supported(struct phy_device *phydev) ...@@ -1665,7 +1665,7 @@ static void of_set_phy_supported(struct phy_device *phydev)
static void of_set_phy_eee_broken(struct phy_device *phydev) static void of_set_phy_eee_broken(struct phy_device *phydev)
{ {
struct device_node *node = phydev->mdio.dev.of_node; struct device_node *node = phydev->mdio.dev.of_node;
u32 broken; u32 broken = 0;
if (!IS_ENABLED(CONFIG_OF_MDIO)) if (!IS_ENABLED(CONFIG_OF_MDIO))
return; return;
...@@ -1673,8 +1673,20 @@ static void of_set_phy_eee_broken(struct phy_device *phydev) ...@@ -1673,8 +1673,20 @@ static void of_set_phy_eee_broken(struct phy_device *phydev)
if (!node) if (!node)
return; return;
if (!of_property_read_u32(node, "eee-broken-modes", &broken)) if (of_property_read_bool(node, "eee-broken-100tx"))
phydev->eee_broken_modes = broken; broken |= MDIO_EEE_100TX;
if (of_property_read_bool(node, "eee-broken-1000t"))
broken |= MDIO_EEE_1000T;
if (of_property_read_bool(node, "eee-broken-10gt"))
broken |= MDIO_EEE_10GT;
if (of_property_read_bool(node, "eee-broken-1000kx"))
broken |= MDIO_EEE_1000KX;
if (of_property_read_bool(node, "eee-broken-10gkx4"))
broken |= MDIO_EEE_10GKX4;
if (of_property_read_bool(node, "eee-broken-10gkr"))
broken |= MDIO_EEE_10GKR;
phydev->eee_broken_modes = broken;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment