init.c (8910a4e5ba342ad661acb6f99fa14e0dd809465e) init.c (16d98b548365fcd6fc3fe2e1ae73c9e3cc5ee43d)
1// SPDX-License-Identifier: ISC
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#include <linux/etherdevice.h>
5#include "mt7921.h"
6#include "mac.h"
7#include "mcu.h"
8#include "eeprom.h"

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

144 dev->mt76.rxfilter = mt76_rr(dev, MT_WF_RFCR(0));
145
146 return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0);
147}
148EXPORT_SYMBOL_GPL(mt7921_mac_init);
149
150static int __mt7921_init_hardware(struct mt7921_dev *dev)
151{
1// SPDX-License-Identifier: ISC
2/* Copyright (C) 2020 MediaTek Inc. */
3
4#include <linux/etherdevice.h>
5#include "mt7921.h"
6#include "mac.h"
7#include "mcu.h"
8#include "eeprom.h"

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

144 dev->mt76.rxfilter = mt76_rr(dev, MT_WF_RFCR(0));
145
146 return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0);
147}
148EXPORT_SYMBOL_GPL(mt7921_mac_init);
149
150static int __mt7921_init_hardware(struct mt7921_dev *dev)
151{
152 struct mt76_dev *mdev = &dev->mt76;
153 int ret;
154
155 /* force firmware operation mode into normal state,
156 * which should be set before firmware download stage.
157 */
158 mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
159 ret = mt7921_mcu_init(dev);
160 if (ret)
161 goto out;
162
152 int ret;
153
154 /* force firmware operation mode into normal state,
155 * which should be set before firmware download stage.
156 */
157 mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
158 ret = mt7921_mcu_init(dev);
159 if (ret)
160 goto out;
161
163 ret = mt7921_eeprom_init(dev);
164 if (ret)
165 goto out;
162 mt76_eeprom_override(&dev->mphy);
166
167 ret = mt7921_mcu_set_eeprom(dev);
168 if (ret)
169 goto out;
170
171 ret = mt7921_mac_init(dev);
172out:
163
164 ret = mt7921_mcu_set_eeprom(dev);
165 if (ret)
166 goto out;
167
168 ret = mt7921_mac_init(dev);
169out:
173 if (ret && mdev->eeprom.data) {
174 devm_kfree(mdev->dev, mdev->eeprom.data);
175 mdev->eeprom.data = NULL;
176 }
177
178 return ret;
179}
180
181static int mt7921_init_hardware(struct mt7921_dev *dev)
182{
183 int ret, idx, i;
184
185 set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);

--- 104 unchanged lines hidden ---
170 return ret;
171}
172
173static int mt7921_init_hardware(struct mt7921_dev *dev)
174{
175 int ret, idx, i;
176
177 set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);

--- 104 unchanged lines hidden ---