Commit aa7e26b6 authored by hayeswang's avatar hayeswang Committed by David S. Miller

r8152: save the speed

The user may change the speed. Use it to replace the default one.
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d21c0d8
...@@ -628,8 +628,11 @@ struct r8152 { ...@@ -628,8 +628,11 @@ struct r8152 {
u32 tx_qlen; u32 tx_qlen;
u32 coalesce; u32 coalesce;
u16 ocp_base; u16 ocp_base;
u16 speed;
u8 *intr_buff; u8 *intr_buff;
u8 version; u8 version;
u8 duplex;
u8 autoneg;
}; };
enum rtl_version { enum rtl_version {
...@@ -3051,9 +3054,7 @@ static void rtl_hw_phy_work_func_t(struct work_struct *work) ...@@ -3051,9 +3054,7 @@ static void rtl_hw_phy_work_func_t(struct work_struct *work)
tp->rtl_ops.hw_phy_cfg(tp); tp->rtl_ops.hw_phy_cfg(tp);
rtl8152_set_speed(tp, AUTONEG_ENABLE, rtl8152_set_speed(tp, tp->autoneg, tp->speed, tp->duplex);
tp->mii.supports_gmii ? SPEED_1000 : SPEED_100,
DUPLEX_FULL);
mutex_unlock(&tp->control); mutex_unlock(&tp->control);
...@@ -3679,6 +3680,11 @@ static int rtl8152_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -3679,6 +3680,11 @@ static int rtl8152_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
mutex_lock(&tp->control); mutex_lock(&tp->control);
ret = rtl8152_set_speed(tp, cmd->autoneg, cmd->speed, cmd->duplex); ret = rtl8152_set_speed(tp, cmd->autoneg, cmd->speed, cmd->duplex);
if (!ret) {
tp->autoneg = cmd->autoneg;
tp->speed = cmd->speed;
tp->duplex = cmd->duplex;
}
mutex_unlock(&tp->control); mutex_unlock(&tp->control);
...@@ -4239,6 +4245,10 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -4239,6 +4245,10 @@ static int rtl8152_probe(struct usb_interface *intf,
break; break;
} }
tp->autoneg = AUTONEG_ENABLE;
tp->speed = tp->mii.supports_gmii ? SPEED_1000 : SPEED_100;
tp->duplex = DUPLEX_FULL;
intf->needs_remote_wakeup = 1; intf->needs_remote_wakeup = 1;
tp->rtl_ops.init(tp); tp->rtl_ops.init(tp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment