Commit 18e8f43f authored by Golan Ben Ami's avatar Golan Ben Ami Committed by Luca Coelho

iwlwifi: support new csr addresses for hw address

In future devices we use different csr addresses for hw addresses.
Update csr addresses to support new and legacy devices.
Signed-off-by: default avatarGolan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent bf1ad897
...@@ -313,6 +313,10 @@ struct iwl_pwr_tx_backoff { ...@@ -313,6 +313,10 @@ struct iwl_pwr_tx_backoff {
* @flag_master_dis: disable master * @flag_master_dis: disable master
* @flag_stop_master: stop master * @flag_stop_master: stop master
* @addr_sw_reset: address for resetting the device * @addr_sw_reset: address for resetting the device
* @mac_addr0_otp: first part of MAC address from OTP
* @mac_addr1_otp: second part of MAC address from OTP
* @mac_addr0_strap: first part of MAC address from strap
* @mac_addr1_strap: second part of MAC address from strap
*/ */
struct iwl_csr_params { struct iwl_csr_params {
u8 flag_sw_reset; u8 flag_sw_reset;
...@@ -323,6 +327,10 @@ struct iwl_csr_params { ...@@ -323,6 +327,10 @@ struct iwl_csr_params {
u8 flag_master_dis; u8 flag_master_dis;
u8 flag_stop_master; u8 flag_stop_master;
u8 addr_sw_reset; u8 addr_sw_reset;
u32 mac_addr0_otp;
u32 mac_addr1_otp;
u32 mac_addr0_strap;
u32 mac_addr1_strap;
}; };
/** /**
...@@ -451,7 +459,11 @@ static const struct iwl_csr_params iwl_csr_v1 = { ...@@ -451,7 +459,11 @@ static const struct iwl_csr_params iwl_csr_v1 = {
.flag_sw_reset = 7, .flag_sw_reset = 7,
.flag_master_dis = 8, .flag_master_dis = 8,
.flag_stop_master = 9, .flag_stop_master = 9,
.addr_sw_reset = (CSR_BASE + 0x020) .addr_sw_reset = (CSR_BASE + 0x020),
.mac_addr0_otp = 0x380,
.mac_addr1_otp = 0x384,
.mac_addr0_strap = 0x388,
.mac_addr1_strap = 0x38C
}; };
static const struct iwl_csr_params iwl_csr_v2 = { static const struct iwl_csr_params iwl_csr_v2 = {
...@@ -462,7 +474,11 @@ static const struct iwl_csr_params iwl_csr_v2 = { ...@@ -462,7 +474,11 @@ static const struct iwl_csr_params iwl_csr_v2 = {
.flag_master_dis = 28, .flag_master_dis = 28,
.flag_stop_master = 29, .flag_stop_master = 29,
.flag_sw_reset = 31, .flag_sw_reset = 31,
.addr_sw_reset = (CSR_BASE + 0x024) .addr_sw_reset = (CSR_BASE + 0x024),
.mac_addr0_otp = 0x30,
.mac_addr1_otp = 0x34,
.mac_addr0_strap = 0x38,
.mac_addr1_strap = 0x3C
}; };
/* /*
......
...@@ -579,8 +579,12 @@ static void iwl_flip_hw_address(__le32 mac_addr0, __le32 mac_addr1, u8 *dest) ...@@ -579,8 +579,12 @@ static void iwl_flip_hw_address(__le32 mac_addr0, __le32 mac_addr1, u8 *dest)
static void iwl_set_hw_address_from_csr(struct iwl_trans *trans, static void iwl_set_hw_address_from_csr(struct iwl_trans *trans,
struct iwl_nvm_data *data) struct iwl_nvm_data *data)
{ {
__le32 mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_STRAP)); __le32 mac_addr0 =
__le32 mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_STRAP)); cpu_to_le32(iwl_read32(trans,
trans->cfg->csr->mac_addr0_strap));
__le32 mac_addr1 =
cpu_to_le32(iwl_read32(trans,
trans->cfg->csr->mac_addr1_strap));
iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr); iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
/* /*
...@@ -590,8 +594,10 @@ static void iwl_set_hw_address_from_csr(struct iwl_trans *trans, ...@@ -590,8 +594,10 @@ static void iwl_set_hw_address_from_csr(struct iwl_trans *trans,
if (is_valid_ether_addr(data->hw_addr)) if (is_valid_ether_addr(data->hw_addr))
return; return;
mac_addr0 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR0_OTP)); mac_addr0 = cpu_to_le32(iwl_read32(trans,
mac_addr1 = cpu_to_le32(iwl_read32(trans, CSR_MAC_ADDR1_OTP)); trans->cfg->csr->mac_addr0_otp));
mac_addr1 = cpu_to_le32(iwl_read32(trans,
trans->cfg->csr->mac_addr1_otp));
iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr); iwl_flip_hw_address(mac_addr0, mac_addr1, data->hw_addr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment