b43: HT-PHY: correct 0x2059 radio init
authorRafał Miłecki <zajec5@gmail.com>
Tue, 28 Jun 2011 22:56:49 +0000 (00:56 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 29 Jun 2011 19:11:06 +0000 (15:11 -0400)
Sometimes additional steps are performed while initializing 2059 radio.
We did not find the condition yet, so make it always true for now.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/phy_ht.c

index 69412d1fb65577ef914706a4fdd840393f2b5548..30b19c61037d65fe7432865ba7a3db28c724a369 100644 (file)
@@ -86,7 +86,10 @@ static void b43_radio_2059_channel_setup(struct b43_wldev *dev,
 static void b43_radio_2059_init(struct b43_wldev *dev)
 {
        const u16 routing[] = { R2059_SYN, R2059_TXRX0, R2059_RXRX1 };
-       u8 i;
+       const u16 radio_values[3][2] = {
+               { 0x61, 0xE9 }, { 0x69, 0xD5 }, { 0x73, 0x99 },
+       };
+       u16 i, j;
 
        b43_radio_write(dev, R2059_ALL | 0x51, 0x0070);
        b43_radio_write(dev, R2059_ALL | 0x5a, 0x0003);
@@ -100,6 +103,51 @@ static void b43_radio_2059_init(struct b43_wldev *dev)
        b43_radio_mask(dev, 0x2e, ~0x0078);
        b43_radio_mask(dev, 0xc0, ~0x0080);
 
+       if (1) { /* FIXME */
+               b43_radio_set(dev, R2059_RXRX1 | 0x4, 0x1);
+               udelay(10);
+               b43_radio_set(dev, R2059_RXRX1 | 0x0BF, 0x1);
+               b43_radio_maskset(dev, R2059_RXRX1 | 0x19B, 0x3, 0x2);
+
+               b43_radio_set(dev, R2059_RXRX1 | 0x4, 0x2);
+               udelay(100);
+               b43_radio_mask(dev, R2059_RXRX1 | 0x4, ~0x2);
+
+               for (i = 0; i < 10000; i++) {
+                       if (b43_radio_read(dev, R2059_RXRX1 | 0x145) & 1) {
+                               i = 0;
+                               break;
+                       }
+                       udelay(100);
+               }
+               if (i)
+                       b43err(dev->wl, "radio 0x945 timeout\n");
+
+               b43_radio_mask(dev, R2059_RXRX1 | 0x4, ~0x1);
+               b43_radio_set(dev, 0xa, 0x60);
+
+               for (i = 0; i < 3; i++) {
+                       b43_radio_write(dev, 0x17F, radio_values[i][0]);
+                       b43_radio_write(dev, 0x13D, 0x6E);
+                       b43_radio_write(dev, 0x13E, radio_values[i][1]);
+                       b43_radio_write(dev, 0x13C, 0x55);
+
+                       for (j = 0; j < 10000; j++) {
+                               if (b43_radio_read(dev, 0x140) & 2) {
+                                       j = 0;
+                                       break;
+                               }
+                               udelay(500);
+                       }
+                       if (j)
+                               b43err(dev->wl, "radio 0x140 timeout\n");
+
+                       b43_radio_write(dev, 0x13C, 0x15);
+               }
+
+               b43_radio_mask(dev, 0x17F, ~0x1);
+       }
+
        b43_radio_mask(dev, 0x11, 0x0008);
 }