Hi tech@

Here is a patch to update bwi_mac_dummy_xmit. This diff remove the
differencies with the linux b43_dummy_transmission function.

It works fine with my Broadcom BCM4306 (ID 4320) and it would be awesome if
someone could try it on another chip (or if someone could lend me some
bwi chips).

Comments/OK/NOK ?

Cheers,

Index: bwi.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/bwi.c,v
retrieving revision 1.97
diff -u -p -u -p -r1.97 bwi.c
--- bwi.c       31 Dec 2012 10:07:51 -0000      1.97
+++ bwi.c       9 Sep 2013 16:26:19 -0000
@@ -148,7 +148,7 @@ void                 bwi_mac_set_tpctl_11bg(struct bwi
                     const struct bwi_tpctl *);
 int             bwi_mac_test(struct bwi_mac *);
 void            bwi_mac_setup_tpctl(struct bwi_mac *);
-void            bwi_mac_dummy_xmit(struct bwi_mac *);
+void            bwi_mac_dummy_xmit(struct bwi_mac *, int);
 void            bwi_mac_init_tpctl_11bg(struct bwi_mac *);
 void            bwi_mac_detach(struct bwi_mac *);
 int             bwi_get_firmware(const char *, const uint8_t *, size_t,
@@ -1495,7 +1495,7 @@ back:
 }
 
 void
-bwi_mac_dummy_xmit(struct bwi_mac *mac)
+bwi_mac_dummy_xmit(struct bwi_mac *mac, int ofdm)
 {
 #define PACKET_LEN     5
        struct bwi_softc *sc = mac->mac_sc;
@@ -1509,23 +1509,24 @@ bwi_mac_dummy_xmit(struct bwi_mac *mac)
        static const uint32_t   packet_11bg[PACKET_LEN] =
            { 0x000b846e, 0x00d40000, 0x00000000, 0x01000000, 0x00000000 };
 
-       if (mac->mac_phy.phy_mode == IEEE80211_MODE_11A) {
+       if (ofdm) {
                wait_max = 30;
                packet = packet_11a;
-               val_50c = 1;
+               val_50c = 0x41;
        } else {
                wait_max = 250;
                packet = packet_11bg;
-               val_50c = 0;
+               val_50c = 0x40;
        }
 
        for (i = 0; i < PACKET_LEN; ++i)
                TMPLT_WRITE_4(mac, i * 4, packet[i]);
 
-       CSR_READ_4(sc, BWI_MAC_STATUS); /* dummy read */
-
        CSR_WRITE_2(sc, 0x568, 0);
-       CSR_WRITE_2(sc, 0x7c0, 0);
+       if (mac->mac_rev < 11)
+               CSR_WRITE_2(sc, 0x7c0, 0);
+       else
+               CSR_WRITE_2(sc, 0x7c0, 0x100);
        CSR_WRITE_2(sc, 0x50c, val_50c);
        CSR_WRITE_2(sc, 0x508, 0);
        CSR_WRITE_2(sc, 0x50a, 0);
@@ -1534,6 +1535,7 @@ bwi_mac_dummy_xmit(struct bwi_mac *mac)
        CSR_WRITE_2(sc, 0x568, 0x826);
        CSR_WRITE_2(sc, 0x500, 0);
        CSR_WRITE_2(sc, 0x502, 0x30);
+       CSR_READ_2(sc, 0x502);  /* dummy read */
 
        if (rf->rf_type == BWI_RF_T_BCM2050 && rf->rf_rev <= 5)
                RF_WRITE(mac, 0x51, 0x17);
@@ -1548,7 +1550,7 @@ bwi_mac_dummy_xmit(struct bwi_mac *mac)
                        break;
                DELAY(10);
        }
-       for (i = 0; i < 10; ++i) {
+       for (i = 0; i < 0x19; ++i) {
                if ((CSR_READ_2(sc, 0x690) & 0x100) == 0)
                        break;
                DELAY(10);
@@ -1607,7 +1609,7 @@ bwi_mac_init_tpctl_11bg(struct bwi_mac *
                bwi_mac_set_tpctl_11bg(mac, &tpctl);
        }
 
-       bwi_mac_dummy_xmit(mac);
+       bwi_mac_dummy_xmit(mac, 0);
 
        mac->mac_flags |= BWI_MAC_F_TPCTL_INITED;
        rf->rf_base_tssi = PHY_READ(mac, 0x29);
@@ -3687,7 +3689,7 @@ bwi_set_gains(struct bwi_mac *mac, const
                PHY_FILT_SETBITS(mac, 0x4a1, 0xbfbf, phy_gain1);
                PHY_FILT_SETBITS(mac, 0x4a2, 0xbfbf, phy_gain2);
        }
-       bwi_mac_dummy_xmit(mac);
+       bwi_mac_dummy_xmit(mac, 0);
 }
 
 void
@@ -4833,7 +4835,7 @@ bwi_rf_lo_update_11g(struct bwi_mac *mac
        if (phy->phy_flags & BWI_PHY_F_LINKED) {
                PHY_WRITE(mac, 0x429, regs.phy_429 & 0x7fff);
                PHY_WRITE(mac, 0x802, regs.phy_802 & 0xfffc);
-               bwi_mac_dummy_xmit(mac);
+               bwi_mac_dummy_xmit(mac, 0);
        }
        RF_WRITE(mac, 0x43, 0x6);
 

Reply via email to