From: Jerome Brunet <jbrunet@baylibre.com>
To: netdev@vger.kernel.org, devicetree@vger.kernel.org,
Florian Fainelli <f.fainelli@gmail.com>
Cc: "Jerome Brunet" <jbrunet@baylibre.com>,
"Carlo Caione" <carlo@caione.org>,
"Kevin Hilman" <khilman@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Andre Roth" <neolynx@gmail.com>, "Andrew Lunn" <andrew@lunn.ch>,
"Neil Armstrong" <narmstrong@baylibre.com>,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"Yegor Yefremov" <yegorslists@googlemail.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [PATCH net 2/3] net: phy: use boolean dt properties for eee broken modes
Date: Mon, 19 Dec 2016 16:05:37 +0100 [thread overview]
Message-ID: <1482159938-13239-3-git-send-email-jbrunet@baylibre.com> (raw)
In-Reply-To: <1482159938-13239-1-git-send-email-jbrunet@baylibre.com>
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: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/net/phy/phy_device.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ee5ebadb1463..92b08383cafa 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -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)
{
struct device_node *node = phydev->mdio.dev.of_node;
- u32 broken;
+ u32 broken = 0;
if (!IS_ENABLED(CONFIG_OF_MDIO))
return;
@@ -1673,8 +1673,20 @@ static void of_set_phy_eee_broken(struct phy_device *phydev)
if (!node)
return;
- if (!of_property_read_u32(node, "eee-broken-modes", &broken))
- phydev->eee_broken_modes = broken;
+ if (of_property_read_bool(node, "eee-broken-100tx"))
+ 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;
}
/**
--
2.7.4
next prev parent reply other threads:[~2016-12-19 15:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 15:05 [PATCH net 0/3] Fix integration of eee-broken-modes Jerome Brunet
2016-12-19 15:05 ` [PATCH net 1/3] net: phy: fix sign type error in genphy_config_eee_advert Jerome Brunet
2016-12-19 15:05 ` Jerome Brunet [this message]
2016-12-19 15:05 ` [PATCH net 3/3] dt: bindings: net: use boolean dt properties for eee broken modes Jerome Brunet
2016-12-20 18:51 ` [PATCH net 0/3] Fix integration of eee-broken-modes David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482159938-13239-3-git-send-email-jbrunet@baylibre.com \
--to=jbrunet@baylibre.com \
--cc=afaerber@suse.de \
--cc=andrew@lunn.ch \
--cc=carlo@caione.org \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=narmstrong@baylibre.com \
--cc=neolynx@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=yegorslists@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox