summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-04-29 18:29:26 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-04-29 18:29:26 +0000
commitbadd7a3cf29aa6c156ddc0010e68519814b456e5 (patch)
tree46ebff9d060ca0072de72abca93773e42702d8cd
parent3e3a4d3d6b4c9d6e34ea887151db8df98d3db001 (diff)
downloadmtk-20170518-badd7a3cf29aa6c156ddc0010e68519814b456e5.zip
mtk-20170518-badd7a3cf29aa6c156ddc0010e68519814b456e5.tar.gz
mtk-20170518-badd7a3cf29aa6c156ddc0010e68519814b456e5.tar.bz2
linux: rtl836x: add a reset_chip callback to rtl8366_smi_ops
SVN-Revision: 31534
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.c4
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.h1
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366rb.c10
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c10
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8367.c10
5 files changed, 11 insertions, 24 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
index e48ca99..434cbfb 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -1277,6 +1277,10 @@ int rtl8366_smi_init(struct rtl8366_smi *smi)
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);
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
index 8b1a70d..1105ce4 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
@@ -76,6 +76,7 @@ struct rtl8366_vlan_4k {
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);
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
index 020e93a..ea99aa7 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
@@ -1140,14 +1140,7 @@ static int rtl8366rb_mii_write(struct mii_bus *bus, int addr, int reg, u16 val)
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)
@@ -1185,6 +1178,7 @@ 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,
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 7f9680a..2a8b3a7 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -1020,14 +1020,7 @@ static int rtl8366s_mii_write(struct mii_bus *bus, int addr, int reg, u16 val)
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)
@@ -1065,6 +1058,7 @@ 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,
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367.c b/target/linux/generic/files/drivers/net/phy/rtl8367.c
index 917976e..c56a129 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8367.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8367.c
@@ -1637,14 +1637,7 @@ static int rtl8367_mii_write(struct mii_bus *bus, int addr, int reg, u16 val)
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)
@@ -1686,6 +1679,7 @@ 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,