Search Linux Wireless

Re: [PATCH 5/8] wifi: mt76: mt7996: support mt7992 eeprom loading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: StanleyYP Wang <StanleyYP.Wang@xxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxx>
> Signed-off-by: Shayne Chen <shayne.chen@xxxxxxxxxxxx>
> ---
>  .../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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux