xref: /openbmc/linux/drivers/net/wireless/ath/regd.h (revision dec05cdf)
13a702e49SBob Copeland /*
23a702e49SBob Copeland  * Copyright (c) 2008-2009 Atheros Communications Inc.
33a702e49SBob Copeland  *
43a702e49SBob Copeland  * Permission to use, copy, modify, and/or distribute this software for any
53a702e49SBob Copeland  * purpose with or without fee is hereby granted, provided that the above
63a702e49SBob Copeland  * copyright notice and this permission notice appear in all copies.
73a702e49SBob Copeland  *
83a702e49SBob Copeland  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
93a702e49SBob Copeland  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
103a702e49SBob Copeland  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
113a702e49SBob Copeland  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
123a702e49SBob Copeland  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
133a702e49SBob Copeland  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
143a702e49SBob Copeland  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
153a702e49SBob Copeland  */
163a702e49SBob Copeland 
173a702e49SBob Copeland #ifndef REGD_H
183a702e49SBob Copeland #define REGD_H
193a702e49SBob Copeland 
203a702e49SBob Copeland #include <linux/nl80211.h>
213a702e49SBob Copeland #include <net/cfg80211.h>
223a702e49SBob Copeland 
23608b88cbSLuis R. Rodriguez #include "ath.h"
24608b88cbSLuis R. Rodriguez 
257f42c37aSJoerg Albert enum ctl_group {
267f42c37aSJoerg Albert 	CTL_FCC = 0x10,
277f42c37aSJoerg Albert 	CTL_MKK = 0x40,
287f42c37aSJoerg Albert 	CTL_ETSI = 0x30,
297f42c37aSJoerg Albert };
307f42c37aSJoerg Albert 
313a702e49SBob Copeland #define SD_NO_CTL               0xE0
323a702e49SBob Copeland #define NO_CTL                  0xff
333a702e49SBob Copeland #define CTL_11A                 0
343a702e49SBob Copeland #define CTL_11B                 1
353a702e49SBob Copeland #define CTL_11G                 2
363a702e49SBob Copeland #define CTL_2GHT20              5
373a702e49SBob Copeland #define CTL_5GHT20              6
383a702e49SBob Copeland #define CTL_2GHT40              7
393a702e49SBob Copeland #define CTL_5GHT40              8
403a702e49SBob Copeland 
413a702e49SBob Copeland #define CTRY_DEBUG 0x1ff
423a702e49SBob Copeland #define CTRY_DEFAULT 0
433a702e49SBob Copeland 
443a702e49SBob Copeland #define COUNTRY_ERD_FLAG        0x8000
453a702e49SBob Copeland #define WORLDWIDE_ROAMING_FLAG  0x4000
463a702e49SBob Copeland 
473a702e49SBob Copeland #define MULTI_DOMAIN_MASK 0xFF00
483a702e49SBob Copeland 
493a702e49SBob Copeland #define WORLD_SKU_MASK          0x00F0
503a702e49SBob Copeland #define WORLD_SKU_PREFIX        0x0060
513a702e49SBob Copeland 
523a702e49SBob Copeland #define CHANNEL_HALF_BW         10
533a702e49SBob Copeland #define CHANNEL_QUARTER_BW      5
543a702e49SBob Copeland 
553a702e49SBob Copeland struct country_code_to_enum_rd {
563a702e49SBob Copeland 	u16 countryCode;
573a702e49SBob Copeland 	u16 regDmnEnum;
583a702e49SBob Copeland 	const char *isoName;
593a702e49SBob Copeland };
603a702e49SBob Copeland 
613a702e49SBob Copeland enum CountryCode {
623a702e49SBob Copeland 	CTRY_ALBANIA = 8,
633a702e49SBob Copeland 	CTRY_ALGERIA = 12,
643a702e49SBob Copeland 	CTRY_ARGENTINA = 32,
653a702e49SBob Copeland 	CTRY_ARMENIA = 51,
66bd6b4442SVivek Natarajan 	CTRY_ARUBA = 533,
673a702e49SBob Copeland 	CTRY_AUSTRALIA = 36,
683a702e49SBob Copeland 	CTRY_AUSTRIA = 40,
693a702e49SBob Copeland 	CTRY_AZERBAIJAN = 31,
70699e2302SSven Eckelmann 	CTRY_BAHAMAS = 44,
713a702e49SBob Copeland 	CTRY_BAHRAIN = 48,
72bd6b4442SVivek Natarajan 	CTRY_BANGLADESH = 50,
73bd6b4442SVivek Natarajan 	CTRY_BARBADOS = 52,
743a702e49SBob Copeland 	CTRY_BELARUS = 112,
753a702e49SBob Copeland 	CTRY_BELGIUM = 56,
763a702e49SBob Copeland 	CTRY_BELIZE = 84,
779c790f2dSSven Eckelmann 	CTRY_BERMUDA = 60,
783a702e49SBob Copeland 	CTRY_BOLIVIA = 68,
793a702e49SBob Copeland 	CTRY_BOSNIA_HERZ = 70,
803a702e49SBob Copeland 	CTRY_BRAZIL = 76,
813a702e49SBob Copeland 	CTRY_BRUNEI_DARUSSALAM = 96,
823a702e49SBob Copeland 	CTRY_BULGARIA = 100,
83bd6b4442SVivek Natarajan 	CTRY_CAMBODIA = 116,
843a702e49SBob Copeland 	CTRY_CANADA = 124,
853a702e49SBob Copeland 	CTRY_CHILE = 152,
863a702e49SBob Copeland 	CTRY_CHINA = 156,
873a702e49SBob Copeland 	CTRY_COLOMBIA = 170,
883a702e49SBob Copeland 	CTRY_COSTA_RICA = 188,
893a702e49SBob Copeland 	CTRY_CROATIA = 191,
903a702e49SBob Copeland 	CTRY_CYPRUS = 196,
913a702e49SBob Copeland 	CTRY_CZECH = 203,
923a702e49SBob Copeland 	CTRY_DENMARK = 208,
933a702e49SBob Copeland 	CTRY_DOMINICAN_REPUBLIC = 214,
943a702e49SBob Copeland 	CTRY_ECUADOR = 218,
953a702e49SBob Copeland 	CTRY_EGYPT = 818,
963a702e49SBob Copeland 	CTRY_EL_SALVADOR = 222,
973a702e49SBob Copeland 	CTRY_ESTONIA = 233,
983a702e49SBob Copeland 	CTRY_FAEROE_ISLANDS = 234,
993a702e49SBob Copeland 	CTRY_FINLAND = 246,
1003a702e49SBob Copeland 	CTRY_FRANCE = 250,
1013a702e49SBob Copeland 	CTRY_GEORGIA = 268,
1023a702e49SBob Copeland 	CTRY_GERMANY = 276,
1033a702e49SBob Copeland 	CTRY_GREECE = 300,
104bd6b4442SVivek Natarajan 	CTRY_GREENLAND = 304,
105d601d9caSPavel Roskin 	CTRY_GRENADA = 308,
106bd6b4442SVivek Natarajan 	CTRY_GUAM = 316,
1073a702e49SBob Copeland 	CTRY_GUATEMALA = 320,
108bd6b4442SVivek Natarajan 	CTRY_HAITI = 332,
1093a702e49SBob Copeland 	CTRY_HONDURAS = 340,
1103a702e49SBob Copeland 	CTRY_HONG_KONG = 344,
1113a702e49SBob Copeland 	CTRY_HUNGARY = 348,
1123a702e49SBob Copeland 	CTRY_ICELAND = 352,
1133a702e49SBob Copeland 	CTRY_INDIA = 356,
1143a702e49SBob Copeland 	CTRY_INDONESIA = 360,
1153a702e49SBob Copeland 	CTRY_IRAN = 364,
1163a702e49SBob Copeland 	CTRY_IRAQ = 368,
1173a702e49SBob Copeland 	CTRY_IRELAND = 372,
1183a702e49SBob Copeland 	CTRY_ISRAEL = 376,
1193a702e49SBob Copeland 	CTRY_ITALY = 380,
1203a702e49SBob Copeland 	CTRY_JAMAICA = 388,
1213a702e49SBob Copeland 	CTRY_JAPAN = 392,
1223a702e49SBob Copeland 	CTRY_JORDAN = 400,
1233a702e49SBob Copeland 	CTRY_KAZAKHSTAN = 398,
1243a702e49SBob Copeland 	CTRY_KENYA = 404,
1253a702e49SBob Copeland 	CTRY_KOREA_NORTH = 408,
1263a702e49SBob Copeland 	CTRY_KOREA_ROC = 410,
1273a702e49SBob Copeland 	CTRY_KOREA_ROC2 = 411,
1283a702e49SBob Copeland 	CTRY_KOREA_ROC3 = 412,
129*dec05cdfSPeter Oh 	CTRY_KOREA_ROC4 = 413,
1303a702e49SBob Copeland 	CTRY_KUWAIT = 414,
1313a702e49SBob Copeland 	CTRY_LATVIA = 428,
1323a702e49SBob Copeland 	CTRY_LEBANON = 422,
1333a702e49SBob Copeland 	CTRY_LIBYA = 434,
1343a702e49SBob Copeland 	CTRY_LIECHTENSTEIN = 438,
1353a702e49SBob Copeland 	CTRY_LITHUANIA = 440,
1363a702e49SBob Copeland 	CTRY_LUXEMBOURG = 442,
1373a702e49SBob Copeland 	CTRY_MACAU = 446,
1383a702e49SBob Copeland 	CTRY_MACEDONIA = 807,
1393a702e49SBob Copeland 	CTRY_MALAYSIA = 458,
1403a702e49SBob Copeland 	CTRY_MALTA = 470,
141a71c984bSSven Eckelmann 	CTRY_MAURITIUS = 480,
1423a702e49SBob Copeland 	CTRY_MEXICO = 484,
1433a702e49SBob Copeland 	CTRY_MONACO = 492,
144a0a6f2a9SSven Eckelmann 	CTRY_MONTENEGRO = 499,
1453a702e49SBob Copeland 	CTRY_MOROCCO = 504,
1463a702e49SBob Copeland 	CTRY_NEPAL = 524,
1473a702e49SBob Copeland 	CTRY_NETHERLANDS = 528,
1483a702e49SBob Copeland 	CTRY_NETHERLANDS_ANTILLES = 530,
1493a702e49SBob Copeland 	CTRY_NEW_ZEALAND = 554,
1503a702e49SBob Copeland 	CTRY_NICARAGUA = 558,
1513a702e49SBob Copeland 	CTRY_NORWAY = 578,
1523a702e49SBob Copeland 	CTRY_OMAN = 512,
1533a702e49SBob Copeland 	CTRY_PAKISTAN = 586,
1543a702e49SBob Copeland 	CTRY_PANAMA = 591,
1553a702e49SBob Copeland 	CTRY_PAPUA_NEW_GUINEA = 598,
1563a702e49SBob Copeland 	CTRY_PARAGUAY = 600,
1573a702e49SBob Copeland 	CTRY_PERU = 604,
1583a702e49SBob Copeland 	CTRY_PHILIPPINES = 608,
1593a702e49SBob Copeland 	CTRY_POLAND = 616,
1603a702e49SBob Copeland 	CTRY_PORTUGAL = 620,
1613a702e49SBob Copeland 	CTRY_PUERTO_RICO = 630,
1623a702e49SBob Copeland 	CTRY_QATAR = 634,
1633a702e49SBob Copeland 	CTRY_ROMANIA = 642,
1643a702e49SBob Copeland 	CTRY_RUSSIA = 643,
1653a702e49SBob Copeland 	CTRY_SAUDI_ARABIA = 682,
1662a3169a5SSven Eckelmann 	CTRY_SERBIA = 688,
1673a702e49SBob Copeland 	CTRY_SERBIA_MONTENEGRO = 891,
1683a702e49SBob Copeland 	CTRY_SINGAPORE = 702,
1693a702e49SBob Copeland 	CTRY_SLOVAKIA = 703,
1703a702e49SBob Copeland 	CTRY_SLOVENIA = 705,
1713a702e49SBob Copeland 	CTRY_SOUTH_AFRICA = 710,
1723a702e49SBob Copeland 	CTRY_SPAIN = 724,
1733a702e49SBob Copeland 	CTRY_SRI_LANKA = 144,
1743a702e49SBob Copeland 	CTRY_SWEDEN = 752,
1753a702e49SBob Copeland 	CTRY_SWITZERLAND = 756,
1763a702e49SBob Copeland 	CTRY_SYRIA = 760,
1773a702e49SBob Copeland 	CTRY_TAIWAN = 158,
178667ddac5SSven Eckelmann 	CTRY_TANZANIA = 834,
1793a702e49SBob Copeland 	CTRY_THAILAND = 764,
1803a702e49SBob Copeland 	CTRY_TRINIDAD_Y_TOBAGO = 780,
1813a702e49SBob Copeland 	CTRY_TUNISIA = 788,
1823a702e49SBob Copeland 	CTRY_TURKEY = 792,
1833a702e49SBob Copeland 	CTRY_UAE = 784,
1841ea3986aSSven Eckelmann 	CTRY_UGANDA = 800,
1853a702e49SBob Copeland 	CTRY_UKRAINE = 804,
1863a702e49SBob Copeland 	CTRY_UNITED_KINGDOM = 826,
1873a702e49SBob Copeland 	CTRY_UNITED_STATES = 840,
18862a2c135SOever Gonzalez 	CTRY_UNITED_STATES2 = 841,
1893a702e49SBob Copeland 	CTRY_UNITED_STATES_FCC49 = 842,
19062a2c135SOever Gonzalez 	CTRY_UNITED_STATES3 = 843,
1913a702e49SBob Copeland 	CTRY_URUGUAY = 858,
1923a702e49SBob Copeland 	CTRY_UZBEKISTAN = 860,
1933a702e49SBob Copeland 	CTRY_VENEZUELA = 862,
1943a702e49SBob Copeland 	CTRY_VIET_NAM = 704,
1953a702e49SBob Copeland 	CTRY_YEMEN = 887,
1963a702e49SBob Copeland 	CTRY_ZIMBABWE = 716,
1973a702e49SBob Copeland 	CTRY_JAPAN1 = 393,
1983a702e49SBob Copeland 	CTRY_JAPAN2 = 394,
1993a702e49SBob Copeland 	CTRY_JAPAN3 = 395,
2003a702e49SBob Copeland 	CTRY_JAPAN4 = 396,
2013a702e49SBob Copeland 	CTRY_JAPAN5 = 397,
2023a702e49SBob Copeland 	CTRY_JAPAN6 = 4006,
2033a702e49SBob Copeland 	CTRY_JAPAN7 = 4007,
2043a702e49SBob Copeland 	CTRY_JAPAN8 = 4008,
2053a702e49SBob Copeland 	CTRY_JAPAN9 = 4009,
2063a702e49SBob Copeland 	CTRY_JAPAN10 = 4010,
2073a702e49SBob Copeland 	CTRY_JAPAN11 = 4011,
2083a702e49SBob Copeland 	CTRY_JAPAN12 = 4012,
2093a702e49SBob Copeland 	CTRY_JAPAN13 = 4013,
2103a702e49SBob Copeland 	CTRY_JAPAN14 = 4014,
2113a702e49SBob Copeland 	CTRY_JAPAN15 = 4015,
2123a702e49SBob Copeland 	CTRY_JAPAN16 = 4016,
2133a702e49SBob Copeland 	CTRY_JAPAN17 = 4017,
2143a702e49SBob Copeland 	CTRY_JAPAN18 = 4018,
2153a702e49SBob Copeland 	CTRY_JAPAN19 = 4019,
2163a702e49SBob Copeland 	CTRY_JAPAN20 = 4020,
2173a702e49SBob Copeland 	CTRY_JAPAN21 = 4021,
2183a702e49SBob Copeland 	CTRY_JAPAN22 = 4022,
2193a702e49SBob Copeland 	CTRY_JAPAN23 = 4023,
2203a702e49SBob Copeland 	CTRY_JAPAN24 = 4024,
2213a702e49SBob Copeland 	CTRY_JAPAN25 = 4025,
2223a702e49SBob Copeland 	CTRY_JAPAN26 = 4026,
2233a702e49SBob Copeland 	CTRY_JAPAN27 = 4027,
2243a702e49SBob Copeland 	CTRY_JAPAN28 = 4028,
2253a702e49SBob Copeland 	CTRY_JAPAN29 = 4029,
2263a702e49SBob Copeland 	CTRY_JAPAN30 = 4030,
2273a702e49SBob Copeland 	CTRY_JAPAN31 = 4031,
2283a702e49SBob Copeland 	CTRY_JAPAN32 = 4032,
2293a702e49SBob Copeland 	CTRY_JAPAN33 = 4033,
2303a702e49SBob Copeland 	CTRY_JAPAN34 = 4034,
2313a702e49SBob Copeland 	CTRY_JAPAN35 = 4035,
2323a702e49SBob Copeland 	CTRY_JAPAN36 = 4036,
2333a702e49SBob Copeland 	CTRY_JAPAN37 = 4037,
2343a702e49SBob Copeland 	CTRY_JAPAN38 = 4038,
2353a702e49SBob Copeland 	CTRY_JAPAN39 = 4039,
2363a702e49SBob Copeland 	CTRY_JAPAN40 = 4040,
2373a702e49SBob Copeland 	CTRY_JAPAN41 = 4041,
2383a702e49SBob Copeland 	CTRY_JAPAN42 = 4042,
2393a702e49SBob Copeland 	CTRY_JAPAN43 = 4043,
2403a702e49SBob Copeland 	CTRY_JAPAN44 = 4044,
2413a702e49SBob Copeland 	CTRY_JAPAN45 = 4045,
2423a702e49SBob Copeland 	CTRY_JAPAN46 = 4046,
2433a702e49SBob Copeland 	CTRY_JAPAN47 = 4047,
2443a702e49SBob Copeland 	CTRY_JAPAN48 = 4048,
2453a702e49SBob Copeland 	CTRY_JAPAN49 = 4049,
2463a702e49SBob Copeland 	CTRY_JAPAN50 = 4050,
2473a702e49SBob Copeland 	CTRY_JAPAN51 = 4051,
2483a702e49SBob Copeland 	CTRY_JAPAN52 = 4052,
2493a702e49SBob Copeland 	CTRY_JAPAN53 = 4053,
2503a702e49SBob Copeland 	CTRY_JAPAN54 = 4054,
2513a702e49SBob Copeland 	CTRY_JAPAN55 = 4055,
2523a702e49SBob Copeland 	CTRY_JAPAN56 = 4056,
2533a702e49SBob Copeland 	CTRY_JAPAN57 = 4057,
2543a702e49SBob Copeland 	CTRY_JAPAN58 = 4058,
2553a702e49SBob Copeland 	CTRY_JAPAN59 = 4059,
2563a702e49SBob Copeland 	CTRY_AUSTRALIA2 = 5000,
2573a702e49SBob Copeland 	CTRY_CANADA2 = 5001,
2583a702e49SBob Copeland 	CTRY_BELGIUM2 = 5002
2593a702e49SBob Copeland };
2603a702e49SBob Copeland 
2613a702e49SBob Copeland bool ath_is_world_regd(struct ath_regulatory *reg);
2625719efddSBruno Randolf bool ath_is_49ghz_allowed(u16 redomain);
263d291d8e0SMichal Kazior u16 ath_regd_find_country_by_name(char *alpha2);
264e3bb249bSBob Copeland int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
2650c0280bdSLuis R. Rodriguez 		  void (*reg_notifier)(struct wiphy *wiphy,
266e3bb249bSBob Copeland 				       struct regulatory_request *request));
2673a702e49SBob Copeland u32 ath_regd_get_band_ctl(struct ath_regulatory *reg,
26857fbcce3SJohannes Berg 			  enum nl80211_band band);
2690c0280bdSLuis R. Rodriguez void ath_reg_notifier_apply(struct wiphy *wiphy,
2703a702e49SBob Copeland 			    struct regulatory_request *request,
2713a702e49SBob Copeland 			    struct ath_regulatory *reg);
2723a702e49SBob Copeland 
2733a702e49SBob Copeland #endif
274