b43: N-PHY: band width setting with dumb clock control call
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
--- 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(-)
drivers/net/wireless/b43/phy_common.c +20 -0
@@ -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 ); +}
drivers/net/wireless/b43/phy_common.h +11 -0
@@ -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_ */
drivers/net/wireless/b43/phy_n.c +2 -2
@@ -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 ) {
drivers/net/wireless/b43/phy_n.h +0 -1
@@ -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;
Signature · 1 line
1.7.1
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
--- 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(-)
drivers/net/wireless/b43/b43.h +1 -0
@@ -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
drivers/net/wireless/b43/phy_common.c +149 -1
159 lines not on this page · raw message
drivers/net/wireless/b43/phy_common.h +7 -0
@@ -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;
Signature · 1 line
1.7.1
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
2010/8/22 Rafa? Mi?ecki <[email protected]>:
Quoted 160 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/b43.h +0
-0@@ -57,6 +57,7 @@?#define
B43_MMIO_TSF_CFP_REP? ? ? ? ?0x188
?#defineB43_MMIO_TSF_CFP_START? ? ? ?0x18C
?#defineB43_MMIO_TSF_CFP_MAXDUR? ? ? ? ? ? ? ?0x190
+#defineB43_MMIO_CLKCTL? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */?/* 32-bit DMA */
?#defineB43_MMIO_DMA32_BASE0? ? ? ? ?0x200drivers/net/wireless/b43/phy_common.c +86
-0@@ -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 */
+ ? ? ? structb43_phy*phy =&dev->phy;
+ ? ? ? structssb_bus*bus =dev->dev->bus;
+ ? ? ? u8core_rev=bus->pcicore.dev->id.revision;
+ ? ? ? u16 i;
+ ? ? ? u32 clkctl;
+ ? ? ? bool wakeup;drivers/net/wireless/b43/phy_common.c +37
-0+ + ? ? ? 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); +
drivers/net/wireless/b43/phy_common.c
Quoted 10 lines
drivers/net/wireless/b43/phy_common.c +10
-0+ ? ? ? ? ? ? ? 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.
Quoted 37 lines
+ ? ? ? ? ? ? ? }
drivers/net/wireless/b43/phy_common.c +9
-0+ + ? ? ? ? ? ? ? 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 */
drivers/net/wireless/b43/phy_common.h +0
-0@@ -260,8 +260,15 @@ struct b43_phy { ? ? ? ?atomic_t txerr_cnt;? ? ? ?/* Clock */
+ ? ? ? u32 clk;
? ? ? ?bool forcefastclk;+ ? ? ? bool up;
+ ? ? ? u32 maccontrol;drivers/net/wireless/b43/phy_common.h +4
-0+ + ? ? ? u32 wake_override; + ? ? ? u32 mute_override; +?#ifdef
CONFIG_B43_DEBUG
? ? ? ?/* PHY registers locked (w.r.t. firmware) */ ? ? ? ?boolphy_locked;
--
1.7.1
Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
W dniu 22 sierpnia 2010 21:52 u?ytkownik G?bor Stefanik <[email protected]> napisa?:
Quoted 166 lines
2010/8/22 Rafa? Mi?ecki <[email protected]>:
Quoted 165 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/b43.h +0
-0@@ -57,6 +57,7 @@?#define
B43_MMIO_TSF_CFP_REP? ? ? ? ?0x188
?#defineB43_MMIO_TSF_CFP_START? ? ? ?0x18C
?#defineB43_MMIO_TSF_CFP_MAXDUR? ? ? ? ? ? ? ?0x190
+#defineB43_MMIO_CLKCTL? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */?/* 32-bit DMA */
?#defineB43_MMIO_DMA32_BASE0? ? ? ? ?0x200drivers/net/wireless/b43/phy_common.c +86
-0@@ -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 */
+ ? ? ? structb43_phy*phy =&dev->phy;
+ ? ? ? structssb_bus*bus =dev->dev->bus;
+ ? ? ? u8core_rev=bus->pcicore.dev->id.revision;
+ ? ? ? u16 i;
+ ? ? ? u32 clkctl;
+ ? ? ? bool wakeup;drivers/net/wireless/b43/phy_common.c +42
-0+ + ? ? ? 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);
Quoted 8 lines
Quoted 5 lines
+ ? ? ? ? ? ? ? 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?
Signature · 1 line
Rafa?
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
2010/8/22 Rafa? Mi?ecki <[email protected]>:
Quoted 183 lines
W dniu 22 sierpnia 2010 21:52 u?ytkownik G?bor Stefanik <[email protected]> napisa?:
Quoted 166 lines
2010/8/22 Rafa? Mi?ecki <[email protected]>:
Quoted 165 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/b43.h +0
-0@@ -57,6 +57,7 @@?#define
B43_MMIO_TSF_CFP_REP? ? ? ? ?0x188
?#defineB43_MMIO_TSF_CFP_START? ? ? ?0x18C
?#defineB43_MMIO_TSF_CFP_MAXDUR? ? ? ? ? ? ? ?0x190
+#defineB43_MMIO_CLKCTL? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */?/* 32-bit DMA */
?#defineB43_MMIO_DMA32_BASE0? ? ? ? ?0x200drivers/net/wireless/b43/phy_common.c +86
-0@@ -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 */
+ ? ? ? structb43_phy*phy =&dev->phy;
+ ? ? ? structssb_bus*bus =dev->dev->bus;
+ ? ? ? u8core_rev=bus->pcicore.dev->id.revision;
+ ? ? ? u16 i;
+ ? ? ? u32 clkctl;
+ ? ? ? bool wakeup;drivers/net/wireless/b43/phy_common.c +42
-0+ + ? ? ? 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);Quoted 8 lines
Quoted 5 lines
+ ? ? ? ? ? ? ? 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.
Quoted 5 lines
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.)
Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
W dniu 22 sierpnia 2010 22:04 u?ytkownik G?bor Stefanik <[email protected]> napisa?:
Quoted 190 lines
2010/8/22 Rafa? Mi?ecki <[email protected]>:
Quoted 183 lines
W dniu 22 sierpnia 2010 21:52 u?ytkownik G?bor Stefanik <[email protected]> napisa?:
Quoted 166 lines
2010/8/22 Rafa? Mi?ecki <[email protected]>:
Quoted 165 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/b43.h +0
-0@@ -57,6 +57,7 @@?#define
B43_MMIO_TSF_CFP_REP? ? ? ? ?0x188
?#defineB43_MMIO_TSF_CFP_START? ? ? ?0x18C
?#defineB43_MMIO_TSF_CFP_MAXDUR? ? ? ? ? ? ? ?0x190
+#defineB43_MMIO_CLKCTL? ? ? ? ? ? ? ? ? ? ? ?0x1E0 ? /* clock control status */?/* 32-bit DMA */
?#defineB43_MMIO_DMA32_BASE0? ? ? ? ?0x200drivers/net/wireless/b43/phy_common.c +86
-0@@ -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 */
+ ? ? ? structb43_phy*phy =&dev->phy;
+ ? ? ? structssb_bus*bus =dev->dev->bus;
+ ? ? ? u8core_rev=bus->pcicore.dev->id.revision;
+ ? ? ? u16 i;
+ ? ? ? u32 clkctl;
+ ? ? ? bool wakeup;drivers/net/wireless/b43/phy_common.c +42
-0+ + ? ? ? 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);Quoted 8 lines
Quoted 5 lines
+ ? ? ? ? ? ? ? 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.
Quoted 5 lines
Could you post a patch making real call instead of this comment, please?
--
Rafa?
Quoted 6 lines
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 :)
Signature · 1 line
Rafa?
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
In reply to Gábor StefanikQuoted 8 lines · Gábor Stefanik
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
PATCH 2/2 b43: N-PHY: add sub calls of band width setting
In reply to Gábor StefanikQuoted 1 line · G?bor Stefanik
Quoted 1 line
Quoted 1 line
Quoted 1 line
+#define
B43_MMIO_CLKCTL0x1E0/* 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.
Signature · 1 line
Greetings Michael.
Rafal,
Couple of minor style issues, if you're re-submitting.
2010/8/23 Rafał Miłecki <[email protected]>:
Quoted 13 lines
Signed-off-by Rafał Miłecki <[email protected]>---
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(-)drivers/net/wireless/b43/phy_common.c +0
-0
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 473
Quoted 8 lines
drivers/net/wireless/b43/phy_common.c +5
-0@@ -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.
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 479
Quoted 6 lines
drivers/net/wireless/b43/phy_common.c +6
-0+} + +/* 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?
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 488
Quoted 9 lines
drivers/net/wireless/b43/phy_common.c +9
-0+ 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); +}
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] .Plan: http://sites.google.com/site/juliancalaby/
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
Quoted 29 lines · Julian Calaby
Rafal,
Couple of minor style issues, if you're re-submitting.
2010/8/23 Rafa? Mi?ecki <[email protected]>:
Quoted 13 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/phy_common.c +0
-0drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 473
Quoted 8 lines
drivers/net/wireless/b43/phy_common.c +5
-0@@ -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.
Quoted 8 lines
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta)
Quoted 6 lines
drivers/net/wireless/b43/phy_common.c +6
-0+} + +/* 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.
Quoted 7 lines
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 485
Quoted 7 lines
drivers/net/wireless/b43/phy_common.c +6
-0+ ? ? ? 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?
Quoted 13 lines
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 488
Quoted 3 lines
drivers/net/wireless/b43/phy_common.c +3
-0+ ? ? ? if (fast) + ? ? ? ? ? ? ? b43_clock_control(dev, 2); +}Thanks,
--
Julian Calaby
Email: julian.calaby at gmail.com
.Plan: http://sites.google.com/site/juliancalaby/
Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
W dniu 23 sierpnia 2010 01:30 u?ytkownik G?bor Stefanik <[email protected]> napisa?:
Quoted 39 lines · Julian Calaby
Quoted 29 lines
Rafal,
Couple of minor style issues, if you're re-submitting.
2010/8/23 Rafa? Mi?ecki <[email protected]>:
Quoted 13 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/phy_common.c +0
-0drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta) · line 473
Quoted 8 lines
drivers/net/wireless/b43/phy_common.c +5
-0@@ -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.
Quoted 8 lines
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta)
Quoted 6 lines
drivers/net/wireless/b43/phy_common.c +6
-0+} + +/* 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?
Quoted 2 lines
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.
Signature · 1 line
Rafa?
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
In reply to Gábor StefanikW dniu 23 sierpnia 2010 01:30 u?ytkownik G?bor Stefanik <[email protected]> napisa?:
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
+ ? ? ? 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 :)
Signature · 1 line
Rafa?
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
Quoted 4 lines · Rafał Miłecki
Quoted 2 lines
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
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
Quoted 4 lines · Larry Finger
Quoted 3 lines · Rafa? Mi?ecki
Quoted 2 lines
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?
Quoted 8 lines
Quoted 1 line
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.)
Quoted 3 lines
Larry
Signature · 1 line
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
PATCH 1/2 b43: N-PHY: band width setting with dumb clock control call
In reply to Julian Calaby2010/8/23 Julian Calaby <[email protected]>:
Quoted 3 lines
Rafal,
Couple of minor style issues, if you're re-submitting.
Thanks for reviewing! :)
Quoted 15 lines
2010/8/23 Rafa? Mi?ecki <[email protected]>:
Quoted 14 lines
Signed-off-by Rafa? Mi?ecki <[email protected]>---
?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(-)
drivers/net/wireless/b43/phy_common.c +0
-0@@ -466,3 +466,23 @@ struct b43_c32 b43_cordic(int theta)
Quoted 9 lines
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta)
Quoted 7 lines
drivers/net/wireless/b43/phy_common.c +5
-0? ? ? ?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 ;)
Quoted 8 lines
drivers/net/wireless/b43/phy_common.c struct b43_c32 b43_cordic(int theta)
Quoted 6 lines
drivers/net/wireless/b43/phy_common.c +6
-0+} + +/* 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.
Signature · 1 line
Rafa?