[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190816122552.GC629@t480s.localdomain>
Date: Fri, 16 Aug 2019 12:25:52 -0400
From: Vivien Didelot <vivien.didelot@...il.com>
To: Marek Behún <marek.behun@....cz>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
Vladimir Oltean <olteanv@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Marek Behún <marek.behun@....cz>
Subject: Re: [PATCH RFC net-next 3/3] net: dsa: mv88e6xxx: setup SERDES irq
also for CPU/DSA ports
On Fri, 16 Aug 2019 17:08:34 +0200, Marek Behún <marek.behun@....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.
Powered by blists - more mailing lists