Skip to content

Commit

Permalink
iwm(4): use correct channel list source for Intel 3168
Browse files Browse the repository at this point in the history
Intel 3168 uses another EEPROM section to store channel flags;
port missing bits from iwlwifi to make it work.

PR:		230750, 236235
Tested by:	Bert JW Regeer <xistence@0x58.com>
MFC after:	3 days
  • Loading branch information
avos authored and avos committed Mar 11, 2019
1 parent 5f8c1f5 commit 4545fe8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sys/dev/iwm/if_iwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
}

if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) {
memcpy(data->nvm_ch_flags, &nvm_sw[IWM_NVM_CHANNELS],
memcpy(data->nvm_ch_flags, sc->cfg->nvm_type == IWM_NVM_SDP ?
&regulatory[0] : &nvm_sw[IWM_NVM_CHANNELS],
IWM_NUM_CHANNELS * sizeof(uint16_t));
} else {
memcpy(data->nvm_ch_flags, &regulatory[IWM_NVM_CHANNELS_8000],
Expand Down Expand Up @@ -2271,8 +2272,9 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iwm_nvm_section *sections)
sw = (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_SW].data;
calib = (const uint16_t *)
sections[IWM_NVM_SECTION_TYPE_CALIBRATION].data;
regulatory = (const uint16_t *)
sections[IWM_NVM_SECTION_TYPE_REGULATORY].data;
regulatory = sc->cfg->nvm_type == IWM_NVM_SDP ?
(const uint16_t *)sections[IWM_NVM_SECTION_TYPE_REGULATORY_SDP].data :
(const uint16_t *)sections[IWM_NVM_SECTION_TYPE_REGULATORY].data;
mac_override = (const uint16_t *)
sections[IWM_NVM_SECTION_TYPE_MAC_OVERRIDE].data;
phy_sku = (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_PHY_SKU].data;
Expand Down
1 change: 1 addition & 0 deletions sys/dev/iwm/if_iwm_7000.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const struct iwm_cfg iwm3168_cfg = {
.fw_name = IWM3168_FW,
IWM_DEVICE_7000_COMMON,
.host_interrupt_operation_mode = 0,
.nvm_type = IWM_NVM_SDP,
};

const struct iwm_cfg iwm7265_cfg = {
Expand Down
15 changes: 15 additions & 0 deletions sys/dev/iwm/if_iwm_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ static inline uint8_t num_of_ant(uint8_t mask)
#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(uint16_t)) /* 32 KB */
#define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000 IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000


/**
* enum iwl_nvm_type - nvm formats
* @IWM_NVM: the regular format
* @IWM_NVM_EXT: extended NVM format
* @IWM_NVM_SDP: NVM format used by 3168 series
*/
enum iwm_nvm_type {
IWM_NVM,
IWM_NVM_EXT,
IWM_NVM_SDP,
};

/**
* struct iwm_cfg
* @name: Official name of the device
Expand All @@ -113,6 +126,7 @@ static inline uint8_t num_of_ant(uint8_t mask)
* @nvm_hw_section_num: the ID of the HW NVM section
* @apmg_wake_up_wa: should the MAC access REQ be asserted when a command
* is in flight. This is due to a HW bug in 7260, 3160 and 7265.
* @nvm_type: see &enum iwl_nvm_type
*/
struct iwm_cfg {
const char *name;
Expand All @@ -122,6 +136,7 @@ struct iwm_cfg {
int host_interrupt_operation_mode;
uint8_t nvm_hw_section_num;
int apmg_wake_up_wa;
enum iwm_nvm_type nvm_type;
};

/*
Expand Down
1 change: 1 addition & 0 deletions sys/dev/iwm/if_iwmreg.h
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,7 @@ enum {
IWM_NVM_SECTION_TYPE_REGULATORY = 3,
IWM_NVM_SECTION_TYPE_CALIBRATION = 4,
IWM_NVM_SECTION_TYPE_PRODUCTION = 5,
IWM_NVM_SECTION_TYPE_REGULATORY_SDP = 8,
IWM_NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
IWM_NVM_SECTION_TYPE_PHY_SKU = 12,
IWM_NVM_MAX_NUM_SECTIONS = 13,
Expand Down

0 comments on commit 4545fe8

Please sign in to comment.