提交 2dd436da 编写于 作者: H hayeswang 提交者: David S. Miller

r8152: move enabling PHY

Move enabling PHY to init(), otherwise some other settings may fail.
Signed-off-by: NHayes Wang <hayeswang@realtek.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e6449539
...@@ -2632,14 +2632,6 @@ static void rtl8152_disable(struct r8152 *tp) ...@@ -2632,14 +2632,6 @@ static void rtl8152_disable(struct r8152 *tp)
static void r8152b_hw_phy_cfg(struct r8152 *tp) static void r8152b_hw_phy_cfg(struct r8152 *tp)
{ {
u16 data;
data = r8152_mdio_read(tp, MII_BMCR);
if (data & BMCR_PDOWN) {
data &= ~BMCR_PDOWN;
r8152_mdio_write(tp, MII_BMCR, data);
}
set_bit(PHY_RESET, &tp->flags); set_bit(PHY_RESET, &tp->flags);
} }
...@@ -2818,16 +2810,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) ...@@ -2818,16 +2810,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp)
u32 ocp_data; u32 ocp_data;
u16 data; u16 data;
if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 ||
tp->version == RTL_VER_05)
ocp_reg_write(tp, OCP_ADC_CFG, CKADSEL_L | ADC_EN | EN_EMI_L);
data = r8152_mdio_read(tp, MII_BMCR);
if (data & BMCR_PDOWN) {
data &= ~BMCR_PDOWN;
r8152_mdio_write(tp, MII_BMCR, data);
}
if (tp->version == RTL_VER_03) { if (tp->version == RTL_VER_03) {
data = ocp_reg_read(tp, OCP_EEE_CFG); data = ocp_reg_read(tp, OCP_EEE_CFG);
data &= ~CTAP_SHORT_EN; data &= ~CTAP_SHORT_EN;
...@@ -3355,10 +3337,17 @@ static void rtl_tally_reset(struct r8152 *tp) ...@@ -3355,10 +3337,17 @@ static void rtl_tally_reset(struct r8152 *tp)
static void r8152b_init(struct r8152 *tp) static void r8152b_init(struct r8152 *tp)
{ {
u32 ocp_data; u32 ocp_data;
u16 data;
if (test_bit(RTL8152_UNPLUG, &tp->flags)) if (test_bit(RTL8152_UNPLUG, &tp->flags))
return; return;
data = r8152_mdio_read(tp, MII_BMCR);
if (data & BMCR_PDOWN) {
data &= ~BMCR_PDOWN;
r8152_mdio_write(tp, MII_BMCR, data);
}
r8152_aldps_en(tp, false); r8152_aldps_en(tp, false);
if (tp->version == RTL_VER_01) { if (tp->version == RTL_VER_01) {
...@@ -3394,6 +3383,7 @@ static void r8152b_init(struct r8152 *tp) ...@@ -3394,6 +3383,7 @@ static void r8152b_init(struct r8152 *tp)
static void r8153_init(struct r8152 *tp) static void r8153_init(struct r8152 *tp)
{ {
u32 ocp_data; u32 ocp_data;
u16 data;
int i; int i;
if (test_bit(RTL8152_UNPLUG, &tp->flags)) if (test_bit(RTL8152_UNPLUG, &tp->flags))
...@@ -3416,6 +3406,23 @@ static void r8153_init(struct r8152 *tp) ...@@ -3416,6 +3406,23 @@ static void r8153_init(struct r8152 *tp)
msleep(20); msleep(20);
} }
if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 ||
tp->version == RTL_VER_05)
ocp_reg_write(tp, OCP_ADC_CFG, CKADSEL_L | ADC_EN | EN_EMI_L);
data = r8152_mdio_read(tp, MII_BMCR);
if (data & BMCR_PDOWN) {
data &= ~BMCR_PDOWN;
r8152_mdio_write(tp, MII_BMCR, data);
}
for (i = 0; i < 500; i++) {
ocp_data = ocp_reg_read(tp, OCP_PHY_STATUS) & PHY_STAT_MASK;
if (ocp_data == PHY_STAT_LAN_ON)
break;
msleep(20);
}
usb_disable_lpm(tp->udev); usb_disable_lpm(tp->udev);
r8153_u2p3en(tp, false); r8153_u2p3en(tp, false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册