Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111410
b: refs/heads/master
c: fb11137
h: refs/heads/master
v: v3
  • Loading branch information
Michael Buesch authored and John W. Linville committed Sep 5, 2008
1 parent 7f2f487 commit f27fed4
Show file tree
Hide file tree
Showing 12 changed files with 179 additions and 110 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: 7cb770729ba895f73253dfcd46c3fcba45d896f9
refs/heads/master: fb11137af83b7b66c7aab8dbc5f09d2c95684fed
36 changes: 22 additions & 14 deletions trunk/drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,12 @@ void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
ssb_read32(dev->dev, SSB_TMSLOW); /* flush */
msleep(1);

/* Turn Analog ON */
b43_switch_analog(dev, 1);
/* Turn Analog ON, but only if we already know the PHY-type.
* This protects against very early setup where we don't know the
* PHY-type, yet. wireless_core_reset will be called once again later,
* when we know the PHY-type. */
if (dev->phy.ops)
b43_switch_analog(dev, 1);

macctl = b43_read32(dev, B43_MMIO_MACCTL);
macctl &= ~B43_MACCTL_GMODE;
Expand Down Expand Up @@ -2694,6 +2698,7 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
/* This is the opposite of b43_chip_init() */
static void b43_chip_exit(struct b43_wldev *dev)
{
b43_phy_exit(dev);
b43_gpio_cleanup(dev);
/* firmware is released later */
}
Expand Down Expand Up @@ -3952,7 +3957,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
dev_kfree_skb_any(dev->wl->current_beacon);
dev->wl->current_beacon = NULL;
}
b43_phy_exit(dev);

ssb_device_disable(dev->dev, 0);
ssb_bus_may_powerdown(dev->dev->bus);
Expand All @@ -3979,24 +3983,23 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
b43_wireless_core_reset(dev, tmp);
}

/* Reset all data structures. */
setup_struct_wldev_for_init(dev);
err = b43_phy_operations_setup(dev);
if (err)
goto err_busdown;
phy->ops->prepare_structs(dev);

/* Enable IRQ routing to this device. */
ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev);

b43_imcfglo_timeouts_workaround(dev);
b43_bluetooth_coext_disable(dev);
if (phy->ops->prepare) {
err = phy->ops->prepare(dev);
if (phy->ops->prepare_hardware) {
err = phy->ops->prepare_hardware(dev);
if (err)
goto err_phy_exit;
goto err_busdown;
}
err = b43_chip_init(dev);
if (err)
goto err_phy_exit;
goto err_busdown;
b43_shm_write16(dev, B43_SHM_SHARED,
B43_SHM_SH_WLCOREREV, dev->dev->id.revision);
hf = b43_hf_read(dev);
Expand Down Expand Up @@ -4064,8 +4067,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev)

err_chip_exit:
b43_chip_exit(dev);
err_phy_exit:
b43_phy_exit(dev);
err_busdown:
ssb_bus_may_powerdown(bus);
B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT);
Expand Down Expand Up @@ -4342,6 +4343,7 @@ static void b43_wireless_core_detach(struct b43_wldev *dev)
/* We release firmware that late to not be required to re-request
* is all the time when we reinit the core. */
b43_release_firmware(dev);
b43_phy_free(dev);
}

static int b43_wireless_core_attach(struct b43_wldev *dev)
Expand Down Expand Up @@ -4415,16 +4417,20 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
}
}

err = b43_phy_allocate(dev);
if (err)
goto err_powerdown;

dev->phy.gmode = have_2ghz_phy;
tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0;
b43_wireless_core_reset(dev, tmp);

err = b43_validate_chipaccess(dev);
if (err)
goto err_powerdown;
goto err_phy_free;
err = b43_setup_bands(dev, have_2ghz_phy, have_5ghz_phy);
if (err)
goto err_powerdown;
goto err_phy_free;

/* Now set some default "current_dev" */
if (!wl->current_dev)
Expand All @@ -4438,6 +4444,8 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
out:
return err;

err_phy_free:
b43_phy_free(dev);
err_powerdown:
ssb_bus_may_powerdown(bus);
return err;
Expand Down
46 changes: 31 additions & 15 deletions trunk/drivers/net/wireless/b43/phy_a.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,6 @@ static int b43_aphy_op_allocate(struct b43_wldev *dev)
return -ENOMEM;
dev->phy.a = aphy;

//TODO init struct b43_phy_a

err = b43_aphy_init_tssi2dbm_table(dev);
if (err)
goto err_free_aphy;
Expand All @@ -406,30 +404,47 @@ static int b43_aphy_op_allocate(struct b43_wldev *dev)
return err;
}

