Commit b1b5133d authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-dsa-enable-and-disable-all-ports'



Vivien Didelot says:

====================
net: dsa: enable and disable all ports

The DSA stack currently calls the .port_enable and .port_disable switch
callbacks for slave ports only. However, it is useful to call them for all
port types. For example this allows some drivers to delay the optimization
of power consumption after the switch is setup. This can also help reducing
the setup code of drivers a bit.

The first DSA core patches enable and disable all ports of a switch, regardless
their type. The last mv88e6xxx patches remove redundant code from the driver
setup and the said callbacks, now that they handle SERDES power for all ports.

Changes in v2: do not guard .port_disable for broadcom switches.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d2187f8e fc0bc019
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -510,10 +510,15 @@ EXPORT_SYMBOL(b53_imp_vlan_setup);
int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
{
	struct b53_device *dev = ds->priv;
	unsigned int cpu_port = ds->ports[port].cpu_dp->index;
	unsigned int cpu_port;
	int ret = 0;
	u16 pvlan;

	if (!dsa_is_user_port(ds, port))
		return 0;

	cpu_port = ds->ports[port].cpu_dp->index;

	if (dev->ops->irq_enable)
		ret = dev->ops->irq_enable(dev, port);
	if (ret)
+3 −0
Original line number Diff line number Diff line
@@ -157,6 +157,9 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
	unsigned int i;
	u32 reg;

	if (!dsa_is_user_port(ds, port))
		return 0;

	/* Clear the memory power down */
	reg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);
	reg &= ~P_TXQ_PSM_VDD(port);
+6 −0
Original line number Diff line number Diff line
@@ -1079,6 +1079,9 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
{
	struct lan9303 *chip = ds->priv;

	if (!dsa_is_user_port(ds, port))
		return 0;

	return lan9303_enable_processing_port(chip, port);
}

@@ -1086,6 +1089,9 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port)
{
	struct lan9303 *chip = ds->priv;

	if (!dsa_is_user_port(ds, port))
		return;

	lan9303_disable_processing_port(chip, port);
	lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
}
+6 −0
Original line number Diff line number Diff line
@@ -642,6 +642,9 @@ static int gswip_port_enable(struct dsa_switch *ds, int port,
	struct gswip_priv *priv = ds->priv;
	int err;

	if (!dsa_is_user_port(ds, port))
		return 0;

	if (!dsa_is_cpu_port(ds, port)) {
		err = gswip_add_single_port_br(priv, port, true);
		if (err)
@@ -678,6 +681,9 @@ static void gswip_port_disable(struct dsa_switch *ds, int port)
{
	struct gswip_priv *priv = ds->priv;

	if (!dsa_is_user_port(ds, port))
		return;

	if (!dsa_is_cpu_port(ds, port)) {
		gswip_mdio_mask(priv, GSWIP_MDIO_PHY_LINK_DOWN,
				GSWIP_MDIO_PHY_LINK_MASK,
+6 −0
Original line number Diff line number Diff line
@@ -361,6 +361,9 @@ int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)
{
	struct ksz_device *dev = ds->priv;

	if (!dsa_is_user_port(ds, port))
		return 0;

	/* setup slave port */
	dev->dev_ops->port_setup(dev, port, false);
	if (dev->dev_ops->phy_setup)
@@ -378,6 +381,9 @@ void ksz_disable_port(struct dsa_switch *ds, int port)
{
	struct ksz_device *dev = ds->priv;

	if (!dsa_is_user_port(ds, port))
		return;

	dev->on_ports &= ~(1 << port);
	dev->live_ports &= ~(1 << port);

Loading