* [PATCH] mt76x0: init: intrduce MT_H2M_* definitions
@ 2018-09-29 17:30 Lorenzo Bianconi
2018-10-01 5:43 ` Stanislaw Gruszka
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-09-29 17:30 UTC (permalink / raw)
To: nbd; +Cc: sgruszka, linux-wireless
Add MT_H2M_BBP_AGENT, MT_H2M_MAILBOX_CSR and MT_H2M_INT_SRC and
remove magic numbers
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 8 ++++----
drivers/net/wireless/mediatek/mt76/mt76x02_regs.h | 3 +++
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
index edfd5d94d197..4b8314844d36 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c
@@ -174,10 +174,10 @@ static void mt76x0_init_mac_registers(struct mt76x0_dev *dev)
mt76_wr(dev, MT_WMM_CTRL, reg);
/* TODO: Probably not needed */
- mt76_wr(dev, 0x7028, 0);
- mt76_wr(dev, 0x7010, 0);
- mt76_wr(dev, 0x7024, 0);
- msleep(10);
+ mt76_wr(dev, MT_H2M_BBP_AGENT, 0);
+ mt76_wr(dev, MT_H2M_MAILBOX_CSR, 0);
+ mt76_wr(dev, MT_H2M_INT_SRC, 0);
+ usleep_range(10000, 20000);
}
static int mt76x0_init_wcid_mem(struct mt76x0_dev *dev)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h b/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h
index f8003ee03a89..217bb0ac12fd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_regs.h
@@ -622,8 +622,11 @@
#define MT_SRAM_BASE 0x4000
+#define MT_H2M_MAILBOX_CSR 0x7010
#define MT_H2M_MAILBOX_CID 0x7014
#define MT_H2M_MAILBOX_STATUS 0x701c
+#define MT_H2M_INT_SRC 0x7024
+#define MT_H2M_BBP_AGENT 0x7028
#define MT_WCID_KEY_BASE 0x8000
#define MT_WCID_KEY(_n) (MT_WCID_KEY_BASE + (_n) * 32)
--
2.19.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mt76x0: init: intrduce MT_H2M_* definitions
2018-09-29 17:30 [PATCH] mt76x0: init: intrduce MT_H2M_* definitions Lorenzo Bianconi
@ 2018-10-01 5:43 ` Stanislaw Gruszka
2018-10-01 9:19 ` Lorenzo Bianconi
0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2018-10-01 5:43 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: nbd, linux-wireless
On Sat, Sep 29, 2018 at 07:30:32PM +0200, Lorenzo Bianconi wrote:
> Add MT_H2M_BBP_AGENT, MT_H2M_MAILBOX_CSR and MT_H2M_INT_SRC and
> remove magic numbers
>
>
> /* TODO: Probably not needed */
> - mt76_wr(dev, 0x7028, 0);
> - mt76_wr(dev, 0x7010, 0);
> - mt76_wr(dev, 0x7024, 0);
> - msleep(10);
> + mt76_wr(dev, MT_H2M_BBP_AGENT, 0);
> + mt76_wr(dev, MT_H2M_MAILBOX_CSR, 0);
> + mt76_wr(dev, MT_H2M_INT_SRC, 0);
The same here, I think this should be just removed.
> + usleep_range(10000, 20000);
Why this change ?
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mt76x0: init: intrduce MT_H2M_* definitions
2018-10-01 5:43 ` Stanislaw Gruszka
@ 2018-10-01 9:19 ` Lorenzo Bianconi
0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2018-10-01 9:19 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: nbd, linux-wireless
> On Sat, Sep 29, 2018 at 07:30:32PM +0200, Lorenzo Bianconi wrote:
> > Add MT_H2M_BBP_AGENT, MT_H2M_MAILBOX_CSR and MT_H2M_INT_SRC and
> > remove magic numbers
> >
> >
> > /* TODO: Probably not needed */
> > - mt76_wr(dev, 0x7028, 0);
> > - mt76_wr(dev, 0x7010, 0);
> > - mt76_wr(dev, 0x7024, 0);
> > - msleep(10);
> > + mt76_wr(dev, MT_H2M_BBP_AGENT, 0);
> > + mt76_wr(dev, MT_H2M_MAILBOX_CSR, 0);
> > + mt76_wr(dev, MT_H2M_INT_SRC, 0);
>
> The same here, I think this should be just removed.
ack, will send a patch to remove them
>
> > + usleep_range(10000, 20000);
>
> Why this change ?
afaik for sleeping less than 20ms it is better to use usleep_range
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/timers/timers-howto.txt
Regards,
Lorenzo
>
> Thanks
> Stanislaw
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-01 9:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-29 17:30 [PATCH] mt76x0: init: intrduce MT_H2M_* definitions Lorenzo Bianconi
2018-10-01 5:43 ` Stanislaw Gruszka
2018-10-01 9:19 ` 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).