Commit b3d95f09 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: mt7615: introduce mt7615_eeprom_parse_hw_band_cap routine



Introduce mt7615_eeprom_parse_hw_band_cap routine in order to configure
supported band for mt7663e and mt7622 devices since they do not rely on
eeprom data to enable 2GHz/5GHz bands

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent c321a3d7
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -91,11 +91,23 @@ static int mt7615_check_eeprom(struct mt76_dev *dev)
	}
}

static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
static void
mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev)
{
	u8 *eeprom = dev->mt76.eeprom.data;
	u8 tx_mask, max_nss;
	u32 val;
	u8 val, *eeprom = dev->mt76.eeprom.data;

	if (is_mt7663(&dev->mt76)) {
		/* dual band */
		dev->mt76.cap.has_2ghz = true;
		dev->mt76.cap.has_5ghz = true;
		return;
	}

	if (is_mt7622(&dev->mt76)) {
		/* 2GHz only */
		dev->mt76.cap.has_2ghz = true;
		return;
	}

	val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL,
			eeprom[MT_EE_WIFI_CONF]);
@@ -111,9 +123,15 @@ static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
		dev->mt76.cap.has_5ghz = true;
		break;
	}
}

static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev)
{
	u8 *eeprom = dev->mt76.eeprom.data;
	u8 tx_mask, max_nss;
	u32 val;

	if (is_mt7622(&dev->mt76))
		dev->mt76.cap.has_5ghz = false;
	mt7615_eeprom_parse_hw_band_cap(dev);

	/* read tx-rx mask from eeprom */
	val = mt76_rr(dev, MT_TOP_STRAP_STA);