* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call
@ 2010-08-22 19:49 Rafał Miłecki
2010-08-22 19:49 ` [PATCH 2/2] b43: N-PHY: add sub calls of band width setting Rafał Miłecki
[not found] ` <AANLkTi=TMhmTF+ztooAu=E1e1zdw-cBnaSZCKj=Utik0@mail.gmail.com>
0 siblings, 2 replies; 14+ messages in thread
From: Rafał Miłecki @ 2010-08-22 19:49 UTC (permalink / raw)
To: linux-wireless, John W. Linville
Cc: b43-dev, Gábor Stefanik, Rafał Miłecki
Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
drivers/net/wireless/b43/phy_common.c | 20 ++++++++++++++++++++
drivers/net/wireless/b43/phy_common.h | 11 +++++++++++
drivers/net/wireless/b43/phy_n.c | 4 ++--
drivers/net/wireless/b43/phy_n.h | 1 -
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 8f7d7ef..b06e3f0 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -466,3 +466,23 @@ struct b43_c32 b43_cordic(int theta)
return ret;
}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */
+static void b43_clock_control(struct b43_wldev *dev, u32 mode)
+{
+ ; /* TODO */
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacBwSet */
+void b43_bmac_set_b_width(struct b43_wldev *dev, u8 b_width)
+{
+ bool fast = dev->phy.forcefastclk;;
+ if (!fast)
+ b43_clock_control(dev, 0);
+ dev->phy.b_width = b_width;
+ b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */
+ /* TODO: Call PHY BMAC Reset */
+ dev->phy.ops->init(dev);
+ if (fast)
+ b43_clock_control(dev, 2);
+}
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index bd480b4..9886db0 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -218,6 +218,9 @@ struct b43_phy {
bool supports_2ghz;
bool supports_5ghz;
+ /* Band width */
+ u8 b_width;
+
/* HT info */
bool is_40mhz;
@@ -256,6 +259,9 @@ struct b43_phy {
/* PHY TX errors counter. */
atomic_t txerr_cnt;
+ /* Clock */
+ bool forcefastclk;
+
#ifdef CONFIG_B43_DEBUG
/* PHY registers locked (w.r.t. firmware) */
bool phy_locked;
@@ -429,4 +435,9 @@ void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on);
struct b43_c32 b43_cordic(int theta);
+/**
+ * b43_bmac_set_b_width - Set band width
+ */
+void b43_bmac_set_b_width(struct b43_wldev *dev, u8 b_width);
+
#endif /* LINUX_B43_PHY_COMMON_H_ */
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 2466c0a..ac217da 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -3410,8 +3410,8 @@ static int b43_nphy_set_chanspec(struct b43_wldev *dev,
nphy->radio_chanspec = chanspec;
- if (chanspec.b_width != nphy->b_width)
- ; /* TODO: BMAC BW Set (chanspec.b_width) */
+ if (chanspec.b_width != dev->phy.b_width)
+ b43_bmac_set_b_width(dev, chanspec.b_width);
/* TODO: use defines */
if (chanspec.b_width == 3) {
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 8b6d570..e7acae2 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -984,7 +984,6 @@ struct b43_phy_n {
u16 papd_epsilon_offset[2];
s32 preamble_override;
u32 bb_mult_save;
- u8 b_width;
struct b43_chanspec radio_chanspec;
bool gain_boost;
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 19:49 [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call Rafał Miłecki @ 2010-08-22 19:49 ` Rafał Miłecki 2010-08-22 19:52 ` Gábor Stefanik [not found] ` <AANLkTi=TMhmTF+ztooAu=E1e1zdw-cBnaSZCKj=Utik0@mail.gmail.com> 1 sibling, 1 reply; 14+ messages in thread From: Rafał Miłecki @ 2010-08-22 19:49 UTC (permalink / raw) To: linux-wireless, John W. Linville Cc: b43-dev, Gábor Stefanik, Rafał Miłecki Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> --- drivers/net/wireless/b43/b43.h | 1 + drivers/net/wireless/b43/phy_common.c | 150 ++++++++++++++++++++++++++++++++- drivers/net/wireless/b43/phy_common.h | 7 ++ 3 files changed, 157 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 8674a99..73376ff 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h @@ -57,6 +57,7 @@ #define B43_MMIO_TSF_CFP_REP 0x188 #define B43_MMIO_TSF_CFP_START 0x18C #define B43_MMIO_TSF_CFP_MAXDUR 0x190 +#define B43_MMIO_CLKCTL 0x1E0 /* clock control status */ /* 32-bit DMA */ #define B43_MMIO_DMA32_BASE0 0x200 diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c index b06e3f0..10b9e6f 100644 --- a/drivers/net/wireless/b43/phy_common.c +++ b/drivers/net/wireless/b43/phy_common.c @@ -467,10 +467,158 @@ struct b43_c32 b43_cordic(int theta) return ret; } +/* http://bcm-v4.sipsolutions.net/802.11/NcClkCtlCc */ +static bool b43_no_check_clock_control_chip_common(struct b43_wldev *dev, + u32 mode) +{ + /* TODO: this is temporary hack */ + return (mode == 0); +} + +/* http://bcm-v4.sipsolutions.net/802.11/ClkCtlCc */ +static bool b43_clock_control_chip_common(struct b43_wldev *dev, u32 mode) +{ + struct ssb_bus *bus = dev->dev->bus; + u16 chip_id = bus->chip_id; + u16 chip_rev = bus->chip_rev; + /* TODO: specs distinguish PCI and PCIe */ + bool pci = (bus->bustype == SSB_BUSTYPE_PCI); + + if (dev->dev->id.revision < 6) + return false; + if (pci && ((chip_id == 0x4311 && chip_rev < 2) || + (pci && chip_id == 0x4321) || + (pci && chip_id == 0x4716))) + return (mode == 0); + return b43_no_check_clock_control_chip_common(dev, mode); +} + +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWaitForWake */ +static void b43_phy_bmac_wait_for_wake(struct b43_wldev *dev) +{ + u8 core_rev = dev->dev->bus->pcicore.dev->id.revision; + u16 tmp, i; + + if (core_rev == 4) { + udelay(5); + return; + } + + if (dev->phy.type == B43_PHYTYPE_G && core_rev == 5) + udelay(2000); + else + udelay(40); + + for (i = 0; i < 1500; i++) { + tmp = b43_shm_read16(dev, B43_SHM_SHARED, + B43_SHM_SH_UCODESTAT); + if (tmp == B43_SHM_SH_UCODESTAT_SLEEP) { + i = 0; + break; + } + udelay(10); + } + if (i) + b43err(dev->wl, "ucode wake up timeout\n"); +} + +/* http://bcm-v4.sipsolutions.net/802.11/PHY/MctrlWrite */ +static void b43_phy_mac_control_write(struct b43_wldev *dev) +{ + u32 tmp = dev->phy.maccontrol; + if (dev->phy.wake_override) + tmp |= B43_MACCTL_AWAKE; + if (dev->phy.mute_override) + tmp &= ~B43_MACCTL_AP; + tmp |= B43_MACCTL_INFRA; + b43_write32(dev, B43_MMIO_MACCTL, tmp); +} + +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideSet */ +static void b43_ucode_wake_override_set(struct b43_wldev *dev, u32 override) +{ + dev->phy.wake_override |= override; + if (dev->phy.wake_override || dev->phy.maccontrol & B43_MACCTL_AWAKE) + return; + b43_phy_mac_control_write(dev); + b43_phy_bmac_wait_for_wake(dev); +} + +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideClear */ +static void b43_ucode_wake_override_clear(struct b43_wldev *dev, u32 override) +{ + dev->phy.wake_override &= ~override; + if (dev->phy.wake_override != (dev->phy.maccontrol & B43_MACCTL_AWAKE)) + return; + b43_phy_mac_control_write(dev); +} + /* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ static void b43_clock_control(struct b43_wldev *dev, u32 mode) { - ; /* TODO */ + struct b43_phy *phy = &dev->phy; + struct ssb_bus *bus = dev->dev->bus; + u8 core_rev = bus->pcicore.dev->id.revision; + u16 i; + u32 clkctl; + bool wakeup; + + if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) { /* PMU Present */ + B43_WARN_ON(core_rev < 20); + if (phy->clk) { + bool tmp = (bus->chipco.pmu.rev == 0 && + (b43_read32(dev, B43_MMIO_CLKCTL) & 0x12)); + + if (mode == 0) { + clkctl = b43_read32(dev, B43_MMIO_CLKCTL); + clkctl |= 0x2; + b43_write32(dev, B43_MMIO_CLKCTL, clkctl); + udelay(33); + } + + if (mode == 0 || tmp) { + for (i = 0; i < 1500; i++) { + clkctl = b43_read32(dev, B43_MMIO_CLKCTL); + if ((clkctl & 0x20000) == 0) { + i = 0; + break; + } + udelay(10); + } + if (i) + b43err(dev->wl, "clock timeout\n"); + } + + if (mode != 0 && tmp) { + clkctl = b43_read32(dev, B43_MMIO_CLKCTL); + clkctl &= ~0x2; + b43_write32(dev, B43_MMIO_CLKCTL, clkctl); + } + } + phy->forcefastclk = (mode == 0); + } else { + B43_WARN_ON(core_rev >= 20); + + wakeup = (core_rev < 9); + if (phy->up && wakeup) + b43_ucode_wake_override_set(dev, 1); + + phy->forcefastclk = b43_clock_control_chip_common(dev, mode); + if (core_rev < 11) { + if (phy->forcefastclk) + ; /* TODO: b43_mhf(dev, 0, 0x400, 0x400, 3); */ + else + ; /* TODO: b43_mhf(dev, 0, 0x400, 0, 3); */ + } + + if (phy->forcefastclk) + phy->wake_override |= 0x10; + else + phy->wake_override &= ~0x10; + + if (phy->up && wakeup) + b43_ucode_wake_override_clear(dev, 1); + } } /* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacBwSet */ diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h index 9886db0..fa20548 100644 --- a/drivers/net/wireless/b43/phy_common.h +++ b/drivers/net/wireless/b43/phy_common.h @@ -260,8 +260,15 @@ struct b43_phy { atomic_t txerr_cnt; /* Clock */ + u32 clk; bool forcefastclk; + bool up; + u32 maccontrol; + + u32 wake_override; + u32 mute_override; + #ifdef CONFIG_B43_DEBUG /* PHY registers locked (w.r.t. firmware) */ bool phy_locked; -- 1.7.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 19:49 ` [PATCH 2/2] b43: N-PHY: add sub calls of band width setting Rafał Miłecki @ 2010-08-22 19:52 ` Gábor Stefanik 2010-08-22 19:58 ` Rafał Miłecki 0 siblings, 1 reply; 14+ messages in thread From: Gábor Stefanik @ 2010-08-22 19:52 UTC (permalink / raw) To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev 2010/8/22 Rafa? Mi?ecki <zajec5@gmail.com>: > Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> > --- > ?drivers/net/wireless/b43/b43.h ? ? ? ?| ? ?1 + > ?drivers/net/wireless/b43/phy_common.c | ?150 ++++++++++++++++++++++++++++++++- > ?drivers/net/wireless/b43/phy_common.h | ? ?7 ++ > ?3 files changed, 157 insertions(+), 1 deletions(-) > > diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h > index 8674a99..73376ff 100644 > --- a/drivers/net/wireless/b43/b43.h > +++ b/drivers/net/wireless/b43/b43.h > @@ -57,6 +57,7 @@ > ?#define B43_MMIO_TSF_CFP_REP ? ? ? ? ? 0x188 > ?#define B43_MMIO_TSF_CFP_START ? ? ? ? 0x18C > ?#define B43_MMIO_TSF_CFP_MAXDUR ? ? ? ? ? ? ? ?0x190 > +#define B43_MMIO_CLKCTL ? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */ > > ?/* 32-bit DMA */ > ?#define B43_MMIO_DMA32_BASE0 ? ? ? ? ? 0x200 > diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c > index b06e3f0..10b9e6f 100644 > --- a/drivers/net/wireless/b43/phy_common.c > +++ b/drivers/net/wireless/b43/phy_common.c > @@ -467,10 +467,158 @@ struct b43_c32 b43_cordic(int theta) > ? ? ? ?return ret; > ?} > > +/* http://bcm-v4.sipsolutions.net/802.11/NcClkCtlCc */ > +static bool b43_no_check_clock_control_chip_common(struct b43_wldev *dev, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u32 mode) > +{ > + ? ? ? /* TODO: this is temporary hack */ > + ? ? ? return (mode == 0); > +} > + > +/* http://bcm-v4.sipsolutions.net/802.11/ClkCtlCc */ > +static bool b43_clock_control_chip_common(struct b43_wldev *dev, u32 mode) > +{ > + ? ? ? struct ssb_bus *bus = dev->dev->bus; > + ? ? ? u16 chip_id = bus->chip_id; > + ? ? ? u16 chip_rev = bus->chip_rev; > + ? ? ? /* TODO: specs distinguish PCI and PCIe */ > + ? ? ? bool pci = (bus->bustype == SSB_BUSTYPE_PCI); > + > + ? ? ? if (dev->dev->id.revision < 6) > + ? ? ? ? ? ? ? return false; > + ? ? ? if (pci && ((chip_id == 0x4311 && chip_rev < 2) || > + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4321) || > + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4716))) > + ? ? ? ? ? ? ? return (mode == 0); > + ? ? ? return b43_no_check_clock_control_chip_common(dev, mode); > +} > + > +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWaitForWake */ > +static void b43_phy_bmac_wait_for_wake(struct b43_wldev *dev) > +{ > + ? ? ? u8 core_rev = dev->dev->bus->pcicore.dev->id.revision; > + ? ? ? u16 tmp, i; > + > + ? ? ? if (core_rev == 4) { > + ? ? ? ? ? ? ? udelay(5); > + ? ? ? ? ? ? ? return; > + ? ? ? } > + > + ? ? ? if (dev->phy.type == B43_PHYTYPE_G && core_rev == 5) > + ? ? ? ? ? ? ? udelay(2000); > + ? ? ? else > + ? ? ? ? ? ? ? udelay(40); > + > + ? ? ? for (i = 0; i < 1500; i++) { > + ? ? ? ? ? ? ? tmp = b43_shm_read16(dev, B43_SHM_SHARED, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? B43_SHM_SH_UCODESTAT); > + ? ? ? ? ? ? ? if (tmp == B43_SHM_SH_UCODESTAT_SLEEP) { > + ? ? ? ? ? ? ? ? ? ? ? i = 0; > + ? ? ? ? ? ? ? ? ? ? ? break; > + ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? udelay(10); > + ? ? ? } > + ? ? ? if (i) > + ? ? ? ? ? ? ? b43err(dev->wl, "ucode wake up timeout\n"); > +} > + > +/* http://bcm-v4.sipsolutions.net/802.11/PHY/MctrlWrite */ > +static void b43_phy_mac_control_write(struct b43_wldev *dev) > +{ > + ? ? ? u32 tmp = dev->phy.maccontrol; > + ? ? ? if (dev->phy.wake_override) > + ? ? ? ? ? ? ? tmp |= B43_MACCTL_AWAKE; > + ? ? ? if (dev->phy.mute_override) > + ? ? ? ? ? ? ? tmp &= ~B43_MACCTL_AP; > + ? ? ? tmp |= B43_MACCTL_INFRA; > + ? ? ? b43_write32(dev, B43_MMIO_MACCTL, tmp); > +} > + > +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideSet */ > +static void b43_ucode_wake_override_set(struct b43_wldev *dev, u32 override) > +{ > + ? ? ? dev->phy.wake_override |= override; > + ? ? ? if (dev->phy.wake_override || dev->phy.maccontrol & B43_MACCTL_AWAKE) > + ? ? ? ? ? ? ? return; > + ? ? ? b43_phy_mac_control_write(dev); > + ? ? ? b43_phy_bmac_wait_for_wake(dev); > +} > + > +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideClear */ > +static void b43_ucode_wake_override_clear(struct b43_wldev *dev, u32 override) > +{ > + ? ? ? dev->phy.wake_override &= ~override; > + ? ? ? if (dev->phy.wake_override != (dev->phy.maccontrol & B43_MACCTL_AWAKE)) > + ? ? ? ? ? ? ? return; > + ? ? ? b43_phy_mac_control_write(dev); > +} > + > ?/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ > ?static void b43_clock_control(struct b43_wldev *dev, u32 mode) > ?{ > - ? ? ? ; /* TODO */ > + ? ? ? struct b43_phy *phy = &dev->phy; > + ? ? ? struct ssb_bus *bus = dev->dev->bus; > + ? ? ? u8 core_rev = bus->pcicore.dev->id.revision; > + ? ? ? u16 i; > + ? ? ? u32 clkctl; > + ? ? ? bool wakeup; > + > + ? ? ? if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) { /* PMU Present */ > + ? ? ? ? ? ? ? B43_WARN_ON(core_rev < 20); > + ? ? ? ? ? ? ? if (phy->clk) { > + ? ? ? ? ? ? ? ? ? ? ? bool tmp = (bus->chipco.pmu.rev == 0 && > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (b43_read32(dev, B43_MMIO_CLKCTL) & 0x12)); > + > + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl |= 0x2; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(33); > + ? ? ? ? ? ? ? ? ? ? ? } > + > + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0 || tmp) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? for (i = 0; i < 1500; i++) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if ((clkctl & 0x20000) == 0) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? i = 0; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(10); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (i) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43err(dev->wl, "clock timeout\n"); > + ? ? ? ? ? ? ? ? ? ? ? } > + > + ? ? ? ? ? ? ? ? ? ? ? if (mode != 0 && tmp) { > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl &= ~0x2; > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); > + ? ? ? ? ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? } > + ? ? ? ? ? ? ? phy->forcefastclk = (mode == 0); > + ? ? ? } else { > + ? ? ? ? ? ? ? B43_WARN_ON(core_rev >= 20); > + > + ? ? ? ? ? ? ? wakeup = (core_rev < 9); > + ? ? ? ? ? ? ? if (phy->up && wakeup) > + ? ? ? ? ? ? ? ? ? ? ? b43_ucode_wake_override_set(dev, 1); > + > + ? ? ? ? ? ? ? phy->forcefastclk = b43_clock_control_chip_common(dev, mode); > + ? ? ? ? ? ? ? if (core_rev < 11) { > + ? ? ? ? ? ? ? ? ? ? ? if (phy->forcefastclk) > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0x400, 3); */ > + ? ? ? ? ? ? ? ? ? ? ? else > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0, 3); */ We do implement mhf already, though it is done differently than in wl. See my earlier "Add missing HF write" patch. > + ? ? ? ? ? ? ? } > + > + ? ? ? ? ? ? ? if (phy->forcefastclk) > + ? ? ? ? ? ? ? ? ? ? ? phy->wake_override |= 0x10; > + ? ? ? ? ? ? ? else > + ? ? ? ? ? ? ? ? ? ? ? phy->wake_override &= ~0x10; > + > + ? ? ? ? ? ? ? if (phy->up && wakeup) > + ? ? ? ? ? ? ? ? ? ? ? b43_ucode_wake_override_clear(dev, 1); > + ? ? ? } > ?} > > ?/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacBwSet */ > diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h > index 9886db0..fa20548 100644 > --- a/drivers/net/wireless/b43/phy_common.h > +++ b/drivers/net/wireless/b43/phy_common.h > @@ -260,8 +260,15 @@ struct b43_phy { > ? ? ? ?atomic_t txerr_cnt; > > ? ? ? ?/* Clock */ > + ? ? ? u32 clk; > ? ? ? ?bool forcefastclk; > > + ? ? ? bool up; > + ? ? ? u32 maccontrol; > + > + ? ? ? u32 wake_override; > + ? ? ? u32 mute_override; > + > ?#ifdef CONFIG_B43_DEBUG > ? ? ? ?/* PHY registers locked (w.r.t. firmware) */ > ? ? ? ?bool phy_locked; > -- > 1.7.1 > > -- Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 19:52 ` Gábor Stefanik @ 2010-08-22 19:58 ` Rafał Miłecki 2010-08-22 20:04 ` Gábor Stefanik 0 siblings, 1 reply; 14+ messages in thread From: Rafał Miłecki @ 2010-08-22 19:58 UTC (permalink / raw) To: Gábor Stefanik; +Cc: linux-wireless, John W. Linville, b43-dev W dniu 22 sierpnia 2010 21:52 u?ytkownik G?bor Stefanik <netrolller.3d@gmail.com> napisa?: > 2010/8/22 Rafa? Mi?ecki <zajec5@gmail.com>: >> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >> --- >> ?drivers/net/wireless/b43/b43.h ? ? ? ?| ? ?1 + >> ?drivers/net/wireless/b43/phy_common.c | ?150 ++++++++++++++++++++++++++++++++- >> ?drivers/net/wireless/b43/phy_common.h | ? ?7 ++ >> ?3 files changed, 157 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h >> index 8674a99..73376ff 100644 >> --- a/drivers/net/wireless/b43/b43.h >> +++ b/drivers/net/wireless/b43/b43.h >> @@ -57,6 +57,7 @@ >> ?#define B43_MMIO_TSF_CFP_REP ? ? ? ? ? 0x188 >> ?#define B43_MMIO_TSF_CFP_START ? ? ? ? 0x18C >> ?#define B43_MMIO_TSF_CFP_MAXDUR ? ? ? ? ? ? ? ?0x190 >> +#define B43_MMIO_CLKCTL ? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */ >> >> ?/* 32-bit DMA */ >> ?#define B43_MMIO_DMA32_BASE0 ? ? ? ? ? 0x200 >> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c >> index b06e3f0..10b9e6f 100644 >> --- a/drivers/net/wireless/b43/phy_common.c >> +++ b/drivers/net/wireless/b43/phy_common.c >> @@ -467,10 +467,158 @@ struct b43_c32 b43_cordic(int theta) >> ? ? ? ?return ret; >> ?} >> >> +/* http://bcm-v4.sipsolutions.net/802.11/NcClkCtlCc */ >> +static bool b43_no_check_clock_control_chip_common(struct b43_wldev *dev, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u32 mode) >> +{ >> + ? ? ? /* TODO: this is temporary hack */ >> + ? ? ? return (mode == 0); >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/ClkCtlCc */ >> +static bool b43_clock_control_chip_common(struct b43_wldev *dev, u32 mode) >> +{ >> + ? ? ? struct ssb_bus *bus = dev->dev->bus; >> + ? ? ? u16 chip_id = bus->chip_id; >> + ? ? ? u16 chip_rev = bus->chip_rev; >> + ? ? ? /* TODO: specs distinguish PCI and PCIe */ >> + ? ? ? bool pci = (bus->bustype == SSB_BUSTYPE_PCI); >> + >> + ? ? ? if (dev->dev->id.revision < 6) >> + ? ? ? ? ? ? ? return false; >> + ? ? ? if (pci && ((chip_id == 0x4311 && chip_rev < 2) || >> + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4321) || >> + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4716))) >> + ? ? ? ? ? ? ? return (mode == 0); >> + ? ? ? return b43_no_check_clock_control_chip_common(dev, mode); >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWaitForWake */ >> +static void b43_phy_bmac_wait_for_wake(struct b43_wldev *dev) >> +{ >> + ? ? ? u8 core_rev = dev->dev->bus->pcicore.dev->id.revision; >> + ? ? ? u16 tmp, i; >> + >> + ? ? ? if (core_rev == 4) { >> + ? ? ? ? ? ? ? udelay(5); >> + ? ? ? ? ? ? ? return; >> + ? ? ? } >> + >> + ? ? ? if (dev->phy.type == B43_PHYTYPE_G && core_rev == 5) >> + ? ? ? ? ? ? ? udelay(2000); >> + ? ? ? else >> + ? ? ? ? ? ? ? udelay(40); >> + >> + ? ? ? for (i = 0; i < 1500; i++) { >> + ? ? ? ? ? ? ? tmp = b43_shm_read16(dev, B43_SHM_SHARED, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? B43_SHM_SH_UCODESTAT); >> + ? ? ? ? ? ? ? if (tmp == B43_SHM_SH_UCODESTAT_SLEEP) { >> + ? ? ? ? ? ? ? ? ? ? ? i = 0; >> + ? ? ? ? ? ? ? ? ? ? ? break; >> + ? ? ? ? ? ? ? } >> + ? ? ? ? ? ? ? udelay(10); >> + ? ? ? } >> + ? ? ? if (i) >> + ? ? ? ? ? ? ? b43err(dev->wl, "ucode wake up timeout\n"); >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/MctrlWrite */ >> +static void b43_phy_mac_control_write(struct b43_wldev *dev) >> +{ >> + ? ? ? u32 tmp = dev->phy.maccontrol; >> + ? ? ? if (dev->phy.wake_override) >> + ? ? ? ? ? ? ? tmp |= B43_MACCTL_AWAKE; >> + ? ? ? if (dev->phy.mute_override) >> + ? ? ? ? ? ? ? tmp &= ~B43_MACCTL_AP; >> + ? ? ? tmp |= B43_MACCTL_INFRA; >> + ? ? ? b43_write32(dev, B43_MMIO_MACCTL, tmp); >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideSet */ >> +static void b43_ucode_wake_override_set(struct b43_wldev *dev, u32 override) >> +{ >> + ? ? ? dev->phy.wake_override |= override; >> + ? ? ? if (dev->phy.wake_override || dev->phy.maccontrol & B43_MACCTL_AWAKE) >> + ? ? ? ? ? ? ? return; >> + ? ? ? b43_phy_mac_control_write(dev); >> + ? ? ? b43_phy_bmac_wait_for_wake(dev); >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideClear */ >> +static void b43_ucode_wake_override_clear(struct b43_wldev *dev, u32 override) >> +{ >> + ? ? ? dev->phy.wake_override &= ~override; >> + ? ? ? if (dev->phy.wake_override != (dev->phy.maccontrol & B43_MACCTL_AWAKE)) >> + ? ? ? ? ? ? ? return; >> + ? ? ? b43_phy_mac_control_write(dev); >> +} >> + >> ?/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ >> ?static void b43_clock_control(struct b43_wldev *dev, u32 mode) >> ?{ >> - ? ? ? ; /* TODO */ >> + ? ? ? struct b43_phy *phy = &dev->phy; >> + ? ? ? struct ssb_bus *bus = dev->dev->bus; >> + ? ? ? u8 core_rev = bus->pcicore.dev->id.revision; >> + ? ? ? u16 i; >> + ? ? ? u32 clkctl; >> + ? ? ? bool wakeup; >> + >> + ? ? ? if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) { /* PMU Present */ >> + ? ? ? ? ? ? ? B43_WARN_ON(core_rev < 20); >> + ? ? ? ? ? ? ? if (phy->clk) { >> + ? ? ? ? ? ? ? ? ? ? ? bool tmp = (bus->chipco.pmu.rev == 0 && >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (b43_read32(dev, B43_MMIO_CLKCTL) & 0x12)); >> + >> + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl |= 0x2; >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(33); >> + ? ? ? ? ? ? ? ? ? ? ? } >> + >> + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0 || tmp) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? for (i = 0; i < 1500; i++) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if ((clkctl & 0x20000) == 0) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? i = 0; >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(10); >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (i) >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43err(dev->wl, "clock timeout\n"); >> + ? ? ? ? ? ? ? ? ? ? ? } >> + >> + ? ? ? ? ? ? ? ? ? ? ? if (mode != 0 && tmp) { >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl &= ~0x2; >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); >> + ? ? ? ? ? ? ? ? ? ? ? } >> + ? ? ? ? ? ? ? } >> + ? ? ? ? ? ? ? phy->forcefastclk = (mode == 0); >> + ? ? ? } else { >> + ? ? ? ? ? ? ? B43_WARN_ON(core_rev >= 20); >> + >> + ? ? ? ? ? ? ? wakeup = (core_rev < 9); >> + ? ? ? ? ? ? ? if (phy->up && wakeup) >> + ? ? ? ? ? ? ? ? ? ? ? b43_ucode_wake_override_set(dev, 1); >> + >> + ? ? ? ? ? ? ? phy->forcefastclk = b43_clock_control_chip_common(dev, mode); >> + ? ? ? ? ? ? ? if (core_rev < 11) { >> + ? ? ? ? ? ? ? ? ? ? ? if (phy->forcefastclk) >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0x400, 3); */ >> + ? ? ? ? ? ? ? ? ? ? ? else >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0, 3); */ > > We do implement mhf already, though it is done differently than in wl. > See my earlier "Add missing HF write" patch. Yes, I noticed this in your patch, thanks, however I don't understand relation between our implementation and wl yet. I'm not 100% sure how to translate this, so I decided to left this as TODO. Didn't want to wait anymore before publishing this, to avoid situation of implementing the same functions and wasting your and/or mine time. Could you post a patch making real call instead of this comment, please? -- Rafa? ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 19:58 ` Rafał Miłecki @ 2010-08-22 20:04 ` Gábor Stefanik 2010-08-22 20:14 ` Rafał Miłecki ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Gábor Stefanik @ 2010-08-22 20:04 UTC (permalink / raw) To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev 2010/8/22 Rafa? Mi?ecki <zajec5@gmail.com>: > W dniu 22 sierpnia 2010 21:52 u?ytkownik G?bor Stefanik > <netrolller.3d@gmail.com> napisa?: >> 2010/8/22 Rafa? Mi?ecki <zajec5@gmail.com>: >>> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >>> --- >>> ?drivers/net/wireless/b43/b43.h ? ? ? ?| ? ?1 + >>> ?drivers/net/wireless/b43/phy_common.c | ?150 ++++++++++++++++++++++++++++++++- >>> ?drivers/net/wireless/b43/phy_common.h | ? ?7 ++ >>> ?3 files changed, 157 insertions(+), 1 deletions(-) >>> >>> diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h >>> index 8674a99..73376ff 100644 >>> --- a/drivers/net/wireless/b43/b43.h >>> +++ b/drivers/net/wireless/b43/b43.h >>> @@ -57,6 +57,7 @@ >>> ?#define B43_MMIO_TSF_CFP_REP ? ? ? ? ? 0x188 >>> ?#define B43_MMIO_TSF_CFP_START ? ? ? ? 0x18C >>> ?#define B43_MMIO_TSF_CFP_MAXDUR ? ? ? ? ? ? ? ?0x190 >>> +#define B43_MMIO_CLKCTL ? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */ >>> >>> ?/* 32-bit DMA */ >>> ?#define B43_MMIO_DMA32_BASE0 ? ? ? ? ? 0x200 >>> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c >>> index b06e3f0..10b9e6f 100644 >>> --- a/drivers/net/wireless/b43/phy_common.c >>> +++ b/drivers/net/wireless/b43/phy_common.c >>> @@ -467,10 +467,158 @@ struct b43_c32 b43_cordic(int theta) >>> ? ? ? ?return ret; >>> ?} >>> >>> +/* http://bcm-v4.sipsolutions.net/802.11/NcClkCtlCc */ >>> +static bool b43_no_check_clock_control_chip_common(struct b43_wldev *dev, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u32 mode) >>> +{ >>> + ? ? ? /* TODO: this is temporary hack */ >>> + ? ? ? return (mode == 0); >>> +} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/ClkCtlCc */ >>> +static bool b43_clock_control_chip_common(struct b43_wldev *dev, u32 mode) >>> +{ >>> + ? ? ? struct ssb_bus *bus = dev->dev->bus; >>> + ? ? ? u16 chip_id = bus->chip_id; >>> + ? ? ? u16 chip_rev = bus->chip_rev; >>> + ? ? ? /* TODO: specs distinguish PCI and PCIe */ >>> + ? ? ? bool pci = (bus->bustype == SSB_BUSTYPE_PCI); >>> + >>> + ? ? ? if (dev->dev->id.revision < 6) >>> + ? ? ? ? ? ? ? return false; >>> + ? ? ? if (pci && ((chip_id == 0x4311 && chip_rev < 2) || >>> + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4321) || >>> + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4716))) >>> + ? ? ? ? ? ? ? return (mode == 0); >>> + ? ? ? return b43_no_check_clock_control_chip_common(dev, mode); >>> +} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWaitForWake */ >>> +static void b43_phy_bmac_wait_for_wake(struct b43_wldev *dev) >>> +{ >>> + ? ? ? u8 core_rev = dev->dev->bus->pcicore.dev->id.revision; >>> + ? ? ? u16 tmp, i; >>> + >>> + ? ? ? if (core_rev == 4) { >>> + ? ? ? ? ? ? ? udelay(5); >>> + ? ? ? ? ? ? ? return; >>> + ? ? ? } >>> + >>> + ? ? ? if (dev->phy.type == B43_PHYTYPE_G && core_rev == 5) >>> + ? ? ? ? ? ? ? udelay(2000); >>> + ? ? ? else >>> + ? ? ? ? ? ? ? udelay(40); >>> + >>> + ? ? ? for (i = 0; i < 1500; i++) { >>> + ? ? ? ? ? ? ? tmp = b43_shm_read16(dev, B43_SHM_SHARED, >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? B43_SHM_SH_UCODESTAT); >>> + ? ? ? ? ? ? ? if (tmp == B43_SHM_SH_UCODESTAT_SLEEP) { >>> + ? ? ? ? ? ? ? ? ? ? ? i = 0; >>> + ? ? ? ? ? ? ? ? ? ? ? break; >>> + ? ? ? ? ? ? ? } >>> + ? ? ? ? ? ? ? udelay(10); >>> + ? ? ? } >>> + ? ? ? if (i) >>> + ? ? ? ? ? ? ? b43err(dev->wl, "ucode wake up timeout\n"); >>> +} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/MctrlWrite */ >>> +static void b43_phy_mac_control_write(struct b43_wldev *dev) >>> +{ >>> + ? ? ? u32 tmp = dev->phy.maccontrol; >>> + ? ? ? if (dev->phy.wake_override) >>> + ? ? ? ? ? ? ? tmp |= B43_MACCTL_AWAKE; >>> + ? ? ? if (dev->phy.mute_override) >>> + ? ? ? ? ? ? ? tmp &= ~B43_MACCTL_AP; >>> + ? ? ? tmp |= B43_MACCTL_INFRA; >>> + ? ? ? b43_write32(dev, B43_MMIO_MACCTL, tmp); >>> +} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideSet */ >>> +static void b43_ucode_wake_override_set(struct b43_wldev *dev, u32 override) >>> +{ >>> + ? ? ? dev->phy.wake_override |= override; >>> + ? ? ? if (dev->phy.wake_override || dev->phy.maccontrol & B43_MACCTL_AWAKE) >>> + ? ? ? ? ? ? ? return; >>> + ? ? ? b43_phy_mac_control_write(dev); >>> + ? ? ? b43_phy_bmac_wait_for_wake(dev); >>> +} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideClear */ >>> +static void b43_ucode_wake_override_clear(struct b43_wldev *dev, u32 override) >>> +{ >>> + ? ? ? dev->phy.wake_override &= ~override; >>> + ? ? ? if (dev->phy.wake_override != (dev->phy.maccontrol & B43_MACCTL_AWAKE)) >>> + ? ? ? ? ? ? ? return; >>> + ? ? ? b43_phy_mac_control_write(dev); >>> +} >>> + >>> ?/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ >>> ?static void b43_clock_control(struct b43_wldev *dev, u32 mode) >>> ?{ >>> - ? ? ? ; /* TODO */ >>> + ? ? ? struct b43_phy *phy = &dev->phy; >>> + ? ? ? struct ssb_bus *bus = dev->dev->bus; >>> + ? ? ? u8 core_rev = bus->pcicore.dev->id.revision; >>> + ? ? ? u16 i; >>> + ? ? ? u32 clkctl; >>> + ? ? ? bool wakeup; >>> + >>> + ? ? ? if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) { /* PMU Present */ >>> + ? ? ? ? ? ? ? B43_WARN_ON(core_rev < 20); >>> + ? ? ? ? ? ? ? if (phy->clk) { >>> + ? ? ? ? ? ? ? ? ? ? ? bool tmp = (bus->chipco.pmu.rev == 0 && >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (b43_read32(dev, B43_MMIO_CLKCTL) & 0x12)); >>> + >>> + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0) { >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl |= 0x2; >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(33); >>> + ? ? ? ? ? ? ? ? ? ? ? } >>> + >>> + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0 || tmp) { >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? for (i = 0; i < 1500; i++) { >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if ((clkctl & 0x20000) == 0) { >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? i = 0; >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(10); >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (i) >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43err(dev->wl, "clock timeout\n"); >>> + ? ? ? ? ? ? ? ? ? ? ? } >>> + >>> + ? ? ? ? ? ? ? ? ? ? ? if (mode != 0 && tmp) { >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl &= ~0x2; >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); >>> + ? ? ? ? ? ? ? ? ? ? ? } >>> + ? ? ? ? ? ? ? } >>> + ? ? ? ? ? ? ? phy->forcefastclk = (mode == 0); >>> + ? ? ? } else { >>> + ? ? ? ? ? ? ? B43_WARN_ON(core_rev >= 20); >>> + >>> + ? ? ? ? ? ? ? wakeup = (core_rev < 9); >>> + ? ? ? ? ? ? ? if (phy->up && wakeup) >>> + ? ? ? ? ? ? ? ? ? ? ? b43_ucode_wake_override_set(dev, 1); >>> + >>> + ? ? ? ? ? ? ? phy->forcefastclk = b43_clock_control_chip_common(dev, mode); >>> + ? ? ? ? ? ? ? if (core_rev < 11) { >>> + ? ? ? ? ? ? ? ? ? ? ? if (phy->forcefastclk) >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0x400, 3); */ >>> + ? ? ? ? ? ? ? ? ? ? ? else >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0, 3); */ >> >> We do implement mhf already, though it is done differently than in wl. >> See my earlier "Add missing HF write" patch. > > Yes, I noticed this in your patch, thanks, however I don't understand > relation between our implementation and wl yet. I'm not 100% sure how > to translate this, so I decided to left this as TODO. Didn't want to > wait anymore before publishing this, to avoid situation of > implementing the same functions and wasting your and/or mine time. > > Could you post a patch making real call instead of this comment, please? > > -- > Rafa? > Sorry, I'm on a Windows-only machine right now. However, the general rule of translation is: mhf(a, b, c, d) -> b43_hf_write(dev, (b43_hf_read(dev) & (~b << (a*16))) | (c << (a*16))) (Yes, the last parameter is ignored; it seems to be just Broadcrap - crap written by Broadcom.) -- Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 20:04 ` Gábor Stefanik @ 2010-08-22 20:14 ` Rafał Miłecki 2010-08-22 20:29 ` Larry Finger 2010-08-25 19:07 ` Michael Büsch 2 siblings, 0 replies; 14+ messages in thread From: Rafał Miłecki @ 2010-08-22 20:14 UTC (permalink / raw) To: Gábor Stefanik; +Cc: linux-wireless, John W. Linville, b43-dev W dniu 22 sierpnia 2010 22:04 u?ytkownik G?bor Stefanik <netrolller.3d@gmail.com> napisa?: > 2010/8/22 Rafa? Mi?ecki <zajec5@gmail.com>: >> W dniu 22 sierpnia 2010 21:52 u?ytkownik G?bor Stefanik >> <netrolller.3d@gmail.com> napisa?: >>> 2010/8/22 Rafa? Mi?ecki <zajec5@gmail.com>: >>>> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >>>> --- >>>> ?drivers/net/wireless/b43/b43.h ? ? ? ?| ? ?1 + >>>> ?drivers/net/wireless/b43/phy_common.c | ?150 ++++++++++++++++++++++++++++++++- >>>> ?drivers/net/wireless/b43/phy_common.h | ? ?7 ++ >>>> ?3 files changed, 157 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h >>>> index 8674a99..73376ff 100644 >>>> --- a/drivers/net/wireless/b43/b43.h >>>> +++ b/drivers/net/wireless/b43/b43.h >>>> @@ -57,6 +57,7 @@ >>>> ?#define B43_MMIO_TSF_CFP_REP ? ? ? ? ? 0x188 >>>> ?#define B43_MMIO_TSF_CFP_START ? ? ? ? 0x18C >>>> ?#define B43_MMIO_TSF_CFP_MAXDUR ? ? ? ? ? ? ? ?0x190 >>>> +#define B43_MMIO_CLKCTL ? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */ >>>> >>>> ?/* 32-bit DMA */ >>>> ?#define B43_MMIO_DMA32_BASE0 ? ? ? ? ? 0x200 >>>> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c >>>> index b06e3f0..10b9e6f 100644 >>>> --- a/drivers/net/wireless/b43/phy_common.c >>>> +++ b/drivers/net/wireless/b43/phy_common.c >>>> @@ -467,10 +467,158 @@ struct b43_c32 b43_cordic(int theta) >>>> ? ? ? ?return ret; >>>> ?} >>>> >>>> +/* http://bcm-v4.sipsolutions.net/802.11/NcClkCtlCc */ >>>> +static bool b43_no_check_clock_control_chip_common(struct b43_wldev *dev, >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? u32 mode) >>>> +{ >>>> + ? ? ? /* TODO: this is temporary hack */ >>>> + ? ? ? return (mode == 0); >>>> +} >>>> + >>>> +/* http://bcm-v4.sipsolutions.net/802.11/ClkCtlCc */ >>>> +static bool b43_clock_control_chip_common(struct b43_wldev *dev, u32 mode) >>>> +{ >>>> + ? ? ? struct ssb_bus *bus = dev->dev->bus; >>>> + ? ? ? u16 chip_id = bus->chip_id; >>>> + ? ? ? u16 chip_rev = bus->chip_rev; >>>> + ? ? ? /* TODO: specs distinguish PCI and PCIe */ >>>> + ? ? ? bool pci = (bus->bustype == SSB_BUSTYPE_PCI); >>>> + >>>> + ? ? ? if (dev->dev->id.revision < 6) >>>> + ? ? ? ? ? ? ? return false; >>>> + ? ? ? if (pci && ((chip_id == 0x4311 && chip_rev < 2) || >>>> + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4321) || >>>> + ? ? ? ? ? ? ? ? ? (pci && chip_id == 0x4716))) >>>> + ? ? ? ? ? ? ? return (mode == 0); >>>> + ? ? ? return b43_no_check_clock_control_chip_common(dev, mode); >>>> +} >>>> + >>>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWaitForWake */ >>>> +static void b43_phy_bmac_wait_for_wake(struct b43_wldev *dev) >>>> +{ >>>> + ? ? ? u8 core_rev = dev->dev->bus->pcicore.dev->id.revision; >>>> + ? ? ? u16 tmp, i; >>>> + >>>> + ? ? ? if (core_rev == 4) { >>>> + ? ? ? ? ? ? ? udelay(5); >>>> + ? ? ? ? ? ? ? return; >>>> + ? ? ? } >>>> + >>>> + ? ? ? if (dev->phy.type == B43_PHYTYPE_G && core_rev == 5) >>>> + ? ? ? ? ? ? ? udelay(2000); >>>> + ? ? ? else >>>> + ? ? ? ? ? ? ? udelay(40); >>>> + >>>> + ? ? ? for (i = 0; i < 1500; i++) { >>>> + ? ? ? ? ? ? ? tmp = b43_shm_read16(dev, B43_SHM_SHARED, >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? B43_SHM_SH_UCODESTAT); >>>> + ? ? ? ? ? ? ? if (tmp == B43_SHM_SH_UCODESTAT_SLEEP) { >>>> + ? ? ? ? ? ? ? ? ? ? ? i = 0; >>>> + ? ? ? ? ? ? ? ? ? ? ? break; >>>> + ? ? ? ? ? ? ? } >>>> + ? ? ? ? ? ? ? udelay(10); >>>> + ? ? ? } >>>> + ? ? ? if (i) >>>> + ? ? ? ? ? ? ? b43err(dev->wl, "ucode wake up timeout\n"); >>>> +} >>>> + >>>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/MctrlWrite */ >>>> +static void b43_phy_mac_control_write(struct b43_wldev *dev) >>>> +{ >>>> + ? ? ? u32 tmp = dev->phy.maccontrol; >>>> + ? ? ? if (dev->phy.wake_override) >>>> + ? ? ? ? ? ? ? tmp |= B43_MACCTL_AWAKE; >>>> + ? ? ? if (dev->phy.mute_override) >>>> + ? ? ? ? ? ? ? tmp &= ~B43_MACCTL_AP; >>>> + ? ? ? tmp |= B43_MACCTL_INFRA; >>>> + ? ? ? b43_write32(dev, B43_MMIO_MACCTL, tmp); >>>> +} >>>> + >>>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideSet */ >>>> +static void b43_ucode_wake_override_set(struct b43_wldev *dev, u32 override) >>>> +{ >>>> + ? ? ? dev->phy.wake_override |= override; >>>> + ? ? ? if (dev->phy.wake_override || dev->phy.maccontrol & B43_MACCTL_AWAKE) >>>> + ? ? ? ? ? ? ? return; >>>> + ? ? ? b43_phy_mac_control_write(dev); >>>> + ? ? ? b43_phy_bmac_wait_for_wake(dev); >>>> +} >>>> + >>>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/UcodeWakeOverrideClear */ >>>> +static void b43_ucode_wake_override_clear(struct b43_wldev *dev, u32 override) >>>> +{ >>>> + ? ? ? dev->phy.wake_override &= ~override; >>>> + ? ? ? if (dev->phy.wake_override != (dev->phy.maccontrol & B43_MACCTL_AWAKE)) >>>> + ? ? ? ? ? ? ? return; >>>> + ? ? ? b43_phy_mac_control_write(dev); >>>> +} >>>> + >>>> ?/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ >>>> ?static void b43_clock_control(struct b43_wldev *dev, u32 mode) >>>> ?{ >>>> - ? ? ? ; /* TODO */ >>>> + ? ? ? struct b43_phy *phy = &dev->phy; >>>> + ? ? ? struct ssb_bus *bus = dev->dev->bus; >>>> + ? ? ? u8 core_rev = bus->pcicore.dev->id.revision; >>>> + ? ? ? u16 i; >>>> + ? ? ? u32 clkctl; >>>> + ? ? ? bool wakeup; >>>> + >>>> + ? ? ? if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) { /* PMU Present */ >>>> + ? ? ? ? ? ? ? B43_WARN_ON(core_rev < 20); >>>> + ? ? ? ? ? ? ? if (phy->clk) { >>>> + ? ? ? ? ? ? ? ? ? ? ? bool tmp = (bus->chipco.pmu.rev == 0 && >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (b43_read32(dev, B43_MMIO_CLKCTL) & 0x12)); >>>> + >>>> + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0) { >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl |= 0x2; >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(33); >>>> + ? ? ? ? ? ? ? ? ? ? ? } >>>> + >>>> + ? ? ? ? ? ? ? ? ? ? ? if (mode == 0 || tmp) { >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? for (i = 0; i < 1500; i++) { >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if ((clkctl & 0x20000) == 0) { >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? i = 0; >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? break; >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? udelay(10); >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (i) >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43err(dev->wl, "clock timeout\n"); >>>> + ? ? ? ? ? ? ? ? ? ? ? } >>>> + >>>> + ? ? ? ? ? ? ? ? ? ? ? if (mode != 0 && tmp) { >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl = b43_read32(dev, B43_MMIO_CLKCTL); >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? clkctl &= ~0x2; >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? b43_write32(dev, B43_MMIO_CLKCTL, clkctl); >>>> + ? ? ? ? ? ? ? ? ? ? ? } >>>> + ? ? ? ? ? ? ? } >>>> + ? ? ? ? ? ? ? phy->forcefastclk = (mode == 0); >>>> + ? ? ? } else { >>>> + ? ? ? ? ? ? ? B43_WARN_ON(core_rev >= 20); >>>> + >>>> + ? ? ? ? ? ? ? wakeup = (core_rev < 9); >>>> + ? ? ? ? ? ? ? if (phy->up && wakeup) >>>> + ? ? ? ? ? ? ? ? ? ? ? b43_ucode_wake_override_set(dev, 1); >>>> + >>>> + ? ? ? ? ? ? ? phy->forcefastclk = b43_clock_control_chip_common(dev, mode); >>>> + ? ? ? ? ? ? ? if (core_rev < 11) { >>>> + ? ? ? ? ? ? ? ? ? ? ? if (phy->forcefastclk) >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0x400, 3); */ >>>> + ? ? ? ? ? ? ? ? ? ? ? else >>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; /* TODO: b43_mhf(dev, 0, 0x400, 0, 3); */ >>> >>> We do implement mhf already, though it is done differently than in wl. >>> See my earlier "Add missing HF write" patch. >> >> Yes, I noticed this in your patch, thanks, however I don't understand >> relation between our implementation and wl yet. I'm not 100% sure how >> to translate this, so I decided to left this as TODO. Didn't want to >> wait anymore before publishing this, to avoid situation of >> implementing the same functions and wasting your and/or mine time. >> >> Could you post a patch making real call instead of this comment, please? >> >> -- >> Rafa? >> > > Sorry, I'm on a Windows-only machine right now. > However, the general rule of translation is: > mhf(a, b, c, d) -> b43_hf_write(dev, (b43_hf_read(dev) & (~b << > (a*16))) | (c << (a*16))) > (Yes, the last parameter is ignored; it seems to be just Broadcrap - > crap written by Broadcom.) Hm, OK, thanks. Still, I've to read it calmly, as it looks that http://bcm-v4.sipsolutions.net/802.11/Mhf uses last parameter and generally is a little different. I don't mean you're wrong, just need time to read this and understand it :) -- Rafa? ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 20:04 ` Gábor Stefanik 2010-08-22 20:14 ` Rafał Miłecki @ 2010-08-22 20:29 ` Larry Finger 2010-08-25 19:07 ` Michael Büsch 2 siblings, 0 replies; 14+ messages in thread From: Larry Finger @ 2010-08-22 20:29 UTC (permalink / raw) To: Gábor Stefanik; +Cc: Rafał Miłecki, linux-wireless, b43-dev On 08/22/2010 03:04 PM, G?bor Stefanik wrote: > > Sorry, I'm on a Windows-only machine right now. > However, the general rule of translation is: > mhf(a, b, c, d) -> b43_hf_write(dev, (b43_hf_read(dev) & (~b << > (a*16))) | (c << (a*16))) > (Yes, the last parameter is ignored; it seems to be just Broadcrap - > crap written by Broadcom.) > IIRC, the d part is a flag used to save the state and avoid writes if the code is setting a state already available. As these writes are not very expensive, this part can indeed be called Broadcrap. Larry ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] b43: N-PHY: add sub calls of band width setting 2010-08-22 20:04 ` Gábor Stefanik 2010-08-22 20:14 ` Rafał Miłecki 2010-08-22 20:29 ` Larry Finger @ 2010-08-25 19:07 ` Michael Büsch 2 siblings, 0 replies; 14+ messages in thread From: Michael Büsch @ 2010-08-25 19:07 UTC (permalink / raw) To: Gábor Stefanik, Rafał Miłecki; +Cc: wireless, b43-dev On 08/22/2010 10:04 PM, G?bor Stefanik wrote: >>>> +#define B43_MMIO_CLKCTL 0x1E0 /* clock control status */ Is it possible that all this stuff is completely bogus? All this clock control stuff you are trying to implement really looks like the standard SSB clock control which is already implemented in SSB. The clock control and status register of the chipcommon is 0x1E0. That "phy reset" stuff also mostly looks like you are reinventing the wheel for code that is already present. -- Greetings Michael. ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <AANLkTi=TMhmTF+ztooAu=E1e1zdw-cBnaSZCKj=Utik0@mail.gmail.com>]
* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call [not found] ` <AANLkTi=TMhmTF+ztooAu=E1e1zdw-cBnaSZCKj=Utik0@mail.gmail.com> @ 2010-08-22 23:30 ` Gábor Stefanik 2010-08-22 23:37 ` Rafał Miłecki 2010-08-23 22:53 ` Rafał Miłecki 2010-08-22 23:35 ` Rafał Miłecki 1 sibling, 2 replies; 14+ messages in thread From: Gábor Stefanik @ 2010-08-22 23:30 UTC (permalink / raw) To: Julian Calaby Cc: Rafał Miłecki, linux-wireless, John W. Linville, b43-dev, Larry Finger On Mon, Aug 23, 2010 at 1:20 AM, Julian Calaby <julian.calaby@gmail.com> wrote: > Rafal, > > Couple of minor style issues, if you're re-submitting. > > 2010/8/23 Rafa? Mi?ecki <zajec5@gmail.com>: >> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >> --- >> ?drivers/net/wireless/b43/phy_common.c | ? 20 ++++++++++++++++++++ >> ?drivers/net/wireless/b43/phy_common.h | ? 11 +++++++++++ >> ?drivers/net/wireless/b43/phy_n.c ? ? ?| ? ?4 ++-- >> ?drivers/net/wireless/b43/phy_n.h ? ? ?| ? ?1 - >> ?4 files changed, 33 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c >> index 8f7d7ef..b06e3f0 100644 >> --- a/drivers/net/wireless/b43/phy_common.c >> +++ b/drivers/net/wireless/b43/phy_common.c >> @@ -466,3 +466,23 @@ struct b43_c32 b43_cordic(int theta) >> >> ? ? ? ?return ret; >> ?} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ >> +static void b43_clock_control(struct b43_wldev *dev, u32 mode) >> +{ >> + ? ? ? ; /* TODO */ > > You don't need the semicolon here, as I understand it. > >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacBwSet */ >> +void b43_bmac_set_b_width(struct b43_wldev *dev, u8 b_width) >> +{ >> + ? ? ? bool fast = dev->phy.forcefastclk;; > > Double semicolon - and is it necessary to assign a local variable here? I agree - don't blindly follow the specs; accessing struct members it not expensive. > >> + ? ? ? if (!fast) >> + ? ? ? ? ? ? ? b43_clock_control(dev, 0); >> + ? ? ? dev->phy.b_width = b_width; >> + ? ? ? b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ >> + ? ? ? /* TODO: Call PHY BMAC Reset */ >> + ? ? ? dev->phy.ops->init(dev); I believe you need to do the whole PHY init, including the common part; not just the PHY type-specific init. Larry, is this true? >> + ? ? ? if (fast) >> + ? ? ? ? ? ? ? b43_clock_control(dev, 2); >> +} > > Thanks, > > -- > > Julian Calaby > > Email: julian.calaby at gmail.com > .Plan: http://sites.google.com/site/juliancalaby/ > -- Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call 2010-08-22 23:30 ` [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call Gábor Stefanik @ 2010-08-22 23:37 ` Rafał Miłecki 2010-08-23 22:53 ` Rafał Miłecki 1 sibling, 0 replies; 14+ messages in thread From: Rafał Miłecki @ 2010-08-22 23:37 UTC (permalink / raw) To: Gábor Stefanik Cc: Julian Calaby, linux-wireless, John W. Linville, b43-dev, Larry Finger W dniu 23 sierpnia 2010 01:30 u?ytkownik G?bor Stefanik <netrolller.3d@gmail.com> napisa?: > On Mon, Aug 23, 2010 at 1:20 AM, Julian Calaby <julian.calaby@gmail.com> wrote: >> Rafal, >> >> Couple of minor style issues, if you're re-submitting. >> >> 2010/8/23 Rafa? Mi?ecki <zajec5@gmail.com>: >>> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >>> --- >>> ?drivers/net/wireless/b43/phy_common.c | ? 20 ++++++++++++++++++++ >>> ?drivers/net/wireless/b43/phy_common.h | ? 11 +++++++++++ >>> ?drivers/net/wireless/b43/phy_n.c ? ? ?| ? ?4 ++-- >>> ?drivers/net/wireless/b43/phy_n.h ? ? ?| ? ?1 - >>> ?4 files changed, 33 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c >>> index 8f7d7ef..b06e3f0 100644 >>> --- a/drivers/net/wireless/b43/phy_common.c >>> +++ b/drivers/net/wireless/b43/phy_common.c >>> @@ -466,3 +466,23 @@ struct b43_c32 b43_cordic(int theta) >>> >>> ? ? ? ?return ret; >>> ?} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ >>> +static void b43_clock_control(struct b43_wldev *dev, u32 mode) >>> +{ >>> + ? ? ? ; /* TODO */ >> >> You don't need the semicolon here, as I understand it. >> >>> +} >>> + >>> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacBwSet */ >>> +void b43_bmac_set_b_width(struct b43_wldev *dev, u8 b_width) >>> +{ >>> + ? ? ? bool fast = dev->phy.forcefastclk;; >> >> Double semicolon - and is it necessary to assign a local variable here? > > I agree - don't blindly follow the specs; accessing struct members it > not expensive. Check for sub call "b43_clock_control", it sets "forcefastclk". And we use local "fast" variable *after* calling "b43_clock_control". I believe it is needed. -- Rafa? ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call 2010-08-22 23:30 ` [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call Gábor Stefanik 2010-08-22 23:37 ` Rafał Miłecki @ 2010-08-23 22:53 ` Rafał Miłecki 2010-08-23 23:17 ` Larry Finger 1 sibling, 1 reply; 14+ messages in thread From: Rafał Miłecki @ 2010-08-23 22:53 UTC (permalink / raw) To: Gábor Stefanik Cc: Julian Calaby, linux-wireless, John W. Linville, b43-dev, Larry Finger W dniu 23 sierpnia 2010 01:30 u?ytkownik G?bor Stefanik <netrolller.3d@gmail.com> napisa?: >>> + ? ? ? if (!fast) >>> + ? ? ? ? ? ? ? b43_clock_control(dev, 0); >>> + ? ? ? dev->phy.b_width = b_width; >>> + ? ? ? b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */ >>> + ? ? ? /* TODO: Call PHY BMAC Reset */ >>> + ? ? ? dev->phy.ops->init(dev); > > I believe you need to do the whole PHY init, including the common > part; not just the PHY type-specific init. Larry, is this true? Do you mean b43_phy_init? Larry: I guess indeed some tip would be nice :) -- Rafa? ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call 2010-08-23 22:53 ` Rafał Miłecki @ 2010-08-23 23:17 ` Larry Finger 2010-08-23 23:56 ` Gábor Stefanik 0 siblings, 1 reply; 14+ messages in thread From: Larry Finger @ 2010-08-23 23:17 UTC (permalink / raw) To: Rafał Miłecki Cc: Gábor Stefanik, Julian Calaby, linux-wireless, John W. Linville, b43-dev On 08/23/2010 05:53 PM, Rafa? Mi?ecki wrote: >> I believe you need to do the whole PHY init, including the common >> part; not just the PHY type-specific init. Larry, is this true? > > Do you mean b43_phy_init? Larry: I guess indeed some tip would be nice :) As it shows in http://bcm-v4.sipsolutions.net/802.11/PHY/Init, you need to do the Common steps. #15 in that list is the specific routines for the PHY type in the device. The code in b43_phy_init() seems not to have all of these steps in it, but I'm not sure where they are implemented. Larry ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call 2010-08-23 23:17 ` Larry Finger @ 2010-08-23 23:56 ` Gábor Stefanik 0 siblings, 0 replies; 14+ messages in thread From: Gábor Stefanik @ 2010-08-23 23:56 UTC (permalink / raw) To: Larry Finger Cc: Rafał Miłecki, Julian Calaby, linux-wireless, John W. Linville, b43-dev On Tue, Aug 24, 2010 at 1:17 AM, Larry Finger <Larry.Finger@lwfinger.net> wrote: > On 08/23/2010 05:53 PM, Rafa? Mi?ecki wrote: >>> I believe you need to do the whole PHY init, including the common >>> part; not just the PHY type-specific init. Larry, is this true? >> >> Do you mean b43_phy_init? Larry: I guess indeed some tip would be nice :) > > As it shows in http://bcm-v4.sipsolutions.net/802.11/PHY/Init, you need to do > the Common steps. #15 in that list is the specific routines for the PHY type in > the device. > > The code in b43_phy_init() seems not to have all of these steps in it, but I'm > not sure where they are implemented. This spec page seems to have lots of Broadcrap in it... it especially needs de-chanspec-tamination; how the driver handles band and bandwidth selection is irrelevant to a HW specification. (Also, many referenced chanspec-related functions are missing.) > > Larry > -- Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call [not found] ` <AANLkTi=TMhmTF+ztooAu=E1e1zdw-cBnaSZCKj=Utik0@mail.gmail.com> 2010-08-22 23:30 ` [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call Gábor Stefanik @ 2010-08-22 23:35 ` Rafał Miłecki 1 sibling, 0 replies; 14+ messages in thread From: Rafał Miłecki @ 2010-08-22 23:35 UTC (permalink / raw) To: Julian Calaby Cc: linux-wireless, John W. Linville, b43-dev, Gábor Stefanik 2010/8/23 Julian Calaby <julian.calaby@gmail.com>: > Rafal, > > Couple of minor style issues, if you're re-submitting. Thanks for reviewing! :) > 2010/8/23 Rafa? Mi?ecki <zajec5@gmail.com>: >> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com> >> --- >> ?drivers/net/wireless/b43/phy_common.c | ? 20 ++++++++++++++++++++ >> ?drivers/net/wireless/b43/phy_common.h | ? 11 +++++++++++ >> ?drivers/net/wireless/b43/phy_n.c ? ? ?| ? ?4 ++-- >> ?drivers/net/wireless/b43/phy_n.h ? ? ?| ? ?1 - >> ?4 files changed, 33 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c >> index 8f7d7ef..b06e3f0 100644 >> --- a/drivers/net/wireless/b43/phy_common.c >> +++ b/drivers/net/wireless/b43/phy_common.c >> @@ -466,3 +466,23 @@ struct b43_c32 b43_cordic(int theta) >> >> ? ? ? ?return ret; >> ?} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/ClkCtlClk */ >> +static void b43_clock_control(struct b43_wldev *dev, u32 mode) >> +{ >> + ? ? ? ; /* TODO */ > > You don't need the semicolon here, as I understand it. Yeah, could be skipped without causing warning. However it was replaced anyway with 2/2. And this code doesn't come from the patch you comment in this thread ;) >> +} >> + >> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacBwSet */ >> +void b43_bmac_set_b_width(struct b43_wldev *dev, u8 b_width) >> +{ >> + ? ? ? bool fast = dev->phy.forcefastclk;; > > Double semicolon - and is it necessary to assign a local variable here? Bingo for double semicolon. We need to keep copy of "forcefastclk" as this can be changed in sub calls. -- Rafa? ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-08-25 19:07 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-22 19:49 [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call Rafał Miłecki
2010-08-22 19:49 ` [PATCH 2/2] b43: N-PHY: add sub calls of band width setting Rafał Miłecki
2010-08-22 19:52 ` Gábor Stefanik
2010-08-22 19:58 ` Rafał Miłecki
2010-08-22 20:04 ` Gábor Stefanik
2010-08-22 20:14 ` Rafał Miłecki
2010-08-22 20:29 ` Larry Finger
2010-08-25 19:07 ` Michael Büsch
[not found] ` <AANLkTi=TMhmTF+ztooAu=E1e1zdw-cBnaSZCKj=Utik0@mail.gmail.com>
2010-08-22 23:30 ` [PATCH 1/2] b43: N-PHY: band width setting with dumb clock control call Gábor Stefanik
2010-08-22 23:37 ` Rafał Miłecki
2010-08-23 22:53 ` Rafał Miłecki
2010-08-23 23:17 ` Larry Finger
2010-08-23 23:56 ` Gábor Stefanik
2010-08-22 23:35 ` Rafał Miłecki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox