Skip to content

Commit 85e6c26

Browse files
rmileckilinvjw
authored andcommitted
b43: HT-PHY: Move radio preparation into init function
Radio should be prepared only before initialization. We need this to be able to call b43_radio_2059_init conditionally (in the future). This also documents RF control register a bit. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 4f4378d commit 85e6c26

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

‎drivers/net/wireless/b43/phy_ht.c‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ static void b43_radio_2059_channel_setup(struct b43_wldev *dev,
8989
udelay(300);
9090
}
9191

92+
static void b43_radio_2059_init_pre(struct b43_wldev *dev)
93+
{
94+
b43_phy_mask(dev, B43_PHY_HT_RF_CTL_CMD, ~B43_PHY_HT_RF_CTL_CMD_CHIP0_PU);
95+
b43_phy_set(dev, B43_PHY_HT_RF_CTL_CMD, B43_PHY_HT_RF_CTL_CMD_FORCE);
96+
b43_phy_mask(dev, B43_PHY_HT_RF_CTL_CMD, ~B43_PHY_HT_RF_CTL_CMD_FORCE);
97+
b43_phy_set(dev, B43_PHY_HT_RF_CTL_CMD, B43_PHY_HT_RF_CTL_CMD_CHIP0_PU);
98+
}
99+
92100
static void b43_radio_2059_init(struct b43_wldev *dev)
93101
{
94102
const u16 routing[] = { R2059_C1, R2059_C2, R2059_C3 };
@@ -97,6 +105,9 @@ static void b43_radio_2059_init(struct b43_wldev *dev)
97105
};
98106
u16 i, j;
99107

108+
/* Prepare (reset?) radio */
109+
b43_radio_2059_init_pre(dev);
110+
100111
b43_radio_write(dev, R2059_ALL | 0x51, 0x0070);
101112
b43_radio_write(dev, R2059_ALL | 0x5a, 0x0003);
102113

@@ -1002,19 +1013,10 @@ static void b43_phy_ht_op_software_rfkill(struct b43_wldev *dev,
10021013
if (b43_read32(dev, B43_MMIO_MACCTL) & B43_MACCTL_ENABLED)
10031014
b43err(dev->wl, "MAC not suspended\n");
10041015

1005-
/* In the following PHY ops we copy wl's dummy behaviour.
1006-
* TODO: Find out if reads (currently hidden in masks/masksets) are
1007-
* needed and replace following ops with just writes or w&r.
1008-
* Note: B43_PHY_HT_RF_CTL1 register is tricky, wrong operation can
1009-
* cause delayed (!) machine lock up. */
10101016
if (blocked) {
1011-
b43_phy_mask(dev, B43_PHY_HT_RF_CTL1, 0);
1017+
b43_phy_mask(dev, B43_PHY_HT_RF_CTL_CMD,
1018+
~B43_PHY_HT_RF_CTL_CMD_CHIP0_PU);
10121019
} else {
1013-
b43_phy_mask(dev, B43_PHY_HT_RF_CTL1, 0);
1014-
b43_phy_maskset(dev, B43_PHY_HT_RF_CTL1, 0, 0x1);
1015-
b43_phy_mask(dev, B43_PHY_HT_RF_CTL1, 0);
1016-
b43_phy_maskset(dev, B43_PHY_HT_RF_CTL1, 0, 0x2);
1017-
10181020
if (dev->phy.radio_ver == 0x2059)
10191021
b43_radio_2059_init(dev);
10201022
else

‎drivers/net/wireless/b43/phy_ht.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
#define B43_PHY_HT_RF_SEQ_STATUS B43_PHY_EXTG(0x004)
8282
/* Values for the status are the same as for the trigger */
8383

84-
#define B43_PHY_HT_RF_CTL1 B43_PHY_EXTG(0x010)
84+
#define B43_PHY_HT_RF_CTL_CMD 0x810
85+
#define B43_PHY_HT_RF_CTL_CMD_FORCE 0x0001
86+
#define B43_PHY_HT_RF_CTL_CMD_CHIP0_PU 0x0002
8587

8688
#define B43_PHY_HT_RF_CTL_INT_C1 B43_PHY_EXTG(0x04c)
8789
#define B43_PHY_HT_RF_CTL_INT_C2 B43_PHY_EXTG(0x06c)

0 commit comments

Comments
 (0)