aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaim Dreyfuss <haim.dreyfuss@intel.com>2016-08-02 15:28:23 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-31 05:02:13 -0600
commit8a0b49af92c655b72f37bb445a3b8748de1160dc (patch)
tree1162cc596e2189f001958522b04e226edc1af400
parent6bda3c71202ed0cd80557afa27facad015982fca (diff)
downloadlinux-yocto-4.8-8a0b49af92c655b72f37bb445a3b8748de1160dc.tar.gz
linux-yocto-4.8-8a0b49af92c655b72f37bb445a3b8748de1160dc.tar.bz2
linux-yocto-4.8-8a0b49af92c655b72f37bb445a3b8748de1160dc.zip
iwlwifi: check for valid ethernet address provided by OEM
commit a6c934b364948cd4de5bd9ab055bb65206ec70f3 upstream. In 9000 family products we added an option to let the OEM fuse the mac address via registers. If these registers are zeroed we use the OTP address instead. Make sure that the address provided by the OEM is valid and, if not, fall back to the OTP address as well. Fixes: commit 17c867bfe89b ("iwlwifi: add support for getting HW address from CSR") Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 43f8f7d45ddb..adba3b003f55 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -564,11 +564,16 @@ static void iwl_set_hw_address_from_csr(struct iwl_trans *trans,
__le32 mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_STRAP));
__le32 mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_STRAP));
- /* If OEM did not fuse address - get it from OTP */
- if (!mac_addr0 && !mac_addr1) {
- mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_OTP));
- mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_OTP));
- }
+ iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
+ /*
+ * If the OEM fused a valid address, use it instead of the one in the
+ * OTP
+ */
+ if (is_valid_ether_addr(data->hw_addr))
+ return;
+
+ mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_OTP));
+ mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_OTP));
iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
}