Skip to content

Commit

Permalink
mt76: mt7921: allow chip reset during device restart
Browse files Browse the repository at this point in the history
Disable chip full reset just during device probing but allow
it during hw restart.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
Lorenzo Bianconi authored and Felix Fietkau committed Jun 19, 2021
1 parent a27238a commit 61a1f99
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion drivers/net/wireless/mediatek/mt76/mt7921/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,13 @@ int mt7921_register_device(struct mt7921_dev *dev)
if (ret)
return ret;

return mt76_connac_mcu_set_deep_sleep(&dev->mt76, dev->pm.ds_enable);
ret = mt76_connac_mcu_set_deep_sleep(&dev->mt76, dev->pm.ds_enable);
if (ret)
return ret;

dev->hw_init_done = true;

return 0;
}

void mt7921_unregister_device(struct mt7921_dev *dev)
Expand Down
8 changes: 5 additions & 3 deletions drivers/net/wireless/mediatek/mt76/mt7921/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,11 +1390,13 @@ void mt7921_reset(struct mt76_dev *mdev)
{
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);

if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
if (!dev->hw_init_done)
return;

if (!dev->hw_full_reset)
queue_work(dev->mt76.wq, &dev->reset_work);
if (dev->hw_full_reset)
return;

queue_work(dev->mt76.wq, &dev->reset_work);
}

static void
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ struct mt7921_dev {
u16 chainmask;

struct work_struct reset_work;
bool hw_full_reset;
bool hw_full_reset:1;
bool hw_init_done:1;

struct list_head sta_poll_list;
spinlock_t sta_poll_lock;
Expand Down

0 comments on commit 61a1f99

Please sign in to comment.