diff options
author | Luciano Coelho <coelho@ti.com> | 2012-04-11 11:07:28 +0300 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2012-04-12 08:43:57 +0300 |
commit | 30d9b4a58bc168620eed0fc6d90b2f05cd02a462 (patch) | |
tree | 8e12315f08cfa4909e4e736014d57370ee00c4e8 /drivers/net/wireless/ti/wl12xx/main.c | |
parent | dd5512eb6b8317069e80d70a624b6d350afebc9e (diff) | |
download | blackbird-op-linux-30d9b4a58bc168620eed0fc6d90b2f05cd02a462.tar.gz blackbird-op-linux-30d9b4a58bc168620eed0fc6d90b2f05cd02a462.zip |
wlcore/wl12xx: move MAC address reading operation to lower driver
Different chip families have the factory MAC address written in
different places. Add a new hardware operation to read the MAC
address, if available.
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti/wl12xx/main.c')
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index d235da244a21..cef2884b37c8 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c @@ -571,6 +571,51 @@ out: return ret; } +static bool wl12xx_mac_in_fuse(struct wl1271 *wl) +{ + bool supported = false; + u8 major, minor; + + if (wl->chip.id == CHIP_ID_1283_PG20) { + major = WL128X_PG_GET_MAJOR(wl->hw_pg_ver); + minor = WL128X_PG_GET_MINOR(wl->hw_pg_ver); + + /* in wl128x we have the MAC address if the PG is >= (2, 1) */ + if (major > 2 || (major == 2 && minor >= 1)) + supported = true; + } else { + major = WL127X_PG_GET_MAJOR(wl->hw_pg_ver); + minor = WL127X_PG_GET_MINOR(wl->hw_pg_ver); + + /* in wl127x we have the MAC address if the PG is >= (3, 1) */ + if (major == 3 && minor >= 1) + supported = true; + } + + wl1271_debug(DEBUG_PROBE, + "PG Ver major = %d minor = %d, MAC %s present", + major, minor, supported ? "is" : "is not"); + + return supported; +} + +static void wl12xx_get_fuse_mac(struct wl1271 *wl) +{ + u32 mac1, mac2; + + wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); + + mac1 = wl1271_read32(wl, WL12XX_REG_FUSE_BD_ADDR_1); + mac2 = wl1271_read32(wl, WL12XX_REG_FUSE_BD_ADDR_2); + + /* these are the two parts of the BD_ADDR */ + wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + + ((mac1 & 0xff000000) >> 24); + wl->fuse_nic_addr = mac1 & 0xffffff; + + wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); +} + static s8 wl12xx_get_pg_ver(struct wl1271 *wl) { u32 die_info; @@ -583,10 +628,17 @@ static s8 wl12xx_get_pg_ver(struct wl1271 *wl) return (s8) (die_info & PG_VER_MASK) >> PG_VER_OFFSET; } +static void wl12xx_get_mac(struct wl1271 *wl) +{ + if (wl12xx_mac_in_fuse(wl)) + wl12xx_get_fuse_mac(wl); +} + static struct wlcore_ops wl12xx_ops = { .identify_chip = wl12xx_identify_chip, .boot = wl12xx_boot, .get_pg_ver = wl12xx_get_pg_ver, + .get_mac = wl12xx_get_mac, }; static int __devinit wl12xx_probe(struct platform_device *pdev) |