diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-12-21 11:13:44 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-12-22 15:43:29 -0500 |
commit | ea7ee14b8a6371f006d73333ef2b7fe929b6dab0 (patch) | |
tree | 3b1cdcadfad481e62ae0b1b1dc95aaab64f2d6ab | |
parent | e41596a118a5cb15a045ef773dc117b2596e6a86 (diff) |
b43: N-PHY: implement radio 2056 init steps
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/b43/phy_n.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/b43/radio_2056.c | 77 | ||||
-rw-r--r-- | drivers/net/wireless/b43/radio_2056.h | 3 |
3 files changed, 111 insertions, 2 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index a1aa5700b631..6b91cb353f23 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -401,16 +401,45 @@ static void b43_radio_init2055(struct b43_wldev *dev) | |||
401 | b43_radio_init2055_post(dev); | 401 | b43_radio_init2055_post(dev); |
402 | } | 402 | } |
403 | 403 | ||
404 | static void b43_radio_init2056_pre(struct b43_wldev *dev) | ||
405 | { | ||
406 | b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, | ||
407 | ~B43_NPHY_RFCTL_CMD_CHIP0PU); | ||
408 | /* Maybe wl meant to reset and set (order?) RFCTL_CMD_OEPORFORCE? */ | ||
409 | b43_phy_mask(dev, B43_NPHY_RFCTL_CMD, | ||
410 | B43_NPHY_RFCTL_CMD_OEPORFORCE); | ||
411 | b43_phy_set(dev, B43_NPHY_RFCTL_CMD, | ||
412 | ~B43_NPHY_RFCTL_CMD_OEPORFORCE); | ||
413 | b43_phy_set(dev, B43_NPHY_RFCTL_CMD, | ||
414 | B43_NPHY_RFCTL_CMD_CHIP0PU); | ||
415 | } | ||
416 | |||
417 | static void b43_radio_init2056_post(struct b43_wldev *dev) | ||
418 | { | ||
419 | b43_radio_set(dev, B2056_SYN_COM_CTRL, 0xB); | ||
420 | b43_radio_set(dev, B2056_SYN_COM_PU, 0x2); | ||
421 | b43_radio_set(dev, B2056_SYN_COM_RESET, 0x2); | ||
422 | msleep(1); | ||
423 | b43_radio_mask(dev, B2056_SYN_COM_RESET, ~0x2); | ||
424 | b43_radio_mask(dev, B2056_SYN_PLL_MAST2, ~0xFC); | ||
425 | b43_radio_mask(dev, B2056_SYN_RCCAL_CTRL0, ~0x1); | ||
426 | /* | ||
427 | if (nphy->init_por) | ||
428 | Call Radio 2056 Recalibrate | ||
429 | */ | ||
430 | } | ||
431 | |||
404 | /* | 432 | /* |
405 | * Initialize a Broadcom 2056 N-radio | 433 | * Initialize a Broadcom 2056 N-radio |
406 | * http://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init | 434 | * http://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init |
407 | */ | 435 | */ |
408 | static void b43_radio_init2056(struct b43_wldev *dev) | 436 | static void b43_radio_init2056(struct b43_wldev *dev) |
409 | { | 437 | { |
410 | /* TODO */ | 438 | b43_radio_init2056_pre(dev); |
439 | b2056_upload_inittabs(dev, 0, 0); | ||
440 | b43_radio_init2056_post(dev); | ||
411 | } | 441 | } |
412 | 442 | ||
413 | |||
414 | /* | 443 | /* |
415 | * Upload the N-PHY tables. | 444 | * Upload the N-PHY tables. |
416 | * http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables | 445 | * http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables |
diff --git a/drivers/net/wireless/b43/radio_2056.c b/drivers/net/wireless/b43/radio_2056.c index 0cdf6a46ba4b..1752d52ab40e 100644 --- a/drivers/net/wireless/b43/radio_2056.c +++ b/drivers/net/wireless/b43/radio_2056.c | |||
@@ -24,6 +24,39 @@ | |||
24 | #include "radio_2056.h" | 24 | #include "radio_2056.h" |
25 | #include "phy_common.h" | 25 | #include "phy_common.h" |
26 | 26 | ||
27 | struct b2056_inittab_entry { | ||
28 | /* Value to write if we use the 5GHz band. */ | ||
29 | u16 ghz5; | ||
30 | /* Value to write if we use the 2.4GHz band. */ | ||
31 | u16 ghz2; | ||
32 | /* Flags */ | ||
33 | u8 flags; | ||
34 | }; | ||
35 | #define B2056_INITTAB_ENTRY_OK 0x01 | ||
36 | #define B2056_INITTAB_UPLOAD 0x02 | ||
37 | #define UPLOAD .flags = B2056_INITTAB_ENTRY_OK | B2056_INITTAB_UPLOAD | ||
38 | #define NOUPLOAD .flags = B2056_INITTAB_ENTRY_OK | ||
39 | |||
40 | struct b2056_inittabs_pts { | ||
41 | const struct b2056_inittab_entry *syn; | ||
42 | unsigned int syn_length; | ||
43 | const struct b2056_inittab_entry *tx; | ||
44 | unsigned int tx_length; | ||
45 | const struct b2056_inittab_entry *rx; | ||
46 | unsigned int rx_length; | ||
47 | }; | ||
48 | |||
49 | #define INITTABSPTS(prefix) \ | ||
50 | .syn = prefix##_syn, \ | ||
51 | .syn_length = ARRAY_SIZE(prefix##_syn), \ | ||
52 | .tx = prefix##_tx, \ | ||
53 | .tx_length = ARRAY_SIZE(prefix##_tx), \ | ||
54 | .rx = prefix##_rx, \ | ||
55 | .rx_length = ARRAY_SIZE(prefix##_rx) | ||
56 | |||
57 | struct b2056_inittabs_pts b2056_inittabs[] = { | ||
58 | }; | ||
59 | |||
27 | #define RADIOREGS3(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \ | 60 | #define RADIOREGS3(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \ |
28 | r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \ | 61 | r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \ |
29 | r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \ | 62 | r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, \ |
@@ -6045,6 +6078,50 @@ static const struct b43_nphy_channeltab_entry_rev3 b43_nphy_channeltab_rev8[] = | |||
6045 | }, | 6078 | }, |
6046 | }; | 6079 | }; |
6047 | 6080 | ||
6081 | static void b2056_upload_inittab(struct b43_wldev *dev, bool ghz5, | ||
6082 | bool ignore_uploadflag, u16 routing, | ||
6083 | const struct b2056_inittab_entry *e, | ||
6084 | unsigned int length) | ||
6085 | { | ||
6086 | unsigned int i; | ||
6087 | u16 value; | ||
6088 | |||
6089 | for (i = 0; i < length; i++, e++) { | ||
6090 | if (!(e->flags & B2056_INITTAB_ENTRY_OK)) | ||
6091 | continue; | ||
6092 | if ((e->flags & B2056_INITTAB_UPLOAD) || ignore_uploadflag) { | ||
6093 | if (ghz5) | ||
6094 | value = e->ghz5; | ||
6095 | else | ||
6096 | value = e->ghz2; | ||
6097 | b43_radio_write(dev, routing | i, value); | ||
6098 | } | ||
6099 | } | ||
6100 | } | ||
6101 | |||
6102 | void b2056_upload_inittabs(struct b43_wldev *dev, | ||
6103 | bool ghz5, bool ignore_uploadflag) | ||
6104 | { | ||
6105 | struct b2056_inittabs_pts *pts; | ||
6106 | |||
6107 | if (dev->phy.rev >= ARRAY_SIZE(b2056_inittabs)) { | ||
6108 | B43_WARN_ON(1); | ||
6109 | return; | ||
6110 | } | ||
6111 | pts = &b2056_inittabs[dev->phy.rev]; | ||
6112 | |||
6113 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, | ||
6114 | B2056_SYN, pts->syn, pts->syn_length); | ||
6115 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, | ||
6116 | B2056_TX0, pts->tx, pts->tx_length); | ||
6117 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, | ||
6118 | B2056_TX1, pts->tx, pts->tx_length); | ||
6119 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, | ||
6120 | B2056_RX0, pts->rx, pts->rx_length); | ||
6121 | b2056_upload_inittab(dev, ghz5, ignore_uploadflag, | ||
6122 | B2056_RX1, pts->rx, pts->rx_length); | ||
6123 | } | ||
6124 | |||
6048 | /* TODO: add support for rev4+ devices by searching in rev4+ tables */ | 6125 | /* TODO: add support for rev4+ devices by searching in rev4+ tables */ |
6049 | const struct b43_nphy_channeltab_entry_rev3 * | 6126 | const struct b43_nphy_channeltab_entry_rev3 * |
6050 | b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq) | 6127 | b43_nphy_get_chantabent_rev3(struct b43_wldev *dev, u16 freq) |
diff --git a/drivers/net/wireless/b43/radio_2056.h b/drivers/net/wireless/b43/radio_2056.h index 302600c0afa4..d601f6e7e313 100644 --- a/drivers/net/wireless/b43/radio_2056.h +++ b/drivers/net/wireless/b43/radio_2056.h | |||
@@ -1114,4 +1114,7 @@ struct b43_nphy_channeltab_entry_rev3 { | |||
1114 | struct b43_phy_n_sfo_cfg phy_regs; | 1114 | struct b43_phy_n_sfo_cfg phy_regs; |
1115 | }; | 1115 | }; |
1116 | 1116 | ||
1117 | void b2056_upload_inittabs(struct b43_wldev *dev, | ||
1118 | bool ghz5, bool ignore_uploadflag); | ||
1119 | |||
1117 | #endif /* B43_RADIO_2056_H_ */ | 1120 | #endif /* B43_RADIO_2056_H_ */ |