aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
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/main.c
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/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index fda9492d5884..156e8f3151d5 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;