Skip to content

Commit bc2bebe

Browse files
jmbergdavem330
authored andcommitted
alx: remove WoL support
Unfortunately, WoL is broken and the system will immediately resume after suspending, and I can't seem to figure out why. Remove WoL support until the issue can be found. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0c1072a commit bc2bebe

4 files changed

Lines changed: 15 additions & 323 deletions

File tree

‎drivers/net/ethernet/atheros/alx/ethtool.c‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -201,48 +201,12 @@ static void alx_set_msglevel(struct net_device *netdev, u32 data)
201201
alx->msg_enable = data;
202202
}
203203

204-
static void alx_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
205-
{
206-
struct alx_priv *alx = netdev_priv(netdev);
207-
struct alx_hw *hw = &alx->hw;
208-
209-
wol->supported = WAKE_MAGIC | WAKE_PHY;
210-
wol->wolopts = 0;
211-
212-
if (hw->sleep_ctrl & ALX_SLEEP_WOL_MAGIC)
213-
wol->wolopts |= WAKE_MAGIC;
214-
if (hw->sleep_ctrl & ALX_SLEEP_WOL_PHY)
215-
wol->wolopts |= WAKE_PHY;
216-
}
217-
218-
static int alx_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
219-
{
220-
struct alx_priv *alx = netdev_priv(netdev);
221-
struct alx_hw *hw = &alx->hw;
222-
223-
if (wol->wolopts & ~(WAKE_MAGIC | WAKE_PHY))
224-
return -EOPNOTSUPP;
225-
226-
hw->sleep_ctrl = 0;
227-
228-
if (wol->wolopts & WAKE_MAGIC)
229-
hw->sleep_ctrl |= ALX_SLEEP_WOL_MAGIC;
230-
if (wol->wolopts & WAKE_PHY)
231-
hw->sleep_ctrl |= ALX_SLEEP_WOL_PHY;
232-
233-
device_set_wakeup_enable(&alx->hw.pdev->dev, hw->sleep_ctrl);
234-
235-
return 0;
236-
}
237-
238204
const struct ethtool_ops alx_ethtool_ops = {
239205
.get_settings = alx_get_settings,
240206
.set_settings = alx_set_settings,
241207
.get_pauseparam = alx_get_pauseparam,
242208
.set_pauseparam = alx_set_pauseparam,
243209
.get_msglevel = alx_get_msglevel,
244210
.set_msglevel = alx_set_msglevel,
245-
.get_wol = alx_get_wol,
246-
.set_wol = alx_set_wol,
247211
.get_link = ethtool_op_get_link,
248212
};

‎drivers/net/ethernet/atheros/alx/hw.c‎

Lines changed: 0 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,6 @@ void alx_set_macaddr(struct alx_hw *hw, const u8 *addr)
332332
alx_write_mem32(hw, ALX_STAD1, val);
333333
}
334334

335-
static void alx_enable_osc(struct alx_hw *hw)
336-
{
337-
u32 val;
338-
339-
/* rising edge */
340-
val = alx_read_mem32(hw, ALX_MISC);
341-
alx_write_mem32(hw, ALX_MISC, val & ~ALX_MISC_INTNLOSC_OPEN);
342-
alx_write_mem32(hw, ALX_MISC, val | ALX_MISC_INTNLOSC_OPEN);
343-
}
344-
345335
static void alx_reset_osc(struct alx_hw *hw, u8 rev)
346336
{
347337
u32 val, val2;
@@ -858,66 +848,6 @@ void alx_post_phy_link(struct alx_hw *hw)
858848
}
859849
}
860850

