From owner-svn-src-all@freebsd.org Mon May 16 20:26:31 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 99B51B3D94E; Mon, 16 May 2016 20:26:31 +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 5CA761CCE; Mon, 16 May 2016 20:26:31 +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 u4GKQUao026250; Mon, 16 May 2016 20:26:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4GKQU7E026249; Mon, 16 May 2016 20:26:30 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201605162026.u4GKQU7E026249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 16 May 2016 20:26:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299976 - 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: Mon, 16 May 2016 20:26:31 -0000 Author: adrian Date: Mon May 16 20:26:30 2016 New Revision: 299976 URL: https://svnweb.freebsd.org/changeset/base/299976 Log: [bwn] check DUALPHY; add BCM4322 to the don't-override list. * DUALPHY in TGSHIGH tells us there's a phy that is dualband, rather than two separate PHYs/MACs (which we almost but don't quite yet support.) Use it. * Add the BCM4322 PCI ID to the list of devices we don't override. This means the 2g/5g flags are preserved, and thus we get 5GHz operation (with N-PHY, of course.) Tested: * BCM4311, STA mode (11bg) * BCM4312, STA mode (11bg) * BCM4321, STA mode (11abg) Sponsored by: Palm Springs Modified: head/sys/dev/bwn/if_bwn.c Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Mon May 16 20:22:52 2016 (r299975) +++ head/sys/dev/bwn/if_bwn.c Mon May 16 20:26:30 2016 (r299976) @@ -1147,15 +1147,32 @@ bwn_attach_core(struct bwn_mac *mac) siba_powerup(sc->sc_dev, 0); high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH); + + /* + * Guess at whether it has A-PHY or G-PHY. + * This is just used for resetting the core to probe things; + * we will re-guess once it's all up and working. + * + * XXX TODO: there's the TGSHIGH DUALPHY flag based on + * the PHY revision. + */ bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ)); + + /* + * Get the PHY version. + */ error = bwn_phy_getinfo(mac, high); if (error) goto fail; - /* XXX need bhnd */ + /* XXX TODO need bhnd */ if (bwn_is_bus_siba(mac)) { have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0; have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0; + if (high & BWN_TGSHIGH_DUALPHY) { + have_bg = 1; + have_a = 1; + } } else { device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__); error = ENXIO; @@ -1175,7 +1192,8 @@ bwn_attach_core(struct bwn_mac *mac) if (siba_get_pci_device(sc->sc_dev) != 0x4312 && siba_get_pci_device(sc->sc_dev) != 0x4319 && - siba_get_pci_device(sc->sc_dev) != 0x4324) { + siba_get_pci_device(sc->sc_dev) != 0x4324 && + siba_get_pci_device(sc->sc_dev) != 0x4328) { have_a = have_bg = 0; if (mac->mac_phy.type == BWN_PHYTYPE_A) have_a = 1; @@ -1187,9 +1205,17 @@ bwn_attach_core(struct bwn_mac *mac) KASSERT(0 == 1, ("%s: unknown phy type (%d)", __func__, mac->mac_phy.type)); } - /* XXX turns off PHY A because it's not supported */ + + /* + * XXX turns off PHY A because it's not supported. + * Implement PHY-A support so we can use it for PHY-G + * dual-band support. + */ if (mac->mac_phy.type != BWN_PHYTYPE_LP && mac->mac_phy.type != BWN_PHYTYPE_N) { + device_printf(sc->sc_dev, + "%s: forcing 2GHz only; missing PHY-A support\n", + __func__); have_a = 0; have_bg = 1; }