diff options
Diffstat (limited to '000-enable-alx-wol.patch')
-rw-r--r-- | 000-enable-alx-wol.patch | 136 |
1 files changed, 73 insertions, 63 deletions
diff --git a/000-enable-alx-wol.patch b/000-enable-alx-wol.patch index ffc7866c3018..2d20eb40d528 100644 --- a/000-enable-alx-wol.patch +++ b/000-enable-alx-wol.patch @@ -1,7 +1,7 @@ -diff --git a/ethtool.c b/ethtool.c -index 2f4eabf..859e272 100644 ---- a/ethtool.c -+++ b/ethtool.c +diff --git a/drivers/net/ethernet/atheros/alx/ethtool.c b/drivers/net/ethernet/atheros/alx/ethtool.c +index 2f4eabf652e8..859e27236ce4 100644 +--- a/drivers/net/ethernet/atheros/alx/ethtool.c ++++ b/drivers/net/ethernet/atheros/alx/ethtool.c @@ -310,11 +310,47 @@ static int alx_get_sset_count(struct net_device *netdev, int sset) } } @@ -50,10 +50,10 @@ index 2f4eabf..859e272 100644 .get_link = ethtool_op_get_link, .get_strings = alx_get_strings, .get_sset_count = alx_get_sset_count, -diff --git a/hw.c b/hw.c -index 6ac40b0..4791b9d 100644 ---- a/hw.c -+++ b/hw.c +diff --git a/drivers/net/ethernet/atheros/alx/hw.c b/drivers/net/ethernet/atheros/alx/hw.c +index 6ac40b0003a3..4791b9dbbe26 100644 +--- a/drivers/net/ethernet/atheros/alx/hw.c ++++ b/drivers/net/ethernet/atheros/alx/hw.c @@ -332,6 +332,16 @@ void alx_set_macaddr(struct alx_hw *hw, const u8 *addr) alx_write_mem32(hw, ALX_STAD1, val); } @@ -237,10 +237,10 @@ index 6ac40b0..4791b9d 100644 bool alx_get_phy_info(struct alx_hw *hw) { u16 devs1, devs2; -diff --git a/hw.h b/hw.h -index e42d7e0..a7fb6c8 100644 ---- a/hw.h -+++ b/hw.h +diff --git a/drivers/net/ethernet/atheros/alx/hw.h b/drivers/net/ethernet/atheros/alx/hw.h +index e42d7e0947eb..a7fb6c8d846a 100644 +--- a/drivers/net/ethernet/atheros/alx/hw.h ++++ b/drivers/net/ethernet/atheros/alx/hw.h @@ -487,6 +487,8 @@ struct alx_hw { u8 flowctrl; u32 adv_cfg; @@ -273,9 +273,11 @@ index e42d7e0..a7fb6c8 100644 bool alx_get_phy_info(struct alx_hw *hw); void alx_update_hw_stats(struct alx_hw *hw); ---- a/main.c 2019-12-03 16:51:19.119352509 +0800 -+++ b/main.c" 2019-12-03 16:57:16.477599479 +0800 -@@ -1069,6 +1069,7 @@ +diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c +index 7748b276e5fd..5c01c429efff 100644 +--- a/drivers/net/ethernet/atheros/alx/main.c ++++ b/drivers/net/ethernet/atheros/alx/main.c +@@ -1069,6 +1069,7 @@ static int alx_init_sw(struct alx_priv *alx) alx->dev->max_mtu = ALX_MAX_FRAME_LEN(ALX_MAX_FRAME_SIZE); alx->tx_ringsz = 256; alx->rx_ringsz = 512; @@ -283,7 +285,7 @@ index e42d7e0..a7fb6c8 100644 hw->imt = 200; alx->int_mask = ALX_ISR_MISC; hw->dma_chnl = hw->max_dma_chnl; -@@ -1343,6 +1344,66 @@ +@@ -1347,6 +1348,66 @@ static int alx_stop(struct net_device *netdev) return 0; } @@ -350,7 +352,7 @@ index e42d7e0..a7fb6c8 100644 static void alx_link_check(struct work_struct *work) { struct alx_priv *alx; -@@ -1836,6 +1897,7 @@ +@@ -1837,6 +1898,7 @@ static int alx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto out_unmap; } @@ -358,18 +360,14 @@ index e42d7e0..a7fb6c8 100644 netdev_info(netdev, "Qualcomm Atheros AR816x/AR817x Ethernet [%pM]\n", netdev->dev_addr); -@@ -1878,37 +1940,70 @@ +@@ -1877,42 +1939,74 @@ static void alx_remove(struct pci_dev *pdev) static int alx_suspend(struct device *dev) { struct alx_priv *alx = dev_get_drvdata(dev); -+ struct pci_dev *pdev = alx->hw.pdev; ++ struct pci_dev *pdev = alx->hw.pdev; + int err; + bool wol_en; - -- if (!netif_running(alx->dev)) -- return 0; -- netif_device_detach(alx->dev); -- __alx_stop(alx); ++ + err = __alx_shutdown(pdev, &wol_en); + if (err) { + dev_err(&pdev->dev, "shutdown fail in suspend %d\n", err); @@ -382,6 +380,11 @@ index e42d7e0..a7fb6c8 100644 + pci_wake_from_d3(pdev, false); + pci_set_power_state(pdev, PCI_D3hot); + } + +- if (!netif_running(alx->dev)) +- return 0; +- netif_device_detach(alx->dev); +- __alx_stop(alx); return 0; } @@ -390,61 +393,69 @@ index e42d7e0..a7fb6c8 100644 struct alx_priv *alx = dev_get_drvdata(dev); + struct net_device *netdev = alx->dev; struct alx_hw *hw = &alx->hw; -+ struct pci_dev *pdev = hw->pdev; ++ struct pci_dev *pdev = hw->pdev; int err; -+ pci_set_power_state(pdev, PCI_D0); -+ pci_restore_state(pdev); -+ pci_save_state(pdev); -+ -+ pci_enable_wake(pdev, PCI_D3hot, 0); -+ pci_enable_wake(pdev, PCI_D3cold, 0); -+ -+ hw->link_speed = SPEED_UNKNOWN; -+ alx->int_mask = ALX_ISR_MISC; -+ -+ alx_reset_pcie(hw); - alx_reset_phy(hw); +- alx_reset_phy(hw); ++ pci_set_power_state(pdev, PCI_D0); ++ pci_restore_state(pdev); ++ pci_save_state(pdev); - if (!netif_running(alx->dev)) - return 0; -- netif_device_attach(alx->dev); -+ err = alx_reset_mac(hw); -+ if (err) { -+ netif_err(alx, hw, alx->dev, -+ "resume:reset_mac fail %d\n", err); -+ return -EIO; -+ } ++ pci_enable_wake(pdev, PCI_D3hot, 0); ++ pci_enable_wake(pdev, PCI_D3cold, 0); - rtnl_lock(); - err = __alx_open(alx, true); - rtnl_unlock(); -+ err = alx_setup_speed_duplex(hw, hw->adv_cfg, hw->flowctrl); +- if (err) +- return err; ++ hw->link_speed = SPEED_UNKNOWN; ++ alx->int_mask = ALX_ISR_MISC; + +- netif_device_attach(alx->dev); ++ alx_reset_pcie(hw); ++ alx_reset_phy(hw); + +- return 0; +-} ++ err = alx_reset_mac(hw); + if (err) { + netif_err(alx, hw, alx->dev, -+ "resume:setup_speed_duplex fail %d\n", err); -+ return -EIO; -+ } -+ -+ if (netif_running(netdev)) { -+ err = __alx_open(alx, true); -+ if (err) -+ return err; -+ } - -- return err; -+ netif_device_attach(netdev); -+ return err; - } ++ "resume:reset_mac fail %d\n", err); ++ return -EIO; ++ } -static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume); -#define ALX_PM_OPS (&alx_pm_ops) -#else -#define ALX_PM_OPS NULL - #endif +-#endif ++ err = alx_setup_speed_duplex(hw, hw->adv_cfg, hw->flowctrl); ++ if (err) { ++ netif_err(alx, hw, alx->dev, ++ "resume:setup_speed_duplex fail %d\n", err); ++ return -EIO; ++ } ++ if (netif_running(netdev)) { ++ rtnl_lock(); ++ err = __alx_open(alx, true); ++ rtnl_unlock(); ++ ++ if (err) ++ return err; ++ } ++ ++ netif_device_attach(netdev); ++ return err; ++} ++#endif /* CONFIG_PM_SLEEP */ -@@ -1954,6 +2049,8 @@ + static pci_ers_result_t alx_pci_error_detected(struct pci_dev *pdev, + pci_channel_state_t state) +@@ -1956,6 +2050,8 @@ static pci_ers_result_t alx_pci_error_slot_reset(struct pci_dev *pdev) } pci_set_master(pdev); @@ -453,7 +464,7 @@ index e42d7e0..a7fb6c8 100644 alx_reset_pcie(hw); if (!alx_reset_mac(hw)) -@@ -2003,11 +2100,20 @@ +@@ -2005,11 +2101,19 @@ static const struct pci_device_id alx_pci_tbl[] = { {} }; @@ -464,7 +475,6 @@ index e42d7e0..a7fb6c8 100644 +#define ALX_PM_OPS NULL +#endif + -+ static struct pci_driver alx_driver = { .name = alx_drv_name, .id_table = alx_pci_tbl, |