Message ID | 758cdeb9c4ab95c01a79dfc44e53f50b631948a2.1538036134.git.lorenzo.bianconi@redhat.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | add mt76x0e hw initialization support | expand |
On Thu, Sep 27, 2018 at 11:01:44AM +0200, Lorenzo Bianconi wrote: > Add beacon offset reset in mt76x0e_init_hardware routine > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > --- > 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); > + } > + This seems to ba fix for "mt76: move mt76x02_beacon_offset in mt76x02_core.c" please add "Fixes:" tag or merge this patch into previous one. Thanks Stanislaw
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@redhat.com> > --- > 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
On Sep 27, Stanislaw Gruszka wrote: > On Thu, Sep 27, 2018 at 11:01:44AM +0200, Lorenzo Bianconi wrote: > > Add beacon offset reset in mt76x0e_init_hardware routine > > > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > > --- > > 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); > > + } > > + > > This seems to ba fix for > > "mt76: move mt76x02_beacon_offset in mt76x02_core.c" I will double-check vendor driver but I guess this is in usb code as well, so I will add a 'Fixes' tag Regards, Lorenzo > > please add "Fixes:" tag or merge this patch into previous one. > > Thanks > Stanislaw
On Sep 27, Felix Fietkau wrote: > 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@redhat.com> > > --- > > 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? ack, will do in v2. Regards, Lorenzo > > - Felix >
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); + } + mt76x0_reset_counters(dev); mt76_rmw(dev, MT_US_CYC_CFG, MT_US_CYC_CNT, 0x1e);
Add beacon offset reset in mt76x0e_init_hardware routine Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> --- drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)