ab43dfdfe5d67f9734f734ea58f3336dc83700e6
[openwrt/staging/wigyori.git] / target / linux / bcm27xx / patches-5.4 / 950-0217-net-genet-enable-link-energy-detect-powerdown-for-ex.patch
1 From cbe8b55622fc2f0a959da599447c87cf1f967a91 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.org>
3 Date: Tue, 14 May 2019 17:17:59 +0100
4 Subject: [PATCH] net: genet: enable link energy detect powerdown for
5 external PHYs
6
7 There are several warts surrounding bcmgenet_mii_probe() as this
8 function is called from ndo_open, but it's calling registration-type
9 functions. The probe should be called at probe time and refactored
10 such that the PHY device data can be extracted to limit the scope
11 of this flag to Broadcom PHYs.
12
13 For now, pass this flag in as it puts our attached PHY into a low-power
14 state when disconnected.
15
16 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
17 ---
18 drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 ++
19 1 file changed, 2 insertions(+)
20
21 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
22 +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
23 @@ -316,6 +316,8 @@ int bcmgenet_mii_probe(struct net_device
24 /* Communicate the integrated PHY revision */
25 if (priv->internal_phy)
26 phy_flags = priv->gphy_rev;
27 + else
28 + phy_flags = PHY_BRCM_AUTO_PWRDWN_ENABLE;
29
30 /* Initialize link state variables that bcmgenet_mii_setup() uses */
31 priv->old_link = -1;