Commit 4da909e7 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

b43: do not use SSB specific flags when calling core reset function

Luckily the only flag we use when calling core reset is GMODE one.
Thanks to that we can just switch to single bool and make function calls
bus generic.

Tested on my BCM4312 (LP-PHY) and early tested with BCM43224.
Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5a6f78af
...@@ -1144,11 +1144,14 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags) ...@@ -1144,11 +1144,14 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
} }
} }
static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags) static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, bool gmode)
{ {
struct ssb_device *sdev = dev->dev->sdev; struct ssb_device *sdev = dev->dev->sdev;
u32 tmslow; u32 tmslow;
u32 flags = 0;
if (gmode)
flags |= B43_TMSLOW_GMODE;
flags |= B43_TMSLOW_PHYCLKEN; flags |= B43_TMSLOW_PHYCLKEN;
flags |= B43_TMSLOW_PHYRESET; flags |= B43_TMSLOW_PHYRESET;
if (dev->phy.type == B43_PHYTYPE_N) if (dev->phy.type == B43_PHYTYPE_N)
...@@ -1169,11 +1172,11 @@ static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags) ...@@ -1169,11 +1172,11 @@ static void b43_ssb_wireless_core_reset(struct b43_wldev *dev, u32 flags)
msleep(1); msleep(1);
} }
void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode)
{ {
u32 macctl; u32 macctl;
b43_ssb_wireless_core_reset(dev, flags); b43_ssb_wireless_core_reset(dev, gmode);
/* Turn Analog ON, but only if we already know the PHY-type. /* Turn Analog ON, but only if we already know the PHY-type.
* This protects against very early setup where we don't know the * This protects against very early setup where we don't know the
...@@ -1184,7 +1187,7 @@ void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags) ...@@ -1184,7 +1187,7 @@ void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags)
macctl = b43_read32(dev, B43_MMIO_MACCTL); macctl = b43_read32(dev, B43_MMIO_MACCTL);
macctl &= ~B43_MACCTL_GMODE; macctl &= ~B43_MACCTL_GMODE;
if (flags & B43_TMSLOW_GMODE) if (gmode)
macctl |= B43_MACCTL_GMODE; macctl |= B43_MACCTL_GMODE;
macctl |= B43_MACCTL_IHR_ENABLED; macctl |= B43_MACCTL_IHR_ENABLED;
b43_write32(dev, B43_MMIO_MACCTL, macctl); b43_write32(dev, B43_MMIO_MACCTL, macctl);
...@@ -4328,17 +4331,14 @@ static int b43_wireless_core_init(struct b43_wldev *dev) ...@@ -4328,17 +4331,14 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
struct b43_phy *phy = &dev->phy; struct b43_phy *phy = &dev->phy;
int err; int err;
u64 hf; u64 hf;
u32 tmp;
B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT); B43_WARN_ON(b43_status(dev) != B43_STAT_UNINIT);
err = b43_bus_powerup(dev, 0); err = b43_bus_powerup(dev, 0);
if (err) if (err)
goto out; goto out;
if (!b43_device_is_enabled(dev)) { if (!b43_device_is_enabled(dev))
tmp = phy->gmode ? B43_TMSLOW_GMODE : 0; b43_wireless_core_reset(dev, phy->gmode);
b43_wireless_core_reset(dev, tmp);
}
/* Reset all data structures. */ /* Reset all data structures. */
setup_struct_wldev_for_init(dev); setup_struct_wldev_for_init(dev);
...@@ -4747,7 +4747,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) ...@@ -4747,7 +4747,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL; struct pci_dev *pdev = (bus->bustype == SSB_BUSTYPE_PCI) ? bus->host_pci : NULL;
int err; int err;
bool have_2ghz_phy = 0, have_5ghz_phy = 0; bool have_2ghz_phy = 0, have_5ghz_phy = 0;
u32 tmp;
/* Do NOT do any device initialization here. /* Do NOT do any device initialization here.
* Do it in wireless_core_init() instead. * Do it in wireless_core_init() instead.
...@@ -4773,8 +4772,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) ...@@ -4773,8 +4772,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
dev->phy.gmode = have_2ghz_phy; dev->phy.gmode = have_2ghz_phy;
dev->phy.radio_on = 1; dev->phy.radio_on = 1;
tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; b43_wireless_core_reset(dev, dev->phy.gmode);
b43_wireless_core_reset(dev, tmp);
err = b43_phy_versioning(dev); err = b43_phy_versioning(dev);
if (err) if (err)
...@@ -4822,8 +4820,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) ...@@ -4822,8 +4820,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
goto err_powerdown; goto err_powerdown;
dev->phy.gmode = have_2ghz_phy; dev->phy.gmode = have_2ghz_phy;
tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; b43_wireless_core_reset(dev, dev->phy.gmode);
b43_wireless_core_reset(dev, tmp);
err = b43_validate_chipaccess(dev); err = b43_validate_chipaccess(dev);
if (err) if (err)
......
...@@ -121,7 +121,7 @@ void b43_hf_write(struct b43_wldev *dev, u64 value); ...@@ -121,7 +121,7 @@ void b43_hf_write(struct b43_wldev *dev, u64 value);
void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on); void b43_dummy_transmission(struct b43_wldev *dev, bool ofdm, bool pa_on);
void b43_wireless_core_reset(struct b43_wldev *dev, u32 flags); void b43_wireless_core_reset(struct b43_wldev *dev, bool gmode);
void b43_controller_restart(struct b43_wldev *dev, const char *reason); void b43_controller_restart(struct b43_wldev *dev, const char *reason);
......
...@@ -2535,7 +2535,7 @@ static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev) ...@@ -2535,7 +2535,7 @@ static int b43_gphy_op_prepare_hardware(struct b43_wldev *dev)
b43_wireless_core_reset(dev, 0); b43_wireless_core_reset(dev, 0);
b43_phy_initg(dev); b43_phy_initg(dev);
phy->gmode = 1; phy->gmode = 1;
b43_wireless_core_reset(dev, B43_TMSLOW_GMODE); b43_wireless_core_reset(dev, 1);
} }
return 0; return 0;
......
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