On 2018-09-27 11:01, Lorenzo Bianconi wrote: > Add beacon offset reset in mt76x0e_init_hardware routine > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxx> > --- > drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c > index 03211fd0db33..6600ee046800 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c > @@ -345,7 +345,7 @@ EXPORT_SYMBOL_GPL(mt76x0_mac_stop); > > int mt76x0_init_hardware(struct mt76x0_dev *dev) > { > - int ret; > + int ret, i, j, beacon_len; > > if (!mt76x02_wait_for_wpdma(&dev->mt76, 1000)) > return -EIO; > @@ -385,6 +385,12 @@ int mt76x0_init_hardware(struct mt76x0_dev *dev) > MT_BEACON_TIME_CFG_TBTT_EN | > MT_BEACON_TIME_CFG_BEACON_TX)); > > + beacon_len = mt76x02_beacon_offsets[1] - mt76x02_beacon_offsets[0]; > + for (i = 0; i < 8; i++) { > + for (j = 0; j < beacon_len; j += 4) > + mt76_wr(dev, mt76x02_beacon_offsets[i] + j, 0); > + That looks a bit convoluted. Do we really need to clear beacon memory? If we do need it, how about simply clearing the entire scratch space instead of looping over beacon offsets? - Felix