Update the RF, RFGAIN, MODE, INI, and BBGAIN initialization tables
authorreyk <reyk@openbsd.org>
Wed, 30 Jul 2008 07:15:39 +0000 (07:15 +0000)
committerreyk <reyk@openbsd.org>
Wed, 30 Jul 2008 07:15:39 +0000 (07:15 +0000)
with different versions for various ar5212 variants and add an extra
table for PCI-E devices.  This fixes support for various newer devices
(like the 1st generation MacBook, T61 variants) but it still does not
work on a number of other devices.

Tested by many
ok deraadt@

sys/dev/ic/ar5211.c
sys/dev/ic/ar5212.c
sys/dev/ic/ar5212reg.h
sys/dev/ic/ar5212var.h
sys/dev/ic/ar5xxx.c
sys/dev/ic/ar5xxx.h

index e50e595..7f8ecfb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar5211.c,v 1.36 2007/11/01 20:32:16 reyk Exp $        */
+/*     $OpenBSD: ar5211.c,v 1.37 2008/07/30 07:15:39 reyk Exp $        */
 
 /*
  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -507,7 +507,7 @@ ar5k_ar5211_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel,
        /*
         * Write initial RF gain settings
         */
-       if (ar5k_rfgain(hal, AR5K_INI_PHY_5111, freq) == AH_FALSE)
+       if (ar5k_rfgain(hal, freq) == AH_FALSE)
                return (AH_FALSE);
 
        AR5K_DELAY(1000);
index 3ac49d1..82f928a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar5212.c,v 1.43 2008/07/29 00:18:25 reyk Exp $        */
+/*     $OpenBSD: ar5212.c,v 1.44 2008/07/30 07:15:39 reyk Exp $        */
 
 /*
  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -34,10 +34,16 @@ HAL_BOOL     ar5k_ar5212_txpower(struct ath_hal *, HAL_CHANNEL *, u_int);
 /*
  * Initial register setting for the AR5212
  */
-static const struct ar5k_ar5212_ini ar5212_ini[] =
-    AR5K_AR5212_INI;
-static const struct ar5k_ar5212_ini_mode ar5212_mode[] =
-    AR5K_AR5212_INI_MODE;
+static const struct ar5k_ini ar5212_ini[] = AR5K_AR5212_INI;
+static const struct ar5k_mode ar5212_mode[] = AR5K_AR5212_MODE;
+static const struct ar5k_mode ar5212_ar5111_mode[] = AR5K_AR5212_AR5111_MODE;
+static const struct ar5k_mode ar5212_ar5112_mode[] = AR5K_AR5212_AR5112_MODE;
+static const struct ar5k_mode ar5413_mode[] = AR5K_AR5413_MODE;
+static const struct ar5k_mode ar2413_mode[] = AR5K_AR2413_MODE;
+static const struct ar5k_mode ar2425_mode[] = AR5K_AR2425_MODE;
+static const struct ar5k_ini ar5111_bbgain[] = AR5K_AR5111_INI_BBGAIN;
+static const struct ar5k_ini ar5112_bbgain[] = AR5K_AR5112_INI_BBGAIN;
+static const struct ar5k_ini ar5212_pcie[] = AR5K_AR5212_PCIE;
 
 AR5K_HAL_FUNCTIONS(extern, ar5k_ar5212,);
 
@@ -222,10 +228,39 @@ ar5k_ar5212_attach(u_int16_t device, void *sc, bus_space_tag_t st,
 
        /* Identify the chipset (this has to be done in an early step) */
        hal->ah_version = AR5K_AR5212;
-       hal->ah_radio = hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112 ?
-           AR5K_AR5111 : AR5K_AR5112;
+       if (srev == AR5K_SREV_VER_AR2425) {
+               hal->ah_radio = AR5K_AR2425;
+               hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112;
+       } else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) {
+               hal->ah_radio = AR5K_AR5111;
+               hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5111;
+       } else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) {
+               hal->ah_radio = AR5K_AR5112;
+               if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A)
+                       hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112;
+               else
+                       hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112A;
+       } else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) {
+               hal->ah_radio = AR5K_AR2413;
+               hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112A;
+       } else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC2) {
+               hal->ah_radio = AR5K_AR5413;
+               hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112A;
+       } else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133 &&
+           srev < AR5K_SREV_VER_AR5424) {
+               hal->ah_radio = AR5K_AR2413;
+               hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5112A;
+       } else if (hal->ah_radio_5ghz_revision < AR5K_SREV_RAD_5133) {
+               hal->ah_radio = AR5K_AR5413;
+               hal->ah_phy_spending = AR5K_AR5212_PHY_SPENDING_AR5424;
+       }
        hal->ah_phy = AR5K_AR5212_PHY(0);
 
+       if (hal->ah_pci_express == AH_TRUE) {
+               /* PCI-Express based devices need some extra initialization */
+               ar5k_write_ini(hal, ar5212_pcie, AR5K_ELEMENTS(ar5212_pcie), 0);
+       }
+
        bcopy(etherbroadcastaddr, mac, IEEE80211_ADDR_LEN);
        ar5k_ar5212_set_associd(hal, mac, 0, 0);
        ar5k_ar5212_get_lladdr(hal, mac);
@@ -431,18 +466,18 @@ ar5k_ar5212_phy_disable(struct ath_hal *hal)
 
 HAL_BOOL
 ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel,
