Commit 6e5d2099 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7615: add address parameter to mt7615_eeprom_init

Introduce address parameter to mt7615_eeprom_init routine in order to be
reused adding usb support to mt7615 driver
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 7d9f1d10
...@@ -40,11 +40,11 @@ static int mt7615_efuse_read(struct mt7615_dev *dev, u32 base, ...@@ -40,11 +40,11 @@ static int mt7615_efuse_read(struct mt7615_dev *dev, u32 base,
return 0; return 0;
} }
static int mt7615_efuse_init(struct mt7615_dev *dev) static int mt7615_efuse_init(struct mt7615_dev *dev, u32 base)
{ {
u32 val, base = mt7615_reg_map(dev, MT_EFUSE_BASE);
int i, len = MT7615_EEPROM_SIZE; int i, len = MT7615_EEPROM_SIZE;
void *buf; void *buf;
u32 val;
val = mt76_rr(dev, base + MT_EFUSE_BASE_CTRL); val = mt76_rr(dev, base + MT_EFUSE_BASE_CTRL);
if (val & MT_EFUSE_BASE_CTRL_EMPTY) if (val & MT_EFUSE_BASE_CTRL_EMPTY)
...@@ -67,7 +67,7 @@ static int mt7615_efuse_init(struct mt7615_dev *dev) ...@@ -67,7 +67,7 @@ static int mt7615_efuse_init(struct mt7615_dev *dev)
return 0; return 0;
} }
static int mt7615_eeprom_load(struct mt7615_dev *dev) static int mt7615_eeprom_load(struct mt7615_dev *dev, u32 addr)
{ {
int ret; int ret;
...@@ -75,7 +75,7 @@ static int mt7615_eeprom_load(struct mt7615_dev *dev) ...@@ -75,7 +75,7 @@ static int mt7615_eeprom_load(struct mt7615_dev *dev)
if (ret < 0) if (ret < 0)
return ret; return ret;
return mt7615_efuse_init(dev); return mt7615_efuse_init(dev, addr);
} }
static int mt7615_check_eeprom(struct mt76_dev *dev) static int mt7615_check_eeprom(struct mt76_dev *dev)
...@@ -265,11 +265,11 @@ static void mt7615_cal_free_data(struct mt7615_dev *dev) ...@@ -265,11 +265,11 @@ static void mt7615_cal_free_data(struct mt7615_dev *dev)
} }
} }
int mt7615_eeprom_init(struct mt7615_dev *dev) int mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr)
{ {
int ret; int ret;
ret = mt7615_eeprom_load(dev); ret = mt7615_eeprom_load(dev, addr);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -146,6 +146,7 @@ static void mt7615_init_work(struct work_struct *work) ...@@ -146,6 +146,7 @@ static void mt7615_init_work(struct work_struct *work)
static int mt7615_init_hardware(struct mt7615_dev *dev) static int mt7615_init_hardware(struct mt7615_dev *dev)
{ {
u32 addr = mt7615_reg_map(dev, MT_EFUSE_BASE);
int ret, idx; int ret, idx;
mt76_wr(dev, MT_INT_SOURCE_CSR, ~0); mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
...@@ -154,7 +155,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev) ...@@ -154,7 +155,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev)
spin_lock_init(&dev->token_lock); spin_lock_init(&dev->token_lock);
idr_init(&dev->token); idr_init(&dev->token);
ret = mt7615_eeprom_init(dev); ret = mt7615_eeprom_init(dev, addr);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -360,7 +360,7 @@ int mt7615_register_device(struct mt7615_dev *dev); ...@@ -360,7 +360,7 @@ int mt7615_register_device(struct mt7615_dev *dev);
void mt7615_unregister_device(struct mt7615_dev *dev); void mt7615_unregister_device(struct mt7615_dev *dev);
int mt7615_register_ext_phy(struct mt7615_dev *dev); int mt7615_register_ext_phy(struct mt7615_dev *dev);
void mt7615_unregister_ext_phy(struct mt7615_dev *dev); void mt7615_unregister_ext_phy(struct mt7615_dev *dev);
int mt7615_eeprom_init(struct mt7615_dev *dev); int mt7615_eeprom_init(struct mt7615_dev *dev, u32 addr);
int mt7615_eeprom_get_power_index(struct mt7615_dev *dev, int mt7615_eeprom_get_power_index(struct mt7615_dev *dev,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
u8 chain_idx); u8 chain_idx);
......
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