mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Joseph CHAMG <josright123@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	joseph_chang@davicom.com.tw, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	andy.shevchenko@gmail.com, leon@kernel.org
Subject: Re: [PATCH v14, 2/2] net: Add dm9051 driver
Date: Fri, 28 Jan 2022 03:18:46 +0100	[thread overview]
Message-ID: <YfNShpsWZhbff/C4@lunn.ch> (raw)
In-Reply-To: <20220127032701.23056-3-josright123@gmail.com>

> +static int dm9051_mdiobus_read(struct mii_bus *bus, int addr, int regnum)
> +{
> +	struct board_info *db = bus->priv;
> +	unsigned int val = 0xffff;
> +	int ret;
> +
> +	if (addr == DM9051_PHY_ID) {

Thanks for fixing the variable name. But don't you think it would of
made sense to rename DM9051_PHY_ID as well? DM9051_PHY_ADDR?

> +static int dm9051_set_pauseparam(struct net_device *ndev,
> +				 struct ethtool_pauseparam *pause)
> +{
> +	struct board_info *db = to_dm9051_board(ndev);
> +	u8 fcr = 0;
> +	int ret;
> +
> +	db->eth_pause = *pause;
> +
> +	if (pause->autoneg)
> +		db->phydev->autoneg = AUTONEG_ENABLE;
> +	else
> +		db->phydev->autoneg = AUTONEG_DISABLE;
> +

pause->autoneg means that pause is negotiated as part of autoneg in
general. But pause->autoneg does not mean turn on autoneg. The
ksetting calls should be used for that.

If pause->autoneg is false, you write the pause settings direct to the
MAC. If it is true, you should call phy_set_sym_pause(). Once
negotiation has completed the link change callback will be called, and
you program the MAC with what has been negotiated.

    Andrew

      parent reply	other threads:[~2022-01-28  2:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27  3:26 [PATCH v14, 0/2] ADD DM9051 ETHERNET DRIVER Joseph CHAMG
2022-01-27  3:27 ` [PATCH v14, 1/2] yaml: Add dm9051 SPI network yaml file Joseph CHAMG
2022-01-27  3:27 ` [PATCH v14, 2/2] net: Add dm9051 driver Joseph CHAMG
2022-01-28  1:57   ` Jakub Kicinski
2022-01-28  2:18   ` Andrew Lunn [this message]

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=YfNShpsWZhbff/C4@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andy.shevchenko@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=joseph_chang@davicom.com.tw \
    --cc=josright123@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@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

Powered by JetHome