diff options
Diffstat (limited to 'drivers/net/wireless/b43/nphy.c')
-rw-r--r-- | drivers/net/wireless/b43/nphy.c | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/nphy.c b/drivers/net/wireless/b43/nphy.c index b427aeeaa1f2..96a052ea4cf7 100644 --- a/drivers/net/wireless/b43/nphy.c +++ b/drivers/net/wireless/b43/nphy.c | |||
@@ -35,12 +35,78 @@ void b43_nphy_xmitpower(struct b43_wldev *dev) | |||
35 | {//TODO | 35 | {//TODO |
36 | } | 36 | } |
37 | 37 | ||
38 | static void b43_chantab_radio_upload(struct b43_wldev *dev, | ||
39 | const struct b43_nphy_channeltab_entry *e) | ||
40 | { | ||
41 | b43_radio_write16(dev, B2055_PLL_REF, e->radio_pll_ref); | ||
42 | b43_radio_write16(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0); | ||
43 | b43_radio_write16(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1); | ||
44 | b43_radio_write16(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail); | ||
45 | b43_radio_write16(dev, B2055_VCO_CAL1, e->radio_vco_cal1); | ||
46 | b43_radio_write16(dev, B2055_VCO_CAL2, e->radio_vco_cal2); | ||
47 | b43_radio_write16(dev, B2055_PLL_LFC1, e->radio_pll_lfc1); | ||
48 | b43_radio_write16(dev, B2055_PLL_LFR1, e->radio_pll_lfr1); | ||
49 | b43_radio_write16(dev, B2055_PLL_LFC2, e->radio_pll_lfc2); | ||
50 | b43_radio_write16(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf); | ||
51 | b43_radio_write16(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1); | ||
52 | b43_radio_write16(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2); | ||
53 | b43_radio_write16(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune); | ||
54 | b43_radio_write16(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune); | ||
55 | b43_radio_write16(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1); | ||
56 | b43_radio_write16(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn); | ||
57 | b43_radio_write16(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim); | ||
58 | b43_radio_write16(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune); | ||
59 | b43_radio_write16(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune); | ||
60 | b43_radio_write16(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1); | ||
61 | b43_radio_write16(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn); | ||
62 | b43_radio_write16(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim); | ||
63 | } | ||
64 | |||
65 | static void b43_chantab_phy_upload(struct b43_wldev *dev, | ||
66 | const struct b43_nphy_channeltab_entry *e) | ||
67 | { | ||
68 | b43_phy_write(dev, B43_NPHY_BW1A, e->phy_bw1a); | ||
69 | b43_phy_write(dev, B43_NPHY_BW2, e->phy_bw2); | ||
70 | b43_phy_write(dev, B43_NPHY_BW3, e->phy_bw3); | ||
71 | b43_phy_write(dev, B43_NPHY_BW4, e->phy_bw4); | ||
72 | b43_phy_write(dev, B43_NPHY_BW5, e->phy_bw5); | ||
73 | b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6); | ||
74 | } | ||
75 | |||
76 | static void b43_nphy_tx_power_fix(struct b43_wldev *dev) | ||
77 | { | ||
78 | //TODO | ||
79 | } | ||
80 | |||
38 | /* Tune the hardware to a new channel. Don't call this directly. | 81 | /* Tune the hardware to a new channel. Don't call this directly. |
39 | * Use b43_radio_selectchannel() */ | 82 | * Use b43_radio_selectchannel() */ |
40 | void b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel) | 83 | int b43_nphy_selectchannel(struct b43_wldev *dev, u8 channel) |
41 | { | 84 | { |
85 | const struct b43_nphy_channeltab_entry *tabent; | ||
42 | 86 | ||
43 | //TODO | 87 | tabent = b43_nphy_get_chantabent(dev, channel); |
88 | if (!tabent) | ||
89 | return -ESRCH; | ||
90 | |||
91 | //FIXME enable/disable band select upper20 in RXCTL | ||
92 | if (0 /*FIXME 5Ghz*/) | ||
93 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20); | ||
94 | else | ||
95 | b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50); | ||
96 | b43_chantab_radio_upload(dev, tabent); | ||
97 | udelay(50); | ||
98 | b43_radio_write16(dev, B2055_VCO_CAL10, 5); | ||
99 | b43_radio_write16(dev, B2055_VCO_CAL10, 45); | ||
100 | b43_radio_write16(dev, B2055_VCO_CAL10, 65); | ||
101 | udelay(300); | ||
102 | if (0 /*FIXME 5Ghz*/) | ||
103 | b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ); | ||
104 | else | ||
105 | b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ); | ||
106 | b43_chantab_phy_upload(dev, tabent); | ||
107 | b43_nphy_tx_power_fix(dev); | ||
108 | |||
109 | return 0; | ||
44 | } | 110 | } |
45 | 111 | ||
46 | static void b43_radio_init2055_pre(struct b43_wldev *dev) | 112 | static void b43_radio_init2055_pre(struct b43_wldev *dev) |