From owner-svn-src-all@freebsd.org Tue May 3 03:24:29 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FA1CB2BB03; Tue, 3 May 2016 03:24:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03C6C1DEC; Tue, 3 May 2016 03:24:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u433OSig060810; Tue, 3 May 2016 03:24:28 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u433OSMW060807; Tue, 3 May 2016 03:24:28 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605030324.u433OSMW060807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 3 May 2016 03:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298952 - head/sys/dev/bwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2016 03:24:29 -0000 Author: adrian Date: Tue May 3 03:24:27 2016 New Revision: 298952 URL: https://svnweb.freebsd.org/changeset/base/298952 Log: [bwn] migrate bwn_dummy_transmission() back to main, as it'll be used by other PHYs. The Linux b43 driver uses this in other PHYs besides the g PHY. Modified: head/sys/dev/bwn/if_bwn.c head/sys/dev/bwn/if_bwn_misc.h head/sys/dev/bwn/if_bwn_phy_g.c Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Tue May 3 01:17:40 2016 (r298951) +++ head/sys/dev/bwn/if_bwn.c Tue May 3 03:24:27 2016 (r298952) @@ -3514,6 +3514,72 @@ bwn_dma_ring_addr(void *arg, bus_dma_seg } void +bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon) +{ + struct bwn_phy *phy = &mac->mac_phy; + struct bwn_softc *sc = mac->mac_sc; + unsigned int i, max_loop; + uint16_t value; + uint32_t buffer[5] = { + 0x00000000, 0x00d40000, 0x00000000, 0x01000000, 0x00000000 + }; + + if (ofdm) { + max_loop = 0x1e; + buffer[0] = 0x000201cc; + } else { + max_loop = 0xfa; + buffer[0] = 0x000b846e; + } + + BWN_ASSERT_LOCKED(mac->mac_sc); + + for (i = 0; i < 5; i++) + bwn_ram_write(mac, i * 4, buffer[i]); + + BWN_WRITE_2(mac, 0x0568, 0x0000); + BWN_WRITE_2(mac, 0x07c0, + (siba_get_revid(sc->sc_dev) < 11) ? 0x0000 : 0x0100); + value = ((phy->type == BWN_PHYTYPE_A) ? 0x41 : 0x40); + BWN_WRITE_2(mac, 0x050c, value); + if (phy->type == BWN_PHYTYPE_LP) + BWN_WRITE_2(mac, 0x0514, 0x1a02); + BWN_WRITE_2(mac, 0x0508, 0x0000); + BWN_WRITE_2(mac, 0x050a, 0x0000); + BWN_WRITE_2(mac, 0x054c, 0x0000); + BWN_WRITE_2(mac, 0x056a, 0x0014); + BWN_WRITE_2(mac, 0x0568, 0x0826); + BWN_WRITE_2(mac, 0x0500, 0x0000); + if (phy->type == BWN_PHYTYPE_LP) + BWN_WRITE_2(mac, 0x0502, 0x0050); + else + BWN_WRITE_2(mac, 0x0502, 0x0030); + + if (phy->rf_ver == 0x2050 && phy->rf_rev <= 0x5) + BWN_RF_WRITE(mac, 0x0051, 0x0017); + for (i = 0x00; i < max_loop; i++) { + value = BWN_READ_2(mac, 0x050e); + if (value & 0x0080) + break; + DELAY(10); + } + for (i = 0x00; i < 0x0a; i++) { + value = BWN_READ_2(mac, 0x050e); + if (value & 0x0400) + break; + DELAY(10); + } + for (i = 0x00; i < 0x19; i++) { + value = BWN_READ_2(mac, 0x0690); + if (!(value & 0x0100)) + break; + DELAY(10); + } + if (phy->rf_ver == 0x2050 && phy->rf_rev <= 0x5) + BWN_RF_WRITE(mac, 0x0051, 0x0037); +} + +void bwn_ram_write(struct bwn_mac *mac, uint16_t offset, uint32_t val) { uint32_t macctl; Modified: head/sys/dev/bwn/if_bwn_misc.h ============================================================================== --- head/sys/dev/bwn/if_bwn_misc.h Tue May 3 01:17:40 2016 (r298951) +++ head/sys/dev/bwn/if_bwn_misc.h Tue May 3 03:24:27 2016 (r298952) @@ -43,6 +43,8 @@ struct bwn_mac; extern uint64_t bwn_hf_read(struct bwn_mac *); extern void bwn_hf_write(struct bwn_mac *, uint64_t); +extern void bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon); + extern void bwn_ram_write(struct bwn_mac *, uint16_t, uint32_t); extern void bwn_mac_suspend(struct bwn_mac *); Modified: head/sys/dev/bwn/if_bwn_phy_g.c ============================================================================== --- head/sys/dev/bwn/if_bwn_phy_g.c Tue May 3 01:17:40 2016 (r298951) +++ head/sys/dev/bwn/if_bwn_phy_g.c Tue May 3 03:24:27 2016 (r298952) @@ -103,7 +103,6 @@ static void bwn_spu_workaround(struct bw static void bwn_wa_init(struct bwn_mac *); static void bwn_ofdmtab_write_2(struct bwn_mac *, uint16_t, uint16_t, uint16_t); -static void bwn_dummy_transmission(struct bwn_mac *, int, int); static void bwn_ofdmtab_write_4(struct bwn_mac *, uint16_t, uint16_t, uint32_t); static void bwn_gtab_write(struct bwn_mac *, uint16_t, uint16_t, @@ -1893,72 +1892,6 @@ bwn_gtab_write(struct bwn_mac *mac, uint } static void -bwn_dummy_transmission(struct bwn_mac *mac, int ofdm, int paon) -{ - struct bwn_phy *phy = &mac->mac_phy; - struct bwn_softc *sc = mac->mac_sc; - unsigned int i, max_loop; - uint16_t value; - uint32_t buffer[5] = { - 0x00000000, 0x00d40000, 0x00000000, 0x01000000, 0x00000000 - }; - - if (ofdm) { - max_loop = 0x1e; - buffer[0] = 0x000201cc; - } else { - max_loop = 0xfa; - buffer[0] = 0x000b846e; - } - - BWN_ASSERT_LOCKED(mac->mac_sc); - - for (i = 0; i < 5; i++) - bwn_ram_write(mac, i * 4, buffer[i]); - - BWN_WRITE_2(mac, 0x0568, 0x0000); - BWN_WRITE_2(mac, 0x07c0, - (siba_get_revid(sc->sc_dev) < 11) ? 0x0000 : 0x0100); - value = ((phy->type == BWN_PHYTYPE_A) ? 0x41 : 0x40); - BWN_WRITE_2(mac, 0x050c, value); - if (phy->type == BWN_PHYTYPE_LP) - BWN_WRITE_2(mac, 0x0514, 0x1a02); - BWN_WRITE_2(mac, 0x0508, 0x0000); - BWN_WRITE_2(mac, 0x050a, 0x0000); - BWN_WRITE_2(mac, 0x054c, 0x0000); - BWN_WRITE_2(mac, 0x056a, 0x0014); - BWN_WRITE_2(mac, 0x0568, 0x0826); - BWN_WRITE_2(mac, 0x0500, 0x0000); - if (phy->type == BWN_PHYTYPE_LP) - BWN_WRITE_2(mac, 0x0502, 0x0050); - else - BWN_WRITE_2(mac, 0x0502, 0x0030); - - if (phy->rf_ver == 0x2050 && phy->rf_rev <= 0x5) - BWN_RF_WRITE(mac, 0x0051, 0x0017); - for (i = 0x00; i < max_loop; i++) { - value = BWN_READ_2(mac, 0x050e); - if (value & 0x0080) - break; - DELAY(10); - } - for (i = 0x00; i < 0x0a; i++) { - value = BWN_READ_2(mac, 0x050e); - if (value & 0x0400) - break; - DELAY(10); - } - for (i = 0x00; i < 0x19; i++) { - value = BWN_READ_2(mac, 0x0690); - if (!(value & 0x0100)) - break; - DELAY(10); - } - if (phy->rf_ver == 0x2050 && phy->rf_rev <= 0x5) - BWN_RF_WRITE(mac, 0x0051, 0x0037); -} - -static void bwn_lo_write(struct bwn_mac *mac, struct bwn_loctl *ctl) { uint16_t value;