From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net-next 11/12] net: dsa: mv88e6xxx: add Energy Detect ops
Date: Mon, 17 Jul 2017 21:27:34 +0200 [thread overview]
Message-ID: <20170717192734.GD9363@lunn.ch> (raw)
In-Reply-To: <20170717170346.19555-12-vivien.didelot@savoirfairelinux.com>
> diff --git a/drivers/net/dsa/mv88e6xxx/phy.c b/drivers/net/dsa/mv88e6xxx/phy.c
> index 436668bd50dc..317ae89cfa68 100644
> --- a/drivers/net/dsa/mv88e6xxx/phy.c
> +++ b/drivers/net/dsa/mv88e6xxx/phy.c
> @@ -246,3 +246,99 @@ int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip)
> {
> return mv88e6xxx_phy_ppu_enable(chip);
> }
> +
> +/* Page 0, Register 16: Copper Specific Control Register 1 */
> +
> +int mv88e6352_phy_energy_detect_read(struct mv88e6xxx_chip *chip, int phy,
> + struct ethtool_eee *eee)
> +{
> + u16 val;
> + int err;
> +
> + err = mv88e6xxx_phy_read(chip, phy, MV88E6XXX_PHY_CSCTL1, &val);
> + if (err)
> + return err;
> +
> + val &= MV88E6352_PHY_CSCTL1_ENERGY_DETECT_MASK;
> +
> + eee->eee_enabled = false;
> + eee->tx_lpi_enabled = false;
> +
> + switch (val) {
> + case MV88E6352_PHY_CSCTL1_ENERGY_DETECT_SENSE_NLP:
> + eee->tx_lpi_enabled = true;
> + /* fall through... */
> + case MV88E6352_PHY_CSCTL1_ENERGY_DETECT_SENSE_RCV:
> + eee->eee_enabled = true;
> + }
> +
> + return 0;
> +}
Hi Vivien
I never liked this. I think it is architecturally wrong for the switch
to be poking around in the PHY. It should ask the PHY driver. This is
especially true for external PHYs which might not be a Marvell PHY.
Andrew
next prev parent reply other threads:[~2017-07-17 19:27 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 17:03 [PATCH net-next 00/12] net: dsa: mv88e6xxx: cleanup capabilities Vivien Didelot
2017-07-17 17:03 ` [PATCH net-next 01/12] net: dsa: mv88e6xxx: remove unneeded dsa header Vivien Didelot
2017-07-17 18:57 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 02/12] net: dsa: mv88e6xxx: remove LED control register Vivien Didelot
2017-07-17 18:57 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 03/12] net: dsa: mv88e6xxx: fix 88E6321 family comment Vivien Didelot
2017-07-17 18:57 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 04/12] net: dsa: mv88e6xxx: remove unused capabilities Vivien Didelot
2017-07-17 18:56 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 05/12] net: dsa: mv88e6xxx: remove 88E6185 G2 interrupt Vivien Didelot
2017-07-17 18:55 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 06/12] net: dsa: mv88e6xxx: add number of Global 2 IRQs Vivien Didelot
2017-07-17 17:43 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 07/12] net: dsa: mv88e6xxx: distinguish Global 2 Rsvd2CPU Vivien Didelot
2017-07-17 17:03 ` [PATCH net-next 08/12] net: dsa: mv88e6xxx: add POT flag to 88E6390 Vivien Didelot
2017-07-17 19:15 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 09/12] net: dsa: mv88e6xxx: add POT operation Vivien Didelot
2017-07-17 19:17 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 10/12] net: dsa: mv88e6xxx: add a global2_addr info flag Vivien Didelot
2017-07-17 19:19 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 11/12] net: dsa: mv88e6xxx: add Energy Detect ops Vivien Didelot
2017-07-17 19:27 ` Andrew Lunn [this message]
2017-07-17 19:32 ` Vivien Didelot
2017-07-17 20:45 ` David Miller
2017-07-17 21:04 ` Andrew Lunn
2017-07-17 21:10 ` David Miller
2017-07-18 16:01 ` Florian Fainelli
2017-07-18 17:46 ` David Miller
2017-07-18 18:59 ` Vivien Didelot
2017-07-18 19:58 ` Andrew Lunn
2017-07-17 17:03 ` [PATCH net-next 12/12] net: dsa: mv88e6xxx: add a multi_chip info flag Vivien Didelot
2017-07-17 19:32 ` Andrew Lunn
2017-07-18 18:11 ` [PATCH net-next 00/12] net: dsa: mv88e6xxx: cleanup capabilities David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-07-04 23:41 Vivien Didelot
2017-07-04 23:41 ` [PATCH net-next 11/12] net: dsa: mv88e6xxx: add Energy Detect ops Vivien Didelot
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=20170717192734.GD9363@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.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;
as well as URLs for NNTP newsgroup(s).