Message ID | 20221110153953.22562-3-nicolas.cavallari@green-communications.fr (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Felix Fietkau |
Headers | show |
Series | [1/4] wifi: mt76: mt7915: fix antenna selection with bad eeprom. | expand |
On 10.11.22 16:39, Nicolas Cavallari wrote: > mt7915 does not have a per-band number of chains unlike the other chips, > it only has a total number of chains. Yet the current code would > consider the total number as a per-band number. > > For example, it would report that a 2x2 + 2x2 DBDC card have 4 chains on > each band and set chainmask to 0b1111 for the first interface and > 0b11110000 for the second. > > Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986") > Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr> > --- > drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c > index 83bced0c0785..8bb971018a1e 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c > @@ -194,6 +194,7 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, > nss = path; > if (dev->dbdc_support) { > if (is_mt7915(&dev->mt76)) { > + path = path / 2; > nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0, > eeprom[MT_EE_WIFI_CONF + 3]); > if (phy->band_idx) This was causing a regression on properly calibrated DBDC cards, where the 'path' variable contains the per-band path, not the total path. I've folded in the following change to fix your commit: --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -194,7 +194,7 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, nss = path; if (dev->dbdc_support) { if (is_mt7915(&dev->mt76)) { - path = path / 2; + path = min_t(u8, path, 2); nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0, eeprom[MT_EE_WIFI_CONF + 3]); if (phy->band_idx)
On 12/11/2022 19:17, Felix Fietkau wrote: > On 10.11.22 16:39, Nicolas Cavallari wrote: >> mt7915 does not have a per-band number of chains unlike the other chips, >> it only has a total number of chains. Yet the current code would >> consider the total number as a per-band number. >> >> For example, it would report that a 2x2 + 2x2 DBDC card have 4 chains on >> each band and set chainmask to 0b1111 for the first interface and >> 0b11110000 for the second. >> >> Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986") >> Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr> >> --- >> drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c >> index 83bced0c0785..8bb971018a1e 100644 >> --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c >> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c >> @@ -194,6 +194,7 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, >> nss = path; >> if (dev->dbdc_support) { >> if (is_mt7915(&dev->mt76)) { >> + path = path / 2; >> nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0, >> eeprom[MT_EE_WIFI_CONF + 3]); >> if (phy->band_idx) > This was causing a regression on properly calibrated DBDC cards, where > the 'path' variable contains the per-band path, not the total path. > I've folded in the following change to fix your commit: > > [...] Maybe the commit message need to be changed too, because it contains my wrong interpretation of the eeprom field...
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c index 83bced0c0785..8bb971018a1e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -194,6 +194,7 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, nss = path; if (dev->dbdc_support) { if (is_mt7915(&dev->mt76)) { + path = path / 2; nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0, eeprom[MT_EE_WIFI_CONF + 3]); if (phy->band_idx)
mt7915 does not have a per-band number of chains unlike the other chips, it only has a total number of chains. Yet the current code would consider the total number as a per-band number. For example, it would report that a 2x2 + 2x2 DBDC card have 4 chains on each band and set chainmask to 0b1111 for the first interface and 0b11110000 for the second. Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986") Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr> --- drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 1 + 1 file changed, 1 insertion(+)