goto err_free_sck;
}
+ err = smi->ops->reset_chip(smi);
+ if (err)
+ goto err_free_sck;
+
err = smi->ops->setup(smi);
if (err) {
dev_err(smi->parent, "chip setup failed, err=%d\n", err);
struct rtl8366_smi_ops {
int (*detect)(struct rtl8366_smi *smi);
+ int (*reset_chip)(struct rtl8366_smi *smi);
int (*setup)(struct rtl8366_smi *smi);
int (*mii_read)(struct mii_bus *bus, int addr, int reg);
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;
+ return rtl8366rb_hw_init(smi);
}
static int rtl8366rb_detect(struct rtl8366_smi *smi)
static struct rtl8366_smi_ops rtl8366rb_smi_ops = {
.detect = rtl8366rb_detect,
+ .reset_chip = rtl8366rb_reset_chip,
.setup = rtl8366rb_setup,
.mii_read = rtl8366rb_mii_read,
static int rtl8366s_setup(struct rtl8366_smi *smi)
{
- int ret;
-
- ret = rtl8366s_reset_chip(smi);
- if (ret)
- return ret;
-
- ret = rtl8366s_hw_init(smi);
- return ret;
+ return rtl8366s_hw_init(smi);
}
static int rtl8366s_detect(struct rtl8366_smi *smi)
static struct rtl8366_smi_ops rtl8366s_smi_ops = {
.detect = rtl8366s_detect,
+ .reset_chip = rtl8366s_reset_chip,
.setup = rtl8366s_setup,
.mii_read = rtl8366s_mii_read,
static int rtl8367_setup(struct rtl8366_smi *smi)
{
- int ret;
-
- ret = rtl8367_reset_chip(smi);
- if (ret)
- return ret;
-
- ret = rtl8367_hw_init(smi);
- return ret;
+ return rtl8367_hw_init(smi);
}
static int rtl8367_detect(struct rtl8366_smi *smi)
static struct rtl8366_smi_ops rtl8367_smi_ops = {
.detect = rtl8367_detect,
+ .reset_chip = rtl8367_reset_chip,
.setup = rtl8367_setup,
.mii_read = rtl8367_mii_read,