Commit d20ad581 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Kalle Valo

mt76: introduce mt76x2-common module

In order to remove usb dependency from pcie code, add mt76x2-common as
a container of shared code between mt76x2 and mt76x2u. Add eeprom code
to mt76x2-common module
Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 469d4818
config MT76_CORE config MT76_CORE
tristate tristate
config MT76x2_COMMON
tristate
depends on MT76_CORE
config MT76x2E config MT76x2E
tristate "MediaTek MT76x2E (PCIe) support" tristate "MediaTek MT76x2E (PCIe) support"
select MT76_CORE select MT76_CORE
select MT76x2_COMMON
depends on MAC80211 depends on MAC80211
depends on PCI depends on PCI
---help--- ---help---
......
obj-$(CONFIG_MT76_CORE) += mt76.o obj-$(CONFIG_MT76_CORE) += mt76.o
obj-$(CONFIG_MT76x2_COMMON) += mt76x2-common.o
obj-$(CONFIG_MT76x2E) += mt76x2e.o obj-$(CONFIG_MT76x2E) += mt76x2e.o
mt76-y := \ mt76-y := \
...@@ -6,10 +7,13 @@ mt76-y := \ ...@@ -6,10 +7,13 @@ mt76-y := \
CFLAGS_trace.o := -I$(src) CFLAGS_trace.o := -I$(src)
mt76x2-common-y := \
mt76x2_eeprom.o
mt76x2e-y := \ mt76x2e-y := \
mt76x2_pci.o mt76x2_dma.o \ mt76x2_pci.o mt76x2_dma.o \
mt76x2_main.o mt76x2_init.o mt76x2_debugfs.o mt76x2_tx.o \ mt76x2_main.o mt76x2_init.o mt76x2_debugfs.o mt76x2_tx.o \
mt76x2_core.o mt76x2_mac.o mt76x2_eeprom.o mt76x2_mcu.o mt76x2_phy.o \ mt76x2_core.o mt76x2_mac.o mt76x2_mcu.o mt76x2_phy.o \
mt76x2_dfs.o mt76x2_trace.o mt76x2_dfs.o mt76x2_trace.o
CFLAGS_mt76x2_trace.o := -I$(src) CFLAGS_mt76x2_trace.o := -I$(src)
...@@ -40,8 +40,7 @@ mt76x2_eeprom_get_macaddr(struct mt76x2_dev *dev) ...@@ -40,8 +40,7 @@ mt76x2_eeprom_get_macaddr(struct mt76x2_dev *dev)
return 0; return 0;
} }
static void void mt76x2_eeprom_parse_hw_cap(struct mt76x2_dev *dev)
mt76x2_eeprom_parse_hw_cap(struct mt76x2_dev *dev)
{ {
u16 val = mt76x2_eeprom_get(dev, MT_EE_NIC_CONF_0); u16 val = mt76x2_eeprom_get(dev, MT_EE_NIC_CONF_0);
...@@ -58,6 +57,7 @@ mt76x2_eeprom_parse_hw_cap(struct mt76x2_dev *dev) ...@@ -58,6 +57,7 @@ mt76x2_eeprom_parse_hw_cap(struct mt76x2_dev *dev)
break; break;
} }
} }
EXPORT_SYMBOL_GPL(mt76x2_eeprom_parse_hw_cap);
static int static int
mt76x2_efuse_read(struct mt76x2_dev *dev, u16 addr, u8 *data) mt76x2_efuse_read(struct mt76x2_dev *dev, u16 addr, u8 *data)
...@@ -415,6 +415,7 @@ void mt76x2_read_rx_gain(struct mt76x2_dev *dev) ...@@ -415,6 +415,7 @@ void mt76x2_read_rx_gain(struct mt76x2_dev *dev)
dev->cal.rx.lna_gain = mt76x2_sign_extend(lna, 8); dev->cal.rx.lna_gain = mt76x2_sign_extend(lna, 8);
} }
EXPORT_SYMBOL_GPL(mt76x2_read_rx_gain);
static s8 static s8
mt76x2_rate_power_val(u8 val) mt76x2_rate_power_val(u8 val)
...@@ -482,6 +483,7 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t, ...@@ -482,6 +483,7 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t,
val >>= 8; val >>= 8;
t->vht[8] = t->vht[9] = mt76x2_rate_power_val(val >> 8); t->vht[8] = t->vht[9] = mt76x2_rate_power_val(val >> 8);
} }
EXPORT_SYMBOL_GPL(mt76x2_get_rate_power);
int mt76x2_get_max_rate_power(struct mt76_rate_power *r) int mt76x2_get_max_rate_power(struct mt76_rate_power *r)
{ {
...@@ -493,6 +495,7 @@ int mt76x2_get_max_rate_power(struct mt76_rate_power *r) ...@@ -493,6 +495,7 @@ int mt76x2_get_max_rate_power(struct mt76_rate_power *r)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(mt76x2_get_max_rate_power);
static void static void
mt76x2_get_power_info_2g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t, mt76x2_get_power_info_2g(struct mt76x2_dev *dev, struct mt76x2_tx_power_info *t,
...@@ -600,6 +603,7 @@ void mt76x2_get_power_info(struct mt76x2_dev *dev, ...@@ -600,6 +603,7 @@ void mt76x2_get_power_info(struct mt76x2_dev *dev,
t->delta_bw40 = mt76x2_rate_power_val(bw40); t->delta_bw40 = mt76x2_rate_power_val(bw40);
t->delta_bw80 = mt76x2_rate_power_val(bw80); t->delta_bw80 = mt76x2_rate_power_val(bw80);
} }
EXPORT_SYMBOL_GPL(mt76x2_get_power_info);
int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t) int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t)
{ {
...@@ -632,6 +636,7 @@ int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t) ...@@ -632,6 +636,7 @@ int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mt76x2_get_temp_comp);
bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band) bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band)
{ {
...@@ -642,6 +647,7 @@ bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band) ...@@ -642,6 +647,7 @@ bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band)
else else
return !(conf0 & MT_EE_NIC_CONF_0_PA_INT_2G); return !(conf0 & MT_EE_NIC_CONF_0_PA_INT_2G);
} }
EXPORT_SYMBOL_GPL(mt76x2_ext_pa_enabled);
int mt76x2_eeprom_init(struct mt76x2_dev *dev) int mt76x2_eeprom_init(struct mt76x2_dev *dev)
{ {
...@@ -658,3 +664,6 @@ int mt76x2_eeprom_init(struct mt76x2_dev *dev) ...@@ -658,3 +664,6 @@ int mt76x2_eeprom_init(struct mt76x2_dev *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mt76x2_eeprom_init);
MODULE_LICENSE("Dual BSD/GPL");
...@@ -155,6 +155,7 @@ void mt76x2_get_power_info(struct mt76x2_dev *dev, ...@@ -155,6 +155,7 @@ void mt76x2_get_power_info(struct mt76x2_dev *dev,
int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t); int mt76x2_get_temp_comp(struct mt76x2_dev *dev, struct mt76x2_temp_comp *t);
bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band); bool mt76x2_ext_pa_enabled(struct mt76x2_dev *dev, enum nl80211_band band);
void mt76x2_read_rx_gain(struct mt76x2_dev *dev); void mt76x2_read_rx_gain(struct mt76x2_dev *dev);
void mt76x2_eeprom_parse_hw_cap(struct mt76x2_dev *dev);
static inline bool static inline bool
mt76x2_temp_tx_alc_enabled(struct mt76x2_dev *dev) mt76x2_temp_tx_alc_enabled(struct mt76x2_dev *dev)
......
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