From owner-svn-src-head@FreeBSD.ORG Thu Apr 16 07:40:02 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9726FDEB; Thu, 16 Apr 2015 07:40:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 83233CAA; Thu, 16 Apr 2015 07:40:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3G7e27g095159; Thu, 16 Apr 2015 07:40:02 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3G7e2s7095158; Thu, 16 Apr 2015 07:40:02 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201504160740.t3G7e2s7095158@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Thu, 16 Apr 2015 07:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281592 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2015 07:40:02 -0000 Author: kevlo Date: Thu Apr 16 07:40:01 2015 New Revision: 281592 URL: https://svnweb.freebsd.org/changeset/base/281592 Log: Enable LDO to 2.5V before efuse r/w action in order to prevent incorrect mac address read from efuse. Reported by: swills Tested by: rpaulo and myself on RPi Modified: head/sys/dev/usb/wlan/if_urtwn.c Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Thu Apr 16 07:17:00 2015 (r281591) +++ head/sys/dev/usb/wlan/if_urtwn.c Thu Apr 16 07:40:01 2015 (r281592) @@ -1195,7 +1195,7 @@ urtwn_efuse_read(struct urtwn_softc *sc) uint8_t *rom = (uint8_t *)&sc->rom; uint16_t addr = 0; uint32_t reg; - uint8_t off, msk; + uint8_t off, msk, vol; int i; urtwn_efuse_switch_power(sc); @@ -1228,10 +1228,15 @@ urtwn_efuse_read(struct urtwn_softc *sc) printf("\n"); } #endif + /* Disable LDO 2.5V. */ + vol = urtwn_read_1(sc, R92C_EFUSE_TEST + 3); + urtwn_write_1(sc, R92C_EFUSE_TEST + 3, vol & ~(0x80)); + } static void urtwn_efuse_switch_power(struct urtwn_softc *sc) { + uint8_t vol; uint32_t reg; reg = urtwn_read_2(sc, R92C_SYS_ISO_CTRL); @@ -1250,6 +1255,12 @@ urtwn_efuse_switch_power(struct urtwn_so urtwn_write_2(sc, R92C_SYS_CLKR, reg | R92C_SYS_CLKR_LOADER_EN | R92C_SYS_CLKR_ANA8M); } + + /* Enable LDO 2.5V. */ + vol = urtwn_read_1(sc, R92C_EFUSE_TEST + 3); + vol &= 0x0f; + vol |= 0x30; + urtwn_write_1(sc, R92C_EFUSE_TEST + 3, (vol | 0x80)); } static int