aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-09-02 07:00:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-05 16:17:49 -0400
commitfb11137af83b7b66c7aab8dbc5f09d2c95684fed (patch)
tree08251ad486eb4c115f56ee4ddfb56a80c2d7c287 /drivers/net/wireless/b43
parent7cb770729ba895f73253dfcd46c3fcba45d896f9 (diff)
b43: Split PHY alloc and init
This splits the PHY allocation from the PHY init. This is needed in order to properly support Analog handling. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/main.c36
-rw-r--r--drivers/net/wireless/b43/phy_a.c46
-rw-r--r--drivers/net/wireless/b43/phy_a.h2
-rw-r--r--drivers/net/wireless/b43/phy_common.c8
-rw-r--r--drivers/net/wireless/b43/phy_common.h29
-rw-r--r--drivers/net/wireless/b43/phy_g.c96
-rw-r--r--drivers/net/wireless/b43/phy_g.h2
-rw-r--r--drivers/net/wireless/b43/phy_lp.c29
-rw-r--r--drivers/net/wireless/b43/phy_lp.h2
-rw-r--r--drivers/net/wireless/b43/phy_n.c35
-rw-r--r--drivers/net/wireless/b43/phy_n.h2
11 files changed, 178 insertions, 109 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index fda9492d588..156e8f3151d 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1091,8 +1091,12 @@ void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
1091 ssb_read32(dev->dev, SSB_TMSLOW); /* flush */ 1091 ssb_read32(dev->dev, SSB_TMSLOW); /* flush */
1092 msleep(1); 1092 msleep(1);
1093 1093
1094 /* Turn Analog ON */ 1094 /* Turn Analog ON, but only if we already know the PHY-type.
1095 b43_switch_analog(dev, 1); 1095 * This protects against very early setup where we don't know the
1096 * PHY-type, yet. wireless_core_reset will be called once again later,
1097 * when we know the PHY-type. */
1098 if (dev->phy.ops)
1099 b43_switch_analog(dev, 1);
1096 1100
1097 macctl = b43_read32(dev, B43_MMIO_MACCTL); 1101 macctl = b43_read32(dev, B43_MMIO_MACCTL);
1098 macctl &= ~B43_MACCTL_GMODE; 1102 macctl &= ~B43_MACCTL_GMODE;
@@ -2694,6 +2698,7 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
2694/* This is the opposite of b43_chip_init() */ 2698/* This is the opposite of b43_chip_init() */
2695static void b43_chip_exit(struct b43_wldev *dev) 2699static void b43_chip_exit(struct b43_wldev *dev)
2696{ 2700{
2701 b43_phy_exit(dev);
2697 b43_gpio_cleanup(dev); 2702 b43_gpio_cleanup(dev);
2698 /* firmware is released later */ 2703 /* firmware is released later */
2699} 2704}
@@ -3952,7 +3957,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
3952 dev_kfree_skb_any(dev->wl->current_beacon); 3957 dev_kfree_skb_any(dev->wl->current_beacon);
3953 dev->wl->current_beacon = NULL; 3958 dev->wl->current_beacon = NULL;
3954 } 3959 }
3955 b43_phy_exit(dev);
3956 3960
3957 ssb_device_disable(dev->dev, 0); 3961 ssb_device_disable(dev->dev, 0);
3958 ssb_bus_may_powerdown(dev->dev->bus); 3962 ssb_bus_may_powerdown(dev->dev->bus);
@@ -3979,24 +3983,23 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
3979 b43_wireless_core_reset(dev, tmp); 3983 b43_wireless_core_reset(dev, tmp);
3980 } 3984 }
3981 3985
3986 /* Reset all data structures. */
3982 setup_struct_wldev_for_init(dev); 3987 setup_struct_wldev_for_init(dev);
3983 err = b43_phy_operations_setup(dev); 3988 phy->ops->prepare_structs(dev);
3984 if (err)
3985 goto err_busdown;
3986 3989
3987 /* Enable IRQ routing to this device. */ 3990 /* Enable IRQ routing to this device. */
3988 ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev); 3991 ssb_pcicore_dev_irqvecs_enable(&bus->pcicore, dev->dev);
3989 3992
3990 b43_imcfglo_timeouts_workaround(dev); 3993 b43_imcfglo_timeouts_workaround(dev);
3991 b43_bluetooth_coext_disable(dev); 3994 b43_bluetooth_coext_disable(dev);
3992 if (phy->ops->prepare) { 3995 if (phy->ops->prepare_hardware) {
3993 err = phy->ops->prepare(dev); 3996 err = phy->ops->prepare_hardware(dev);
3994 if (err) 3997 if (err)
3995 goto err_phy_exit; 3998 goto err_busdown;
3996 } 3999 }
3997 err = b43_chip_init(dev); 4000 err = b43_chip_init(dev);
3998 if (err) 4001 if (err)
3999 goto err_phy_exit; 4002 goto err_busdown;
4000 b43_shm_write16(dev, B43_SHM_SHARED, 4003 b43_shm_write16(dev, B43_SHM_SHARED,
4001 B43_SHM_SH_WLCOREREV, dev->dev->id.revision); 4004 B43_SHM_SH_WLCOREREV, dev->dev->id.revision);
4002 hf = b43_hf_read(dev); 4005 hf = b43_hf_read(dev);
@@ -4064,8 +4067,6 @@ out:
4064 4067
4065err_chip_exit: 4068err_chip_exit:
4066 b43_chip_exit(dev); 4069 b43_chip_exit(dev);
4067err_phy_exit:
4068 b43_phy_exit(dev);
4069err_busdown: 4070err_busdown:
4070 ssb_bus_may_powerdown(bus); 4071 ssb_bus_may_powerdown(bus);
4071 B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); 4072 B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT);
@@ -4342,6 +4343,7 @@ static void b43_wireless_core_detach(struct b43_wldev *dev)
4342 /* We release firmware that late to not be required to re-request 4343 /* We release firmware that late to not be required to re-request
4343 * is all the time when we reinit the core. */ 4344 * is all the time when we reinit the core. */
4344 b43_release_firmware(dev); 4345 b43_release_firmware(dev);
4346 b43_phy_free(dev);
4345} 4347}
4346 4348
4347static int b43_wireless_core_attach(struct b43_wldev *dev) 4349static int b43_wireless_core_attach(struct b43_wldev *dev)
@@ -4415,16 +4417,20 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
4415 } 4417 }
4416 } 4418 }
4417 4419
4420 err = b43_phy_allocate(dev);
4421 if (err)
4422 goto err_powerdown;
4423
4418 dev->phy.gmode = have_2ghz_phy; 4424 dev->phy.gmode = have_2ghz_phy;
4419 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; 4425 tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0;
4420 b43_wireless_core_reset(dev, tmp); 4426 b43_wireless_core_reset(dev, tmp);
4421 4427
4422 err = b43_validate_chipaccess(dev); 4428 err = b43_validate_chipaccess(dev);
4423 if (err) 4429 if (err)
4424 goto err_powerdown; 4430 goto err_phy_free;
4425 err = b43_setup_bands(dev, have_2ghz_phy, have_5ghz_phy); 4431 err = b43_setup_bands(dev, have_2ghz_phy, have_5ghz_phy);
4426 if (err) 4432 if (err)
4427 goto err_powerdown; 4433 goto err_phy_free;
4428 4434
4429 /* Now set some default "current_dev" */ 4435 /* Now set some default "current_dev" */
4430 if (!wl->current_dev) 4436 if (!wl->current_dev)
@@ -4438,6 +4444,8 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
4438out: 4444out:
4439 return err; 4445 return err;
4440 4446
4447err_phy_free:
4448 b43_phy_free(dev);
4441err_powerdown: 4449err_powerdown:
4442 ssb_bus_may_powerdown(bus); 4450 ssb_bus_may_powerdown(bus);
4443 return err; 4451 return err;
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 2ca8353aa9a..c9f00ace46a 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -391,8 +391,6 @@ static int b43_aphy_op_allocate(struct b43_wldev *dev)
391 return -ENOMEM; 391 return -ENOMEM;
392 dev->phy.a = aphy; 392 dev->phy.a = aphy;
393 393
394 //TODO init struct b43_phy_a
395
396 err = b43_aphy_init_tssi2dbm_table(dev); 394 err = b43_aphy_init_tssi2dbm_table(dev);
397 if (err) 395 if (err)
398 goto err_free_aphy; 396 goto err_free_aphy;
@@ -406,30 +404,47 @@ err_free_aphy:
406 return err; 404 return err;
407} 405}
408 406
409static int b43_aphy_op_init(struct b43_wldev *dev) 407static void b43_aphy_op_prepare_structs(struct b43_wldev *dev)
410{ 408{
411 struct b43_phy_a *aphy = dev->phy.a; 409 struct b43_phy *phy = &dev->phy;
410 struct b43_phy_a *aphy = phy->a;
411 const void *tssi2dbm;
412 int tgt_idle_tssi;
412 413
413 b43_phy_inita(dev); 414 /* tssi2dbm table is constant, so it is initialized at alloc time.
414 aphy->initialised = 1; 415 * Save a copy of the pointer. */
416 tssi2dbm = aphy->tssi2dbm;
417 tgt_idle_tssi = aphy->tgt_idle_tssi;
418
419 /* Zero out the whole PHY structure. */
420 memset(aphy, 0, sizeof(*aphy));
421
422 aphy->tssi2dbm = tssi2dbm;
423 aphy->tgt_idle_tssi = tgt_idle_tssi;
424
425 //TODO init struct b43_phy_a
415 426
416 return 0;
417} 427}
418 428
419static void b43_aphy_op_exit(struct b43_wldev *dev) 429static void b43_aphy_op_free(struct b43_wldev *dev)
420{ 430{
421 struct b43_phy_a *aphy = dev->phy.a; 431 struct b43_phy *phy = &dev->phy;
432 struct b43_phy_a *aphy = phy->a;
422 433
423 if (aphy->initialised) {
424 //TODO
425 aphy->initialised = 0;
426 }
427 //TODO
428 kfree(aphy->tssi2dbm); 434 kfree(aphy->tssi2dbm);
435 aphy->tssi2dbm = NULL;
436
429 kfree(aphy); 437 kfree(aphy);
430 dev->phy.a = NULL; 438 dev->phy.a = NULL;
431} 439}
432 440
441static int b43_aphy_op_init(struct b43_wldev *dev)
442{
443 b43_phy_inita(dev);
444
445 return 0;
446}
447
433static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset) 448static inline u16 adjust_phyreg(struct b43_wldev *dev, u16 offset)
434{ 449{
435 /* OFDM registers are base-registers for the A-PHY. */ 450 /* OFDM registers are base-registers for the A-PHY. */
@@ -608,8 +623,9 @@ static void b43_aphy_op_pwork_60sec(struct b43_wldev *dev)
608 623
609const struct b43_phy_operations b43_phyops_a = { 624const struct b43_phy_operations b43_phyops_a = {
610 .allocate = b43_aphy_op_allocate, 625 .allocate = b43_aphy_op_allocate,
626 .free = b43_aphy_op_free,
627 .prepare_structs = b43_aphy_op_prepare_structs,
611 .init = b43_aphy_op_init, 628 .init = b43_aphy_op_init,
612 .exit = b43_aphy_op_exit,
613 .phy_read = b43_aphy_op_read, 629 .phy_read = b43_aphy_op_read,
614 .phy_write = b43_aphy_op_write, 630 .phy_write = b43_aphy_op_write,
615 .radio_read = b43_aphy_op_radio_read, 631 .radio_read = b43_aphy_op_radio_read,
diff --git a/drivers/net/wireless/b43/phy_a.h b/drivers/net/wireless/b43/phy_a.h
index 583da0e416e..5cfaab7b16e 100644
--- a/drivers/net/wireless/b43/phy_a.h
+++ b/drivers/net/wireless/b43/phy_a.h
@@ -103,8 +103,6 @@ void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table,
103 103
104 104
105struct b43_phy_a { 105struct b43_phy_a {
106 bool initialised;
107
108 /* Pointer to the table used to convert a 106 /* Pointer to the table used to convert a
109 * TSSI value to dBm-Q5.2 */ 107 * TSSI value to dBm-Q5.2 */
110 const s8 *tssi2dbm; 108 const s8 *tssi2dbm;
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index b3762d8163c..e12fca69a97 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -35,7 +35,7 @@
35#include "main.h" 35#include "main.h"
36 36
37 37
38int b43_phy_operations_setup(struct b43_wldev *dev) 38int b43_phy_allocate(struct b43_wldev *dev)
39{ 39{
40 struct b43_phy *phy = &(dev->phy); 40 struct b43_phy *phy = &(dev->phy);
41 int err; 41 int err;
@@ -70,6 +70,12 @@ int b43_phy_operations_setup(struct b43_wldev *dev)
70 return err; 70 return err;
71} 71}
72 72
73void b43_phy_free(struct b43_wldev *dev)
74{
75 dev->phy.ops->free(dev);
76 dev->phy.ops = NULL;
77}
78
73int b43_phy_init(struct b43_wldev *dev) 79int b43_phy_init(struct b43_wldev *dev)
74{ 80{
75 struct b43_phy *phy = &dev->phy; 81 struct b43_phy *phy = &dev->phy;
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index a876e169cc8..4a1795f5fc2 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -74,11 +74,21 @@ enum b43_txpwr_result {
74/** 74/**
75 * struct b43_phy_operations - Function pointers for PHY ops. 75 * struct b43_phy_operations - Function pointers for PHY ops.
76 * 76 *
77 * @prepare: Prepare the PHY. This is called before @init. 77 * @allocate: Allocate and initialise the PHY data structures.
78 * Must not be NULL.
79 * @free: Destroy and free the PHY data structures.
80 * Must not be NULL.
81 *
82 * @prepare_structs: Prepare the PHY data structures.
83 * The data structures allocated in @allocate are
84 * initialized here.
85 * Must not be NULL.
86 * @prepare_hardware: Prepare the PHY. This is called before b43_chip_init to
87 * do some early early PHY hardware init.
78 * Can be NULL, if not required. 88 * Can be NULL, if not required.
79 * @init: Initialize the PHY. 89 * @init: Initialize the PHY.
80 * Must not be NULL. 90 * Must not be NULL.
81 * @exit: Shutdown the PHY and free all data structures. 91 * @exit: Shutdown the PHY.
82 * Can be NULL, if not required. 92 * Can be NULL, if not required.
83 * 93 *
84 * @phy_read: Read from a PHY register. 94 * @phy_read: Read from a PHY register.
@@ -133,7 +143,9 @@ enum b43_txpwr_result {
133struct b43_phy_operations { 143struct b43_phy_operations {
134 /* Initialisation */ 144 /* Initialisation */
135 int (*allocate)(struct b43_wldev *dev); 145 int (*allocate)(struct b43_wldev *dev);
136 int (*prepare)(struct b43_wldev *dev); 146 void (*free)(struct b43_wldev *dev);
147 void (*prepare_structs)(struct b43_wldev *dev);
148 int (*prepare_hardware)(struct b43_wldev *dev);
137 int (*init)(struct b43_wldev *dev); 149 int (*init)(struct b43_wldev *dev);
138 void (*exit)(struct b43_wldev *dev); 150 void (*exit)(struct b43_wldev *dev);
139 151
@@ -237,10 +249,15 @@ struct b43_phy {
237 249
238 250
239/** 251/**
240 * b43_phy_operations_setup - Initialize the PHY operations datastructure 252 * b43_phy_allocate - Allocate PHY structs
241 * based on the current PHY type. 253 * Allocate the PHY data structures, based on the current dev->phy.type
254 */
255int b43_phy_allocate(struct b43_wldev *dev);
256
257/**
258 * b43_phy_free - Free PHY structs
242 */ 259 */
243int b43_phy_operations_setup(struct b43_wldev *dev); 260void b43_phy_free(struct b43_wldev *dev);
244 261
245/** 262/**
246 * b43_phy_init - Initialise the PHY 263 * b43_phy_init - Initialise the PHY
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index 063db5c00ce..b44740b24e7 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -2635,7 +2635,7 @@ static int b43_gphy_op_allocate(struct b43_wldev *dev)
2635{ 2635{
2636 struct b43_phy_g *gphy; 2636 struct b43_phy_g *gphy;
2637 struct b43_txpower_lo_control *lo; 2637 struct b43_txpower_lo_control *lo;
2638 int err, i; 2638 int err;
2639 2639
2640 gphy = kzalloc(sizeof(*gphy), GFP_KERNEL); 2640 gphy = kzalloc(sizeof(*gphy), GFP_KERNEL);
2641 if (!gphy) { 2641 if (!gphy) {
@@ -2644,6 +2644,51 @@ static int b43_gphy_op_allocate(struct b43_wldev *dev)
2644 } 2644 }
2645 dev->phy.g = gphy; 2645 dev->phy.g = gphy;
2646 2646
2647 lo = kzalloc(sizeof(*lo), GFP_KERNEL);
2648 if (!lo) {
2649 err = -ENOMEM;
2650 goto err_free_gphy;
2651 }
2652 gphy->lo_control = lo;
2653
2654 err = b43_gphy_init_tssi2dbm_table(dev);
2655 if (err)
2656 goto err_free_lo;
2657
2658 return 0;
2659
2660err_free_lo:
2661 kfree(lo);
2662err_free_gphy:
2663 kfree(gphy);
2664error:
2665 return err;
2666}
2667
2668static void b43_gphy_op_prepare_structs(struct b43_wldev *dev)
2669{
2670 struct b43_phy *phy = &dev->phy;
2671 struct b43_phy_g *gphy = phy->g;
2672 const void *tssi2dbm;
2673 int tgt_idle_tssi;
2674 struct b43_txpower_lo_control *lo;
2675 unsigned int i;
2676
2677 /* tssi2dbm table is constant, so it is initialized at alloc time.
2678 * Save a copy of the pointer. */
2679 tssi2dbm = gphy->tssi2dbm;
2680 tgt_idle_tssi = gphy->tgt_idle_tssi;
2681 /* Save the LO pointer. */
2682 lo = gphy->lo_control;
2683
2684 /* Zero out the whole PHY structure. */
2685 memset(gphy, 0, sizeof(*gphy));
2686
2687 /* Restore pointers. */
2688 gphy->tssi2dbm = tssi2dbm;
2689 gphy->tgt_idle_tssi = tgt_idle_tssi;
2690 gphy->lo_control = lo;
2691
2647 memset(gphy->minlowsig, 0xFF, sizeof(gphy->minlowsig)); 2692 memset(gphy->minlowsig, 0xFF, sizeof(gphy->minlowsig));
2648 2693
2649 /* NRSSI */ 2694 /* NRSSI */
@@ -2662,31 +2707,28 @@ static int b43_gphy_op_allocate(struct b43_wldev *dev)
2662 2707
2663 gphy->average_tssi = 0xFF; 2708 gphy->average_tssi = 0xFF;
2664 2709
2665 lo = kzalloc(sizeof(*lo), GFP_KERNEL); 2710 /* Local Osciallator structure */
2666 if (!lo) {
2667 err = -ENOMEM;
2668 goto err_free_gphy;
2669 }
2670 gphy->lo_control = lo;
2671
2672 lo->tx_bias = 0xFF; 2711 lo->tx_bias = 0xFF;
2673 INIT_LIST_HEAD(&lo->calib_list); 2712 INIT_LIST_HEAD(&lo->calib_list);
2713}
2674 2714
2675 err = b43_gphy_init_tssi2dbm_table(dev); 2715static void b43_gphy_op_free(struct b43_wldev *dev)
2676 if (err) 2716{
2677 goto err_free_lo; 2717 struct b43_phy *phy = &dev->phy;
2718 struct b43_phy_g *gphy = phy->g;
2678 2719
2679 return 0; 2720 kfree(gphy->lo_control);
2721
2722 if (gphy->dyn_tssi_tbl)
2723 kfree(gphy->tssi2dbm);
2724 gphy->dyn_tssi_tbl = 0;
2725 gphy->tssi2dbm = NULL;
2680 2726
2681err_free_lo:
2682 kfree(lo);
2683err_free_gphy:
2684 kfree(gphy); 2727 kfree(gphy);
2685error: 2728 dev->phy.g = NULL;
2686 return err;
2687} 2729}
2688 2730
2689static int b43_gphy_op_prepare(struct b43_wldev *dev) 2731static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev)
2690{ 2732{
2691 struct b43_phy *phy = &dev->phy; 2733 struct b43_phy *phy = &dev->phy;
2692 struct b43_phy_g *gphy = phy->g; 2734 struct b43_phy_g *gphy = phy->g;
@@ -2718,28 +2760,14 @@ static int b43_gphy_op_prepare(struct b43_wldev *dev)
2718 2760
2719static int b43_gphy_op_init(struct b43_wldev *dev) 2761static int b43_gphy_op_init(struct b43_wldev *dev)
2720{ 2762{
2721 struct b43_phy_g *gphy = dev->phy.g;
2722
2723 b43_phy_initg(dev); 2763 b43_phy_initg(dev);
2724 gphy->initialised = 1;
2725 2764
2726 return 0; 2765 return 0;
2727} 2766}
2728 2767
2729static void b43_gphy_op_exit(struct b43_wldev *dev) 2768static void b43_gphy_op_exit(struct b43_wldev *dev)
2730{ 2769{
2731 struct b43_phy_g *gphy = dev->phy.g;
2732
2733 if (gphy->initialised) {
2734 //TODO
2735 gphy->initialised = 0;
2736 }
2737 b43_lo_g_cleanup(dev); 2770 b43_lo_g_cleanup(dev);
2738 kfree(gphy->lo_control);
2739 if (gphy->dyn_tssi_tbl)
2740 kfree(gphy->tssi2dbm);
2741 kfree(gphy);
2742 dev->phy.g = NULL;
2743} 2771}
2744 2772
2745static u16 b43_gphy_op_read(struct b43_wldev *dev, u16 reg) 2773static u16 b43_gphy_op_read(struct b43_wldev *dev, u16 reg)
@@ -3232,7 +3260,9 @@ static void b43_gphy_op_pwork_60sec(struct b43_wldev *dev)
3232 3260
3233const struct b43_phy_operations b43_phyops_g = { 3261const struct b43_phy_operations b43_phyops_g = {
3234 .allocate = b43_gphy_op_allocate, 3262 .allocate = b43_gphy_op_allocate,
3235 .prepare = b43_gphy_op_prepare, 3263 .free = b43_gphy_op_free,
3264 .prepare_structs = b43_gphy_op_prepare_structs,
3265 .prepare_hardware = b43_gphy_op_prepare_hardware,
3236 .init = b43_gphy_op_init, 3266 .init = b43_gphy_op_init,
3237 .exit = b43_gphy_op_exit, 3267 .exit = b43_gphy_op_exit,
3238 .phy_read = b43_gphy_op_read, 3268 .phy_read = b43_gphy_op_read,
diff --git a/drivers/net/wireless/b43/phy_g.h b/drivers/net/wireless/b43/phy_g.h
index 913eb13e8fb..718947fd41a 100644
--- a/drivers/net/wireless/b43/phy_g.h
+++ b/drivers/net/wireless/b43/phy_g.h
@@ -114,8 +114,6 @@ static inline bool b43_compare_bbatt(const struct b43_bbatt *a,
114struct b43_txpower_lo_control; 114struct b43_txpower_lo_control;
115 115
116struct b43_phy_g { 116struct b43_phy_g {
117 bool initialised;
118
119 /* ACI (adjacent channel interference) flags. */ 117 /* ACI (adjacent channel interference) flags. */
120 bool aci_enable; 118 bool aci_enable;
121 bool aci_wlan_automatic; 119 bool aci_wlan_automatic;
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index e769ca0b29a..41994f1f0f0 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -36,34 +36,34 @@ static int b43_lpphy_op_allocate(struct b43_wldev *dev)
36 return -ENOMEM; 36 return -ENOMEM;
37 dev->phy.lp = lpphy; 37 dev->phy.lp = lpphy;
38 38
39 //TODO
40
41 return 0; 39 return 0;
42} 40}
43 41
44static int b43_lpphy_op_init(struct b43_wldev *dev) 42static void b43_lpphy_op_prepare_structs(struct b43_wldev *dev)
45{ 43{
46 struct b43_phy_lp *lpphy = dev->phy.lp; 44 struct b43_phy *phy = &dev->phy;
45 struct b43_phy_lp *lpphy = phy->lp;
47 46
48 //TODO 47 memset(lpphy, 0, sizeof(*lpphy));
49 lpphy->initialised = 1;
50 48
51 return 0; 49 //TODO
52} 50}
53 51
54static void b43_lpphy_op_exit(struct b43_wldev *dev) 52static void b43_lpphy_op_free(struct b43_wldev *dev)
55{ 53{
56 struct b43_phy_lp *lpphy = dev->phy.lp; 54 struct b43_phy_lp *lpphy = dev->phy.lp;
57 55
58 if (lpphy->initialised) {
59 //TODO
60 lpphy->initialised = 0;
61 }
62
63 kfree(lpphy); 56 kfree(lpphy);
64 dev->phy.lp = NULL; 57 dev->phy.lp = NULL;
65} 58}
66 59
60static int b43_lpphy_op_init(struct b43_wldev *dev)
61{
62 //TODO
63
64 return 0;
65}
66
67static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 reg) 67static u16 b43_lpphy_op_read(struct b43_wldev *dev, u16 reg)
68{ 68{
69 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg); 69 b43_write16(dev, B43_MMIO_PHY_CONTROL, reg);
@@ -138,8 +138,9 @@ static enum b43_txpwr_result b43_lpphy_op_recalc_txpower(struct b43_wldev *dev,
138 138
139const struct b43_phy_operations b43_phyops_lp = { 139const struct b43_phy_operations b43_phyops_lp = {
140 .allocate = b43_lpphy_op_allocate, 140 .allocate = b43_lpphy_op_allocate,
141 .free = b43_lpphy_op_free,
142 .prepare_structs = b43_lpphy_op_prepare_structs,
141 .init = b43_lpphy_op_init, 143 .init = b43_lpphy_op_init,
142 .exit = b43_lpphy_op_exit,
143 .phy_read = b43_lpphy_op_read, 144 .phy_read = b43_lpphy_op_read,
144 .phy_write = b43_lpphy_op_write, 145 .phy_write = b43_lpphy_op_write,
145 .radio_read = b43_lpphy_op_radio_read, 146 .radio_read = b43_lpphy_op_radio_read,
diff --git a/drivers/net/wireless/b43/phy_lp.h b/drivers/net/wireless/b43/phy_lp.h
index 9a0da355f28..b0b5357abf9 100644
--- a/drivers/net/wireless/b43/phy_lp.h
+++ b/drivers/net/wireless/b43/phy_lp.h
@@ -530,7 +530,7 @@
530 530
531 531
532struct b43_phy_lp { 532struct b43_phy_lp {
533 bool initialised; 533 //TODO
534}; 534};
535 535
536 536
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 8162fd7792f..617724dc6aa 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -499,35 +499,31 @@ static int b43_nphy_op_allocate(struct b43_wldev *dev)
499 return -ENOMEM; 499 return -ENOMEM;
500 dev->phy.n = nphy; 500 dev->phy.n = nphy;
501 501
502 //TODO init struct b43_phy_n
503
504 return 0; 502 return 0;
505} 503}
506 504
507static int b43_nphy_op_init(struct b43_wldev *dev) 505static void b43_nphy_op_prepare_structs(struct b43_wldev *dev)
508{ 506{
509 struct b43_phy_n *nphy = dev->phy.n; 507 struct b43_phy *phy = &dev->phy;
510 int err; 508 struct b43_phy_n *nphy = phy->n;
511 509
512 err = b43_phy_initn(dev); 510 memset(nphy, 0, sizeof(*nphy));
513 if (err)
514 return err;
515 nphy->initialised = 1;
516 511
517 return 0; 512 //TODO init struct b43_phy_n
518} 513}
519 514
520static void b43_nphy_op_exit(struct b43_wldev *dev) 515static void b43_nphy_op_free(struct b43_wldev *dev)
521{ 516{
522 struct b43_phy_n *nphy = dev->phy.n; 517 struct b43_phy *phy = &dev->phy;
518 struct b43_phy_n *nphy = phy->n;
523 519
524 if (nphy->initialised) {
525 //TODO
526 nphy->initialised = 0;
527 }
528 //TODO
529 kfree(nphy); 520 kfree(nphy);
530 dev->phy.n = NULL; 521 phy->n = NULL;
522}
523
524static int b43_nphy_op_init(struct b43_wldev *dev)
525{
526 return b43_phy_initn(dev);
531} 527}
532 528
533static inline void check_phyreg(struct b43_wldev *dev, u16 offset) 529static inline void check_phyreg(struct b43_wldev *dev, u16 offset)
@@ -610,8 +606,9 @@ static unsigned int b43_nphy_op_get_default_chan(struct b43_wldev *dev)
610 606
611const struct b43_phy_operations b43_phyops_n = { 607const struct b43_phy_operations b43_phyops_n = {
612 .allocate = b43_nphy_op_allocate, 608 .allocate = b43_nphy_op_allocate,
609 .free = b43_nphy_op_free,
610 .prepare_structs = b43_nphy_op_prepare_structs,
613 .init = b43_nphy_op_init, 611 .init = b43_nphy_op_init,
614 .exit = b43_nphy_op_exit,
615 .phy_read = b43_nphy_op_read, 612 .phy_read = b43_nphy_op_read,
616 .phy_write = b43_nphy_op_write, 613 .phy_write = b43_nphy_op_write,
617 .radio_read = b43_nphy_op_radio_read, 614 .radio_read = b43_nphy_op_radio_read,
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 3d1f65ed201..1749aef4147 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -920,8 +920,6 @@
920struct b43_wldev; 920struct b43_wldev;
921 921
922struct b43_phy_n { 922struct b43_phy_n {
923 bool initialised;
924
925 //TODO lots of missing stuff 923 //TODO lots of missing stuff
926}; 924};
927 925