summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2016-06-13 11:49:37 +0200
committerDavid S. Miller <davem@davemloft.net>2016-06-15 07:37:48 +0200
commit9d21c0d83ea3def89b9cd33222b1c44c1af44b4d (patch)
tree75edc64b67ddbf06b29e09dbbdf566dec518323f /drivers/net/usb
parentr8152: move the settings of PHY to a work queue (diff)
downloadlinux-9d21c0d83ea3def89b9cd33222b1c44c1af44b4d.tar.xz
linux-9d21c0d83ea3def89b9cd33222b1c44c1af44b4d.zip
r8152: move the setting for the default speed
Move calling set_speed() from open() to rtl_hw_phy_work_func_t(). Then, we would set the default speed only for first initialization or after resuming. Besides, the set_speed() could handle the flag of PHY_RESET which would be set in rtl_ops.hw_phy_cfg(). Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/r8152.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 46fe9a7dc996..dcdc4fa50d31 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3051,6 +3051,10 @@ static void rtl_hw_phy_work_func_t(struct work_struct *work)
tp->rtl_ops.hw_phy_cfg(tp);
+ rtl8152_set_speed(tp, AUTONEG_ENABLE,
+ tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
+ DUPLEX_FULL);
+
mutex_unlock(&tp->control);
usb_autopm_put_interface(tp->intf);
@@ -3104,9 +3108,6 @@ static int rtl8152_open(struct net_device *netdev)
tp->rtl_ops.up(tp);
- rtl8152_set_speed(tp, AUTONEG_ENABLE,
- tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
- DUPLEX_FULL);
netif_carrier_off(netdev);
netif_start_queue(netdev);
set_bit(WORK_ENABLE, &tp->flags);
@@ -3549,10 +3550,6 @@ static int rtl8152_resume(struct usb_interface *intf)
napi_enable(&tp->napi);
} else {
tp->rtl_ops.up(tp);
- rtl8152_set_speed(tp, AUTONEG_ENABLE,
- tp->mii.supports_gmii ?
- SPEED_1000 : SPEED_100,
- DUPLEX_FULL);
netif_carrier_off(tp->netdev);
set_bit(WORK_ENABLE, &tp->flags);
}