Commit 9220f695 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mmio: move mt76x02_set_irq_mask in mt76 module

Move mt76x02_set_irq_mask in mt76 module in order to be reused
adding support for mt7603 driver and remove duplicated code
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent e3037485
...@@ -70,6 +70,19 @@ static int mt76_mmio_rd_rp(struct mt76_dev *dev, u32 base, ...@@ -70,6 +70,19 @@ static int mt76_mmio_rd_rp(struct mt76_dev *dev, u32 base,
return 0; return 0;
} }
void mt76_set_irq_mask(struct mt76_dev *dev, u32 addr,
u32 clear, u32 set)
{
unsigned long flags;
spin_lock_irqsave(&dev->mmio.irq_lock, flags);
dev->mmio.irqmask &= ~clear;
dev->mmio.irqmask |= set;
mt76_mmio_wr(dev, addr, dev->mmio.irqmask);
spin_unlock_irqrestore(&dev->mmio.irq_lock, flags);
}
EXPORT_SYMBOL_GPL(mt76_set_irq_mask);
void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs) void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs)
{ {
static const struct mt76_bus_ops mt76_mmio_ops = { static const struct mt76_bus_ops mt76_mmio_ops = {
......
...@@ -770,4 +770,6 @@ void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb); ...@@ -770,4 +770,6 @@ void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb);
struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev, struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
unsigned long expires); unsigned long expires);
void mt76_set_irq_mask(struct mt76_dev *dev, u32 addr, u32 clear, u32 set);
#endif #endif
...@@ -2,17 +2,6 @@ ...@@ -2,17 +2,6 @@
#include "mt7603.h" #include "mt7603.h"
void mt7603_set_irq_mask(struct mt7603_dev *dev, u32 clear, u32 set)
{
unsigned long flags;
spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags);
dev->mt76.mmio.irqmask &= ~clear;
dev->mt76.mmio.irqmask |= set;
mt76_wr(dev, MT_INT_MASK_CSR, dev->mt76.mmio.irqmask);
spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags);
}
void mt7603_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q) void mt7603_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q)
{ {
struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76); struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
......
...@@ -179,16 +179,14 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev); ...@@ -179,16 +179,14 @@ void mt7603_dma_cleanup(struct mt7603_dev *dev);
int mt7603_mcu_init(struct mt7603_dev *dev); int mt7603_mcu_init(struct mt7603_dev *dev);
void mt7603_init_debugfs(struct mt7603_dev *dev); void mt7603_init_debugfs(struct mt7603_dev *dev);
void mt7603_set_irq_mask(struct mt7603_dev *dev, u32 clear, u32 set);
static inline void mt7603_irq_enable(struct mt7603_dev *dev, u32 mask) static inline void mt7603_irq_enable(struct mt7603_dev *dev, u32 mask)
{ {
mt7603_set_irq_mask(dev, 0, mask); mt76_set_irq_mask(&dev->mt76, MT_INT_MASK_CSR, 0, mask);
} }
static inline void mt7603_irq_disable(struct mt7603_dev *dev, u32 mask) static inline void mt7603_irq_disable(struct mt7603_dev *dev, u32 mask)
{ {
mt7603_set_irq_mask(dev, mask, 0); mt76_set_irq_mask(&dev->mt76, MT_INT_MASK_CSR, mask, 0);
} }
void mt7603_mac_dma_start(struct mt7603_dev *dev); void mt7603_mac_dma_start(struct mt7603_dev *dev);
......
...@@ -187,7 +187,6 @@ void mt76x02_bss_info_changed(struct ieee80211_hw *hw, ...@@ -187,7 +187,6 @@ void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
extern const u16 mt76x02_beacon_offsets[16]; extern const u16 mt76x02_beacon_offsets[16];
void mt76x02_init_beacon_config(struct mt76x02_dev *dev); void mt76x02_init_beacon_config(struct mt76x02_dev *dev);
void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set);
void mt76x02_mac_start(struct mt76x02_dev *dev); void mt76x02_mac_start(struct mt76x02_dev *dev);
void mt76x02_init_debugfs(struct mt76x02_dev *dev); void mt76x02_init_debugfs(struct mt76x02_dev *dev);
...@@ -208,12 +207,12 @@ static inline bool is_mt76x2(struct mt76x02_dev *dev) ...@@ -208,12 +207,12 @@ static inline bool is_mt76x2(struct mt76x02_dev *dev)
static inline void mt76x02_irq_enable(struct mt76x02_dev *dev, u32 mask) static inline void mt76x02_irq_enable(struct mt76x02_dev *dev, u32 mask)
{ {
mt76x02_set_irq_mask(dev, 0, mask); mt76_set_irq_mask(&dev->mt76, MT_INT_MASK_CSR, 0, mask);
} }
static inline void mt76x02_irq_disable(struct mt76x02_dev *dev, u32 mask) static inline void mt76x02_irq_disable(struct mt76x02_dev *dev, u32 mask)
{ {
mt76x02_set_irq_mask(dev, mask, 0); mt76_set_irq_mask(&dev->mt76, MT_INT_MASK_CSR, mask, 0);
} }
static inline bool static inline bool
......
...@@ -336,18 +336,6 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance) ...@@ -336,18 +336,6 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
} }
EXPORT_SYMBOL_GPL(mt76x02_irq_handler); EXPORT_SYMBOL_GPL(mt76x02_irq_handler);
void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set)
{
unsigned long flags;
spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags);
dev->mt76.mmio.irqmask &= ~clear;
dev->mt76.mmio.irqmask |= set;
mt76_wr(dev, MT_INT_MASK_CSR, dev->mt76.mmio.irqmask);
spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags);
}
EXPORT_SYMBOL_GPL(mt76x02_set_irq_mask);
static void mt76x02_dma_enable(struct mt76x02_dev *dev) static void mt76x02_dma_enable(struct mt76x02_dev *dev)
{ {
u32 val; u32 val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment