Commit fb3dc5b8 authored by David S. Miller's avatar David S. Miller

Merge branch 'phy-broken-modes'

Jerome Brunet says:

====================
phy: Fix integration of eee-broken-modes

The purpose of this series is to fix the integration of the ethernet phy
property "eee-broken-modes" [0]

The v3 of this series has been merged, missing a fix (error reported by
kbuild robot) available in the v4 [1]

More importantly, Florian opposed adding a DT property mapping a device
register this directly [2]. The concern was that the property could be
abused to implement platform configuration policy. After discussing it,
I think we agreed that such information about the HW (defect) should appear
in the platform DT. However, the preferred way is to add a boolean property
for each EEE broken mode.

[0]: http://lkml.kernel.org/r/1480326409-25419-1-git-send-email-jbrunet@baylibre.com
[1]: http://lkml.kernel.org/r/1480348229-25672-1-git-send-email-jbrunet@baylibre.com
[2]: http://lkml.kernel.org/r/e14a3b0c-dc34-be14-48b3-518a0ad0c080@gmail.com
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0a28cfd5 308d3165
...@@ -38,8 +38,14 @@ Optional Properties: ...@@ -38,8 +38,14 @@ Optional Properties:
- enet-phy-lane-swap: If set, indicates the PHY will swap the TX/RX lanes to - enet-phy-lane-swap: If set, indicates the PHY will swap the TX/RX lanes to
compensate for the board being designed with the lanes swapped. compensate for the board being designed with the lanes swapped.
- eee-broken-modes: Bits to clear in the MDIO_AN_EEE_ADV register to - eee-broken-100tx:
disable EEE broken modes. - eee-broken-1000t:
- eee-broken-10gt:
- eee-broken-1000kx:
- eee-broken-10gkx4:
- eee-broken-10gkr:
Mark the corresponding energy efficient ethernet mode as broken and
request the ethernet to stop advertising it.
Example: Example:
......
...@@ -1187,8 +1187,8 @@ static int genphy_config_advert(struct phy_device *phydev) ...@@ -1187,8 +1187,8 @@ static int genphy_config_advert(struct phy_device *phydev)
*/ */
static int genphy_config_eee_advert(struct phy_device *phydev) static int genphy_config_eee_advert(struct phy_device *phydev)
{ {
u32 broken = phydev->eee_broken_modes; int broken = phydev->eee_broken_modes;
u32 old_adv, adv; int old_adv, adv;
/* Nothing to disable */ /* Nothing to disable */
if (!broken) if (!broken)
...@@ -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;
} }
/** /**
......
/*
* This header provides generic constants for ethernet MDIO bindings
*/
#ifndef _DT_BINDINGS_NET_MDIO_H
#define _DT_BINDINGS_NET_MDIO_H
/*
* EEE capability Advertisement
*/
#define MDIO_EEE_100TX 0x0002 /* 100TX EEE cap */
#define MDIO_EEE_1000T 0x0004 /* 1000T EEE cap */
#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */
#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */
#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */
#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */
#endif
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