861-
862-
/* NOTE:
863-
* 1. phy link must be established before calling this function
864-
* 2. wol option (pattern,magic,link,etc.) is configed before call it.
865-
*/
866-
int alx_pre_suspend(struct alx_hw *hw, int speed, u8 duplex)
867-
{
868-
u32 master, mac, phy, val;
869-
int err = 0;
870-
871-
master = alx_read_mem32(hw, ALX_MASTER);
872-
master &= ~ALX_MASTER_PCLKSEL_SRDS;
873-
mac = hw->rx_ctrl;
874-
/* 10/100 half */
875-
ALX_SET_FIELD(mac, ALX_MAC_CTRL_SPEED, ALX_MAC_CTRL_SPEED_10_100);
876-
mac &= ~(ALX_MAC_CTRL_FULLD | ALX_MAC_CTRL_RX_EN | ALX_MAC_CTRL_TX_EN);
877-
878-
phy = alx_read_mem32(hw, ALX_PHY_CTRL);
879-
phy &= ~(ALX_PHY_CTRL_DSPRST_OUT | ALX_PHY_CTRL_CLS);
880-
phy |= ALX_PHY_CTRL_RST_ANALOG | ALX_PHY_CTRL_HIB_PULSE |
881-
ALX_PHY_CTRL_HIB_EN;
882-
883-
/* without any activity */
884-
if (!(hw->sleep_ctrl & ALX_SLEEP_ACTIVE)) {
885-
err = alx_write_phy_reg(hw, ALX_MII_IER, 0);
886-
if (err)
887-
return err;
888-
phy |= ALX_PHY_CTRL_IDDQ | ALX_PHY_CTRL_POWER_DOWN;
889-
} else {
890-
if (hw->sleep_ctrl & (ALX_SLEEP_WOL_MAGIC | ALX_SLEEP_CIFS))
891-
mac |= ALX_MAC_CTRL_RX_EN | ALX_MAC_CTRL_BRD_EN;
892-
if (hw->sleep_ctrl & ALX_SLEEP_CIFS)
893-
mac |= ALX_MAC_CTRL_TX_EN;
894-
if (duplex == DUPLEX_FULL)
895-
mac |= ALX_MAC_CTRL_FULLD;
896-
if (speed == SPEED_1000)
897-
ALX_SET_FIELD(mac, ALX_MAC_CTRL_SPEED,
898-
ALX_MAC_CTRL_SPEED_1000);
899-
phy |= ALX_PHY_CTRL_DSPRST_OUT;
900-
err = alx_write_phy_ext(hw, ALX_MIIEXT_ANEG,
901-
ALX_MIIEXT_S3DIG10,
902-
ALX_MIIEXT_S3DIG10_SL);
903-
if (err)
904-
return err;
905-
}
906-
907-
alx_enable_osc(hw);
908-
hw->rx_ctrl = mac;
909-
alx_write_mem32(hw, ALX_MASTER, master);
910-
alx_write_mem32(hw, ALX_MAC_CTRL, mac);
911-
alx_write_mem32(hw, ALX_PHY_CTRL, phy);
912-
913-
/* set val of PDLL D3PLLOFF */
914-
val = alx_read_mem32(hw, ALX_PDLL_TRNS1);
915-
val |= ALX_PDLL_TRNS1_D3PLLOFF_EN;
916-
alx_write_mem32(hw, ALX_PDLL_TRNS1, val);
917-
918-
return 0;
919-
}
920-
921851
bool alx_phy_configured(struct alx_hw *hw)
922852
{
923853
u32 cfg, hw_cfg;
@@ -990,26 +920,6 @@ int alx_clear_phy_intr(struct alx_hw *hw)
990920
return alx_read_phy_reg(hw, ALX_MII_ISR, &isr);
991921
}
992922

993-
int alx_config_wol(struct alx_hw *hw)
994-
{
995-
u32 wol = 0;
996-
int err = 0;
997-
998-
/* turn on magic packet event */
999-
if (hw->sleep_ctrl & ALX_SLEEP_WOL_MAGIC)
1000-
wol |= ALX_WOL0_MAGIC_EN | ALX_WOL0_PME_MAGIC_EN;
1001-
1002-
/* turn on link up event */
1003-
if (hw->sleep_ctrl & ALX_SLEEP_WOL_PHY) {
1004-
wol |= ALX_WOL0_LINK_EN | ALX_WOL0_PME_LINK;
1005-
/* only link up can wake up */
1006-
err = alx_write_phy_reg(hw, ALX_MII_IER, ALX_IER_LINK_UP);
1007-
}
1008-
alx_write_mem32(hw, ALX_WOL0, wol);
1009-
1010-
return err;
1011-
}
1012-
1013923
void alx_disable_rss(struct alx_hw *hw)
1014924
{
1015925
u32 ctrl = alx_read_mem32(hw, ALX_RXQ0);
@@ -1121,71 +1031,6 @@ void alx_configure_basic(struct alx_hw *hw)
11211031
alx_write_mem32(hw, ALX_WRR, val);
11221032
}
11231033

