* [PATCH] mt76: mt7615: select wifi band according to eeprom [not found] <cover.1558127930.git.lorenzo@kernel.org> @ 2019-05-17 21:32 ` Lorenzo Bianconi 2019-05-17 21:35 ` Lorenzo Bianconi 2019-06-07 16:56 ` Felix Fietkau 0 siblings, 2 replies; 3+ messages in thread From: Lorenzo Bianconi @ 2019-05-17 21:32 UTC (permalink / raw) To: nbd; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee, royluo Select supported band according to the value read from eeprom mtd/otp partition Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- .../wireless/mediatek/mt76/mt7615/eeprom.c | 24 ++++++++++++++++--- .../wireless/mediatek/mt76/mt7615/eeprom.h | 9 +++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c index 1712f66520a8..714590878d65 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c @@ -90,6 +90,26 @@ static int mt7615_check_eeprom(struct mt76_dev *dev) } } +static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) +{ + u8 val, *eeprom = dev->mt76.eeprom.data; + + val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL, + eeprom[MT_EE_WIFI_CONF]); + switch (val) { + case MT_EE_5GHZ: + dev->mt76.cap.has_5ghz = true; + break; + case MT_EE_2GHZ: + dev->mt76.cap.has_2ghz = true; + break; + default: + dev->mt76.cap.has_2ghz = true; + dev->mt76.cap.has_5ghz = true; + break; + } +} + int mt7615_eeprom_init(struct mt7615_dev *dev) { int ret; @@ -103,9 +123,7 @@ int mt7615_eeprom_init(struct mt7615_dev *dev) memcpy(dev->mt76.eeprom.data, dev->mt76.otp.data, MT7615_EEPROM_SIZE); - dev->mt76.cap.has_2ghz = true; - dev->mt76.cap.has_5ghz = true; - + mt7615_eeprom_parse_hw_cap(dev); memcpy(dev->mt76.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, ETH_ALEN); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h index a4cf16688171..b422e395d6ee 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h @@ -11,8 +11,17 @@ enum mt7615_eeprom_field { MT_EE_VERSION = 0x002, MT_EE_MAC_ADDR = 0x004, MT_EE_NIC_CONF_0 = 0x034, + MT_EE_WIFI_CONF = 0x03e, __MT_EE_MAX = 0x3bf }; +#define MT_EE_NIC_WIFI_CONF_BAND_SEL GENMASK(5, 4) +enum mt7615_eeprom_band { + MT_EE_DUAL_BAND, + MT_EE_5GHZ, + MT_EE_2GHZ, + MT_EE_DBDC, +}; + #endif -- 2.20.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mt76: mt7615: select wifi band according to eeprom 2019-05-17 21:32 ` [PATCH] mt76: mt7615: select wifi band according to eeprom Lorenzo Bianconi @ 2019-05-17 21:35 ` Lorenzo Bianconi 2019-06-07 16:56 ` Felix Fietkau 1 sibling, 0 replies; 3+ messages in thread From: Lorenzo Bianconi @ 2019-05-17 21:35 UTC (permalink / raw) To: Felix Fietkau; +Cc: linux-wireless, Ryder Lee, royluo > > Select supported band according to the value read from > eeprom mtd/otp partition > I forgot to mention this patch is based on 'mt76: mt7615: add support for mtd eeprom parsing' https://patchwork.kernel.org/patch/10947385/ Regards, Lorenzo > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > --- > .../wireless/mediatek/mt76/mt7615/eeprom.c | 24 ++++++++++++++++--- > .../wireless/mediatek/mt76/mt7615/eeprom.h | 9 +++++++ > 2 files changed, 30 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c > index 1712f66520a8..714590878d65 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c > @@ -90,6 +90,26 @@ static int mt7615_check_eeprom(struct mt76_dev *dev) > } > } > > +static void mt7615_eeprom_parse_hw_cap(struct mt7615_dev *dev) > +{ > + u8 val, *eeprom = dev->mt76.eeprom.data; > + > + val = FIELD_GET(MT_EE_NIC_WIFI_CONF_BAND_SEL, > + eeprom[MT_EE_WIFI_CONF]); > + switch (val) { > + case MT_EE_5GHZ: > + dev->mt76.cap.has_5ghz = true; > + break; > + case MT_EE_2GHZ: > + dev->mt76.cap.has_2ghz = true; > + break; > + default: > + dev->mt76.cap.has_2ghz = true; > + dev->mt76.cap.has_5ghz = true; > + break; > + } > +} > + > int mt7615_eeprom_init(struct mt7615_dev *dev) > { > int ret; > @@ -103,9 +123,7 @@ int mt7615_eeprom_init(struct mt7615_dev *dev) > memcpy(dev->mt76.eeprom.data, dev->mt76.otp.data, > MT7615_EEPROM_SIZE); > > - dev->mt76.cap.has_2ghz = true; > - dev->mt76.cap.has_5ghz = true; > - > + mt7615_eeprom_parse_hw_cap(dev); > memcpy(dev->mt76.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, > ETH_ALEN); > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h > index a4cf16688171..b422e395d6ee 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.h > @@ -11,8 +11,17 @@ enum mt7615_eeprom_field { > MT_EE_VERSION = 0x002, > MT_EE_MAC_ADDR = 0x004, > MT_EE_NIC_CONF_0 = 0x034, > + MT_EE_WIFI_CONF = 0x03e, > > __MT_EE_MAX = 0x3bf > }; > > +#define MT_EE_NIC_WIFI_CONF_BAND_SEL GENMASK(5, 4) > +enum mt7615_eeprom_band { > + MT_EE_DUAL_BAND, > + MT_EE_5GHZ, > + MT_EE_2GHZ, > + MT_EE_DBDC, > +}; > + > #endif > -- > 2.20.1 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mt76: mt7615: select wifi band according to eeprom 2019-05-17 21:32 ` [PATCH] mt76: mt7615: select wifi band according to eeprom Lorenzo Bianconi 2019-05-17 21:35 ` Lorenzo Bianconi @ 2019-06-07 16:56 ` Felix Fietkau 1 sibling, 0 replies; 3+ messages in thread From: Felix Fietkau @ 2019-06-07 16:56 UTC (permalink / raw) To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, ryder.lee, royluo On 2019-05-17 23:32, Lorenzo Bianconi wrote: > Select supported band according to the value read from > eeprom mtd/otp partition > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Applied, thanks. - Felix ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-07 16:56 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <cover.1558127930.git.lorenzo@kernel.org> 2019-05-17 21:32 ` [PATCH] mt76: mt7615: select wifi band according to eeprom Lorenzo Bianconi 2019-05-17 21:35 ` Lorenzo Bianconi 2019-06-07 16:56 ` Felix Fietkau
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).