Commit c2ac4d2a authored by Michael Grzeschik's avatar Michael Grzeschik Committed by David S. Miller

net: dsa: microchip: ksz8795: move cpu_select_interface to extra function

This patch moves the cpu interface selection code to a individual
function specific for ksz8795. It will make it simpler to customize the
code path for different switches supported by this driver.
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b5baca0
...@@ -909,26 +909,11 @@ static void ksz8_port_mirror_del(struct dsa_switch *ds, int port, ...@@ -909,26 +909,11 @@ static void ksz8_port_mirror_del(struct dsa_switch *ds, int port,
PORT_MIRROR_SNIFFER, false); PORT_MIRROR_SNIFFER, false);
} }
static void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port) static void ksz8795_cpu_interface_select(struct ksz_device *dev, int port)
{ {
struct ksz_port *p = &dev->ports[port]; struct ksz_port *p = &dev->ports[port];
u8 data8, member; u8 data8;
/* enable broadcast storm limit */
ksz_port_cfg(dev, port, P_BCAST_STORM_CTRL, PORT_BROADCAST_STORM, true);
ksz8795_set_prio_queue(dev, port, 4);
/* disable DiffServ priority */
ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_DIFFSERV_ENABLE, false);
/* replace priority */
ksz_port_cfg(dev, port, P_802_1P_CTRL, PORT_802_1P_REMAPPING, false);
/* enable 802.1p priority */
ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);
if (cpu_port) {
if (!p->interface && dev->compat_interface) { if (!p->interface && dev->compat_interface) {
dev_warn(dev->dev, dev_warn(dev->dev,
"Using legacy switch \"phy-mode\" property, because it is missing on port %d node. " "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
...@@ -970,6 +955,29 @@ static void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port) ...@@ -970,6 +955,29 @@ static void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port)
} }
ksz_write8(dev, REG_PORT_5_CTRL_6, data8); ksz_write8(dev, REG_PORT_5_CTRL_6, data8);
p->phydev.duplex = 1; p->phydev.duplex = 1;
}
static void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port)
{
struct ksz_port *p = &dev->ports[port];
u8 member;
/* enable broadcast storm limit */
ksz_port_cfg(dev, port, P_BCAST_STORM_CTRL, PORT_BROADCAST_STORM, true);
ksz8795_set_prio_queue(dev, port, 4);
/* disable DiffServ priority */
ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_DIFFSERV_ENABLE, false);
/* replace priority */
ksz_port_cfg(dev, port, P_802_1P_CTRL, PORT_802_1P_REMAPPING, false);
/* enable 802.1p priority */
ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);
if (cpu_port) {
ksz8795_cpu_interface_select(dev, port);
member = dev->port_mask; member = dev->port_mask;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment