0006-wifi.patch 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. From 1d1f574d38351171cb963be29c2eaee4b5317895 Mon Sep 17 00:00:00 2001
  2. From: sebanc <22224731+sebanc@users.noreply.github.com>
  3. Date: Mon, 4 Nov 2019 09:30:57 +0100
  4. Subject: [PATCH 06/10] wifi
  5. ---
  6. drivers/net/wireless/marvell/mwifiex/pcie.c | 75 ++++++++++---------
  7. .../net/wireless/marvell/mwifiex/sta_cmd.c | 15 +---
  8. 2 files changed, 40 insertions(+), 50 deletions(-)
  9. diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
  10. index b54f73e3d508..f0925b3d5aaf 100644
  11. --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
  12. +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
  13. @@ -149,37 +149,39 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
  14. */
  15. static int mwifiex_pcie_suspend(struct device *dev)
  16. {
  17. - struct mwifiex_adapter *adapter;
  18. - struct pcie_service_card *card;
  19. struct pci_dev *pdev = to_pci_dev(dev);
  20. + struct pcie_service_card *card = pci_get_drvdata(pdev);
  21. + struct mwifiex_adapter *adapter;
  22. + struct mwifiex_private *priv;
  23. + const struct mwifiex_pcie_card_reg *reg;
  24. + u32 fw_status;
  25. + int ret;
  26. - card = pci_get_drvdata(pdev);
  27. /* Might still be loading firmware */
  28. wait_for_completion(&card->fw_done);
  29. adapter = card->adapter;
  30. - if (!adapter) {
  31. - dev_err(dev, "adapter is not valid\n");
  32. + if (!adapter || !adapter->priv_num)
  33. return 0;
  34. - }
  35. - mwifiex_enable_wake(adapter);
  36. + reg = card->pcie.reg;
  37. + if (reg)
  38. + ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
  39. + else
  40. + fw_status = -1;
  41. +
  42. + if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
  43. + mwifiex_deauthenticate_all(adapter);
  44. - /* Enable the Host Sleep */
  45. - if (!mwifiex_enable_hs(adapter)) {
  46. - mwifiex_dbg(adapter, ERROR,
  47. - "cmd: failed to suspend\n");
  48. - clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
  49. - mwifiex_disable_wake(adapter);
  50. - return -EFAULT;
  51. - }
  52. + priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
  53. - flush_workqueue(adapter->workqueue);
  54. + mwifiex_disable_auto_ds(priv);
  55. +
  56. + mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
  57. + }
  58. - /* Indicate device suspended */
  59. - set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
  60. - clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
  61. + mwifiex_remove_card(adapter);
  62. return 0;
  63. }
  64. @@ -194,30 +196,29 @@ static int mwifiex_pcie_suspend(struct device *dev)
  65. */
  66. static int mwifiex_pcie_resume(struct device *dev)
  67. {
  68. - struct mwifiex_adapter *adapter;
  69. - struct pcie_service_card *card;
  70. struct pci_dev *pdev = to_pci_dev(dev);
  71. + struct pcie_service_card *card = pci_get_drvdata(pdev);
  72. + int ret;
  73. - card = pci_get_drvdata(pdev);
  74. + pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
  75. + pdev->vendor, pdev->device, pdev->revision);
  76. - if (!card->adapter) {
  77. - dev_err(dev, "adapter structure is not valid\n");
  78. - return 0;
  79. - }
  80. + init_completion(&card->fw_done);
  81. - adapter = card->adapter;
  82. + card->dev = pdev;
  83. - if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
  84. - mwifiex_dbg(adapter, WARN,
  85. - "Device already resumed\n");
  86. - return 0;
  87. + /* device tree node parsing and platform specific configuration */
  88. + if (pdev->dev.of_node) {
  89. + ret = mwifiex_pcie_probe_of(&pdev->dev);
  90. + if (ret)
  91. + return ret;
  92. }
  93. - clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
  94. -
  95. - mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
  96. - MWIFIEX_ASYNC_CMD);
  97. - mwifiex_disable_wake(adapter);
  98. + if (mwifiex_add_card(card, &card->fw_done, &pcie_ops,
  99. + MWIFIEX_PCIE, &pdev->dev)) {
  100. + pr_err("%s failed\n", __func__);
  101. + return -1;
  102. + }
  103. return 0;
  104. }
  105. @@ -271,6 +272,8 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
  106. return -1;
  107. }
  108. + pdev->bus->self->bridge_d3 = false;
  109. +
  110. return 0;
  111. }
  112. diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  113. index 4ed10cf82f9a..013db4386c39 100644
  114. --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  115. +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
  116. @@ -2265,14 +2265,13 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
  117. int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
  118. {
  119. struct mwifiex_adapter *adapter = priv->adapter;
  120. - int ret;
  121. struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
  122. - struct mwifiex_ds_auto_ds auto_ds;
  123. enum state_11d_t state_11d;
  124. struct mwifiex_ds_11n_tx_cfg tx_cfg;
  125. u8 sdio_sp_rx_aggr_enable;
  126. u16 packet_aggr_enable;
  127. int data;
  128. + int ret;
  129. if (first_sta) {
  130. if (priv->adapter->iface_type == MWIFIEX_PCIE) {
  131. @@ -2395,18 +2394,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
  132. if (ret)
  133. return -1;
  134. - if (!disable_auto_ds && first_sta &&
  135. - priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
  136. - /* Enable auto deep sleep */
  137. - auto_ds.auto_ds = DEEP_SLEEP_ON;
  138. - auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;
  139. - ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH,
  140. - EN_AUTO_PS, BITMAP_AUTO_DS,
  141. - &auto_ds, true);
  142. - if (ret)
  143. - return -1;
  144. - }
  145. -
  146. if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
  147. /* Send cmd to FW to enable/disable 11D function */
  148. state_11d = ENABLE_11D;
  149. --
  150. 2.24.1