[Zrouter-src-freebsd] [rt2860-in-ral] 3 new revisions pushed by r... at ddteam.net on 2012-03-21 14:50 GMT
rt2860-in-ral at googlecode.com
rt2860-in-ral at googlecode.com
Wed Mar 21 14:51:40 UTC 2012
3 new revisions:
Revision: 65015722dcd6
Author: Aleksandr Rybalko <ray at ddteam.net>
Date: Wed Mar 21 07:49:23 2012
Log: Remove old style EEPROM addresses (byte offset)
http://code.google.com/p/rt2860-in-ral/source/detail?r=65015722dcd6
Revision: 819454b26a9e
Author: Aleksandr Rybalko <ray at ddteam.net>
Date: Wed Mar 21 07:49:56 2012
Log: Add Radar detection interrupt bit.
http://code.google.com/p/rt2860-in-ral/source/detail?r=819454b26a9e
Revision: cbdb0a181ac5
Author: Aleksandr Rybalko <ray at ddteam.net>
Date: Wed Mar 21 07:50:36 2012
Log: EEPROM handling rework.
http://code.google.com/p/rt2860-in-ral/source/detail?r=cbdb0a181ac5
==============================================================================
Revision: 65015722dcd6
Author: Aleksandr Rybalko <ray at ddteam.net>
Date: Wed Mar 21 07:49:23 2012
Log: Remove old style EEPROM addresses (byte offset)
http://code.google.com/p/rt2860-in-ral/source/detail?r=65015722dcd6
Modified:
/sys/dev/ral/rt2860var.h
=======================================
--- /sys/dev/ral/rt2860var.h Wed Mar 14 04:43:04 2012
+++ /sys/dev/ral/rt2860var.h Wed Mar 21 07:49:23 2012
@@ -425,29 +425,6 @@
#endif
};
-#define RT2860_EEPROM_ADDRESS01 0x0004
-#define RT2860_EEPROM_ADDRESS23 0x0006
-#define RT2860_EEPROM_ADDRESS45 0x0008
-#define RT2860_EEPROM_POWERSAVE_LEVEL 0x0022
-#define RT2860_EEPROM_NIC_CONFIG 0x0036
-#define RT2860_EEPROM_RF_FREQ_OFF 0x003a
-#define RT2860_EEPROM_LED1_OFF 0x003c
-#define RT2860_EEPROM_LED2_OFF 0x003e
-#define RT2860_EEPROM_LED3_OFF 0x0040
-#define RT2860_EEPROM_LNA_GAIN 0x0044
-#define RT2860_EEPROM_RSSI_OFF_2GHZ_BASE 0x0046
-#define RT2860_EEPROM_RSSI2_OFF_2GHZ_BASE 0x0048
-#define RT2860_EEPROM_RSSI_OFF_5GHZ_BASE 0x004a
-#define RT2860_EEPROM_RSSI2_OFF_5GHZ_BASE 0x004c
-#define RT2860_EEPROM_TXPOW_RATE_DELTA 0x0050
-#define RT2860_EEPROM_TXPOW1_2GHZ_BASE 0x0052
-#define RT2860_EEPROM_TXPOW2_2GHZ_BASE 0x0060
-#define RT2860_EEPROM_TSSI_2GHZ_BASE 0x006e
-#define RT2860_EEPROM_TXPOW1_5GHZ_BASE 0x0078
-#define RT2860_EEPROM_TXPOW2_5GHZ_BASE 0x00a6
-#define RT2860_EEPROM_TSSI_5GHZ_BASE 0x00d4
-#define RT2860_EEPROM_TXPOW_RATE_BASE 0x00de
-
/*
* RT2860_EEPROM_NIC_CONFIG flags
*/
==============================================================================
Revision: 819454b26a9e
Author: Aleksandr Rybalko <ray at ddteam.net>
Date: Wed Mar 21 07:49:56 2012
Log: Add Radar detection interrupt bit.
http://code.google.com/p/rt2860-in-ral/source/detail?r=819454b26a9e
Modified:
/sys/dev/ral/rt2860reg.h
=======================================
--- /sys/dev/ral/rt2860reg.h Wed Mar 21 04:59:39 2012
+++ /sys/dev/ral/rt2860reg.h Wed Mar 21 07:49:56 2012
@@ -220,6 +220,7 @@
* RT2860_REG_SCHDMA_INT_STATUS
* RT2860_REG_SCHDMA_INT_MASK flags
*/
+#define RT2860_REG_INT_RADAR (1 << 20)
#define RT2860_REG_INT_TX_COHERENT (1 << 17)
#define RT2860_REG_INT_RX_COHERENT (1 << 16)
#define RT2860_REG_INT_GP_TIMER (1 << 15)
==============================================================================
Revision: cbdb0a181ac5
Author: Aleksandr Rybalko <ray at ddteam.net>
Date: Wed Mar 21 07:50:36 2012
Log: EEPROM handling rework.
http://code.google.com/p/rt2860-in-ral/source/detail?r=cbdb0a181ac5
Modified:
/sys/dev/ral/rt2860.c
=======================================
--- /sys/dev/ral/rt2860.c Wed Mar 21 05:03:06 2012
+++ /sys/dev/ral/rt2860.c Wed Mar 21 07:50:36 2012
@@ -7015,17 +7015,18 @@
uint16_t rt2860_io_eeprom_read(struct rt2860_softc *sc, uint16_t addr)
{
uint32_t tmp;
- uint16_t val;
+ uint16_t addr2, val;
int n;
- addr = (addr >> 1);
+ addr2 = (addr >> 1);
if (sc->mac_rev == 0x28720200) {
+ /* SoC embedded version, don't have EEPROM */
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, addr));
+ return (rt3090_efuse_read_2(sc, addr2));
}
/* clock C once before the first command */
@@ -7049,11 +7050,21 @@
n = ((RAL_READ(sc, RT2860_PCI_EECTRL) & 0x30) == 0) ? 5 : 7;
for (; n >= 0; n--) {
RT2860_EEPROM_CTL(sc, RT2860_S |
- (((addr >> n) & 1) << RT2860_SHIFT_D));
+ (((addr2 >> n) & 1) << RT2860_SHIFT_D));
RT2860_EEPROM_CTL(sc, RT2860_S |
- (((addr >> n) & 1) << RT2860_SHIFT_D) | RT2860_C);
+ (((addr2 >> n) & 1) << RT2860_SHIFT_D) | RT2860_C);
}
+ RT2860_EEPROM_CTL(sc, RT2860_S);
+
+ /* read data Q15-Q0 */
+ val = 0;
+ for (n = 15; n >= 0; n--) {
+ RT2860_EEPROM_CTL(sc, RT2860_S | RT2860_C);
+ tmp = RAL_READ(sc, RT2860_PCI_EECTRL);
+ val |= ((tmp & RT2860_Q) >> RT2860_SHIFT_Q) << n;
+ RT2860_EEPROM_CTL(sc, RT2860_S);
+ }
RT2860_EEPROM_CTL(sc, 0);
/* clear Chip Select and clock C */
@@ -7493,17 +7504,17 @@
/* read MAC address */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_ADDRESS01);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_MAC01);
sc->mac_addr[0] = (val & 0xff);
sc->mac_addr[1] = (val >> 8);
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_ADDRESS23);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_MAC23);
sc->mac_addr[2] = (val & 0xff);
sc->mac_addr[3] = (val >> 8);
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_ADDRESS45);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_MAC45);
sc->mac_addr[4] = (val & 0xff);
sc->mac_addr[5] = (val >> 8);
@@ -7537,7 +7548,7 @@
"%s: EEPROM RF rev=0x%04x, paths=%dT%dR\n",
device_get_nameunit(sc->sc_dev), sc->rf_rev, sc->ntxpath, sc->nrxpath);
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_NIC_CONFIG);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_CONFIG);
if ((val & 0xff00) != 0xff00)
sc->patch_dac = (val >> 15) & 1;
@@ -7564,7 +7575,7 @@
/* read RF frequency offset */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RF_FREQ_OFF);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_FREQ_LEDS);
if ((val & 0xff) != 0xff) {
sc->rf_freq_off = (val & 0xff);
@@ -7582,11 +7593,11 @@
if (((val >> 8) & 0xff) != 0xff) {
sc->led_cntl = ((val >> 8) & 0xff);
sc->led_off[0] = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_LED1_OFF);
+ RT2860_EEPROM_LED1);
sc->led_off[1] = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_LED2_OFF);
+ RT2860_EEPROM_LED2);
sc->led_off[2] = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_LED3_OFF);
+ RT2860_EEPROM_LED3);
} else {
device_printf(sc->sc_dev, "invalid EEPROM LED settings\n");
@@ -7603,7 +7614,7 @@
/* read RSSI offsets and LNA gains */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_LNA_GAIN);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_LNA);
if ((sc->mac_rev & 0xffff0000) >= 0x30710000)
sc->lna_gain[0] = RT3090_DEF_LNA;
else /* channel group 0 */
@@ -7611,12 +7622,12 @@
sc->lna_gain[1] = (val >> 8) & 0xff;
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI_OFF_2GHZ_BASE);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI1_2GHZ);
sc->rssi_off_2ghz[0] = (val & 0xff);
sc->rssi_off_2ghz[1] = (val >> 8) & 0xff;
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI_OFF_2GHZ_BASE + 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI2_2GHZ);
if ((sc->mac_rev & 0xffff0000) >= 0x30710000) {
/*
@@ -7629,12 +7640,12 @@
sc->rssi_off_2ghz[2] = val & 0xff; /* Ant C */
sc->lna_gain[2] = (val >> 8) & 0xff;
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI_OFF_5GHZ_BASE);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI1_5GHZ);
sc->rssi_off_5ghz[0] = (val & 0xff);
sc->rssi_off_5ghz[1] = (val >> 8) & 0xff;
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI_OFF_5GHZ_BASE + 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_RSSI2_5GHZ);
sc->rssi_off_5ghz[2] = (val & 0xff);
sc->lna_gain[3] = (val >> 8) & 0xff;
@@ -7691,13 +7702,13 @@
for (i = 0; i < 14; i += 2) {
val = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_TXPOW1_2GHZ_BASE + i / 2);
+ RT2860_EEPROM_PWR2GHZ_BASE1 + i / 2);
sc->txpow1[i + 0] = (int8_t) (val & 0xff);
sc->txpow1[i + 1] = (int8_t) (val >> 8);
val = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_TXPOW2_2GHZ_BASE + i / 2);
+ RT2860_EEPROM_PWR2GHZ_BASE1 + i / 2);
sc->txpow2[i + 0] = (int8_t) (val & 0xff);
sc->txpow2[i + 1] = (int8_t) (val >> 8);
@@ -7708,13 +7719,13 @@
for (; i < RT2860_SOFTC_TXPOW_COUNT; i += 2)
{
val = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_TXPOW1_5GHZ_BASE + i / 2);
+ RT2860_EEPROM_PWR5GHZ_BASE1 + i / 2);
sc->txpow1[i + 0] = (int8_t) (val & 0xff);
sc->txpow1[i + 1] = (int8_t) (val >> 8);
val = rt2860_io_eeprom_read(sc,
- RT2860_EEPROM_TXPOW2_5GHZ_BASE + i / 2);
+ RT2860_EEPROM_PWR5GHZ_BASE2 + i / 2);
sc->txpow2[i + 0] = (int8_t) (val & 0xff);
sc->txpow2[i + 1] = (int8_t) (val >> 8);
@@ -7764,7 +7775,7 @@
/* read Tx power per rate deltas */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TXPOW_RATE_DELTA);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_DELTAPWR);
sc->txpow_rate_delta_2ghz = 0;
sc->txpow_rate_delta_5ghz = 0;
@@ -7821,27 +7832,27 @@
/* read factory-calibrated samples for temperature compensation */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_2GHZ_BASE);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI1_2GHZ);
sc->tssi_2ghz[0] = (val & 0xff); /* [-4] */
sc->tssi_2ghz[1] = (val >> 8); /* [-3] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_2GHZ_BASE + 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI2_2GHZ);
sc->tssi_2ghz[2] = (val & 0xff); /* [-2] */
sc->tssi_2ghz[3] = (val >> 8); /* [-1] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_2GHZ_BASE + 2 * 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI3_2GHZ);
sc->tssi_2ghz[4] = (val & 0xff); /* [0] */
sc->tssi_2ghz[5] = (val >> 8); /* [+1] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_2GHZ_BASE + 3 * 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI4_2GHZ);
sc->tssi_2ghz[6] = (val & 0xff); /* [+2] */
sc->tssi_2ghz[7] = (val >> 8); /* [+3] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_2GHZ_BASE + 4 * 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI5_2GHZ);
sc->tssi_2ghz[8] = (val & 0xff); /* [+4] */
sc->tssi_step_2ghz = (val >> 8);
@@ -7858,27 +7869,27 @@
sc->tssi_2ghz[6], sc->tssi_2ghz[7], sc->tssi_2ghz[8],
sc->tssi_step_2ghz);
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_5GHZ_BASE);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI1_5GHZ);
sc->tssi_5ghz[0] = (val & 0xff); /* [-4] */
sc->tssi_5ghz[1] = (val >> 8); /* [-3] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_5GHZ_BASE + 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI2_5GHZ);
sc->tssi_5ghz[2] = (val & 0xff); /* [-2] */
sc->tssi_5ghz[3] = (val >> 8); /* [-1] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_5GHZ_BASE + 2 * 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI3_5GHZ);
sc->tssi_5ghz[4] = (val & 0xff); /* [0] */
sc->tssi_5ghz[5] = (val >> 8); /* [+1] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_5GHZ_BASE + 3 * 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI4_5GHZ);
sc->tssi_5ghz[6] = (val & 0xff); /* [+2] */
sc->tssi_5ghz[7] = (val >> 8); /* [+3] */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI_5GHZ_BASE + 4 * 2);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_TSSI5_5GHZ);
sc->tssi_5ghz[8] = (val & 0xff); /* [+4] */
sc->tssi_step_5ghz = (val >> 8);
@@ -7911,7 +7922,7 @@
}
/* read powersave level */
- val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_POWERSAVE_LEVEL);
+ val = rt2860_io_eeprom_read(sc, RT2860_EEPROM_PCIE_PSLEVEL);
sc->powersave_level = val & 0xff;
More information about the Zrouter-src-freebsd
mailing list