aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/dsa/mv88e6xxx.c39
-rw-r--r--drivers/net/dsa/mv88e6xxx.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 6496beb74510..2052e51edd5d 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -700,6 +700,45 @@ int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
700 return 0; 700 return 0;
701} 701}
702 702
703int mv88e6xxx_setup_port_common(struct dsa_switch *ds, int port)
704{
705 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
706 int ret, reg;
707
708 mutex_lock(&ps->smi_mutex);
709
710 /* Port Control 1: disable trunking. Also, if this is the
711 * CPU port, enable learn messages to be sent to this port.
712 */
713 ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), 0x05,
714 dsa_is_cpu_port(ds, port) ? 0x8000 : 0x0000);
715 if (ret)
716 goto abort;
717
718 /* Port based VLAN map: give each port its own address
719 * database, allow the CPU port to talk to each of the 'real'
720 * ports, and allow each of the 'real' ports to only talk to
721 * the upstream port.
722 */
723 reg = (port & 0xf) << 12;
724 if (dsa_is_cpu_port(ds, port))
725 reg |= ds->phys_port_mask;
726 else
727 reg |= 1 << dsa_upstream_port(ds);
728
729 ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), 0x06, reg);
730 if (ret)
731 goto abort;
732
733 /* Default VLAN ID and priority: don't set a default VLAN
734 * ID, and set the default packet priority to zero.
735 */
736 ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), 0x07, 0x0000);
737abort:
738 mutex_unlock(&ps->smi_mutex);
739 return ret;
740}
741
703int mv88e6xxx_setup_common(struct dsa_switch *ds) 742int mv88e6xxx_setup_common(struct dsa_switch *ds)
704{ 743{
705 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); 744 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index a02d95a9b313..a4df4968594e 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -57,6 +57,7 @@ struct mv88e6xxx_hw_stat {
57 int reg; 57 int reg;
58}; 58};
59 59
60int mv88e6xxx_setup_port_common(struct dsa_switch *ds, int port);
60int mv88e6xxx_setup_common(struct dsa_switch *ds); 61int mv88e6xxx_setup_common(struct dsa_switch *ds);
61int __mv88e6xxx_reg_read(struct mii_bus *bus, int sw_addr, int addr, int reg); 62int __mv88e6xxx_reg_read(struct mii_bus *bus, int sw_addr, int addr, int reg);
62int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg); 63int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg);