mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 00:51:35 +00:00
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: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4b5baca040
commit
c2ac4d2ac5
1 changed files with 50 additions and 42 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue