diff options
-rw-r--r-- | drivers/net/usb/r8152.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index d7f20a9b4b9a..0da72d39b4f9 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #define NETNEXT_VERSION "08" | 31 | #define NETNEXT_VERSION "08" |
32 | 32 | ||
33 | /* Information for net */ | 33 | /* Information for net */ |
34 | #define NET_VERSION "4" | 34 | #define NET_VERSION "5" |
35 | 35 | ||
36 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION | 36 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION |
37 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" | 37 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
@@ -624,6 +624,7 @@ struct r8152 { | |||
624 | int (*eee_get)(struct r8152 *, struct ethtool_eee *); | 624 | int (*eee_get)(struct r8152 *, struct ethtool_eee *); |
625 | int (*eee_set)(struct r8152 *, struct ethtool_eee *); | 625 | int (*eee_set)(struct r8152 *, struct ethtool_eee *); |
626 | bool (*in_nway)(struct r8152 *); | 626 | bool (*in_nway)(struct r8152 *); |
627 | void (*autosuspend_en)(struct r8152 *tp, bool enable); | ||
627 | } rtl_ops; | 628 | } rtl_ops; |
628 | 629 | ||
629 | int intr_interval; | 630 | int intr_interval; |
@@ -2408,9 +2409,6 @@ static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) | |||
2408 | if (enable) { | 2409 | if (enable) { |
2409 | u32 ocp_data; | 2410 | u32 ocp_data; |
2410 | 2411 | ||
2411 | r8153_u1u2en(tp, false); | ||
2412 | r8153_u2p3en(tp, false); | ||
2413 | |||
2414 | __rtl_set_wol(tp, WAKE_ANY); | 2412 | __rtl_set_wol(tp, WAKE_ANY); |
2415 | 2413 | ||
2416 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); | 2414 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_CONFIG); |
@@ -2432,7 +2430,17 @@ static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable) | |||
2432 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG34, ocp_data); | 2430 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_CONFIG34, ocp_data); |
2433 | 2431 | ||
2434 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); | 2432 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CRWECR, CRWECR_NORAML); |
2433 | } | ||
2434 | } | ||
2435 | 2435 | ||
2436 | static void rtl8153_runtime_enable(struct r8152 *tp, bool enable) | ||
2437 | { | ||
2438 | rtl_runtime_suspend_enable(tp, enable); | ||
2439 | |||
2440 | if (enable) { | ||
2441 | r8153_u1u2en(tp, false); | ||
2442 | r8153_u2p3en(tp, false); | ||
2443 | } else { | ||
2436 | r8153_u2p3en(tp, true); | 2444 | r8153_u2p3en(tp, true); |
2437 | r8153_u1u2en(tp, true); | 2445 | r8153_u1u2en(tp, true); |
2438 | } | 2446 | } |
@@ -3523,7 +3531,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
3523 | napi_disable(&tp->napi); | 3531 | napi_disable(&tp->napi); |
3524 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3532 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3525 | rtl_stop_rx(tp); | 3533 | rtl_stop_rx(tp); |
3526 | rtl_runtime_suspend_enable(tp, true); | 3534 | tp->rtl_ops.autosuspend_en(tp, true); |
3527 | } else { | 3535 | } else { |
3528 | cancel_delayed_work_sync(&tp->schedule); | 3536 | cancel_delayed_work_sync(&tp->schedule); |
3529 | tp->rtl_ops.down(tp); | 3537 | tp->rtl_ops.down(tp); |
@@ -3549,7 +3557,7 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3549 | 3557 | ||
3550 | if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { | 3558 | if (netif_running(tp->netdev) && tp->netdev->flags & IFF_UP) { |
3551 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3559 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3552 | rtl_runtime_suspend_enable(tp, false); | 3560 | tp->rtl_ops.autosuspend_en(tp, false); |
3553 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3561 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
3554 | napi_disable(&tp->napi); | 3562 | napi_disable(&tp->napi); |
3555 | set_bit(WORK_ENABLE, &tp->flags); | 3563 | set_bit(WORK_ENABLE, &tp->flags); |
@@ -3568,7 +3576,7 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3568 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3576 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
3569 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3577 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3570 | if (tp->netdev->flags & IFF_UP) | 3578 | if (tp->netdev->flags & IFF_UP) |
3571 | rtl_runtime_suspend_enable(tp, false); | 3579 | tp->rtl_ops.autosuspend_en(tp, false); |
3572 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3580 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
3573 | } | 3581 | } |
3574 | 3582 | ||
@@ -4148,6 +4156,7 @@ static int rtl_ops_init(struct r8152 *tp) | |||
4148 | ops->eee_get = r8152_get_eee; | 4156 | ops->eee_get = r8152_get_eee; |
4149 | ops->eee_set = r8152_set_eee; | 4157 | ops->eee_set = r8152_set_eee; |
4150 | ops->in_nway = rtl8152_in_nway; | 4158 | ops->in_nway = rtl8152_in_nway; |
4159 | ops->autosuspend_en = rtl_runtime_suspend_enable; | ||
4151 | break; | 4160 | break; |
4152 | 4161 | ||
4153 | case RTL_VER_03: | 4162 | case RTL_VER_03: |
@@ -4163,6 +4172,7 @@ static int rtl_ops_init(struct r8152 *tp) | |||
4163 | ops->eee_get = r8153_get_eee; | 4172 | ops->eee_get = r8153_get_eee; |
4164 | ops->eee_set = r8153_set_eee; | 4173 | ops->eee_set = r8153_set_eee; |
4165 | ops->in_nway = rtl8153_in_nway; | 4174 | ops->in_nway = rtl8153_in_nway; |
4175 | ops->autosuspend_en = rtl8153_runtime_enable; | ||
4166 | break; | 4176 | break; |
4167 | 4177 | ||
4168 | default: | 4178 | default: |