From: Vivien Didelot <vivien.didelot@gmail.com>
To: "Marek Behún" <marek.behun@nic.cz>
Cc: netdev@vger.kernel.org, "Andrew Lunn" <andrew@lunn.ch>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Marek Behún" <marek.behun@nic.cz>
Subject: Re: [PATCH RFC net-next 3/3] net: dsa: mv88e6xxx: setup SERDES irq also for CPU/DSA ports
Date: Fri, 16 Aug 2019 12:25:52 -0400 [thread overview]
Message-ID: <20190816122552.GC629@t480s.localdomain> (raw)
In-Reply-To: <20190816150834.26939-4-marek.behun@nic.cz>
On Fri, 16 Aug 2019 17:08:34 +0200, Marek Behún <marek.behun@nic.cz> wrote:
> @@ -2151,16 +2151,6 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
> 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))) {
> - err = mv88e6xxx_serdes_power(chip, port, true);
> - if (err)
> - return err;
> - }
> -
> /* Port Control 2: don't force a good FCS, set the maximum frame size to
> * 10240 bytes, disable 802.1q tags checking, don't discard tagged or
> * untagged frames on this port, do a destination address lookup on all
> @@ -2557,6 +2547,48 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
> return err;
> }
>
> +static int mv88e6xxx_port_setup(struct dsa_switch *ds, int port)
> +{
> + struct mv88e6xxx_chip *chip = ds->priv;
> + int 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))) {
> + mv88e6xxx_reg_lock(chip);
> +
> + err = mv88e6xxx_serdes_power(chip, port, true);
> +
> + if (!err && chip->info->ops->serdes_irq_setup)
> + err = chip->info->ops->serdes_irq_setup(chip, port);
> +
> + mv88e6xxx_reg_unlock(chip);
> +
> + return err;
> + }
> +
> + return 0;
> +}
> +
> +static void mv88e6xxx_port_teardown(struct dsa_switch *ds, int port)
> +{
> + struct mv88e6xxx_chip *chip = ds->priv;
> +
> + if ((dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))) {
> + mv88e6xxx_reg_lock(chip);
> +
> + if (chip->info->ops->serdes_irq_free)
> + chip->info->ops->serdes_irq_free(chip, port);
> +
> + if (mv88e6xxx_serdes_power(chip, port, false))
> + dev_err(chip->dev, "failed to power off SERDES\n");
> +
> + mv88e6xxx_reg_unlock(chip);
> + }
> +}
So now we have mv88e6xxx_setup_port() and mv88e6xxx_port_setup(), which both
setup a port, differently, at different time. This is definitely error prone.
next prev parent reply other threads:[~2019-08-16 16:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 15:08 [PATCH RFC net-next 0/3] mv88e6xxx: setting 2500base-x mode for CPU/DSA port in dts Marek Behún
2019-08-16 15:08 ` [PATCH RFC net-next 1/3] net: dsa: mv88e6xxx: support 2500base-x in SGMII IRQ handler Marek Behún
2019-08-16 15:08 ` [PATCH RFC net-next 2/3] net: dsa: add port_setup/port_teardown methods to DSA ops Marek Behún
2019-08-16 15:08 ` [PATCH RFC net-next 3/3] net: dsa: mv88e6xxx: setup SERDES irq also for CPU/DSA ports Marek Behún
2019-08-16 16:25 ` Vivien Didelot [this message]
2019-08-16 17:05 ` Marek Behun
2019-08-16 23:05 ` Vivien Didelot
2019-08-17 18:03 ` Marek Behun
2019-08-17 18:15 ` Marek Behun
2019-08-17 19:27 ` 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=20190816122552.GC629@t480s.localdomain \
--to=vivien.didelot@gmail.com \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=marek.behun@nic.cz \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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).