iwlwifi: mvm: take the MAC address from HW registers
authorEran Harary <eran.harary@intel.com>
Sun, 8 Feb 2015 09:41:43 +0000 (11:41 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 12 Mar 2015 07:57:30 +0000 (09:57 +0200)
For some configurations, the driver should get the MAC
address from the hardware registers and not from the
regular locations. Since the parsing of the MAC address
is the same regardless of its source, continue the regular
code path (parsing) after we read the registers.

Signed-off-by: Eran Harary <eran.harary@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-fw-file.h
drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
drivers/net/wireless/iwlwifi/iwl-nvm-parse.h
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/mvm/fw-api.h
drivers/net/wireless/iwlwifi/mvm/mac80211.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/nvm.c
drivers/net/wireless/iwlwifi/mvm/ops.c

index 5ea3818..81c2f48 100644 (file)
@@ -244,6 +244,7 @@ enum iwl_ucode_tlv_flag {
  * @IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF: ucode supports disabling dummy notif.
  * @IWL_UCODE_TLV_API_FRAGMENTED_SCAN: This ucode supports active dwell time
  *     longer than the passive one, which is essential for fragmented scan.
+ * @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
  * IWL_UCODE_TLV_API_HDC_PHASE_0: ucode supports finer configuration of LTR
  * @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command,
  *     regardless of the band or the number of the probes. FW will calculate
@@ -261,6 +262,7 @@ enum iwl_ucode_tlv_api {
        IWL_UCODE_TLV_API_DISABLE_STA_TX        = BIT(5),
        IWL_UCODE_TLV_API_SF_NO_DUMMY_NOTIF     = BIT(7),
        IWL_UCODE_TLV_API_FRAGMENTED_SCAN       = BIT(8),
+       IWL_UCODE_TLV_API_WIFI_MCC_UPDATE       = BIT(9),
        IWL_UCODE_TLV_API_HDC_PHASE_0           = BIT(10),
        IWL_UCODE_TLV_API_BASIC_DWELL           = BIT(13),
        IWL_UCODE_TLV_API_SCD_CFG               = BIT(15),
index d9423ed..54e447b 100644 (file)
@@ -542,7 +542,8 @@ static void iwl_set_hw_address_family_8000(struct device *dev,
                                           const struct iwl_cfg *cfg,
                                           struct iwl_nvm_data *data,
                                           const __le16 *mac_override,
-                                          const __le16 *nvm_hw)
+                                          const __le16 *nvm_hw,
+                                          u32 mac_addr0, u32 mac_addr1)
 {
        const u8 *hw_addr;
 
@@ -566,48 +567,17 @@ static void iwl_set_hw_address_family_8000(struct device *dev,
        }
 
        if (nvm_hw) {
-               /* read the MAC address from OTP */
-               if (!dev_is_pci(dev) || (data->nvm_version < 0xE08)) {
-                       /* read the mac address from the WFPM location */
-                       hw_addr = (const u8 *)(nvm_hw +
-                                              HW_ADDR0_WFPM_FAMILY_8000);
-                       data->hw_addr[0] = hw_addr[3];
-                       data->hw_addr[1] = hw_addr[2];
-                       data->hw_addr[2] = hw_addr[1];
-                       data->hw_addr[3] = hw_addr[0];
-
-                       hw_addr = (const u8 *)(nvm_hw +
-                                              HW_ADDR1_WFPM_FAMILY_8000);
-                       data->hw_addr[4] = hw_addr[1];
-                       data->hw_addr[5] = hw_addr[0];
-               } else if ((data->nvm_version >= 0xE08) &&
-                          (data->nvm_version < 0xE0B)) {
-                       /* read "reverse order"  from the PCIe location */
-                       hw_addr = (const u8 *)(nvm_hw +
-                                              HW_ADDR0_PCIE_FAMILY_8000);
-                       data->hw_addr[5] = hw_addr[2];
-                       data->hw_addr[4] = hw_addr[1];
-                       data->hw_addr[3] = hw_addr[0];
-
-                       hw_addr = (const u8 *)(nvm_hw +
-                                              HW_ADDR1_PCIE_FAMILY_8000);
-                       data->hw_addr[2] = hw_addr[3];
-                       data->hw_addr[1] = hw_addr[2];
-                       data->hw_addr[0] = hw_addr[1];
-               } else {
-                       /* read from the PCIe location */
-                       hw_addr = (const u8 *)(nvm_hw +
-                                              HW_ADDR0_PCIE_FAMILY_8000);
-                       data->hw_addr[5] = hw_addr[0];
-                       data->hw_addr[4] = hw_addr[1];
-                       data->hw_addr[3] = hw_addr[2];
-
-                       hw_addr = (const u8 *)(nvm_hw +
-                                              HW_ADDR1_PCIE_FAMILY_8000);
-                       data->hw_addr[2] = hw_addr[1];
-                       data->hw_addr[1] = hw_addr[2];
-                       data->hw_addr[0] = hw_addr[3];
-               }
+               /* read the MAC address from HW resisters */
+               hw_addr = (const u8 *)&mac_addr0;
+               data->hw_addr[0] = hw_addr[3];
+               data->hw_addr[1] = hw_addr[2];
+               data->hw_addr[2] = hw_addr[1];
+               data->hw_addr[3] = hw_addr[0];
+
+               hw_addr = (const u8 *)&mac_addr1;
+               data->hw_addr[4] = hw_addr[1];
+               data->hw_addr[5] = hw_addr[0];
+
                if (!is_valid_ether_addr(data->hw_addr))
                        IWL_ERR_DEV(dev,
                                    "mac address from hw section is not valid\n");
@@ -624,7 +594,8 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
                   const __le16 *nvm_calib, const __le16 *regulatory,
                   const __le16 *mac_override, const __le16 *phy_sku,
                   u8 tx_chains, u8 rx_chains,
-                  bool lar_fw_supported, bool is_family_8000_a_step)
+                  bool lar_fw_supported, bool is_family_8000_a_step,
+                  u32 mac_addr0, u32 mac_addr1)
 {
        struct iwl_nvm_data *data;
        u32 sku;
@@ -692,7 +663,7 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
 
                /* MAC address in family 8000 */
                iwl_set_hw_address_family_8000(dev, cfg, data, mac_override,
-                                              nvm_hw);
+                                              nvm_hw, mac_addr0, mac_addr1);
 
                iwl_init_sbands(dev, cfg, data, regulatory,
                                tx_chains, rx_chains,
index 18c3ff2..c995d2c 100644 (file)
@@ -79,7 +79,8 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg,
                   const __le16 *nvm_calib, const __le16 *regulatory,
                   const __le16 *mac_override, const __le16 *phy_sku,
                   u8 tx_chains, u8 rx_chains,
-                  bool lar_fw_supported, bool is_family_8000_a_step);
+                  bool lar_fw_supported, bool is_family_8000_a_step,
+                  u32 mac_addr0, u32 mac_addr1);
 
 /**
  * iwl_parse_mcc_info - parse MCC (mobile country code) info coming from FW