-    HAL_BOOL change_channel, HAL_STATUS *status)
+    HAL_BOOL chanchange, HAL_STATUS *status)
 {
        struct ar5k_eeprom_info *ee = &hal->ah_capabilities.cap_eeprom;
        u_int8_t mac[IEEE80211_ADDR_LEN];
        u_int32_t data, s_seq, s_ant, s_led[3], dmasize;
-       u_int i, phy, mode, freq, off, ee_mode, ant[2];
+       u_int i, mode, freq, ee_mode, ant[2];
        const HAL_RATE_TABLE *rt;
 
        /*
         * Save some registers before a reset
         */
-       if (change_channel == AH_TRUE) {
+       if (chanchange == AH_TRUE) {
                s_seq = AR5K_REG_READ(AR5K_AR5212_DCU_SEQNUM(0));
                s_ant = AR5K_REG_READ(AR5K_AR5212_DEFAULT_ANTENNA);
        } else {
@@ -455,7 +490,7 @@ ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel,
        s_led[1] = AR5K_REG_READ(AR5K_AR5212_GPIOCR);
        s_led[2] = AR5K_REG_READ(AR5K_AR5212_GPIODO);
 
-       if (change_channel == AH_TRUE && hal->ah_rf_banks != NULL)
+       if (chanchange == AH_TRUE && hal->ah_rf_banks != NULL)
                ar5k_ar5212_get_rf_gain(hal);
 
        if (ar5k_ar5212_nic_wakeup(hal, channel->c_channel_flags) == AH_FALSE)
@@ -466,15 +501,6 @@ ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel,
         */
        hal->ah_op_mode = op_mode;
 
-       if (hal->ah_radio == AR5K_AR5111) {
-               phy = AR5K_INI_PHY_5111;
-       } else if (hal->ah_radio == AR5K_AR5112) {
-               phy = AR5K_INI_PHY_5112;
-       } else {
-               AR5K_PRINTF("invalid phy radio: %u\n", hal->ah_radio);
-               return (AH_FALSE);
-       }
-
        switch (channel->c_channel_flags & CHANNEL_MODES) {
        case CHANNEL_A:
                mode = AR5K_INI_VAL_11A;
@@ -516,48 +542,52 @@ ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel,
        AR5K_REG_WRITE(AR5K_AR5212_PHY(0), AR5K_AR5212_PHY_SHIFT_5GHZ);
 
        /*
-        * Write initial mode settings
+        * Write initial mode and register settings
         */
-       for (i = 0; i < AR5K_ELEMENTS(ar5212_mode); i++) {
-               if (ar5212_mode[i].mode_flags == AR5K_INI_FLAG_511X)
-                       off = AR5K_INI_PHY_511X;
-               else if (ar5212_mode[i].mode_flags & AR5K_INI_FLAG_5111 &&
-                   hal->ah_radio == AR5K_AR5111)
-                       off = AR5K_INI_PHY_5111;
-               else if (ar5212_mode[i].mode_flags & AR5K_INI_FLAG_5112 &&
-                   hal->ah_radio == AR5K_AR5112)
-                       off = AR5K_INI_PHY_5112;
-               else
-                       continue;
+       ar5k_write_mode(hal, ar5212_mode, AR5K_ELEMENTS(ar5212_mode), mode);
+       ar5k_write_ini(hal, ar5212_ini, AR5K_ELEMENTS(ar5212_ini), chanchange);
 
-               AR5K_REG_WAIT(i);
-               AR5K_REG_WRITE((u_int32_t)ar5212_mode[i].mode_register,
-                   ar5212_mode[i].mode_value[off][mode]);
+       switch (hal->ah_radio) {
+       case AR5K_AR5111:
+               ar5k_write_mode(hal, ar5212_ar5111_mode,
+                   AR5K_ELEMENTS(ar5212_ar5111_mode), mode);
+               break;
+       case AR5K_AR5112:
+               ar5k_write_mode(hal, ar5212_ar5112_mode,
+                   AR5K_ELEMENTS(ar5212_ar5112_mode), mode);
+               break;
+       case AR5K_AR5413:
+               ar5k_write_mode(hal, ar5413_mode,
+                   AR5K_ELEMENTS(ar5413_mode), mode);
+               break;
+       case AR5K_AR2413:
+               AR5K_REG_WRITE(AR5K_AR5212_PHY(648), 0x018830c6);
+               ar5k_write_mode(hal, ar2413_mode,
+                   AR5K_ELEMENTS(ar2413_mode), mode);
+               break;
+       case AR5K_AR2425:
+               AR5K_REG_WRITE(AR5K_AR5212_PHY(648), 0x018830c6);
+               if (mode == AR5K_INI_VAL_11B)
+                       mode = AR5K_INI_VAL_11G;
+               ar5k_write_mode(hal, ar2425_mode,
+                   AR5K_ELEMENTS(ar2425_mode), mode);
+               break;
+       default:
+               AR5K_PRINTF("invalid radio: %d\n", hal->ah_radio);
+               return (AH_FALSE);
        }
 
-       /*
-        * Write initial register settings
-        */
-       for (i = 0; i < AR5K_ELEMENTS(ar5212_ini); i++) {
-               if (change_channel == AH_TRUE &&
-                   ar5212_ini[i].ini_register >= AR5K_AR5212_PCU_MIN &&
-                   ar5212_ini[i].ini_register <= AR5K_AR5212_PCU_MAX)
-                       continue;
-
-               if ((hal->ah_radio == AR5K_AR5111 &&
-                   ar5212_ini[i].ini_flags & AR5K_INI_FLAG_5111) ||
-                   (hal->ah_radio == AR5K_AR5112 &&
-                   ar5212_ini[i].ini_flags & AR5K_INI_FLAG_5112)) {
-                       AR5K_REG_WAIT(i);
-                       AR5K_REG_WRITE((u_int32_t)ar5212_ini[i].ini_register,
-                           ar5212_ini[i].ini_value);
-               }
-       }
+       if (hal->ah_radio == AR5K_AR5111)
+               ar5k_write_ini(hal, ar5111_bbgain,
+                   AR5K_ELEMENTS(ar5111_bbgain), chanchange);
+       else
+               ar5k_write_ini(hal, ar5112_bbgain,
+                   AR5K_ELEMENTS(ar5112_bbgain), chanchange);
 
        /*
         * Write initial RF gain settings
         */
-       if (ar5k_rfgain(hal, phy, freq) == AH_FALSE)
+       if (ar5k_rfgain(hal, freq) == AH_FALSE)
                return (AH_FALSE);
 
        AR5K_DELAY(1000);
@@ -806,8 +836,7 @@ ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel,
        AR5K_REG_WRITE(AR5K_AR5212_PHY_SCAL, AR5K_AR5212_PHY_SCAL_32MHZ);
        AR5K_REG_WRITE(AR5K_AR5212_PHY_SCLOCK, AR5K_AR5212_PHY_SCLOCK_32MHZ);
        AR5K_REG_WRITE(AR5K_AR5212_PHY_SDELAY, AR5K_AR5212_PHY_SDELAY_32MHZ);
-       AR5K_REG_WRITE(AR5K_AR5212_PHY_SPENDING, hal->ah_radio == AR5K_AR5111 ?
-           AR5K_AR5212_PHY_SPENDING_AR5111 : AR5K_AR5212_PHY_SPENDING_AR5112);
+       AR5K_REG_WRITE(AR5K_AR5212_PHY_SPENDING, hal->ah_phy_spending);
 
        /* 
         * Disable beacons and reset the register
@@ -2161,7 +2190,7 @@ ar5k_ar5212_get_rf_gain(struct ath_hal *hal)
                if (type == AR5K_AR5212_PHY_PAPD_PROBE_TYPE_CCK)
                        hal->ah_gain.g_current += AR5K_GAIN_CCK_PROBE_CORR;
 
-               if (hal->ah_radio == AR5K_AR5112) {
+               if (hal->ah_radio >= AR5K_AR5112) {
                        ar5k_rfregs_gainf_corr(hal);
                        hal->ah_gain.g_current =
                            hal->ah_gain.g_current >= hal->ah_gain.g_f_corr ?
index 2684b60..6a259b1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar5212reg.h,v 1.11 2007/03/12 01:04:52 reyk Exp $     */
+/*     $OpenBSD: ar5212reg.h,v 1.12 2008/07/30 07:15:39 reyk Exp $     */
 
 /*
  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1175,13 +1175,15 @@ typedef enum {
 /*
  * PHY clock sleep registers
  */
-#define AR5K_AR5212_PHY_SCLOCK         0x99f0
-#define AR5K_AR5212_PHY_SCLOCK_32MHZ   0x0000000c
-#define AR5K_AR5212_PHY_SDELAY         0x99f4
-#define AR5K_AR5212_PHY_SDELAY_32MHZ   0x000000ff
-#define AR5K_AR5212_PHY_SPENDING       0x99f8
-#define AR5K_AR5212_PHY_SPENDING_AR5111        0x00000018
-#define AR5K_AR5212_PHY_SPENDING_AR5112        0x00000014
+#define AR5K_AR5212_PHY_SCLOCK                 0x99f0
+#define AR5K_AR5212_PHY_SCLOCK_32MHZ           0x0000000c
+#define AR5K_AR5212_PHY_SDELAY                 0x99f4
+#define AR5K_AR5212_PHY_SDELAY_32MHZ           0x000000ff
+#define AR5K_AR5212_PHY_SPENDING               0x99f8
+#define AR5K_AR5212_PHY_SPENDING_AR5111                0x00000018
+#define AR5K_AR5212_PHY_SPENDING_AR5112                0x00000014
+#define AR5K_AR5212_PHY_SPENDING_AR5112A       0x0000000e
+#define AR5K_AR5212_PHY_SPENDING_AR5424                0x00000012
 
 /*
  * PHY timing IQ calibration result register
index 584eb3a..8233d44 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar5212var.h,v 1.14 2007/03/12 01:04:52 reyk Exp $     */
+/*     $OpenBSD: ar5212var.h,v 1.15 2008/07/30 07:15:39 reyk Exp $     */
 
 /*
  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -238,561 +238,934 @@ extern ar5k_attach_t ar5k_ar5212_attach;
  * card at boot time and after each reset.
  */
 
-struct ar5k_ar5212_ini {
-       u_int8_t        ini_flags;
-       u_int16_t       ini_register;
-       u_int32_t       ini_value;
-
-#define AR5K_INI_FLAG_511X     0x00
-#define        AR5K_INI_FLAG_5111      0x01
-#define AR5K_INI_FLAG_5112     0x02
-#define AR5K_INI_FLAG_BOTH     (AR5K_INI_FLAG_5111 | AR5K_INI_FLAG_5112)
-};
-
-#define AR5K_AR5212_INI {                                              \
-       { AR5K_INI_FLAG_BOTH, 0x000c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0034, 0x00000005 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0040, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0044, 0x00000008 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0048, 0x00000008 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x004c, 0x00000010 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0050, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0054, 0x0000001f },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0800, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0804, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0808, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x080c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0810, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0814, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0818, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x081c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0820, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x0824, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1230, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1270, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1038, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1078, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x10b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x10f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1138, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1178, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x11b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x11f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1238, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1278, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x12b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x12f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1338, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1378, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x13b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x13f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1438, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1478, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x14b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x14f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1538, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1578, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x15b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x15f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1638, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1678, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x16b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x16f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1738, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x1778, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x17b8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x17f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x103c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x107c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x10bc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x10fc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x113c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x117c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x11bc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x11fc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x123c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x127c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x12bc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x12fc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x133c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x137c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x13bc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x13fc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x143c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x147c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8004, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8008, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x800c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8018, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8020, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8024, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8028, 0x00000030 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x802c, 0x0007ffff },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8030, 0x01ffffff },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8034, 0x00000031 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8038, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x803c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8048, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8054, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8058, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x805c, 0xffffc7ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8080, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8084, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8088, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x808c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8090, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8094, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8098, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80c0, 0x2a82301a },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80c4, 0x05dc01e0 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80c8, 0x1f402710 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80cc, 0x01f40000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80d0, 0x00001e1c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80d4, 0x0002aaaa },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80d8, 0x02005555 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80dc, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80e0, 0xffffffff },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80e4, 0x0000ffff },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80e8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80ec, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80f0, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80f4, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80f8, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x80fc, 0x00000088 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8700, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8704, 0x0000008c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8708, 0x000000e4 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x870c, 0x000002d5 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8710, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8714, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8718, 0x000000a0 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x871c, 0x000001c9 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8720, 0x0000002c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8724, 0x0000002c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8728, 0x00000030 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x872c, 0x0000003c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8730, 0x0000002c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8734, 0x0000002c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8738, 0x00000030 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x873c, 0x0000003c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8740, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8744, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8748, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x874c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8750, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8754, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8758, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x875c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8760, 0x000000d5 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8764, 0x000000df },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8768, 0x00000102 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x876c, 0x0000013a },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8770, 0x00000075 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8774, 0x0000007f },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8778, 0x000000a2 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x877c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8100, 0x00010002 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8104, 0x00000001 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8108, 0x000000c0 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x810c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8110, 0x00000168 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x8114, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87c0, 0x03020100 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87c4, 0x07060504 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87c8, 0x0b0a0908 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87cc, 0x0f0e0d0c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87d0, 0x13121110 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87d4, 0x17161514 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87d8, 0x1b1a1918 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87dc, 0x1f1e1d1c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87e0, 0x03020100 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87e4, 0x07060504 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87e8, 0x0b0a0908 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87ec, 0x0f0e0d0c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87f0, 0x13121110 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87f4, 0x17161514 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87f8, 0x1b1a1918 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x87fc, 0x1f1e1d1c },                     \
-       /* PHY registers */                                             \
-       { AR5K_INI_FLAG_BOTH, 0x9808, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x980c, 0xad848e19 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9810, 0x7d28e000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9814, 0x9c0a9f6b },                     \
-       { AR5K_INI_FLAG_BOTH, 0x981c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x982c, 0x00022ffe },                     \
-       { AR5K_INI_FLAG_BOTH, 0x983c, 0x00020100 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9840, 0x206a017a },                     \
-       { AR5K_INI_FLAG_BOTH, 0x984c, 0x1284613c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9854, 0x00000859 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9900, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9904, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9908, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x990c, 0x00800000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9910, 0x00000001 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x991c, 0x0000092a },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9920, 0x05100000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9928, 0x00000001 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x992c, 0x00000004 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9934, 0x1e1f2022 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9938, 0x0a0b0c0d },                     \
-       { AR5K_INI_FLAG_BOTH, 0x993c, 0x0000003f },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9940, 0x00000004 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9948, 0x9280b212 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9954, 0x5d50e188 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9958, 0x000000ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0x995c, 0x004b6a8e },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9968, 0x000003ce },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9970, 0x192fb515 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9974, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9978, 0x00000001 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x997c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa184, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa188, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa18c, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa190, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa194, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa198, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa19c, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1a0, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1a4, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1a8, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1ac, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1b0, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1b4, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1b8, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1bc, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1c0, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1c4, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1c8, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1cc, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1d0, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1d4, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1d8, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1dc, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1e0, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1e4, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1e8, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1ec, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1f0, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1f4, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1f8, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa1fc, 0x10ff10ff },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa210, 0x0080a333 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa214, 0x00206c10 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa218, 0x009c4060 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa21c, 0x1483800a },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa220, 0x01831061 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa224, 0x00000400 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa228, 0x000001b5 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa22c, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa234, 0x20202020 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa238, 0x20202020 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa23c, 0x13c889af },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa240, 0x38490a20 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa244, 0x00007bb6 },                     \
-       { AR5K_INI_FLAG_BOTH, 0xa248, 0x0fff3ffc },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9b00, 0x00000000 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9b28, 0x0000000c },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9b38, 0x00000012 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9b64, 0x00000021 },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9b8c, 0x0000002d },                     \
-       { AR5K_INI_FLAG_BOTH, 0x9b9c, 0x00000033 },                     \
-       /* AR5111 specific */                                           \
-       { AR5K_INI_FLAG_5111, 0x9930, 0x00004883 },                     \
-       { AR5K_INI_FLAG_5111, 0xa204, 0x00000000 },                     \
-       { AR5K_INI_FLAG_5111, 0xa208, 0xd03e6788 },                     \
-       { AR5K_INI_FLAG_5111, 0xa20c, 0x6448416a },                     \
-       { AR5K_INI_FLAG_5111, 0x9b04, 0x00000020 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b08, 0x00000010 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b0c, 0x00000030 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b10, 0x00000008 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b14, 0x00000028 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b18, 0x00000004 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b1c, 0x00000024 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b20, 0x00000014 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b24, 0x00000034 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b2c, 0x0000002c },                     \
-       { AR5K_INI_FLAG_5111, 0x9b30, 0x00000002 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b34, 0x00000022 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b3c, 0x00000032 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b40, 0x0000000a },                     \
-       { AR5K_INI_FLAG_5111, 0x9b44, 0x0000002a },                     \
-       { AR5K_INI_FLAG_5111, 0x9b48, 0x00000006 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b4c, 0x00000026 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b50, 0x00000016 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b54, 0x00000036 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b58, 0x0000000e },                     \
-       { AR5K_INI_FLAG_5111, 0x9b5c, 0x0000002e },                     \
-       { AR5K_INI_FLAG_5111, 0x9b60, 0x00000001 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b68, 0x00000011 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b6c, 0x00000031 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b70, 0x00000009 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b74, 0x00000029 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b78, 0x00000005 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b7c, 0x00000025 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b80, 0x00000015 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b84, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b88, 0x0000000d },                     \
-       { AR5K_INI_FLAG_5111, 0x9b90, 0x00000003 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b94, 0x00000023 },                     \
-       { AR5K_INI_FLAG_5111, 0x9b98, 0x00000013 },                     \
-       { AR5K_INI_FLAG_5111, 0x9ba0, 0x0000000b },                     \
-       { AR5K_INI_FLAG_5111, 0x9ba4, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9ba8, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bac, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bb0, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bb4, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bb8, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bbc, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bc0, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bc4, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bc8, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bcc, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bd0, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bd4, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bd8, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bdc, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9be0, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9be4, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9be8, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bec, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bf0, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bf4, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5111, 0x9bf8, 0x00000002 },                     \
-       { AR5K_INI_FLAG_5111, 0x9bfc, 0x00000016 },                     \
-       /* AR5112 specific */                                           \
-       { AR5K_INI_FLAG_5112, 0x9930, 0x00004882 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b04, 0x00000001 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b08, 0x00000002 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b0c, 0x00000003 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b10, 0x00000004 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b14, 0x00000005 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b18, 0x00000008 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b1c, 0x00000009 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b20, 0x0000000a },                     \
-       { AR5K_INI_FLAG_5112, 0x9b24, 0x0000000b },                     \
-       { AR5K_INI_FLAG_5112, 0x9b2c, 0x0000000d },                     \
-       { AR5K_INI_FLAG_5112, 0x9b30, 0x00000010 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b34, 0x00000011 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b3c, 0x00000013 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b40, 0x00000014 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b44, 0x00000015 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b48, 0x00000018 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b4c, 0x00000019 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b50, 0x0000001a },                     \
-       { AR5K_INI_FLAG_5112, 0x9b54, 0x0000001b },                     \
-       { AR5K_INI_FLAG_5112, 0x9b58, 0x0000001c },                     \
-       { AR5K_INI_FLAG_5112, 0x9b5c, 0x0000001d },                     \
-       { AR5K_INI_FLAG_5112, 0x9b60, 0x00000020 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b68, 0x00000022 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b6c, 0x00000023 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b70, 0x00000024 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b74, 0x00000025 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b78, 0x00000028 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b7c, 0x00000029 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b80, 0x0000002a },                     \
-       { AR5K_INI_FLAG_5112, 0x9b84, 0x0000002b },                     \
-       { AR5K_INI_FLAG_5112, 0x9b88, 0x0000002c },                     \
-       { AR5K_INI_FLAG_5112, 0x9b90, 0x00000030 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b94, 0x00000031 },                     \
-       { AR5K_INI_FLAG_5112, 0x9b98, 0x00000032 },                     \
-       { AR5K_INI_FLAG_5112, 0x9ba0, 0x00000034 },                     \
-       { AR5K_INI_FLAG_5112, 0x9ba4, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9ba8, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bac, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bb0, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bb4, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bb8, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bbc, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bc0, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bc4, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bc8, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bcc, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bd0, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bd4, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bd8, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bdc, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9be0, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9be4, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9be8, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bec, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bf0, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bf4, 0x00000035 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bf8, 0x00000010 },                     \
-       { AR5K_INI_FLAG_5112, 0x9bfc, 0x0000001a },                     \
+#define AR5K_AR5212_INI        {               \
+       { 0x000c,       0x00000000 },   \
+       { 0x0034,       0x00000005 },   \
+       { 0x0040,       0x00000000 },   \
+       { 0x0044,       0x00000008 },   \
+       { 0x0048,       0x00000008 },   \
+       { 0x004c,       0x00000010 },   \
+       { 0x0050,       0x00000000 },   \
+       { 0x0054,       0x0000001f },   \
+       { 0x0800,       0x00000000 },   \
+       { 0x0804,       0x00000000 },   \
+       { 0x0808,       0x00000000 },   \
+       { 0x080c,       0x00000000 },   \
+       { 0x0810,       0x00000000 },   \
+       { 0x0814,       0x00000000 },   \
+       { 0x0818,       0x00000000 },   \
+       { 0x081c,       0x00000000 },   \
+       { 0x0820,       0x00000000 },   \
+       { 0x0824,       0x00000000 },   \
+       { 0x1230,       0x00000000 },   \
+       { 0x1270,       0x00000000 },   \
+       { 0x1038,       0x00000000 },   \
+       { 0x1078,       0x00000000 },   \
+       { 0x10b8,       0x00000000 },   \
+       { 0x10f8,       0x00000000 },   \
+       { 0x1138,       0x00000000 },   \
+       { 0x1178,       0x00000000 },   \
+       { 0x11b8,       0x00000000 },   \
+       { 0x11f8,       0x00000000 },   \
+       { 0x1238,       0x00000000 },   \
+       { 0x1278,       0x00000000 },   \
+       { 0x12b8,       0x00000000 },   \
+       { 0x12f8,       0x00000000 },   \
+       { 0x1338,       0x00000000 },   \
+       { 0x1378,       0x00000000 },   \
+       { 0x13b8,       0x00000000 },   \
+       { 0x13f8,       0x00000000 },   \
+       { 0x1438,       0x00000000 },   \
+       { 0x1478,       0x00000000 },   \
+       { 0x14b8,       0x00000000 },   \
+       { 0x14f8,       0x00000000 },   \
+       { 0x1538,       0x00000000 },   \
+       { 0x1578,       0x00000000 },   \
+       { 0x15b8,       0x00000000 },   \
+       { 0x15f8,       0x00000000 },   \
+       { 0x1638,       0x00000000 },   \
+       { 0x1678,       0x00000000 },   \
+       { 0x16b8,       0x00000000 },   \
+       { 0x16f8,       0x00000000 },   \
+       { 0x1738,       0x00000000 },   \
+       { 0x1778,       0x00000000 },   \
+       { 0x17b8,       0x00000000 },   \
+       { 0x17f8,       0x00000000 },   \
+       { 0x103c,       0x00000000 },   \
+       { 0x107c,       0x00000000 },   \
+       { 0x10bc,       0x00000000 },   \
+       { 0x10fc,       0x00000000 },   \
+       { 0x113c,       0x00000000 },   \
+       { 0x117c,       0x00000000 },   \
+       { 0x11bc,       0x00000000 },   \
+       { 0x11fc,       0x00000000 },   \
+       { 0x123c,       0x00000000 },   \
+       { 0x127c,       0x00000000 },   \
+       { 0x12bc,       0x00000000 },   \
+       { 0x12fc,       0x00000000 },   \
+       { 0x133c,       0x00000000 },   \
+       { 0x137c,       0x00000000 },   \
+       { 0x13bc,       0x00000000 },   \
+       { 0x13fc,       0x00000000 },   \
+       { 0x143c,       0x00000000 },   \
+       { 0x147c,       0x00000000 },   \
+       { 0x143c,       0x00000000 },   \
+       { 0x147c,       0x00000000 },   \
+       { 0x8004,       0x00000000 },   \
+       { 0x8008,       0x00000000 },   \
+       { 0x800c,       0x00000000 },   \
+       { 0x8020,       0x00000000 },   \
+       { 0x8024,       0x00000000 },   \
+       { 0x8028,       0x00000030 },   \
+       { 0x802c,       0x0007ffff },   \
+       { 0x8030,       0x01ffffff },   \
+       { 0x8034,       0x00000031 },   \
+       { 0x8038,       0x00000000 },   \
+       { 0x803c,       0x00000000 },   \
+       { 0x8048,       0x00000000 },   \
+       { 0x8054,       0x00000000 },   \
+       { 0x8058,       0x00000000 },   \
+       { 0x8080,       0x00000000 },   \
+       { 0x805c,       0x000fc78f },   \
+       { 0x8084,       0x00000000 },   \
+       { 0x8088,       0x00000000 },   \
+       { 0x808c,       0x00000000 },   \
+       { 0x8090,       0x00000000 },   \
+       { 0x8094,       0x00000000 },   \
+       { 0x8098,       0x00000000 },   \
+       { 0x80c0,       0x2a82301a },   \
+       { 0x80c4,       0x05dc01e0 },   \
+       { 0x80c8,       0x1f402710 },   \
+       { 0x80cc,       0x01f40000 },   \
+       { 0x80d0,       0x00001e1c },   \
+       { 0x80d4,       0x0002aaaa },   \
+       { 0x80d8,       0x02005555 },   \
+       { 0x80dc,       0x00000000 },   \
+       { 0x80e0,       0xffffffff },   \
+       { 0x80e4,       0x0000ffff },   \
+       { 0x80e8,       0x00000000 },   \
+       { 0x80ec,       0x00000000 },   \
+       { 0x80f0,       0x00000000 },   \
+       { 0x80f4,       0x00000000 },   \
+       { 0x80f8,       0x00000000 },   \
+       { 0x80fc,       0x00000088 },   \
+       { 0x8700,       0x00000000 },   \
+       { 0x8704,       0x0000008c },   \
+       { 0x8708,       0x000000e4 },   \
+       { 0x870c,       0x000002d5 },   \
+       { 0x8710,       0x00000000 },   \
+       { 0x8714,       0x00000000 },   \
+       { 0x8718,       0x000000a0 },   \
+       { 0x871c,       0x000001c9 },   \
+       { 0x8720,       0x0000002c },   \
+       { 0x8724,       0x0000002c },   \
+       { 0x8728,       0x00000030 },   \
+       { 0x872c,       0x0000003c },   \
+       { 0x8730,       0x0000002c },   \
+       { 0x8734,       0x0000002c },   \
+       { 0x8738,       0x00000030 },   \
+       { 0x873c,       0x0000003c },   \
+       { 0x8740,       0x00000000 },   \
+       { 0x8744,       0x00000000 },   \
+       { 0x8748,       0x00000000 },   \
+       { 0x874c,       0x00000000 },   \
+       { 0x8750,       0x00000000 },   \
+       { 0x8754,       0x00000000 },   \
+       { 0x8758,       0x00000000 },   \
+       { 0x875c,       0x00000000 },   \
+       { 0x8760,       0x000000d5 },   \
+       { 0x8764,       0x000000df },   \
+       { 0x8768,       0x00000102 },   \
+       { 0x876c,       0x0000013a },   \
+       { 0x8770,       0x00000075 },   \
+       { 0x8774,       0x0000007f },   \
+       { 0x8778,       0x000000a2 },   \
+       { 0x877c,       0x00000000 },   \
+       { 0x8100,       0x00010002 },   \
+       { 0x8104,       0x00000001 },   \
+       { 0x8108,       0x000000c0 },   \
+       { 0x810c,       0x00000000 },   \
+       { 0x8110,       0x00000168 },   \
+       { 0x8114,       0x00000000 },   \
+       { 0x87c0,       0x03020100 },   \
+       { 0x87c4,       0x07060504 },   \
+       { 0x87c8,       0x0b0a0908 },   \
+       { 0x87cc,       0x0f0e0d0c },   \
+       { 0x87d0,       0x13121110 },   \
+       { 0x87d4,       0x17161514 },   \
+       { 0x87d8,       0x1b1a1918 },   \
+       { 0x87dc,       0x1f1e1d1c },   \
+       { 0x87e0,       0x03020100 },   \
+       { 0x87e4,       0x07060504 },   \
+       { 0x87e8,       0x0b0a0908 },   \
+       { 0x87ec,       0x0f0e0d0c },   \
+       { 0x87f0,       0x13121110 },   \
+       { 0x87f4,       0x17161514 },   \
+       { 0x87f8,       0x1b1a1918 },   \
+       { 0x87fc,       0x1f1e1d1c },   \
+       { 0x980c,       0xad848e19 },   \
+       { 0x9810,       0x7d28e000 },   \
+       { 0x9814,       0x9c0a9f6b },   \
+       { 0x981c,       0x00000000 },   \
+       { 0x9840,       0x206a017a },   \
+       { 0x9854,       0x00000859 },   \
+       { 0x9900,       0x00000000 },   \
+       { 0x9904,       0x00000000 },   \
+       { 0x9908,       0x00000000 },   \
+       { 0x990c,       0x00800000 },   \
+       { 0x9910,       0x00000001 },   \
+       { 0x991c,       0x00000c80 },   \
+       { 0x9920,       0x05100000 },   \
+       { 0x9928,       0x00000001 },   \
+       { 0x992c,       0x00000004 },   \
+       { 0x9934,       0x1e1f2022 },   \
+       { 0x9938,       0x0a0b0c0d },   \
+       { 0x993c,       0x0000003f },   \
+       { 0x9948,       0x9280b212 },   \
+       { 0x9954,       0x5d50e188 },   \
+       { 0x995c,       0x004b6a8e },   \
+       { 0x9968,       0x000003ce },   \
+       { 0x9970,       0x192fb515 },   \
+       { 0x9978,       0x00000001 },   \
+       { 0x997c,       0x00000000 },   \
+       { 0xa210,       0x00806333 },   \
+       { 0xa214,       0x00106c10 },   \
+       { 0xa218,       0x009c4060 },   \
+       { 0xa21c,       0x1483800a },   \
+       { 0xa220,       0x01831061 },   \
+       { 0xa224,       0x00000400 },   \
+       { 0xa22c,       0x00000000 },   \
+       { 0xa234,       0x20202020 },   \
+       { 0x9938,       0x20202020 },   \
+       { 0xa240,       0x38490a20 },   \
+       { 0xa244,       0x00007bb6 },   \
+       { 0xa248,       0x0fff3ffc },   \
 }
 
