b43: HT-PHY: init: zero EXTG registers
PATCH 1/4 b43: HT-PHY: init: zero EXTG registers
---
I've simply chcked what ndis does after uploading PHY tables:
phy_read(0x00be) -> 0x0002phy_write(0x00be) <- 0x0000
phy_read(0x023f) -> 0x0000phy_write(0x023f) <- 0x07ff
phy_read(0x0240) -> 0x0000phy_write(0x0240) <- 0x07ff
phy_read(0x0241) -> 0x0000phy_write(0x0241) <- 0x07ff
phy_write(0x0840) <- 0x0000phy_write(0x0841) <- 0x0000phy_write(0x0842) <- 0x0000phy_write(0x0843) <- 0x0000
phy_write(0x0860) <- 0x0000phy_write(0x0861) <- 0x0000phy_write(0x0862) <- 0x0000phy_write(0x0863) <- 0x0000
phy_write(0x0880) <- 0x0000phy_write(0x0881) <- 0x0000phy_write(0x0882) <- 0x0000phy_write(0x0883) <- 0x0000
phy_write(0x084c) <- 0x0000phy_write(0x086c) <- 0x0000phy_write(0x088c) <- 0x0000
--- drivers/net/wireless/b43/phy_ht.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_ht.c +22 -0
@@ -152,6 +152,24 @@ static void b43_radio_2059_init(struct b43_wldev *dev) }/************************************************** +* Various PHY ops +**************************************************/ + +static void b43_phy_ht_zero_extg (struct b43_wldev *dev) +{ +u8 i, j; +u16 base[] = {0x40 ,0x60 ,0x80 }; + +for (i =0 ; i <ARRAY_SIZE (base); i++) { +for (j =0 ; j <4 ; j++) +b43_phy_write (dev,B43_PHY_EXTG (base[i] + j),0 ); + } + +for (i =0 ; i <ARRAY_SIZE (base); i++) +b43_phy_write (dev,B43_PHY_EXTG (base[i] +0xc ),0 ); +} + +/************************************************** * Channel switching ops. **************************************************/
@@ -257,6 +275,10 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev) {b43_phy_ht_tables_init (dev); +/* TODO: PHY ops on regs 0x0be, 0x23f 0x240 0x241 */ + +b43_phy_ht_zero_extg (dev); +return 0 ; }
Signature · 1 line
1.7.3.4
PATCH 2/4 b43: HT-PHY: init: implement few simple PHY writes
---
Not much magic, after zeroing EXTG regs, ndis does:
phy_read(0x0800) -> 0x0003phy_write(0x0800) <- 0x0000
phy_write(0x0910) <- 0x0000phy_write(0x0914) <- 0x0000phy_write(0x0918) <- 0x0000phy_write(0x0903) <- 0x0020phy_write(0x0901) <- 0x0020phy_write(0x020d) <- 0x00b8phy_write(0x094f) <- 0x00c8phy_write(0x0070) <- 0x0050phy_write(0x01ff) <- 0x0030
--- drivers/net/wireless/b43/phy_ht.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_ht.c +22 -0
@@ -279,6 +279,28 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev)b43_phy_ht_zero_extg (dev); +/* TODO: PHY op on reg B43_PHY_EXTG(0) */ + +b43_phy_write (dev,B43_PHY_HT_AFE_CTL1 ,0 ); +b43_phy_write (dev,B43_PHY_HT_AFE_CTL3 ,0 ); +b43_phy_write (dev,B43_PHY_HT_AFE_CTL5 ,0 ); + +b43_phy_write (dev,B43_PHY_EXTG (0x103 ),0x20 ); +b43_phy_write (dev,B43_PHY_EXTG (0x101 ),0x20 ); +b43_phy_write (dev,0x20d ,0xb8 ); +b43_phy_write (dev,B43_PHY_EXTG (0x14f ),0xc8 ); +b43_phy_write (dev,0x70 ,0x50 ); +b43_phy_write (dev,0x1ff ,0x30 ); + +if (0 )/* TODO: condition */ + ;/* TODO: PHY op on reg 0x217 */ + + ;/* TODO: PHY op on reg 0xb0 */ + + ;/* TODO: PHY ops on regs 0xb1, 0x32f, 0x077, 0x0b4, 0x17e */ + +b43_phy_write (dev,0x0b9 ,0x0072 ); +return 0 ; }
Signature · 1 line
1.7.3.4
PATCH 3/4 b43: HT-PHY: init: copy tables and reset CCA
In reply to Rafał Miłecki---
Copying comes from following part of the dump:phy_write(0x0072) <- 0x1d44
phy_read(0x0073) -> 0x0002phy_write(0x0072) <- 0x1d4aphy_write(0x0073) <- 0x0002
phy_write(0x0072) <- 0x1d54
phy_read(0x0073) -> 0x0002phy_write(0x0072) <- 0x1d5aphy_write(0x0073) <- 0x0002
phy_write(0x0072) <- 0x1d64
phy_read(0x0073) -> 0x0002phy_write(0x0072) <- 0x1d6aphy_write(0x0073) <- 0x0002
CCA reset from dump (known from N-PHY):
read32 0xb0601408 -> 0x00002055
write32 0xb0601408 <- 0x00002057
read32 0xb0601408 -> 0x00002057
phy_read(0x0001) -> 0x0000phy_write(0x0001) <- 0x4000phy_write(0x0001) <- 0x0000
read32 0xb0601408 -> 0x00002057
write32 0xb0601408 <- 0x00002055
read32 0xb0601408 -> 0x00002055
Finally well-known MAC PHY clock en:
read32 0xb0601408 -> 0x00002055
write32 0xb0601408 <- 0x00002055
read32 0xb0601408 -> 0x00002055
--- drivers/net/wireless/b43/phy_ht.c | 21 +++++++++++++++++++++ drivers/net/wireless/b43/phy_ht.h | 4 ++++ 2 files changed, 25 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_ht.c +21 -0
@@ -273,6 +273,8 @@ static void b43_phy_ht_op_prepare_structs(struct b43_wldev *dev)static int b43_phy_ht_op_init (struct b43_wldev *dev) { +u16 tmp; +b43_phy_ht_tables_init (dev);/* TODO: PHY ops on regs 0x0be, 0x23f 0x240 0x241 */
@@ -301,6 +303,25 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev)b43_phy_write (dev,0x0b9 ,0x0072 ); +/* TODO: Some ops here */ + +/* Copy some tables entries */ + tmp =b43_httab_read (dev,B43_HTTAB16 (7 ,0x144 )); +b43_httab_write (dev,B43_HTTAB16 (7 ,0x14a ), tmp); + tmp =b43_httab_read (dev,B43_HTTAB16 (7 ,0x154 )); +b43_httab_write (dev,B43_HTTAB16 (7 ,0x15a ), tmp); + tmp =b43_httab_read (dev,B43_HTTAB16 (7 ,0x164 )); +b43_httab_write (dev,B43_HTTAB16 (7 ,0x16a ), tmp); + +/* Reset CCA */ +b43_phy_force_clock (dev, true); + tmp =b43_phy_read (dev,B43_PHY_HT_BBCFG ); +b43_phy_write (dev,B43_PHY_HT_BBCFG , tmp |B43_PHY_HT_BBCFG_RSTCCA ); +b43_phy_write (dev,B43_PHY_HT_BBCFG , tmp & ~B43_PHY_HT_BBCFG_RSTCCA ); +b43_phy_force_clock (dev, false); + +b43_mac_phy_clock_set (dev, true); +return 0 ; }
drivers/net/wireless/b43/phy_ht.h +4 -0
@@ -4,7 +4,11 @@#include "phy_common.h" +#define B43_PHY_HT_BBCFG 0x001/* BB config */ +#define B43_PHY_HT_BBCFG_RSTCCA 0x4000/* Reset CCA */ +#define B43_PHY_HT_BBCFG_RSTRX 0x8000/* Reset RX */ #define B43_PHY_HT_BANDCTL 0x009/* Band control */ +#define B43_PHY_HT_BANDCTL_5GHZ 0x0001/* Use the 5GHz band */ #define B43_PHY_HT_TABLE_ADDR 0x072/* Table address */ #define B43_PHY_HT_TABLE_DATALO 0x073/* Table data low */ #define B43_PHY_HT_TABLE_DATAHI 0x074/* Table data high */
Signature · 1 line
1.7.3.4
PATCH 4/4 b43: HT-PHY: init: init BPHY and upload 0x1a table
In reply to Rafał Miłecki---
BPHY is something partially known from N-PHY.
This 0x1a table with 0xc0 offset is a little tricky. We already upload something like that earlier, but this is needed to stop radio going crazy and transmissint crap.
--- drivers/net/wireless/b43/phy_ht.c | 26 ++++++++++++++++++++ drivers/net/wireless/b43/tables_phy_ht.c | 38 ++++++++++++++++++++++++++++++ drivers/net/wireless/b43/tables_phy_ht.h | 3 ++ 3 files changed, 67 insertions(+), 0 deletions(-)
drivers/net/wireless/b43/phy_ht.c +26 -0
@@ -169,6 +169,24 @@ static void b43_phy_ht_zero_extg(struct b43_wldev *dev)b43_phy_write (dev,B43_PHY_EXTG (base[i] +0xc ),0 ); } +static void b43_phy_ht_bphy_init (struct b43_wldev *dev) +{ +unsigned int i; +u16 val; + + val =0x1E1F ; +for (i =0 ; i <16 ; i++) { +b43_phy_write (dev,B43_PHY_N_BMODE (0x88 + i), val); + val -=0x202 ; + } + val =0x3E3F ; +for (i =0 ; i <16 ; i++) { +b43_phy_write (dev,B43_PHY_N_BMODE (0x98 + i), val); + val -=0x202 ; + } +b43_phy_write (dev,B43_PHY_N_BMODE (0x38 ),0x668 ); +} +/************************************************** * Channel switching ops. **************************************************/
@@ -322,6 +340,14 @@ static int b43_phy_ht_op_init(struct b43_wldev *dev)b43_mac_phy_clock_set (dev, true); +/* TODO: Some ops here */ + +if (b43_current_band (dev->wl) ==IEEE80211_BAND_2GHZ ) +b43_phy_ht_bphy_init (dev); + +b43_httab_write_bulk (dev,B43_HTTAB32 (0x1a ,0xc0 ), +B43_HTTAB_1A_C0_LATE_SIZE , b43_httab_0x1a_0xc0_late); +return 0 ; }
drivers/net/wireless/b43/tables_phy_ht.c +38 -0
@@ -574,6 +574,42 @@ static const u32 b43_httab_0x24[] = { 0x005d0582, 0x005805d6, 0x0053062e, 0x004e068c, }; +/* Some late-init table */ +const u32 b43_httab_0x1a_0xc0_late[] = { +0x10f90040 ,0x10e10040 ,0x10e1003c ,0x10c9003d , +0x10b9003c ,0x10a9003d ,0x10a1003c ,0x1099003b , +0x1091003b ,0x1089003a ,0x1081003a ,0x10790039 , +0x10710039 ,0x1069003a ,0x1061003b ,0x1059003d , +0x1051003f ,0x10490042 ,0x1049003e ,0x1049003b , +0x1041003e ,0x1041003b ,0x1039003e ,0x1039003b , +0x10390038 ,0x10390035 ,0x1031003a ,0x10310036 , +0x10310033 ,0x1029003a ,0x10290037 ,0x10290034 , +0x10290031 ,0x10210039 ,0x10210036 ,0x10210033 , +0x10210030 ,0x1019003c ,0x10190039 ,0x10190036 , +0x10190033 ,0x10190030 ,0x1019002d ,0x1019002b , +0x10190028 ,0x1011003a ,0x10110036 ,0x10110033 , +0x10110030 ,0x1011002e ,0x1011002b ,0x10110029 , +0x10110027 ,0x10110024 ,0x10110022 ,0x10110020 , +0x1011001f ,0x1011001d ,0x1009003a ,0x10090037 , +0x10090034 ,0x10090031 ,0x1009002e ,0x1009002c , +0x10090029 ,0x10090027 ,0x10090025 ,0x10090023 , +0x10090021 ,0x1009001f ,0x1009001d ,0x1009001b , +0x1009001a ,0x10090018 ,0x10090017 ,0x10090016 , +0x10090015 ,0x10090013 ,0x10090012 ,0x10090011 , +0x10090010 ,0x1009000f ,0x1009000f ,0x1009000e , +0x1009000d ,0x1009000c ,0x1009000c ,0x1009000b , +0x1009000a ,0x1009000a ,0x10090009 ,0x10090009 , +0x10090008 ,0x10090008 ,0x10090007 ,0x10090007 , +0x10090007 ,0x10090006 ,0x10090006 ,0x10090005 , +0x10090005 ,0x10090005 ,0x10090005 ,0x10090004 , +0x10090004 ,0x10090004 ,0x10090004 ,0x10090003 , +0x10090003 ,0x10090003 ,0x10090003 ,0x10090003 , +0x10090003 ,0x10090002 ,0x10090002 ,0x10090002 , +0x10090002 ,0x10090002 ,0x10090002 ,0x10090002 , +0x10090002 ,0x10090002 ,0x10090001 ,0x10090001 , +0x10090001 ,0x10090001 ,0x10090001 ,0x10090001 , +}; +/************************************************** * R/W ops. **************************************************/
@@ -768,6 +804,8 @@ void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset, }while (0 ) void b43_phy_ht_tables_init(struct b43_wldev *dev) { +BUILD_BUG_ON (ARRAY_SIZE (b43_httab_0x1a_0xc0_late) !=B43_HTTAB_1A_C0_LATE_SIZE ); +httab_upload (dev,B43_HTTAB16 (0x12 ,0 ), b43_httab_0x12);httab_upload (dev,B43_HTTAB16 (0x27 ,0 ), b43_httab_0x27);httab_upload (dev,B43_HTTAB16 (0x26 ,0 ), b43_httab_0x26);
drivers/net/wireless/b43/tables_phy_ht.h +3 -0
@@ -20,4 +20,7 @@ void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,void b43_phy_ht_tables_init (struct b43_wldev *dev); +#define B43_HTTAB_1A_C0_LATE_SIZE 128 +extern const u32 b43_httab_0x1a_0xc0_late[]; +#endif /* B43_TABLES_PHY_HT_H_ */
Signature · 1 line
1.7.3.4