[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b502aeb-3362-22e4-d160-2ddd8371a389@bitwise.fi>
Date: Thu, 22 Nov 2018 12:40:25 +0200
From: Anssi Hannula <anssi.hannula@...wise.fi>
To: Andrew Lunn <andrew@...n.ch>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>
Subject: Re: [PATCH v3 net-next 04/12] net: ethernet: Use phy_set_max_speed()
to limit advertised speed
Hi,
On 12.9.2018 2:53, Andrew Lunn wrote:
> Many Ethernet MAC drivers want to limit the PHY to only advertise a
> maximum speed of 100Mbs or 1Gbps. Rather than using a mask, make use
> of the helper function phy_set_max_speed().
But what if the PHY does not support 1Gbps in the first place?
This now adds 1Gbps to ->supported and ->advertising even on PHYs that
do not support 1Gbps or have the max speed limited to e.g. 100M via the
"max-speed" device tree property, breaking things.
Unless I'm missing something on how this is supposed to work now :)
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
> ---
> drivers/net/ethernet/8390/ax88796.c | 4 +---
> drivers/net/ethernet/aeroflex/greth.c | 4 ++--
> drivers/net/ethernet/agere/et131x.c | 12 ++----------
> drivers/net/ethernet/allwinner/sun4i-emac.c | 3 +--
> drivers/net/ethernet/altera/altera_tse_main.c | 5 +----
> drivers/net/ethernet/amd/au1000_eth.c | 12 +-----------
> drivers/net/ethernet/broadcom/bcm63xx_enet.c | 10 ++--------
> drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +-
> drivers/net/ethernet/broadcom/sb1250-mac.c | 11 ++---------
> drivers/net/ethernet/broadcom/tg3.c | 8 ++++----
> drivers/net/ethernet/cadence/macb_main.c | 4 ++--
> drivers/net/ethernet/cortina/gemini.c | 2 +-
> drivers/net/ethernet/dnet.c | 4 ++--
> drivers/net/ethernet/ethoc.c | 5 +----
> drivers/net/ethernet/freescale/fec_main.c | 4 ++--
> drivers/net/ethernet/freescale/ucc_geth.c | 7 +------
> drivers/net/ethernet/lantiq_etop.c | 11 ++---------
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++--
> drivers/net/ethernet/nxp/lpc_eth.c | 3 +--
> drivers/net/ethernet/rdc/r6040.c | 12 ++----------
> drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 4 ++--
> drivers/net/ethernet/smsc/smsc911x.c | 5 +++--
> drivers/net/ethernet/smsc/smsc9420.c | 5 +++--
> drivers/net/ethernet/socionext/sni_ave.c | 6 ++----
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +--
> drivers/net/ethernet/toshiba/tc35815.c | 2 +-
> drivers/net/ethernet/xilinx/xilinx_emaclite.c | 3 +--
> drivers/staging/mt7621-eth/mdio.c | 2 +-
> 28 files changed, 47 insertions(+), 110 deletions(-)
[...]
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 16e4ef7d7185..bd4095c3a031 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -544,9 +544,9 @@ static int macb_mii_probe(struct net_device *dev)
>
> /* mask with MAC supported features */
> if (macb_is_gem(bp) && bp->caps & MACB_CAPS_GIGABIT_MODE_AVAILABLE)
> - phydev->supported &= PHY_GBIT_FEATURES;
> + phy_set_max_speed(phydev, SPEED_1000);
> else
> - phydev->supported &= PHY_BASIC_FEATURES;
> + phy_set_max_speed(phydev, SPEED_100);
>
> if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF)
> phydev->supported &= ~SUPPORTED_1000baseT_Half;
[...]
--
Anssi Hannula / Bitwise Oy
Powered by blists - more mailing lists