-struct ar5k_ar5212_ini_mode {
-       u_int16_t       mode_register;
-       u_int8_t        mode_flags;
-       u_int32_t       mode_value[2][5];
-};
-
-#define AR5K_AR5212_INI_MODE {                                                 \
-       { 0x0030, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00008107, 0x00008107, 0x00008107, 0x00008107, 0x00008107 }  \
-       } },                                                                    \
-       { 0x1040, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1044, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1048, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x104c, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1050, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1054, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1058, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x105c, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1060, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1064, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f }  \
-       } },                                                                    \
-       { 0x1030, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 }  \
-       } },                                                                    \
-       { 0x1070, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 }  \
-       } },                                                                    \
-       { 0x10b0, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 }  \
-       } },                                                                    \
-       { 0x10f0, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 }  \
-       } },                                                                    \
-       { 0x8014, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 }  \
-       } },                                                                    \
-       { 0x9804, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 }  \
-       } },                                                                    \
-       { 0x9820, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 }  \
-       } },                                                                    \
-       { 0x9834, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e }  \
-       } },                                                                    \
-       { 0x9838, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b }  \
-       } },                                                                    \
-       { 0x9844, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x1372161c, 0x13721c25, 0x13721728, 0x137216a2, 0x13721c25 }  \
-       } },                                                                    \
-       { 0x9850, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 }  \
-       } },                                                                    \
-       { 0x9858, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e }  \
-       } },                                                                    \
-       { 0x9860, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d10, 0x00009d10 }  \
-       } },                                                                    \
-       { 0x9864, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 }  \
-       } },                                                                    \
-       { 0x9868, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 }  \
-       } },                                                                    \
-       { 0x9918, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 }  \
-       } },                                                                    \
-       { 0x9924, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 }  \
-       } },                                                                    \
-       { 0xa180, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x10ff14ff, 0x10ff14ff, 0x10ff10ff, 0x10ff19ff, 0x10ff19ff }  \
-       } },                                                                    \
-       { 0xa230, AR5K_INI_FLAG_511X, {                                         \
-               { 0, },                                                         \
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 }  \
-       } },                                                                    \
-       { 0x801c, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x128d8fab, 0x09880fcf }, \
-               { 0x128d93a7, 0x098813cf, 0x04e01395, 0x128d93ab, 0x098813cf }  \
-       } },                                                                    \
-       { 0x9824, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e }, \
-               { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e }  \
-       } },                                                                    \
-       { 0x9828, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 }, \
-               { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 }  \
-       } },                                                                    \
-       { 0x9848, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 }, \
-               { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 }  \
-       } },                                                                    \
-       { 0x985c, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e }, \
-               { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e }  \
-       } },                                                                    \
-       { 0x986c, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 }, \
-               { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 }  \
-       } },                                                                    \
-       { 0x9914, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 }, \
-               { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 }  \
-       } },                                                                    \
-       { 0x9944, AR5K_INI_FLAG_BOTH, {                                         \
-               { 0xffb81020, 0xffb81020, 0xffb80d20, 0xffb81020, 0xffb81020 }, \
-               { 0xffb81020, 0xffb81020, 0xffb80d10, 0xffb81010, 0xffb81010 }  \
-       } },                                                                    \
-       { 0xa204, AR5K_INI_FLAG_5112, {                                         \
-               { 0, },                                                         \
-               { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 }  \
-       } },                                                                    \
-       { 0xa208, AR5K_INI_FLAG_5112, {                                         \
-               { 0, },                                                         \
-               { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 }  \
-       } },                                                                    \
-       { 0xa20c, AR5K_INI_FLAG_5112, {                                         \
-               { 0, },                                                         \
-               { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 }  \
-       } },                                                                    \
+#define AR5K_AR5212_MODE       {               \
+       { 0xa200,\
+           { 0x00000008, 0x00000008, 0x0000000b, 0x0000000e, 0x0000000e } },\
+       { 0x9800,\
+           { 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0x00000007 } },\
+       { 0x1040,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1044,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1048,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x104c,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1050,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1054,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1058,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x105c,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1060,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1064,\
+           { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },\
+       { 0x1030,\
+           { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } },\
+       { 0x1070,\
+           { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } },\
+       { 0x10b0,\
+           { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } },\
+       { 0x10f0,\
+           { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } },\
+       { 0x8014,\
+           { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } },\
+       { 0x9804,\
+           { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } },\
+       { 0x9820,\
+           { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } },\
+       { 0x9824,\
+           { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e } },\
+       { 0x9844,\
+           { 0x1372161c, 0x13721c25, 0x13721722, 0x137216a2, 0x13721c25 } },\
+       { 0x9860,\
+           { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d18, 0x00009d18 } },\
+       { 0x9864,\
+           { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },\
+       { 0x9868,\
+           { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } },\
+       { 0x9918,\
+           { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } },\
+       { 0x9924,\
+           { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } },\
+       { 0xa230,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } },\
+}
+
+#define AR5K_AR5212_AR5111_MODE        {               \
+       { 0xa200,\
+           { 0x00000000, 0x00000000, 0x00000003, 0x00000006, 0x00000006 } },\
+       { 0x0030,\
+           { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },\
+       { 0x801c,\
+           { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x12e00fab, 0x09880fcf } },\
+       { 0x9828,\
+           { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 } },\
+       { 0x9834,\
+           { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },\
+       { 0x9838,\
+           { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },\
+       { 0x9848,\
+           { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 } },\
+       { 0x9850,\
+           { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },\
+       { 0x9858,\
+           { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } },\
+       { 0x985c,\
+           { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e } },\
+       { 0x986c,\
+           { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 } },\
+       { 0x9914,\
+           { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 } },\
+       { 0x9944,\
+           { 0xf7b81020, 0xf7b81020, 0xf7b80d20, 0xf7b81020, 0xf7b81020 } },\
+       { 0xa20c,\
+           { 0x642c416a, 0x642c416a, 0x6440416a, 0x6440416a, 0x6440416a } },\
+       { 0xa21c,\
+           { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },\
+       { 0x1230,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x9808,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x982c,\
+           { 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe } },\
+       { 0x983c,\
+           { 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020100 } },\
+       { 0x984c,\
+           { 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c } },\
+       { 0x9930,\
+           { 0x00004883, 0x00004883, 0x00004883, 0x00004883, 0x00004883 } },\
+       { 0x9940,\
+           { 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 } },\
+       { 0x9958,\
+           { 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff } },\
+       { 0x9974,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x99f8,\
+           { 0x00000018, 0x00000018, 0x00000018, 0x00000018, 0x00000018 } },\
+       { 0xa204,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa208,\
+           { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },\
+       { 0xa23c,\
+           { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },\
+}
+
+#define AR5K_AR5212_AR5112_MODE        {               \
+       { 0x0030,\
+           { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },\
+       { 0x801c,\
+           { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },\
+       { 0x9828,\
+           { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },\
+       { 0x9834,\
+           { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },\
+       { 0x9838,\
+           { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },\
+       { 0x9848,\
+           { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } },\
+       { 0x9850,\
+           { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },\
+       { 0x9858,\
+           { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e, 0x7ee80d2e } },\
+       { 0x985c,\
+           { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } },\
+       { 0x986c,\
+           { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },\
+       { 0x9914,\
+           { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },\
+       { 0x9944,\
+           { 0xf7b81020, 0xf7b81020, 0xf7b80d10, 0xf7b81010, 0xf7b81010 } },\
+       { 0xa204,\
+           { 0x00000000, 0x00000000, 0x00000008, 0x00000008, 0x00000008 } },\
+       { 0xa208,\
+           { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },\
+       { 0xa20c,\
+           { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } },\
+       { 0xa21c,\
+           { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },\
+       { 0x1230,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x9808,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x982c,\
+           { 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe } },\
+       { 0x983c,\
+           { 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020100 } },\
+       { 0x984c,\
+           { 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c } },\
+       { 0x9930,\
+           { 0x00004882, 0x00004882, 0x00004882, 0x00004882, 0x00004882 } },\
+       { 0x9940,\
+           { 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 } },\
+       { 0x9958,\
+           { 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff } },\
+       { 0x9974,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa228,\
+           { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } },\
+       { 0xa23c,\
+           { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },\
+}
+
+#define AR5K_AR5413_MODE       {               \
+       { 0x0030,\
+           { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },\
+       { 0x801c,\
+           { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },\
+       { 0x9828,\
+           { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },\
+       { 0x9834,\
+           { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },\
+       { 0x9838,\
+           { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },\
+       { 0x9848,\
+           { 0x0018fa61, 0x0018fa61, 0x001a1a63, 0x001a1a63, 0x001a1a63 } },\
+       { 0x9850,\
+           { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } },\
+       { 0x9858,\
+           { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },\
+       { 0x985c,\
+           { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } },\
+       { 0x986c,\
+           { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },\
+       { 0x9914,\
+           { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },\
+       { 0x9944,\
+           { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },\
+       { 0xa204,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa208,\
+           { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },\
+       { 0xa20c,\
+           { 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 } },\
+       { 0xa21c,\
+           { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },\
+       { 0xa300,\
+           { 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0x18010000 } },\
+       { 0xa304,\
+           { 0x30032602, 0x30032602, 0x30032602, 0x30032602, 0x30032602 } },\
+       { 0xa308,\
+           { 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06 } },\
+       { 0xa30c,\
+           { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },\
+       { 0xa310,\
+           { 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f } },\
+       { 0xa314,\
+           { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },\
+       { 0xa318,\
+           { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },\
+       { 0xa31c,\
+           { 0x90cf865b, 0x90cf865b, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } },\
+       { 0xa320,\
+           { 0x9d4f970f, 0x9d4f970f, 0x9b4f970f, 0x9b4f970f, 0x9b4f970f } },\
+       { 0xa324,\
+           { 0xa7cfa38f, 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f, 0xa3cf9f8f } },\
+       { 0xa328,\
+           { 0xb55faf1f, 0xb55faf1f, 0xb35faf1f, 0xb35faf1f, 0xb35faf1f } },\
+       { 0xa32c,\
+           { 0xbddfb99f, 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f, 0xbbdfb99f } },\
+       { 0xa330,\
+           { 0xcb7fc53f, 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f, 0xcb7fc73f } },\
+       { 0xa334,\
+           { 0xd5ffd1bf, 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },\
+       { 0x1230,\
+           { 0x000003e0, 0x000003e0, 0x000003e0, 0x000003e0, 0x000003e0 } },\
+       { 0x4068,\
+           { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } },\
+       { 0x8060,\
+           { 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f } },\
+       { 0x809c,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x80a0,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8118,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x811c,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8120,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8124,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8128,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x812c,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8130,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8134,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8138,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x813c,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8140,\
+           { 0x800003f9, 0x800003f9, 0x800003f9, 0x800003f9, 0x800003f9 } },\
+       { 0x8144,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x9808,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x982c,\
+           { 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000 } },\
+       { 0x983c,\
+           { 0x00200400, 0x00200400, 0x00200400, 0x00200400, 0x00200400 } },\
+       { 0x984c,\
+           { 0x1284233c, 0x1284233c, 0x1284233c, 0x1284233c, 0x1284233c } },\
+       { 0x9870,\
+           { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f } },\
+       { 0x9874,\
+           { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },\
+       { 0x9878,\
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },\
+       { 0x9958,\
+           { 0x00081fff, 0x00081fff, 0x00081fff, 0x00081fff, 0x00081fff } },\
+       { 0x9980,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x9984,\
+           { 0x02800000, 0x02800000, 0x02800000, 0x02800000, 0x02800000 } },\
+       { 0x99a0,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x99e0,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x99e4,\
+           { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa } },\
+       { 0x99e8,\
+           { 0x3c466478, 0x3c466478, 0x3c466478, 0x3c466478, 0x3c466478 } },\
+       { 0x99ec,\
+           { 0x000000aa, 0x000000aa, 0x000000aa, 0x000000aa, 0x000000aa } },\
+       { 0x99f0,\
+           { 0x0000000c, 0x0000000c, 0x0000000c, 0x0000000c, 0x0000000c } },\
+       { 0x99f4,\
+           { 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff } },\
+       { 0x99f8,\
+           { 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014 } },\
+       { 0xa228,\
+           { 0x000009b5, 0x000009b5, 0x000009b5, 0x000009b5, 0x000009b5 } },\
+       { 0xa23c,\
+           { 0x93c889af, 0x93c889af, 0x93c889af, 0x93c889af, 0x93c889af } },\
+       { 0xa24c,\
+           { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },\
+       { 0xa250,\
+           { 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000 } },\
+       { 0xa254,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa258,\
+           { 0x0cc75380, 0x0cc75380, 0x0cc75380, 0x0cc75380, 0x0cc75380 } },\
+       { 0xa25c,\
+           { 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01 } },\
+       { 0xa260,\
+           { 0x5f690f01, 0x5f690f01, 0x5f690f01, 0x5f690f01, 0x5f690f01 } },\
+       { 0xa264,\
+           { 0x00418a11, 0x00418a11, 0x00418a11, 0x00418a11, 0x00418a11 } },\
+       { 0xa268,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa26c,\
+           { 0x0c30c16a, 0x0c30c16a, 0x0c30c16a, 0x0c30c16a, 0x0c30c16a } },\
+       { 0xa270,\
+           { 0x00820820, 0x00820820, 0x00820820, 0x00820820, 0x00820820 } },\
+       { 0xa274,\
+           { 0x081b7caa, 0x081b7caa, 0x081b7caa, 0x081b7caa, 0x081b7caa } },\
+       { 0xa278,\
+           { 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce } },\
+       { 0xa27c,\
+           { 0x051701ce, 0x051701ce, 0x051701ce, 0x051701ce, 0x051701ce } },\
+       { 0xa338,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa33c,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa340,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa344,\
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa348,\
+           { 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff } },\
+       { 0xa34c,\
+           { 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff } },\
+       { 0xa350,\
+           { 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff } },\
+       { 0xa354,\
+           { 0x0003ffff, 0x0003ffff, 0x0003ffff, 0x0003ffff, 0x0003ffff } },\
+       { 0xa358,\
+           { 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f } },\
+       { 0xa35c,\
+           { 0x066c420f, 0x066c420f, 0x066c420f, 0x066c420f, 0x066c420f } },\
+       { 0xa360,\
+           { 0x0f282207, 0x0f282207, 0x0f282207, 0x0f282207, 0x0f282207 } },\
+       { 0xa364,\
+           { 0x17601685, 0x17601685, 0x17601685, 0x17601685, 0x17601685 } },\
+       { 0xa368,\
+           { 0x1f801104, 0x1f801104, 0x1f801104, 0x1f801104, 0x1f801104 } },\
+       { 0xa36c,\
+           { 0x37a00c03, 0x37a00c03, 0x37a00c03, 0x37a00c03, 0x37a00c03 } },\
+       { 0xa370,\
+           { 0x3fc40883, 0x3fc40883, 0x3fc40883, 0x3fc40883, 0x3fc40883 } },\
+       { 0xa374,\
+           { 0x57c00803, 0x57c00803, 0x57c00803, 0x57c00803, 0x57c00803 } },\
+       { 0xa378,\
+           { 0x5fd80682, 0x5fd80682, 0x5fd80682, 0x5fd80682, 0x5fd80682 } },\
+       { 0xa37c,\
+           { 0x7fe00482, 0x7fe00482, 0x7fe00482, 0x7fe00482, 0x7fe00482 } },\
+       { 0xa380,\
+           { 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba } },\
+       { 0xa384,\
+           { 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0 } },\
+}
+
+#define AR5K_AR2413_MODE       {               \
+       { 0x0030, { 0, 0, 0x00000015, 0x00000015, 0x00000015 } },\
+       { 0x801c, { 0, 0, 0x04e01395, 0x12e013ab, 0x098813cf } },\
+       { 0x9828, { 0, 0, 0x05020000, 0x0a020001, 0x0a020001 } },\
+       { 0x9834, { 0, 0, 0x00000e00, 0x00000e00, 0x00000e00 } },\
+       { 0x9838, { 0, 0, 0x0000000a, 0x0000000a, 0x0000000a } },\
+       { 0x9848, { 0, 0, 0x001a6a64, 0x001a6a64, 0x001a6a64 } },\
+       { 0x9850, { 0, 0, 0x0de8b0da, 0x0c98b0da, 0x0c98b0da } },\
+       { 0x9858, { 0, 0, 0x7ee80d2e, 0x7ec80d2e, 0x7ec80d2e } },\
+       { 0x985c, { 0, 0, 0x3137665e, 0x3139605e, 0x3139605e } },\
+       { 0x986c, { 0, 0, 0x050cb081, 0x050cb081, 0x050cb081 } },\
+       { 0x9914, { 0, 0, 0x0000044c, 0x00000898, 0x000007d0 } },\
+       { 0x9944, { 0, 0, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },\
+       { 0xa204, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa208, { 0, 0, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },\
+       { 0xa20c, { 0, 0, 0x0042c140, 0x0042c140, 0x0042c140 } },\
+       { 0xa21c, { 0, 0, 0x1863800a, 0x1883800a, 0x1883800a } },\
+       { 0x1230, { 0, 0, 0x000003e0, 0x000003e0, 0x000003e0 } },\
+       { 0x8060, { 0, 0, 0x0000000f, 0x0000000f, 0x0000000f } },\
+       { 0x8118, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x811c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8120, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8124, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8128, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x812c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8130, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8134, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8138, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x813c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x8140, { 0, 0, 0x800000a8, 0x800000a8, 0x800000a8 } },\
+       { 0x8144, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x9808, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x982c, { 0, 0, 0x0000a000, 0x0000a000, 0x0000a000 } },\
+       { 0x983c, { 0, 0, 0x00200400, 0x00200400, 0x00200400 } },\
+       { 0x984c, { 0, 0, 0x1284233c, 0x1284233c, 0x1284233c } },\
+       { 0x9870, { 0, 0, 0x0000001f, 0x0000001f, 0x0000001f } },\
+       { 0x9874, { 0, 0, 0x00000080, 0x00000080, 0x00000080 } },\
+       { 0x9878, { 0, 0, 0x0000000e, 0x0000000e, 0x0000000e } },\
+       { 0x9958, { 0, 0, 0x000000ff, 0x000000ff, 0x000000ff } },\
+       { 0x9980, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x9984, { 0, 0, 0x02800000, 0x02800000, 0x02800000 } },\
+       { 0x99a0, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x99e0, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0x99e4, { 0, 0, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa } },\
+       { 0x99e8, { 0, 0, 0x3c466478, 0x3c466478, 0x3c466478 } },\
+       { 0x99ec, { 0, 0, 0x000000aa, 0x000000aa, 0x000000aa } },\
+       { 0x99f0, { 0, 0, 0x0000000c, 0x0000000c, 0x0000000c } },\
+       { 0x99f4, { 0, 0, 0x000000ff, 0x000000ff, 0x000000ff } },\
+       { 0x99f8, { 0, 0, 0x00000014, 0x00000014, 0x00000014 } },\
+       { 0xa228, { 0, 0, 0x000009b5, 0x000009b5, 0x000009b5 } },\
+       { 0xa23c, { 0, 0, 0x93c889af, 0x93c889af, 0x93c889af } },\
+       { 0xa24c, { 0, 0, 0x00000001, 0x00000001, 0x00000001 } },\
+       { 0xa250, { 0, 0, 0x0000a000, 0x0000a000, 0x0000a000 } },\
+       { 0xa254, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa258, { 0, 0, 0x0cc75380, 0x0cc75380, 0x0cc75380 } },\
+       { 0xa25c, { 0, 0, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01 } },\
+       { 0xa260, { 0, 0, 0x5f690f01, 0x5f690f01, 0x5f690f01 } },\
+       { 0xa264, { 0, 0, 0x00418a11, 0x00418a11, 0x00418a11 } },\
+       { 0xa268, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa26c, { 0, 0, 0x0c30c16a, 0x0c30c16a, 0x0c30c16a } },\
+       { 0xa270, { 0, 0, 0x00820820, 0x00820820, 0x00820820 } },\
+       { 0xa274, { 0, 0, 0x001b7caa, 0x001b7caa, 0x001b7caa } },\
+       { 0xa278, { 0, 0, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce } },\
+       { 0xa27c, { 0, 0, 0x051701ce, 0x051701ce, 0x051701ce } },\
+       { 0xa300, { 0, 0, 0x18010000, 0x18010000, 0x18010000 } },\
+       { 0xa304, { 0, 0, 0x30032602, 0x30032602, 0x30032602 } },\
+       { 0xa308, { 0, 0, 0x48073e06, 0x48073e06, 0x48073e06 } },\
+       { 0xa30c, { 0, 0, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },\
+       { 0xa310, { 0, 0, 0x641a600f, 0x641a600f, 0x641a600f } },\
+       { 0xa314, { 0, 0, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },\
+       { 0xa318, { 0, 0, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },\
+       { 0xa31c, { 0, 0, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } },\
+       { 0xa320, { 0, 0, 0x9d4f970f, 0x9d4f970f, 0x9d4f970f } },\
+       { 0xa324, { 0, 0, 0xa5cfa18f, 0xa5cfa18f, 0xa5cfa18f } },\
+       { 0xa328, { 0, 0, 0xb55faf1f, 0xb55faf1f, 0xb55faf1f } },\
+       { 0xa32c, { 0, 0, 0xbddfb99f, 0xbddfb99f, 0xbddfb99f } },\
+       { 0xa330, { 0, 0, 0xcd7fc73f, 0xcd7fc73f, 0xcd7fc73f } },\
+       { 0xa334, { 0, 0, 0xd5ffd1bf, 0xd5ffd1bf, 0xd5ffd1bf } },\
+       { 0xa338, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa33c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa340, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa344, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },\
+       { 0xa348, { 0, 0, 0x3fffffff, 0x3fffffff, 0x3fffffff } },\
+       { 0xa34c, { 0, 0, 0x3fffffff, 0x3fffffff, 0x3fffffff } },\
+       { 0xa350, { 0, 0, 0x3fffffff, 0x3fffffff, 0x3fffffff } },\
+       { 0xa354, { 0, 0, 0x0003ffff, 0x0003ffff, 0x0003ffff } },\
+       { 0xa358, { 0, 0, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f } },\
+       { 0xa35c, { 0, 0, 0x066c420f, 0x066c420f, 0x066c420f } },\
+       { 0xa360, { 0, 0, 0x0f282207, 0x0f282207, 0x0f282207 } },\
+       { 0xa364, { 0, 0, 0x17601685, 0x17601685, 0x17601685 } },\
+       { 0xa368, { 0, 0, 0x1f801104, 0x1f801104, 0x1f801104 } },\
+       { 0xa36c, { 0, 0, 0x37a00c03, 0x37a00c03, 0x37a00c03 } },\
+       { 0xa370, { 0, 0, 0x3fc40883, 0x3fc40883, 0x3fc40883 } },\
+       { 0xa374, { 0, 0, 0x57c00803, 0x57c00803, 0x57c00803 } },\
+       { 0xa378, { 0, 0, 0x5fd80682, 0x5fd80682, 0x5fd80682 } },\
+       { 0xa37c, { 0, 0, 0x7fe00482, 0x7fe00482, 0x7fe00482 } },\
+       { 0xa380, { 0, 0, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba } },\
+       { 0xa384, { 0, 0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0 } },\
+}
+
+#define AR5K_AR2425_MODE       {               \
+       { 0x0030, { 0, 0, 0, 0x00000015, 0x00000015 } },\
+       { 0x801c, { 0, 0, 0, 0x12e013ab, 0x098813cf } },\
+       { 0x9804, { 0, 0, 0, 0x00000000, 0x00000003 } },\
+       { 0x9828, { 0, 0, 0, 0x0a020001, 0x0a020001 } },\
+       { 0x9834, { 0, 0, 0, 0x00000e0e, 0x00000e0e } },\
+       { 0x9838, { 0, 0, 0, 0x0000000b, 0x0000000b } },\
+       { 0x9844, { 0, 0, 0, 0x13721422, 0x13721422 } },\
+       { 0x9848, { 0, 0, 0, 0x00199a65, 0x00199a65 } },\
+       { 0x9850, { 0, 0, 0, 0x0c98b0da, 0x0c98b0da } },\
+       { 0x9858, { 0, 0, 0, 0x7ec80d2e, 0x7ec80d2e } },\
+       { 0x985c, { 0, 0, 0, 0x3139605e, 0x3139605e } },\
+       { 0x986c, { 0, 0, 0, 0x050cb081, 0x050cb081 } },\
+       { 0x9914, { 0, 0, 0, 0x00000898, 0x000007d0 } },\
+       { 0x9944, { 0, 0, 0, 0xf7b81000, 0xf7b81000 } },\
+       { 0xa204, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0xa208, { 0, 0, 0, 0xd03e6788, 0xd03e6788 } },\
+       { 0xa20c, { 0, 0, 0, 0x0052c140, 0x0052c140 } },\
+       { 0xa21c, { 0, 0, 0, 0x1883800a, 0x1883800a } },\
+       { 0xa324, { 0, 0, 0, 0xa7cfa7cf, 0xa7cfa7cf } },\
+       { 0xa328, { 0, 0, 0, 0xa7cfa7cf, 0xa7cfa7cf } },\
+       { 0xa32c, { 0, 0, 0, 0xa7cfa7cf, 0xa7cfa7cf } },\
+       { 0xa330, { 0, 0, 0, 0xa7cfa7cf, 0xa7cfa7cf } },\
+       { 0xa334, { 0, 0, 0, 0xa7cfa7cf, 0xa7cfa7cf } },\
+       { 0x1230, { 0, 0, 0, 0x000003e0, 0x000003e0 } },\
+       { 0x8060, { 0, 0, 0, 0x0000000f, 0x0000000f } },\
+       { 0x809c, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x80a0, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8118, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x811c, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8120, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8124, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8128, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x812c, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8130, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8134, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8138, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x813c, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x8140, { 0, 0, 0, 0x800003f9, 0x800003f9 } },\
+       { 0x8144, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x9808, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x982c, { 0, 0, 0, 0x0000a000, 0x0000a000 } },\
+       { 0x983c, { 0, 0, 0, 0x00200400, 0x00200400 } },\
+       { 0x984c, { 0, 0, 0, 0x1284233c, 0x1284233c } },\
+       { 0x9870, { 0, 0, 0, 0x0000001f, 0x0000001f } },\
+       { 0x9874, { 0, 0, 0, 0x00000080, 0x00000080 } },\
+       { 0x9878, { 0, 0, 0, 0x0000000e, 0x0000000e } },\
+       { 0x9958, { 0, 0, 0, 0x00081fff, 0x00081fff } },\
+       { 0x9980, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x9984, { 0, 0, 0, 0x02800000, 0x02800000 } },\
+       { 0x99a0, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x99dc, { 0, 0, 0, 0xfebadbe8, 0xfebadbe8 } },\
+       { 0x99e0, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0x99e4, { 0, 0, 0, 0xaaaaaaaa, 0xaaaaaaaa } },\
+       { 0x99e8, { 0, 0, 0, 0x3c466478, 0x3c466478 } },\
+       { 0x99ec, { 0, 0, 0, 0x000000aa, 0x000000aa } },\
+       { 0x99f0, { 0, 0, 0, 0x0000000c, 0x0000000c } },\
+       { 0x99f4, { 0, 0, 0, 0x000000ff, 0x000000ff } },\
+       { 0x99f8, { 0, 0, 0, 0x00000014, 0x00000014 } },\
+       { 0xa228, { 0, 0, 0, 0x000009b5, 0x000009b5 } },\
+       { 0xa234, { 0, 0, 0, 0x20202020, 0x20202020 } },\
+       { 0xa238, { 0, 0, 0, 0x20202020, 0x20202020 } },\
+       { 0xa23c, { 0, 0, 0, 0x93c889af, 0x93c889af } },\
+       { 0xa24c, { 0, 0, 0, 0x00000001, 0x00000001 } },\
+       { 0xa250, { 0, 0, 0, 0x0000a000, 0x0000a000 } },\
+       { 0xa254, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0xa258, { 0, 0, 0, 0x0cc75380, 0x0cc75380 } },\
+       { 0xa25c, { 0, 0, 0, 0x0f0f0f01, 0x0f0f0f01 } },\
+       { 0xa260, { 0, 0, 0, 0x5f690f01, 0x5f690f01 } },\
+       { 0xa264, { 0, 0, 0, 0x00418a11, 0x00418a11 } },\
+       { 0xa268, { 0, 0, 0, 0x00000000, 0x00000000 } },\
+       { 0xa26c, { 0, 0, 0, 0x0c30c166, 0x0c30c166 } },\
+       { 0xa270, { 0, 0, 0, 0x00820820, 0x00820820 } },\
+       { 0xa274, { 0, 0, 0, 0x081a3caa, 0x081a3caa } },\
+       { 0xa278, { 0, 0, 0, 0x1ce739ce, 0x1ce739ce } },\
+       { 0xa27c, { 0, 0, 0, 0x051701ce, 0x051701ce } },\
+       { 0xa300, { 0, 0, 0, 0x16010000, 0x16010000 } },\
+       { 0xa304, { 0, 0, 0, 0x2c032402, 0x2c032402 } },\
+       { 0xa308, { 0, 0, 0, 0x48433e42, 0x48433e42 } },\
+       { 0xa30c, { 0, 0, 0, 0x5a0f500b, 0x5a0f500b } },\
+       { 0xa310, { 0, 0, 0, 0x6c4b624a, 0x6c4b624a } },\
+       { 0xa314, { 0, 0, 0, 0x7e8b748a, 0x7e8b748a } },\
+       { 0xa318, { 0, 0, 0, 0x96cf8ccb, 0x96cf8ccb } },\
+       { 0xa31c, { 0, 0, 0, 0xa34f9d0f, 0xa34f9d0f } },\
+       { 0xa320, { 0, 0, 0, 0xa7cfa58f, 0xa7cfa58f } },\
+       { 0xa348, { 0, 0, 0, 0x3fffffff, 0x3fffffff } },\
+       { 0xa34c, { 0, 0, 0, 0x3fffffff, 0x3fffffff } },\
+       { 0xa350, { 0, 0, 0, 0x3fffffff, 0x3fffffff } },\
+       { 0xa354, { 0, 0, 0, 0x0003ffff, 0x0003ffff } },\
+       { 0xa358, { 0, 0, 0, 0x79a8aa1f, 0x79a8aa1f } },\
+       { 0xa35c, { 0, 0, 0, 0x066c420f, 0x066c420f } },\
+       { 0xa360, { 0, 0, 0, 0x0f282207, 0x0f282207 } },\
+       { 0xa364, { 0, 0, 0, 0x17601685, 0x17601685 } },\
+       { 0xa368, { 0, 0, 0, 0x1f801104, 0x1f801104 } },\
+       { 0xa36c, { 0, 0, 0, 0x37a00c03, 0x37a00c03 } },\
+       { 0xa370, { 0, 0, 0, 0x3fc40883, 0x3fc40883 } },\
+       { 0xa374, { 0, 0, 0, 0x57c00803, 0x57c00803 } },\
+       { 0xa378, { 0, 0, 0, 0x5fd80682, 0x5fd80682 } },\
+       { 0xa37c, { 0, 0, 0, 0x7fe00482, 0x7fe00482 } },\
+       { 0xa380, { 0, 0, 0, 0x7f3c7bba, 0x7f3c7bba } },\
+       { 0xa384, { 0, 0, 0, 0xf3307ff0, 0xf3307ff0 } },\
+}
+
+#define AR5K_AR5111_INI_BBGAIN {       \
+       { 0x9b00,       0x00000000 },   \
+       { 0x9b04,       0x00000020 },   \
+       { 0x9b08,       0x00000010 },   \
+       { 0x9b0c,       0x00000030 },   \
+       { 0x9b10,       0x00000008 },   \
+       { 0x9b14,       0x00000028 },   \
+       { 0x9b18,       0x00000004 },   \
+       { 0x9b1c,       0x00000024 },   \
+       { 0x9b20,       0x00000014 },   \
+       { 0x9b24,       0x00000034 },   \
+       { 0x9b28,       0x0000000c },   \
+       { 0x9b2c,       0x0000002c },   \
+       { 0x9b30,       0x00000002 },   \
+       { 0x9b34,       0x00000022 },   \
+       { 0x9b38,       0x00000012 },   \
+       { 0x9b3c,       0x00000032 },   \
+       { 0x9b40,       0x0000000a },   \
+       { 0x9b44,       0x0000002a },   \
+       { 0x9b48,       0x00000006 },   \
+       { 0x9b4c,       0x00000026 },   \
+       { 0x9b50,       0x00000016 },   \
+       { 0x9b54,       0x00000036 },   \
+       { 0x9b58,       0x0000000e },   \
+       { 0x9b5c,       0x0000002e },   \
+       { 0x9b60,       0x00000001 },   \
+       { 0x9b64,       0x00000021 },   \
+       { 0x9b68,       0x00000011 },   \
+       { 0x9b6c,       0x00000031 },   \
+       { 0x9b70,       0x00000009 },   \
+       { 0x9b74,       0x00000029 },   \
+       { 0x9b78,       0x00000005 },   \
+       { 0x9b7c,       0x00000025 },   \
+       { 0x9b80,       0x00000015 },   \
+       { 0x9b84,       0x00000035 },   \
+       { 0x9b88,       0x0000000d },   \
+       { 0x9b8c,       0x0000002d },   \
+       { 0x9b90,       0x00000003 },   \
+       { 0x9b94,       0x00000023 },   \
+       { 0x9b98,       0x00000013 },   \
+       { 0x9b9c,       0x00000033 },   \
+       { 0x9ba0,       0x0000000b },   \
+       { 0x9ba4,       0x0000002b },   \
+       { 0x9ba8,       0x0000002b },   \
+       { 0x9bac,       0x0000002b },   \
+       { 0x9bb0,       0x0000002b },   \
+       { 0x9bb4,       0x0000002b },   \
+       { 0x9bb8,       0x0000002b },   \
+       { 0x9bbc,       0x0000002b },   \
+       { 0x9bc0,       0x0000002b },   \
+       { 0x9bc4,       0x0000002b },   \
+       { 0x9bc8,       0x0000002b },   \
+       { 0x9bcc,       0x0000002b },   \
+       { 0x9bd0,       0x0000002b },   \
+       { 0x9bd4,       0x0000002b },   \
+       { 0x9bd8,       0x0000002b },   \
+       { 0x9bdc,       0x0000002b },   \
+       { 0x9be0,       0x0000002b },   \
+       { 0x9be4,       0x0000002b },   \
+       { 0x9be8,       0x0000002b },   \
+       { 0x9bec,       0x0000002b },   \
+       { 0x9bf0,       0x0000002b },   \
+       { 0x9bf4,       0x0000002b },   \
+       { 0x9bf8,       0x00000002 },   \
+       { 0x9bfc,       0x00000016 },   \
+}
+
+#define AR5K_AR5112_INI_BBGAIN {       \
+       { 0x9b00,       0x00000000 },   \
+       { 0x9b04,       0x00000001 },   \
+       { 0x9b08,       0x00000002 },   \
+       { 0x9b0c,       0x00000003 },   \
+       { 0x9b10,       0x00000004 },   \
+       { 0x9b14,       0x00000005 },   \
+       { 0x9b18,       0x00000008 },   \
+       { 0x9b1c,       0x00000009 },   \
+       { 0x9b20,       0x0000000a },   \
+       { 0x9b24,       0x0000000b },   \
+       { 0x9b28,       0x0000000c },   \
+       { 0x9b2c,       0x0000000d },   \
+       { 0x9b30,       0x00000010 },   \
+       { 0x9b34,       0x00000011 },   \
+       { 0x9b38,       0x00000012 },   \
+       { 0x9b3c,       0x00000013 },   \
+       { 0x9b40,       0x00000014 },   \
+       { 0x9b44,       0x00000015 },   \
+       { 0x9b48,       0x00000018 },   \
+       { 0x9b4c,       0x00000019 },   \
+       { 0x9b50,       0x0000001a },   \
+       { 0x9b54,       0x0000001b },   \
+       { 0x9b58,       0x0000001c },   \
+       { 0x9b5c,       0x0000001d },   \
+       { 0x9b60,       0x00000020 },   \
+       { 0x9b64,       0x00000021 },   \
+       { 0x9b68,       0x00000022 },   \
+       { 0x9b6c,       0x00000023 },   \
+       { 0x9b70,       0x00000024 },   \
+       { 0x9b74,       0x00000025 },   \
+       { 0x9b78,       0x00000028 },   \
+       { 0x9b7c,       0x00000029 },   \
+       { 0x9b80,       0x0000002a },   \
+       { 0x9b84,       0x0000002b },   \
+       { 0x9b88,       0x0000002c },   \
+       { 0x9b8c,       0x0000002d },   \
+       { 0x9b90,       0x00000030 },   \
+       { 0x9b94,       0x00000031 },   \
+       { 0x9b98,       0x00000032 },   \
+       { 0x9b9c,       0x00000033 },   \
+       { 0x9ba0,       0x00000034 },   \
+       { 0x9ba4,       0x00000035 },   \
+       { 0x9ba8,       0x00000035 },   \
+       { 0x9bac,       0x00000035 },   \
+       { 0x9bb0,       0x00000035 },   \
+       { 0x9bb4,       0x00000035 },   \
+       { 0x9bb8,       0x00000035 },   \
+       { 0x9bbc,       0x00000035 },   \
+       { 0x9bc0,       0x00000035 },   \
+       { 0x9bc4,       0x00000035 },   \
+       { 0x9bc8,       0x00000035 },   \
+       { 0x9bcc,       0x00000035 },   \
+       { 0x9bd0,       0x00000035 },   \
+       { 0x9bd4,       0x00000035 },   \
+       { 0x9bd8,       0x00000035 },   \
+       { 0x9bdc,       0x00000035 },   \
+       { 0x9be0,       0x00000035 },   \
+       { 0x9be4,       0x00000035 },   \
+       { 0x9be8,       0x00000035 },   \
+       { 0x9bec,       0x00000035 },   \
+       { 0x9bf0,       0x00000035 },   \
+       { 0x9bf4,       0x00000035 },   \
+       { 0x9bf8,       0x00000010 },   \
+       { 0x9bfc,       0x0000001a },   \
+}
+
+#define AR5K_AR5212_PCIE       {       \
+       { 0x4080,       0x9248fc00 },   \
+       { 0x4080,       0x24924924 },   \
+       { 0x4080,       0x28000039 },   \
+       { 0x4080,       0x53160824 },   \
+       { 0x4080,       0xe5980579 },   \
+       { 0x4080,       0x001defff },   \
+       { 0x4080,       0x1aaabe40 },   \
+       { 0x4080,       0xbe105554 },   \
+       { 0x4080,       0x000e3007 },   \
+       { 0x4084,       0x00000000 }    \
 }
 
 #endif /* _AR5K_AR5212_VAR_H */
index 0cc67ed..de05ccf 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar5xxx.c,v 1.50 2008/07/29 00:18:25 reyk Exp $        */
+/*     $OpenBSD: ar5xxx.c,v 1.51 2008/07/30 07:15:39 reyk Exp $        */
 
 /*
  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -95,6 +95,7 @@ HAL_BOOL       ar5k_check_channel(struct ath_hal *, u_int16_t, u_int flags);
 
 HAL_BOOL        ar5k_ar5111_rfregs(struct ath_hal *, HAL_CHANNEL *, u_int);
 HAL_BOOL        ar5k_ar5112_rfregs(struct ath_hal *, HAL_CHANNEL *, u_int);
+HAL_BOOL        ar5k_arxxxx_rfregs(struct ath_hal *, HAL_CHANNEL *, u_int);
 u_int           ar5k_rfregs_op(u_int32_t *, u_int32_t, u_int32_t, u_int32_t,
     u_int32_t, u_int32_t, HAL_BOOL);
 
@@ -118,7 +119,13 @@ static const struct ar5k_gain_opt ar5112_gain_opt = AR5K_AR5112_GAIN_OPT;
 static const struct ar5k_ini_rf ar5111_rf[] = AR5K_AR5111_INI_RF;
 static const struct ar5k_ini_rf ar5112_rf[] = AR5K_AR5112_INI_RF;
 static const struct ar5k_ini_rf ar5112a_rf[] = AR5K_AR5112A_INI_RF;
-static const struct ar5k_ini_rfgain ar5k_rfg[] = AR5K_INI_RFGAIN;
+static const struct ar5k_ini_rf ar5413_rf[] = AR5K_AR5413_INI_RF;
+static const struct ar5k_ini_rf ar2413_rf[] = AR5K_AR2413_INI_RF;
+static const struct ar5k_ini_rf ar2425_rf[] = AR5K_AR2425_INI_RF;
+static const struct ar5k_ini_rfgain ar5111_rfg[] = AR5K_AR5111_INI_RFGAIN;
+static const struct ar5k_ini_rfgain ar5112_rfg[] = AR5K_AR5112_INI_RFGAIN;
+static const struct ar5k_ini_rfgain ar5413_rfg[] = AR5K_AR5413_INI_RFGAIN;
+static const struct ar5k_ini_rfgain ar2413_rfg[] = AR5K_AR2413_INI_RFGAIN;
 
 /*
  * Enable to overwrite the country code (use "00" for debug)
@@ -261,13 +268,6 @@ ath_hal_attach(u_int16_t device, void *arg, bus_space_tag_t st,
                ar5k_rt_copy(&hal->ah_rt_11a, &ar5k_rt_11a);
        if (hal->ah_capabilities.cap_mode & HAL_MODE_11B) {
                ar5k_rt_copy(&hal->ah_rt_11b, &ar5k_rt_11b);
-               /*
-                * XXX Workaround for AR24xx/AR54xx and newer chipsets
-                * XXX to limit 11b operation to 1-2Mbit/s. This
-                * XXX needs to be fixed but allows basic operation for now.
-                */
-               if (hal->ah_pci_express == AH_TRUE)
-                       hal->ah_rt_11b.rateCount = 2;
        } if (hal->ah_capabilities.cap_mode & HAL_MODE_11G)
                ar5k_rt_copy(&hal->ah_rt_11g, &ar5k_rt_11g);
        if (hal->ah_capabilities.cap_mode & HAL_MODE_TURBO)
@@ -290,6 +290,8 @@ ath_hal_attach(u_int16_t device, void *arg, bus_space_tag_t st,
                hal->ah_gain.g_low = 20;
                hal->ah_gain.g_high = 85;
                hal->ah_gain.g_active = 1;
+       } else {
+               /* XXX not needed for newer chipsets? */
        }
 
        *status = HAL_OK;
@@ -1257,20 +1259,6 @@ ar5k_ar5112_channel(struct ath_hal *hal, HAL_CHANNEL *channel)
         * Set the channel on the AR5112 or newer
         */
        if (c < 4800) {
-               /*
-                * XXX Workaround for AR24xx/AR54xx and newer chipsets to
-                * XXX set the 2GHz channels correctly.
-                * XXX This needs to be replaced with a true algorithm
-                * XXX after figuring out how to calculate the Atheros
-                * XXX channel for these chipsets.
-                */
-               if (hal->ah_pci_express == AH_TRUE) {
-                       c += c < 2427 ? -45 :           /* channel 1-3 */
-                           (c < 2447 ? -40 :           /* channel 4-7 */
-                           (c < 2462 ? -35 :           /* channel 8-10 */
-                           (c < 2477 ? -30 : -25)));   /* channel 11-13 */
-               }
-
                if (!((c - 2224) % 5)) {
                        data0 = ((2 * (c - 704)) - 3040) / 10;
                        data1 = 1;
@@ -1491,17 +1479,33 @@ ar5k_rfregs(struct ath_hal *hal, HAL_CHANNEL *channel, u_int mode)
        ar5k_rfgain_t *func = NULL;
        HAL_BOOL ret;
 
-       if (hal->ah_radio == AR5K_AR5111) {
+       switch (hal->ah_radio) {
+       case AR5K_AR5111:
                hal->ah_rf_banks_size = sizeof(ar5111_rf);
                func = ar5k_ar5111_rfregs;
-       } else if (hal->ah_radio == AR5K_AR5112) {
+               break;
+       case AR5K_AR5112:
                if (hal->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A)
                        hal->ah_rf_banks_size = sizeof(ar5112a_rf);
                else
                        hal->ah_rf_banks_size = sizeof(ar5112_rf);
                func = ar5k_ar5112_rfregs;
-       } else
+               break;
+       case AR5K_AR5413:
+               hal->ah_rf_banks_size = sizeof(ar5413_rf);
+               func = ar5k_arxxxx_rfregs;
+               break;
+       case AR5K_AR2413:
+               hal->ah_rf_banks_size = sizeof(ar2413_rf);
+               func = ar5k_arxxxx_rfregs;
+               break;
+       case AR5K_AR2425:
+               hal->ah_rf_banks_size = sizeof(ar2425_rf);
+               func = ar5k_arxxxx_rfregs;
+               break;
+       default:
                return (AH_FALSE);
+       }
 
        if (hal->ah_rf_banks == NULL) {
                /* XXX do extra checks? */
@@ -1703,19 +1707,90 @@ ar5k_ar5112_rfregs(struct ath_hal *hal, HAL_CHANNEL *channel, u_int mode)
 
        /* Write RF values */
        for (i = 0; i < rf_size; i++)
-               AR5K_REG_WRITE(ar5112_rf[i].rf_register, rf[i]);
+               AR5K_REG_WRITE(rf_ini[i].rf_register, rf[i]);
 
        return (AH_TRUE);
 }
 
 HAL_BOOL
-ar5k_rfgain(struct ath_hal *hal, u_int phy, u_int freq)
+ar5k_arxxxx_rfregs(struct ath_hal *hal, HAL_CHANNEL *channel, u_int mode)
 {
-       int i;
+       const struct ar5k_ini_rf        *rf_ini;
+       u_int                            rf_size;
+       u_int32_t                       *rf;
+       int                              i, bank = -1;
+
+       AR5K_ASSERT_ENTRY(mode, AR5K_INI_VAL_MAX);
+
+       rf = hal->ah_rf_banks;
+
+       switch (hal->ah_radio) {
+       case AR5K_AR5413:
+               rf_ini = ar5413_rf;
+               rf_size = AR5K_ELEMENTS(ar5413_rf);
+               break;
+       case AR5K_AR2413:
+               rf_ini = ar2413_rf;
+               rf_size = AR5K_ELEMENTS(ar2413_rf);
+               break;
+       case AR5K_AR2425:
+               if (mode == AR5K_INI_VAL_11B)
+                       mode = AR5K_INI_VAL_11G;
+               rf_ini = ar2425_rf;
+               rf_size = AR5K_ELEMENTS(ar2425_rf);
+               break;
+       default:
+               return (AH_FALSE);
+       }
+
+       /* Copy values to modify them */
+       for (i = 0; i < rf_size; i++) {
+               if (rf_ini[i].rf_bank >= AR5K_MAX_RF_BANKS) {
+                       AR5K_PRINT("invalid bank\n");
+                       return (AH_FALSE);
+               }
+
+               if (bank != rf_ini[i].rf_bank) {
+                       bank = rf_ini[i].rf_bank;
+                       hal->ah_offset[bank] = i;
+               }
+
+               rf[i] = rf_ini[i].rf_value[mode];
+       }
+
+       /* Write RF values */
+       for (i = 0; i < rf_size; i++)
+               AR5K_REG_WRITE(rf_ini[i].rf_register, rf[i]);
 
-       switch (phy) {
-       case AR5K_INI_PHY_5111:
-       case AR5K_INI_PHY_5112:
+       return (AH_TRUE);
+}
+
+HAL_BOOL
+ar5k_rfgain(struct ath_hal *hal, u_int freq)
+{
+       const struct ar5k_ini_rfgain    *rfg;
+       size_t                           rfg_size;
+       int                              i;
+
+       switch (hal->ah_radio) {
+       case AR5K_AR5111:
+               rfg = ar5111_rfg;
+               rfg_size = AR5K_ELEMENTS(ar5111_rfg);
+               break;
+       case AR5K_AR5112:
+               rfg = ar5112_rfg;
+               rfg_size = AR5K_ELEMENTS(ar5112_rfg);
+               break;
+       case AR5K_AR5413:
+               rfg = ar5413_rfg;
+               rfg_size = AR5K_ELEMENTS(ar5413_rfg);
+               break;
+       case AR5K_AR2413:
+       case AR5K_AR2425:
+               if (freq == AR5K_INI_RFGAIN_5GHZ)
+                       return (AH_FALSE);
+               rfg = ar2413_rfg;
+               rfg_size = AR5K_ELEMENTS(ar2413_rfg);
                break;
        default:
                return (AH_FALSE);
@@ -1729,10 +1804,10 @@ ar5k_rfgain(struct ath_hal *hal, u_int phy, u_int freq)
                return (AH_FALSE);
        }
 
-       for (i = 0; i < AR5K_ELEMENTS(ar5k_rfg); i++) {
+       for (i = 0; i < rfg_size; i++) {
                AR5K_REG_WAIT(i);
-               AR5K_REG_WRITE((u_int32_t)ar5k_rfg[i].rfg_register,
-                   ar5k_rfg[i].rfg_value[phy][freq]);
+               AR5K_REG_WRITE((u_int32_t)rfg[i].rfg_register,
+                   rfg[i].rfg_value[freq]);
        }
 
        return (AH_TRUE);
@@ -1776,3 +1851,41 @@ ar5k_txpower_table(struct ath_hal *hal, HAL_CHANNEL *channel, int16_t max_power)
                    min;
 #endif
 }
+
+void
+ar5k_write_ini(struct ath_hal *hal, const struct ar5k_ini *ini,
+    size_t n, HAL_BOOL change_channel)
+{
+       u_int    i;
+
+       for (i = 0; i < n; i++) {
+               if (change_channel == AH_TRUE &&
+                   ini[i].ini_register >= AR5K_PCU_MIN &&
+                   ini[i].ini_register <= AR5K_PCU_MAX)
+                       continue;
+               switch (ini[i].ini_mode) {
+               case AR5K_INI_READ:
+                       /* cleared on read */
+                       AR5K_REG_READ((u_int32_t)ini[i].ini_register);
+                       break;
+               case AR5K_INI_WRITE:
+                       AR5K_REG_WAIT(i);
+                       AR5K_REG_WRITE((u_int32_t)ini[i].ini_register,
+                           ini[i].ini_value);
+                       break;
+               }
+       }
+}
+
+void
+ar5k_write_mode(struct ath_hal *hal, const struct ar5k_mode *ini,
+    size_t n, u_int mode)
+{
+       u_int    i;
+
+       for (i = 0; i < n; i++) {
+               AR5K_REG_WAIT(i);
+               AR5K_REG_WRITE((u_int32_t)ini[i].mode_register,
+                   ini[i].mode_value[mode]);
+       }
+}
index b632e11..9ddfe67 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ar5xxx.h,v 1.43 2008/07/29 00:18:25 reyk Exp $        */
+/*     $OpenBSD: ar5xxx.h,v 1.44 2008/07/30 07:15:39 reyk Exp $        */
 
 /*
  * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -74,6 +74,9 @@ enum ar5k_radio {
        AR5K_AR5110     = 0,
        AR5K_AR5111     = 1,
        AR5K_AR5112     = 2,
+       AR5K_AR2413     = 3,
+       AR5K_AR5413     = 4,
+       AR5K_AR2425     = 5
 };
 
 /*
@@ -1128,7 +1131,9 @@ struct ath_hal {
 
        enum ar5k_version       ah_version;
        enum ar5k_radio         ah_radio;
+
        u_int32_t               ah_phy;
+       u_int32_t               ah_phy_spending;
 
        HAL_BOOL                ah_5ghz;
        HAL_BOOL                ah_2ghz;
@@ -1226,9 +1231,9 @@ struct ar5k_srev_name {
        { "5112a",      AR5K_VERSION_RAD,       AR5K_SREV_RAD_5112A },  \
        { "2112",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2112 },   \
        { "2112a",      AR5K_VERSION_RAD,       AR5K_SREV_RAD_2112A },  \
-       { "2413",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_2413 },   \
-       { "2414",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5413 },   \
-       { "5424",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_5424 },   \
+       { "2413",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_SC0 },    \
+       { "2414",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_SC1 },    \
+       { "5424",       AR5K_VERSION_RAD,       AR5K_SREV_RAD_SC2 },    \
        { "xxxx",       AR5K_VERSION_RAD,       AR5K_SREV_UNKNOWN },    \
        { "2413",       AR5K_VERSION_DEV,       AR5K_DEVID_AR2413 },    \
        { "5413",       AR5K_VERSION_DEV,       AR5K_DEVID_AR5413 },    \
@@ -1265,9 +1270,9 @@ struct ar5k_srev_name {
 #define AR5K_SREV_RAD_5112A    0x35
 #define AR5K_SREV_RAD_2112     0x40
 #define AR5K_SREV_RAD_2112A    0x45
-#define AR5K_SREV_RAD_2413     0x56
-#define AR5K_SREV_RAD_5413     0x63
-#define AR5K_SREV_RAD_5424     0xa2
+#define AR5K_SREV_RAD_SC0      0x56
+#define AR5K_SREV_RAD_SC1      0x63
+#define AR5K_SREV_RAD_SC2      0xa2
 #define AR5K_SREV_RAD_5133     0xc0
 #define AR5K_SREV_RAD_UNSUPP   0xff
 
@@ -1479,6 +1484,9 @@ struct ar5k_ini {
        } ini_mode;
 };
 
+#define AR5K_PCU_MIN           0x8000
+#define AR5K_PCU_MAX           0x8fff
+
 #define AR5K_INI_VAL_11A       0
 #define AR5K_INI_VAL_11A_TURBO 1
 #define AR5K_INI_VAL_11B       2
@@ -1487,6 +1495,11 @@ struct ar5k_ini {
 #define AR5K_INI_VAL_XR                0
 #define AR5K_INI_VAL_MAX       5
 
+struct ar5k_mode {
+       u_int16_t       mode_register;
+       u_int32_t       mode_value[AR5K_INI_VAL_MAX];
+};
+
 #define AR5K_INI_PHY_5111      0
 #define AR5K_INI_PHY_5112      1
 #define AR5K_INI_PHY_511X      1
@@ -1819,143 +1832,445 @@ struct ar5k_ini_rf {
            { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },   \
 }
 
+#define AR5K_AR5413_INI_RF     {                                               \
+       { 1, 0x98d4,                                                            \
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },   \
+       { 2, 0x98d0,                                                            \
+           { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },   \
+       { 3, 0x98dc,                                                            \
+           { 0x00a000c0, 0x00a000c0, 0x00e000c0, 0x00e000c0, 0x00e000c0 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x33000000, 0x33000000, 0x33000000, 0x33000000, 0x33000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00610000, 0x00610000, 0x00610000, 0x00610000, 0x00610000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00440000, 0x00440000, 0x00440000, 0x00440000, 0x00440000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00100080, 0x00100080, 0x00100080, 0x00100080, 0x00100080 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00510040, 0x00510040, 0x005100a0, 0x005100a0, 0x005100a0 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x0050006a, 0x0050006a, 0x005000dd, 0x005000dd, 0x005000dd } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00004044, 0x00004044, 0x00004044, 0x00004044, 0x00004044 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0 } },   \
+       { 6, 0x989c,                                                            \
+           { 0x00002c00, 0x00002c00, 0x00003600, 0x00003600, 0x00003600 } },   \
+       { 6, 0x98c8,                                                            \
+           { 0x00000403, 0x00000403, 0x00040403, 0x00040403, 0x00040403 } },   \
+       { 7, 0x989c,                                                            \
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },   \
+       { 7, 0x989c,                                                            \
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },   \
+       { 7, 0x98cc,                                                            \
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },   \
+}
+
+#define AR5K_AR2413_INI_RF     {                                               \
+       { 1, 0x98d4, { 0, 0, 0x00000020, 0x00000020, 0x00000020 } },            \
+       { 2, 0x98d0, { 0, 0, 0x02001408, 0x02001408, 0x02001408 } },            \
+       { 3, 0x98dc, { 0, 0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },            \
+       { 6, 0x989c, { 0, 0, 0xf0000000, 0xf0000000, 0xf0000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x03000000, 0x03000000, 0x03000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x40400000, 0x40400000, 0x40400000 } },            \
+       { 6, 0x989c, { 0, 0, 0x65050000, 0x65050000, 0x65050000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00420000, 0x00420000, 0x00420000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00b50000, 0x00b50000, 0x00b50000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00030000, 0x00030000, 0x00030000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00f70000, 0x00f70000, 0x00f70000 } },            \
+       { 6, 0x989c, { 0, 0, 0x009d0000, 0x009d0000, 0x009d0000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00220000, 0x00220000, 0x00220000 } },            \
+       { 6, 0x989c, { 0, 0, 0x04220000, 0x04220000, 0x04220000 } },            \
+       { 6, 0x989c, { 0, 0, 0x00230018, 0x00230018, 0x00230018 } },            \
+       { 6, 0x989c, { 0, 0, 0x00280050, 0x00280050, 0x00280050 } },            \
+       { 6, 0x989c, { 0, 0, 0x005000c3, 0x005000c3, 0x005000c3 } },            \
+       { 6, 0x989c, { 0, 0, 0x0004007f, 0x0004007f, 0x0004007f } },            \
+       { 6, 0x989c, { 0, 0, 0x00000458, 0x00000458, 0x00000458 } },            \
+       { 6, 0x989c, { 0, 0, 0x00000000, 0x00000000, 0x00000000 } },            \
+       { 6, 0x989c, { 0, 0, 0x0000c000, 0x0000c000, 0x0000c000 } },            \
+       { 6, 0x98d8, { 0, 0, 0x00400230, 0x00400230, 0x00400230 } },            \
+       { 7, 0x989c, { 0, 0, 0x00006400, 0x00006400, 0x00006400 } },            \
+       { 7, 0x989c, { 0, 0, 0x00000800, 0x00000800, 0x00000800 } },            \
+       { 7, 0x98cc, { 0, 0, 0x0000000e, 0x0000000e, 0x0000000e } },            \
+}
+
+#define AR5K_AR2425_INI_RF     {                                               \
+       { 1, 0x98d4, { 0, 0, 0, 0x00000020, 0x00000020 } },                     \
+       { 2, 0x98d0, { 0, 0, 0, 0x02001408, 0x02001408 } },                     \
+       { 3, 0x98dc, { 0, 0, 0, 0x00e020c0, 0x00e020c0 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x10000000, 0x10000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x002a0000, 0x002a0000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00100000, 0x00100000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00020000, 0x00020000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00730000, 0x00730000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00f80000, 0x00f80000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00e70000, 0x00e70000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00140000, 0x00140000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00910040, 0x00910040 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x0007001a, 0x0007001a } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00410000, 0x00410000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00810060, 0x00810060 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00020803, 0x00020803 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00000000, 0x00000000 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00001660, 0x00001660 } },                     \
+       { 6, 0x989c, { 0, 0, 0, 0x00001688, 0x00001688 } },                     \
+       { 6, 0x98c4, { 0, 0, 0, 0x00000001, 0x00000001 } },                     \
+       { 7, 0x989c, { 0, 0, 0, 0x00006400, 0x00006400 } },                     \
+       { 7, 0x989c, { 0, 0, 0, 0x00000800, 0x00000800 } },                     \
+       { 7, 0x98cc, { 0, 0, 0, 0x0000000e, 0x0000000e } }                      \
+}
+
 struct ar5k_ini_rfgain {
        u_int16_t       rfg_register;
-       u_int32_t       rfg_value[2][2];
+       u_int32_t       rfg_value[2];
 
 #define AR5K_INI_RFGAIN_5GHZ   0
 #define AR5K_INI_RFGAIN_2GHZ   1
+#define AR5K_INI_RFGAIN(_n)    (0x9a00 + ((_n) << 2))
 };
 
-#define AR5K_INI_RFGAIN        {                                                       \
-       { 0x9a00, {                                                             \
-               { 0x000001a9, 0x00000000 }, { 0x00000007, 0x00000007 } } },     \
-       { 0x9a04, {                                                             \
-               { 0x000001e9, 0x00000040 }, { 0x00000047, 0x00000047 } } },     \
-       { 0x9a08, {                                                             \
-               { 0x00000029, 0x00000080 }, { 0x00000087, 0x00000087 } } },     \
-       { 0x9a0c, {                                                             \
-               { 0x00000069, 0x00000150 }, { 0x000001a0, 0x000001a0 } } },     \
-       { 0x9a10, {                                                             \
-               { 0x00000199, 0x00000190 }, { 0x000001e0, 0x000001e0 } } },     \
-       { 0x9a14, {                                                             \
-               { 0x000001d9, 0x000001d0 }, { 0x00000020, 0x00000020 } } },     \
-       { 0x9a18, {                                                             \
-               { 0x00000019, 0x00000010 }, { 0x00000060, 0x00000060 } } },     \
-       { 0x9a1c, {                                                             \
-               { 0x00000059, 0x00000044 }, { 0x000001a1, 0x000001a1 } } },     \
-       { 0x9a20, {                                                             \
-               { 0x00000099, 0x00000084 }, { 0x000001e1, 0x000001e1 } } },     \
-       { 0x9a24, {                                                             \
-               { 0x000001a5, 0x00000148 }, { 0x00000021, 0x00000021 } } },     \
-       { 0x9a28, {                                                             \
-               { 0x000001e5, 0x00000188 }, { 0x00000061, 0x00000061 } } },     \
-       { 0x9a2c, {                                                             \
-               { 0x00000025, 0x000001c8 }, { 0x00000162, 0x00000162 } } },     \
-       { 0x9a30, {                                                             \
-               { 0x000001c8, 0x00000014 }, { 0x000001a2, 0x000001a2 } } },     \
-       { 0x9a34, {                                                             \
-               { 0x00000008, 0x00000042 }, { 0x000001e2, 0x000001e2 } } },     \
-       { 0x9a38, {                                                             \
-               { 0x00000048, 0x00000082 }, { 0x00000022, 0x00000022 } } },     \
-       { 0x9a3c, {                                                             \
-               { 0x00000088, 0x00000178 }, { 0x00000062, 0x00000062 } } },     \
-       { 0x9a40, {                                                             \
-               { 0x00000198, 0x000001b8 }, { 0x00000163, 0x00000163 } } },     \
-       { 0x9a44, {                                                             \
-               { 0x000001d8, 0x000001f8 }, { 0x000001a3, 0x000001a3 } } },     \
-       { 0x9a48, {                                                             \
-               { 0x00000018, 0x00000012 }, { 0x000001e3, 0x000001e3 } } },     \
-       { 0x9a4c, {                                                             \
-               { 0x00000058, 0x00000052 }, { 0x00000023, 0x00000023 } } },     \
-       { 0x9a50, {                                                             \
-               { 0x00000098, 0x00000092 }, { 0x00000063, 0x00000063 } } },     \
-       { 0x9a54, {                                                             \
-               { 0x000001a4, 0x0000017c }, { 0x00000184, 0x00000184 } } },     \
-       { 0x9a58, {                                                             \
-               { 0x000001e4, 0x000001bc }, { 0x000001c4, 0x000001c4 } } },     \
-       { 0x9a5c, {                                                             \
-               { 0x00000024, 0x000001fc }, { 0x00000004, 0x00000004 } } },     \
-       { 0x9a60, {                                                             \
-               { 0x00000064, 0x0000000a }, { 0x000001ea, 0x0000000b } } },     \
-       { 0x9a64, {                                                             \
-               { 0x000000a4, 0x0000004a }, { 0x0000002a, 0x0000004b } } },     \
-       { 0x9a68, {                                                             \
-               { 0x000000e4, 0x0000008a }, { 0x0000006a, 0x0000008b } } },     \
-       { 0x9a6c, {                                                             \
-               { 0x0000010a, 0x0000015a }, { 0x000000aa, 0x000001ac } } },     \
-       { 0x9a70, {                                                             \
-               { 0x0000014a, 0x0000019a }, { 0x000001ab, 0x000001ec } } },     \
-       { 0x9a74, {                                                             \
-               { 0x0000018a, 0x000001da }, { 0x000001eb, 0x0000002c } } },     \
-       { 0x9a78, {                                                             \
-               { 0x000001ca, 0x0000000e }, { 0x0000002b, 0x00000012 } } },     \
-       { 0x9a7c, {                                                             \
-               { 0x0000000a, 0x0000004e }, { 0x0000006b, 0x00000052 } } },     \
-       { 0x9a80, {                                                             \
-               { 0x0000004a, 0x0000008e }, { 0x000000ab, 0x00000092 } } },     \
-       { 0x9a84, {                                                             \
-               { 0x0000008a, 0x0000015e }, { 0x000001ac, 0x00000193 } } },     \
-       { 0x9a88, {                                                             \
-               { 0x000001ba, 0x0000019e }, { 0x000001ec, 0x000001d3 } } },     \
-       { 0x9a8c, {                                                             \
-               { 0x000001fa, 0x000001de }, { 0x0000002c, 0x00000013 } } },     \
-       { 0x9a90, {                                                             \
-               { 0x0000003a, 0x00000009 }, { 0x0000003a, 0x00000053 } } },     \
-       { 0x9a94, {                                                             \
-               { 0x0000007a, 0x00000049 }, { 0x0000007a, 0x00000093 } } },     \
-       { 0x9a98, {                                                             \
-               { 0x00000186, 0x00000089 }, { 0x000000ba, 0x00000194 } } },     \
-       { 0x9a9c, {                                                             \
-               { 0x000001c6, 0x00000179 }, { 0x000001bb, 0x000001d4 } } },     \
-       { 0x9aa0, {                                                             \
-               { 0x00000006, 0x000001b9 }, { 0x000001fb, 0x00000014 } } },     \
-       { 0x9aa4, {                                                             \
-               { 0x00000046, 0x000001f9 }, { 0x0000003b, 0x0000003a } } },     \
-       { 0x9aa8, {                                                             \
-               { 0x00000086, 0x00000039 }, { 0x0000007b, 0x0000007a } } },     \
-       { 0x9aac, {                                                             \
-               { 0x000000c6, 0x00000079 }, { 0x000000bb, 0x000000ba } } },     \
-       { 0x9ab0, {                                                             \
-               { 0x000000c6, 0x000000b9 }, { 0x000001bc, 0x000001bb } } },     \
-       { 0x9ab4, {                                                             \
-               { 0x000000c6, 0x000001bd }, { 0x000001fc, 0x000001fb } } },     \
-       { 0x9ab8, {                                                             \
-               { 0x000000c6, 0x000001fd }, { 0x0000003c, 0x0000003b } } },     \
-       { 0x9abc, {                                                             \
-               { 0x000000c6, 0x0000003d }, { 0x0000007c, 0x0000007b } } },     \
-       { 0x9ac0, {                                                             \
-               { 0x000000c6, 0x0000007d }, { 0x000000bc, 0x000000bb } } },     \
-       { 0x9ac4, {                                                             \
-               { 0x000000c6, 0x000000bd }, { 0x000000fc, 0x000001bc } } },     \
-       { 0x9ac8, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000001fc } } },     \
-       { 0x9acc, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x0000003c } } },     \
-       { 0x9ad0, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x0000007c } } },     \
-       { 0x9ad4, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000bc } } },     \
-       { 0x9ad8, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9adc, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9ae0, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9ae4, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9ae8, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9aec, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9af0, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9af4, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9af8, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
-       { 0x9afc, {                                                             \
-               { 0x000000c6, 0x000000fd }, { 0x000000fc, 0x000000fc } } },     \
+#define AR5K_AR5111_INI_RFGAIN {                               \
+       { AR5K_INI_RFGAIN(0),   { 0x000001a9, 0x00000000 } },   \
+       { AR5K_INI_RFGAIN(1),   { 0x000001e9, 0x00000040 } },   \
+       { AR5K_INI_RFGAIN(2),   { 0x00000029, 0x00000080 } },   \
+       { AR5K_INI_RFGAIN(3),   { 0x00000069, 0x00000150 } },   \
+       { AR5K_INI_RFGAIN(4),   { 0x00000199, 0x00000190 } },   \
+       { AR5K_INI_RFGAIN(5),   { 0x000001d9, 0x000001d0 } },   \
+       { AR5K_INI_RFGAIN(6),   { 0x00000019, 0x00000010 } },   \
+       { AR5K_INI_RFGAIN(7),   { 0x00000059, 0x00000044 } },   \
+       { AR5K_INI_RFGAIN(8),   { 0x00000099, 0x00000084 } },   \
+       { AR5K_INI_RFGAIN(9),   { 0x000001a5, 0x00000148 } },   \
+       { AR5K_INI_RFGAIN(10),  { 0x000001e5, 0x00000188 } },   \
+       { AR5K_INI_RFGAIN(11),  { 0x00000025, 0x000001c8 } },   \
+       { AR5K_INI_RFGAIN(12),  { 0x000001c8, 0x00000014 } },   \
+       { AR5K_INI_RFGAIN(13),  { 0x00000008, 0x00000042 } },   \
+       { AR5K_INI_RFGAIN(14),  { 0x00000048, 0x00000082 } },   \
+       { AR5K_INI_RFGAIN(15),  { 0x00000088, 0x00000178 } },   \
+       { AR5K_INI_RFGAIN(16),  { 0x00000198, 0x000001b8 } },   \
+       { AR5K_INI_RFGAIN(17),  { 0x000001d8, 0x000001f8 } },   \
+       { AR5K_INI_RFGAIN(18),  { 0x00000018, 0x00000012 } },   \
+       { AR5K_INI_RFGAIN(19),  { 0x00000058, 0x00000052 } },   \
+       { AR5K_INI_RFGAIN(20),  { 0x00000098, 0x00000092 } },   \
+       { AR5K_INI_RFGAIN(21),  { 0x000001a4, 0x0000017c } },   \
+       { AR5K_INI_RFGAIN(22),  { 0x000001e4, 0x000001bc } },   \
+       { AR5K_INI_RFGAIN(23),  { 0x00000024, 0x000001fc } },   \
+       { AR5K_INI_RFGAIN(24),  { 0x00000064, 0x0000000a } },   \
+       { AR5K_INI_RFGAIN(25),  { 0x000000a4, 0x0000004a } },   \
+       { AR5K_INI_RFGAIN(26),  { 0x000000e4, 0x0000008a } },   \
+       { AR5K_INI_RFGAIN(27),  { 0x0000010a, 0x0000015a } },   \
+       { AR5K_INI_RFGAIN(28),  { 0x0000014a, 0x0000019a } },   \
+       { AR5K_INI_RFGAIN(29),  { 0x0000018a, 0x000001da } },   \
+       { AR5K_INI_RFGAIN(30),  { 0x000001ca, 0x0000000e } },   \
+       { AR5K_INI_RFGAIN(31),  { 0x0000000a, 0x0000004e } },   \
+       { AR5K_INI_RFGAIN(32),  { 0x0000004a, 0x0000008e } },   \
+       { AR5K_INI_RFGAIN(33),  { 0x0000008a, 0x0000015e } },   \
+       { AR5K_INI_RFGAIN(34),  { 0x000001ba, 0x0000019e } },   \
+       { AR5K_INI_RFGAIN(35),  { 0x000001fa, 0x000001de } },   \
+       { AR5K_INI_RFGAIN(36),  { 0x0000003a, 0x00000009 } },   \
+       { AR5K_INI_RFGAIN(37),  { 0x0000007a, 0x00000049 } },   \
+       { AR5K_INI_RFGAIN(38),  { 0x00000186, 0x00000089 } },   \
+       { AR5K_INI_RFGAIN(39),  { 0x000001c6, 0x00000179 } },   \
+       { AR5K_INI_RFGAIN(40),  { 0x00000006, 0x000001b9 } },   \
+       { AR5K_INI_RFGAIN(41),  { 0x00000046, 0x000001f9 } },   \
+       { AR5K_INI_RFGAIN(42),  { 0x00000086, 0x00000039 } },   \
+       { AR5K_INI_RFGAIN(43),  { 0x000000c6, 0x00000079 } },   \
+       { AR5K_INI_RFGAIN(44),  { 0x000000c6, 0x000000b9 } },   \
+       { AR5K_INI_RFGAIN(45),  { 0x000000c6, 0x000001bd } },   \
+       { AR5K_INI_RFGAIN(46),  { 0x000000c6, 0x000001fd } },   \
+       { AR5K_INI_RFGAIN(47),  { 0x000000c6, 0x0000003d } },   \
+       { AR5K_INI_RFGAIN(48),  { 0x000000c6, 0x0000007d } },   \
+       { AR5K_INI_RFGAIN(49),  { 0x000000c6, 0x000000bd } },   \
+       { AR5K_INI_RFGAIN(50),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(51),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(52),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(53),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(54),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(55),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(56),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(57),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(58),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(59),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(60),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(61),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(62),  { 0x000000c6, 0x000000fd } },   \
+       { AR5K_INI_RFGAIN(63),  { 0x000000c6, 0x000000fd } }    \
+}
+
+#define AR5K_AR5112_INI_RFGAIN {                               \
+       { AR5K_INI_RFGAIN(0),   { 0x00000007, 0x00000007 } },   \
+       { AR5K_INI_RFGAIN(1),   { 0x00000047, 0x00000047 } },   \
+       { AR5K_INI_RFGAIN(2),   { 0x00000087, 0x00000087 } },   \
+       { AR5K_INI_RFGAIN(3),   { 0x000001a0, 0x000001a0 } },   \
+       { AR5K_INI_RFGAIN(4),   { 0x000001e0, 0x000001e0 } },   \
+       { AR5K_INI_RFGAIN(5),   { 0x00000020, 0x00000020 } },   \
+       { AR5K_INI_RFGAIN(6),   { 0x00000060, 0x00000060 } },   \
+       { AR5K_INI_RFGAIN(7),   { 0x000001a1, 0x000001a1 } },   \
+       { AR5K_INI_RFGAIN(8),   { 0x000001e1, 0x000001e1 } },   \
+       { AR5K_INI_RFGAIN(9),   { 0x00000021, 0x00000021 } },   \
+       { AR5K_INI_RFGAIN(10),  { 0x00000061, 0x00000061 } },   \
+       { AR5K_INI_RFGAIN(11),  { 0x00000162, 0x00000162 } },   \
+       { AR5K_INI_RFGAIN(12),  { 0x000001a2, 0x000001a2 } },   \
+       { AR5K_INI_RFGAIN(13),  { 0x000001e2, 0x000001e2 } },   \
+       { AR5K_INI_RFGAIN(14),  { 0x00000022, 0x00000022 } },   \
+       { AR5K_INI_RFGAIN(15),  { 0x00000062, 0x00000062 } },   \
+       { AR5K_INI_RFGAIN(16),  { 0x00000163, 0x00000163 } },   \
+       { AR5K_INI_RFGAIN(17),  { 0x000001a3, 0x000001a3 } },   \
+       { AR5K_INI_RFGAIN(18),  { 0x000001e3, 0x000001e3 } },   \
+       { AR5K_INI_RFGAIN(19),  { 0x00000023, 0x00000023 } },   \
+       { AR5K_INI_RFGAIN(20),  { 0x00000063, 0x00000063 } },   \
+       { AR5K_INI_RFGAIN(21),  { 0x00000184, 0x00000184 } },   \
+       { AR5K_INI_RFGAIN(22),  { 0x000001c4, 0x000001c4 } },   \
+       { AR5K_INI_RFGAIN(23),  { 0x00000004, 0x00000004 } },   \
+       { AR5K_INI_RFGAIN(24),  { 0x000001ea, 0x0000000b } },   \
+       { AR5K_INI_RFGAIN(25),  { 0x0000002a, 0x0000004b } },   \
+       { AR5K_INI_RFGAIN(26),  { 0x0000006a, 0x0000008b } },   \
+       { AR5K_INI_RFGAIN(27),  { 0x000000aa, 0x000001ac } },   \
+       { AR5K_INI_RFGAIN(28),  { 0x000001ab, 0x000001ec } },   \
+       { AR5K_INI_RFGAIN(29),  { 0x000001eb, 0x0000002c } },   \
+       { AR5K_INI_RFGAIN(30),  { 0x0000002b, 0x00000012 } },   \
+       { AR5K_INI_RFGAIN(31),  { 0x0000006b, 0x00000052 } },   \
+       { AR5K_INI_RFGAIN(32),  { 0x000000ab, 0x00000092 } },   \
+       { AR5K_INI_RFGAIN(33),  { 0x000001ac, 0x00000193 } },   \
+       { AR5K_INI_RFGAIN(34),  { 0x000001ec, 0x000001d3 } },   \
+       { AR5K_INI_RFGAIN(35),  { 0x0000002c, 0x00000013 } },   \
+       { AR5K_INI_RFGAIN(36),  { 0x0000003a, 0x00000053 } },   \
+       { AR5K_INI_RFGAIN(37),  { 0x0000007a, 0x00000093 } },   \
+       { AR5K_INI_RFGAIN(38),  { 0x000000ba, 0x00000194 } },   \
+       { AR5K_INI_RFGAIN(39),  { 0x000001bb, 0x000001d4 } },   \
+       { AR5K_INI_RFGAIN(40),  { 0x000001fb, 0x00000014 } },   \
+       { AR5K_INI_RFGAIN(41),  { 0x0000003b, 0x0000003a } },   \
+       { AR5K_INI_RFGAIN(42),  { 0x0000007b, 0x0000007a } },   \
+       { AR5K_INI_RFGAIN(43),  { 0x000000bb, 0x000000ba } },   \
+       { AR5K_INI_RFGAIN(44),  { 0x000001bc, 0x000001bb } },   \
+       { AR5K_INI_RFGAIN(45),  { 0x000001fc, 0x000001fb } },   \
+       { AR5K_INI_RFGAIN(46),  { 0x0000003c, 0x0000003b } },   \
+       { AR5K_INI_RFGAIN(47),  { 0x0000007c, 0x0000007b } },   \
+       { AR5K_INI_RFGAIN(48),  { 0x000000bc, 0x000000bb } },   \
+       { AR5K_INI_RFGAIN(49),  { 0x000000fc, 0x000001bc } },   \
+       { AR5K_INI_RFGAIN(50),  { 0x000000fc, 0x000001fc } },   \
+       { AR5K_INI_RFGAIN(51),  { 0x000000fc, 0x0000003c } },   \
+       { AR5K_INI_RFGAIN(52),  { 0x000000fc, 0x0000007c } },   \
+       { AR5K_INI_RFGAIN(53),  { 0x000000fc, 0x000000bc } },   \
+       { AR5K_INI_RFGAIN(54),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(55),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(56),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(57),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(58),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(59),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(60),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(61),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(62),  { 0x000000fc, 0x000000fc } },   \
+       { AR5K_INI_RFGAIN(63),  { 0x000000fc, 0x000000fc } },   \
+}
+
+#define AR5K_AR5413_INI_RFGAIN {                               \
+       { AR5K_INI_RFGAIN(0),   { 0x00000000, 0x00000000 } },   \
+       { AR5K_INI_RFGAIN(1),   { 0x00000040, 0x00000040 } },   \
+       { AR5K_INI_RFGAIN(2),   { 0x00000080, 0x00000080 } },   \
+       { AR5K_INI_RFGAIN(3),   { 0x000001a1, 0x00000161 } },   \
+       { AR5K_INI_RFGAIN(4),   { 0x000001e1, 0x000001a1 } },   \
+       { AR5K_INI_RFGAIN(5),   { 0x00000021, 0x000001e1 } },   \
+       { AR5K_INI_RFGAIN(6),   { 0x00000061, 0x00000021 } },   \
+       { AR5K_INI_RFGAIN(7),   { 0x00000188, 0x00000061 } },   \
+       { AR5K_INI_RFGAIN(8),   { 0x000001c8, 0x00000188 } },   \
+       { AR5K_INI_RFGAIN(9),   { 0x00000008, 0x000001c8 } },   \
+       { AR5K_INI_RFGAIN(10),  { 0x00000048, 0x00000008 } },   \
+       { AR5K_INI_RFGAIN(11),  { 0x00000088, 0x00000048 } },   \
+       { AR5K_INI_RFGAIN(12),  { 0x000001a9, 0x00000088 } },   \
+       { AR5K_INI_RFGAIN(13),  { 0x000001e9, 0x00000169 } },   \
+       { AR5K_INI_RFGAIN(14),  { 0x00000029, 0x000001a9 } },   \
+       { AR5K_INI_RFGAIN(15),  { 0x00000069, 0x000001e9 } },   \
+       { AR5K_INI_RFGAIN(16),  { 0x000001d0, 0x00000029 } },   \
+       { AR5K_INI_RFGAIN(17),  { 0x00000010, 0x00000069 } },   \
+       { AR5K_INI_RFGAIN(18),  { 0x00000050, 0x00000190 } },   \
+       { AR5K_INI_RFGAIN(19),  { 0x00000090, 0x000001d0 } },   \
+       { AR5K_INI_RFGAIN(20),  { 0x000001b1, 0x00000010 } },   \
+       { AR5K_INI_RFGAIN(21),  { 0x000001f1, 0x00000050 } },   \
+       { AR5K_INI_RFGAIN(22),  { 0x00000031, 0x00000090 } },   \
+       { AR5K_INI_RFGAIN(23),  { 0x00000071, 0x00000171 } },   \
+       { AR5K_INI_RFGAIN(24),  { 0x000001b8, 0x000001b1 } },   \
+       { AR5K_INI_RFGAIN(25),  { 0x000001f8, 0x000001f1 } },   \
+       { AR5K_INI_RFGAIN(26),  { 0x00000038, 0x00000031 } },   \
+       { AR5K_INI_RFGAIN(27),  { 0x00000078, 0x00000071 } },   \
+       { AR5K_INI_RFGAIN(28),  { 0x00000199, 0x00000198 } },   \
+       { AR5K_INI_RFGAIN(29),  { 0x000001d9, 0x000001d8 } },   \
+       { AR5K_INI_RFGAIN(30),  { 0x00000019, 0x00000018 } },   \
+       { AR5K_INI_RFGAIN(31),  { 0x00000059, 0x00000058 } },   \
+       { AR5K_INI_RFGAIN(32),  { 0x00000099, 0x00000098 } },   \
+       { AR5K_INI_RFGAIN(33),  { 0x000000d9, 0x00000179 } },   \
+       { AR5K_INI_RFGAIN(34),  { 0x000000f9, 0x000001b9 } },   \
+       { AR5K_INI_RFGAIN(35),  { 0x000000f9, 0x000001f9 } },   \
+       { AR5K_INI_RFGAIN(36),  { 0x000000f9, 0x00000039 } },   \
+       { AR5K_INI_RFGAIN(37),  { 0x000000f9, 0x00000079 } },   \
+       { AR5K_INI_RFGAIN(38),  { 0x000000f9, 0x000000b9 } },   \
+       { AR5K_INI_RFGAIN(39),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(40),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(41),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(42),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(43),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(44),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(45),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(46),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(47),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(48),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(49),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(50),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(51),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(52),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(53),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(54),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(55),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(56),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(57),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(58),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(59),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(60),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(61),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(62),  { 0x000000f9, 0x000000f9 } },   \
+       { AR5K_INI_RFGAIN(63),  { 0x000000f9, 0x000000f9 } }    \
+}
+
+#define AR5K_AR2413_INI_RFGAIN {                               \
+       { AR5K_INI_RFGAIN(0),   { 0, 0x00000000 } },            \
+       { AR5K_INI_RFGAIN(1),   { 0, 0x00000040 } },            \
+       { AR5K_INI_RFGAIN(2),   { 0, 0x00000080 } },            \
+       { AR5K_INI_RFGAIN(3),   { 0, 0x00000181 } },            \
+       { AR5K_INI_RFGAIN(4),   { 0, 0x000001c1 } },            \
+       { AR5K_INI_RFGAIN(5),   { 0, 0x00000001 } },            \
+       { AR5K_INI_RFGAIN(6),   { 0, 0x00000041 } },            \
+       { AR5K_INI_RFGAIN(7),   { 0, 0x00000081 } },            \
+       { AR5K_INI_RFGAIN(8),   { 0, 0x00000168 } },            \
+       { AR5K_INI_RFGAIN(9),   { 0, 0x000001a8 } },            \
+       { AR5K_INI_RFGAIN(10),  { 0, 0x000001e8 } },            \
+       { AR5K_INI_RFGAIN(11),  { 0, 0x00000028 } },            \
+       { AR5K_INI_RFGAIN(12),  { 0, 0x00000068 } },            \
+       { AR5K_INI_RFGAIN(13),  { 0, 0x00000189 } },            \
+       { AR5K_INI_RFGAIN(14),  { 0, 0x000001c9 } },            \
+       { AR5K_INI_RFGAIN(15),  { 0, 0x00000009 } },            \
+       { AR5K_INI_RFGAIN(16),  { 0, 0x00000049 } },            \
+       { AR5K_INI_RFGAIN(17),  { 0, 0x00000089 } },            \
+       { AR5K_INI_RFGAIN(18),  { 0, 0x00000190 } },            \
+       { AR5K_INI_RFGAIN(19),  { 0, 0x000001d0 } },            \
+       { AR5K_INI_RFGAIN(20),  { 0, 0x00000010 } },            \
+       { AR5K_INI_RFGAIN(21),  { 0, 0x00000050 } },            \
+       { AR5K_INI_RFGAIN(22),  { 0, 0x00000090 } },            \
+       { AR5K_INI_RFGAIN(23),  { 0, 0x00000191 } },            \
+       { AR5K_INI_RFGAIN(24),  { 0, 0x000001d1 } },            \
+       { AR5K_INI_RFGAIN(25),  { 0, 0x00000011 } },            \
+       { AR5K_INI_RFGAIN(26),  { 0, 0x00000051 } },            \
+       { AR5K_INI_RFGAIN(27),  { 0, 0x00000091 } },            \
+       { AR5K_INI_RFGAIN(28),  { 0, 0x00000178 } },            \
+       { AR5K_INI_RFGAIN(29),  { 0, 0x000001b8 } },            \
+       { AR5K_INI_RFGAIN(30),  { 0, 0x000001f8 } },            \
+       { AR5K_INI_RFGAIN(31),  { 0, 0x00000038 } },            \
+       { AR5K_INI_RFGAIN(32),  { 0, 0x00000078 } },            \
+       { AR5K_INI_RFGAIN(33),  { 0, 0x00000199 } },            \
+       { AR5K_INI_RFGAIN(34),  { 0, 0x000001d9 } },            \
+       { AR5K_INI_RFGAIN(35),  { 0, 0x00000019 } },            \
+       { AR5K_INI_RFGAIN(36),  { 0, 0x00000059 } },            \
+       { AR5K_INI_RFGAIN(37),  { 0, 0x00000099 } },            \
+       { AR5K_INI_RFGAIN(38),  { 0, 0x000000d9 } },            \
+       { AR5K_INI_RFGAIN(39),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(40),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(41),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(42),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(43),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(44),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(45),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(46),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(47),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(48),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(49),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(50),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(51),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(52),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(53),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(54),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(55),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(56),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(57),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(58),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(59),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(60),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(61),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(62),  { 0, 0x000000f9 } },            \
+       { AR5K_INI_RFGAIN(63),  { 0, 0x000000f9 } },            \
 }
 
 /*
@@ -1999,11 +2314,16 @@ HAL_BOOL                 ar5k_rfregs(struct ath_hal *, HAL_CHANNEL *, u_int);
 u_int32_t               ar5k_rfregs_gainf_corr(struct ath_hal *);
 HAL_BOOL                ar5k_rfregs_gain_readback(struct ath_hal *);
 int32_t                         ar5k_rfregs_gain_adjust(struct ath_hal *);
-HAL_BOOL                ar5k_rfgain(struct ath_hal *, u_int, u_int);
+HAL_BOOL                ar5k_rfgain(struct ath_hal *, u_int);
 
 void                    ar5k_txpower_table(struct ath_hal *, HAL_CHANNEL *,
     int16_t);
 
+void                    ar5k_write_ini(struct ath_hal *,
+                           const struct ar5k_ini *, size_t, HAL_BOOL);
+void                    ar5k_write_mode(struct ath_hal *,
+                           const struct ar5k_mode *, size_t, u_int);
+
 __END_DECLS
 
 #endif /* _AR5K_H */