ar9003_eeprom.c 130 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654
  1. /*
  2. * Copyright (c) 2010 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "hw.h"
  17. #include "ar9003_phy.h"
  18. #include "ar9003_eeprom.h"
  19. #define COMP_HDR_LEN 4
  20. #define COMP_CKSUM_LEN 2
  21. #define AR_CH0_TOP (0x00016288)
  22. #define AR_CH0_TOP_XPABIASLVL (0x300)
  23. #define AR_CH0_TOP_XPABIASLVL_S (8)
  24. #define AR_CH0_THERM (0x00016290)
  25. #define AR_CH0_THERM_XPABIASLVL_MSB 0x3
  26. #define AR_CH0_THERM_XPABIASLVL_MSB_S 0
  27. #define AR_CH0_THERM_XPASHORT2GND 0x4
  28. #define AR_CH0_THERM_XPASHORT2GND_S 2
  29. #define AR_SWITCH_TABLE_COM_ALL (0xffff)
  30. #define AR_SWITCH_TABLE_COM_ALL_S (0)
  31. #define AR_SWITCH_TABLE_COM2_ALL (0xffffff)
  32. #define AR_SWITCH_TABLE_COM2_ALL_S (0)
  33. #define AR_SWITCH_TABLE_ALL (0xfff)
  34. #define AR_SWITCH_TABLE_ALL_S (0)
  35. #define LE16(x) __constant_cpu_to_le16(x)
  36. #define LE32(x) __constant_cpu_to_le32(x)
  37. /* Local defines to distinguish between extension and control CTL's */
  38. #define EXT_ADDITIVE (0x8000)
  39. #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
  40. #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
  41. #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
  42. #define REDUCE_SCALED_POWER_BY_TWO_CHAIN 6 /* 10*log10(2)*2 */
  43. #define REDUCE_SCALED_POWER_BY_THREE_CHAIN 9 /* 10*log10(3)*2 */
  44. #define PWRINCR_3_TO_1_CHAIN 9 /* 10*log(3)*2 */
  45. #define PWRINCR_3_TO_2_CHAIN 3 /* floor(10*log(3/2)*2) */
  46. #define PWRINCR_2_TO_1_CHAIN 6 /* 10*log(2)*2 */
  47. #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
  48. #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
  49. static int ar9003_hw_power_interpolate(int32_t x,
  50. int32_t *px, int32_t *py, u_int16_t np);
  51. static const struct ar9300_eeprom ar9300_default = {
  52. .eepromVersion = 2,
  53. .templateVersion = 2,
  54. .macAddr = {1, 2, 3, 4, 5, 6},
  55. .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  56. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  57. .baseEepHeader = {
  58. .regDmn = { LE16(0), LE16(0x1f) },
  59. .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
  60. .opCapFlags = {
  61. .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
  62. .eepMisc = 0,
  63. },
  64. .rfSilent = 0,
  65. .blueToothOptions = 0,
  66. .deviceCap = 0,
  67. .deviceType = 5, /* takes lower byte in eeprom location */
  68. .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
  69. .params_for_tuning_caps = {0, 0},
  70. .featureEnable = 0x0c,
  71. /*
  72. * bit0 - enable tx temp comp - disabled
  73. * bit1 - enable tx volt comp - disabled
  74. * bit2 - enable fastClock - enabled
  75. * bit3 - enable doubling - enabled
  76. * bit4 - enable internal regulator - disabled
  77. * bit5 - enable pa predistortion - disabled
  78. */
  79. .miscConfiguration = 0, /* bit0 - turn down drivestrength */
  80. .eepromWriteEnableGpio = 3,
  81. .wlanDisableGpio = 0,
  82. .wlanLedGpio = 8,
  83. .rxBandSelectGpio = 0xff,
  84. .txrxgain = 0,
  85. .swreg = 0,
  86. },
  87. .modalHeader2G = {
  88. /* ar9300_modal_eep_header 2g */
  89. /* 4 idle,t1,t2,b(4 bits per setting) */
  90. .antCtrlCommon = LE32(0x110),
  91. /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
  92. .antCtrlCommon2 = LE32(0x22222),
  93. /*
  94. * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
  95. * rx1, rx12, b (2 bits each)
  96. */
  97. .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
  98. /*
  99. * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
  100. * for ar9280 (0xa20c/b20c 5:0)
  101. */
  102. .xatten1DB = {0, 0, 0},
  103. /*
  104. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  105. * for ar9280 (0xa20c/b20c 16:12
  106. */
  107. .xatten1Margin = {0, 0, 0},
  108. .tempSlope = 36,
  109. .voltSlope = 0,
  110. /*
  111. * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
  112. * channels in usual fbin coding format
  113. */
  114. .spurChans = {0, 0, 0, 0, 0},
  115. /*
  116. * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
  117. * if the register is per chain
  118. */
  119. .noiseFloorThreshCh = {-1, 0, 0},
  120. .ob = {1, 1, 1},/* 3 chain */
  121. .db_stage2 = {1, 1, 1}, /* 3 chain */
  122. .db_stage3 = {0, 0, 0},
  123. .db_stage4 = {0, 0, 0},
  124. .xpaBiasLvl = 0,
  125. .txFrameToDataStart = 0x0e,
  126. .txFrameToPaOn = 0x0e,
  127. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  128. .antennaGain = 0,
  129. .switchSettling = 0x2c,
  130. .adcDesiredSize = -30,
  131. .txEndToXpaOff = 0,
  132. .txEndToRxOn = 0x2,
  133. .txFrameToXpaOn = 0xe,
  134. .thresh62 = 28,
  135. .papdRateMaskHt20 = LE32(0x0cf0e0e0),
  136. .papdRateMaskHt40 = LE32(0x6cf0e0e0),
  137. .futureModal = {
  138. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  139. },
  140. },
  141. .base_ext1 = {
  142. .ant_div_control = 0,
  143. .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  144. },
  145. .calFreqPier2G = {
  146. FREQ2FBIN(2412, 1),
  147. FREQ2FBIN(2437, 1),
  148. FREQ2FBIN(2472, 1),
  149. },
  150. /* ar9300_cal_data_per_freq_op_loop 2g */
  151. .calPierData2G = {
  152. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  153. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  154. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  155. },
  156. .calTarget_freqbin_Cck = {
  157. FREQ2FBIN(2412, 1),
  158. FREQ2FBIN(2484, 1),
  159. },
  160. .calTarget_freqbin_2G = {
  161. FREQ2FBIN(2412, 1),
  162. FREQ2FBIN(2437, 1),
  163. FREQ2FBIN(2472, 1)
  164. },
  165. .calTarget_freqbin_2GHT20 = {
  166. FREQ2FBIN(2412, 1),
  167. FREQ2FBIN(2437, 1),
  168. FREQ2FBIN(2472, 1)
  169. },
  170. .calTarget_freqbin_2GHT40 = {
  171. FREQ2FBIN(2412, 1),
  172. FREQ2FBIN(2437, 1),
  173. FREQ2FBIN(2472, 1)
  174. },
  175. .calTargetPowerCck = {
  176. /* 1L-5L,5S,11L,11S */
  177. { {36, 36, 36, 36} },
  178. { {36, 36, 36, 36} },
  179. },
  180. .calTargetPower2G = {
  181. /* 6-24,36,48,54 */
  182. { {32, 32, 28, 24} },
  183. { {32, 32, 28, 24} },
  184. { {32, 32, 28, 24} },
  185. },
  186. .calTargetPower2GHT20 = {
  187. { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
  188. { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
  189. { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
  190. },
  191. .calTargetPower2GHT40 = {
  192. { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
  193. { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
  194. { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
  195. },
  196. .ctlIndex_2G = {
  197. 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
  198. 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
  199. },
  200. .ctl_freqbin_2G = {
  201. {
  202. FREQ2FBIN(2412, 1),
  203. FREQ2FBIN(2417, 1),
  204. FREQ2FBIN(2457, 1),
  205. FREQ2FBIN(2462, 1)
  206. },
  207. {
  208. FREQ2FBIN(2412, 1),
  209. FREQ2FBIN(2417, 1),
  210. FREQ2FBIN(2462, 1),
  211. 0xFF,
  212. },
  213. {
  214. FREQ2FBIN(2412, 1),
  215. FREQ2FBIN(2417, 1),
  216. FREQ2FBIN(2462, 1),
  217. 0xFF,
  218. },
  219. {
  220. FREQ2FBIN(2422, 1),
  221. FREQ2FBIN(2427, 1),
  222. FREQ2FBIN(2447, 1),
  223. FREQ2FBIN(2452, 1)
  224. },
  225. {
  226. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  227. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  228. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  229. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
  230. },
  231. {
  232. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  233. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  234. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  235. 0,
  236. },
  237. {
  238. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  239. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  240. FREQ2FBIN(2472, 1),
  241. 0,
  242. },
  243. {
  244. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  245. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  246. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  247. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  248. },
  249. {
  250. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  251. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  252. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  253. },
  254. {
  255. /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  256. /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  257. /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  258. 0
  259. },
  260. {
  261. /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  262. /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  263. /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  264. 0
  265. },
  266. {
  267. /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  268. /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  269. /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  270. /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  271. }
  272. },
  273. .ctlPowerData_2G = {
  274. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  275. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  276. { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
  277. { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
  278. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  279. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  280. { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
  281. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  282. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  283. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  284. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  285. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  286. },
  287. .modalHeader5G = {
  288. /* 4 idle,t1,t2,b (4 bits per setting) */
  289. .antCtrlCommon = LE32(0x110),
  290. /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
  291. .antCtrlCommon2 = LE32(0x22222),
  292. /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
  293. .antCtrlChain = {
  294. LE16(0x000), LE16(0x000), LE16(0x000),
  295. },
  296. /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
  297. .xatten1DB = {0, 0, 0},
  298. /*
  299. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  300. * for merlin (0xa20c/b20c 16:12
  301. */
  302. .xatten1Margin = {0, 0, 0},
  303. .tempSlope = 68,
  304. .voltSlope = 0,
  305. /* spurChans spur channels in usual fbin coding format */
  306. .spurChans = {0, 0, 0, 0, 0},
  307. /* noiseFloorThreshCh Check if the register is per chain */
  308. .noiseFloorThreshCh = {-1, 0, 0},
  309. .ob = {3, 3, 3}, /* 3 chain */
  310. .db_stage2 = {3, 3, 3}, /* 3 chain */
  311. .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
  312. .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
  313. .xpaBiasLvl = 0,
  314. .txFrameToDataStart = 0x0e,
  315. .txFrameToPaOn = 0x0e,
  316. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  317. .antennaGain = 0,
  318. .switchSettling = 0x2d,
  319. .adcDesiredSize = -30,
  320. .txEndToXpaOff = 0,
  321. .txEndToRxOn = 0x2,
  322. .txFrameToXpaOn = 0xe,
  323. .thresh62 = 28,
  324. .papdRateMaskHt20 = LE32(0x0c80c080),
  325. .papdRateMaskHt40 = LE32(0x0080c080),
  326. .futureModal = {
  327. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  328. },
  329. },
  330. .base_ext2 = {
  331. .tempSlopeLow = 0,
  332. .tempSlopeHigh = 0,
  333. .xatten1DBLow = {0, 0, 0},
  334. .xatten1MarginLow = {0, 0, 0},
  335. .xatten1DBHigh = {0, 0, 0},
  336. .xatten1MarginHigh = {0, 0, 0}
  337. },
  338. .calFreqPier5G = {
  339. FREQ2FBIN(5180, 0),
  340. FREQ2FBIN(5220, 0),
  341. FREQ2FBIN(5320, 0),
  342. FREQ2FBIN(5400, 0),
  343. FREQ2FBIN(5500, 0),
  344. FREQ2FBIN(5600, 0),
  345. FREQ2FBIN(5725, 0),
  346. FREQ2FBIN(5825, 0)
  347. },
  348. .calPierData5G = {
  349. {
  350. {0, 0, 0, 0, 0},
  351. {0, 0, 0, 0, 0},
  352. {0, 0, 0, 0, 0},
  353. {0, 0, 0, 0, 0},
  354. {0, 0, 0, 0, 0},
  355. {0, 0, 0, 0, 0},
  356. {0, 0, 0, 0, 0},
  357. {0, 0, 0, 0, 0},
  358. },
  359. {
  360. {0, 0, 0, 0, 0},
  361. {0, 0, 0, 0, 0},
  362. {0, 0, 0, 0, 0},
  363. {0, 0, 0, 0, 0},
  364. {0, 0, 0, 0, 0},
  365. {0, 0, 0, 0, 0},
  366. {0, 0, 0, 0, 0},
  367. {0, 0, 0, 0, 0},
  368. },
  369. {
  370. {0, 0, 0, 0, 0},
  371. {0, 0, 0, 0, 0},
  372. {0, 0, 0, 0, 0},
  373. {0, 0, 0, 0, 0},
  374. {0, 0, 0, 0, 0},
  375. {0, 0, 0, 0, 0},
  376. {0, 0, 0, 0, 0},
  377. {0, 0, 0, 0, 0},
  378. },
  379. },
  380. .calTarget_freqbin_5G = {
  381. FREQ2FBIN(5180, 0),
  382. FREQ2FBIN(5220, 0),
  383. FREQ2FBIN(5320, 0),
  384. FREQ2FBIN(5400, 0),
  385. FREQ2FBIN(5500, 0),
  386. FREQ2FBIN(5600, 0),
  387. FREQ2FBIN(5725, 0),
  388. FREQ2FBIN(5825, 0)
  389. },
  390. .calTarget_freqbin_5GHT20 = {
  391. FREQ2FBIN(5180, 0),
  392. FREQ2FBIN(5240, 0),
  393. FREQ2FBIN(5320, 0),
  394. FREQ2FBIN(5500, 0),
  395. FREQ2FBIN(5700, 0),
  396. FREQ2FBIN(5745, 0),
  397. FREQ2FBIN(5725, 0),
  398. FREQ2FBIN(5825, 0)
  399. },
  400. .calTarget_freqbin_5GHT40 = {
  401. FREQ2FBIN(5180, 0),
  402. FREQ2FBIN(5240, 0),
  403. FREQ2FBIN(5320, 0),
  404. FREQ2FBIN(5500, 0),
  405. FREQ2FBIN(5700, 0),
  406. FREQ2FBIN(5745, 0),
  407. FREQ2FBIN(5725, 0),
  408. FREQ2FBIN(5825, 0)
  409. },
  410. .calTargetPower5G = {
  411. /* 6-24,36,48,54 */
  412. { {20, 20, 20, 10} },
  413. { {20, 20, 20, 10} },
  414. { {20, 20, 20, 10} },
  415. { {20, 20, 20, 10} },
  416. { {20, 20, 20, 10} },
  417. { {20, 20, 20, 10} },
  418. { {20, 20, 20, 10} },
  419. { {20, 20, 20, 10} },
  420. },
  421. .calTargetPower5GHT20 = {
  422. /*
  423. * 0_8_16,1-3_9-11_17-19,
  424. * 4,5,6,7,12,13,14,15,20,21,22,23
  425. */
  426. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  427. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  428. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  429. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  430. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  431. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  432. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  433. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  434. },
  435. .calTargetPower5GHT40 = {
  436. /*
  437. * 0_8_16,1-3_9-11_17-19,
  438. * 4,5,6,7,12,13,14,15,20,21,22,23
  439. */
  440. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  441. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  442. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  443. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  444. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  445. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  446. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  447. { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
  448. },
  449. .ctlIndex_5G = {
  450. 0x10, 0x16, 0x18, 0x40, 0x46,
  451. 0x48, 0x30, 0x36, 0x38
  452. },
  453. .ctl_freqbin_5G = {
  454. {
  455. /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  456. /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  457. /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  458. /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  459. /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
  460. /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  461. /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  462. /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  463. },
  464. {
  465. /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  466. /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  467. /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  468. /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  469. /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
  470. /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  471. /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  472. /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  473. },
  474. {
  475. /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  476. /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  477. /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  478. /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
  479. /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
  480. /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
  481. /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
  482. /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
  483. },
  484. {
  485. /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  486. /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  487. /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
  488. /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
  489. /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  490. /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  491. /* Data[3].ctlEdges[6].bChannel */ 0xFF,
  492. /* Data[3].ctlEdges[7].bChannel */ 0xFF,
  493. },
  494. {
  495. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  496. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  497. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
  498. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
  499. /* Data[4].ctlEdges[4].bChannel */ 0xFF,
  500. /* Data[4].ctlEdges[5].bChannel */ 0xFF,
  501. /* Data[4].ctlEdges[6].bChannel */ 0xFF,
  502. /* Data[4].ctlEdges[7].bChannel */ 0xFF,
  503. },
  504. {
  505. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  506. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
  507. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
  508. /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  509. /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
  510. /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  511. /* Data[5].ctlEdges[6].bChannel */ 0xFF,
  512. /* Data[5].ctlEdges[7].bChannel */ 0xFF
  513. },
  514. {
  515. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  516. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  517. /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
  518. /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
  519. /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  520. /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
  521. /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
  522. /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
  523. },
  524. {
  525. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  526. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  527. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
  528. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  529. /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
  530. /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  531. /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  532. /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  533. },
  534. {
  535. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  536. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  537. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  538. /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  539. /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
  540. /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  541. /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
  542. /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
  543. }
  544. },
  545. .ctlPowerData_5G = {
  546. {
  547. {
  548. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  549. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  550. }
  551. },
  552. {
  553. {
  554. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  555. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  556. }
  557. },
  558. {
  559. {
  560. {60, 0}, {60, 1}, {60, 0}, {60, 1},
  561. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  562. }
  563. },
  564. {
  565. {
  566. {60, 0}, {60, 1}, {60, 1}, {60, 0},
  567. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  568. }
  569. },
  570. {
  571. {
  572. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  573. {60, 0}, {60, 0}, {60, 0}, {60, 0},
  574. }
  575. },
  576. {
  577. {
  578. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  579. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  580. }
  581. },
  582. {
  583. {
  584. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  585. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  586. }
  587. },
  588. {
  589. {
  590. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  591. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  592. }
  593. },
  594. {
  595. {
  596. {60, 1}, {60, 0}, {60, 1}, {60, 1},
  597. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  598. }
  599. },
  600. }
  601. };
  602. static const struct ar9300_eeprom ar9300_x113 = {
  603. .eepromVersion = 2,
  604. .templateVersion = 6,
  605. .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
  606. .custData = {"x113-023-f0000"},
  607. .baseEepHeader = {
  608. .regDmn = { LE16(0), LE16(0x1f) },
  609. .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
  610. .opCapFlags = {
  611. .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
  612. .eepMisc = 0,
  613. },
  614. .rfSilent = 0,
  615. .blueToothOptions = 0,
  616. .deviceCap = 0,
  617. .deviceType = 5, /* takes lower byte in eeprom location */
  618. .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
  619. .params_for_tuning_caps = {0, 0},
  620. .featureEnable = 0x0d,
  621. /*
  622. * bit0 - enable tx temp comp - disabled
  623. * bit1 - enable tx volt comp - disabled
  624. * bit2 - enable fastClock - enabled
  625. * bit3 - enable doubling - enabled
  626. * bit4 - enable internal regulator - disabled
  627. * bit5 - enable pa predistortion - disabled
  628. */
  629. .miscConfiguration = 0, /* bit0 - turn down drivestrength */
  630. .eepromWriteEnableGpio = 6,
  631. .wlanDisableGpio = 0,
  632. .wlanLedGpio = 8,
  633. .rxBandSelectGpio = 0xff,
  634. .txrxgain = 0x21,
  635. .swreg = 0,
  636. },
  637. .modalHeader2G = {
  638. /* ar9300_modal_eep_header 2g */
  639. /* 4 idle,t1,t2,b(4 bits per setting) */
  640. .antCtrlCommon = LE32(0x110),
  641. /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
  642. .antCtrlCommon2 = LE32(0x44444),
  643. /*
  644. * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
  645. * rx1, rx12, b (2 bits each)
  646. */
  647. .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
  648. /*
  649. * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
  650. * for ar9280 (0xa20c/b20c 5:0)
  651. */
  652. .xatten1DB = {0, 0, 0},
  653. /*
  654. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  655. * for ar9280 (0xa20c/b20c 16:12
  656. */
  657. .xatten1Margin = {0, 0, 0},
  658. .tempSlope = 25,
  659. .voltSlope = 0,
  660. /*
  661. * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
  662. * channels in usual fbin coding format
  663. */
  664. .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
  665. /*
  666. * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
  667. * if the register is per chain
  668. */
  669. .noiseFloorThreshCh = {-1, 0, 0},
  670. .ob = {1, 1, 1},/* 3 chain */
  671. .db_stage2 = {1, 1, 1}, /* 3 chain */
  672. .db_stage3 = {0, 0, 0},
  673. .db_stage4 = {0, 0, 0},
  674. .xpaBiasLvl = 0,
  675. .txFrameToDataStart = 0x0e,
  676. .txFrameToPaOn = 0x0e,
  677. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  678. .antennaGain = 0,
  679. .switchSettling = 0x2c,
  680. .adcDesiredSize = -30,
  681. .txEndToXpaOff = 0,
  682. .txEndToRxOn = 0x2,
  683. .txFrameToXpaOn = 0xe,
  684. .thresh62 = 28,
  685. .papdRateMaskHt20 = LE32(0x0c80c080),
  686. .papdRateMaskHt40 = LE32(0x0080c080),
  687. .futureModal = {
  688. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  689. },
  690. },
  691. .base_ext1 = {
  692. .ant_div_control = 0,
  693. .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  694. },
  695. .calFreqPier2G = {
  696. FREQ2FBIN(2412, 1),
  697. FREQ2FBIN(2437, 1),
  698. FREQ2FBIN(2472, 1),
  699. },
  700. /* ar9300_cal_data_per_freq_op_loop 2g */
  701. .calPierData2G = {
  702. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  703. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  704. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  705. },
  706. .calTarget_freqbin_Cck = {
  707. FREQ2FBIN(2412, 1),
  708. FREQ2FBIN(2472, 1),
  709. },
  710. .calTarget_freqbin_2G = {
  711. FREQ2FBIN(2412, 1),
  712. FREQ2FBIN(2437, 1),
  713. FREQ2FBIN(2472, 1)
  714. },
  715. .calTarget_freqbin_2GHT20 = {
  716. FREQ2FBIN(2412, 1),
  717. FREQ2FBIN(2437, 1),
  718. FREQ2FBIN(2472, 1)
  719. },
  720. .calTarget_freqbin_2GHT40 = {
  721. FREQ2FBIN(2412, 1),
  722. FREQ2FBIN(2437, 1),
  723. FREQ2FBIN(2472, 1)
  724. },
  725. .calTargetPowerCck = {
  726. /* 1L-5L,5S,11L,11S */
  727. { {34, 34, 34, 34} },
  728. { {34, 34, 34, 34} },
  729. },
  730. .calTargetPower2G = {
  731. /* 6-24,36,48,54 */
  732. { {34, 34, 32, 32} },
  733. { {34, 34, 32, 32} },
  734. { {34, 34, 32, 32} },
  735. },
  736. .calTargetPower2GHT20 = {
  737. { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
  738. { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
  739. { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
  740. },
  741. .calTargetPower2GHT40 = {
  742. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
  743. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
  744. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
  745. },
  746. .ctlIndex_2G = {
  747. 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
  748. 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
  749. },
  750. .ctl_freqbin_2G = {
  751. {
  752. FREQ2FBIN(2412, 1),
  753. FREQ2FBIN(2417, 1),
  754. FREQ2FBIN(2457, 1),
  755. FREQ2FBIN(2462, 1)
  756. },
  757. {
  758. FREQ2FBIN(2412, 1),
  759. FREQ2FBIN(2417, 1),
  760. FREQ2FBIN(2462, 1),
  761. 0xFF,
  762. },
  763. {
  764. FREQ2FBIN(2412, 1),
  765. FREQ2FBIN(2417, 1),
  766. FREQ2FBIN(2462, 1),
  767. 0xFF,
  768. },
  769. {
  770. FREQ2FBIN(2422, 1),
  771. FREQ2FBIN(2427, 1),
  772. FREQ2FBIN(2447, 1),
  773. FREQ2FBIN(2452, 1)
  774. },
  775. {
  776. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  777. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  778. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  779. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
  780. },
  781. {
  782. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  783. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  784. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  785. 0,
  786. },
  787. {
  788. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  789. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  790. FREQ2FBIN(2472, 1),
  791. 0,
  792. },
  793. {
  794. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  795. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  796. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  797. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  798. },
  799. {
  800. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  801. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  802. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  803. },
  804. {
  805. /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  806. /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  807. /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  808. 0
  809. },
  810. {
  811. /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  812. /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  813. /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  814. 0
  815. },
  816. {
  817. /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  818. /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  819. /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  820. /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  821. }
  822. },
  823. .ctlPowerData_2G = {
  824. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  825. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  826. { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
  827. { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
  828. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  829. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  830. { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
  831. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  832. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  833. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  834. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  835. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  836. },
  837. .modalHeader5G = {
  838. /* 4 idle,t1,t2,b (4 bits per setting) */
  839. .antCtrlCommon = LE32(0x220),
  840. /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
  841. .antCtrlCommon2 = LE32(0x11111),
  842. /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
  843. .antCtrlChain = {
  844. LE16(0x150), LE16(0x150), LE16(0x150),
  845. },
  846. /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
  847. .xatten1DB = {0, 0, 0},
  848. /*
  849. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  850. * for merlin (0xa20c/b20c 16:12
  851. */
  852. .xatten1Margin = {0, 0, 0},
  853. .tempSlope = 68,
  854. .voltSlope = 0,
  855. /* spurChans spur channels in usual fbin coding format */
  856. .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0},
  857. /* noiseFloorThreshCh Check if the register is per chain */
  858. .noiseFloorThreshCh = {-1, 0, 0},
  859. .ob = {3, 3, 3}, /* 3 chain */
  860. .db_stage2 = {3, 3, 3}, /* 3 chain */
  861. .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
  862. .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
  863. .xpaBiasLvl = 0,
  864. .txFrameToDataStart = 0x0e,
  865. .txFrameToPaOn = 0x0e,
  866. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  867. .antennaGain = 0,
  868. .switchSettling = 0x2d,
  869. .adcDesiredSize = -30,
  870. .txEndToXpaOff = 0,
  871. .txEndToRxOn = 0x2,
  872. .txFrameToXpaOn = 0xe,
  873. .thresh62 = 28,
  874. .papdRateMaskHt20 = LE32(0x0cf0e0e0),
  875. .papdRateMaskHt40 = LE32(0x6cf0e0e0),
  876. .futureModal = {
  877. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  878. },
  879. },
  880. .base_ext2 = {
  881. .tempSlopeLow = 72,
  882. .tempSlopeHigh = 105,
  883. .xatten1DBLow = {0, 0, 0},
  884. .xatten1MarginLow = {0, 0, 0},
  885. .xatten1DBHigh = {0, 0, 0},
  886. .xatten1MarginHigh = {0, 0, 0}
  887. },
  888. .calFreqPier5G = {
  889. FREQ2FBIN(5180, 0),
  890. FREQ2FBIN(5240, 0),
  891. FREQ2FBIN(5320, 0),
  892. FREQ2FBIN(5400, 0),
  893. FREQ2FBIN(5500, 0),
  894. FREQ2FBIN(5600, 0),
  895. FREQ2FBIN(5745, 0),
  896. FREQ2FBIN(5785, 0)
  897. },
  898. .calPierData5G = {
  899. {
  900. {0, 0, 0, 0, 0},
  901. {0, 0, 0, 0, 0},
  902. {0, 0, 0, 0, 0},
  903. {0, 0, 0, 0, 0},
  904. {0, 0, 0, 0, 0},
  905. {0, 0, 0, 0, 0},
  906. {0, 0, 0, 0, 0},
  907. {0, 0, 0, 0, 0},
  908. },
  909. {
  910. {0, 0, 0, 0, 0},
  911. {0, 0, 0, 0, 0},
  912. {0, 0, 0, 0, 0},
  913. {0, 0, 0, 0, 0},
  914. {0, 0, 0, 0, 0},
  915. {0, 0, 0, 0, 0},
  916. {0, 0, 0, 0, 0},
  917. {0, 0, 0, 0, 0},
  918. },
  919. {
  920. {0, 0, 0, 0, 0},
  921. {0, 0, 0, 0, 0},
  922. {0, 0, 0, 0, 0},
  923. {0, 0, 0, 0, 0},
  924. {0, 0, 0, 0, 0},
  925. {0, 0, 0, 0, 0},
  926. {0, 0, 0, 0, 0},
  927. {0, 0, 0, 0, 0},
  928. },
  929. },
  930. .calTarget_freqbin_5G = {
  931. FREQ2FBIN(5180, 0),
  932. FREQ2FBIN(5220, 0),
  933. FREQ2FBIN(5320, 0),
  934. FREQ2FBIN(5400, 0),
  935. FREQ2FBIN(5500, 0),
  936. FREQ2FBIN(5600, 0),
  937. FREQ2FBIN(5745, 0),
  938. FREQ2FBIN(5785, 0)
  939. },
  940. .calTarget_freqbin_5GHT20 = {
  941. FREQ2FBIN(5180, 0),
  942. FREQ2FBIN(5240, 0),
  943. FREQ2FBIN(5320, 0),
  944. FREQ2FBIN(5400, 0),
  945. FREQ2FBIN(5500, 0),
  946. FREQ2FBIN(5700, 0),
  947. FREQ2FBIN(5745, 0),
  948. FREQ2FBIN(5825, 0)
  949. },
  950. .calTarget_freqbin_5GHT40 = {
  951. FREQ2FBIN(5190, 0),
  952. FREQ2FBIN(5230, 0),
  953. FREQ2FBIN(5320, 0),
  954. FREQ2FBIN(5410, 0),
  955. FREQ2FBIN(5510, 0),
  956. FREQ2FBIN(5670, 0),
  957. FREQ2FBIN(5755, 0),
  958. FREQ2FBIN(5825, 0)
  959. },
  960. .calTargetPower5G = {
  961. /* 6-24,36,48,54 */
  962. { {42, 40, 40, 34} },
  963. { {42, 40, 40, 34} },
  964. { {42, 40, 40, 34} },
  965. { {42, 40, 40, 34} },
  966. { {42, 40, 40, 34} },
  967. { {42, 40, 40, 34} },
  968. { {42, 40, 40, 34} },
  969. { {42, 40, 40, 34} },
  970. },
  971. .calTargetPower5GHT20 = {
  972. /*
  973. * 0_8_16,1-3_9-11_17-19,
  974. * 4,5,6,7,12,13,14,15,20,21,22,23
  975. */
  976. { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
  977. { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
  978. { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
  979. { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
  980. { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
  981. { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
  982. { {38, 38, 38, 38, 32, 28, 38, 38, 32, 28, 38, 38, 32, 26} },
  983. { {36, 36, 36, 36, 32, 28, 36, 36, 32, 28, 36, 36, 32, 26} },
  984. },
  985. .calTargetPower5GHT40 = {
  986. /*
  987. * 0_8_16,1-3_9-11_17-19,
  988. * 4,5,6,7,12,13,14,15,20,21,22,23
  989. */
  990. { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
  991. { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
  992. { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
  993. { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
  994. { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
  995. { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
  996. { {36, 36, 36, 36, 30, 26, 36, 36, 30, 26, 36, 36, 30, 24} },
  997. { {34, 34, 34, 34, 30, 26, 34, 34, 30, 26, 34, 34, 30, 24} },
  998. },
  999. .ctlIndex_5G = {
  1000. 0x10, 0x16, 0x18, 0x40, 0x46,
  1001. 0x48, 0x30, 0x36, 0x38
  1002. },
  1003. .ctl_freqbin_5G = {
  1004. {
  1005. /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1006. /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1007. /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  1008. /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  1009. /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
  1010. /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1011. /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  1012. /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  1013. },
  1014. {
  1015. /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1016. /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1017. /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  1018. /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  1019. /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
  1020. /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1021. /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  1022. /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  1023. },
  1024. {
  1025. /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  1026. /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  1027. /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  1028. /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
  1029. /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
  1030. /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
  1031. /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
  1032. /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
  1033. },
  1034. {
  1035. /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1036. /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  1037. /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
  1038. /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
  1039. /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  1040. /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1041. /* Data[3].ctlEdges[6].bChannel */ 0xFF,
  1042. /* Data[3].ctlEdges[7].bChannel */ 0xFF,
  1043. },
  1044. {
  1045. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1046. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1047. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
  1048. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
  1049. /* Data[4].ctlEdges[4].bChannel */ 0xFF,
  1050. /* Data[4].ctlEdges[5].bChannel */ 0xFF,
  1051. /* Data[4].ctlEdges[6].bChannel */ 0xFF,
  1052. /* Data[4].ctlEdges[7].bChannel */ 0xFF,
  1053. },
  1054. {
  1055. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  1056. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
  1057. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
  1058. /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  1059. /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
  1060. /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  1061. /* Data[5].ctlEdges[6].bChannel */ 0xFF,
  1062. /* Data[5].ctlEdges[7].bChannel */ 0xFF
  1063. },
  1064. {
  1065. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1066. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  1067. /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
  1068. /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
  1069. /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  1070. /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
  1071. /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
  1072. /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
  1073. },
  1074. {
  1075. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1076. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1077. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
  1078. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  1079. /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
  1080. /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1081. /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  1082. /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  1083. },
  1084. {
  1085. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  1086. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  1087. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  1088. /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  1089. /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
  1090. /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  1091. /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
  1092. /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
  1093. }
  1094. },
  1095. .ctlPowerData_5G = {
  1096. {
  1097. {
  1098. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1099. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1100. }
  1101. },
  1102. {
  1103. {
  1104. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1105. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1106. }
  1107. },
  1108. {
  1109. {
  1110. {60, 0}, {60, 1}, {60, 0}, {60, 1},
  1111. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1112. }
  1113. },
  1114. {
  1115. {
  1116. {60, 0}, {60, 1}, {60, 1}, {60, 0},
  1117. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  1118. }
  1119. },
  1120. {
  1121. {
  1122. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1123. {60, 0}, {60, 0}, {60, 0}, {60, 0},
  1124. }
  1125. },
  1126. {
  1127. {
  1128. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1129. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  1130. }
  1131. },
  1132. {
  1133. {
  1134. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1135. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1136. }
  1137. },
  1138. {
  1139. {
  1140. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  1141. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1142. }
  1143. },
  1144. {
  1145. {
  1146. {60, 1}, {60, 0}, {60, 1}, {60, 1},
  1147. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  1148. }
  1149. },
  1150. }
  1151. };
  1152. static const struct ar9300_eeprom ar9300_h112 = {
  1153. .eepromVersion = 2,
  1154. .templateVersion = 3,
  1155. .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
  1156. .custData = {"h112-241-f0000"},
  1157. .baseEepHeader = {
  1158. .regDmn = { LE16(0), LE16(0x1f) },
  1159. .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
  1160. .opCapFlags = {
  1161. .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
  1162. .eepMisc = 0,
  1163. },
  1164. .rfSilent = 0,
  1165. .blueToothOptions = 0,
  1166. .deviceCap = 0,
  1167. .deviceType = 5, /* takes lower byte in eeprom location */
  1168. .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
  1169. .params_for_tuning_caps = {0, 0},
  1170. .featureEnable = 0x0d,
  1171. /*
  1172. * bit0 - enable tx temp comp - disabled
  1173. * bit1 - enable tx volt comp - disabled
  1174. * bit2 - enable fastClock - enabled
  1175. * bit3 - enable doubling - enabled
  1176. * bit4 - enable internal regulator - disabled
  1177. * bit5 - enable pa predistortion - disabled
  1178. */
  1179. .miscConfiguration = 0, /* bit0 - turn down drivestrength */
  1180. .eepromWriteEnableGpio = 6,
  1181. .wlanDisableGpio = 0,
  1182. .wlanLedGpio = 8,
  1183. .rxBandSelectGpio = 0xff,
  1184. .txrxgain = 0x10,
  1185. .swreg = 0,
  1186. },
  1187. .modalHeader2G = {
  1188. /* ar9300_modal_eep_header 2g */
  1189. /* 4 idle,t1,t2,b(4 bits per setting) */
  1190. .antCtrlCommon = LE32(0x110),
  1191. /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
  1192. .antCtrlCommon2 = LE32(0x44444),
  1193. /*
  1194. * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
  1195. * rx1, rx12, b (2 bits each)
  1196. */
  1197. .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
  1198. /*
  1199. * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
  1200. * for ar9280 (0xa20c/b20c 5:0)
  1201. */
  1202. .xatten1DB = {0, 0, 0},
  1203. /*
  1204. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  1205. * for ar9280 (0xa20c/b20c 16:12
  1206. */
  1207. .xatten1Margin = {0, 0, 0},
  1208. .tempSlope = 25,
  1209. .voltSlope = 0,
  1210. /*
  1211. * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
  1212. * channels in usual fbin coding format
  1213. */
  1214. .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
  1215. /*
  1216. * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
  1217. * if the register is per chain
  1218. */
  1219. .noiseFloorThreshCh = {-1, 0, 0},
  1220. .ob = {1, 1, 1},/* 3 chain */
  1221. .db_stage2 = {1, 1, 1}, /* 3 chain */
  1222. .db_stage3 = {0, 0, 0},
  1223. .db_stage4 = {0, 0, 0},
  1224. .xpaBiasLvl = 0,
  1225. .txFrameToDataStart = 0x0e,
  1226. .txFrameToPaOn = 0x0e,
  1227. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  1228. .antennaGain = 0,
  1229. .switchSettling = 0x2c,
  1230. .adcDesiredSize = -30,
  1231. .txEndToXpaOff = 0,
  1232. .txEndToRxOn = 0x2,
  1233. .txFrameToXpaOn = 0xe,
  1234. .thresh62 = 28,
  1235. .papdRateMaskHt20 = LE32(0x80c080),
  1236. .papdRateMaskHt40 = LE32(0x80c080),
  1237. .futureModal = {
  1238. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1239. },
  1240. },
  1241. .base_ext1 = {
  1242. .ant_div_control = 0,
  1243. .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  1244. },
  1245. .calFreqPier2G = {
  1246. FREQ2FBIN(2412, 1),
  1247. FREQ2FBIN(2437, 1),
  1248. FREQ2FBIN(2472, 1),
  1249. },
  1250. /* ar9300_cal_data_per_freq_op_loop 2g */
  1251. .calPierData2G = {
  1252. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  1253. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  1254. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  1255. },
  1256. .calTarget_freqbin_Cck = {
  1257. FREQ2FBIN(2412, 1),
  1258. FREQ2FBIN(2484, 1),
  1259. },
  1260. .calTarget_freqbin_2G = {
  1261. FREQ2FBIN(2412, 1),
  1262. FREQ2FBIN(2437, 1),
  1263. FREQ2FBIN(2472, 1)
  1264. },
  1265. .calTarget_freqbin_2GHT20 = {
  1266. FREQ2FBIN(2412, 1),
  1267. FREQ2FBIN(2437, 1),
  1268. FREQ2FBIN(2472, 1)
  1269. },
  1270. .calTarget_freqbin_2GHT40 = {
  1271. FREQ2FBIN(2412, 1),
  1272. FREQ2FBIN(2437, 1),
  1273. FREQ2FBIN(2472, 1)
  1274. },
  1275. .calTargetPowerCck = {
  1276. /* 1L-5L,5S,11L,11S */
  1277. { {34, 34, 34, 34} },
  1278. { {34, 34, 34, 34} },
  1279. },
  1280. .calTargetPower2G = {
  1281. /* 6-24,36,48,54 */
  1282. { {34, 34, 32, 32} },
  1283. { {34, 34, 32, 32} },
  1284. { {34, 34, 32, 32} },
  1285. },
  1286. .calTargetPower2GHT20 = {
  1287. { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
  1288. { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
  1289. { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
  1290. },
  1291. .calTargetPower2GHT40 = {
  1292. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
  1293. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
  1294. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
  1295. },
  1296. .ctlIndex_2G = {
  1297. 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
  1298. 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
  1299. },
  1300. .ctl_freqbin_2G = {
  1301. {
  1302. FREQ2FBIN(2412, 1),
  1303. FREQ2FBIN(2417, 1),
  1304. FREQ2FBIN(2457, 1),
  1305. FREQ2FBIN(2462, 1)
  1306. },
  1307. {
  1308. FREQ2FBIN(2412, 1),
  1309. FREQ2FBIN(2417, 1),
  1310. FREQ2FBIN(2462, 1),
  1311. 0xFF,
  1312. },
  1313. {
  1314. FREQ2FBIN(2412, 1),
  1315. FREQ2FBIN(2417, 1),
  1316. FREQ2FBIN(2462, 1),
  1317. 0xFF,
  1318. },
  1319. {
  1320. FREQ2FBIN(2422, 1),
  1321. FREQ2FBIN(2427, 1),
  1322. FREQ2FBIN(2447, 1),
  1323. FREQ2FBIN(2452, 1)
  1324. },
  1325. {
  1326. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  1327. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  1328. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  1329. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
  1330. },
  1331. {
  1332. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  1333. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  1334. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  1335. 0,
  1336. },
  1337. {
  1338. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  1339. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  1340. FREQ2FBIN(2472, 1),
  1341. 0,
  1342. },
  1343. {
  1344. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  1345. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  1346. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  1347. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  1348. },
  1349. {
  1350. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  1351. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  1352. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  1353. },
  1354. {
  1355. /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  1356. /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  1357. /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  1358. 0
  1359. },
  1360. {
  1361. /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  1362. /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  1363. /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  1364. 0
  1365. },
  1366. {
  1367. /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  1368. /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  1369. /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  1370. /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  1371. }
  1372. },
  1373. .ctlPowerData_2G = {
  1374. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1375. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1376. { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
  1377. { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
  1378. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1379. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1380. { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
  1381. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1382. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1383. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1384. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  1385. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  1386. },
  1387. .modalHeader5G = {
  1388. /* 4 idle,t1,t2,b (4 bits per setting) */
  1389. .antCtrlCommon = LE32(0x220),
  1390. /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
  1391. .antCtrlCommon2 = LE32(0x44444),
  1392. /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
  1393. .antCtrlChain = {
  1394. LE16(0x150), LE16(0x150), LE16(0x150),
  1395. },
  1396. /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
  1397. .xatten1DB = {0, 0, 0},
  1398. /*
  1399. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  1400. * for merlin (0xa20c/b20c 16:12
  1401. */
  1402. .xatten1Margin = {0, 0, 0},
  1403. .tempSlope = 45,
  1404. .voltSlope = 0,
  1405. /* spurChans spur channels in usual fbin coding format */
  1406. .spurChans = {0, 0, 0, 0, 0},
  1407. /* noiseFloorThreshCh Check if the register is per chain */
  1408. .noiseFloorThreshCh = {-1, 0, 0},
  1409. .ob = {3, 3, 3}, /* 3 chain */
  1410. .db_stage2 = {3, 3, 3}, /* 3 chain */
  1411. .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
  1412. .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
  1413. .xpaBiasLvl = 0,
  1414. .txFrameToDataStart = 0x0e,
  1415. .txFrameToPaOn = 0x0e,
  1416. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  1417. .antennaGain = 0,
  1418. .switchSettling = 0x2d,
  1419. .adcDesiredSize = -30,
  1420. .txEndToXpaOff = 0,
  1421. .txEndToRxOn = 0x2,
  1422. .txFrameToXpaOn = 0xe,
  1423. .thresh62 = 28,
  1424. .papdRateMaskHt20 = LE32(0x0cf0e0e0),
  1425. .papdRateMaskHt40 = LE32(0x6cf0e0e0),
  1426. .futureModal = {
  1427. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1428. },
  1429. },
  1430. .base_ext2 = {
  1431. .tempSlopeLow = 40,
  1432. .tempSlopeHigh = 50,
  1433. .xatten1DBLow = {0, 0, 0},
  1434. .xatten1MarginLow = {0, 0, 0},
  1435. .xatten1DBHigh = {0, 0, 0},
  1436. .xatten1MarginHigh = {0, 0, 0}
  1437. },
  1438. .calFreqPier5G = {
  1439. FREQ2FBIN(5180, 0),
  1440. FREQ2FBIN(5220, 0),
  1441. FREQ2FBIN(5320, 0),
  1442. FREQ2FBIN(5400, 0),
  1443. FREQ2FBIN(5500, 0),
  1444. FREQ2FBIN(5600, 0),
  1445. FREQ2FBIN(5700, 0),
  1446. FREQ2FBIN(5825, 0)
  1447. },
  1448. .calPierData5G = {
  1449. {
  1450. {0, 0, 0, 0, 0},
  1451. {0, 0, 0, 0, 0},
  1452. {0, 0, 0, 0, 0},
  1453. {0, 0, 0, 0, 0},
  1454. {0, 0, 0, 0, 0},
  1455. {0, 0, 0, 0, 0},
  1456. {0, 0, 0, 0, 0},
  1457. {0, 0, 0, 0, 0},
  1458. },
  1459. {
  1460. {0, 0, 0, 0, 0},
  1461. {0, 0, 0, 0, 0},
  1462. {0, 0, 0, 0, 0},
  1463. {0, 0, 0, 0, 0},
  1464. {0, 0, 0, 0, 0},
  1465. {0, 0, 0, 0, 0},
  1466. {0, 0, 0, 0, 0},
  1467. {0, 0, 0, 0, 0},
  1468. },
  1469. {
  1470. {0, 0, 0, 0, 0},
  1471. {0, 0, 0, 0, 0},
  1472. {0, 0, 0, 0, 0},
  1473. {0, 0, 0, 0, 0},
  1474. {0, 0, 0, 0, 0},
  1475. {0, 0, 0, 0, 0},
  1476. {0, 0, 0, 0, 0},
  1477. {0, 0, 0, 0, 0},
  1478. },
  1479. },
  1480. .calTarget_freqbin_5G = {
  1481. FREQ2FBIN(5180, 0),
  1482. FREQ2FBIN(5240, 0),
  1483. FREQ2FBIN(5320, 0),
  1484. FREQ2FBIN(5400, 0),
  1485. FREQ2FBIN(5500, 0),
  1486. FREQ2FBIN(5600, 0),
  1487. FREQ2FBIN(5700, 0),
  1488. FREQ2FBIN(5825, 0)
  1489. },
  1490. .calTarget_freqbin_5GHT20 = {
  1491. FREQ2FBIN(5180, 0),
  1492. FREQ2FBIN(5240, 0),
  1493. FREQ2FBIN(5320, 0),
  1494. FREQ2FBIN(5400, 0),
  1495. FREQ2FBIN(5500, 0),
  1496. FREQ2FBIN(5700, 0),
  1497. FREQ2FBIN(5745, 0),
  1498. FREQ2FBIN(5825, 0)
  1499. },
  1500. .calTarget_freqbin_5GHT40 = {
  1501. FREQ2FBIN(5180, 0),
  1502. FREQ2FBIN(5240, 0),
  1503. FREQ2FBIN(5320, 0),
  1504. FREQ2FBIN(5400, 0),
  1505. FREQ2FBIN(5500, 0),
  1506. FREQ2FBIN(5700, 0),
  1507. FREQ2FBIN(5745, 0),
  1508. FREQ2FBIN(5825, 0)
  1509. },
  1510. .calTargetPower5G = {
  1511. /* 6-24,36,48,54 */
  1512. { {30, 30, 28, 24} },
  1513. { {30, 30, 28, 24} },
  1514. { {30, 30, 28, 24} },
  1515. { {30, 30, 28, 24} },
  1516. { {30, 30, 28, 24} },
  1517. { {30, 30, 28, 24} },
  1518. { {30, 30, 28, 24} },
  1519. { {30, 30, 28, 24} },
  1520. },
  1521. .calTargetPower5GHT20 = {
  1522. /*
  1523. * 0_8_16,1-3_9-11_17-19,
  1524. * 4,5,6,7,12,13,14,15,20,21,22,23
  1525. */
  1526. { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
  1527. { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
  1528. { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
  1529. { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
  1530. { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
  1531. { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
  1532. { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
  1533. { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
  1534. },
  1535. .calTargetPower5GHT40 = {
  1536. /*
  1537. * 0_8_16,1-3_9-11_17-19,
  1538. * 4,5,6,7,12,13,14,15,20,21,22,23
  1539. */
  1540. { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
  1541. { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
  1542. { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
  1543. { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
  1544. { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
  1545. { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
  1546. { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
  1547. { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
  1548. },
  1549. .ctlIndex_5G = {
  1550. 0x10, 0x16, 0x18, 0x40, 0x46,
  1551. 0x48, 0x30, 0x36, 0x38
  1552. },
  1553. .ctl_freqbin_5G = {
  1554. {
  1555. /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1556. /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1557. /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  1558. /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  1559. /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
  1560. /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1561. /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  1562. /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  1563. },
  1564. {
  1565. /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1566. /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1567. /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  1568. /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  1569. /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
  1570. /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1571. /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  1572. /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  1573. },
  1574. {
  1575. /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  1576. /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  1577. /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  1578. /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
  1579. /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
  1580. /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
  1581. /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
  1582. /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
  1583. },
  1584. {
  1585. /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1586. /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  1587. /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
  1588. /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
  1589. /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  1590. /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1591. /* Data[3].ctlEdges[6].bChannel */ 0xFF,
  1592. /* Data[3].ctlEdges[7].bChannel */ 0xFF,
  1593. },
  1594. {
  1595. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1596. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1597. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
  1598. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
  1599. /* Data[4].ctlEdges[4].bChannel */ 0xFF,
  1600. /* Data[4].ctlEdges[5].bChannel */ 0xFF,
  1601. /* Data[4].ctlEdges[6].bChannel */ 0xFF,
  1602. /* Data[4].ctlEdges[7].bChannel */ 0xFF,
  1603. },
  1604. {
  1605. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  1606. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
  1607. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
  1608. /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  1609. /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
  1610. /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  1611. /* Data[5].ctlEdges[6].bChannel */ 0xFF,
  1612. /* Data[5].ctlEdges[7].bChannel */ 0xFF
  1613. },
  1614. {
  1615. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1616. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  1617. /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
  1618. /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
  1619. /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  1620. /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
  1621. /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
  1622. /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
  1623. },
  1624. {
  1625. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  1626. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  1627. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
  1628. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  1629. /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
  1630. /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  1631. /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  1632. /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  1633. },
  1634. {
  1635. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  1636. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  1637. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  1638. /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  1639. /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
  1640. /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  1641. /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
  1642. /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
  1643. }
  1644. },
  1645. .ctlPowerData_5G = {
  1646. {
  1647. {
  1648. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1649. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1650. }
  1651. },
  1652. {
  1653. {
  1654. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1655. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1656. }
  1657. },
  1658. {
  1659. {
  1660. {60, 0}, {60, 1}, {60, 0}, {60, 1},
  1661. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1662. }
  1663. },
  1664. {
  1665. {
  1666. {60, 0}, {60, 1}, {60, 1}, {60, 0},
  1667. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  1668. }
  1669. },
  1670. {
  1671. {
  1672. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1673. {60, 0}, {60, 0}, {60, 0}, {60, 0},
  1674. }
  1675. },
  1676. {
  1677. {
  1678. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1679. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  1680. }
  1681. },
  1682. {
  1683. {
  1684. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1685. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  1686. }
  1687. },
  1688. {
  1689. {
  1690. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  1691. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  1692. }
  1693. },
  1694. {
  1695. {
  1696. {60, 1}, {60, 0}, {60, 1}, {60, 1},
  1697. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  1698. }
  1699. },
  1700. }
  1701. };
  1702. static const struct ar9300_eeprom ar9300_x112 = {
  1703. .eepromVersion = 2,
  1704. .templateVersion = 5,
  1705. .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
  1706. .custData = {"x112-041-f0000"},
  1707. .baseEepHeader = {
  1708. .regDmn = { LE16(0), LE16(0x1f) },
  1709. .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
  1710. .opCapFlags = {
  1711. .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
  1712. .eepMisc = 0,
  1713. },
  1714. .rfSilent = 0,
  1715. .blueToothOptions = 0,
  1716. .deviceCap = 0,
  1717. .deviceType = 5, /* takes lower byte in eeprom location */
  1718. .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
  1719. .params_for_tuning_caps = {0, 0},
  1720. .featureEnable = 0x0d,
  1721. /*
  1722. * bit0 - enable tx temp comp - disabled
  1723. * bit1 - enable tx volt comp - disabled
  1724. * bit2 - enable fastclock - enabled
  1725. * bit3 - enable doubling - enabled
  1726. * bit4 - enable internal regulator - disabled
  1727. * bit5 - enable pa predistortion - disabled
  1728. */
  1729. .miscConfiguration = 0, /* bit0 - turn down drivestrength */
  1730. .eepromWriteEnableGpio = 6,
  1731. .wlanDisableGpio = 0,
  1732. .wlanLedGpio = 8,
  1733. .rxBandSelectGpio = 0xff,
  1734. .txrxgain = 0x0,
  1735. .swreg = 0,
  1736. },
  1737. .modalHeader2G = {
  1738. /* ar9300_modal_eep_header 2g */
  1739. /* 4 idle,t1,t2,b(4 bits per setting) */
  1740. .antCtrlCommon = LE32(0x110),
  1741. /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
  1742. .antCtrlCommon2 = LE32(0x22222),
  1743. /*
  1744. * antCtrlChain[ar9300_max_chains]; 6 idle, t, r,
  1745. * rx1, rx12, b (2 bits each)
  1746. */
  1747. .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) },
  1748. /*
  1749. * xatten1DB[AR9300_max_chains]; 3 xatten1_db
  1750. * for ar9280 (0xa20c/b20c 5:0)
  1751. */
  1752. .xatten1DB = {0x1b, 0x1b, 0x1b},
  1753. /*
  1754. * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
  1755. * for ar9280 (0xa20c/b20c 16:12
  1756. */
  1757. .xatten1Margin = {0x15, 0x15, 0x15},
  1758. .tempSlope = 50,
  1759. .voltSlope = 0,
  1760. /*
  1761. * spurChans[OSPrey_eeprom_modal_sPURS]; spur
  1762. * channels in usual fbin coding format
  1763. */
  1764. .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
  1765. /*
  1766. * noiseFloorThreshch[ar9300_max_cHAINS]; 3 Check
  1767. * if the register is per chain
  1768. */
  1769. .noiseFloorThreshCh = {-1, 0, 0},
  1770. .ob = {1, 1, 1},/* 3 chain */
  1771. .db_stage2 = {1, 1, 1}, /* 3 chain */
  1772. .db_stage3 = {0, 0, 0},
  1773. .db_stage4 = {0, 0, 0},
  1774. .xpaBiasLvl = 0,
  1775. .txFrameToDataStart = 0x0e,
  1776. .txFrameToPaOn = 0x0e,
  1777. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  1778. .antennaGain = 0,
  1779. .switchSettling = 0x2c,
  1780. .adcDesiredSize = -30,
  1781. .txEndToXpaOff = 0,
  1782. .txEndToRxOn = 0x2,
  1783. .txFrameToXpaOn = 0xe,
  1784. .thresh62 = 28,
  1785. .papdRateMaskHt20 = LE32(0x0c80c080),
  1786. .papdRateMaskHt40 = LE32(0x0080c080),
  1787. .futureModal = {
  1788. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1789. },
  1790. },
  1791. .base_ext1 = {
  1792. .ant_div_control = 0,
  1793. .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  1794. },
  1795. .calFreqPier2G = {
  1796. FREQ2FBIN(2412, 1),
  1797. FREQ2FBIN(2437, 1),
  1798. FREQ2FBIN(2472, 1),
  1799. },
  1800. /* ar9300_cal_data_per_freq_op_loop 2g */
  1801. .calPierData2G = {
  1802. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  1803. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  1804. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  1805. },
  1806. .calTarget_freqbin_Cck = {
  1807. FREQ2FBIN(2412, 1),
  1808. FREQ2FBIN(2472, 1),
  1809. },
  1810. .calTarget_freqbin_2G = {
  1811. FREQ2FBIN(2412, 1),
  1812. FREQ2FBIN(2437, 1),
  1813. FREQ2FBIN(2472, 1)
  1814. },
  1815. .calTarget_freqbin_2GHT20 = {
  1816. FREQ2FBIN(2412, 1),
  1817. FREQ2FBIN(2437, 1),
  1818. FREQ2FBIN(2472, 1)
  1819. },
  1820. .calTarget_freqbin_2GHT40 = {
  1821. FREQ2FBIN(2412, 1),
  1822. FREQ2FBIN(2437, 1),
  1823. FREQ2FBIN(2472, 1)
  1824. },
  1825. .calTargetPowerCck = {
  1826. /* 1L-5L,5S,11L,11s */
  1827. { {38, 38, 38, 38} },
  1828. { {38, 38, 38, 38} },
  1829. },
  1830. .calTargetPower2G = {
  1831. /* 6-24,36,48,54 */
  1832. { {38, 38, 36, 34} },
  1833. { {38, 38, 36, 34} },
  1834. { {38, 38, 34, 32} },
  1835. },
  1836. .calTargetPower2GHT20 = {
  1837. { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
  1838. { {36, 36, 36, 36, 36, 34, 36, 34, 32, 30, 30, 30, 28, 26} },
  1839. { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
  1840. },
  1841. .calTargetPower2GHT40 = {
  1842. { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
  1843. { {36, 36, 36, 36, 34, 32, 34, 32, 30, 28, 28, 28, 28, 24} },
  1844. { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
  1845. },
  1846. .ctlIndex_2G = {
  1847. 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
  1848. 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
  1849. },
  1850. .ctl_freqbin_2G = {
  1851. {
  1852. FREQ2FBIN(2412, 1),
  1853. FREQ2FBIN(2417, 1),
  1854. FREQ2FBIN(2457, 1),
  1855. FREQ2FBIN(2462, 1)
  1856. },
  1857. {
  1858. FREQ2FBIN(2412, 1),
  1859. FREQ2FBIN(2417, 1),
  1860. FREQ2FBIN(2462, 1),
  1861. 0xFF,
  1862. },
  1863. {
  1864. FREQ2FBIN(2412, 1),
  1865. FREQ2FBIN(2417, 1),
  1866. FREQ2FBIN(2462, 1),
  1867. 0xFF,
  1868. },
  1869. {
  1870. FREQ2FBIN(2422, 1),
  1871. FREQ2FBIN(2427, 1),
  1872. FREQ2FBIN(2447, 1),
  1873. FREQ2FBIN(2452, 1)
  1874. },
  1875. {
  1876. /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
  1877. /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
  1878. /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
  1879. /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(2484, 1),
  1880. },
  1881. {
  1882. /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
  1883. /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
  1884. /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
  1885. 0,
  1886. },
  1887. {
  1888. /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
  1889. /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
  1890. FREQ2FBIN(2472, 1),
  1891. 0,
  1892. },
  1893. {
  1894. /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
  1895. /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
  1896. /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
  1897. /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
  1898. },
  1899. {
  1900. /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
  1901. /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
  1902. /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
  1903. },
  1904. {
  1905. /* Data[9].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
  1906. /* Data[9].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
  1907. /* Data[9].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
  1908. 0
  1909. },
  1910. {
  1911. /* Data[10].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
  1912. /* Data[10].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
  1913. /* Data[10].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
  1914. 0
  1915. },
  1916. {
  1917. /* Data[11].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
  1918. /* Data[11].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
  1919. /* Data[11].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
  1920. /* Data[11].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
  1921. }
  1922. },
  1923. .ctlPowerData_2G = {
  1924. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1925. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1926. { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
  1927. { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
  1928. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1929. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1930. { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
  1931. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1932. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1933. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  1934. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  1935. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  1936. },
  1937. .modalHeader5G = {
  1938. /* 4 idle,t1,t2,b (4 bits per setting) */
  1939. .antCtrlCommon = LE32(0x110),
  1940. /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
  1941. .antCtrlCommon2 = LE32(0x22222),
  1942. /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
  1943. .antCtrlChain = {
  1944. LE16(0x0), LE16(0x0), LE16(0x0),
  1945. },
  1946. /* xatten1DB 3 xatten1_db for ar9280 (0xa20c/b20c 5:0) */
  1947. .xatten1DB = {0x13, 0x19, 0x17},
  1948. /*
  1949. * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
  1950. * for merlin (0xa20c/b20c 16:12
  1951. */
  1952. .xatten1Margin = {0x19, 0x19, 0x19},
  1953. .tempSlope = 70,
  1954. .voltSlope = 15,
  1955. /* spurChans spur channels in usual fbin coding format */
  1956. .spurChans = {0, 0, 0, 0, 0},
  1957. /* noiseFloorThreshch check if the register is per chain */
  1958. .noiseFloorThreshCh = {-1, 0, 0},
  1959. .ob = {3, 3, 3}, /* 3 chain */
  1960. .db_stage2 = {3, 3, 3}, /* 3 chain */
  1961. .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
  1962. .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
  1963. .xpaBiasLvl = 0,
  1964. .txFrameToDataStart = 0x0e,
  1965. .txFrameToPaOn = 0x0e,
  1966. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  1967. .antennaGain = 0,
  1968. .switchSettling = 0x2d,
  1969. .adcDesiredSize = -30,
  1970. .txEndToXpaOff = 0,
  1971. .txEndToRxOn = 0x2,
  1972. .txFrameToXpaOn = 0xe,
  1973. .thresh62 = 28,
  1974. .papdRateMaskHt20 = LE32(0x0cf0e0e0),
  1975. .papdRateMaskHt40 = LE32(0x6cf0e0e0),
  1976. .futureModal = {
  1977. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  1978. },
  1979. },
  1980. .base_ext2 = {
  1981. .tempSlopeLow = 72,
  1982. .tempSlopeHigh = 105,
  1983. .xatten1DBLow = {0x10, 0x14, 0x10},
  1984. .xatten1MarginLow = {0x19, 0x19 , 0x19},
  1985. .xatten1DBHigh = {0x1d, 0x20, 0x24},
  1986. .xatten1MarginHigh = {0x10, 0x10, 0x10}
  1987. },
  1988. .calFreqPier5G = {
  1989. FREQ2FBIN(5180, 0),
  1990. FREQ2FBIN(5220, 0),
  1991. FREQ2FBIN(5320, 0),
  1992. FREQ2FBIN(5400, 0),
  1993. FREQ2FBIN(5500, 0),
  1994. FREQ2FBIN(5600, 0),
  1995. FREQ2FBIN(5700, 0),
  1996. FREQ2FBIN(5785, 0)
  1997. },
  1998. .calPierData5G = {
  1999. {
  2000. {0, 0, 0, 0, 0},
  2001. {0, 0, 0, 0, 0},
  2002. {0, 0, 0, 0, 0},
  2003. {0, 0, 0, 0, 0},
  2004. {0, 0, 0, 0, 0},
  2005. {0, 0, 0, 0, 0},
  2006. {0, 0, 0, 0, 0},
  2007. {0, 0, 0, 0, 0},
  2008. },
  2009. {
  2010. {0, 0, 0, 0, 0},
  2011. {0, 0, 0, 0, 0},
  2012. {0, 0, 0, 0, 0},
  2013. {0, 0, 0, 0, 0},
  2014. {0, 0, 0, 0, 0},
  2015. {0, 0, 0, 0, 0},
  2016. {0, 0, 0, 0, 0},
  2017. {0, 0, 0, 0, 0},
  2018. },
  2019. {
  2020. {0, 0, 0, 0, 0},
  2021. {0, 0, 0, 0, 0},
  2022. {0, 0, 0, 0, 0},
  2023. {0, 0, 0, 0, 0},
  2024. {0, 0, 0, 0, 0},
  2025. {0, 0, 0, 0, 0},
  2026. {0, 0, 0, 0, 0},
  2027. {0, 0, 0, 0, 0},
  2028. },
  2029. },
  2030. .calTarget_freqbin_5G = {
  2031. FREQ2FBIN(5180, 0),
  2032. FREQ2FBIN(5220, 0),
  2033. FREQ2FBIN(5320, 0),
  2034. FREQ2FBIN(5400, 0),
  2035. FREQ2FBIN(5500, 0),
  2036. FREQ2FBIN(5600, 0),
  2037. FREQ2FBIN(5725, 0),
  2038. FREQ2FBIN(5825, 0)
  2039. },
  2040. .calTarget_freqbin_5GHT20 = {
  2041. FREQ2FBIN(5180, 0),
  2042. FREQ2FBIN(5220, 0),
  2043. FREQ2FBIN(5320, 0),
  2044. FREQ2FBIN(5400, 0),
  2045. FREQ2FBIN(5500, 0),
  2046. FREQ2FBIN(5600, 0),
  2047. FREQ2FBIN(5725, 0),
  2048. FREQ2FBIN(5825, 0)
  2049. },
  2050. .calTarget_freqbin_5GHT40 = {
  2051. FREQ2FBIN(5180, 0),
  2052. FREQ2FBIN(5220, 0),
  2053. FREQ2FBIN(5320, 0),
  2054. FREQ2FBIN(5400, 0),
  2055. FREQ2FBIN(5500, 0),
  2056. FREQ2FBIN(5600, 0),
  2057. FREQ2FBIN(5725, 0),
  2058. FREQ2FBIN(5825, 0)
  2059. },
  2060. .calTargetPower5G = {
  2061. /* 6-24,36,48,54 */
  2062. { {32, 32, 28, 26} },
  2063. { {32, 32, 28, 26} },
  2064. { {32, 32, 28, 26} },
  2065. { {32, 32, 26, 24} },
  2066. { {32, 32, 26, 24} },
  2067. { {32, 32, 24, 22} },
  2068. { {30, 30, 24, 22} },
  2069. { {30, 30, 24, 22} },
  2070. },
  2071. .calTargetPower5GHT20 = {
  2072. /*
  2073. * 0_8_16,1-3_9-11_17-19,
  2074. * 4,5,6,7,12,13,14,15,20,21,22,23
  2075. */
  2076. { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
  2077. { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
  2078. { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
  2079. { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 22, 22, 20, 20} },
  2080. { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 20, 18, 16, 16} },
  2081. { {32, 32, 32, 32, 28, 26, 32, 24, 20, 16, 18, 16, 14, 14} },
  2082. { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
  2083. { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
  2084. },
  2085. .calTargetPower5GHT40 = {
  2086. /*
  2087. * 0_8_16,1-3_9-11_17-19,
  2088. * 4,5,6,7,12,13,14,15,20,21,22,23
  2089. */
  2090. { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
  2091. { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
  2092. { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
  2093. { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 22, 22, 20, 20} },
  2094. { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 20, 18, 16, 16} },
  2095. { {32, 32, 32, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
  2096. { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
  2097. { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
  2098. },
  2099. .ctlIndex_5G = {
  2100. 0x10, 0x16, 0x18, 0x40, 0x46,
  2101. 0x48, 0x30, 0x36, 0x38
  2102. },
  2103. .ctl_freqbin_5G = {
  2104. {
  2105. /* Data[0].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
  2106. /* Data[0].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
  2107. /* Data[0].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
  2108. /* Data[0].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
  2109. /* Data[0].ctledges[4].bchannel */ FREQ2FBIN(5600, 0),
  2110. /* Data[0].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
  2111. /* Data[0].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
  2112. /* Data[0].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
  2113. },
  2114. {
  2115. /* Data[1].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
  2116. /* Data[1].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
  2117. /* Data[1].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
  2118. /* Data[1].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
  2119. /* Data[1].ctledges[4].bchannel */ FREQ2FBIN(5520, 0),
  2120. /* Data[1].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
  2121. /* Data[1].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
  2122. /* Data[1].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
  2123. },
  2124. {
  2125. /* Data[2].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
  2126. /* Data[2].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
  2127. /* Data[2].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
  2128. /* Data[2].ctledges[3].bchannel */ FREQ2FBIN(5310, 0),
  2129. /* Data[2].ctledges[4].bchannel */ FREQ2FBIN(5510, 0),
  2130. /* Data[2].ctledges[5].bchannel */ FREQ2FBIN(5550, 0),
  2131. /* Data[2].ctledges[6].bchannel */ FREQ2FBIN(5670, 0),
  2132. /* Data[2].ctledges[7].bchannel */ FREQ2FBIN(5755, 0)
  2133. },
  2134. {
  2135. /* Data[3].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
  2136. /* Data[3].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
  2137. /* Data[3].ctledges[2].bchannel */ FREQ2FBIN(5260, 0),
  2138. /* Data[3].ctledges[3].bchannel */ FREQ2FBIN(5320, 0),
  2139. /* Data[3].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
  2140. /* Data[3].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
  2141. /* Data[3].ctledges[6].bchannel */ 0xFF,
  2142. /* Data[3].ctledges[7].bchannel */ 0xFF,
  2143. },
  2144. {
  2145. /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
  2146. /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
  2147. /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(5500, 0),
  2148. /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(5700, 0),
  2149. /* Data[4].ctledges[4].bchannel */ 0xFF,
  2150. /* Data[4].ctledges[5].bchannel */ 0xFF,
  2151. /* Data[4].ctledges[6].bchannel */ 0xFF,
  2152. /* Data[4].ctledges[7].bchannel */ 0xFF,
  2153. },
  2154. {
  2155. /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
  2156. /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(5270, 0),
  2157. /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(5310, 0),
  2158. /* Data[5].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
  2159. /* Data[5].ctledges[4].bchannel */ FREQ2FBIN(5590, 0),
  2160. /* Data[5].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
  2161. /* Data[5].ctledges[6].bchannel */ 0xFF,
  2162. /* Data[5].ctledges[7].bchannel */ 0xFF
  2163. },
  2164. {
  2165. /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
  2166. /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
  2167. /* Data[6].ctledges[2].bchannel */ FREQ2FBIN(5220, 0),
  2168. /* Data[6].ctledges[3].bchannel */ FREQ2FBIN(5260, 0),
  2169. /* Data[6].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
  2170. /* Data[6].ctledges[5].bchannel */ FREQ2FBIN(5600, 0),
  2171. /* Data[6].ctledges[6].bchannel */ FREQ2FBIN(5700, 0),
  2172. /* Data[6].ctledges[7].bchannel */ FREQ2FBIN(5745, 0)
  2173. },
  2174. {
  2175. /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
  2176. /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
  2177. /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(5320, 0),
  2178. /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
  2179. /* Data[7].ctledges[4].bchannel */ FREQ2FBIN(5560, 0),
  2180. /* Data[7].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
  2181. /* Data[7].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
  2182. /* Data[7].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
  2183. },
  2184. {
  2185. /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
  2186. /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
  2187. /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
  2188. /* Data[8].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
  2189. /* Data[8].ctledges[4].bchannel */ FREQ2FBIN(5550, 0),
  2190. /* Data[8].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
  2191. /* Data[8].ctledges[6].bchannel */ FREQ2FBIN(5755, 0),
  2192. /* Data[8].ctledges[7].bchannel */ FREQ2FBIN(5795, 0)
  2193. }
  2194. },
  2195. .ctlPowerData_5G = {
  2196. {
  2197. {
  2198. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2199. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2200. }
  2201. },
  2202. {
  2203. {
  2204. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2205. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2206. }
  2207. },
  2208. {
  2209. {
  2210. {60, 0}, {60, 1}, {60, 0}, {60, 1},
  2211. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2212. }
  2213. },
  2214. {
  2215. {
  2216. {60, 0}, {60, 1}, {60, 1}, {60, 0},
  2217. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  2218. }
  2219. },
  2220. {
  2221. {
  2222. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2223. {60, 0}, {60, 0}, {60, 0}, {60, 0},
  2224. }
  2225. },
  2226. {
  2227. {
  2228. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2229. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  2230. }
  2231. },
  2232. {
  2233. {
  2234. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2235. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2236. }
  2237. },
  2238. {
  2239. {
  2240. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  2241. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2242. }
  2243. },
  2244. {
  2245. {
  2246. {60, 1}, {60, 0}, {60, 1}, {60, 1},
  2247. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  2248. }
  2249. },
  2250. }
  2251. };
  2252. static const struct ar9300_eeprom ar9300_h116 = {
  2253. .eepromVersion = 2,
  2254. .templateVersion = 4,
  2255. .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
  2256. .custData = {"h116-041-f0000"},
  2257. .baseEepHeader = {
  2258. .regDmn = { LE16(0), LE16(0x1f) },
  2259. .txrxMask = 0x33, /* 4 bits tx and 4 bits rx */
  2260. .opCapFlags = {
  2261. .opFlags = AR9300_OPFLAGS_11G | AR9300_OPFLAGS_11A,
  2262. .eepMisc = 0,
  2263. },
  2264. .rfSilent = 0,
  2265. .blueToothOptions = 0,
  2266. .deviceCap = 0,
  2267. .deviceType = 5, /* takes lower byte in eeprom location */
  2268. .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
  2269. .params_for_tuning_caps = {0, 0},
  2270. .featureEnable = 0x0d,
  2271. /*
  2272. * bit0 - enable tx temp comp - disabled
  2273. * bit1 - enable tx volt comp - disabled
  2274. * bit2 - enable fastClock - enabled
  2275. * bit3 - enable doubling - enabled
  2276. * bit4 - enable internal regulator - disabled
  2277. * bit5 - enable pa predistortion - disabled
  2278. */
  2279. .miscConfiguration = 0, /* bit0 - turn down drivestrength */
  2280. .eepromWriteEnableGpio = 6,
  2281. .wlanDisableGpio = 0,
  2282. .wlanLedGpio = 8,
  2283. .rxBandSelectGpio = 0xff,
  2284. .txrxgain = 0x10,
  2285. .swreg = 0,
  2286. },
  2287. .modalHeader2G = {
  2288. /* ar9300_modal_eep_header 2g */
  2289. /* 4 idle,t1,t2,b(4 bits per setting) */
  2290. .antCtrlCommon = LE32(0x110),
  2291. /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
  2292. .antCtrlCommon2 = LE32(0x44444),
  2293. /*
  2294. * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
  2295. * rx1, rx12, b (2 bits each)
  2296. */
  2297. .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) },
  2298. /*
  2299. * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
  2300. * for ar9280 (0xa20c/b20c 5:0)
  2301. */
  2302. .xatten1DB = {0x1f, 0x1f, 0x1f},
  2303. /*
  2304. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  2305. * for ar9280 (0xa20c/b20c 16:12
  2306. */
  2307. .xatten1Margin = {0x12, 0x12, 0x12},
  2308. .tempSlope = 25,
  2309. .voltSlope = 0,
  2310. /*
  2311. * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
  2312. * channels in usual fbin coding format
  2313. */
  2314. .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
  2315. /*
  2316. * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
  2317. * if the register is per chain
  2318. */
  2319. .noiseFloorThreshCh = {-1, 0, 0},
  2320. .ob = {1, 1, 1},/* 3 chain */
  2321. .db_stage2 = {1, 1, 1}, /* 3 chain */
  2322. .db_stage3 = {0, 0, 0},
  2323. .db_stage4 = {0, 0, 0},
  2324. .xpaBiasLvl = 0,
  2325. .txFrameToDataStart = 0x0e,
  2326. .txFrameToPaOn = 0x0e,
  2327. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  2328. .antennaGain = 0,
  2329. .switchSettling = 0x2c,
  2330. .adcDesiredSize = -30,
  2331. .txEndToXpaOff = 0,
  2332. .txEndToRxOn = 0x2,
  2333. .txFrameToXpaOn = 0xe,
  2334. .thresh62 = 28,
  2335. .papdRateMaskHt20 = LE32(0x0c80C080),
  2336. .papdRateMaskHt40 = LE32(0x0080C080),
  2337. .futureModal = {
  2338. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2339. },
  2340. },
  2341. .base_ext1 = {
  2342. .ant_div_control = 0,
  2343. .future = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  2344. },
  2345. .calFreqPier2G = {
  2346. FREQ2FBIN(2412, 1),
  2347. FREQ2FBIN(2437, 1),
  2348. FREQ2FBIN(2472, 1),
  2349. },
  2350. /* ar9300_cal_data_per_freq_op_loop 2g */
  2351. .calPierData2G = {
  2352. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  2353. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  2354. { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
  2355. },
  2356. .calTarget_freqbin_Cck = {
  2357. FREQ2FBIN(2412, 1),
  2358. FREQ2FBIN(2472, 1),
  2359. },
  2360. .calTarget_freqbin_2G = {
  2361. FREQ2FBIN(2412, 1),
  2362. FREQ2FBIN(2437, 1),
  2363. FREQ2FBIN(2472, 1)
  2364. },
  2365. .calTarget_freqbin_2GHT20 = {
  2366. FREQ2FBIN(2412, 1),
  2367. FREQ2FBIN(2437, 1),
  2368. FREQ2FBIN(2472, 1)
  2369. },
  2370. .calTarget_freqbin_2GHT40 = {
  2371. FREQ2FBIN(2412, 1),
  2372. FREQ2FBIN(2437, 1),
  2373. FREQ2FBIN(2472, 1)
  2374. },
  2375. .calTargetPowerCck = {
  2376. /* 1L-5L,5S,11L,11S */
  2377. { {34, 34, 34, 34} },
  2378. { {34, 34, 34, 34} },
  2379. },
  2380. .calTargetPower2G = {
  2381. /* 6-24,36,48,54 */
  2382. { {34, 34, 32, 32} },
  2383. { {34, 34, 32, 32} },
  2384. { {34, 34, 32, 32} },
  2385. },
  2386. .calTargetPower2GHT20 = {
  2387. { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
  2388. { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
  2389. { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
  2390. },
  2391. .calTargetPower2GHT40 = {
  2392. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
  2393. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
  2394. { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
  2395. },
  2396. .ctlIndex_2G = {
  2397. 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
  2398. 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
  2399. },
  2400. .ctl_freqbin_2G = {
  2401. {
  2402. FREQ2FBIN(2412, 1),
  2403. FREQ2FBIN(2417, 1),
  2404. FREQ2FBIN(2457, 1),
  2405. FREQ2FBIN(2462, 1)
  2406. },
  2407. {
  2408. FREQ2FBIN(2412, 1),
  2409. FREQ2FBIN(2417, 1),
  2410. FREQ2FBIN(2462, 1),
  2411. 0xFF,
  2412. },
  2413. {
  2414. FREQ2FBIN(2412, 1),
  2415. FREQ2FBIN(2417, 1),
  2416. FREQ2FBIN(2462, 1),
  2417. 0xFF,
  2418. },
  2419. {
  2420. FREQ2FBIN(2422, 1),
  2421. FREQ2FBIN(2427, 1),
  2422. FREQ2FBIN(2447, 1),
  2423. FREQ2FBIN(2452, 1)
  2424. },
  2425. {
  2426. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  2427. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  2428. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  2429. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
  2430. },
  2431. {
  2432. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  2433. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  2434. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  2435. 0,
  2436. },
  2437. {
  2438. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  2439. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  2440. FREQ2FBIN(2472, 1),
  2441. 0,
  2442. },
  2443. {
  2444. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  2445. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  2446. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  2447. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  2448. },
  2449. {
  2450. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  2451. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  2452. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  2453. },
  2454. {
  2455. /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  2456. /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  2457. /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  2458. 0
  2459. },
  2460. {
  2461. /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
  2462. /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
  2463. /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
  2464. 0
  2465. },
  2466. {
  2467. /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
  2468. /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
  2469. /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
  2470. /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
  2471. }
  2472. },
  2473. .ctlPowerData_2G = {
  2474. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2475. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2476. { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } },
  2477. { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } },
  2478. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2479. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2480. { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } },
  2481. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2482. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2483. { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } },
  2484. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  2485. { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } },
  2486. },
  2487. .modalHeader5G = {
  2488. /* 4 idle,t1,t2,b (4 bits per setting) */
  2489. .antCtrlCommon = LE32(0x220),
  2490. /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
  2491. .antCtrlCommon2 = LE32(0x44444),
  2492. /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
  2493. .antCtrlChain = {
  2494. LE16(0x150), LE16(0x150), LE16(0x150),
  2495. },
  2496. /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
  2497. .xatten1DB = {0x19, 0x19, 0x19},
  2498. /*
  2499. * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
  2500. * for merlin (0xa20c/b20c 16:12
  2501. */
  2502. .xatten1Margin = {0x14, 0x14, 0x14},
  2503. .tempSlope = 70,
  2504. .voltSlope = 0,
  2505. /* spurChans spur channels in usual fbin coding format */
  2506. .spurChans = {0, 0, 0, 0, 0},
  2507. /* noiseFloorThreshCh Check if the register is per chain */
  2508. .noiseFloorThreshCh = {-1, 0, 0},
  2509. .ob = {3, 3, 3}, /* 3 chain */
  2510. .db_stage2 = {3, 3, 3}, /* 3 chain */
  2511. .db_stage3 = {3, 3, 3}, /* doesn't exist for 2G */
  2512. .db_stage4 = {3, 3, 3}, /* don't exist for 2G */
  2513. .xpaBiasLvl = 0,
  2514. .txFrameToDataStart = 0x0e,
  2515. .txFrameToPaOn = 0x0e,
  2516. .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
  2517. .antennaGain = 0,
  2518. .switchSettling = 0x2d,
  2519. .adcDesiredSize = -30,
  2520. .txEndToXpaOff = 0,
  2521. .txEndToRxOn = 0x2,
  2522. .txFrameToXpaOn = 0xe,
  2523. .thresh62 = 28,
  2524. .papdRateMaskHt20 = LE32(0x0cf0e0e0),
  2525. .papdRateMaskHt40 = LE32(0x6cf0e0e0),
  2526. .futureModal = {
  2527. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  2528. },
  2529. },
  2530. .base_ext2 = {
  2531. .tempSlopeLow = 35,
  2532. .tempSlopeHigh = 50,
  2533. .xatten1DBLow = {0, 0, 0},
  2534. .xatten1MarginLow = {0, 0, 0},
  2535. .xatten1DBHigh = {0, 0, 0},
  2536. .xatten1MarginHigh = {0, 0, 0}
  2537. },
  2538. .calFreqPier5G = {
  2539. FREQ2FBIN(5180, 0),
  2540. FREQ2FBIN(5220, 0),
  2541. FREQ2FBIN(5320, 0),
  2542. FREQ2FBIN(5400, 0),
  2543. FREQ2FBIN(5500, 0),
  2544. FREQ2FBIN(5600, 0),
  2545. FREQ2FBIN(5700, 0),
  2546. FREQ2FBIN(5785, 0)
  2547. },
  2548. .calPierData5G = {
  2549. {
  2550. {0, 0, 0, 0, 0},
  2551. {0, 0, 0, 0, 0},
  2552. {0, 0, 0, 0, 0},
  2553. {0, 0, 0, 0, 0},
  2554. {0, 0, 0, 0, 0},
  2555. {0, 0, 0, 0, 0},
  2556. {0, 0, 0, 0, 0},
  2557. {0, 0, 0, 0, 0},
  2558. },
  2559. {
  2560. {0, 0, 0, 0, 0},
  2561. {0, 0, 0, 0, 0},
  2562. {0, 0, 0, 0, 0},
  2563. {0, 0, 0, 0, 0},
  2564. {0, 0, 0, 0, 0},
  2565. {0, 0, 0, 0, 0},
  2566. {0, 0, 0, 0, 0},
  2567. {0, 0, 0, 0, 0},
  2568. },
  2569. {
  2570. {0, 0, 0, 0, 0},
  2571. {0, 0, 0, 0, 0},
  2572. {0, 0, 0, 0, 0},
  2573. {0, 0, 0, 0, 0},
  2574. {0, 0, 0, 0, 0},
  2575. {0, 0, 0, 0, 0},
  2576. {0, 0, 0, 0, 0},
  2577. {0, 0, 0, 0, 0},
  2578. },
  2579. },
  2580. .calTarget_freqbin_5G = {
  2581. FREQ2FBIN(5180, 0),
  2582. FREQ2FBIN(5240, 0),
  2583. FREQ2FBIN(5320, 0),
  2584. FREQ2FBIN(5400, 0),
  2585. FREQ2FBIN(5500, 0),
  2586. FREQ2FBIN(5600, 0),
  2587. FREQ2FBIN(5700, 0),
  2588. FREQ2FBIN(5825, 0)
  2589. },
  2590. .calTarget_freqbin_5GHT20 = {
  2591. FREQ2FBIN(5180, 0),
  2592. FREQ2FBIN(5240, 0),
  2593. FREQ2FBIN(5320, 0),
  2594. FREQ2FBIN(5400, 0),
  2595. FREQ2FBIN(5500, 0),
  2596. FREQ2FBIN(5700, 0),
  2597. FREQ2FBIN(5745, 0),
  2598. FREQ2FBIN(5825, 0)
  2599. },
  2600. .calTarget_freqbin_5GHT40 = {
  2601. FREQ2FBIN(5180, 0),
  2602. FREQ2FBIN(5240, 0),
  2603. FREQ2FBIN(5320, 0),
  2604. FREQ2FBIN(5400, 0),
  2605. FREQ2FBIN(5500, 0),
  2606. FREQ2FBIN(5700, 0),
  2607. FREQ2FBIN(5745, 0),
  2608. FREQ2FBIN(5825, 0)
  2609. },
  2610. .calTargetPower5G = {
  2611. /* 6-24,36,48,54 */
  2612. { {30, 30, 28, 24} },
  2613. { {30, 30, 28, 24} },
  2614. { {30, 30, 28, 24} },
  2615. { {30, 30, 28, 24} },
  2616. { {30, 30, 28, 24} },
  2617. { {30, 30, 28, 24} },
  2618. { {30, 30, 28, 24} },
  2619. { {30, 30, 28, 24} },
  2620. },
  2621. .calTargetPower5GHT20 = {
  2622. /*
  2623. * 0_8_16,1-3_9-11_17-19,
  2624. * 4,5,6,7,12,13,14,15,20,21,22,23
  2625. */
  2626. { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
  2627. { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
  2628. { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
  2629. { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
  2630. { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
  2631. { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
  2632. { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
  2633. { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
  2634. },
  2635. .calTargetPower5GHT40 = {
  2636. /*
  2637. * 0_8_16,1-3_9-11_17-19,
  2638. * 4,5,6,7,12,13,14,15,20,21,22,23
  2639. */
  2640. { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
  2641. { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
  2642. { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
  2643. { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
  2644. { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
  2645. { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
  2646. { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
  2647. { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
  2648. },
  2649. .ctlIndex_5G = {
  2650. 0x10, 0x16, 0x18, 0x40, 0x46,
  2651. 0x48, 0x30, 0x36, 0x38
  2652. },
  2653. .ctl_freqbin_5G = {
  2654. {
  2655. /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  2656. /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  2657. /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  2658. /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  2659. /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
  2660. /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  2661. /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  2662. /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  2663. },
  2664. {
  2665. /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  2666. /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  2667. /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
  2668. /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  2669. /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
  2670. /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  2671. /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  2672. /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  2673. },
  2674. {
  2675. /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  2676. /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  2677. /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  2678. /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
  2679. /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
  2680. /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
  2681. /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
  2682. /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
  2683. },
  2684. {
  2685. /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  2686. /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  2687. /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
  2688. /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
  2689. /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  2690. /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  2691. /* Data[3].ctlEdges[6].bChannel */ 0xFF,
  2692. /* Data[3].ctlEdges[7].bChannel */ 0xFF,
  2693. },
  2694. {
  2695. /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  2696. /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  2697. /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
  2698. /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
  2699. /* Data[4].ctlEdges[4].bChannel */ 0xFF,
  2700. /* Data[4].ctlEdges[5].bChannel */ 0xFF,
  2701. /* Data[4].ctlEdges[6].bChannel */ 0xFF,
  2702. /* Data[4].ctlEdges[7].bChannel */ 0xFF,
  2703. },
  2704. {
  2705. /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  2706. /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
  2707. /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
  2708. /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  2709. /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
  2710. /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  2711. /* Data[5].ctlEdges[6].bChannel */ 0xFF,
  2712. /* Data[5].ctlEdges[7].bChannel */ 0xFF
  2713. },
  2714. {
  2715. /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  2716. /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
  2717. /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
  2718. /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
  2719. /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
  2720. /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
  2721. /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
  2722. /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
  2723. },
  2724. {
  2725. /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
  2726. /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
  2727. /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
  2728. /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
  2729. /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
  2730. /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
  2731. /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
  2732. /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
  2733. },
  2734. {
  2735. /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
  2736. /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
  2737. /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
  2738. /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
  2739. /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
  2740. /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
  2741. /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
  2742. /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
  2743. }
  2744. },
  2745. .ctlPowerData_5G = {
  2746. {
  2747. {
  2748. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2749. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2750. }
  2751. },
  2752. {
  2753. {
  2754. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2755. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2756. }
  2757. },
  2758. {
  2759. {
  2760. {60, 0}, {60, 1}, {60, 0}, {60, 1},
  2761. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2762. }
  2763. },
  2764. {
  2765. {
  2766. {60, 0}, {60, 1}, {60, 1}, {60, 0},
  2767. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  2768. }
  2769. },
  2770. {
  2771. {
  2772. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2773. {60, 0}, {60, 0}, {60, 0}, {60, 0},
  2774. }
  2775. },
  2776. {
  2777. {
  2778. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2779. {60, 1}, {60, 0}, {60, 0}, {60, 0},
  2780. }
  2781. },
  2782. {
  2783. {
  2784. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2785. {60, 1}, {60, 1}, {60, 1}, {60, 1},
  2786. }
  2787. },
  2788. {
  2789. {
  2790. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  2791. {60, 1}, {60, 1}, {60, 1}, {60, 0},
  2792. }
  2793. },
  2794. {
  2795. {
  2796. {60, 1}, {60, 0}, {60, 1}, {60, 1},
  2797. {60, 1}, {60, 1}, {60, 0}, {60, 1},
  2798. }
  2799. },
  2800. }
  2801. };
  2802. static const struct ar9300_eeprom *ar9300_eep_templates[] = {
  2803. &ar9300_default,
  2804. &ar9300_x112,
  2805. &ar9300_h116,
  2806. &ar9300_h112,
  2807. &ar9300_x113,
  2808. };
  2809. static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id)
  2810. {
  2811. #define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0]))
  2812. int it;
  2813. for (it = 0; it < N_LOOP; it++)
  2814. if (ar9300_eep_templates[it]->templateVersion == id)
  2815. return ar9300_eep_templates[it];
  2816. return NULL;
  2817. #undef N_LOOP
  2818. }
  2819. static u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
  2820. {
  2821. if (fbin == AR9300_BCHAN_UNUSED)
  2822. return fbin;
  2823. return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin));
  2824. }
  2825. static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah)
  2826. {
  2827. return 0;
  2828. }
  2829. static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
  2830. enum eeprom_param param)
  2831. {
  2832. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  2833. struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
  2834. switch (param) {
  2835. case EEP_MAC_LSW:
  2836. return eep->macAddr[0] << 8 | eep->macAddr[1];
  2837. case EEP_MAC_MID:
  2838. return eep->macAddr[2] << 8 | eep->macAddr[3];
  2839. case EEP_MAC_MSW:
  2840. return eep->macAddr[4] << 8 | eep->macAddr[5];
  2841. case EEP_REG_0:
  2842. return le16_to_cpu(pBase->regDmn[0]);
  2843. case EEP_REG_1:
  2844. return le16_to_cpu(pBase->regDmn[1]);
  2845. case EEP_OP_CAP:
  2846. return pBase->deviceCap;
  2847. case EEP_OP_MODE:
  2848. return pBase->opCapFlags.opFlags;
  2849. case EEP_RF_SILENT:
  2850. return pBase->rfSilent;
  2851. case EEP_TX_MASK:
  2852. return (pBase->txrxMask >> 4) & 0xf;
  2853. case EEP_RX_MASK:
  2854. return pBase->txrxMask & 0xf;
  2855. case EEP_DRIVE_STRENGTH:
  2856. #define AR9300_EEP_BASE_DRIV_STRENGTH 0x1
  2857. return pBase->miscConfiguration & AR9300_EEP_BASE_DRIV_STRENGTH;
  2858. case EEP_INTERNAL_REGULATOR:
  2859. /* Bit 4 is internal regulator flag */
  2860. return (pBase->featureEnable & 0x10) >> 4;
  2861. case EEP_SWREG:
  2862. return le32_to_cpu(pBase->swreg);
  2863. case EEP_PAPRD:
  2864. return !!(pBase->featureEnable & BIT(5));
  2865. default:
  2866. return 0;
  2867. }
  2868. }
  2869. static bool ar9300_eeprom_read_byte(struct ath_common *common, int address,
  2870. u8 *buffer)
  2871. {
  2872. u16 val;
  2873. if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val)))
  2874. return false;
  2875. *buffer = (val >> (8 * (address % 2))) & 0xff;
  2876. return true;
  2877. }
  2878. static bool ar9300_eeprom_read_word(struct ath_common *common, int address,
  2879. u8 *buffer)
  2880. {
  2881. u16 val;
  2882. if (unlikely(!ath9k_hw_nvram_read(common, address / 2, &val)))
  2883. return false;
  2884. buffer[0] = val >> 8;
  2885. buffer[1] = val & 0xff;
  2886. return true;
  2887. }
  2888. static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
  2889. int count)
  2890. {
  2891. struct ath_common *common = ath9k_hw_common(ah);
  2892. int i;
  2893. if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) {
  2894. ath_print(common, ATH_DBG_EEPROM,
  2895. "eeprom address not in range\n");
  2896. return false;
  2897. }
  2898. /*
  2899. * Since we're reading the bytes in reverse order from a little-endian
  2900. * word stream, an even address means we only use the lower half of
  2901. * the 16-bit word at that address
  2902. */
  2903. if (address % 2 == 0) {
  2904. if (!ar9300_eeprom_read_byte(common, address--, buffer++))
  2905. goto error;
  2906. count--;
  2907. }
  2908. for (i = 0; i < count / 2; i++) {
  2909. if (!ar9300_eeprom_read_word(common, address, buffer))
  2910. goto error;
  2911. address -= 2;
  2912. buffer += 2;
  2913. }
  2914. if (count % 2)
  2915. if (!ar9300_eeprom_read_byte(common, address, buffer))
  2916. goto error;
  2917. return true;
  2918. error:
  2919. ath_print(common, ATH_DBG_EEPROM,
  2920. "unable to read eeprom region at offset %d\n", address);
  2921. return false;
  2922. }
  2923. static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference,
  2924. int *length, int *major, int *minor)
  2925. {
  2926. unsigned long value[4];
  2927. value[0] = best[0];
  2928. value[1] = best[1];
  2929. value[2] = best[2];
  2930. value[3] = best[3];
  2931. *code = ((value[0] >> 5) & 0x0007);
  2932. *reference = (value[0] & 0x001f) | ((value[1] >> 2) & 0x0020);
  2933. *length = ((value[1] << 4) & 0x07f0) | ((value[2] >> 4) & 0x000f);
  2934. *major = (value[2] & 0x000f);
  2935. *minor = (value[3] & 0x00ff);
  2936. }
  2937. static u16 ar9300_comp_cksum(u8 *data, int dsize)
  2938. {
  2939. int it, checksum = 0;
  2940. for (it = 0; it < dsize; it++) {
  2941. checksum += data[it];
  2942. checksum &= 0xffff;
  2943. }
  2944. return checksum;
  2945. }
  2946. static bool ar9300_uncompress_block(struct ath_hw *ah,
  2947. u8 *mptr,
  2948. int mdataSize,
  2949. u8 *block,
  2950. int size)
  2951. {
  2952. int it;
  2953. int spot;
  2954. int offset;
  2955. int length;
  2956. struct ath_common *common = ath9k_hw_common(ah);
  2957. spot = 0;
  2958. for (it = 0; it < size; it += (length+2)) {
  2959. offset = block[it];
  2960. offset &= 0xff;
  2961. spot += offset;
  2962. length = block[it+1];
  2963. length &= 0xff;
  2964. if (length > 0 && spot >= 0 && spot+length <= mdataSize) {
  2965. ath_print(common, ATH_DBG_EEPROM,
  2966. "Restore at %d: spot=%d "
  2967. "offset=%d length=%d\n",
  2968. it, spot, offset, length);
  2969. memcpy(&mptr[spot], &block[it+2], length);
  2970. spot += length;
  2971. } else if (length > 0) {
  2972. ath_print(common, ATH_DBG_EEPROM,
  2973. "Bad restore at %d: spot=%d "
  2974. "offset=%d length=%d\n",
  2975. it, spot, offset, length);
  2976. return false;
  2977. }
  2978. }
  2979. return true;
  2980. }
  2981. static int ar9300_compress_decision(struct ath_hw *ah,
  2982. int it,
  2983. int code,
  2984. int reference,
  2985. u8 *mptr,
  2986. u8 *word, int length, int mdata_size)
  2987. {
  2988. struct ath_common *common = ath9k_hw_common(ah);
  2989. u8 *dptr;
  2990. const struct ar9300_eeprom *eep = NULL;
  2991. switch (code) {
  2992. case _CompressNone:
  2993. if (length != mdata_size) {
  2994. ath_print(common, ATH_DBG_EEPROM,
  2995. "EEPROM structure size mismatch"
  2996. "memory=%d eeprom=%d\n", mdata_size, length);
  2997. return -1;
  2998. }
  2999. memcpy(mptr, (u8 *) (word + COMP_HDR_LEN), length);
  3000. ath_print(common, ATH_DBG_EEPROM, "restored eeprom %d:"
  3001. " uncompressed, length %d\n", it, length);
  3002. break;
  3003. case _CompressBlock:
  3004. if (reference == 0) {
  3005. dptr = mptr;
  3006. } else {
  3007. eep = ar9003_eeprom_struct_find_by_id(reference);
  3008. if (eep == NULL) {
  3009. ath_print(common, ATH_DBG_EEPROM,
  3010. "cant find reference eeprom"
  3011. "struct %d\n", reference);
  3012. return -1;
  3013. }
  3014. memcpy(mptr, eep, mdata_size);
  3015. }
  3016. ath_print(common, ATH_DBG_EEPROM,
  3017. "restore eeprom %d: block, reference %d,"
  3018. " length %d\n", it, reference, length);
  3019. ar9300_uncompress_block(ah, mptr, mdata_size,
  3020. (u8 *) (word + COMP_HDR_LEN), length);
  3021. break;
  3022. default:
  3023. ath_print(common, ATH_DBG_EEPROM, "unknown compression"
  3024. " code %d\n", code);
  3025. return -1;
  3026. }
  3027. return 0;
  3028. }
  3029. /*
  3030. * Read the configuration data from the eeprom.
  3031. * The data can be put in any specified memory buffer.
  3032. *
  3033. * Returns -1 on error.
  3034. * Returns address of next memory location on success.
  3035. */
  3036. static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
  3037. u8 *mptr, int mdata_size)
  3038. {
  3039. #define MDEFAULT 15
  3040. #define MSTATE 100
  3041. int cptr;
  3042. u8 *word;
  3043. int code;
  3044. int reference, length, major, minor;
  3045. int osize;
  3046. int it;
  3047. u16 checksum, mchecksum;
  3048. struct ath_common *common = ath9k_hw_common(ah);
  3049. word = kzalloc(2048, GFP_KERNEL);
  3050. if (!word)
  3051. return -1;
  3052. memcpy(mptr, &ar9300_default, mdata_size);
  3053. cptr = AR9300_BASE_ADDR;
  3054. for (it = 0; it < MSTATE; it++) {
  3055. if (!ar9300_read_eeprom(ah, cptr, word, COMP_HDR_LEN))
  3056. goto fail;
  3057. if ((word[0] == 0 && word[1] == 0 && word[2] == 0 &&
  3058. word[3] == 0) || (word[0] == 0xff && word[1] == 0xff
  3059. && word[2] == 0xff && word[3] == 0xff))
  3060. break;
  3061. ar9300_comp_hdr_unpack(word, &code, &reference,
  3062. &length, &major, &minor);
  3063. ath_print(common, ATH_DBG_EEPROM,
  3064. "Found block at %x: code=%d ref=%d"
  3065. "length=%d major=%d minor=%d\n", cptr, code,
  3066. reference, length, major, minor);
  3067. if (length >= 1024) {
  3068. ath_print(common, ATH_DBG_EEPROM,
  3069. "Skipping bad header\n");
  3070. cptr -= COMP_HDR_LEN;
  3071. continue;
  3072. }
  3073. osize = length;
  3074. ar9300_read_eeprom(ah, cptr, word,
  3075. COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
  3076. checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length);
  3077. mchecksum = word[COMP_HDR_LEN + osize] |
  3078. (word[COMP_HDR_LEN + osize + 1] << 8);
  3079. ath_print(common, ATH_DBG_EEPROM,
  3080. "checksum %x %x\n", checksum, mchecksum);
  3081. if (checksum == mchecksum) {
  3082. ar9300_compress_decision(ah, it, code, reference, mptr,
  3083. word, length, mdata_size);
  3084. } else {
  3085. ath_print(common, ATH_DBG_EEPROM,
  3086. "skipping block with bad checksum\n");
  3087. }
  3088. cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
  3089. }
  3090. kfree(word);
  3091. return cptr;
  3092. fail:
  3093. kfree(word);
  3094. return -1;
  3095. }
  3096. /*
  3097. * Restore the configuration structure by reading the eeprom.
  3098. * This function destroys any existing in-memory structure
  3099. * content.
  3100. */
  3101. static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah)
  3102. {
  3103. u8 *mptr = (u8 *) &ah->eeprom.ar9300_eep;
  3104. if (ar9300_eeprom_restore_internal(ah, mptr,
  3105. sizeof(struct ar9300_eeprom)) < 0)
  3106. return false;
  3107. return true;
  3108. }
  3109. /* XXX: review hardware docs */
  3110. static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw *ah)
  3111. {
  3112. return ah->eeprom.ar9300_eep.eepromVersion;
  3113. }
  3114. /* XXX: could be read from the eepromVersion, not sure yet */
  3115. static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah)
  3116. {
  3117. return 0;
  3118. }
  3119. static u8 ath9k_hw_ar9300_get_num_ant_config(struct ath_hw *ah,
  3120. enum ath9k_hal_freq_band freq_band)
  3121. {
  3122. return 1;
  3123. }
  3124. static u32 ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw *ah,
  3125. struct ath9k_channel *chan)
  3126. {
  3127. return -EINVAL;
  3128. }
  3129. static s32 ar9003_hw_xpa_bias_level_get(struct ath_hw *ah, bool is2ghz)
  3130. {
  3131. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3132. if (is2ghz)
  3133. return eep->modalHeader2G.xpaBiasLvl;
  3134. else
  3135. return eep->modalHeader5G.xpaBiasLvl;
  3136. }
  3137. static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
  3138. {
  3139. int bias = ar9003_hw_xpa_bias_level_get(ah, is2ghz);
  3140. REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
  3141. REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPABIASLVL_MSB, bias >> 2);
  3142. REG_RMW_FIELD(ah, AR_CH0_THERM, AR_CH0_THERM_XPASHORT2GND, 1);
  3143. }
  3144. static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
  3145. {
  3146. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3147. __le32 val;
  3148. if (is2ghz)
  3149. val = eep->modalHeader2G.antCtrlCommon;
  3150. else
  3151. val = eep->modalHeader5G.antCtrlCommon;
  3152. return le32_to_cpu(val);
  3153. }
  3154. static u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz)
  3155. {
  3156. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3157. __le32 val;
  3158. if (is2ghz)
  3159. val = eep->modalHeader2G.antCtrlCommon2;
  3160. else
  3161. val = eep->modalHeader5G.antCtrlCommon2;
  3162. return le32_to_cpu(val);
  3163. }
  3164. static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah,
  3165. int chain,
  3166. bool is2ghz)
  3167. {
  3168. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3169. __le16 val = 0;
  3170. if (chain >= 0 && chain < AR9300_MAX_CHAINS) {
  3171. if (is2ghz)
  3172. val = eep->modalHeader2G.antCtrlChain[chain];
  3173. else
  3174. val = eep->modalHeader5G.antCtrlChain[chain];
  3175. }
  3176. return le16_to_cpu(val);
  3177. }
  3178. static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
  3179. {
  3180. u32 value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
  3181. REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, AR_SWITCH_TABLE_COM_ALL, value);
  3182. value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz);
  3183. REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value);
  3184. value = ar9003_hw_ant_ctrl_chain_get(ah, 0, is2ghz);
  3185. REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_0, AR_SWITCH_TABLE_ALL, value);
  3186. value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz);
  3187. REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_1, AR_SWITCH_TABLE_ALL, value);
  3188. value = ar9003_hw_ant_ctrl_chain_get(ah, 2, is2ghz);
  3189. REG_RMW_FIELD(ah, AR_PHY_SWITCH_CHAIN_2, AR_SWITCH_TABLE_ALL, value);
  3190. }
  3191. static void ar9003_hw_drive_strength_apply(struct ath_hw *ah)
  3192. {
  3193. int drive_strength;
  3194. unsigned long reg;
  3195. drive_strength = ath9k_hw_ar9300_get_eeprom(ah, EEP_DRIVE_STRENGTH);
  3196. if (!drive_strength)
  3197. return;
  3198. reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS1);
  3199. reg &= ~0x00ffffc0;
  3200. reg |= 0x5 << 21;
  3201. reg |= 0x5 << 18;
  3202. reg |= 0x5 << 15;
  3203. reg |= 0x5 << 12;
  3204. reg |= 0x5 << 9;
  3205. reg |= 0x5 << 6;
  3206. REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS1, reg);
  3207. reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS2);
  3208. reg &= ~0xffffffe0;
  3209. reg |= 0x5 << 29;
  3210. reg |= 0x5 << 26;
  3211. reg |= 0x5 << 23;
  3212. reg |= 0x5 << 20;
  3213. reg |= 0x5 << 17;
  3214. reg |= 0x5 << 14;
  3215. reg |= 0x5 << 11;
  3216. reg |= 0x5 << 8;
  3217. reg |= 0x5 << 5;
  3218. REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS2, reg);
  3219. reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS4);
  3220. reg &= ~0xff800000;
  3221. reg |= 0x5 << 29;
  3222. reg |= 0x5 << 26;
  3223. reg |= 0x5 << 23;
  3224. REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS4, reg);
  3225. }
  3226. static u16 ar9003_hw_atten_chain_get(struct ath_hw *ah, int chain,
  3227. struct ath9k_channel *chan)
  3228. {
  3229. int f[3], t[3];
  3230. u16 value;
  3231. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3232. if (chain >= 0 && chain < 3) {
  3233. if (IS_CHAN_2GHZ(chan))
  3234. return eep->modalHeader2G.xatten1DB[chain];
  3235. else if (eep->base_ext2.xatten1DBLow[chain] != 0) {
  3236. t[0] = eep->base_ext2.xatten1DBLow[chain];
  3237. f[0] = 5180;
  3238. t[1] = eep->modalHeader5G.xatten1DB[chain];
  3239. f[1] = 5500;
  3240. t[2] = eep->base_ext2.xatten1DBHigh[chain];
  3241. f[2] = 5785;
  3242. value = ar9003_hw_power_interpolate((s32) chan->channel,
  3243. f, t, 3);
  3244. return value;
  3245. } else
  3246. return eep->modalHeader5G.xatten1DB[chain];
  3247. }
  3248. return 0;
  3249. }
  3250. static u16 ar9003_hw_atten_chain_get_margin(struct ath_hw *ah, int chain,
  3251. struct ath9k_channel *chan)
  3252. {
  3253. int f[3], t[3];
  3254. u16 value;
  3255. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3256. if (chain >= 0 && chain < 3) {
  3257. if (IS_CHAN_2GHZ(chan))
  3258. return eep->modalHeader2G.xatten1Margin[chain];
  3259. else if (eep->base_ext2.xatten1MarginLow[chain] != 0) {
  3260. t[0] = eep->base_ext2.xatten1MarginLow[chain];
  3261. f[0] = 5180;
  3262. t[1] = eep->modalHeader5G.xatten1Margin[chain];
  3263. f[1] = 5500;
  3264. t[2] = eep->base_ext2.xatten1MarginHigh[chain];
  3265. f[2] = 5785;
  3266. value = ar9003_hw_power_interpolate((s32) chan->channel,
  3267. f, t, 3);
  3268. return value;
  3269. } else
  3270. return eep->modalHeader5G.xatten1Margin[chain];
  3271. }
  3272. return 0;
  3273. }
  3274. static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan)
  3275. {
  3276. int i;
  3277. u16 value;
  3278. unsigned long ext_atten_reg[3] = {AR_PHY_EXT_ATTEN_CTL_0,
  3279. AR_PHY_EXT_ATTEN_CTL_1,
  3280. AR_PHY_EXT_ATTEN_CTL_2,
  3281. };
  3282. /* Test value. if 0 then attenuation is unused. Don't load anything. */
  3283. for (i = 0; i < 3; i++) {
  3284. value = ar9003_hw_atten_chain_get(ah, i, chan);
  3285. REG_RMW_FIELD(ah, ext_atten_reg[i],
  3286. AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value);
  3287. value = ar9003_hw_atten_chain_get_margin(ah, i, chan);
  3288. REG_RMW_FIELD(ah, ext_atten_reg[i],
  3289. AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN, value);
  3290. }
  3291. }
  3292. static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
  3293. {
  3294. int internal_regulator =
  3295. ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR);
  3296. if (internal_regulator) {
  3297. /* Internal regulator is ON. Write swreg register. */
  3298. int swreg = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG);
  3299. REG_WRITE(ah, AR_RTC_REG_CONTROL1,
  3300. REG_READ(ah, AR_RTC_REG_CONTROL1) &
  3301. (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM));
  3302. REG_WRITE(ah, AR_RTC_REG_CONTROL0, swreg);
  3303. /* Set REG_CONTROL1.SWREG_PROGRAM */
  3304. REG_WRITE(ah, AR_RTC_REG_CONTROL1,
  3305. REG_READ(ah,
  3306. AR_RTC_REG_CONTROL1) |
  3307. AR_RTC_REG_CONTROL1_SWREG_PROGRAM);
  3308. } else {
  3309. REG_WRITE(ah, AR_RTC_SLEEP_CLK,
  3310. (REG_READ(ah,
  3311. AR_RTC_SLEEP_CLK) |
  3312. AR_RTC_FORCE_SWREG_PRD));
  3313. }
  3314. }
  3315. static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
  3316. struct ath9k_channel *chan)
  3317. {
  3318. ar9003_hw_xpa_bias_level_apply(ah, IS_CHAN_2GHZ(chan));
  3319. ar9003_hw_ant_ctrl_apply(ah, IS_CHAN_2GHZ(chan));
  3320. ar9003_hw_drive_strength_apply(ah);
  3321. ar9003_hw_atten_apply(ah, chan);
  3322. ar9003_hw_internal_regulator_apply(ah);
  3323. }
  3324. static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah,
  3325. struct ath9k_channel *chan)
  3326. {
  3327. }
  3328. /*
  3329. * Returns the interpolated y value corresponding to the specified x value
  3330. * from the np ordered pairs of data (px,py).
  3331. * The pairs do not have to be in any order.
  3332. * If the specified x value is less than any of the px,
  3333. * the returned y value is equal to the py for the lowest px.
  3334. * If the specified x value is greater than any of the px,
  3335. * the returned y value is equal to the py for the highest px.
  3336. */
  3337. static int ar9003_hw_power_interpolate(int32_t x,
  3338. int32_t *px, int32_t *py, u_int16_t np)
  3339. {
  3340. int ip = 0;
  3341. int lx = 0, ly = 0, lhave = 0;
  3342. int hx = 0, hy = 0, hhave = 0;
  3343. int dx = 0;
  3344. int y = 0;
  3345. lhave = 0;
  3346. hhave = 0;
  3347. /* identify best lower and higher x calibration measurement */
  3348. for (ip = 0; ip < np; ip++) {
  3349. dx = x - px[ip];
  3350. /* this measurement is higher than our desired x */
  3351. if (dx <= 0) {
  3352. if (!hhave || dx > (x - hx)) {
  3353. /* new best higher x measurement */
  3354. hx = px[ip];
  3355. hy = py[ip];
  3356. hhave = 1;
  3357. }
  3358. }
  3359. /* this measurement is lower than our desired x */
  3360. if (dx >= 0) {
  3361. if (!lhave || dx < (x - lx)) {
  3362. /* new best lower x measurement */
  3363. lx = px[ip];
  3364. ly = py[ip];
  3365. lhave = 1;
  3366. }
  3367. }
  3368. }
  3369. /* the low x is good */
  3370. if (lhave) {
  3371. /* so is the high x */
  3372. if (hhave) {
  3373. /* they're the same, so just pick one */
  3374. if (hx == lx)
  3375. y = ly;
  3376. else /* interpolate */
  3377. y = ly + (((x - lx) * (hy - ly)) / (hx - lx));
  3378. } else /* only low is good, use it */
  3379. y = ly;
  3380. } else if (hhave) /* only high is good, use it */
  3381. y = hy;
  3382. else /* nothing is good,this should never happen unless np=0, ???? */
  3383. y = -(1 << 30);
  3384. return y;
  3385. }
  3386. static u8 ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw *ah,
  3387. u16 rateIndex, u16 freq, bool is2GHz)
  3388. {
  3389. u16 numPiers, i;
  3390. s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS];
  3391. s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS];
  3392. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3393. struct cal_tgt_pow_legacy *pEepromTargetPwr;
  3394. u8 *pFreqBin;
  3395. if (is2GHz) {
  3396. numPiers = AR9300_NUM_2G_20_TARGET_POWERS;
  3397. pEepromTargetPwr = eep->calTargetPower2G;
  3398. pFreqBin = eep->calTarget_freqbin_2G;
  3399. } else {
  3400. numPiers = AR9300_NUM_5G_20_TARGET_POWERS;
  3401. pEepromTargetPwr = eep->calTargetPower5G;
  3402. pFreqBin = eep->calTarget_freqbin_5G;
  3403. }
  3404. /*
  3405. * create array of channels and targetpower from
  3406. * targetpower piers stored on eeprom
  3407. */
  3408. for (i = 0; i < numPiers; i++) {
  3409. freqArray[i] = FBIN2FREQ(pFreqBin[i], is2GHz);
  3410. targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
  3411. }
  3412. /* interpolate to get target power for given frequency */
  3413. return (u8) ar9003_hw_power_interpolate((s32) freq,
  3414. freqArray,
  3415. targetPowerArray, numPiers);
  3416. }
  3417. static u8 ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw *ah,
  3418. u16 rateIndex,
  3419. u16 freq, bool is2GHz)
  3420. {
  3421. u16 numPiers, i;
  3422. s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS];
  3423. s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS];
  3424. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3425. struct cal_tgt_pow_ht *pEepromTargetPwr;
  3426. u8 *pFreqBin;
  3427. if (is2GHz) {
  3428. numPiers = AR9300_NUM_2G_20_TARGET_POWERS;
  3429. pEepromTargetPwr = eep->calTargetPower2GHT20;
  3430. pFreqBin = eep->calTarget_freqbin_2GHT20;
  3431. } else {
  3432. numPiers = AR9300_NUM_5G_20_TARGET_POWERS;
  3433. pEepromTargetPwr = eep->calTargetPower5GHT20;
  3434. pFreqBin = eep->calTarget_freqbin_5GHT20;
  3435. }
  3436. /*
  3437. * create array of channels and targetpower
  3438. * from targetpower piers stored on eeprom
  3439. */
  3440. for (i = 0; i < numPiers; i++) {
  3441. freqArray[i] = FBIN2FREQ(pFreqBin[i], is2GHz);
  3442. targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
  3443. }
  3444. /* interpolate to get target power for given frequency */
  3445. return (u8) ar9003_hw_power_interpolate((s32) freq,
  3446. freqArray,
  3447. targetPowerArray, numPiers);
  3448. }
  3449. static u8 ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw *ah,
  3450. u16 rateIndex,
  3451. u16 freq, bool is2GHz)
  3452. {
  3453. u16 numPiers, i;
  3454. s32 targetPowerArray[AR9300_NUM_5G_40_TARGET_POWERS];
  3455. s32 freqArray[AR9300_NUM_5G_40_TARGET_POWERS];
  3456. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3457. struct cal_tgt_pow_ht *pEepromTargetPwr;
  3458. u8 *pFreqBin;
  3459. if (is2GHz) {
  3460. numPiers = AR9300_NUM_2G_40_TARGET_POWERS;
  3461. pEepromTargetPwr = eep->calTargetPower2GHT40;
  3462. pFreqBin = eep->calTarget_freqbin_2GHT40;
  3463. } else {
  3464. numPiers = AR9300_NUM_5G_40_TARGET_POWERS;
  3465. pEepromTargetPwr = eep->calTargetPower5GHT40;
  3466. pFreqBin = eep->calTarget_freqbin_5GHT40;
  3467. }
  3468. /*
  3469. * create array of channels and targetpower from
  3470. * targetpower piers stored on eeprom
  3471. */
  3472. for (i = 0; i < numPiers; i++) {
  3473. freqArray[i] = FBIN2FREQ(pFreqBin[i], is2GHz);
  3474. targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
  3475. }
  3476. /* interpolate to get target power for given frequency */
  3477. return (u8) ar9003_hw_power_interpolate((s32) freq,
  3478. freqArray,
  3479. targetPowerArray, numPiers);
  3480. }
  3481. static u8 ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw *ah,
  3482. u16 rateIndex, u16 freq)
  3483. {
  3484. u16 numPiers = AR9300_NUM_2G_CCK_TARGET_POWERS, i;
  3485. s32 targetPowerArray[AR9300_NUM_2G_CCK_TARGET_POWERS];
  3486. s32 freqArray[AR9300_NUM_2G_CCK_TARGET_POWERS];
  3487. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3488. struct cal_tgt_pow_legacy *pEepromTargetPwr = eep->calTargetPowerCck;
  3489. u8 *pFreqBin = eep->calTarget_freqbin_Cck;
  3490. /*
  3491. * create array of channels and targetpower from
  3492. * targetpower piers stored on eeprom
  3493. */
  3494. for (i = 0; i < numPiers; i++) {
  3495. freqArray[i] = FBIN2FREQ(pFreqBin[i], 1);
  3496. targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
  3497. }
  3498. /* interpolate to get target power for given frequency */
  3499. return (u8) ar9003_hw_power_interpolate((s32) freq,
  3500. freqArray,
  3501. targetPowerArray, numPiers);
  3502. }
  3503. /* Set tx power registers to array of values passed in */
  3504. static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
  3505. {
  3506. #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
  3507. /* make sure forced gain is not set */
  3508. REG_WRITE(ah, 0xa458, 0);
  3509. /* Write the OFDM power per rate set */
  3510. /* 6 (LSB), 9, 12, 18 (MSB) */
  3511. REG_WRITE(ah, 0xa3c0,
  3512. POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
  3513. POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) |
  3514. POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
  3515. POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
  3516. /* 24 (LSB), 36, 48, 54 (MSB) */
  3517. REG_WRITE(ah, 0xa3c4,
  3518. POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) |
  3519. POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) |
  3520. POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) |
  3521. POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
  3522. /* Write the CCK power per rate set */
  3523. /* 1L (LSB), reserved, 2L, 2S (MSB) */
  3524. REG_WRITE(ah, 0xa3c8,
  3525. POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) |
  3526. POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
  3527. /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */
  3528. POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0));
  3529. /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */
  3530. REG_WRITE(ah, 0xa3cc,
  3531. POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) |
  3532. POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) |
  3533. POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) |
  3534. POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
  3535. );
  3536. /* Write the HT20 power per rate set */
  3537. /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
  3538. REG_WRITE(ah, 0xa3d0,
  3539. POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) |
  3540. POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) |
  3541. POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) |
  3542. POW_SM(pPwrArray[ALL_TARGET_HT20_0_8_16], 0)
  3543. );
  3544. /* 6 (LSB), 7, 12, 13 (MSB) */
  3545. REG_WRITE(ah, 0xa3d4,
  3546. POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) |
  3547. POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) |
  3548. POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) |
  3549. POW_SM(pPwrArray[ALL_TARGET_HT20_6], 0)
  3550. );
  3551. /* 14 (LSB), 15, 20, 21 */
  3552. REG_WRITE(ah, 0xa3e4,
  3553. POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) |
  3554. POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) |
  3555. POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) |
  3556. POW_SM(pPwrArray[ALL_TARGET_HT20_14], 0)
  3557. );
  3558. /* Mixed HT20 and HT40 rates */
  3559. /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */
  3560. REG_WRITE(ah, 0xa3e8,
  3561. POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) |
  3562. POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) |
  3563. POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) |
  3564. POW_SM(pPwrArray[ALL_TARGET_HT20_22], 0)
  3565. );
  3566. /*
  3567. * Write the HT40 power per rate set
  3568. * correct PAR difference between HT40 and HT20/LEGACY
  3569. * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB)
  3570. */
  3571. REG_WRITE(ah, 0xa3d8,
  3572. POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) |
  3573. POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) |
  3574. POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) |
  3575. POW_SM(pPwrArray[ALL_TARGET_HT40_0_8_16], 0)
  3576. );
  3577. /* 6 (LSB), 7, 12, 13 (MSB) */
  3578. REG_WRITE(ah, 0xa3dc,
  3579. POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) |
  3580. POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) |
  3581. POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) |
  3582. POW_SM(pPwrArray[ALL_TARGET_HT40_6], 0)
  3583. );
  3584. /* 14 (LSB), 15, 20, 21 */
  3585. REG_WRITE(ah, 0xa3ec,
  3586. POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) |
  3587. POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) |
  3588. POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) |
  3589. POW_SM(pPwrArray[ALL_TARGET_HT40_14], 0)
  3590. );
  3591. return 0;
  3592. #undef POW_SM
  3593. }
  3594. static void ar9003_hw_set_target_power_eeprom(struct ath_hw *ah, u16 freq,
  3595. u8 *targetPowerValT2)
  3596. {
  3597. /* XXX: hard code for now, need to get from eeprom struct */
  3598. u8 ht40PowerIncForPdadc = 0;
  3599. bool is2GHz = false;
  3600. unsigned int i = 0;
  3601. struct ath_common *common = ath9k_hw_common(ah);
  3602. if (freq < 4000)
  3603. is2GHz = true;
  3604. targetPowerValT2[ALL_TARGET_LEGACY_6_24] =
  3605. ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq,
  3606. is2GHz);
  3607. targetPowerValT2[ALL_TARGET_LEGACY_36] =
  3608. ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_36, freq,
  3609. is2GHz);
  3610. targetPowerValT2[ALL_TARGET_LEGACY_48] =
  3611. ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_48, freq,
  3612. is2GHz);
  3613. targetPowerValT2[ALL_TARGET_LEGACY_54] =
  3614. ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq,
  3615. is2GHz);
  3616. targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] =
  3617. ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L,
  3618. freq);
  3619. targetPowerValT2[ALL_TARGET_LEGACY_5S] =
  3620. ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_5S, freq);
  3621. targetPowerValT2[ALL_TARGET_LEGACY_11L] =
  3622. ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq);
  3623. targetPowerValT2[ALL_TARGET_LEGACY_11S] =
  3624. ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq);
  3625. targetPowerValT2[ALL_TARGET_HT20_0_8_16] =
  3626. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
  3627. is2GHz);
  3628. targetPowerValT2[ALL_TARGET_HT20_1_3_9_11_17_19] =
  3629. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19,
  3630. freq, is2GHz);
  3631. targetPowerValT2[ALL_TARGET_HT20_4] =
  3632. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_4, freq,
  3633. is2GHz);
  3634. targetPowerValT2[ALL_TARGET_HT20_5] =
  3635. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_5, freq,
  3636. is2GHz);
  3637. targetPowerValT2[ALL_TARGET_HT20_6] =
  3638. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_6, freq,
  3639. is2GHz);
  3640. targetPowerValT2[ALL_TARGET_HT20_7] =
  3641. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_7, freq,
  3642. is2GHz);
  3643. targetPowerValT2[ALL_TARGET_HT20_12] =
  3644. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_12, freq,
  3645. is2GHz);
  3646. targetPowerValT2[ALL_TARGET_HT20_13] =
  3647. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_13, freq,
  3648. is2GHz);
  3649. targetPowerValT2[ALL_TARGET_HT20_14] =
  3650. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_14, freq,
  3651. is2GHz);
  3652. targetPowerValT2[ALL_TARGET_HT20_15] =
  3653. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_15, freq,
  3654. is2GHz);
  3655. targetPowerValT2[ALL_TARGET_HT20_20] =
  3656. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_20, freq,
  3657. is2GHz);
  3658. targetPowerValT2[ALL_TARGET_HT20_21] =
  3659. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_21, freq,
  3660. is2GHz);
  3661. targetPowerValT2[ALL_TARGET_HT20_22] =
  3662. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_22, freq,
  3663. is2GHz);
  3664. targetPowerValT2[ALL_TARGET_HT20_23] =
  3665. ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
  3666. is2GHz);
  3667. targetPowerValT2[ALL_TARGET_HT40_0_8_16] =
  3668. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
  3669. is2GHz) + ht40PowerIncForPdadc;
  3670. targetPowerValT2[ALL_TARGET_HT40_1_3_9_11_17_19] =
  3671. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19,
  3672. freq,
  3673. is2GHz) + ht40PowerIncForPdadc;
  3674. targetPowerValT2[ALL_TARGET_HT40_4] =
  3675. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_4, freq,
  3676. is2GHz) + ht40PowerIncForPdadc;
  3677. targetPowerValT2[ALL_TARGET_HT40_5] =
  3678. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_5, freq,
  3679. is2GHz) + ht40PowerIncForPdadc;
  3680. targetPowerValT2[ALL_TARGET_HT40_6] =
  3681. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_6, freq,
  3682. is2GHz) + ht40PowerIncForPdadc;
  3683. targetPowerValT2[ALL_TARGET_HT40_7] =
  3684. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_7, freq,
  3685. is2GHz) + ht40PowerIncForPdadc;
  3686. targetPowerValT2[ALL_TARGET_HT40_12] =
  3687. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_12, freq,
  3688. is2GHz) + ht40PowerIncForPdadc;
  3689. targetPowerValT2[ALL_TARGET_HT40_13] =
  3690. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_13, freq,
  3691. is2GHz) + ht40PowerIncForPdadc;
  3692. targetPowerValT2[ALL_TARGET_HT40_14] =
  3693. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_14, freq,
  3694. is2GHz) + ht40PowerIncForPdadc;
  3695. targetPowerValT2[ALL_TARGET_HT40_15] =
  3696. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_15, freq,
  3697. is2GHz) + ht40PowerIncForPdadc;
  3698. targetPowerValT2[ALL_TARGET_HT40_20] =
  3699. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_20, freq,
  3700. is2GHz) + ht40PowerIncForPdadc;
  3701. targetPowerValT2[ALL_TARGET_HT40_21] =
  3702. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_21, freq,
  3703. is2GHz) + ht40PowerIncForPdadc;
  3704. targetPowerValT2[ALL_TARGET_HT40_22] =
  3705. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_22, freq,
  3706. is2GHz) + ht40PowerIncForPdadc;
  3707. targetPowerValT2[ALL_TARGET_HT40_23] =
  3708. ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
  3709. is2GHz) + ht40PowerIncForPdadc;
  3710. while (i < ar9300RateSize) {
  3711. ath_print(common, ATH_DBG_EEPROM,
  3712. "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
  3713. i++;
  3714. ath_print(common, ATH_DBG_EEPROM,
  3715. "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
  3716. i++;
  3717. ath_print(common, ATH_DBG_EEPROM,
  3718. "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
  3719. i++;
  3720. ath_print(common, ATH_DBG_EEPROM,
  3721. "TPC[%02d] 0x%08x\n", i, targetPowerValT2[i]);
  3722. i++;
  3723. }
  3724. }
  3725. static int ar9003_hw_cal_pier_get(struct ath_hw *ah,
  3726. int mode,
  3727. int ipier,
  3728. int ichain,
  3729. int *pfrequency,
  3730. int *pcorrection,
  3731. int *ptemperature, int *pvoltage)
  3732. {
  3733. u8 *pCalPier;
  3734. struct ar9300_cal_data_per_freq_op_loop *pCalPierStruct;
  3735. int is2GHz;
  3736. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3737. struct ath_common *common = ath9k_hw_common(ah);
  3738. if (ichain >= AR9300_MAX_CHAINS) {
  3739. ath_print(common, ATH_DBG_EEPROM,
  3740. "Invalid chain index, must be less than %d\n",
  3741. AR9300_MAX_CHAINS);
  3742. return -1;
  3743. }
  3744. if (mode) { /* 5GHz */
  3745. if (ipier >= AR9300_NUM_5G_CAL_PIERS) {
  3746. ath_print(common, ATH_DBG_EEPROM,
  3747. "Invalid 5GHz cal pier index, must "
  3748. "be less than %d\n",
  3749. AR9300_NUM_5G_CAL_PIERS);
  3750. return -1;
  3751. }
  3752. pCalPier = &(eep->calFreqPier5G[ipier]);
  3753. pCalPierStruct = &(eep->calPierData5G[ichain][ipier]);
  3754. is2GHz = 0;
  3755. } else {
  3756. if (ipier >= AR9300_NUM_2G_CAL_PIERS) {
  3757. ath_print(common, ATH_DBG_EEPROM,
  3758. "Invalid 2GHz cal pier index, must "
  3759. "be less than %d\n", AR9300_NUM_2G_CAL_PIERS);
  3760. return -1;
  3761. }
  3762. pCalPier = &(eep->calFreqPier2G[ipier]);
  3763. pCalPierStruct = &(eep->calPierData2G[ichain][ipier]);
  3764. is2GHz = 1;
  3765. }
  3766. *pfrequency = FBIN2FREQ(*pCalPier, is2GHz);
  3767. *pcorrection = pCalPierStruct->refPower;
  3768. *ptemperature = pCalPierStruct->tempMeas;
  3769. *pvoltage = pCalPierStruct->voltMeas;
  3770. return 0;
  3771. }
  3772. static int ar9003_hw_power_control_override(struct ath_hw *ah,
  3773. int frequency,
  3774. int *correction,
  3775. int *voltage, int *temperature)
  3776. {
  3777. int tempSlope = 0;
  3778. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  3779. REG_RMW(ah, AR_PHY_TPC_11_B0,
  3780. (correction[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
  3781. AR_PHY_TPC_OLPC_GAIN_DELTA);
  3782. REG_RMW(ah, AR_PHY_TPC_11_B1,
  3783. (correction[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
  3784. AR_PHY_TPC_OLPC_GAIN_DELTA);
  3785. REG_RMW(ah, AR_PHY_TPC_11_B2,
  3786. (correction[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
  3787. AR_PHY_TPC_OLPC_GAIN_DELTA);
  3788. /* enable open loop power control on chip */
  3789. REG_RMW(ah, AR_PHY_TPC_6_B0,
  3790. (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
  3791. AR_PHY_TPC_6_ERROR_EST_MODE);
  3792. REG_RMW(ah, AR_PHY_TPC_6_B1,
  3793. (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
  3794. AR_PHY_TPC_6_ERROR_EST_MODE);
  3795. REG_RMW(ah, AR_PHY_TPC_6_B2,
  3796. (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
  3797. AR_PHY_TPC_6_ERROR_EST_MODE);
  3798. /*
  3799. * enable temperature compensation
  3800. * Need to use register names
  3801. */
  3802. if (frequency < 4000)
  3803. tempSlope = eep->modalHeader2G.tempSlope;
  3804. else
  3805. tempSlope = eep->modalHeader5G.tempSlope;
  3806. REG_RMW_FIELD(ah, AR_PHY_TPC_19, AR_PHY_TPC_19_ALPHA_THERM, tempSlope);
  3807. REG_RMW_FIELD(ah, AR_PHY_TPC_18, AR_PHY_TPC_18_THERM_CAL_VALUE,
  3808. temperature[0]);
  3809. return 0;
  3810. }
  3811. /* Apply the recorded correction values. */
  3812. static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
  3813. {
  3814. int ichain, ipier, npier;
  3815. int mode;
  3816. int lfrequency[AR9300_MAX_CHAINS],
  3817. lcorrection[AR9300_MAX_CHAINS],
  3818. ltemperature[AR9300_MAX_CHAINS], lvoltage[AR9300_MAX_CHAINS];
  3819. int hfrequency[AR9300_MAX_CHAINS],
  3820. hcorrection[AR9300_MAX_CHAINS],
  3821. htemperature[AR9300_MAX_CHAINS], hvoltage[AR9300_MAX_CHAINS];
  3822. int fdiff;
  3823. int correction[AR9300_MAX_CHAINS],
  3824. voltage[AR9300_MAX_CHAINS], temperature[AR9300_MAX_CHAINS];
  3825. int pfrequency, pcorrection, ptemperature, pvoltage;
  3826. struct ath_common *common = ath9k_hw_common(ah);
  3827. mode = (frequency >= 4000);
  3828. if (mode)
  3829. npier = AR9300_NUM_5G_CAL_PIERS;
  3830. else
  3831. npier = AR9300_NUM_2G_CAL_PIERS;
  3832. for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
  3833. lfrequency[ichain] = 0;
  3834. hfrequency[ichain] = 100000;
  3835. }
  3836. /* identify best lower and higher frequency calibration measurement */
  3837. for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
  3838. for (ipier = 0; ipier < npier; ipier++) {
  3839. if (!ar9003_hw_cal_pier_get(ah, mode, ipier, ichain,
  3840. &pfrequency, &pcorrection,
  3841. &ptemperature, &pvoltage)) {
  3842. fdiff = frequency - pfrequency;
  3843. /*
  3844. * this measurement is higher than
  3845. * our desired frequency
  3846. */
  3847. if (fdiff <= 0) {
  3848. if (hfrequency[ichain] <= 0 ||
  3849. hfrequency[ichain] >= 100000 ||
  3850. fdiff >
  3851. (frequency - hfrequency[ichain])) {
  3852. /*
  3853. * new best higher
  3854. * frequency measurement
  3855. */
  3856. hfrequency[ichain] = pfrequency;
  3857. hcorrection[ichain] =
  3858. pcorrection;
  3859. htemperature[ichain] =
  3860. ptemperature;
  3861. hvoltage[ichain] = pvoltage;
  3862. }
  3863. }
  3864. if (fdiff >= 0) {
  3865. if (lfrequency[ichain] <= 0
  3866. || fdiff <
  3867. (frequency - lfrequency[ichain])) {
  3868. /*
  3869. * new best lower
  3870. * frequency measurement
  3871. */
  3872. lfrequency[ichain] = pfrequency;
  3873. lcorrection[ichain] =
  3874. pcorrection;
  3875. ltemperature[ichain] =
  3876. ptemperature;
  3877. lvoltage[ichain] = pvoltage;
  3878. }
  3879. }
  3880. }
  3881. }
  3882. }
  3883. /* interpolate */
  3884. for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
  3885. ath_print(common, ATH_DBG_EEPROM,
  3886. "ch=%d f=%d low=%d %d h=%d %d\n",
  3887. ichain, frequency, lfrequency[ichain],
  3888. lcorrection[ichain], hfrequency[ichain],
  3889. hcorrection[ichain]);
  3890. /* they're the same, so just pick one */
  3891. if (hfrequency[ichain] == lfrequency[ichain]) {
  3892. correction[ichain] = lcorrection[ichain];
  3893. voltage[ichain] = lvoltage[ichain];
  3894. temperature[ichain] = ltemperature[ichain];
  3895. }
  3896. /* the low frequency is good */
  3897. else if (frequency - lfrequency[ichain] < 1000) {
  3898. /* so is the high frequency, interpolate */
  3899. if (hfrequency[ichain] - frequency < 1000) {
  3900. correction[ichain] = lcorrection[ichain] +
  3901. (((frequency - lfrequency[ichain]) *
  3902. (hcorrection[ichain] -
  3903. lcorrection[ichain])) /
  3904. (hfrequency[ichain] - lfrequency[ichain]));
  3905. temperature[ichain] = ltemperature[ichain] +
  3906. (((frequency - lfrequency[ichain]) *
  3907. (htemperature[ichain] -
  3908. ltemperature[ichain])) /
  3909. (hfrequency[ichain] - lfrequency[ichain]));
  3910. voltage[ichain] =
  3911. lvoltage[ichain] +
  3912. (((frequency -
  3913. lfrequency[ichain]) * (hvoltage[ichain] -
  3914. lvoltage[ichain]))
  3915. / (hfrequency[ichain] -
  3916. lfrequency[ichain]));
  3917. }
  3918. /* only low is good, use it */
  3919. else {
  3920. correction[ichain] = lcorrection[ichain];
  3921. temperature[ichain] = ltemperature[ichain];
  3922. voltage[ichain] = lvoltage[ichain];
  3923. }
  3924. }
  3925. /* only high is good, use it */
  3926. else if (hfrequency[ichain] - frequency < 1000) {
  3927. correction[ichain] = hcorrection[ichain];
  3928. temperature[ichain] = htemperature[ichain];
  3929. voltage[ichain] = hvoltage[ichain];
  3930. } else { /* nothing is good, presume 0???? */
  3931. correction[ichain] = 0;
  3932. temperature[ichain] = 0;
  3933. voltage[ichain] = 0;
  3934. }
  3935. }
  3936. ar9003_hw_power_control_override(ah, frequency, correction, voltage,
  3937. temperature);
  3938. ath_print(common, ATH_DBG_EEPROM,
  3939. "for frequency=%d, calibration correction = %d %d %d\n",
  3940. frequency, correction[0], correction[1], correction[2]);
  3941. return 0;
  3942. }
  3943. static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep,
  3944. int idx,
  3945. int edge,
  3946. bool is2GHz)
  3947. {
  3948. struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G;
  3949. struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
  3950. if (is2GHz)
  3951. return ctl_2g[idx].ctlEdges[edge].tPower;
  3952. else
  3953. return ctl_5g[idx].ctlEdges[edge].tPower;
  3954. }
  3955. static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
  3956. int idx,
  3957. unsigned int edge,
  3958. u16 freq,
  3959. bool is2GHz)
  3960. {
  3961. struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G;
  3962. struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
  3963. u8 *ctl_freqbin = is2GHz ?
  3964. &eep->ctl_freqbin_2G[idx][0] :
  3965. &eep->ctl_freqbin_5G[idx][0];
  3966. if (is2GHz) {
  3967. if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
  3968. ctl_2g[idx].ctlEdges[edge - 1].flag)
  3969. return ctl_2g[idx].ctlEdges[edge - 1].tPower;
  3970. } else {
  3971. if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq &&
  3972. ctl_5g[idx].ctlEdges[edge - 1].flag)
  3973. return ctl_5g[idx].ctlEdges[edge - 1].tPower;
  3974. }
  3975. return AR9300_MAX_RATE_POWER;
  3976. }
  3977. /*
  3978. * Find the maximum conformance test limit for the given channel and CTL info
  3979. */
  3980. static u16 ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep,
  3981. u16 freq, int idx, bool is2GHz)
  3982. {
  3983. u16 twiceMaxEdgePower = AR9300_MAX_RATE_POWER;
  3984. u8 *ctl_freqbin = is2GHz ?
  3985. &eep->ctl_freqbin_2G[idx][0] :
  3986. &eep->ctl_freqbin_5G[idx][0];
  3987. u16 num_edges = is2GHz ?
  3988. AR9300_NUM_BAND_EDGES_2G : AR9300_NUM_BAND_EDGES_5G;
  3989. unsigned int edge;
  3990. /* Get the edge power */
  3991. for (edge = 0;
  3992. (edge < num_edges) && (ctl_freqbin[edge] != AR9300_BCHAN_UNUSED);
  3993. edge++) {
  3994. /*
  3995. * If there's an exact channel match or an inband flag set
  3996. * on the lower channel use the given rdEdgePower
  3997. */
  3998. if (freq == ath9k_hw_fbin2freq(ctl_freqbin[edge], is2GHz)) {
  3999. twiceMaxEdgePower =
  4000. ar9003_hw_get_direct_edge_power(eep, idx,
  4001. edge, is2GHz);
  4002. break;
  4003. } else if ((edge > 0) &&
  4004. (freq < ath9k_hw_fbin2freq(ctl_freqbin[edge],
  4005. is2GHz))) {
  4006. twiceMaxEdgePower =
  4007. ar9003_hw_get_indirect_edge_power(eep, idx,
  4008. edge, freq,
  4009. is2GHz);
  4010. /*
  4011. * Leave loop - no more affecting edges possible in
  4012. * this monotonic increasing list
  4013. */
  4014. break;
  4015. }
  4016. }
  4017. return twiceMaxEdgePower;
  4018. }
  4019. static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
  4020. struct ath9k_channel *chan,
  4021. u8 *pPwrArray, u16 cfgCtl,
  4022. u8 twiceAntennaReduction,
  4023. u8 twiceMaxRegulatoryPower,
  4024. u16 powerLimit)
  4025. {
  4026. struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
  4027. struct ath_common *common = ath9k_hw_common(ah);
  4028. struct ar9300_eeprom *pEepData = &ah->eeprom.ar9300_eep;
  4029. u16 twiceMaxEdgePower = AR9300_MAX_RATE_POWER;
  4030. static const u16 tpScaleReductionTable[5] = {
  4031. 0, 3, 6, 9, AR9300_MAX_RATE_POWER
  4032. };
  4033. int i;
  4034. int16_t twiceLargestAntenna;
  4035. u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
  4036. u16 ctlModesFor11a[] = {
  4037. CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40
  4038. };
  4039. u16 ctlModesFor11g[] = {
  4040. CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT,
  4041. CTL_11G_EXT, CTL_2GHT40
  4042. };
  4043. u16 numCtlModes, *pCtlMode, ctlMode, freq;
  4044. struct chan_centers centers;
  4045. u8 *ctlIndex;
  4046. u8 ctlNum;
  4047. u16 twiceMinEdgePower;
  4048. bool is2ghz = IS_CHAN_2GHZ(chan);
  4049. ath9k_hw_get_channel_centers(ah, chan, &centers);
  4050. /* Compute TxPower reduction due to Antenna Gain */
  4051. if (is2ghz)
  4052. twiceLargestAntenna = pEepData->modalHeader2G.antennaGain;
  4053. else
  4054. twiceLargestAntenna = pEepData->modalHeader5G.antennaGain;
  4055. twiceLargestAntenna = (int16_t)min((twiceAntennaReduction) -
  4056. twiceLargestAntenna, 0);
  4057. /*
  4058. * scaledPower is the minimum of the user input power level
  4059. * and the regulatory allowed power level
  4060. */
  4061. maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
  4062. if (regulatory->tp_scale != ATH9K_TP_SCALE_MAX) {
  4063. maxRegAllowedPower -=
  4064. (tpScaleReductionTable[(regulatory->tp_scale)] * 2);
  4065. }
  4066. scaledPower = min(powerLimit, maxRegAllowedPower);
  4067. /*
  4068. * Reduce scaled Power by number of chains active to get
  4069. * to per chain tx power level
  4070. */
  4071. switch (ar5416_get_ntxchains(ah->txchainmask)) {
  4072. case 1:
  4073. break;
  4074. case 2:
  4075. scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
  4076. break;
  4077. case 3:
  4078. scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
  4079. break;
  4080. }
  4081. scaledPower = max((u16)0, scaledPower);
  4082. /*
  4083. * Get target powers from EEPROM - our baseline for TX Power
  4084. */
  4085. if (is2ghz) {
  4086. /* Setup for CTL modes */
  4087. /* CTL_11B, CTL_11G, CTL_2GHT20 */
  4088. numCtlModes =
  4089. ARRAY_SIZE(ctlModesFor11g) -
  4090. SUB_NUM_CTL_MODES_AT_2G_40;
  4091. pCtlMode = ctlModesFor11g;
  4092. if (IS_CHAN_HT40(chan))
  4093. /* All 2G CTL's */
  4094. numCtlModes = ARRAY_SIZE(ctlModesFor11g);
  4095. } else {
  4096. /* Setup for CTL modes */
  4097. /* CTL_11A, CTL_5GHT20 */
  4098. numCtlModes = ARRAY_SIZE(ctlModesFor11a) -
  4099. SUB_NUM_CTL_MODES_AT_5G_40;
  4100. pCtlMode = ctlModesFor11a;
  4101. if (IS_CHAN_HT40(chan))
  4102. /* All 5G CTL's */
  4103. numCtlModes = ARRAY_SIZE(ctlModesFor11a);
  4104. }
  4105. /*
  4106. * For MIMO, need to apply regulatory caps individually across
  4107. * dynamically running modes: CCK, OFDM, HT20, HT40
  4108. *
  4109. * The outer loop walks through each possible applicable runtime mode.
  4110. * The inner loop walks through each ctlIndex entry in EEPROM.
  4111. * The ctl value is encoded as [7:4] == test group, [3:0] == test mode.
  4112. */
  4113. for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
  4114. bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
  4115. (pCtlMode[ctlMode] == CTL_2GHT40);
  4116. if (isHt40CtlMode)
  4117. freq = centers.synth_center;
  4118. else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
  4119. freq = centers.ext_center;
  4120. else
  4121. freq = centers.ctl_center;
  4122. ath_print(common, ATH_DBG_REGULATORY,
  4123. "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
  4124. "EXT_ADDITIVE %d\n",
  4125. ctlMode, numCtlModes, isHt40CtlMode,
  4126. (pCtlMode[ctlMode] & EXT_ADDITIVE));
  4127. /* walk through each CTL index stored in EEPROM */
  4128. if (is2ghz) {
  4129. ctlIndex = pEepData->ctlIndex_2G;
  4130. ctlNum = AR9300_NUM_CTLS_2G;
  4131. } else {
  4132. ctlIndex = pEepData->ctlIndex_5G;
  4133. ctlNum = AR9300_NUM_CTLS_5G;
  4134. }
  4135. for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) {
  4136. ath_print(common, ATH_DBG_REGULATORY,
  4137. "LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
  4138. "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
  4139. "chan %dn",
  4140. i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i],
  4141. chan->channel);
  4142. /*
  4143. * compare test group from regulatory
  4144. * channel list with test mode from pCtlMode
  4145. * list
  4146. */
  4147. if ((((cfgCtl & ~CTL_MODE_M) |
  4148. (pCtlMode[ctlMode] & CTL_MODE_M)) ==
  4149. ctlIndex[i]) ||
  4150. (((cfgCtl & ~CTL_MODE_M) |
  4151. (pCtlMode[ctlMode] & CTL_MODE_M)) ==
  4152. ((ctlIndex[i] & CTL_MODE_M) |
  4153. SD_NO_CTL))) {
  4154. twiceMinEdgePower =
  4155. ar9003_hw_get_max_edge_power(pEepData,
  4156. freq, i,
  4157. is2ghz);
  4158. if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL)
  4159. /*
  4160. * Find the minimum of all CTL
  4161. * edge powers that apply to
  4162. * this channel
  4163. */
  4164. twiceMaxEdgePower =
  4165. min(twiceMaxEdgePower,
  4166. twiceMinEdgePower);
  4167. else {
  4168. /* specific */
  4169. twiceMaxEdgePower =
  4170. twiceMinEdgePower;
  4171. break;
  4172. }
  4173. }
  4174. }
  4175. minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
  4176. ath_print(common, ATH_DBG_REGULATORY,
  4177. "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d "
  4178. "sP %d minCtlPwr %d\n",
  4179. ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
  4180. scaledPower, minCtlPower);
  4181. /* Apply ctl mode to correct target power set */
  4182. switch (pCtlMode[ctlMode]) {
  4183. case CTL_11B:
  4184. for (i = ALL_TARGET_LEGACY_1L_5L;
  4185. i <= ALL_TARGET_LEGACY_11S; i++)
  4186. pPwrArray[i] =
  4187. (u8)min((u16)pPwrArray[i],
  4188. minCtlPower);
  4189. break;
  4190. case CTL_11A:
  4191. case CTL_11G:
  4192. for (i = ALL_TARGET_LEGACY_6_24;
  4193. i <= ALL_TARGET_LEGACY_54; i++)
  4194. pPwrArray[i] =
  4195. (u8)min((u16)pPwrArray[i],
  4196. minCtlPower);
  4197. break;
  4198. case CTL_5GHT20:
  4199. case CTL_2GHT20:
  4200. for (i = ALL_TARGET_HT20_0_8_16;
  4201. i <= ALL_TARGET_HT20_21; i++)
  4202. pPwrArray[i] =
  4203. (u8)min((u16)pPwrArray[i],
  4204. minCtlPower);
  4205. pPwrArray[ALL_TARGET_HT20_22] =
  4206. (u8)min((u16)pPwrArray[ALL_TARGET_HT20_22],
  4207. minCtlPower);
  4208. pPwrArray[ALL_TARGET_HT20_23] =
  4209. (u8)min((u16)pPwrArray[ALL_TARGET_HT20_23],
  4210. minCtlPower);
  4211. break;
  4212. case CTL_5GHT40:
  4213. case CTL_2GHT40:
  4214. for (i = ALL_TARGET_HT40_0_8_16;
  4215. i <= ALL_TARGET_HT40_23; i++)
  4216. pPwrArray[i] =
  4217. (u8)min((u16)pPwrArray[i],
  4218. minCtlPower);
  4219. break;
  4220. default:
  4221. break;
  4222. }
  4223. } /* end ctl mode checking */
  4224. }
  4225. static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
  4226. struct ath9k_channel *chan, u16 cfgCtl,
  4227. u8 twiceAntennaReduction,
  4228. u8 twiceMaxRegulatoryPower,
  4229. u8 powerLimit, bool test)
  4230. {
  4231. struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
  4232. struct ath_common *common = ath9k_hw_common(ah);
  4233. u8 targetPowerValT2[ar9300RateSize];
  4234. unsigned int i = 0;
  4235. ar9003_hw_set_target_power_eeprom(ah, chan->channel, targetPowerValT2);
  4236. ar9003_hw_set_power_per_rate_table(ah, chan,
  4237. targetPowerValT2, cfgCtl,
  4238. twiceAntennaReduction,
  4239. twiceMaxRegulatoryPower,
  4240. powerLimit);
  4241. regulatory->max_power_level = 0;
  4242. for (i = 0; i < ar9300RateSize; i++) {
  4243. if (targetPowerValT2[i] > regulatory->max_power_level)
  4244. regulatory->max_power_level = targetPowerValT2[i];
  4245. }
  4246. if (test)
  4247. return;
  4248. for (i = 0; i < ar9300RateSize; i++) {
  4249. ath_print(common, ATH_DBG_EEPROM,
  4250. "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
  4251. i++;
  4252. ath_print(common, ATH_DBG_EEPROM,
  4253. "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
  4254. i++;
  4255. ath_print(common, ATH_DBG_EEPROM,
  4256. "TPC[%02d] 0x%08x ", i, targetPowerValT2[i]);
  4257. i++;
  4258. ath_print(common, ATH_DBG_EEPROM,
  4259. "TPC[%02d] 0x%08x\n\n", i, targetPowerValT2[i]);
  4260. i++;
  4261. }
  4262. /*
  4263. * This is the TX power we send back to driver core,
  4264. * and it can use to pass to userspace to display our
  4265. * currently configured TX power setting.
  4266. *
  4267. * Since power is rate dependent, use one of the indices
  4268. * from the AR9300_Rates enum to select an entry from
  4269. * targetPowerValT2[] to report. Currently returns the
  4270. * power for HT40 MCS 0, HT20 MCS 0, or OFDM 6 Mbps
  4271. * as CCK power is less interesting (?).
  4272. */
  4273. i = ALL_TARGET_LEGACY_6_24; /* legacy */
  4274. if (IS_CHAN_HT40(chan))
  4275. i = ALL_TARGET_HT40_0_8_16; /* ht40 */
  4276. else if (IS_CHAN_HT20(chan))
  4277. i = ALL_TARGET_HT20_0_8_16; /* ht20 */
  4278. ah->txpower_limit = targetPowerValT2[i];
  4279. regulatory->max_power_level = targetPowerValT2[i];
  4280. /* Write target power array to registers */
  4281. ar9003_hw_tx_power_regwrite(ah, targetPowerValT2);
  4282. ar9003_hw_calibration_apply(ah, chan->channel);
  4283. }
  4284. static u16 ath9k_hw_ar9300_get_spur_channel(struct ath_hw *ah,
  4285. u16 i, bool is2GHz)
  4286. {
  4287. return AR_NO_SPUR;
  4288. }
  4289. s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah)
  4290. {
  4291. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  4292. return (eep->baseEepHeader.txrxgain >> 4) & 0xf; /* bits 7:4 */
  4293. }
  4294. s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah)
  4295. {
  4296. struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
  4297. return (eep->baseEepHeader.txrxgain) & 0xf; /* bits 3:0 */
  4298. }
  4299. const struct eeprom_ops eep_ar9300_ops = {
  4300. .check_eeprom = ath9k_hw_ar9300_check_eeprom,
  4301. .get_eeprom = ath9k_hw_ar9300_get_eeprom,
  4302. .fill_eeprom = ath9k_hw_ar9300_fill_eeprom,
  4303. .get_eeprom_ver = ath9k_hw_ar9300_get_eeprom_ver,
  4304. .get_eeprom_rev = ath9k_hw_ar9300_get_eeprom_rev,
  4305. .get_num_ant_config = ath9k_hw_ar9300_get_num_ant_config,
  4306. .get_eeprom_antenna_cfg = ath9k_hw_ar9300_get_eeprom_antenna_cfg,
  4307. .set_board_values = ath9k_hw_ar9300_set_board_values,
  4308. .set_addac = ath9k_hw_ar9300_set_addac,
  4309. .set_txpower = ath9k_hw_ar9300_set_txpower,
  4310. .get_spur_channel = ath9k_hw_ar9300_get_spur_channel
  4311. };