mt76: mt76x0: handle chip specific initval differences
Some RF registers need different values for various chips. For at least mt76x0_rf_central_tab registers, overwriting them later does not work, as the wrong values can cause the entire system to hang on some devices with MT7610E Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
@@ -33,8 +33,10 @@
|
|||||||
|
|
||||||
static inline bool is_mt7610e(struct mt76x02_dev *dev)
|
static inline bool is_mt7610e(struct mt76x02_dev *dev)
|
||||||
{
|
{
|
||||||
/* TODO */
|
if (!mt76_is_mmio(dev))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return mt76_chip(&dev->mt76) == 0x7610;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool is_mt7630(struct mt76x02_dev *dev)
|
static inline bool is_mt7630(struct mt76x02_dev *dev)
|
||||||
|
|||||||
@@ -742,13 +742,56 @@ static void mt76x0_phy_calibration_work(struct work_struct *work)
|
|||||||
MT_CALIBRATE_INTERVAL);
|
MT_CALIBRATE_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mt76x0_rf_patch_reg_array(struct mt76x02_dev *dev,
|
||||||
|
const struct mt76_reg_pair *rp, int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
u32 reg = rp[i].reg;
|
||||||
|
u8 val = rp[i].value;
|
||||||
|
|
||||||
|
switch (reg) {
|
||||||
|
case MT_RF(0, 3):
|
||||||
|
if (mt76_is_mmio(dev)) {
|
||||||
|
if (is_mt7630(dev))
|
||||||
|
val = 0x70;
|
||||||
|
else
|
||||||
|
val = 0x63;
|
||||||
|
} else {
|
||||||
|
val = 0x73;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MT_RF(0, 21):
|
||||||
|
if (is_mt7610e(dev))
|
||||||
|
val = 0x10;
|
||||||
|
else
|
||||||
|
val = 0x12;
|
||||||
|
break;
|
||||||
|
case MT_RF(5, 2):
|
||||||
|
if (is_mt7630(dev))
|
||||||
|
val = 0x1d;
|
||||||
|
else if (is_mt7610e(dev))
|
||||||
|
val = 0x00;
|
||||||
|
else
|
||||||
|
val = 0x0c;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
mt76x0_rf_wr(dev, reg, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void mt76x0_phy_rf_init(struct mt76x02_dev *dev)
|
static void mt76x0_phy_rf_init(struct mt76x02_dev *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
RF_RANDOM_WRITE(dev, mt76x0_rf_central_tab);
|
mt76x0_rf_patch_reg_array(dev, mt76x0_rf_central_tab,
|
||||||
RF_RANDOM_WRITE(dev, mt76x0_rf_2g_channel_0_tab);
|
ARRAY_SIZE(mt76x0_rf_central_tab));
|
||||||
|
mt76x0_rf_patch_reg_array(dev, mt76x0_rf_2g_channel_0_tab,
|
||||||
|
ARRAY_SIZE(mt76x0_rf_2g_channel_0_tab));
|
||||||
RF_RANDOM_WRITE(dev, mt76x0_rf_5g_channel_0_tab);
|
RF_RANDOM_WRITE(dev, mt76x0_rf_5g_channel_0_tab);
|
||||||
RF_RANDOM_WRITE(dev, mt76x0_rf_vga_channel_0_tab);
|
RF_RANDOM_WRITE(dev, mt76x0_rf_vga_channel_0_tab);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user