Skip to content

Commit

Permalink
wil6210: use OEM MAC address from OTP
Browse files Browse the repository at this point in the history
In addition to existing MAC address field in OTP, new field added for
OEM MAC address.
wil6210 gives precedence to the new OEM MAC address and will use it if
its valid.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Dedy Lansky authored and Kalle Valo committed Apr 3, 2019
1 parent e4a29bd commit 7b83463
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
21 changes: 15 additions & 6 deletions drivers/net/wireless/ath/wil6210/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,13 +1413,22 @@ static int wil_get_otp_info(struct wil6210_priv *wil)
u8 mac[8];
int mac_addr;

if (wil->hw_version >= HW_VER_TALYN_MB)
mac_addr = RGF_OTP_MAC_TALYN_MB;
else
mac_addr = RGF_OTP_MAC;
/* OEM MAC has precedence */
mac_addr = RGF_OTP_OEM_MAC;
wil_memcpy_fromio_32(mac, wil->csr + HOSTADDR(mac_addr), sizeof(mac));

if (is_valid_ether_addr(mac)) {
wil_info(wil, "using OEM MAC %pM\n", mac);
} else {
if (wil->hw_version >= HW_VER_TALYN_MB)
mac_addr = RGF_OTP_MAC_TALYN_MB;
else
mac_addr = RGF_OTP_MAC;

wil_memcpy_fromio_32(mac, wil->csr + HOSTADDR(mac_addr),
sizeof(mac));
}

wil_memcpy_fromio_32(mac, wil->csr + HOSTADDR(mac_addr),
sizeof(mac));
if (!is_valid_ether_addr(mac)) {
wil_err(wil, "Invalid MAC %pM\n", mac);
return -EINVAL;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/wil6210/wil6210.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ struct RGF_ICR {
#define REVISION_ID_SPARROW_D0 (0x3)

#define RGF_OTP_MAC_TALYN_MB (0x8a0304)
#define RGF_OTP_OEM_MAC (0x8a0334)
#define RGF_OTP_MAC (0x8a0620)

/* Talyn-MB */
Expand Down

0 comments on commit 7b83463

Please sign in to comment.