Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 300909
b: refs/heads/master
c: 30d9b4a
h: refs/heads/master
i:
  300907: 5c38716
v: v3
  • Loading branch information
Luciano Coelho committed Apr 12, 2012
1 parent 0856f6a commit 29286f6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 51 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dd5512eb6b8317069e80d70a624b6d350afebc9e
refs/heads/master: 30d9b4a58bc168620eed0fc6d90b2f05cd02a462
52 changes: 52 additions & 0 deletions trunk/drivers/net/wireless/ti/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,51 @@ static int wl12xx_boot(struct wl1271 *wl)
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;
Expand All @@ -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)
Expand Down
52 changes: 2 additions & 50 deletions trunk/drivers/net/wireless/ti/wlcore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@
#include "testmode.h"
#include "scan.h"

/* TODO: remove this once the FUSE definitions are separated */
#include "../wl12xx/reg.h"

#define WL1271_BOOT_RETRIES 3

static struct conf_drv_settings default_conf = {
Expand Down Expand Up @@ -4993,34 +4990,6 @@ static struct bin_attribute fwlog_attr = {
.read = wl1271_sysfs_read_fwlog,
};

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_derive_mac_addresses(struct wl1271 *wl,
u32 oui, u32 nic, int n)
{
Expand All @@ -5046,23 +5015,6 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl,
wl->hw->wiphy->addresses = wl->addresses;
}

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 int wl12xx_get_hw_info(struct wl1271 *wl)
{
int ret;
Expand All @@ -5078,8 +5030,8 @@ static int wl12xx_get_hw_info(struct wl1271 *wl)

wl->hw_pg_ver = wl->ops->get_pg_ver(wl);

if (wl12xx_mac_in_fuse(wl))
wl12xx_get_fuse_mac(wl);
if (wl->ops->get_mac)
wl->ops->get_mac(wl);

wl1271_power_off(wl);
out:
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ti/wlcore/wlcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct wlcore_ops {
int (*identify_chip)(struct wl1271 *wl);
int (*boot)(struct wl1271 *wl);
s8 (*get_pg_ver)(struct wl1271 *wl);
void (*get_mac)(struct wl1271 *wl);
};

enum wlcore_partitions {
Expand Down

0 comments on commit 29286f6

Please sign in to comment.