Message ID | 282971bcd54817ae02fbe065bc357ded9e068e56.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:46AM +0200, Lorenzo Bianconi wrote: > Introduce mt76x02_mac_start since the mac start code is shared between > mt76x0e and mt76x2 drivers. > > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > --- > drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 15 +++++++++++++++ > drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 1 + > drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 12 +----------- > 3 files changed, 17 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > index df4366a702c9..5f120c1fa79f 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c > @@ -18,6 +18,8 @@ > #include "mt76.h" > #include "mt76x02_regs.h" > #include "mt76x02_mac.h" > +#include "mt76x02_dma.h" > +#include "mt76x02_util.h" > > enum mt76x02_cipher_type > mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data) > @@ -520,3 +522,16 @@ void mt76x02_mac_setaddr(struct mt76_dev *dev, u8 *addr) > FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); > } > EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr); > + > +void mt76x02_mac_start(struct mt76_dev *dev) > +{ > + mt76x02_dma_enable(dev); > + __mt76_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter); > + __mt76_wr(dev, MT_MAC_SYS_CTRL, > + MT_MAC_SYS_CTRL_ENABLE_TX | > + MT_MAC_SYS_CTRL_ENABLE_RX); > + mt76x02_irq_enable(dev, > + MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | > + MT_INT_TX_STAT); > +} irq_enable is PCIe specific (also mt76x02_dma_enable() seems to be PCIe specifc). I think this should be not mixed within generic code and perhaps the function name prefix should be mt76x02e_ . Thanks Stanislaw
> On Thu, Sep 27, 2018 at 11:01:46AM +0200, Lorenzo Bianconi wrote: > > enum mt76x02_cipher_type > > mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data) > > @@ -520,3 +522,16 @@ void mt76x02_mac_setaddr(struct mt76_dev *dev, u8 *addr) > > FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); > > } > > EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr); > > + > > +void mt76x02_mac_start(struct mt76_dev *dev) > > +{ > > + mt76x02_dma_enable(dev); > > + __mt76_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter); > > + __mt76_wr(dev, MT_MAC_SYS_CTRL, > > + MT_MAC_SYS_CTRL_ENABLE_TX | > > + MT_MAC_SYS_CTRL_ENABLE_RX); > > + mt76x02_irq_enable(dev, > > + MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | > > + MT_INT_TX_STAT); > > +} > > irq_enable is PCIe specific (also mt76x02_dma_enable() seems to > be PCIe specifc). I think this should be not mixed within generic code > and perhaps the function name prefix should be mt76x02e_ . ack, I will move them in mt76x02_mmio.c but I would prefer to maintain name convetion we are using so far. Regards, Lorenzo > > Thanks > Stanislaw >
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index df4366a702c9..5f120c1fa79f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -18,6 +18,8 @@ #include "mt76.h" #include "mt76x02_regs.h" #include "mt76x02_mac.h" +#include "mt76x02_dma.h" +#include "mt76x02_util.h" enum mt76x02_cipher_type mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data) @@ -520,3 +522,16 @@ void mt76x02_mac_setaddr(struct mt76_dev *dev, u8 *addr) FIELD_PREP(MT_MAC_ADDR_DW1_U2ME_MASK, 0xff)); } EXPORT_SYMBOL_GPL(mt76x02_mac_setaddr); + +void mt76x02_mac_start(struct mt76_dev *dev) +{ + mt76x02_dma_enable(dev); + __mt76_wr(dev, MT_RX_FILTR_CFG, dev->rxfilter); + __mt76_wr(dev, MT_MAC_SYS_CTRL, + MT_MAC_SYS_CTRL_ENABLE_TX | + MT_MAC_SYS_CTRL_ENABLE_RX); + mt76x02_irq_enable(dev, + MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | + MT_INT_TX_STAT); +} +EXPORT_SYMBOL_GPL(mt76x02_mac_start); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h index 62072291e416..3d95b60392dd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h @@ -203,4 +203,5 @@ void mt76x02_send_tx_status(struct mt76_dev *dev, int mt76x02_mac_process_rate(struct mt76_rx_status *status, u16 rate); void mt76x02_mac_setaddr(struct mt76_dev *dev, u8 *addr); +void mt76x02_mac_start(struct mt76_dev *dev); #endif diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c index 37cbe550ad1a..3f77c13a6d54 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -188,17 +188,7 @@ int mt76x2_mac_start(struct mt76x2_dev *dev) mt76_rr(dev, MT_TX_STAT_FIFO); memset(dev->aggr_stats, 0, sizeof(dev->aggr_stats)); - - mt76x02_dma_enable(&dev->mt76); - mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter); - - mt76_wr(dev, MT_MAC_SYS_CTRL, - MT_MAC_SYS_CTRL_ENABLE_TX | - MT_MAC_SYS_CTRL_ENABLE_RX); - - mt76x02_irq_enable(&dev->mt76, - MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | - MT_INT_TX_STAT); + mt76x02_mac_start(&dev->mt76); return 0; }
Introduce mt76x02_mac_start since the mac start code is shared between mt76x0e and mt76x2 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> --- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 15 +++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 1 + drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 12 +----------- 3 files changed, 17 insertions(+), 11 deletions(-)