mdiobus_free(smi->mii_bus);
}
+int rtl8366_sw_reset_switch(struct switch_dev *dev)
+{
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+ int err;
+
+ err = smi->ops->reset_chip(smi);
+ if (err)
+ return err;
+
+ err = smi->ops->setup(smi);
+ if (err)
+ return err;
+
+ err = rtl8366_reset_vlan(smi);
+ if (err)
+ return err;
+
+ err = rtl8366_enable_vlan(smi, 1);
+ if (err)
+ return err;
+
+ return rtl8366_enable_all_ports(smi, 1);
+}
+EXPORT_SYMBOL_GPL(rtl8366_sw_reset_switch);
+
int rtl8366_sw_get_port_pvid(struct switch_dev *dev, int port, int *val)
{
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
return container_of(sw, struct rtl8366_smi, sw_dev);
}
+int rtl8366_sw_reset_switch(struct switch_dev *dev);
int rtl8366_sw_get_port_pvid(struct switch_dev *dev, int port, int *val);
int rtl8366_sw_set_port_pvid(struct switch_dev *dev, int port, int val);
int rtl8366_sw_get_port_mib(struct switch_dev *dev,
RTL8366RB_MIB_CTRL_PORT_RESET(val->port_vlan));
}
-static int rtl8366rb_sw_reset_switch(struct switch_dev *dev)
-{
- struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- int err;
-
- err = rtl8366rb_reset_chip(smi);
- if (err)
- return err;
-
- err = rtl8366rb_setup(smi);
- if (err)
- return err;
-
- err = rtl8366_reset_vlan(smi);
- if (err)
- return err;
-
- err = rtl8366_enable_vlan(smi, 1);
- if (err)
- return err;
-
- return rtl8366_enable_all_ports(smi, 1);
-}
-
static struct switch_attr rtl8366rb_globals[] = {
{
.type = SWITCH_TYPE_INT,
.set_vlan_ports = rtl8366_sw_set_vlan_ports,
.get_port_pvid = rtl8366_sw_get_port_pvid,
.set_port_pvid = rtl8366_sw_set_port_pvid,
- .reset_switch = rtl8366rb_sw_reset_switch,
+ .reset_switch = rtl8366_sw_reset_switch,
.get_port_link = rtl8366rb_sw_get_port_link,
};
0, (1 << (val->port_vlan + 3)));
}
-static int rtl8366s_sw_reset_switch(struct switch_dev *dev)
-{
- struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- int err;
-
- err = rtl8366s_reset_chip(smi);
- if (err)
- return err;
-
- err = rtl8366s_setup(smi);
- if (err)
- return err;
-
- err = rtl8366_reset_vlan(smi);
- if (err)
- return err;
-
- err = rtl8366_enable_vlan(smi, 1);
- if (err)
- return err;
-
- return rtl8366_enable_all_ports(smi, 1);
-}
-
static struct switch_attr rtl8366s_globals[] = {
{
.type = SWITCH_TYPE_INT,
.set_vlan_ports = rtl8366_sw_set_vlan_ports,
.get_port_pvid = rtl8366_sw_get_port_pvid,
.set_port_pvid = rtl8366_sw_set_port_pvid,
- .reset_switch = rtl8366s_sw_reset_switch,
+ .reset_switch = rtl8366_sw_reset_switch,
.get_port_link = rtl8366s_sw_get_port_link,
};
RTL8367_MIB_CTRL_PORT_RESET_MASK(port % 8));
}
-static int rtl8367_sw_reset_switch(struct switch_dev *dev)
-{
- struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
- int err;
-
- err = rtl8367_reset_chip(smi);
- if (err)
- return err;
-
-
- err = rtl8367_setup(smi);
- if (err)
- return err;
-
- err = rtl8366_reset_vlan(smi);
- if (err)
- return err;
-
- err = rtl8366_enable_vlan(smi, 1);
- if (err)
- return err;
-
- return rtl8366_enable_all_ports(smi, 1);
-}
-
static struct switch_attr rtl8367_globals[] = {
{
.type = SWITCH_TYPE_INT,
.set_vlan_ports = rtl8366_sw_set_vlan_ports,
.get_port_pvid = rtl8366_sw_get_port_pvid,
.set_port_pvid = rtl8366_sw_set_port_pvid,
- .reset_switch = rtl8367_sw_reset_switch,
+ .reset_switch = rtl8366_sw_reset_switch,
.get_port_link = rtl8367_sw_get_port_link,
};