netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: Andrew Lunn <andrew@lunn.ch>, David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	nikita.yoush@cogentembedded.com, Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next 3/3] dsa: mv88e6xxx: Enable/Disable SERDES on port enable/disable
Date: Wed, 17 May 2017 16:44:03 -0400	[thread overview]
Message-ID: <87a86b8b8s.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <1495051512-13554-4-git-send-email-andrew@lunn.ch>

Hi Andrew,

Good patchset overall, some comments below.

Andrew Lunn <andrew@lunn.ch> writes:

> @@ -2168,7 +2165,44 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
>  	/* Default VLAN ID and priority: don't set a default VLAN
>  	 * ID, and set the default packet priority to zero.
>  	 */
> -	return mv88e6xxx_port_write(chip, port, PORT_DEFAULT_VLAN, 0x0000);
> +	err = mv88e6xxx_port_write(chip, port, PORT_DEFAULT_VLAN, 0x0000);
> +	if (err)
> +		return err;
> +
> +	/* Enable the SERDES interface for DSA and CPU ports. Normal
> +	 * ports SERDES are enabled when the port is enabled, thus
> +	 * saving a bit of power.
> +	 */
> +	if ((dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)) &&
> +	    chip->info->ops->serdes_power)
> +		err = chip->info->ops->serdes_power(chip, port, true);

Please provide a wrapper like this in chip.c in patch 1/3:

    static int mv88e6xxx_serdes_power()
    {
        if (chip->info->ops->serdes_power)
            return chip->info->ops->serdes_power();

        return 0;
    }

So that we don't check chip->info->ops that many times.

> +
> +	return err;
> +}
> +
> +static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port,
> +				 struct phy_device *phydev)
> +{
> +	struct mv88e6xxx_chip *chip = ds->priv;
> +	int err = 0;
> +
> +	mutex_lock(&chip->reg_lock);
> +	if (chip->info->ops->serdes_power)
> +		err = chip->info->ops->serdes_power(chip, port, true);
> +	mutex_unlock(&chip->reg_lock);
> +
> +	return err;
> +}
> +
> +static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port,
> +				   struct phy_device *phydev)
> +{
> +	struct mv88e6xxx_chip *chip = ds->priv;
> +
> +	mutex_lock(&chip->reg_lock);
> +	if (chip->info->ops->serdes_power)
> +		chip->info->ops->serdes_power(chip, port, false);
> +	mutex_unlock(&chip->reg_lock);
>  }

Also please split this in 2 patchs, one which setups serdes with the
port, one which implements port_enable/disable DSA ops.

Thanks,

        Vivien

      reply	other threads:[~2017-05-17 20:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 20:05 [PATCH net-next 0/3] net: dsa: mv88e6xxx: Add basic SERDES support Andrew Lunn
2017-05-17 20:05 ` [PATCH net-next 1/3] net: dsa: mv88e6xxx: Refactor mv88e6352 SERDES code into an op Andrew Lunn
2017-05-17 21:01   ` Vivien Didelot
2017-05-17 20:05 ` [PATCH net-next 2/3] net: dsa: mv88e6xxx: mv88e6390X SERDES support Andrew Lunn
2017-05-17 20:49   ` Vivien Didelot
2017-05-17 20:05 ` [PATCH net-next 3/3] dsa: mv88e6xxx: Enable/Disable SERDES on port enable/disable Andrew Lunn
2017-05-17 20:44   ` Vivien Didelot [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=87a86b8b8s.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me \
    --to=vivien.didelot@savoirfairelinux.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nikita.yoush@cogentembedded.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).