[Zrouter-src-freebsd] [rt2860-in-ral] push by r... at ddteam.net - Fix EEPROM address for PCI devices. on 2012-03-21 15:51 GMT

rt2860-in-ral at googlecode.com rt2860-in-ral at googlecode.com
Wed Mar 21 15:51:51 UTC 2012


Revision: 0631186b5e3f
Author:   Aleksandr Rybalko <ray at ddteam.net>
Date:     Wed Mar 21 08:51:39 2012
Log:      Fix EEPROM address for PCI devices.
http://code.google.com/p/rt2860-in-ral/source/detail?r=0631186b5e3f

Modified:
  /sys/dev/ral/rt2860.c

=======================================
--- /sys/dev/ral/rt2860.c	Wed Mar 21 07:50:36 2012
+++ /sys/dev/ral/rt2860.c	Wed Mar 21 08:51:39 2012
@@ -7011,22 +7011,25 @@

  /*
   * rt2860_io_eeprom_read
+ * addr is 16bit word address
   */
  uint16_t rt2860_io_eeprom_read(struct rt2860_softc *sc, uint16_t addr)
  {
  	uint32_t tmp;
-	uint16_t addr2, val;
+	uint16_t byteaddr, val;
  	int n;

-	addr2 = (addr >> 1);
+	byteaddr = (addr << 1);

  	if (sc->mac_rev == 0x28720200) {
  		/* SoC embedded version, don't have EEPROM */
+		/* index of 16bit words array */
  		return (rt3052_eeprom[addr]);
  	} else if ((sc->mac_rev & 0xffff0000) >= 0x30710000) {
  		tmp = RAL_READ(sc, RT3070_EFUSE_CTRL);
  		if (tmp & RT3070_SEL_EFUSE)
-			return (rt3090_efuse_read_2(sc, addr2));
+			/* XXX: "byteaddr" here, should be checked */
+			return (rt3090_efuse_read_2(sc, byteaddr));
  	}

  	/* clock C once before the first command */
@@ -7050,9 +7053,9 @@
  	n = ((RAL_READ(sc, RT2860_PCI_EECTRL) & 0x30) == 0) ? 5 : 7;
  	for (; n >= 0; n--) {
  		RT2860_EEPROM_CTL(sc, RT2860_S |
-		    (((addr2 >> n) & 1) << RT2860_SHIFT_D));
+		    (((byteaddr >> n) & 1) << RT2860_SHIFT_D));
  		RT2860_EEPROM_CTL(sc, RT2860_S |
-		    (((addr2 >> n) & 1) << RT2860_SHIFT_D) | RT2860_C);
+		    (((byteaddr >> n) & 1) << RT2860_SHIFT_D) | RT2860_C);
  	}

  	RT2860_EEPROM_CTL(sc, RT2860_S);


More information about the Zrouter-src-freebsd mailing list