return 0;
}
-static int rtl8366rb_hw_init(struct rtl8366_smi *smi)
+static int rtl8366rb_setup(struct rtl8366_smi *smi)
{
int err;
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_hw_init(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,
};
return err;
}
-static int rtl8366rb_setup(struct rtl8366_smi *smi)
-{
- int ret;
-
- ret = rtl8366rb_reset_chip(smi);
- if (ret)
- return ret;
-
- ret = rtl8366rb_hw_init(smi);
- return ret;
-}
-
static int rtl8366rb_detect(struct rtl8366_smi *smi)
{
u32 chip_id = 0;
static struct rtl8366_smi_ops rtl8366rb_smi_ops = {
.detect = rtl8366rb_detect,
+ .reset_chip = rtl8366rb_reset_chip,
.setup = rtl8366rb_setup,
.mii_read = rtl8366rb_mii_read,
smi->gpio_sda = pdata->gpio_sda;
smi->gpio_sck = pdata->gpio_sck;
+ smi->hw_reset = pdata->hw_reset;
+
smi->clk_delay = 10;
smi->cmd_read = 0xa9;
smi->cmd_write = 0xa8;