Commit 95f381c5 authored by Felix Fietkau's avatar Felix Fietkau

mt76: mt7615: unify init work

Reduce code duplication and remove unnecessary exports
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 07c0d001
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
#include "mac.h" #include "mac.h"
#include "eeprom.h" #include "eeprom.h"
void mt7615_phy_init(struct mt7615_dev *dev) static void
mt7615_phy_init(struct mt7615_dev *dev)
{ {
/* disable rf low power beacon mode */ /* disable rf low power beacon mode */
mt76_set(dev, MT_WF_PHY_WF2_RFCTRL0(0), MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN); mt76_set(dev, MT_WF_PHY_WF2_RFCTRL0(0), MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN);
mt76_set(dev, MT_WF_PHY_WF2_RFCTRL0(1), MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN); mt76_set(dev, MT_WF_PHY_WF2_RFCTRL0(1), MT_WF_PHY_WF2_RFCTRL0_LPBCN_EN);
} }
EXPORT_SYMBOL_GPL(mt7615_phy_init);
static void static void
mt7615_init_mac_chain(struct mt7615_dev *dev, int chain) mt7615_init_mac_chain(struct mt7615_dev *dev, int chain)
...@@ -79,7 +79,8 @@ mt7615_init_mac_chain(struct mt7615_dev *dev, int chain) ...@@ -79,7 +79,8 @@ mt7615_init_mac_chain(struct mt7615_dev *dev, int chain)
} }
} }
void mt7615_mac_init(struct mt7615_dev *dev) static void
mt7615_mac_init(struct mt7615_dev *dev)
{ {
int i; int i;
...@@ -128,9 +129,9 @@ void mt7615_mac_init(struct mt7615_dev *dev) ...@@ -128,9 +129,9 @@ void mt7615_mac_init(struct mt7615_dev *dev)
mt7615_init_mac_chain(dev, 1); mt7615_init_mac_chain(dev, 1);
} }
} }
EXPORT_SYMBOL_GPL(mt7615_mac_init);
void mt7615_check_offload_capability(struct mt7615_dev *dev) static void
mt7615_check_offload_capability(struct mt7615_dev *dev)
{ {
struct ieee80211_hw *hw = mt76_hw(dev); struct ieee80211_hw *hw = mt76_hw(dev);
struct wiphy *wiphy = hw->wiphy; struct wiphy *wiphy = hw->wiphy;
...@@ -162,7 +163,6 @@ void mt7615_check_offload_capability(struct mt7615_dev *dev) ...@@ -162,7 +163,6 @@ void mt7615_check_offload_capability(struct mt7615_dev *dev)
wiphy->max_sched_scan_reqs = 0; wiphy->max_sched_scan_reqs = 0;
} }
} }
EXPORT_SYMBOL_GPL(mt7615_check_offload_capability);
bool mt7615_wait_for_mcu_init(struct mt7615_dev *dev) bool mt7615_wait_for_mcu_init(struct mt7615_dev *dev)
{ {
...@@ -286,6 +286,16 @@ void mt7615_init_txpower(struct mt7615_dev *dev, ...@@ -286,6 +286,16 @@ void mt7615_init_txpower(struct mt7615_dev *dev,
} }
EXPORT_SYMBOL_GPL(mt7615_init_txpower); EXPORT_SYMBOL_GPL(mt7615_init_txpower);
void mt7615_init_work(struct mt7615_dev *dev)
{
mt7615_mcu_set_eeprom(dev);
mt7615_mac_init(dev);
mt7615_phy_init(dev);
mt7615_mcu_del_wtbl_all(dev);
mt7615_check_offload_capability(dev);
}
EXPORT_SYMBOL_GPL(mt7615_init_work);
static void static void
mt7615_regd_notifier(struct wiphy *wiphy, mt7615_regd_notifier(struct wiphy *wiphy,
struct regulatory_request *request) struct regulatory_request *request)
......
...@@ -2522,7 +2522,6 @@ int mt7615_mcu_set_eeprom(struct mt7615_dev *dev) ...@@ -2522,7 +2522,6 @@ int mt7615_mcu_set_eeprom(struct mt7615_dev *dev)
return mt76_mcu_skb_send_msg(&dev->mt76, skb, return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_EXT_CMD_EFUSE_BUFFER_MODE, true); MCU_EXT_CMD_EFUSE_BUFFER_MODE, true);
} }
EXPORT_SYMBOL_GPL(mt7615_mcu_set_eeprom);
int mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable) int mt7615_mcu_set_mac_enable(struct mt7615_dev *dev, int band, bool enable)
{ {
...@@ -2664,7 +2663,6 @@ int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev) ...@@ -2664,7 +2663,6 @@ int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev)
return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE, &req, return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_WTBL_UPDATE, &req,
sizeof(req), true); sizeof(req), true);
} }
EXPORT_SYMBOL_GPL(mt7615_mcu_del_wtbl_all);
int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev, int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev,
enum mt7615_rdd_cmd cmd, u8 index, enum mt7615_rdd_cmd cmd, u8 index,
......
...@@ -402,7 +402,6 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, ...@@ -402,7 +402,6 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
int irq, const u32 *map); int irq, const u32 *map);
u32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr); u32 mt7615_reg_map(struct mt7615_dev *dev, u32 addr);
void mt7615_check_offload_capability(struct mt7615_dev *dev);
void mt7615_init_device(struct mt7615_dev *dev); void mt7615_init_device(struct mt7615_dev *dev);
int mt7615_register_device(struct mt7615_dev *dev); int mt7615_register_device(struct mt7615_dev *dev);
void mt7615_unregister_device(struct mt7615_dev *dev); void mt7615_unregister_device(struct mt7615_dev *dev);
...@@ -520,9 +519,8 @@ void mt7615_roc_work(struct work_struct *work); ...@@ -520,9 +519,8 @@ void mt7615_roc_work(struct work_struct *work);
void mt7615_roc_timer(struct timer_list *timer); void mt7615_roc_timer(struct timer_list *timer);
void mt7615_init_txpower(struct mt7615_dev *dev, void mt7615_init_txpower(struct mt7615_dev *dev,
struct ieee80211_supported_band *sband); struct ieee80211_supported_band *sband);
void mt7615_phy_init(struct mt7615_dev *dev);
void mt7615_mac_init(struct mt7615_dev *dev);
int mt7615_set_channel(struct mt7615_phy *phy); int mt7615_set_channel(struct mt7615_phy *phy);
void mt7615_init_work(struct mt7615_dev *dev);
int mt7615_mcu_restart(struct mt76_dev *dev); int mt7615_mcu_restart(struct mt76_dev *dev);
void mt7615_update_channel(struct mt76_dev *mdev); void mt7615_update_channel(struct mt76_dev *mdev);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "mac.h" #include "mac.h"
#include "eeprom.h" #include "eeprom.h"
static void mt7615_init_work(struct work_struct *work) static void mt7615_pci_init_work(struct work_struct *work)
{ {
struct mt7615_dev *dev = container_of(work, struct mt7615_dev, struct mt7615_dev *dev = container_of(work, struct mt7615_dev,
mcu_work); mcu_work);
...@@ -27,12 +27,7 @@ static void mt7615_init_work(struct work_struct *work) ...@@ -27,12 +27,7 @@ static void mt7615_init_work(struct work_struct *work)
if (ret) if (ret)
return; return;
mt7615_mcu_set_eeprom(dev); mt7615_init_work(dev);
mt7615_mac_init(dev);
mt7615_phy_init(dev);
mt7615_mcu_del_wtbl_all(dev);
mt7615_check_offload_capability(dev);
if (dev->dbdc_support) if (dev->dbdc_support)
mt7615_register_ext_phy(dev); mt7615_register_ext_phy(dev);
} }
...@@ -44,7 +39,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev) ...@@ -44,7 +39,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev)
mt76_wr(dev, MT_INT_SOURCE_CSR, ~0); mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
INIT_WORK(&dev->mcu_work, mt7615_init_work); INIT_WORK(&dev->mcu_work, mt7615_pci_init_work);
spin_lock_init(&dev->token_lock); spin_lock_init(&dev->token_lock);
idr_init(&dev->token); idr_init(&dev->token);
......
...@@ -227,11 +227,7 @@ static void mt7663s_init_work(struct work_struct *work) ...@@ -227,11 +227,7 @@ static void mt7663s_init_work(struct work_struct *work)
if (mt7663s_mcu_init(dev)) if (mt7663s_mcu_init(dev))
return; return;
mt7615_mcu_set_eeprom(dev); mt7615_init_work(dev);
mt7615_mac_init(dev);
mt7615_phy_init(dev);
mt7615_mcu_del_wtbl_all(dev);
mt7615_check_offload_capability(dev);
} }
static int mt7663s_hw_init(struct mt7615_dev *dev, struct sdio_func *func) static int mt7663s_hw_init(struct mt7615_dev *dev, struct sdio_func *func)
......
...@@ -47,11 +47,7 @@ static void mt7663u_init_work(struct work_struct *work) ...@@ -47,11 +47,7 @@ static void mt7663u_init_work(struct work_struct *work)
if (mt7663u_mcu_init(dev)) if (mt7663u_mcu_init(dev))
return; return;
mt7615_mcu_set_eeprom(dev); mt7615_init_work(dev);
mt7615_mac_init(dev);
mt7615_phy_init(dev);
mt7615_mcu_del_wtbl_all(dev);
mt7615_check_offload_capability(dev);
} }
static int mt7663u_probe(struct usb_interface *usb_intf, static int mt7663u_probe(struct usb_interface *usb_intf,
......
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