static int b43_aphy_op_init(struct b43_wldev *dev)
static void b43_aphy_op_prepare_structs(struct b43_wldev *dev)
{
struct b43_phy_a *aphy = dev->phy.a;
struct b43_phy *phy = &dev->phy;
struct b43_phy_a *aphy = phy->a;
const void *tssi2dbm;
int tgt_idle_tssi;

b43_phy_inita(dev);
aphy->initialised = 1;
/* tssi2dbm table is constant, so it is initialized at alloc time.
* Save a copy of the pointer. */
tssi2dbm = aphy->tssi2dbm;
tgt_idle_tssi = aphy->tgt_idle_tssi;

/* Zero out the whole PHY structure. */
memset(aphy, 0, sizeof(*aphy));

aphy->tssi2dbm = tssi2dbm;
aphy->tgt_idle_tssi = tgt_idle_tssi;

//TODO init struct b43_phy_a

return 0;
}

static void b43_aphy_op_exit(struct b43_wldev *dev)
static void b43_aphy_op_free(struct b43_wldev *dev)
{
struct b43_phy_a *aphy = dev->phy.a;
struct b43_phy *phy = &dev->phy;
struct b43_phy_a *aphy = phy->a;

if (aphy->initialised) {
//TODO
aphy->initialised = 0;
}
//TODO
kfree(aphy->tssi2dbm);
aphy->tssi2dbm = NULL;

kfree(aphy);
dev->phy.a = NULL;
}

static int b43_aphy_op_init(struct b43_wldev *dev)
{
b43_phy_inita(dev);

return 0;
}

static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset)
{
/* OFDM registers are base-registers for the A-PHY. */
Expand Down Expand Up @@ -608,8 +623,9 @@ static void b43_aphy_op_pwork_60sec(struct b43_wldev *dev)

const struct b43_phy_operations b43_phyops_a = {
.allocate = b43_aphy_op_allocate,
.free = b43_aphy_op_free,
.prepare_structs = b43_aphy_op_prepare_structs,
.init = b43_aphy_op_init,
.exit = b43_aphy_op_exit,
.phy_read = b43_aphy_op_read,
.phy_write = b43_aphy_op_write,
.radio_read = b43_aphy_op_radio_read,
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/net/wireless/b43/phy_a.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table,


struct b43_phy_a {
bool initialised;

/* Pointer to the table used to convert a
* TSSI value to dBm-Q5.2 */
const s8 *tssi2dbm;
Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/net/wireless/b43/phy_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "main.h"


int b43_phy_operations_setup(struct b43_wldev *dev)
int b43_phy_allocate(struct b43_wldev *dev)
{
struct b43_phy *phy = &(dev->phy);
int err;
Expand Down Expand Up @@ -70,6 +70,12 @@ int b43_phy_operations_setup(struct b43_wldev *dev)
return err;
}

void b43_phy_free(struct b43_wldev *dev)
{
dev->phy.ops->free(dev);
dev->phy.ops = NULL;
}

int b43_phy_init(struct b43_wldev *dev)
{
struct b43_phy *phy = &dev->phy;
Expand Down
29 changes: 23 additions & 6 deletions trunk/drivers/net/wireless/b43/phy_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,21 @@ enum b43_txpwr_result {
/**
* struct b43_phy_operations - Function pointers for PHY ops.
*
* @prepare: Prepare the PHY. This is called before @init.
* @allocate: Allocate and initialise the PHY data structures.
* Must not be NULL.
* @free: Destroy and free the PHY data structures.
* Must not be NULL.
*
* @prepare_structs: Prepare the PHY data structures.
* The data structures allocated in @allocate are
* initialized here.
* Must not be NULL.
* @prepare_hardware: Prepare the PHY. This is called before b43_chip_init to
* do some early early PHY hardware init.
* Can be NULL, if not required.
* @init: Initialize the PHY.
* Must not be NULL.
* @exit: Shutdown the PHY and free all data structures.
* @exit: Shutdown the PHY.
* Can be NULL, if not required.
*
* @phy_read: Read from a PHY register.
Expand Down Expand Up @@ -133,7 +143,9 @@ enum b43_txpwr_result {
struct b43_phy_operations {
/* Initialisation */
int (*allocate)(struct b43_wldev *dev);
int (*prepare)(struct b43_wldev *dev);
void (*free)(struct b43_wldev *dev);
void (*prepare_structs)(struct b43_wldev *dev);
int (*prepare_hardware)(struct b43_wldev *dev);
int (*init)(struct b43_wldev *dev);
void (*exit)(struct b43_wldev *dev);

Expand Down Expand Up @@ -237,10 +249,15 @@ struct b43_phy {


/**
* b43_phy_operations_setup - Initialize the PHY operations datastructure
* based on the current PHY type.
* b43_phy_allocate - Allocate PHY structs
* Allocate the PHY data structures, based on the current dev->phy.type
*/
int b43_phy_allocate(struct b43_wldev *dev);

/**
* b43_phy_free - Free PHY structs
*/
int b43_phy_operations_setup(struct b43_wldev *dev);
void b43_phy_free(struct b43_wldev *dev);

/**
* b43_phy_init - Initialise the PHY
Expand Down
Loading

0 comments on commit f27fed4

Please sign in to comment.