1124-
int alx_select_powersaving_speed(struct alx_hw *hw, int *speed, u8 *duplex)
1125-
{
1126-
int i, err;
1127-
u16 lpa;
1128-
1129-
err = alx_read_phy_link(hw);
1130-
if (err)
1131-
return err;
1132-
1133-
if (hw->link_speed == SPEED_UNKNOWN) {
1134-
*speed = SPEED_UNKNOWN;
1135-
*duplex = DUPLEX_UNKNOWN;
1136-
return 0;
1137-
}
1138-
1139-
err = alx_read_phy_reg(hw, MII_LPA, &lpa);
1140-
if (err)
1141-
return err;
1142-
1143-
if (!(lpa & LPA_LPACK)) {
1144-
*speed = hw->link_speed;
1145-
return 0;
1146-
}
1147-
1148-
if (lpa & LPA_10FULL) {
1149-
*speed = SPEED_10;
1150-
*duplex = DUPLEX_FULL;
1151-
} else if (lpa & LPA_10HALF) {
1152-
*speed = SPEED_10;
1153-
*duplex = DUPLEX_HALF;
1154-
} else if (lpa & LPA_100FULL) {
1155-
*speed = SPEED_100;
1156-
*duplex = DUPLEX_FULL;
1157-
} else {
1158-
*speed = SPEED_100;
1159-
*duplex = DUPLEX_HALF;
1160-
}
1161-
1162-
if (*speed == hw->link_speed && *duplex == hw->duplex)
1163-
return 0;
1164-
err = alx_write_phy_reg(hw, ALX_MII_IER, 0);
1165-
if (err)
1166-
return err;
1167-
err = alx_setup_speed_duplex(hw, alx_speed_to_ethadv(*speed, *duplex) |
1168-
ADVERTISED_Autoneg, ALX_FC_ANEG |
1169-
ALX_FC_RX | ALX_FC_TX);
1170-
if (err)
1171-
return err;
1172-
1173-
/* wait for linkup */
1174-
for (i = 0; i < ALX_MAX_SETUP_LNK_CYCLE; i++) {
1175-
msleep(100);
1176-
1177-
err = alx_read_phy_link(hw);
1178-
if (err < 0)
1179-
return err;
1180-
if (hw->link_speed != SPEED_UNKNOWN)
1181-
break;
1182-
}
1183-
if (i == ALX_MAX_SETUP_LNK_CYCLE)
1184-
return -ETIMEDOUT;
1185-
1186-
return 0;
1187-
}
1188-
11891034
bool alx_get_phy_info(struct alx_hw *hw)
11901035
{
11911036
u16 devs1, devs2;

‎drivers/net/ethernet/atheros/alx/hw.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ struct alx_hw {
418418
u8 flowctrl;
419419
u32 adv_cfg;
420420

421-
u32 sleep_ctrl;
422-
423421
spinlock_t mdio_lock;
424422
struct mdio_if_info mdio;
425423
u16 phy_id[2];
@@ -479,22 +477,19 @@ void alx_reset_pcie(struct alx_hw *hw);
479477
void alx_enable_aspm(struct alx_hw *hw, bool l0s_en, bool l1_en);
480478
int alx_setup_speed_duplex(struct alx_hw *hw, u32 ethadv, u8 flowctrl);
481479
void alx_post_phy_link(struct alx_hw *hw);
482-
int alx_pre_suspend(struct alx_hw *hw, int speed, u8 duplex);
483480
int alx_read_phy_reg(struct alx_hw *hw, u16 reg, u16 *phy_data);
484481
int alx_write_phy_reg(struct alx_hw *hw, u16 reg, u16 phy_data);
485482
int alx_read_phy_ext(struct alx_hw *hw, u8 dev, u16 reg, u16 *pdata);
486483
int alx_write_phy_ext(struct alx_hw *hw, u8 dev, u16 reg, u16 data);
487484
int alx_read_phy_link(struct alx_hw *hw);
488485
int alx_clear_phy_intr(struct alx_hw *hw);
489-
int alx_config_wol(struct alx_hw *hw);
490486
void alx_cfg_mac_flowcontrol(struct alx_hw *hw, u8 fc);
491487
void alx_start_mac(struct alx_hw *hw);
492488
int alx_reset_mac(struct alx_hw *hw);
493489
void alx_set_macaddr(struct alx_hw *hw, const u8 *addr);
494490
bool alx_phy_configured(struct alx_hw *hw);
495491
void alx_configure_basic(struct alx_hw *hw);
496492
void alx_disable_rss(struct alx_hw *hw);
497-
int alx_select_powersaving_speed(struct alx_hw *hw, int *speed, u8 *duplex);
498493
bool alx_get_phy_info(struct alx_hw *hw);
499494

500495
static inline u32 alx_speed_to_ethadv(int speed, u8 duplex)

0 commit comments

Comments
 (0)