init.c (8a55712d124fd8a919e8a69b70643e1a97280b4b) init.c (4dbcb9125cc3e10a6d879c10e4f5816d05a87c49)
1// SPDX-License-Identifier: ISC
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#include <linux/etherdevice.h>
5#include <linux/hwmon.h>
6#include <linux/hwmon-sysfs.h>
7#include <linux/thermal.h>
8#include "mt7915.h"
9#include "mac.h"
10#include "mcu.h"
1// SPDX-License-Identifier: ISC
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#include <linux/etherdevice.h>
5#include <linux/hwmon.h>
6#include <linux/hwmon-sysfs.h>
7#include <linux/thermal.h>
8#include "mt7915.h"
9#include "mac.h"
10#include "mcu.h"
11#include "coredump.h"
11#include "eeprom.h"
12
13static const struct ieee80211_iface_limit if_limits[] = {
14 {
15 .max = 1,
16 .types = BIT(NL80211_IFTYPE_ADHOC)
17 }, {
18 .max = 16,

--- 1076 unchanged lines hidden (view full) ---

1095 INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
1096 INIT_LIST_HEAD(&dev->sta_rc_list);
1097 INIT_LIST_HEAD(&dev->sta_poll_list);
1098 INIT_LIST_HEAD(&dev->twt_list);
1099 spin_lock_init(&dev->sta_poll_lock);
1100
1101 init_waitqueue_head(&dev->reset_wait);
1102 INIT_WORK(&dev->reset_work, mt7915_mac_reset_work);
12#include "eeprom.h"
13
14static const struct ieee80211_iface_limit if_limits[] = {
15 {
16 .max = 1,
17 .types = BIT(NL80211_IFTYPE_ADHOC)
18 }, {
19 .max = 16,

--- 1076 unchanged lines hidden (view full) ---

1096 INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
1097 INIT_LIST_HEAD(&dev->sta_rc_list);
1098 INIT_LIST_HEAD(&dev->sta_poll_list);
1099 INIT_LIST_HEAD(&dev->twt_list);
1100 spin_lock_init(&dev->sta_poll_lock);
1101
1102 init_waitqueue_head(&dev->reset_wait);
1103 INIT_WORK(&dev->reset_work, mt7915_mac_reset_work);
1104 INIT_WORK(&dev->dump_work, mt7915_mac_dump_work);
1105 mutex_init(&dev->dump_mutex);
1103
1104 dev->dbdc_support = mt7915_band_config(dev);
1105
1106 phy2 = mt7915_alloc_ext_phy(dev);
1107 if (IS_ERR(phy2))
1108 return PTR_ERR(phy2);
1109
1110 ret = mt7915_init_hardware(dev, phy2);

--- 26 unchanged lines hidden (view full) ---

1137 if (phy2) {
1138 ret = mt7915_register_ext_phy(dev, phy2);
1139 if (ret)
1140 goto unreg_thermal;
1141 }
1142
1143 dev->recovery.hw_init_done = true;
1144
1106
1107 dev->dbdc_support = mt7915_band_config(dev);
1108
1109 phy2 = mt7915_alloc_ext_phy(dev);
1110 if (IS_ERR(phy2))
1111 return PTR_ERR(phy2);
1112
1113 ret = mt7915_init_hardware(dev, phy2);

--- 26 unchanged lines hidden (view full) ---

1140 if (phy2) {
1141 ret = mt7915_register_ext_phy(dev, phy2);
1142 if (ret)
1143 goto unreg_thermal;
1144 }
1145
1146 dev->recovery.hw_init_done = true;
1147
1145 mt7915_init_debugfs(&dev->phy);
1148 ret = mt7915_init_debugfs(&dev->phy);
1149 if (ret)
1150 goto unreg_thermal;
1146
1151
1152 ret = mt7915_coredump_register(dev);
1153 if (ret)
1154 goto unreg_thermal;
1155
1147 return 0;
1148
1149unreg_thermal:
1150 mt7915_unregister_thermal(&dev->phy);
1151unreg_dev:
1152 mt76_unregister_device(&dev->mt76);
1153stop_hw:
1154 mt7915_stop_hardware(dev);
1155free_phy2:
1156 if (phy2)
1157 ieee80211_free_hw(phy2->mt76->hw);
1158 return ret;
1159}
1160
1161void mt7915_unregister_device(struct mt7915_dev *dev)
1162{
1163 mt7915_unregister_ext_phy(dev);
1156 return 0;
1157
1158unreg_thermal:
1159 mt7915_unregister_thermal(&dev->phy);
1160unreg_dev:
1161 mt76_unregister_device(&dev->mt76);
1162stop_hw:
1163 mt7915_stop_hardware(dev);
1164free_phy2:
1165 if (phy2)
1166 ieee80211_free_hw(phy2->mt76->hw);
1167 return ret;
1168}
1169
1170void mt7915_unregister_device(struct mt7915_dev *dev)
1171{
1172 mt7915_unregister_ext_phy(dev);
1173 mt7915_coredump_unregister(dev);
1164 mt7915_unregister_thermal(&dev->phy);
1165 mt76_unregister_device(&dev->mt76);
1166 mt7915_stop_hardware(dev);
1167
1168 mt76_free_device(&dev->mt76);
1169}
1174 mt7915_unregister_thermal(&dev->phy);
1175 mt76_unregister_device(&dev->mt76);
1176 mt7915_stop_hardware(dev);
1177
1178 mt76_free_device(&dev->mt76);
1179}