diff mbox series

mt76x0: init: intrduce MT_H2M_* definitions

Message ID 20180929173032.32747-1-lorenzo.bianconi@redhat.com (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series mt76x0: init: intrduce MT_H2M_* definitions | expand

Commit Message

Lorenzo Bianconi Sept. 29, 2018, 5:30 p.m. UTC
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(-)

Comments

Stanislaw Gruszka Oct. 1, 2018, 5:43 a.m. UTC | #1
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
Lorenzo Bianconi Oct. 1, 2018, 9:19 a.m. UTC | #2
> 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
diff mbox series

Patch

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)