diff mbox

wl18xx: use locally administered MAC address if not available from fuse

Message ID 1368002677-16772-1-git-send-email-coelho@ti.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Luciano Coelho May 8, 2013, 8:44 a.m. UTC
In some R&D chips, the device may be left untrimmed and with the MAC
address missing from fuse ROM.  In order to support those devices,
apply a locally administered MAC address instead and generate print
out a message to warn the user.

Based on the original patch by Victor Goldenshtein.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/ti/wl18xx/main.c   |    6 ++++++
 drivers/net/wireless/ti/wl18xx/wl18xx.h |    9 +++++++++
 2 files changed, 15 insertions(+)
diff mbox

Patch

diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index ae85ae4..e296f34 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -1318,6 +1318,12 @@  static int wl18xx_get_mac(struct wl1271 *wl)
 		((mac1 & 0xff000000) >> 24);
 	wl->fuse_nic_addr = (mac1 & 0xffffff);
 
+	if (!wl->fuse_oui_addr && !wl->fuse_nic_addr) {
+		wl->fuse_oui_addr = WL18XX_DEFAULT_LOCAL_OUI;
+		wl->fuse_nic_addr = WL18XX_DEFAULT_LOCAL_NIC;
+		wl1271_warning("MAC address from fuse ROM not available, using locally administered addresses.");
+	}
+
 	ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]);
 
 out:
diff --git a/drivers/net/wireless/ti/wl18xx/wl18xx.h b/drivers/net/wireless/ti/wl18xx/wl18xx.h
index 9204e07..e76bfc7 100644
--- a/drivers/net/wireless/ti/wl18xx/wl18xx.h
+++ b/drivers/net/wireless/ti/wl18xx/wl18xx.h
@@ -42,6 +42,15 @@ 
 
 #define WL18XX_RX_BA_MAX_SESSIONS 5
 
+/*
+ * Locally administered MAC address to be used when unavailable in
+ * fuse ROM.  This is TI's 08:00:28 OUI with the locally administered
+ * bit set.  Note that this is actually the assigned BDADDR, the WLAN
+ * MAC addresses are generated incrementally from this one.
+ */
+#define WL18XX_DEFAULT_LOCAL_OUI	(0x0a0028)
+#define WL18XX_DEFAULT_LOCAL_NIC	(0x000000)
+
 struct wl18xx_priv {
 	/* buffer for sending commands to FW */
 	u8 cmd_buf[WL18XX_CMD_MAX_SIZE];