* [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs
@ 2021-01-14 10:44 Russell King - ARM Linux admin
2021-01-14 10:45 ` [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties Russell King
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Russell King - ARM Linux admin @ 2021-01-14 10:44 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, devicetree, Florian Fainelli, Jakub Kicinski,
netdev, Rob Herring, Jon Nettleton
Hi,
This patch series adds the ability to configure the SmartEEE feature
in AT803x PHYs. SmartEEE defaults to enabled on these PHYs, and has
a history of causing random sporadic link drops at Gigabit speeds.
There appears to be two solutions to this. There is the approach that
Freescale adopted early on, which is to disable the SmartEEE feature.
However, this loses the power saving provided by EEE. Another solution
was found by Jon Nettleton is to increase the Tw parameter for Gigabit
links.
This patch series adds support for both approaches, by adding a boolean:
qca,disable-smarteee
if one wishes to disable SmartEEE, and two properties to configure the
SmartEEE Tw parameters:
qca,smarteee-tw-us-100m
qca,smarteee-tw-us-1g
Sadly, the PHY quirk I merged a while back for AT8035 on iMX6 is broken
- rather than disabling SmartEEE mode, it enables it.
The addition of these properties will be sent to the appropriate
platform maintainers - although for SolidRun platforms, we only make use
of "qca,smarteee-tw-us-1g".
.../devicetree/bindings/net/qca,ar803x.yaml | 16 ++++++
drivers/net/phy/at803x.c | 65 +++++++++++++++++++++-
2 files changed, 80 insertions(+), 1 deletion(-)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties
2021-01-14 10:44 [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs Russell King - ARM Linux admin
@ 2021-01-14 10:45 ` Russell King
2021-01-15 17:27 ` Rob Herring
2021-01-14 10:45 ` [PATCH net-next 2/2] net: phy: at803x: add support for configuring SmartEEE Russell King
2021-01-15 23:10 ` [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Russell King @ 2021-01-14 10:45 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, devicetree, Florian Fainelli, Jakub Kicinski,
netdev, Rob Herring, Jon Nettleton
The SmartEEE feature of Atheros AR803x PHYs can cause the link to
bounce. Add DT properties to allow SmartEEE to be disabled, and to
allow the Tw parameters for 100M and 1G links to be configured.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
.../devicetree/bindings/net/qca,ar803x.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/qca,ar803x.yaml b/Documentation/devicetree/bindings/net/qca,ar803x.yaml
index 64b3357ade8a..b3d4013b7ca6 100644
--- a/Documentation/devicetree/bindings/net/qca,ar803x.yaml
+++ b/Documentation/devicetree/bindings/net/qca,ar803x.yaml
@@ -28,6 +28,10 @@ description: |
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2]
+ qca,disable-smarteee:
+ description: Disable Atheros SmartEEE feature.
+ type: boolean
+
qca,keep-pll-enabled:
description: |
If set, keep the PLL enabled even if there is no link. Useful if you
@@ -36,6 +40,18 @@ description: |
Only supported on the AR8031.
type: boolean
+ qca,smarteee-tw-us-100m:
+ description: EEE Tw parameter for 100M links.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 1
+ maximum: 255
+
+ qca,smarteee-tw-us-1g:
+ description: EEE Tw parameter for gigabit links.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 1
+ maximum: 255
+
vddio-supply:
description: |
RGMII I/O voltage regulator (see regulator/regulator.yaml).
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] net: phy: at803x: add support for configuring SmartEEE
2021-01-14 10:44 [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs Russell King - ARM Linux admin
2021-01-14 10:45 ` [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties Russell King
@ 2021-01-14 10:45 ` Russell King
2021-01-15 23:10 ` [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Russell King @ 2021-01-14 10:45 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: David S. Miller, devicetree, Florian Fainelli, Jakub Kicinski,
netdev, Rob Herring, Jon Nettleton
SmartEEE for the atheros phy was deemed buggy by Freescale and commits
were added to disable it for their boards.
In initial testing, SolidRun found that the default settings were
causing disconnects but by increasing the Tw buffer time we could allow
enough time for all parts of the link to come out of a low power state
and function properly without causing a disconnect. This allows us to
have functional power savings of between 300 and 400mW, rather than
disabling the feature altogether.
This commit adds support for disabling SmartEEE and configuring the Tw
parameters for 1G and 100M speeds.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/at803x.c | 65 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 64 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 3909dc9fc94b..104dd7b37c5d 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -132,6 +132,11 @@
#define AT803X_MIN_DOWNSHIFT 2
#define AT803X_MAX_DOWNSHIFT 9
+#define AT803X_MMD3_SMARTEEE_CTL1 0x805b
+#define AT803X_MMD3_SMARTEEE_CTL2 0x805c
+#define AT803X_MMD3_SMARTEEE_CTL3 0x805d
+#define AT803X_MMD3_SMARTEEE_CTL3_LPI_EN BIT(8)
+
#define ATH9331_PHY_ID 0x004dd041
#define ATH8030_PHY_ID 0x004dd076
#define ATH8031_PHY_ID 0x004dd074
@@ -146,8 +151,11 @@ MODULE_LICENSE("GPL");
struct at803x_priv {
int flags;
#define AT803X_KEEP_PLL_ENABLED BIT(0) /* don't turn off internal PLL */
+#define AT803X_DISABLE_SMARTEEE BIT(1)
u16 clk_25m_reg;
u16 clk_25m_mask;
+ u8 smarteee_lpi_tw_1g;
+ u8 smarteee_lpi_tw_100m;
struct regulator_dev *vddio_rdev;
struct regulator_dev *vddh_rdev;
struct regulator *vddio;
@@ -411,13 +419,32 @@ static int at803x_parse_dt(struct phy_device *phydev)
{
struct device_node *node = phydev->mdio.dev.of_node;
struct at803x_priv *priv = phydev->priv;
- u32 freq, strength;
+ u32 freq, strength, tw;
unsigned int sel;
int ret;
if (!IS_ENABLED(CONFIG_OF_MDIO))
return 0;
+ if (of_property_read_bool(node, "qca,disable-smarteee"))
+ priv->flags |= AT803X_DISABLE_SMARTEEE;
+
+ if (!of_property_read_u32(node, "qca,smarteee-tw-us-1g", &tw)) {
+ if (!tw || tw > 255) {
+ phydev_err(phydev, "invalid qca,smarteee-tw-us-1g\n");
+ return -EINVAL;
+ }
+ priv->smarteee_lpi_tw_1g = tw;
+ }
+
+ if (!of_property_read_u32(node, "qca,smarteee-tw-us-100m", &tw)) {
+ if (!tw || tw > 255) {
+ phydev_err(phydev, "invalid qca,smarteee-tw-us-100m\n");
+ return -EINVAL;
+ }
+ priv->smarteee_lpi_tw_100m = tw;
+ }
+
ret = of_property_read_u32(node, "qca,clk-out-frequency", &freq);
if (!ret) {
switch (freq) {
@@ -526,6 +553,38 @@ static void at803x_remove(struct phy_device *phydev)
regulator_disable(priv->vddio);
}
+static int at803x_smarteee_config(struct phy_device *phydev)
+{
+ struct at803x_priv *priv = phydev->priv;
+ u16 mask = 0, val = 0;
+ int ret;
+
+ if (priv->flags & AT803X_DISABLE_SMARTEEE)
+ return phy_modify_mmd(phydev, MDIO_MMD_PCS,
+ AT803X_MMD3_SMARTEEE_CTL3,
+ AT803X_MMD3_SMARTEEE_CTL3_LPI_EN, 0);
+
+ if (priv->smarteee_lpi_tw_1g) {
+ mask |= 0xff00;
+ val |= priv->smarteee_lpi_tw_1g << 8;
+ }
+ if (priv->smarteee_lpi_tw_100m) {
+ mask |= 0x00ff;
+ val |= priv->smarteee_lpi_tw_100m;
+ }
+ if (!mask)
+ return 0;
+
+ ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_MMD3_SMARTEEE_CTL1,
+ mask, val);
+ if (ret)
+ return ret;
+
+ return phy_modify_mmd(phydev, MDIO_MMD_PCS, AT803X_MMD3_SMARTEEE_CTL3,
+ AT803X_MMD3_SMARTEEE_CTL3_LPI_EN,
+ AT803X_MMD3_SMARTEEE_CTL3_LPI_EN);
+}
+
static int at803x_clk_out_config(struct phy_device *phydev)
{
struct at803x_priv *priv = phydev->priv;
@@ -577,6 +636,10 @@ static int at803x_config_init(struct phy_device *phydev)
if (ret < 0)
return ret;
+ ret = at803x_smarteee_config(phydev);
+ if (ret < 0)
+ return ret;
+
ret = at803x_clk_out_config(phydev);
if (ret < 0)
return ret;
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties
2021-01-14 10:45 ` [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties Russell King
@ 2021-01-15 17:27 ` Rob Herring
0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2021-01-15 17:27 UTC (permalink / raw)
To: Russell King
Cc: Heiner Kallweit, Jon Nettleton, Florian Fainelli, Jakub Kicinski,
David S. Miller, Rob Herring, Andrew Lunn, devicetree, netdev
On Thu, 14 Jan 2021 10:45:44 +0000, Russell King wrote:
> The SmartEEE feature of Atheros AR803x PHYs can cause the link to
> bounce. Add DT properties to allow SmartEEE to be disabled, and to
> allow the Tw parameters for 100M and 1G links to be configured.
>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
> .../devicetree/bindings/net/qca,ar803x.yaml | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs
2021-01-14 10:44 [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs Russell King - ARM Linux admin
2021-01-14 10:45 ` [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties Russell King
2021-01-14 10:45 ` [PATCH net-next 2/2] net: phy: at803x: add support for configuring SmartEEE Russell King
@ 2021-01-15 23:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-15 23:10 UTC (permalink / raw)
To: Russell King - ARM Linux admin
Cc: andrew, hkallweit1, davem, devicetree, f.fainelli, kuba, netdev,
robh+dt, jon
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
On Thu, 14 Jan 2021 10:44:56 +0000 you wrote:
> Hi,
>
> This patch series adds the ability to configure the SmartEEE feature
> in AT803x PHYs. SmartEEE defaults to enabled on these PHYs, and has
> a history of causing random sporadic link drops at Gigabit speeds.
>
> There appears to be two solutions to this. There is the approach that
> Freescale adopted early on, which is to disable the SmartEEE feature.
> However, this loses the power saving provided by EEE. Another solution
> was found by Jon Nettleton is to increase the Tw parameter for Gigabit
> links.
>
> [...]
Here is the summary with links:
- [net-next,1/2] dt: ar803x: document SmartEEE properties
https://git.kernel.org/netdev/net-next/c/623c13295cf4
- [net-next,2/2] net: phy: at803x: add support for configuring SmartEEE
https://git.kernel.org/netdev/net-next/c/390b4cad8148
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-15 23:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 10:44 [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs Russell King - ARM Linux admin
2021-01-14 10:45 ` [PATCH net-next 1/2] dt: ar803x: document SmartEEE properties Russell King
2021-01-15 17:27 ` Rob Herring
2021-01-14 10:45 ` [PATCH net-next 2/2] net: phy: at803x: add support for configuring SmartEEE Russell King
2021-01-15 23:10 ` [PATCH net-next 0/2] Add further DT configuration for AT803x PHYs patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.