Commit 09951ad4 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

b43: PHY: allow init optimizations by tracking PHY state

PHY has to be often re-initialized (e.g. during band switching after PHY
reset), however some operations have to be performed only once (only
power reset affects them).
Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cf42c4e5
...@@ -5164,6 +5164,7 @@ static void b43_supported_bands(struct b43_wldev *dev, bool *have_2ghz_phy, ...@@ -5164,6 +5164,7 @@ static void b43_supported_bands(struct b43_wldev *dev, bool *have_2ghz_phy,
static int b43_wireless_core_attach(struct b43_wldev *dev) static int b43_wireless_core_attach(struct b43_wldev *dev)
{ {
struct b43_wl *wl = dev->wl; struct b43_wl *wl = dev->wl;
struct b43_phy *phy = &dev->phy;
int err; int err;
u32 tmp; u32 tmp;
bool have_2ghz_phy = false, have_5ghz_phy = false; bool have_2ghz_phy = false, have_5ghz_phy = false;
...@@ -5181,6 +5182,8 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) ...@@ -5181,6 +5182,8 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
goto out; goto out;
} }
phy->do_full_init = true;
/* Try to guess supported bands for the first init needs */ /* Try to guess supported bands for the first init needs */
switch (dev->dev->bus_type) { switch (dev->dev->bus_type) {
#ifdef CONFIG_B43_BCMA #ifdef CONFIG_B43_BCMA
......
...@@ -98,11 +98,14 @@ int b43_phy_init(struct b43_wldev *dev) ...@@ -98,11 +98,14 @@ int b43_phy_init(struct b43_wldev *dev)
phy->ops->switch_analog(dev, true); phy->ops->switch_analog(dev, true);
b43_software_rfkill(dev, false); b43_software_rfkill(dev, false);
err = ops->init(dev); err = ops->init(dev);
if (err) { if (err) {
b43err(dev->wl, "PHY init failed\n"); b43err(dev->wl, "PHY init failed\n");
goto err_block_rf; goto err_block_rf;
} }
phy->do_full_init = false;
/* Make sure to switch hardware and firmware (SHM) to /* Make sure to switch hardware and firmware (SHM) to
* the default channel. */ * the default channel. */
err = b43_switch_channel(dev, ops->get_default_chan(dev)); err = b43_switch_channel(dev, ops->get_default_chan(dev));
...@@ -114,6 +117,7 @@ int b43_phy_init(struct b43_wldev *dev) ...@@ -114,6 +117,7 @@ int b43_phy_init(struct b43_wldev *dev)
return 0; return 0;
err_phy_exit: err_phy_exit:
phy->do_full_init = true;
if (ops->exit) if (ops->exit)
ops->exit(dev); ops->exit(dev);
err_block_rf: err_block_rf:
...@@ -127,6 +131,7 @@ void b43_phy_exit(struct b43_wldev *dev) ...@@ -127,6 +131,7 @@ void b43_phy_exit(struct b43_wldev *dev)
const struct b43_phy_operations *ops = dev->phy.ops; const struct b43_phy_operations *ops = dev->phy.ops;
b43_software_rfkill(dev, true); b43_software_rfkill(dev, true);
dev->phy.do_full_init = true;
if (ops->exit) if (ops->exit)
ops->exit(dev); ops->exit(dev);
} }
......
...@@ -234,6 +234,9 @@ struct b43_phy { ...@@ -234,6 +234,9 @@ struct b43_phy {
/* Is GMODE (2 GHz mode) bit enabled? */ /* Is GMODE (2 GHz mode) bit enabled? */
bool gmode; bool gmode;
/* After power reset full init has to be performed */
bool do_full_init;
/* Analog Type */ /* Analog Type */
u8 analog; u8 analog;
/* B43_PHYTYPE_ */ /* B43_PHYTYPE_ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment