Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	royluo@google.com
Subject: Re: [PATCH] mt76: mt7615: select wifi band according to eeprom
Date: Fri, 17 May 2019 23:35:37 +0200
Message-ID: <CAJ0CqmXen_WGJRxjt4Kzr0SPrT=rTSUToUXFz=d7EZnLP11a3w@mail.gmail.com> (raw)
In-Reply-To: <38aa977df45a92f60d78d9cb7e575289ccbaeef6.1558127930.git.lorenzo@kernel.org>

>
> 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
>

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1558127930.git.lorenzo@kernel.org>
2019-05-17 21:32 ` Lorenzo Bianconi
2019-05-17 21:35   ` Lorenzo Bianconi [this message]
2019-06-07 16:56   ` Felix Fietkau

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ0CqmXen_WGJRxjt4Kzr0SPrT=rTSUToUXFz=d7EZnLP11a3w@mail.gmail.com' \
    --to=lorenzo.bianconi@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=royluo@google.com \
    --cc=ryder.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox