* [PATCH v2 08/24] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module
@ 2018-09-28 6:40 Lorenzo Bianconi
2018-09-28 8:59 ` Stanislaw Gruszka
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-09-28 6:40 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Move mt76x2_wait_for_bbp utility routine in mt76x02_util.h
in order to be resued by mt76x0 driver. Morover rename it in
mt76x02_wait_for_txrx_active
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 8 ++++++++
drivers/net/wireless/mediatek/mt76/mt76x2.h | 7 -------
drivers/net/wireless/mediatek/mt76/mt76x2u_init.c | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
index 479e7ffcc951..432c725da62f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.h
@@ -66,4 +66,12 @@ static inline void mt76x02_irq_disable(struct mt76_dev *dev, u32 mask)
mt76x02_set_irq_mask(dev, mask, 0);
}
+static inline bool
+mt76x02_wait_for_txrx_active(struct mt76_dev *dev)
+{
+ return __mt76_poll_msec(dev, MT_MAC_STATUS,
+ MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
+ 0, 100);
+}
+
#endif
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h
index c51d6e2a64ce..9bf8be5ea1cd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h
@@ -124,13 +124,6 @@ static inline bool mt76x2_channel_silent(struct mt76x2_dev *dev)
chan->dfs_state != NL80211_DFS_AVAILABLE);
}
-static inline bool mt76x2_wait_for_bbp(struct mt76x2_dev *dev)
-{
- return mt76_poll_msec(dev, MT_MAC_STATUS,
- MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
- 0, 100);
-}
-
extern const struct ieee80211_ops mt76x2_ops;
struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c
index 4eb3fe657bd2..ecaafbb3eabe 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2u_init.c
@@ -209,7 +209,7 @@ int mt76x2u_init_hardware(struct mt76x2_dev *dev)
mt76x2u_init_beacon_offsets(dev);
- if (!mt76x2_wait_for_bbp(dev))
+ if (!mt76x02_wait_for_txrx_active(&dev->mt76))
return -ETIMEDOUT;
/* reset wcid table */
--
2.19.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 08/24] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module
2018-09-28 6:40 [PATCH v2 08/24] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module Lorenzo Bianconi
@ 2018-09-28 8:59 ` Stanislaw Gruszka
2018-09-28 10:28 ` Lorenzo Bianconi
0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2018-09-28 8:59 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: nbd, linux-wireless
On Fri, Sep 28, 2018 at 08:40:01AM +0200, Lorenzo Bianconi wrote:
> +static inline bool
> +mt76x02_wait_for_txrx_active(struct mt76_dev *dev)
> +{
> + return __mt76_poll_msec(dev, MT_MAC_STATUS,
> + MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
> + 0, 100);
> +}
The name is unfortunate, what we wait for is TX and RX become idle
i.e. hardware do not perform any RX or TX (see for example
mt76x2_mac_stop() ).
I think this patch should be droped and we should just use
mt76_poll_msec(MT_MAC_STATUS) directly, there is no real benefit
for this function.
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 08/24] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module
2018-09-28 8:59 ` Stanislaw Gruszka
@ 2018-09-28 10:28 ` Lorenzo Bianconi
0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-09-28 10:28 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: Felix Fietkau, linux-wireless
>
> On Fri, Sep 28, 2018 at 08:40:01AM +0200, Lorenzo Bianconi wrote:
> > +static inline bool
> > +mt76x02_wait_for_txrx_active(struct mt76_dev *dev)
> > +{
> > + return __mt76_poll_msec(dev, MT_MAC_STATUS,
> > + MT_MAC_STATUS_TX | MT_MAC_STATUS_RX,
> > + 0, 100);
> > +}
>
> The name is unfortunate, what we wait for is TX and RX become idle
> i.e. hardware do not perform any RX or TX (see for example
> mt76x2_mac_stop() ).
Hi Stanislaw,
This is what I meant, but probably 'mt76x02_wait_for_txrx_idle' will
be better I guess, agree?
>
> I think this patch should be droped and we should just use
> mt76_poll_msec(MT_MAC_STATUS) directly, there is no real benefit
> for this function.
>
I would prefer to use shared utilities if it possible.
I will fix it in v3
Regards,
Lorenzo
> Thanks
> Stanislaw
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-28 10:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 6:40 [PATCH v2 08/24] mt76: move mt76x2_wait_for_bbp in mt76x02-lib module Lorenzo Bianconi
2018-09-28 8:59 ` Stanislaw Gruszka
2018-09-28 10:28 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).