From: Andrew Lunn <andrew@lunn.ch>
To: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
UNGLinuxDriver@microchip.com
Subject: Re: [PATCH v1 net-next 6/9] lan743x: Add power management support
Date: Thu, 5 Jul 2018 19:37:43 +0200 [thread overview]
Message-ID: <20180705173743.GM23469@lunn.ch> (raw)
In-Reply-To: <1530808766-13973-7-git-send-email-Bryan.Whitehead@microchip.com>
> +static void lan743x_ethtool_get_wol(struct net_device *netdev,
> + struct ethtool_wolinfo *wol)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(netdev);
> + u32 data;
> +
> + data = lan743x_csr_read(adapter, PMT_CTL);
Hi Bryan
Why do you do this read? You do not use the result.
> +
> + wol->supported = WAKE_BCAST | WAKE_UCAST | WAKE_MCAST |
> + WAKE_MAGIC | WAKE_PHY | WAKE_ARP;
> +
> + wol->wolopts = adapter->wolopts;
> +}
> +#endif /* CONFIG_PM */
> +
> +static int lan743x_pm_wakeframe_crc16(const u8 *buf, int len)
> +{
> + const u16 crc16poly = 0x8005;
> + u16 bit, crc, msb;
> + u8 data;
> + int i;
> +
> + crc = 0xFFFF;
> + for (i = 0; i < len; i++) {
> + data = *buf++;
> + for (bit = 0; bit < 8; bit++) {
> + msb = crc >> 15;
> + crc <<= 1;
> +
> + if (msb ^ (u16)(data & 1)) {
> + crc ^= crc16poly;
> + crc |= (u16)0x0001U;
> + }
> + data >>= 1;
> + }
> + }
> +
There are a few different crc algorithms in lib. Can you use one of
them, rather than implementing it yourself?
> +#if CONFIG_PM
> +static int lan743x_pm_suspend(struct device *dev)
> +{
> + struct pci_dev *pdev = to_pci_dev(dev);
> + struct net_device *netdev = pci_get_drvdata(pdev);
> + struct lan743x_adapter *adapter = netdev_priv(netdev);
> + u16 phydata;
> + int ret;
> +
> + if (adapter->wolopts & WAKE_PHY) {
> + phydata = phy_read(netdev->phydev, 27);
> + phydata |= 0x0500;
> + phy_write(netdev->phydev, 27, phydata);
> + }
Shouldn't the PHY driver do this?
Andrew
next prev parent reply other threads:[~2018-07-05 17:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 16:39 [PATCH v1 net-next 0/9] lan743x: Add features to lan743x driver Bryan Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 1/9] lan743x: Add support for ethtool get_drvinfo Bryan Whitehead
2018-07-05 17:12 ` Andrew Lunn
2018-07-05 19:07 ` Bryan.Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 2/9] lan743x: Add support for ethtool link settings Bryan Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 3/9] lan743x: Add support for ethtool statistics Bryan Whitehead
2018-07-05 17:20 ` Andrew Lunn
2018-07-05 19:09 ` Bryan.Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 4/9] lan743x: Add support for ethtool message level Bryan Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 5/9] lan743x: Add support for ethtool eeprom access Bryan Whitehead
2018-07-05 17:28 ` Andrew Lunn
2018-07-05 19:11 ` Bryan.Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 6/9] lan743x: Add power management support Bryan Whitehead
2018-07-05 17:37 ` Andrew Lunn [this message]
2018-07-05 19:29 ` Bryan.Whitehead
2018-07-06 13:57 ` kbuild test robot
2018-07-05 16:39 ` [PATCH v1 net-next 7/9] lan743x: Add EEE support Bryan Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 8/9] lan743x: Add RSS support Bryan Whitehead
2018-07-05 16:39 ` [PATCH v1 net-next 9/9] lan743x: Add PTP support Bryan Whitehead
2018-07-06 21:07 ` kbuild test robot
2018-07-06 21:24 ` Richard Cochran
2018-07-09 20:35 ` Bryan.Whitehead
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=20180705173743.GM23469@lunn.ch \
--to=andrew@lunn.ch \
--cc=Bryan.Whitehead@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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).