b43: N-PHY: init and channel switching of radio 0x2057 rev 9
authorRafał Miłecki <zajec5@gmail.com>
Tue, 8 Jul 2014 13:11:08 +0000 (15:11 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 15 Jul 2014 19:51:39 +0000 (15:51 -0400)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/phy_n.c
drivers/net/wireless/b43/radio_2057.c

index 44349f5b99c6e739348e949297cb98dbdd770332..479cda88ca5ec241c1acd1877f825d08e15f5a28 100644 (file)
@@ -746,10 +746,55 @@ static void b43_radio_2057_setup(struct b43_wldev *dev,
                        b43_radio_write(dev, R2057_RFPLL_LOOPFILTER_C2, 0x8);
                }
                break;
+       case 9: /* e.g. PHY rev 16 */
+               b43_radio_write(dev, R2057_LOGEN_PTAT_RESETS, 0x20);
+               b43_radio_write(dev, R2057_VCOBUF_IDACS, 0x18);
+               if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
+                       b43_radio_write(dev, R2057_LOGEN_PTAT_RESETS, 0x38);
+                       b43_radio_write(dev, R2057_VCOBUF_IDACS, 0x0f);
+
+                       if (b43_is_40mhz(dev)) {
+                               /* TODO */
+                       } else {
+                               b43_radio_write(dev,
+                                               R2057_PAD_BIAS_FILTER_BWS_CORE0,
+                                               0x3c);
+                               b43_radio_write(dev,
+                                               R2057_PAD_BIAS_FILTER_BWS_CORE1,
+                                               0x3c);
+                       }
+               }
+               break;
        /* TODO */
        }
 
-       /* TODO */
+       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               u16 txmix2g_tune_boost_pu = 0;
+               u16 pad2g_tune_pus = 0;
+
+               if (b43_nphy_ipa(dev)) {
+                       switch (phy->radio_rev) {
+                       case 9:
+                               txmix2g_tune_boost_pu = 0x0041;
+                               /* TODO */
+                               break;
+                       }
+                       /* TODO */
+               }
+
+               if (txmix2g_tune_boost_pu)
+                       b43_radio_write(dev, R2057_TXMIX2G_TUNE_BOOST_PU_CORE0,
+                                       txmix2g_tune_boost_pu);
+               if (pad2g_tune_pus)
+                       b43_radio_write(dev, R2057_PAD2G_TUNE_PUS_CORE0,
+                                       pad2g_tune_pus);
+               if (txmix2g_tune_boost_pu)
+                       b43_radio_write(dev, R2057_TXMIX2G_TUNE_BOOST_PU_CORE1,
+                                       txmix2g_tune_boost_pu);
+               if (pad2g_tune_pus)
+                       b43_radio_write(dev, R2057_PAD2G_TUNE_PUS_CORE1,
+                                       pad2g_tune_pus);
+       }
 
        usleep_range(50, 100);
 
index df3574545819d7f34249f59206ef0d3b1f40a473..941cf3db5a640b4cc8b662074baacce5450f474e 100644 (file)
@@ -105,6 +105,18 @@ static u16 r2057_rev8_init[][2] = {
 };
 */
 
+/* Extracted from MMIO dump of 6.30.223.141 */
+static u16 r2057_rev9_init[][2] = {
+       { 0x27, 0x1f }, { 0x28, 0x0a }, { 0x29, 0x2f }, { 0x42, 0x1f },
+       { 0x48, 0x3f }, { 0x5c, 0x41 }, { 0x63, 0x14 }, { 0x64, 0x12 },
+       { 0x66, 0xff }, { 0x74, 0xa3 }, { 0x7b, 0x14 }, { 0x7c, 0x14 },
+       { 0x7d, 0xee }, { 0x86, 0xc0 }, { 0xc4, 0x10 }, { 0xc9, 0x01 },
+       { 0xe1, 0x41 }, { 0xe8, 0x14 }, { 0xe9, 0x12 }, { 0xeb, 0xff },
+       { 0xf5, 0x0a }, { 0xf8, 0x09 }, { 0xf9, 0xa3 }, { 0x100, 0x14 },
+       { 0x101, 0x10 }, { 0x102, 0xee }, { 0x10b, 0xc0 }, { 0x149, 0x10 },
+       { 0x14e, 0x01 }, { 0x1b7, 0x05 }, { 0x1c2, 0xa0 },
+};
+
 #define RADIOREGS7(r00, r01, r02, r03, r04, r05, r06, r07, r08, r09, \
                   r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, \
                   r20, r21, r22, r23, r24, r25, r26, r27) \
