All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Shayne Chen <shayne.chen@mediatek.com>
Cc: Felix Fietkau <nbd@nbd.name>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	Bo Jiao <Bo.Jiao@mediatek.com>,
	linux-mediatek <linux-mediatek@lists.infradead.org>,
	StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Subject: Re: [PATCH 5/8] wifi: mt76: mt7996: support mt7992 eeprom loading
Date: Mon, 13 Nov 2023 12:08:49 +0100	[thread overview]
Message-ID: <ZVIDwUD8ESJIpsnM@lore-desk> (raw)
In-Reply-To: <20231113070619.19964-6-shayne.chen@mediatek.com>

[-- Attachment #1: Type: text/plain, Size: 2480 bytes --]

> From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> 
> Add the default eeprom and 0x7992 check to mt7996_check_eeprom().
> This is a preliminary patch for mt7992 chipsets support.
> 
> Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt7996/eeprom.c    | 15 ++++++++++++---
>  .../net/wireless/mediatek/mt76/mt7996/mt7996.h    |  1 +
>  2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
> index 9db7e531076d..9c3735bed50c 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
> @@ -12,9 +12,12 @@ static int mt7996_check_eeprom(struct mt7996_dev *dev)
>  	u8 *eeprom = dev->mt76.eeprom.data;
>  	u16 val = get_unaligned_le16(eeprom);
>  
> +#define CHECK_EEPROM_ERR(match)	(match ? 0 : -EINVAL)

I do not see the point of using this macro here, the code is so simply you can
use 'open code' directly.

Regards,
Lorenzo

>  	switch (val) {
>  	case 0x7990:
> -		return 0;
> +		return CHECK_EEPROM_ERR(is_mt7996(&dev->mt76));
> +	case 0x7992:
> +		return CHECK_EEPROM_ERR(is_mt7992(&dev->mt76));
>  	default:
>  		return -EINVAL;
>  	}
> @@ -22,8 +25,14 @@ static int mt7996_check_eeprom(struct mt7996_dev *dev)
>  
>  static char *mt7996_eeprom_name(struct mt7996_dev *dev)
>  {
> -	/* reserve for future variants */
> -	return MT7996_EEPROM_DEFAULT;
> +	switch (mt76_chip(&dev->mt76)) {
> +	case 0x7990:
> +		return MT7996_EEPROM_DEFAULT;
> +	case 0x7992:
> +		return MT7992_EEPROM_DEFAULT;
> +	default:
> +		return MT7996_EEPROM_DEFAULT;
> +	}
>  }
>  
>  static int
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
> index 87822663870f..5cdde28ce83f 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h
> @@ -39,6 +39,7 @@
>  #define MT7992_ROM_PATCH		"mediatek/mt7996/mt7992_rom_patch.bin"
>  
>  #define MT7996_EEPROM_DEFAULT		"mediatek/mt7996/mt7996_eeprom.bin"
> +#define MT7992_EEPROM_DEFAULT		"mediatek/mt7996/mt7992_eeprom.bin"
>  #define MT7996_EEPROM_SIZE		7680
>  #define MT7996_EEPROM_BLOCK_SIZE	16
>  #define MT7996_TOKEN_SIZE		16384
> -- 
> 2.39.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-11-13 11:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13  7:06 [PATCH 0/8] Add MT7992 support Shayne Chen
2023-11-13  7:06 ` [PATCH 1/8] wifi: mt76: mt7996: introduce mt7996_band_valid() Shayne Chen
2023-11-13  7:06 ` [PATCH 2/8] wifi: mt76: connac: add firmware support for mt7992 Shayne Chen
2023-11-13  7:06 ` [PATCH 3/8] wifi: mt76: mt7996: add DMA " Shayne Chen
2023-11-13  7:06 ` [PATCH 4/8] wifi: mt76: mt7996: rework register offsets " Shayne Chen
2023-11-13  7:06 ` [PATCH 5/8] wifi: mt76: mt7996: support mt7992 eeprom loading Shayne Chen
2023-11-13 11:08   ` Lorenzo Bianconi [this message]
2023-11-13  7:06 ` [PATCH 6/8] wifi: mt76: mt7996: adjust interface num and wtbl size for mt7992 Shayne Chen
2023-11-13  7:06 ` [PATCH 7/8] wifi: mt76: connac: add new definition of tx descriptor Shayne Chen
2023-11-13  7:06 ` [PATCH 8/8] wifi: mt76: mt7996: add PCI IDs for mt7992 Shayne Chen

Reply instructions:

You may reply publicly 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=ZVIDwUD8ESJIpsnM@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=Bo.Jiao@mediatek.com \
    --cc=StanleyYP.Wang@mediatek.com \
    --cc=evelyn.tsai@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=shayne.chen@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.