00001 /* 00002 * Copyright (c) 2004-2008 Reyk Floeter <reyk@openbsd.org> 00003 * Copyright (c) 2006-2008 Nick Kossifidis <mickflemm@gmail.com> 00004 * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com> 00005 * 00006 * Lightly modified for gPXE, July 2009, by Joshua Oreman <oremanj@rwcr.net>. 00007 * 00008 * Permission to use, copy, modify, and distribute this software for any 00009 * purpose with or without fee is hereby granted, provided that the above 00010 * copyright notice and this permission notice appear in all copies. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 00013 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 00014 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 00015 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00016 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00017 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00018 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00019 * 00020 */ 00021 00022 FILE_LICENCE ( MIT ); 00023 00024 /**************\ 00025 * Capabilities * 00026 \**************/ 00027 00028 #include "ath5k.h" 00029 #include "reg.h" 00030 #include "base.h" 00031 00032 /* 00033 * Fill the capabilities struct 00034 * TODO: Merge this with EEPROM code when we are done with it 00035 */ 00036 int ath5k_hw_set_capabilities(struct ath5k_hw *ah) 00037 { 00038 u16 ee_header; 00039 00040 /* Capabilities stored in the EEPROM */ 00041 ee_header = ah->ah_capabilities.cap_eeprom.ee_header; 00042 00043 if (ah->ah_version == AR5K_AR5210) { 00044 /* 00045 * Set radio capabilities 00046 * (The AR5110 only supports the middle 5GHz band) 00047 */ 00048 ah->ah_capabilities.cap_range.range_5ghz_min = 5120; 00049 ah->ah_capabilities.cap_range.range_5ghz_max = 5430; 00050 ah->ah_capabilities.cap_range.range_2ghz_min = 0; 00051 ah->ah_capabilities.cap_range.range_2ghz_max = 0; 00052 00053 /* Set supported modes */ 00054 ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A; 00055 ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO; 00056 } else { 00057 /* 00058 * XXX The tranceiver supports frequencies from 4920 to 6100GHz 00059 * XXX and from 2312 to 2732GHz. There are problems with the 00060 * XXX current ieee80211 implementation because the IEEE 00061 * XXX channel mapping does not support negative channel 00062 * XXX numbers (2312MHz is channel -19). Of course, this 00063 * XXX doesn't matter because these channels are out of range 00064 * XXX but some regulation domains like MKK (Japan) will 00065 * XXX support frequencies somewhere around 4.8GHz. 00066 */ 00067 00068 /* 00069 * Set radio capabilities 00070 */ 00071 00072 if (AR5K_EEPROM_HDR_11A(ee_header)) { 00073 /* 4920 */ 00074 ah->ah_capabilities.cap_range.range_5ghz_min = 5005; 00075 ah->ah_capabilities.cap_range.range_5ghz_max = 6100; 00076 00077 /* Set supported modes */ 00078 ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A; 00079 ah->ah_capabilities.cap_mode |= AR5K_MODE_BIT_11A_TURBO; 00080 if (ah->ah_version == AR5K_AR5212) 00081 ah->ah_capabilities.cap_mode |= 00082 AR5K_MODE_BIT_11G_TURBO; 00083 } 00084 00085 /* Enable 802.11b if a 2GHz capable radio (2111/5112) is 00086 * connected */ 00087 if (AR5K_EEPROM_HDR_11B(ee_header) || 00088 (AR5K_EEPROM_HDR_11G(ee_header) && 00089 ah->ah_version != AR5K_AR5211)) { 00090 /* 2312 */ 00091 ah->ah_capabilities.cap_range.range_2ghz_min = 2412; 00092 ah->ah_capabilities.cap_range.range_2ghz_max = 2732; 00093 00094 if (AR5K_EEPROM_HDR_11B(ee_header)) 00095 ah->ah_capabilities.cap_mode |= 00096 AR5K_MODE_BIT_11B; 00097 00098 if (AR5K_EEPROM_HDR_11G(ee_header) && 00099 ah->ah_version != AR5K_AR5211) 00100 ah->ah_capabilities.cap_mode |= 00101 AR5K_MODE_BIT_11G; 00102 } 00103 } 00104 00105 /* GPIO */ 00106 ah->ah_gpio_npins = AR5K_NUM_GPIO; 00107 00108 /* Set number of supported TX queues */ 00109 ah->ah_capabilities.cap_queues.q_tx_num = 1; 00110 00111 return 0; 00112 } 00113 00114 /* Main function used by the driver part to check caps */ 00115 int ath5k_hw_get_capability(struct ath5k_hw *ah, 00116 enum ath5k_capability_type cap_type, 00117 u32 capability __unused, u32 *result) 00118 { 00119 switch (cap_type) { 00120 case AR5K_CAP_NUM_TXQUEUES: 00121 if (result) { 00122 *result = 1; 00123 goto yes; 00124 } 00125 case AR5K_CAP_VEOL: 00126 goto yes; 00127 case AR5K_CAP_COMPRESSION: 00128 if (ah->ah_version == AR5K_AR5212) 00129 goto yes; 00130 else 00131 goto no; 00132 case AR5K_CAP_BURST: 00133 goto yes; 00134 case AR5K_CAP_TPC: 00135 goto yes; 00136 case AR5K_CAP_BSSIDMASK: 00137 if (ah->ah_version == AR5K_AR5212) 00138 goto yes; 00139 else 00140 goto no; 00141 case AR5K_CAP_XR: 00142 if (ah->ah_version == AR5K_AR5212) 00143 goto yes; 00144 else 00145 goto no; 00146 default: 00147 goto no; 00148 } 00149 00150 no: 00151 return -EINVAL; 00152 yes: 00153 return 0; 00154 }
1.5.7.1