@@ -145,6 +157,170 @@ static u16 r2057_rev8_init[][2] = {
        .phy_regs.phy_bw5       = r4,   \
        .phy_regs.phy_bw6       = r5
 
+/* Extracted from MMIO dump of 6.30.223.141 */
+static const struct b43_nphy_chantabent_rev7 b43_nphy_chantab_phy_rev16_radio_rev9[] = {
+       {
+               .freq                   = 2412,
+               RADIOREGS7(0x48, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x6c,
+                          0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03c9, 0x03c5, 0x03c1, 0x043a, 0x043f, 0x0443),
+       },
+       {
+               .freq                   = 2417,
+               RADIOREGS7(0x4b, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x71,
+                          0x09, 0x0f, 0x0a, 0x00, 0x0a, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03cb, 0x03c7, 0x03c3, 0x0438, 0x043d, 0x0441),
+       },
+       {
+               .freq                   = 2422,
+               RADIOREGS7(0x4e, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x76,
+                          0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03cd, 0x03c9, 0x03c5, 0x0436, 0x043a, 0x043f),
+       },
+       {
+               .freq                   = 2427,
+               RADIOREGS7(0x52, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x7b,
+                          0x09, 0x0f, 0x09, 0x00, 0x09, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03cf, 0x03cb, 0x03c7, 0x0434, 0x0438, 0x043d),
+       },
+       {
+               .freq                   = 2432,
+               RADIOREGS7(0x55, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x80,
+                          0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03d1, 0x03cd, 0x03c9, 0x0431, 0x0436, 0x043a),
+       },
+       {
+               .freq                   = 2437,
+               RADIOREGS7(0x58, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x85,
+                          0x09, 0x0f, 0x08, 0x00, 0x08, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03d3, 0x03cf, 0x03cb, 0x042f, 0x0434, 0x0438),
+       },
+       {
+               .freq                   = 2442,
+               RADIOREGS7(0x5c, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8a,
+                          0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03d5, 0x03d1, 0x03cd, 0x042d, 0x0431, 0x0436),
+       },
+       {
+               .freq                   = 2447,
+               RADIOREGS7(0x5f, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x8f,
+                          0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03d7, 0x03d3, 0x03cf, 0x042b, 0x042f, 0x0434),
+       },
+       {
+               .freq                   = 2452,
+               RADIOREGS7(0x62, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x94,
+                          0x09, 0x0f, 0x07, 0x00, 0x07, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03d9, 0x03d5, 0x03d1, 0x0429, 0x042d, 0x0431),
+       },
+       {
+               .freq                   = 2457,
+               RADIOREGS7(0x66, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x99,
+                          0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03db, 0x03d7, 0x03d3, 0x0427, 0x042b, 0x042f),
+       },
+       {
+               .freq                   = 2462,
+               RADIOREGS7(0x69, 0x16, 0x30, 0x1b, 0x0a, 0x0a, 0x30, 0x9e,
+                          0x09, 0x0f, 0x06, 0x00, 0x06, 0x00, 0x41, 0x63,
+                          0x00, 0x00, 0x00, 0xf0, 0x00, 0x41, 0x63, 0x00,
+                          0x00, 0x00, 0xf0, 0x00),
+               PHYREGS(0x03dd, 0x03d9, 0x03d5, 0x0424, 0x0429, 0x042d),
+       },
+       {
+               .freq                   = 5180,
+               RADIOREGS7(0xbe, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x06,
+                          0x02, 0x0e, 0x00, 0x0e, 0x00, 0x9e, 0x00, 0x00,
+                          0x9f, 0x2f, 0xa3, 0x00, 0xfc, 0x00, 0x00, 0x4f,
+                          0x3a, 0x83, 0x00, 0xfc),
+               PHYREGS(0x081c, 0x0818, 0x0814, 0x01f9, 0x01fa, 0x01fb),
+       },
+       {
+               .freq                   = 5200,
+               RADIOREGS7(0xc5, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x08,
+                          0x02, 0x0e, 0x00, 0x0e, 0x00, 0x9e, 0x00, 0x00,
+                          0x7f, 0x2f, 0x83, 0x00, 0xf8, 0x00, 0x00, 0x4c,
+                          0x4a, 0x83, 0x00, 0xf8),
+               PHYREGS(0x0824, 0x0820, 0x081c, 0x01f7, 0x01f8, 0x01f9),
+       },
+       {
+               .freq                   = 5220,
+               RADIOREGS7(0xcc, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0a,
+                          0x02, 0x0e, 0x00, 0x0e, 0x00, 0x9e, 0x00, 0x00,
+                          0x6d, 0x3d, 0x83, 0x00, 0xf8, 0x00, 0x00, 0x2d,
+                          0x2a, 0x73, 0x00, 0xf8),
+               PHYREGS(0x082c, 0x0828, 0x0824, 0x01f5, 0x01f6, 0x01f7),
+       },
+       {
+               .freq                   = 5240,
+               RADIOREGS7(0xd2, 0x16, 0x10, 0x1f, 0x08, 0x08, 0x3f, 0x0c,
+                          0x02, 0x0d, 0x00, 0x0d, 0x00, 0x8d, 0x00, 0x00,
+                          0x4d, 0x1c, 0x73, 0x00, 0xf8, 0x00, 0x00, 0x4d,
+                          0x2b, 0x73, 0x00, 0xf8),
+               PHYREGS(0x0834, 0x0830, 0x082c, 0x01f3, 0x01f4, 0x01f5),
+       },
+       {
+               .freq                   = 5745,
+               RADIOREGS7(0x7b, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x7d,
+                          0x04, 0x08, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00,
+                          0x08, 0x03, 0x03, 0x00, 0x30, 0x00, 0x00, 0x06,
+                          0x02, 0x03, 0x00, 0x30),
+               PHYREGS(0x08fe, 0x08fa, 0x08f6, 0x01c8, 0x01c8, 0x01c9),
+       },
+       {
+               .freq                   = 5765,
+               RADIOREGS7(0x81, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x81,
+                          0x04, 0x08, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00,
+                          0x06, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05,
+                          0x02, 0x03, 0x00, 0x00),
+               PHYREGS(0x0906, 0x0902, 0x08fe, 0x01c6, 0x01c7, 0x01c8),
+       },
+       {
+               .freq                   = 5785,
+               RADIOREGS7(0x88, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x85,
+                          0x04, 0x08, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00,
+                          0x08, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x05,
+                          0x21, 0x03, 0x00, 0x00),
+               PHYREGS(0x090e, 0x090a, 0x0906, 0x01c4, 0x01c5, 0x01c6),
+       },
+       {
+               .freq                   = 5805,
+               RADIOREGS7(0x8f, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x89,
+                          0x04, 0x07, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00,
+                          0x06, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03,
+                          0x00, 0x03, 0x00, 0x00),
+               PHYREGS(0x0916, 0x0912, 0x090e, 0x01c3, 0x01c4, 0x01c4),
+       },
+       {
+               .freq                   = 5825,
+               RADIOREGS7(0x95, 0x17, 0x20, 0x1f, 0x08, 0x08, 0x3f, 0x8d,
+                          0x04, 0x07, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00,
+                          0x05, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x03,
+                          0x00, 0x03, 0x00, 0x00),
+               PHYREGS(0x091e, 0x091a, 0x0916, 0x01c1, 0x01c2, 0x01c3),
+       },
+};
+
 void r2057_upload_inittabs(struct b43_wldev *dev)
 {
        struct b43_phy *phy = &dev->phy;
@@ -171,6 +347,12 @@ void r2057_upload_inittabs(struct b43_wldev *dev)
                        size = ARRAY_SIZE(r2057_rev5a_init);
                }
                break;
+       case 16:
+               if (phy->radio_rev == 9) {
+                       table = r2057_rev9_init[0];
+                       size = ARRAY_SIZE(r2057_rev9_init);
+               }
+               break;
        }
 
        B43_WARN_ON(!table);
@@ -195,6 +377,12 @@ void r2057_get_chantabent_rev7(struct b43_wldev *dev, u16 freq,
 
        /* TODO */
        switch (phy->rev) {
+       case 16:
+               if (phy->radio_rev == 9) {
+                       e_r7 = b43_nphy_chantab_phy_rev16_radio_rev9;
+                       len = ARRAY_SIZE(b43_nphy_chantab_phy_rev16_radio_rev9);
+               }
+               break;
        default:
                break;
        }