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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to