12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510 |
- /*
- * Copyright (c) 2010-2011 Atheros Communications Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
- #include <asm/unaligned.h>
- #include "hw.h"
- #include "ar9003_phy.h"
- #include "ar9003_eeprom.h"
- #include "ar9003_mci.h"
- #define COMP_HDR_LEN 4
- #define COMP_CKSUM_LEN 2
- #define LE16(x) cpu_to_le16(x)
- #define LE32(x) cpu_to_le32(x)
- /* Local defines to distinguish between extension and control CTL's */
- #define EXT_ADDITIVE (0x8000)
- #define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
- #define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
- #define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
- #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */
- #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */
- #define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6))
- #define EEPROM_DATA_LEN_9485 1088
- static int ar9003_hw_power_interpolate(int32_t x,
- int32_t *px, int32_t *py, u_int16_t np);
- static const struct ar9300_eeprom ar9300_default = {
- .eepromVersion = 2,
- .templateVersion = 2,
- .macAddr = {0, 2, 3, 4, 5, 6},
- .custData = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .baseEepHeader = {
- .regDmn = { LE16(0), LE16(0x1f) },
- .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
- .opCapFlags = {
- .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
- .eepMisc = 0,
- },
- .rfSilent = 0,
- .blueToothOptions = 0,
- .deviceCap = 0,
- .deviceType = 5, /* takes lower byte in eeprom location */
- .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
- .params_for_tuning_caps = {0, 0},
- .featureEnable = 0x0c,
- /*
- * bit0 - enable tx temp comp - disabled
- * bit1 - enable tx volt comp - disabled
- * bit2 - enable fastClock - enabled
- * bit3 - enable doubling - enabled
- * bit4 - enable internal regulator - disabled
- * bit5 - enable pa predistortion - disabled
- */
- .miscConfiguration = 0, /* bit0 - turn down drivestrength */
- .eepromWriteEnableGpio = 3,
- .wlanDisableGpio = 0,
- .wlanLedGpio = 8,
- .rxBandSelectGpio = 0xff,
- .txrxgain = 0,
- .swreg = 0,
- },
- .modalHeader2G = {
- /* ar9300_modal_eep_header 2g */
- /* 4 idle,t1,t2,b(4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
- .antCtrlCommon2 = LE32(0x22222),
- /*
- * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
- * rx1, rx12, b (2 bits each)
- */
- .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
- /*
- * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
- * for ar9280 (0xa20c/b20c 5:0)
- */
- .xatten1DB = {0, 0, 0},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for ar9280 (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0, 0, 0},
- .tempSlope = 36,
- .voltSlope = 0,
- /*
- * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
- * channels in usual fbin coding format
- */
- .spurChans = {0, 0, 0, 0, 0},
- /*
- * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
- * if the register is per chain
- */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2c,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0cf0e0e0),
- .papdRateMaskHt40 = LE32(0x6cf0e0e0),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext1 = {
- .ant_div_control = 0,
- .future = {0, 0},
- .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
- },
- .calFreqPier2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1),
- },
- /* ar9300_cal_data_per_freq_op_loop 2g */
- .calPierData2G = {
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- },
- .calTarget_freqbin_Cck = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2484, 1),
- },
- .calTarget_freqbin_2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT20 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT40 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTargetPowerCck = {
- /* 1L-5L,5S,11L,11S */
- { {36, 36, 36, 36} },
- { {36, 36, 36, 36} },
- },
- .calTargetPower2G = {
- /* 6-24,36,48,54 */
- { {32, 32, 28, 24} },
- { {32, 32, 28, 24} },
- { {32, 32, 28, 24} },
- },
- .calTargetPower2GHT20 = {
- { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
- { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
- { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
- },
- .calTargetPower2GHT40 = {
- { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
- { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
- { {32, 32, 32, 32, 28, 20, 32, 32, 28, 20, 32, 32, 28, 20} },
- },
- .ctlIndex_2G = {
- 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
- 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
- },
- .ctl_freqbin_2G = {
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2457, 1),
- FREQ2FBIN(2462, 1)
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2422, 1),
- FREQ2FBIN(2427, 1),
- FREQ2FBIN(2447, 1),
- FREQ2FBIN(2452, 1)
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- },
- {
- /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- }
- },
- .ctlPowerData_2G = {
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- },
- .modalHeader5G = {
- /* 4 idle,t1,t2,b (4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
- .antCtrlCommon2 = LE32(0x22222),
- /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
- .antCtrlChain = {
- LE16(0x000), LE16(0x000), LE16(0x000),
- },
- /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
- .xatten1DB = {0, 0, 0},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for merlin (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0, 0, 0},
- .tempSlope = 68,
- .voltSlope = 0,
- /* spurChans spur channels in usual fbin coding format */
- .spurChans = {0, 0, 0, 0, 0},
- /* noiseFloorThreshCh Check if the register is per chain */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2d,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0c80c080),
- .papdRateMaskHt40 = LE32(0x0080c080),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext2 = {
- .tempSlopeLow = 0,
- .tempSlopeHigh = 0,
- .xatten1DBLow = {0, 0, 0},
- .xatten1MarginLow = {0, 0, 0},
- .xatten1DBHigh = {0, 0, 0},
- .xatten1MarginHigh = {0, 0, 0}
- },
- .calFreqPier5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calPierData5G = {
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- },
- .calTarget_freqbin_5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT20 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT40 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTargetPower5G = {
- /* 6-24,36,48,54 */
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- { {20, 20, 20, 10} },
- },
- .calTargetPower5GHT20 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- },
- .calTargetPower5GHT40 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- { {20, 20, 10, 10, 0, 0, 10, 10, 0, 0, 10, 10, 0, 0} },
- },
- .ctlIndex_5G = {
- 0x10, 0x16, 0x18, 0x40, 0x46,
- 0x48, 0x30, 0x36, 0x38
- },
- .ctl_freqbin_5G = {
- {
- /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
- /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
- },
- {
- /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[3].ctlEdges[6].bChannel */ 0xFF,
- /* Data[3].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[4].ctlEdges[4].bChannel */ 0xFF,
- /* Data[4].ctlEdges[5].bChannel */ 0xFF,
- /* Data[4].ctlEdges[6].bChannel */ 0xFF,
- /* Data[4].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
- /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[5].ctlEdges[6].bChannel */ 0xFF,
- /* Data[5].ctlEdges[7].bChannel */ 0xFF
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
- /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
- /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
- /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
- }
- },
- .ctlPowerData_5G = {
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- }
- },
- }
- };
- static const struct ar9300_eeprom ar9300_x113 = {
- .eepromVersion = 2,
- .templateVersion = 6,
- .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
- .custData = {"x113-023-f0000"},
- .baseEepHeader = {
- .regDmn = { LE16(0), LE16(0x1f) },
- .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
- .opCapFlags = {
- .opFlags = AR5416_OPFLAGS_11A,
- .eepMisc = 0,
- },
- .rfSilent = 0,
- .blueToothOptions = 0,
- .deviceCap = 0,
- .deviceType = 5, /* takes lower byte in eeprom location */
- .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
- .params_for_tuning_caps = {0, 0},
- .featureEnable = 0x0d,
- /*
- * bit0 - enable tx temp comp - disabled
- * bit1 - enable tx volt comp - disabled
- * bit2 - enable fastClock - enabled
- * bit3 - enable doubling - enabled
- * bit4 - enable internal regulator - disabled
- * bit5 - enable pa predistortion - disabled
- */
- .miscConfiguration = 0, /* bit0 - turn down drivestrength */
- .eepromWriteEnableGpio = 6,
- .wlanDisableGpio = 0,
- .wlanLedGpio = 8,
- .rxBandSelectGpio = 0xff,
- .txrxgain = 0x21,
- .swreg = 0,
- },
- .modalHeader2G = {
- /* ar9300_modal_eep_header 2g */
- /* 4 idle,t1,t2,b(4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
- .antCtrlCommon2 = LE32(0x44444),
- /*
- * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
- * rx1, rx12, b (2 bits each)
- */
- .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
- /*
- * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
- * for ar9280 (0xa20c/b20c 5:0)
- */
- .xatten1DB = {0, 0, 0},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for ar9280 (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0, 0, 0},
- .tempSlope = 25,
- .voltSlope = 0,
- /*
- * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
- * channels in usual fbin coding format
- */
- .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
- /*
- * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
- * if the register is per chain
- */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2c,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0c80c080),
- .papdRateMaskHt40 = LE32(0x0080c080),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext1 = {
- .ant_div_control = 0,
- .future = {0, 0},
- .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
- },
- .calFreqPier2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1),
- },
- /* ar9300_cal_data_per_freq_op_loop 2g */
- .calPierData2G = {
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- },
- .calTarget_freqbin_Cck = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2472, 1),
- },
- .calTarget_freqbin_2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT20 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT40 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTargetPowerCck = {
- /* 1L-5L,5S,11L,11S */
- { {34, 34, 34, 34} },
- { {34, 34, 34, 34} },
- },
- .calTargetPower2G = {
- /* 6-24,36,48,54 */
- { {34, 34, 32, 32} },
- { {34, 34, 32, 32} },
- { {34, 34, 32, 32} },
- },
- .calTargetPower2GHT20 = {
- { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
- { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
- { {32, 32, 32, 32, 32, 28, 32, 32, 30, 28, 0, 0, 0, 0} },
- },
- .calTargetPower2GHT40 = {
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
- },
- .ctlIndex_2G = {
- 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
- 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
- },
- .ctl_freqbin_2G = {
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2457, 1),
- FREQ2FBIN(2462, 1)
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2422, 1),
- FREQ2FBIN(2427, 1),
- FREQ2FBIN(2447, 1),
- FREQ2FBIN(2452, 1)
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- },
- {
- /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- }
- },
- .ctlPowerData_2G = {
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- },
- .modalHeader5G = {
- /* 4 idle,t1,t2,b (4 bits per setting) */
- .antCtrlCommon = LE32(0x220),
- /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
- .antCtrlCommon2 = LE32(0x11111),
- /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
- .antCtrlChain = {
- LE16(0x150), LE16(0x150), LE16(0x150),
- },
- /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
- .xatten1DB = {0, 0, 0},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for merlin (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0, 0, 0},
- .tempSlope = 68,
- .voltSlope = 0,
- /* spurChans spur channels in usual fbin coding format */
- .spurChans = {FREQ2FBIN(5500, 0), 0, 0, 0, 0},
- /* noiseFloorThreshCh Check if the register is per chain */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0xf,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2d,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0cf0e0e0),
- .papdRateMaskHt40 = LE32(0x6cf0e0e0),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext2 = {
- .tempSlopeLow = 72,
- .tempSlopeHigh = 105,
- .xatten1DBLow = {0, 0, 0},
- .xatten1MarginLow = {0, 0, 0},
- .xatten1DBHigh = {0, 0, 0},
- .xatten1MarginHigh = {0, 0, 0}
- },
- .calFreqPier5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5785, 0)
- },
- .calPierData5G = {
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- },
- .calTarget_freqbin_5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5785, 0)
- },
- .calTarget_freqbin_5GHT20 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT40 = {
- FREQ2FBIN(5190, 0),
- FREQ2FBIN(5230, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5410, 0),
- FREQ2FBIN(5510, 0),
- FREQ2FBIN(5670, 0),
- FREQ2FBIN(5755, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTargetPower5G = {
- /* 6-24,36,48,54 */
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- { {42, 40, 40, 34} },
- },
- .calTargetPower5GHT20 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
- { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
- { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
- { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
- { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
- { {40, 40, 40, 40, 32, 28, 40, 40, 32, 28, 40, 40, 32, 20} },
- { {38, 38, 38, 38, 32, 28, 38, 38, 32, 28, 38, 38, 32, 26} },
- { {36, 36, 36, 36, 32, 28, 36, 36, 32, 28, 36, 36, 32, 26} },
- },
- .calTargetPower5GHT40 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
- { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
- { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
- { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
- { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
- { {40, 40, 40, 38, 30, 26, 40, 40, 30, 26, 40, 40, 30, 24} },
- { {36, 36, 36, 36, 30, 26, 36, 36, 30, 26, 36, 36, 30, 24} },
- { {34, 34, 34, 34, 30, 26, 34, 34, 30, 26, 34, 34, 30, 24} },
- },
- .ctlIndex_5G = {
- 0x10, 0x16, 0x18, 0x40, 0x46,
- 0x48, 0x30, 0x36, 0x38
- },
- .ctl_freqbin_5G = {
- {
- /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
- /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
- },
- {
- /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[3].ctlEdges[6].bChannel */ 0xFF,
- /* Data[3].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[4].ctlEdges[4].bChannel */ 0xFF,
- /* Data[4].ctlEdges[5].bChannel */ 0xFF,
- /* Data[4].ctlEdges[6].bChannel */ 0xFF,
- /* Data[4].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
- /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[5].ctlEdges[6].bChannel */ 0xFF,
- /* Data[5].ctlEdges[7].bChannel */ 0xFF
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
- /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
- /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
- /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
- }
- },
- .ctlPowerData_5G = {
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- }
- },
- }
- };
- static const struct ar9300_eeprom ar9300_h112 = {
- .eepromVersion = 2,
- .templateVersion = 3,
- .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
- .custData = {"h112-241-f0000"},
- .baseEepHeader = {
- .regDmn = { LE16(0), LE16(0x1f) },
- .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
- .opCapFlags = {
- .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
- .eepMisc = 0,
- },
- .rfSilent = 0,
- .blueToothOptions = 0,
- .deviceCap = 0,
- .deviceType = 5, /* takes lower byte in eeprom location */
- .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
- .params_for_tuning_caps = {0, 0},
- .featureEnable = 0x0d,
- /*
- * bit0 - enable tx temp comp - disabled
- * bit1 - enable tx volt comp - disabled
- * bit2 - enable fastClock - enabled
- * bit3 - enable doubling - enabled
- * bit4 - enable internal regulator - disabled
- * bit5 - enable pa predistortion - disabled
- */
- .miscConfiguration = 0, /* bit0 - turn down drivestrength */
- .eepromWriteEnableGpio = 6,
- .wlanDisableGpio = 0,
- .wlanLedGpio = 8,
- .rxBandSelectGpio = 0xff,
- .txrxgain = 0x10,
- .swreg = 0,
- },
- .modalHeader2G = {
- /* ar9300_modal_eep_header 2g */
- /* 4 idle,t1,t2,b(4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
- .antCtrlCommon2 = LE32(0x44444),
- /*
- * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
- * rx1, rx12, b (2 bits each)
- */
- .antCtrlChain = { LE16(0x150), LE16(0x150), LE16(0x150) },
- /*
- * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
- * for ar9280 (0xa20c/b20c 5:0)
- */
- .xatten1DB = {0, 0, 0},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for ar9280 (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0, 0, 0},
- .tempSlope = 25,
- .voltSlope = 0,
- /*
- * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
- * channels in usual fbin coding format
- */
- .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
- /*
- * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
- * if the register is per chain
- */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2c,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0c80c080),
- .papdRateMaskHt40 = LE32(0x0080c080),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext1 = {
- .ant_div_control = 0,
- .future = {0, 0},
- .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
- },
- .calFreqPier2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2462, 1),
- },
- /* ar9300_cal_data_per_freq_op_loop 2g */
- .calPierData2G = {
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- },
- .calTarget_freqbin_Cck = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2472, 1),
- },
- .calTarget_freqbin_2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT20 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT40 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTargetPowerCck = {
- /* 1L-5L,5S,11L,11S */
- { {34, 34, 34, 34} },
- { {34, 34, 34, 34} },
- },
- .calTargetPower2G = {
- /* 6-24,36,48,54 */
- { {34, 34, 32, 32} },
- { {34, 34, 32, 32} },
- { {34, 34, 32, 32} },
- },
- .calTargetPower2GHT20 = {
- { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
- { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
- { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 28, 28, 28, 24} },
- },
- .calTargetPower2GHT40 = {
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 26, 26, 26, 22} },
- },
- .ctlIndex_2G = {
- 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
- 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
- },
- .ctl_freqbin_2G = {
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2457, 1),
- FREQ2FBIN(2462, 1)
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2422, 1),
- FREQ2FBIN(2427, 1),
- FREQ2FBIN(2447, 1),
- FREQ2FBIN(2452, 1)
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- },
- {
- /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- }
- },
- .ctlPowerData_2G = {
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- },
- .modalHeader5G = {
- /* 4 idle,t1,t2,b (4 bits per setting) */
- .antCtrlCommon = LE32(0x220),
- /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
- .antCtrlCommon2 = LE32(0x44444),
- /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
- .antCtrlChain = {
- LE16(0x150), LE16(0x150), LE16(0x150),
- },
- /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
- .xatten1DB = {0, 0, 0},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for merlin (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0, 0, 0},
- .tempSlope = 45,
- .voltSlope = 0,
- /* spurChans spur channels in usual fbin coding format */
- .spurChans = {0, 0, 0, 0, 0},
- /* noiseFloorThreshCh Check if the register is per chain */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2d,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0cf0e0e0),
- .papdRateMaskHt40 = LE32(0x6cf0e0e0),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext2 = {
- .tempSlopeLow = 40,
- .tempSlopeHigh = 50,
- .xatten1DBLow = {0, 0, 0},
- .xatten1MarginLow = {0, 0, 0},
- .xatten1DBHigh = {0, 0, 0},
- .xatten1MarginHigh = {0, 0, 0}
- },
- .calFreqPier5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5785, 0)
- },
- .calPierData5G = {
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- },
- .calTarget_freqbin_5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT20 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT40 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTargetPower5G = {
- /* 6-24,36,48,54 */
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- },
- .calTargetPower5GHT20 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
- { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 20, 20, 20, 16} },
- { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
- { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 18, 18, 18, 16} },
- { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
- { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 16, 16, 16, 14} },
- { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
- { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 14, 14, 14, 12} },
- },
- .calTargetPower5GHT40 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
- { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 18, 18, 18, 14} },
- { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
- { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 16, 16, 16, 12} },
- { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
- { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 14, 14, 14, 10} },
- { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
- { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 12, 12, 12, 8} },
- },
- .ctlIndex_5G = {
- 0x10, 0x16, 0x18, 0x40, 0x46,
- 0x48, 0x30, 0x36, 0x38
- },
- .ctl_freqbin_5G = {
- {
- /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
- /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
- },
- {
- /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[3].ctlEdges[6].bChannel */ 0xFF,
- /* Data[3].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[4].ctlEdges[4].bChannel */ 0xFF,
- /* Data[4].ctlEdges[5].bChannel */ 0xFF,
- /* Data[4].ctlEdges[6].bChannel */ 0xFF,
- /* Data[4].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
- /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[5].ctlEdges[6].bChannel */ 0xFF,
- /* Data[5].ctlEdges[7].bChannel */ 0xFF
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
- /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
- /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
- /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
- }
- },
- .ctlPowerData_5G = {
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- }
- },
- }
- };
- static const struct ar9300_eeprom ar9300_x112 = {
- .eepromVersion = 2,
- .templateVersion = 5,
- .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
- .custData = {"x112-041-f0000"},
- .baseEepHeader = {
- .regDmn = { LE16(0), LE16(0x1f) },
- .txrxMask = 0x77, /* 4 bits tx and 4 bits rx */
- .opCapFlags = {
- .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
- .eepMisc = 0,
- },
- .rfSilent = 0,
- .blueToothOptions = 0,
- .deviceCap = 0,
- .deviceType = 5, /* takes lower byte in eeprom location */
- .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
- .params_for_tuning_caps = {0, 0},
- .featureEnable = 0x0d,
- /*
- * bit0 - enable tx temp comp - disabled
- * bit1 - enable tx volt comp - disabled
- * bit2 - enable fastclock - enabled
- * bit3 - enable doubling - enabled
- * bit4 - enable internal regulator - disabled
- * bit5 - enable pa predistortion - disabled
- */
- .miscConfiguration = 0, /* bit0 - turn down drivestrength */
- .eepromWriteEnableGpio = 6,
- .wlanDisableGpio = 0,
- .wlanLedGpio = 8,
- .rxBandSelectGpio = 0xff,
- .txrxgain = 0x0,
- .swreg = 0,
- },
- .modalHeader2G = {
- /* ar9300_modal_eep_header 2g */
- /* 4 idle,t1,t2,b(4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
- .antCtrlCommon2 = LE32(0x22222),
- /*
- * antCtrlChain[ar9300_max_chains]; 6 idle, t, r,
- * rx1, rx12, b (2 bits each)
- */
- .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) },
- /*
- * xatten1DB[AR9300_max_chains]; 3 xatten1_db
- * for ar9280 (0xa20c/b20c 5:0)
- */
- .xatten1DB = {0x1b, 0x1b, 0x1b},
- /*
- * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
- * for ar9280 (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0x15, 0x15, 0x15},
- .tempSlope = 50,
- .voltSlope = 0,
- /*
- * spurChans[OSPrey_eeprom_modal_sPURS]; spur
- * channels in usual fbin coding format
- */
- .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
- /*
- * noiseFloorThreshch[ar9300_max_cHAINS]; 3 Check
- * if the register is per chain
- */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2c,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0c80c080),
- .papdRateMaskHt40 = LE32(0x0080c080),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext1 = {
- .ant_div_control = 0,
- .future = {0, 0},
- .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
- },
- .calFreqPier2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1),
- },
- /* ar9300_cal_data_per_freq_op_loop 2g */
- .calPierData2G = {
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- },
- .calTarget_freqbin_Cck = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2472, 1),
- },
- .calTarget_freqbin_2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT20 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT40 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTargetPowerCck = {
- /* 1L-5L,5S,11L,11s */
- { {38, 38, 38, 38} },
- { {38, 38, 38, 38} },
- },
- .calTargetPower2G = {
- /* 6-24,36,48,54 */
- { {38, 38, 36, 34} },
- { {38, 38, 36, 34} },
- { {38, 38, 34, 32} },
- },
- .calTargetPower2GHT20 = {
- { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
- { {36, 36, 36, 36, 36, 34, 36, 34, 32, 30, 30, 30, 28, 26} },
- { {36, 36, 36, 36, 36, 34, 34, 32, 30, 28, 28, 28, 28, 26} },
- },
- .calTargetPower2GHT40 = {
- { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
- { {36, 36, 36, 36, 34, 32, 34, 32, 30, 28, 28, 28, 28, 24} },
- { {36, 36, 36, 36, 34, 32, 32, 30, 28, 26, 26, 26, 26, 24} },
- },
- .ctlIndex_2G = {
- 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
- 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
- },
- .ctl_freqbin_2G = {
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2457, 1),
- FREQ2FBIN(2462, 1)
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2422, 1),
- FREQ2FBIN(2427, 1),
- FREQ2FBIN(2447, 1),
- FREQ2FBIN(2452, 1)
- },
- {
- /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
- /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
- /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
- /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(2484, 1),
- },
- {
- /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
- /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
- /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
- /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
- FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
- /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
- /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
- /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
- },
- {
- /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
- /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
- /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
- },
- {
- /* Data[9].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
- /* Data[9].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
- /* Data[9].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[10].ctledges[0].bchannel */ FREQ2FBIN(2412, 1),
- /* Data[10].ctledges[1].bchannel */ FREQ2FBIN(2417, 1),
- /* Data[10].ctledges[2].bchannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[11].ctledges[0].bchannel */ FREQ2FBIN(2422, 1),
- /* Data[11].ctledges[1].bchannel */ FREQ2FBIN(2427, 1),
- /* Data[11].ctledges[2].bchannel */ FREQ2FBIN(2447, 1),
- /* Data[11].ctledges[3].bchannel */ FREQ2FBIN(2462, 1),
- }
- },
- .ctlPowerData_2G = {
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- },
- .modalHeader5G = {
- /* 4 idle,t1,t2,b (4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
- .antCtrlCommon2 = LE32(0x22222),
- /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
- .antCtrlChain = {
- LE16(0x0), LE16(0x0), LE16(0x0),
- },
- /* xatten1DB 3 xatten1_db for ar9280 (0xa20c/b20c 5:0) */
- .xatten1DB = {0x13, 0x19, 0x17},
- /*
- * xatten1Margin[ar9300_max_chains]; 3 xatten1_margin
- * for merlin (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0x19, 0x19, 0x19},
- .tempSlope = 70,
- .voltSlope = 15,
- /* spurChans spur channels in usual fbin coding format */
- .spurChans = {0, 0, 0, 0, 0},
- /* noiseFloorThreshch check if the register is per chain */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2d,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0cf0e0e0),
- .papdRateMaskHt40 = LE32(0x6cf0e0e0),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext2 = {
- .tempSlopeLow = 72,
- .tempSlopeHigh = 105,
- .xatten1DBLow = {0x10, 0x14, 0x10},
- .xatten1MarginLow = {0x19, 0x19 , 0x19},
- .xatten1DBHigh = {0x1d, 0x20, 0x24},
- .xatten1MarginHigh = {0x10, 0x10, 0x10}
- },
- .calFreqPier5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5785, 0)
- },
- .calPierData5G = {
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- },
- .calTarget_freqbin_5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT20 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT40 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5725, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTargetPower5G = {
- /* 6-24,36,48,54 */
- { {32, 32, 28, 26} },
- { {32, 32, 28, 26} },
- { {32, 32, 28, 26} },
- { {32, 32, 26, 24} },
- { {32, 32, 26, 24} },
- { {32, 32, 24, 22} },
- { {30, 30, 24, 22} },
- { {30, 30, 24, 22} },
- },
- .calTargetPower5GHT20 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
- { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
- { {32, 32, 32, 32, 28, 26, 32, 28, 26, 24, 24, 24, 22, 22} },
- { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 22, 22, 20, 20} },
- { {32, 32, 32, 32, 28, 26, 32, 26, 24, 22, 20, 18, 16, 16} },
- { {32, 32, 32, 32, 28, 26, 32, 24, 20, 16, 18, 16, 14, 14} },
- { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
- { {30, 30, 30, 30, 28, 26, 30, 24, 20, 16, 18, 16, 14, 14} },
- },
- .calTargetPower5GHT40 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
- { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
- { {32, 32, 32, 30, 28, 26, 30, 28, 26, 24, 24, 24, 22, 22} },
- { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 22, 22, 20, 20} },
- { {32, 32, 32, 30, 28, 26, 30, 26, 24, 22, 20, 18, 16, 16} },
- { {32, 32, 32, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
- { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
- { {30, 30, 30, 30, 28, 26, 30, 22, 20, 16, 18, 16, 14, 14} },
- },
- .ctlIndex_5G = {
- 0x10, 0x16, 0x18, 0x40, 0x46,
- 0x48, 0x30, 0x36, 0x38
- },
- .ctl_freqbin_5G = {
- {
- /* Data[0].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
- /* Data[0].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
- /* Data[0].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
- /* Data[0].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
- /* Data[0].ctledges[4].bchannel */ FREQ2FBIN(5600, 0),
- /* Data[0].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
- /* Data[0].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
- /* Data[0].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[1].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
- /* Data[1].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
- /* Data[1].ctledges[2].bchannel */ FREQ2FBIN(5280, 0),
- /* Data[1].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
- /* Data[1].ctledges[4].bchannel */ FREQ2FBIN(5520, 0),
- /* Data[1].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
- /* Data[1].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
- /* Data[1].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[2].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
- /* Data[2].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
- /* Data[2].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
- /* Data[2].ctledges[3].bchannel */ FREQ2FBIN(5310, 0),
- /* Data[2].ctledges[4].bchannel */ FREQ2FBIN(5510, 0),
- /* Data[2].ctledges[5].bchannel */ FREQ2FBIN(5550, 0),
- /* Data[2].ctledges[6].bchannel */ FREQ2FBIN(5670, 0),
- /* Data[2].ctledges[7].bchannel */ FREQ2FBIN(5755, 0)
- },
- {
- /* Data[3].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
- /* Data[3].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
- /* Data[3].ctledges[2].bchannel */ FREQ2FBIN(5260, 0),
- /* Data[3].ctledges[3].bchannel */ FREQ2FBIN(5320, 0),
- /* Data[3].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
- /* Data[3].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
- /* Data[3].ctledges[6].bchannel */ 0xFF,
- /* Data[3].ctledges[7].bchannel */ 0xFF,
- },
- {
- /* Data[4].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
- /* Data[4].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
- /* Data[4].ctledges[2].bchannel */ FREQ2FBIN(5500, 0),
- /* Data[4].ctledges[3].bchannel */ FREQ2FBIN(5700, 0),
- /* Data[4].ctledges[4].bchannel */ 0xFF,
- /* Data[4].ctledges[5].bchannel */ 0xFF,
- /* Data[4].ctledges[6].bchannel */ 0xFF,
- /* Data[4].ctledges[7].bchannel */ 0xFF,
- },
- {
- /* Data[5].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
- /* Data[5].ctledges[1].bchannel */ FREQ2FBIN(5270, 0),
- /* Data[5].ctledges[2].bchannel */ FREQ2FBIN(5310, 0),
- /* Data[5].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
- /* Data[5].ctledges[4].bchannel */ FREQ2FBIN(5590, 0),
- /* Data[5].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
- /* Data[5].ctledges[6].bchannel */ 0xFF,
- /* Data[5].ctledges[7].bchannel */ 0xFF
- },
- {
- /* Data[6].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
- /* Data[6].ctledges[1].bchannel */ FREQ2FBIN(5200, 0),
- /* Data[6].ctledges[2].bchannel */ FREQ2FBIN(5220, 0),
- /* Data[6].ctledges[3].bchannel */ FREQ2FBIN(5260, 0),
- /* Data[6].ctledges[4].bchannel */ FREQ2FBIN(5500, 0),
- /* Data[6].ctledges[5].bchannel */ FREQ2FBIN(5600, 0),
- /* Data[6].ctledges[6].bchannel */ FREQ2FBIN(5700, 0),
- /* Data[6].ctledges[7].bchannel */ FREQ2FBIN(5745, 0)
- },
- {
- /* Data[7].ctledges[0].bchannel */ FREQ2FBIN(5180, 0),
- /* Data[7].ctledges[1].bchannel */ FREQ2FBIN(5260, 0),
- /* Data[7].ctledges[2].bchannel */ FREQ2FBIN(5320, 0),
- /* Data[7].ctledges[3].bchannel */ FREQ2FBIN(5500, 0),
- /* Data[7].ctledges[4].bchannel */ FREQ2FBIN(5560, 0),
- /* Data[7].ctledges[5].bchannel */ FREQ2FBIN(5700, 0),
- /* Data[7].ctledges[6].bchannel */ FREQ2FBIN(5745, 0),
- /* Data[7].ctledges[7].bchannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[8].ctledges[0].bchannel */ FREQ2FBIN(5190, 0),
- /* Data[8].ctledges[1].bchannel */ FREQ2FBIN(5230, 0),
- /* Data[8].ctledges[2].bchannel */ FREQ2FBIN(5270, 0),
- /* Data[8].ctledges[3].bchannel */ FREQ2FBIN(5510, 0),
- /* Data[8].ctledges[4].bchannel */ FREQ2FBIN(5550, 0),
- /* Data[8].ctledges[5].bchannel */ FREQ2FBIN(5670, 0),
- /* Data[8].ctledges[6].bchannel */ FREQ2FBIN(5755, 0),
- /* Data[8].ctledges[7].bchannel */ FREQ2FBIN(5795, 0)
- }
- },
- .ctlPowerData_5G = {
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- }
- },
- }
- };
- static const struct ar9300_eeprom ar9300_h116 = {
- .eepromVersion = 2,
- .templateVersion = 4,
- .macAddr = {0x00, 0x03, 0x7f, 0x0, 0x0, 0x0},
- .custData = {"h116-041-f0000"},
- .baseEepHeader = {
- .regDmn = { LE16(0), LE16(0x1f) },
- .txrxMask = 0x33, /* 4 bits tx and 4 bits rx */
- .opCapFlags = {
- .opFlags = AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A,
- .eepMisc = 0,
- },
- .rfSilent = 0,
- .blueToothOptions = 0,
- .deviceCap = 0,
- .deviceType = 5, /* takes lower byte in eeprom location */
- .pwrTableOffset = AR9300_PWR_TABLE_OFFSET,
- .params_for_tuning_caps = {0, 0},
- .featureEnable = 0x0d,
- /*
- * bit0 - enable tx temp comp - disabled
- * bit1 - enable tx volt comp - disabled
- * bit2 - enable fastClock - enabled
- * bit3 - enable doubling - enabled
- * bit4 - enable internal regulator - disabled
- * bit5 - enable pa predistortion - disabled
- */
- .miscConfiguration = 0, /* bit0 - turn down drivestrength */
- .eepromWriteEnableGpio = 6,
- .wlanDisableGpio = 0,
- .wlanLedGpio = 8,
- .rxBandSelectGpio = 0xff,
- .txrxgain = 0x10,
- .swreg = 0,
- },
- .modalHeader2G = {
- /* ar9300_modal_eep_header 2g */
- /* 4 idle,t1,t2,b(4 bits per setting) */
- .antCtrlCommon = LE32(0x110),
- /* 4 ra1l1, ra2l1, ra1l2, ra2l2, ra12 */
- .antCtrlCommon2 = LE32(0x44444),
- /*
- * antCtrlChain[AR9300_MAX_CHAINS]; 6 idle, t, r,
- * rx1, rx12, b (2 bits each)
- */
- .antCtrlChain = { LE16(0x10), LE16(0x10), LE16(0x10) },
- /*
- * xatten1DB[AR9300_MAX_CHAINS]; 3 xatten1_db
- * for ar9280 (0xa20c/b20c 5:0)
- */
- .xatten1DB = {0x1f, 0x1f, 0x1f},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for ar9280 (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0x12, 0x12, 0x12},
- .tempSlope = 25,
- .voltSlope = 0,
- /*
- * spurChans[OSPREY_EEPROM_MODAL_SPURS]; spur
- * channels in usual fbin coding format
- */
- .spurChans = {FREQ2FBIN(2464, 1), 0, 0, 0, 0},
- /*
- * noiseFloorThreshCh[AR9300_MAX_CHAINS]; 3 Check
- * if the register is per chain
- */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2c,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0c80C080),
- .papdRateMaskHt40 = LE32(0x0080C080),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext1 = {
- .ant_div_control = 0,
- .future = {0, 0},
- .tempslopextension = {0, 0, 0, 0, 0, 0, 0, 0}
- },
- .calFreqPier2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2462, 1),
- },
- /* ar9300_cal_data_per_freq_op_loop 2g */
- .calPierData2G = {
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0} },
- },
- .calTarget_freqbin_Cck = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2472, 1),
- },
- .calTarget_freqbin_2G = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT20 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTarget_freqbin_2GHT40 = {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2437, 1),
- FREQ2FBIN(2472, 1)
- },
- .calTargetPowerCck = {
- /* 1L-5L,5S,11L,11S */
- { {34, 34, 34, 34} },
- { {34, 34, 34, 34} },
- },
- .calTargetPower2G = {
- /* 6-24,36,48,54 */
- { {34, 34, 32, 32} },
- { {34, 34, 32, 32} },
- { {34, 34, 32, 32} },
- },
- .calTargetPower2GHT20 = {
- { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
- { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
- { {32, 32, 32, 32, 32, 30, 32, 32, 30, 28, 0, 0, 0, 0} },
- },
- .calTargetPower2GHT40 = {
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
- { {30, 30, 30, 30, 30, 28, 30, 30, 28, 26, 0, 0, 0, 0} },
- },
- .ctlIndex_2G = {
- 0x11, 0x12, 0x15, 0x17, 0x41, 0x42,
- 0x45, 0x47, 0x31, 0x32, 0x35, 0x37,
- },
- .ctl_freqbin_2G = {
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2457, 1),
- FREQ2FBIN(2462, 1)
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2412, 1),
- FREQ2FBIN(2417, 1),
- FREQ2FBIN(2462, 1),
- 0xFF,
- },
- {
- FREQ2FBIN(2422, 1),
- FREQ2FBIN(2427, 1),
- FREQ2FBIN(2447, 1),
- FREQ2FBIN(2452, 1)
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(2484, 1),
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- FREQ2FBIN(2472, 1),
- 0,
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- },
- {
- /* Data[9].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[9].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[9].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[10].ctlEdges[0].bChannel */ FREQ2FBIN(2412, 1),
- /* Data[10].ctlEdges[1].bChannel */ FREQ2FBIN(2417, 1),
- /* Data[10].ctlEdges[2].bChannel */ FREQ2FBIN(2472, 1),
- 0
- },
- {
- /* Data[11].ctlEdges[0].bChannel */ FREQ2FBIN(2422, 1),
- /* Data[11].ctlEdges[1].bChannel */ FREQ2FBIN(2427, 1),
- /* Data[11].ctlEdges[2].bChannel */ FREQ2FBIN(2447, 1),
- /* Data[11].ctlEdges[3].bChannel */ FREQ2FBIN(2462, 1),
- }
- },
- .ctlPowerData_2G = {
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } },
- { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } },
- },
- .modalHeader5G = {
- /* 4 idle,t1,t2,b (4 bits per setting) */
- .antCtrlCommon = LE32(0x220),
- /* 4 ra1l1, ra2l1, ra1l2,ra2l2,ra12 */
- .antCtrlCommon2 = LE32(0x44444),
- /* antCtrlChain 6 idle, t,r,rx1,rx12,b (2 bits each) */
- .antCtrlChain = {
- LE16(0x150), LE16(0x150), LE16(0x150),
- },
- /* xatten1DB 3 xatten1_db for AR9280 (0xa20c/b20c 5:0) */
- .xatten1DB = {0x19, 0x19, 0x19},
- /*
- * xatten1Margin[AR9300_MAX_CHAINS]; 3 xatten1_margin
- * for merlin (0xa20c/b20c 16:12
- */
- .xatten1Margin = {0x14, 0x14, 0x14},
- .tempSlope = 70,
- .voltSlope = 0,
- /* spurChans spur channels in usual fbin coding format */
- .spurChans = {0, 0, 0, 0, 0},
- /* noiseFloorThreshCh Check if the register is per chain */
- .noiseFloorThreshCh = {-1, 0, 0},
- .reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- .quick_drop = 0,
- .xpaBiasLvl = 0,
- .txFrameToDataStart = 0x0e,
- .txFrameToPaOn = 0x0e,
- .txClip = 3, /* 4 bits tx_clip, 4 bits dac_scale_cck */
- .antennaGain = 0,
- .switchSettling = 0x2d,
- .adcDesiredSize = -30,
- .txEndToXpaOff = 0,
- .txEndToRxOn = 0x2,
- .txFrameToXpaOn = 0xe,
- .thresh62 = 28,
- .papdRateMaskHt20 = LE32(0x0cf0e0e0),
- .papdRateMaskHt40 = LE32(0x6cf0e0e0),
- .switchcomspdt = 0,
- .xlna_bias_strength = 0,
- .futureModal = {
- 0, 0, 0, 0, 0, 0, 0,
- },
- },
- .base_ext2 = {
- .tempSlopeLow = 35,
- .tempSlopeHigh = 50,
- .xatten1DBLow = {0, 0, 0},
- .xatten1MarginLow = {0, 0, 0},
- .xatten1DBHigh = {0, 0, 0},
- .xatten1MarginHigh = {0, 0, 0}
- },
- .calFreqPier5G = {
- FREQ2FBIN(5160, 0),
- FREQ2FBIN(5220, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5785, 0)
- },
- .calPierData5G = {
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- {
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0},
- },
- },
- .calTarget_freqbin_5G = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5600, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT20 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTarget_freqbin_5GHT40 = {
- FREQ2FBIN(5180, 0),
- FREQ2FBIN(5240, 0),
- FREQ2FBIN(5320, 0),
- FREQ2FBIN(5400, 0),
- FREQ2FBIN(5500, 0),
- FREQ2FBIN(5700, 0),
- FREQ2FBIN(5745, 0),
- FREQ2FBIN(5825, 0)
- },
- .calTargetPower5G = {
- /* 6-24,36,48,54 */
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- { {30, 30, 28, 24} },
- },
- .calTargetPower5GHT20 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
- { {30, 30, 30, 28, 24, 20, 30, 28, 24, 20, 0, 0, 0, 0} },
- { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
- { {30, 30, 30, 26, 22, 18, 30, 26, 22, 18, 0, 0, 0, 0} },
- { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
- { {30, 30, 30, 24, 20, 16, 30, 24, 20, 16, 0, 0, 0, 0} },
- { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
- { {30, 30, 30, 22, 18, 14, 30, 22, 18, 14, 0, 0, 0, 0} },
- },
- .calTargetPower5GHT40 = {
- /*
- * 0_8_16,1-3_9-11_17-19,
- * 4,5,6,7,12,13,14,15,20,21,22,23
- */
- { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
- { {28, 28, 28, 26, 22, 18, 28, 26, 22, 18, 0, 0, 0, 0} },
- { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
- { {28, 28, 28, 24, 20, 16, 28, 24, 20, 16, 0, 0, 0, 0} },
- { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
- { {28, 28, 28, 22, 18, 14, 28, 22, 18, 14, 0, 0, 0, 0} },
- { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
- { {28, 28, 28, 20, 16, 12, 28, 20, 16, 12, 0, 0, 0, 0} },
- },
- .ctlIndex_5G = {
- 0x10, 0x16, 0x18, 0x40, 0x46,
- 0x48, 0x30, 0x36, 0x38
- },
- .ctl_freqbin_5G = {
- {
- /* Data[0].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[0].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[0].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[0].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[0].ctlEdges[4].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[0].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[0].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[0].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[1].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[1].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[1].ctlEdges[2].bChannel */ FREQ2FBIN(5280, 0),
- /* Data[1].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[1].ctlEdges[4].bChannel */ FREQ2FBIN(5520, 0),
- /* Data[1].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[1].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[1].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[2].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[2].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[2].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[2].ctlEdges[3].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[2].ctlEdges[4].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[2].ctlEdges[5].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[2].ctlEdges[6].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[2].ctlEdges[7].bChannel */ FREQ2FBIN(5755, 0)
- },
- {
- /* Data[3].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[3].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[3].ctlEdges[2].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[3].ctlEdges[3].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[3].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[3].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[3].ctlEdges[6].bChannel */ 0xFF,
- /* Data[3].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[4].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[4].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[4].ctlEdges[2].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[4].ctlEdges[3].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[4].ctlEdges[4].bChannel */ 0xFF,
- /* Data[4].ctlEdges[5].bChannel */ 0xFF,
- /* Data[4].ctlEdges[6].bChannel */ 0xFF,
- /* Data[4].ctlEdges[7].bChannel */ 0xFF,
- },
- {
- /* Data[5].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[5].ctlEdges[1].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[5].ctlEdges[2].bChannel */ FREQ2FBIN(5310, 0),
- /* Data[5].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[5].ctlEdges[4].bChannel */ FREQ2FBIN(5590, 0),
- /* Data[5].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[5].ctlEdges[6].bChannel */ 0xFF,
- /* Data[5].ctlEdges[7].bChannel */ 0xFF
- },
- {
- /* Data[6].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[6].ctlEdges[1].bChannel */ FREQ2FBIN(5200, 0),
- /* Data[6].ctlEdges[2].bChannel */ FREQ2FBIN(5220, 0),
- /* Data[6].ctlEdges[3].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[6].ctlEdges[4].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[6].ctlEdges[5].bChannel */ FREQ2FBIN(5600, 0),
- /* Data[6].ctlEdges[6].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[6].ctlEdges[7].bChannel */ FREQ2FBIN(5745, 0)
- },
- {
- /* Data[7].ctlEdges[0].bChannel */ FREQ2FBIN(5180, 0),
- /* Data[7].ctlEdges[1].bChannel */ FREQ2FBIN(5260, 0),
- /* Data[7].ctlEdges[2].bChannel */ FREQ2FBIN(5320, 0),
- /* Data[7].ctlEdges[3].bChannel */ FREQ2FBIN(5500, 0),
- /* Data[7].ctlEdges[4].bChannel */ FREQ2FBIN(5560, 0),
- /* Data[7].ctlEdges[5].bChannel */ FREQ2FBIN(5700, 0),
- /* Data[7].ctlEdges[6].bChannel */ FREQ2FBIN(5745, 0),
- /* Data[7].ctlEdges[7].bChannel */ FREQ2FBIN(5825, 0)
- },
- {
- /* Data[8].ctlEdges[0].bChannel */ FREQ2FBIN(5190, 0),
- /* Data[8].ctlEdges[1].bChannel */ FREQ2FBIN(5230, 0),
- /* Data[8].ctlEdges[2].bChannel */ FREQ2FBIN(5270, 0),
- /* Data[8].ctlEdges[3].bChannel */ FREQ2FBIN(5510, 0),
- /* Data[8].ctlEdges[4].bChannel */ FREQ2FBIN(5550, 0),
- /* Data[8].ctlEdges[5].bChannel */ FREQ2FBIN(5670, 0),
- /* Data[8].ctlEdges[6].bChannel */ FREQ2FBIN(5755, 0),
- /* Data[8].ctlEdges[7].bChannel */ FREQ2FBIN(5795, 0)
- }
- },
- .ctlPowerData_5G = {
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0),
- }
- },
- {
- {
- CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1),
- CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1),
- }
- },
- }
- };
- static const struct ar9300_eeprom *ar9300_eep_templates[] = {
- &ar9300_default,
- &ar9300_x112,
- &ar9300_h116,
- &ar9300_h112,
- &ar9300_x113,
- };
- static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id)
- {
- #define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0]))
- int it;
- for (it = 0; it < N_LOOP; it++)
- if (ar9300_eep_templates[it]->templateVersion == id)
- return ar9300_eep_templates[it];
- return NULL;
- #undef N_LOOP
- }
- static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah)
- {
- return 0;
- }
- static int interpolate(int x, int xa, int xb, int ya, int yb)
- {
- int bf, factor, plus;
- bf = 2 * (yb - ya) * (x - xa) / (xb - xa);
- factor = bf / 2;
- plus = bf % 2;
- return ya + factor + plus;
- }
- static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
- enum eeprom_param param)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
- switch (param) {
- case EEP_MAC_LSW:
- return get_unaligned_be16(eep->macAddr);
- case EEP_MAC_MID:
- return get_unaligned_be16(eep->macAddr + 2);
- case EEP_MAC_MSW:
- return get_unaligned_be16(eep->macAddr + 4);
- case EEP_REG_0:
- return le16_to_cpu(pBase->regDmn[0]);
- case EEP_OP_CAP:
- return pBase->deviceCap;
- case EEP_OP_MODE:
- return pBase->opCapFlags.opFlags;
- case EEP_RF_SILENT:
- return pBase->rfSilent;
- case EEP_TX_MASK:
- return (pBase->txrxMask >> 4) & 0xf;
- case EEP_RX_MASK:
- return pBase->txrxMask & 0xf;
- case EEP_PAPRD:
- return !!(pBase->featureEnable & BIT(5));
- case EEP_CHAIN_MASK_REDUCE:
- return (pBase->miscConfiguration >> 0x3) & 0x1;
- case EEP_ANT_DIV_CTL1:
- if (AR_SREV_9565(ah))
- return AR9300_EEP_ANTDIV_CONTROL_DEFAULT_VALUE;
- else
- return eep->base_ext1.ant_div_control;
- case EEP_ANTENNA_GAIN_5G:
- return eep->modalHeader5G.antennaGain;
- case EEP_ANTENNA_GAIN_2G:
- return eep->modalHeader2G.antennaGain;
- default:
- return 0;
- }
- }
- static bool ar9300_eeprom_read_byte(struct ath_hw *ah, int address,
- u8 *buffer)
- {
- u16 val;
- if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
- return false;
- *buffer = (val >> (8 * (address % 2))) & 0xff;
- return true;
- }
- static bool ar9300_eeprom_read_word(struct ath_hw *ah, int address,
- u8 *buffer)
- {
- u16 val;
- if (unlikely(!ath9k_hw_nvram_read(ah, address / 2, &val)))
- return false;
- buffer[0] = val >> 8;
- buffer[1] = val & 0xff;
- return true;
- }
- static bool ar9300_read_eeprom(struct ath_hw *ah, int address, u8 *buffer,
- int count)
- {
- struct ath_common *common = ath9k_hw_common(ah);
- int i;
- if ((address < 0) || ((address + count) / 2 > AR9300_EEPROM_SIZE - 1)) {
- ath_dbg(common, EEPROM, "eeprom address not in range\n");
- return false;
- }
- /*
- * Since we're reading the bytes in reverse order from a little-endian
- * word stream, an even address means we only use the lower half of
- * the 16-bit word at that address
- */
- if (address % 2 == 0) {
- if (!ar9300_eeprom_read_byte(ah, address--, buffer++))
- goto error;
- count--;
- }
- for (i = 0; i < count / 2; i++) {
- if (!ar9300_eeprom_read_word(ah, address, buffer))
- goto error;
- address -= 2;
- buffer += 2;
- }
- if (count % 2)
- if (!ar9300_eeprom_read_byte(ah, address, buffer))
- goto error;
- return true;
- error:
- ath_dbg(common, EEPROM, "unable to read eeprom region at offset %d\n",
- address);
- return false;
- }
- static bool ar9300_otp_read_word(struct ath_hw *ah, int addr, u32 *data)
- {
- REG_READ(ah, AR9300_OTP_BASE + (4 * addr));
- if (!ath9k_hw_wait(ah, AR9300_OTP_STATUS, AR9300_OTP_STATUS_TYPE,
- AR9300_OTP_STATUS_VALID, 1000))
- return false;
- *data = REG_READ(ah, AR9300_OTP_READ_DATA);
- return true;
- }
- static bool ar9300_read_otp(struct ath_hw *ah, int address, u8 *buffer,
- int count)
- {
- u32 data;
- int i;
- for (i = 0; i < count; i++) {
- int offset = 8 * ((address - i) % 4);
- if (!ar9300_otp_read_word(ah, (address - i) / 4, &data))
- return false;
- buffer[i] = (data >> offset) & 0xff;
- }
- return true;
- }
- static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference,
- int *length, int *major, int *minor)
- {
- unsigned long value[4];
- value[0] = best[0];
- value[1] = best[1];
- value[2] = best[2];
- value[3] = best[3];
- *code = ((value[0] >> 5) & 0x0007);
- *reference = (value[0] & 0x001f) | ((value[1] >> 2) & 0x0020);
- *length = ((value[1] << 4) & 0x07f0) | ((value[2] >> 4) & 0x000f);
- *major = (value[2] & 0x000f);
- *minor = (value[3] & 0x00ff);
- }
- static u16 ar9300_comp_cksum(u8 *data, int dsize)
- {
- int it, checksum = 0;
- for (it = 0; it < dsize; it++) {
- checksum += data[it];
- checksum &= 0xffff;
- }
- return checksum;
- }
- static bool ar9300_uncompress_block(struct ath_hw *ah,
- u8 *mptr,
- int mdataSize,
- u8 *block,
- int size)
- {
- int it;
- int spot;
- int offset;
- int length;
- struct ath_common *common = ath9k_hw_common(ah);
- spot = 0;
- for (it = 0; it < size; it += (length+2)) {
- offset = block[it];
- offset &= 0xff;
- spot += offset;
- length = block[it+1];
- length &= 0xff;
- if (length > 0 && spot >= 0 && spot+length <= mdataSize) {
- ath_dbg(common, EEPROM,
- "Restore at %d: spot=%d offset=%d length=%d\n",
- it, spot, offset, length);
- memcpy(&mptr[spot], &block[it+2], length);
- spot += length;
- } else if (length > 0) {
- ath_dbg(common, EEPROM,
- "Bad restore at %d: spot=%d offset=%d length=%d\n",
- it, spot, offset, length);
- return false;
- }
- }
- return true;
- }
- static int ar9300_compress_decision(struct ath_hw *ah,
- int it,
- int code,
- int reference,
- u8 *mptr,
- u8 *word, int length, int mdata_size)
- {
- struct ath_common *common = ath9k_hw_common(ah);
- const struct ar9300_eeprom *eep = NULL;
- switch (code) {
- case _CompressNone:
- if (length != mdata_size) {
- ath_dbg(common, EEPROM,
- "EEPROM structure size mismatch memory=%d eeprom=%d\n",
- mdata_size, length);
- return -1;
- }
- memcpy(mptr, word + COMP_HDR_LEN, length);
- ath_dbg(common, EEPROM,
- "restored eeprom %d: uncompressed, length %d\n",
- it, length);
- break;
- case _CompressBlock:
- if (reference == 0) {
- } else {
- eep = ar9003_eeprom_struct_find_by_id(reference);
- if (eep == NULL) {
- ath_dbg(common, EEPROM,
- "can't find reference eeprom struct %d\n",
- reference);
- return -1;
- }
- memcpy(mptr, eep, mdata_size);
- }
- ath_dbg(common, EEPROM,
- "restore eeprom %d: block, reference %d, length %d\n",
- it, reference, length);
- ar9300_uncompress_block(ah, mptr, mdata_size,
- (word + COMP_HDR_LEN), length);
- break;
- default:
- ath_dbg(common, EEPROM, "unknown compression code %d\n", code);
- return -1;
- }
- return 0;
- }
- typedef bool (*eeprom_read_op)(struct ath_hw *ah, int address, u8 *buffer,
- int count);
- static bool ar9300_check_header(void *data)
- {
- u32 *word = data;
- return !(*word == 0 || *word == ~0);
- }
- static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
- int base_addr)
- {
- u8 header[4];
- if (!read(ah, base_addr, header, 4))
- return false;
- return ar9300_check_header(header);
- }
- static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
- int mdata_size)
- {
- u16 *data = (u16 *) mptr;
- int i;
- for (i = 0; i < mdata_size / 2; i++, data++)
- ath9k_hw_nvram_read(ah, i, data);
- return 0;
- }
- /*
- * Read the configuration data from the eeprom.
- * The data can be put in any specified memory buffer.
- *
- * Returns -1 on error.
- * Returns address of next memory location on success.
- */
- static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
- u8 *mptr, int mdata_size)
- {
- #define MDEFAULT 15
- #define MSTATE 100
- int cptr;
- u8 *word;
- int code;
- int reference, length, major, minor;
- int osize;
- int it;
- u16 checksum, mchecksum;
- struct ath_common *common = ath9k_hw_common(ah);
- struct ar9300_eeprom *eep;
- eeprom_read_op read;
- if (ath9k_hw_use_flash(ah)) {
- u8 txrx;
- ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
- /* check if eeprom contains valid data */
- eep = (struct ar9300_eeprom *) mptr;
- txrx = eep->baseEepHeader.txrxMask;
- if (txrx != 0 && txrx != 0xff)
- return 0;
- }
- word = kzalloc(2048, GFP_KERNEL);
- if (!word)
- return -ENOMEM;
- memcpy(mptr, &ar9300_default, mdata_size);
- read = ar9300_read_eeprom;
- if (AR_SREV_9485(ah))
- cptr = AR9300_BASE_ADDR_4K;
- else if (AR_SREV_9330(ah))
- cptr = AR9300_BASE_ADDR_512;
- else
- cptr = AR9300_BASE_ADDR;
- ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
- cptr);
- if (ar9300_check_eeprom_header(ah, read, cptr))
- goto found;
- cptr = AR9300_BASE_ADDR_512;
- ath_dbg(common, EEPROM, "Trying EEPROM access at Address 0x%04x\n",
- cptr);
- if (ar9300_check_eeprom_header(ah, read, cptr))
- goto found;
- read = ar9300_read_otp;
- cptr = AR9300_BASE_ADDR;
- ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr);
- if (ar9300_check_eeprom_header(ah, read, cptr))
- goto found;
- cptr = AR9300_BASE_ADDR_512;
- ath_dbg(common, EEPROM, "Trying OTP access at Address 0x%04x\n", cptr);
- if (ar9300_check_eeprom_header(ah, read, cptr))
- goto found;
- goto fail;
- found:
- ath_dbg(common, EEPROM, "Found valid EEPROM data\n");
- for (it = 0; it < MSTATE; it++) {
- if (!read(ah, cptr, word, COMP_HDR_LEN))
- goto fail;
- if (!ar9300_check_header(word))
- break;
- ar9300_comp_hdr_unpack(word, &code, &reference,
- &length, &major, &minor);
- ath_dbg(common, EEPROM,
- "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n",
- cptr, code, reference, length, major, minor);
- if ((!AR_SREV_9485(ah) && length >= 1024) ||
- (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) {
- ath_dbg(common, EEPROM, "Skipping bad header\n");
- cptr -= COMP_HDR_LEN;
- continue;
- }
- osize = length;
- read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
- checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length);
- mchecksum = get_unaligned_le16(&word[COMP_HDR_LEN + osize]);
- ath_dbg(common, EEPROM, "checksum %x %x\n",
- checksum, mchecksum);
- if (checksum == mchecksum) {
- ar9300_compress_decision(ah, it, code, reference, mptr,
- word, length, mdata_size);
- } else {
- ath_dbg(common, EEPROM,
- "skipping block with bad checksum\n");
- }
- cptr -= (COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
- }
- kfree(word);
- return cptr;
- fail:
- kfree(word);
- return -1;
- }
- /*
- * Restore the configuration structure by reading the eeprom.
- * This function destroys any existing in-memory structure
- * content.
- */
- static bool ath9k_hw_ar9300_fill_eeprom(struct ath_hw *ah)
- {
- u8 *mptr = (u8 *) &ah->eeprom.ar9300_eep;
- if (ar9300_eeprom_restore_internal(ah, mptr,
- sizeof(struct ar9300_eeprom)) < 0)
- return false;
- return true;
- }
- #if defined(CONFIG_ATH9K_DEBUGFS) || defined(CONFIG_ATH9K_HTC_DEBUGFS)
- static u32 ar9003_dump_modal_eeprom(char *buf, u32 len, u32 size,
- struct ar9300_modal_eep_header *modal_hdr)
- {
- PR_EEP("Chain0 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[0]));
- PR_EEP("Chain1 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[1]));
- PR_EEP("Chain2 Ant. Control", le16_to_cpu(modal_hdr->antCtrlChain[2]));
- PR_EEP("Ant. Common Control", le32_to_cpu(modal_hdr->antCtrlCommon));
- PR_EEP("Ant. Common Control2", le32_to_cpu(modal_hdr->antCtrlCommon2));
- PR_EEP("Ant. Gain", modal_hdr->antennaGain);
- PR_EEP("Switch Settle", modal_hdr->switchSettling);
- PR_EEP("Chain0 xatten1DB", modal_hdr->xatten1DB[0]);
- PR_EEP("Chain1 xatten1DB", modal_hdr->xatten1DB[1]);
- PR_EEP("Chain2 xatten1DB", modal_hdr->xatten1DB[2]);
- PR_EEP("Chain0 xatten1Margin", modal_hdr->xatten1Margin[0]);
- PR_EEP("Chain1 xatten1Margin", modal_hdr->xatten1Margin[1]);
- PR_EEP("Chain2 xatten1Margin", modal_hdr->xatten1Margin[2]);
- PR_EEP("Temp Slope", modal_hdr->tempSlope);
- PR_EEP("Volt Slope", modal_hdr->voltSlope);
- PR_EEP("spur Channels0", modal_hdr->spurChans[0]);
- PR_EEP("spur Channels1", modal_hdr->spurChans[1]);
- PR_EEP("spur Channels2", modal_hdr->spurChans[2]);
- PR_EEP("spur Channels3", modal_hdr->spurChans[3]);
- PR_EEP("spur Channels4", modal_hdr->spurChans[4]);
- PR_EEP("Chain0 NF Threshold", modal_hdr->noiseFloorThreshCh[0]);
- PR_EEP("Chain1 NF Threshold", modal_hdr->noiseFloorThreshCh[1]);
- PR_EEP("Chain2 NF Threshold", modal_hdr->noiseFloorThreshCh[2]);
- PR_EEP("Quick Drop", modal_hdr->quick_drop);
- PR_EEP("txEndToXpaOff", modal_hdr->txEndToXpaOff);
- PR_EEP("xPA Bias Level", modal_hdr->xpaBiasLvl);
- PR_EEP("txFrameToDataStart", modal_hdr->txFrameToDataStart);
- PR_EEP("txFrameToPaOn", modal_hdr->txFrameToPaOn);
- PR_EEP("txFrameToXpaOn", modal_hdr->txFrameToXpaOn);
- PR_EEP("txClip", modal_hdr->txClip);
- PR_EEP("ADC Desired size", modal_hdr->adcDesiredSize);
- return len;
- }
- static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
- u8 *buf, u32 len, u32 size)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_base_eep_hdr *pBase;
- if (!dump_base_hdr) {
- len += scnprintf(buf + len, size - len,
- "%20s :\n", "2GHz modal Header");
- len = ar9003_dump_modal_eeprom(buf, len, size,
- &eep->modalHeader2G);
- len += scnprintf(buf + len, size - len,
- "%20s :\n", "5GHz modal Header");
- len = ar9003_dump_modal_eeprom(buf, len, size,
- &eep->modalHeader5G);
- goto out;
- }
- pBase = &eep->baseEepHeader;
- PR_EEP("EEPROM Version", ah->eeprom.ar9300_eep.eepromVersion);
- PR_EEP("RegDomain1", le16_to_cpu(pBase->regDmn[0]));
- PR_EEP("RegDomain2", le16_to_cpu(pBase->regDmn[1]));
- PR_EEP("TX Mask", (pBase->txrxMask >> 4));
- PR_EEP("RX Mask", (pBase->txrxMask & 0x0f));
- PR_EEP("Allow 5GHz", !!(pBase->opCapFlags.opFlags &
- AR5416_OPFLAGS_11A));
- PR_EEP("Allow 2GHz", !!(pBase->opCapFlags.opFlags &
- AR5416_OPFLAGS_11G));
- PR_EEP("Disable 2GHz HT20", !!(pBase->opCapFlags.opFlags &
- AR5416_OPFLAGS_N_2G_HT20));
- PR_EEP("Disable 2GHz HT40", !!(pBase->opCapFlags.opFlags &
- AR5416_OPFLAGS_N_2G_HT40));
- PR_EEP("Disable 5Ghz HT20", !!(pBase->opCapFlags.opFlags &
- AR5416_OPFLAGS_N_5G_HT20));
- PR_EEP("Disable 5Ghz HT40", !!(pBase->opCapFlags.opFlags &
- AR5416_OPFLAGS_N_5G_HT40));
- PR_EEP("Big Endian", !!(pBase->opCapFlags.eepMisc & 0x01));
- PR_EEP("RF Silent", pBase->rfSilent);
- PR_EEP("BT option", pBase->blueToothOptions);
- PR_EEP("Device Cap", pBase->deviceCap);
- PR_EEP("Device Type", pBase->deviceType);
- PR_EEP("Power Table Offset", pBase->pwrTableOffset);
- PR_EEP("Tuning Caps1", pBase->params_for_tuning_caps[0]);
- PR_EEP("Tuning Caps2", pBase->params_for_tuning_caps[1]);
- PR_EEP("Enable Tx Temp Comp", !!(pBase->featureEnable & BIT(0)));
- PR_EEP("Enable Tx Volt Comp", !!(pBase->featureEnable & BIT(1)));
- PR_EEP("Enable fast clock", !!(pBase->featureEnable & BIT(2)));
- PR_EEP("Enable doubling", !!(pBase->featureEnable & BIT(3)));
- PR_EEP("Internal regulator", !!(pBase->featureEnable & BIT(4)));
- PR_EEP("Enable Paprd", !!(pBase->featureEnable & BIT(5)));
- PR_EEP("Driver Strength", !!(pBase->miscConfiguration & BIT(0)));
- PR_EEP("Quick Drop", !!(pBase->miscConfiguration & BIT(1)));
- PR_EEP("Chain mask Reduce", (pBase->miscConfiguration >> 0x3) & 0x1);
- PR_EEP("Write enable Gpio", pBase->eepromWriteEnableGpio);
- PR_EEP("WLAN Disable Gpio", pBase->wlanDisableGpio);
- PR_EEP("WLAN LED Gpio", pBase->wlanLedGpio);
- PR_EEP("Rx Band Select Gpio", pBase->rxBandSelectGpio);
- PR_EEP("Tx Gain", pBase->txrxgain >> 4);
- PR_EEP("Rx Gain", pBase->txrxgain & 0xf);
- PR_EEP("SW Reg", le32_to_cpu(pBase->swreg));
- len += scnprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
- ah->eeprom.ar9300_eep.macAddr);
- out:
- if (len > size)
- len = size;
- return len;
- }
- #else
- static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
- u8 *buf, u32 len, u32 size)
- {
- return 0;
- }
- #endif
- /* XXX: review hardware docs */
- static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw *ah)
- {
- return ah->eeprom.ar9300_eep.eepromVersion;
- }
- /* XXX: could be read from the eepromVersion, not sure yet */
- static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah)
- {
- return 0;
- }
- static struct ar9300_modal_eep_header *ar9003_modal_header(struct ath_hw *ah,
- bool is2ghz)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- if (is2ghz)
- return &eep->modalHeader2G;
- else
- return &eep->modalHeader5G;
- }
- static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
- {
- int bias = ar9003_modal_header(ah, is2ghz)->xpaBiasLvl;
- if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah) ||
- AR_SREV_9531(ah) || AR_SREV_9561(ah))
- REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias);
- else if (AR_SREV_9462(ah) || AR_SREV_9550(ah) || AR_SREV_9565(ah))
- REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
- else {
- REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
- REG_RMW_FIELD(ah, AR_CH0_THERM,
- AR_CH0_THERM_XPABIASLVL_MSB,
- bias >> 2);
- REG_RMW_FIELD(ah, AR_CH0_THERM,
- AR_CH0_THERM_XPASHORT2GND, 1);
- }
- }
- static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is2ghz)
- {
- return le16_to_cpu(ar9003_modal_header(ah, is2ghz)->switchcomspdt);
- }
- u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
- {
- return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon);
- }
- u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz)
- {
- return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon2);
- }
- static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, int chain,
- bool is2ghz)
- {
- __le16 val = ar9003_modal_header(ah, is2ghz)->antCtrlChain[chain];
- return le16_to_cpu(val);
- }
- static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
- {
- struct ath_common *common = ath9k_hw_common(ah);
- struct ath9k_hw_capabilities *pCap = &ah->caps;
- int chain;
- u32 regval, value, gpio;
- static const u32 switch_chain_reg[AR9300_MAX_CHAINS] = {
- AR_PHY_SWITCH_CHAIN_0,
- AR_PHY_SWITCH_CHAIN_1,
- AR_PHY_SWITCH_CHAIN_2,
- };
- if (AR_SREV_9485(ah) && (ar9003_hw_get_rx_gain_idx(ah) == 0)) {
- if (ah->config.xlna_gpio)
- gpio = ah->config.xlna_gpio;
- else
- gpio = AR9300_EXT_LNA_CTL_GPIO_AR9485;
- ath9k_hw_cfg_output(ah, gpio,
- AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED);
- }
- value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
- if (AR_SREV_9462(ah) || AR_SREV_9565(ah)) {
- REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
- AR_SWITCH_TABLE_COM_AR9462_ALL, value);
- } else if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) {
- REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
- AR_SWITCH_TABLE_COM_AR9550_ALL, value);
- } else
- REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
- AR_SWITCH_TABLE_COM_ALL, value);
- /*
- * AR9462 defines new switch table for BT/WLAN,
- * here's new field name in XXX.ref for both 2G and 5G.
- * Register: [GLB_CONTROL] GLB_CONTROL (@0x20044)
- * 15:12 R/W SWITCH_TABLE_COM_SPDT_WLAN_RX
- * SWITCH_TABLE_COM_SPDT_WLAN_RX
- *
- * 11:8 R/W SWITCH_TABLE_COM_SPDT_WLAN_TX
- * SWITCH_TABLE_COM_SPDT_WLAN_TX
- *
- * 7:4 R/W SWITCH_TABLE_COM_SPDT_WLAN_IDLE
- * SWITCH_TABLE_COM_SPDT_WLAN_IDLE
- */
- if (AR_SREV_9462_20_OR_LATER(ah) || AR_SREV_9565(ah)) {
- value = ar9003_switch_com_spdt_get(ah, is2ghz);
- REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL,
- AR_SWITCH_TABLE_COM_SPDT_ALL, value);
- REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_SPDT_ENABLE);
- }
- value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz);
- if (AR_SREV_9485(ah) && common->bt_ant_diversity) {
- value &= ~AR_SWITCH_TABLE_COM2_ALL;
- value |= ah->config.ant_ctrl_comm2g_switch_enable;
- }
- REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value);
- if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) {
- value = ar9003_hw_ant_ctrl_chain_get(ah, 1, is2ghz);
- REG_RMW_FIELD(ah, switch_chain_reg[0],
- AR_SWITCH_TABLE_ALL, value);
- }
- for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
- if ((ah->rxchainmask & BIT(chain)) ||
- (ah->txchainmask & BIT(chain))) {
- value = ar9003_hw_ant_ctrl_chain_get(ah, chain,
- is2ghz);
- REG_RMW_FIELD(ah, switch_chain_reg[chain],
- AR_SWITCH_TABLE_ALL, value);
- }
- }
- if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
- value = ath9k_hw_ar9300_get_eeprom(ah, EEP_ANT_DIV_CTL1);
- /*
- * main_lnaconf, alt_lnaconf, main_tb, alt_tb
- * are the fields present
- */
- regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
- regval &= (~AR_ANT_DIV_CTRL_ALL);
- regval |= (value & 0x3f) << AR_ANT_DIV_CTRL_ALL_S;
- /* enable_lnadiv */
- regval &= (~AR_PHY_ANT_DIV_LNADIV);
- regval |= ((value >> 6) & 0x1) << AR_PHY_ANT_DIV_LNADIV_S;
- if (AR_SREV_9485(ah) && common->bt_ant_diversity)
- regval |= AR_ANT_DIV_ENABLE;
- if (AR_SREV_9565(ah)) {
- if (common->bt_ant_diversity) {
- regval |= (1 << AR_PHY_ANT_SW_RX_PROT_S);
- REG_SET_BIT(ah, AR_PHY_RESTART,
- AR_PHY_RESTART_ENABLE_DIV_M2FLAG);
- /* Force WLAN LNA diversity ON */
- REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV,
- AR_BTCOEX_WL_LNADIV_FORCE_ON);
- } else {
- regval &= ~(1 << AR_PHY_ANT_DIV_LNADIV_S);
- regval &= ~(1 << AR_PHY_ANT_SW_RX_PROT_S);
- REG_CLR_BIT(ah, AR_PHY_MC_GAIN_CTRL,
- (1 << AR_PHY_ANT_SW_RX_PROT_S));
- /* Force WLAN LNA diversity OFF */
- REG_CLR_BIT(ah, AR_BTCOEX_WL_LNADIV,
- AR_BTCOEX_WL_LNADIV_FORCE_ON);
- }
- }
- REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
- /* enable fast_div */
- regval = REG_READ(ah, AR_PHY_CCK_DETECT);
- regval &= (~AR_FAST_DIV_ENABLE);
- regval |= ((value >> 7) & 0x1) << AR_FAST_DIV_ENABLE_S;
- if ((AR_SREV_9485(ah) || AR_SREV_9565(ah))
- && common->bt_ant_diversity)
- regval |= AR_FAST_DIV_ENABLE;
- REG_WRITE(ah, AR_PHY_CCK_DETECT, regval);
- if (pCap->hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) {
- regval = REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
- /*
- * clear bits 25-30 main_lnaconf, alt_lnaconf,
- * main_tb, alt_tb
- */
- regval &= (~(AR_PHY_ANT_DIV_MAIN_LNACONF |
- AR_PHY_ANT_DIV_ALT_LNACONF |
- AR_PHY_ANT_DIV_ALT_GAINTB |
- AR_PHY_ANT_DIV_MAIN_GAINTB));
- /* by default use LNA1 for the main antenna */
- regval |= (ATH_ANT_DIV_COMB_LNA1 <<
- AR_PHY_ANT_DIV_MAIN_LNACONF_S);
- regval |= (ATH_ANT_DIV_COMB_LNA2 <<
- AR_PHY_ANT_DIV_ALT_LNACONF_S);
- REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, regval);
- }
- }
- }
- static void ar9003_hw_drive_strength_apply(struct ath_hw *ah)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
- int drive_strength;
- unsigned long reg;
- drive_strength = pBase->miscConfiguration & BIT(0);
- if (!drive_strength)
- return;
- reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS1);
- reg &= ~0x00ffffc0;
- reg |= 0x5 << 21;
- reg |= 0x5 << 18;
- reg |= 0x5 << 15;
- reg |= 0x5 << 12;
- reg |= 0x5 << 9;
- reg |= 0x5 << 6;
- REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS1, reg);
- reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS2);
- reg &= ~0xffffffe0;
- reg |= 0x5 << 29;
- reg |= 0x5 << 26;
- reg |= 0x5 << 23;
- reg |= 0x5 << 20;
- reg |= 0x5 << 17;
- reg |= 0x5 << 14;
- reg |= 0x5 << 11;
- reg |= 0x5 << 8;
- reg |= 0x5 << 5;
- REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS2, reg);
- reg = REG_READ(ah, AR_PHY_65NM_CH0_BIAS4);
- reg &= ~0xff800000;
- reg |= 0x5 << 29;
- reg |= 0x5 << 26;
- reg |= 0x5 << 23;
- REG_WRITE(ah, AR_PHY_65NM_CH0_BIAS4, reg);
- }
- static u16 ar9003_hw_atten_chain_get(struct ath_hw *ah, int chain,
- struct ath9k_channel *chan)
- {
- int f[3], t[3];
- u16 value;
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- if (chain >= 0 && chain < 3) {
- if (IS_CHAN_2GHZ(chan))
- return eep->modalHeader2G.xatten1DB[chain];
- else if (eep->base_ext2.xatten1DBLow[chain] != 0) {
- t[0] = eep->base_ext2.xatten1DBLow[chain];
- f[0] = 5180;
- t[1] = eep->modalHeader5G.xatten1DB[chain];
- f[1] = 5500;
- t[2] = eep->base_ext2.xatten1DBHigh[chain];
- f[2] = 5785;
- value = ar9003_hw_power_interpolate((s32) chan->channel,
- f, t, 3);
- return value;
- } else
- return eep->modalHeader5G.xatten1DB[chain];
- }
- return 0;
- }
- static u16 ar9003_hw_atten_chain_get_margin(struct ath_hw *ah, int chain,
- struct ath9k_channel *chan)
- {
- int f[3], t[3];
- u16 value;
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- if (chain >= 0 && chain < 3) {
- if (IS_CHAN_2GHZ(chan))
- return eep->modalHeader2G.xatten1Margin[chain];
- else if (eep->base_ext2.xatten1MarginLow[chain] != 0) {
- t[0] = eep->base_ext2.xatten1MarginLow[chain];
- f[0] = 5180;
- t[1] = eep->modalHeader5G.xatten1Margin[chain];
- f[1] = 5500;
- t[2] = eep->base_ext2.xatten1MarginHigh[chain];
- f[2] = 5785;
- value = ar9003_hw_power_interpolate((s32) chan->channel,
- f, t, 3);
- return value;
- } else
- return eep->modalHeader5G.xatten1Margin[chain];
- }
- return 0;
- }
- static void ar9003_hw_atten_apply(struct ath_hw *ah, struct ath9k_channel *chan)
- {
- int i;
- u16 value;
- unsigned long ext_atten_reg[3] = {AR_PHY_EXT_ATTEN_CTL_0,
- AR_PHY_EXT_ATTEN_CTL_1,
- AR_PHY_EXT_ATTEN_CTL_2,
- };
- if ((AR_SREV_9462(ah)) && (ah->rxchainmask == 0x2)) {
- value = ar9003_hw_atten_chain_get(ah, 1, chan);
- REG_RMW_FIELD(ah, ext_atten_reg[0],
- AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value);
- value = ar9003_hw_atten_chain_get_margin(ah, 1, chan);
- REG_RMW_FIELD(ah, ext_atten_reg[0],
- AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
- value);
- }
- /* Test value. if 0 then attenuation is unused. Don't load anything. */
- for (i = 0; i < 3; i++) {
- if (ah->txchainmask & BIT(i)) {
- value = ar9003_hw_atten_chain_get(ah, i, chan);
- REG_RMW_FIELD(ah, ext_atten_reg[i],
- AR_PHY_EXT_ATTEN_CTL_XATTEN1_DB, value);
- if (AR_SREV_9485(ah) &&
- (ar9003_hw_get_rx_gain_idx(ah) == 0) &&
- ah->config.xatten_margin_cfg)
- value = 5;
- else
- value = ar9003_hw_atten_chain_get_margin(ah, i, chan);
- if (ah->config.alt_mingainidx)
- REG_RMW_FIELD(ah, AR_PHY_EXT_ATTEN_CTL_0,
- AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
- value);
- REG_RMW_FIELD(ah, ext_atten_reg[i],
- AR_PHY_EXT_ATTEN_CTL_XATTEN1_MARGIN,
- value);
- }
- }
- }
- static bool is_pmu_set(struct ath_hw *ah, u32 pmu_reg, int pmu_set)
- {
- int timeout = 100;
- while (pmu_set != REG_READ(ah, pmu_reg)) {
- if (timeout-- == 0)
- return false;
- REG_WRITE(ah, pmu_reg, pmu_set);
- udelay(10);
- }
- return true;
- }
- void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
- u32 reg_val;
- if (pBase->featureEnable & BIT(4)) {
- if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
- int reg_pmu_set;
- reg_pmu_set = REG_READ(ah, AR_PHY_PMU2) & ~AR_PHY_PMU2_PGM;
- REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set);
- if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set))
- return;
- if (AR_SREV_9330(ah)) {
- if (ah->is_clk_25mhz) {
- reg_pmu_set = (3 << 1) | (8 << 4) |
- (3 << 8) | (1 << 14) |
- (6 << 17) | (1 << 20) |
- (3 << 24);
- } else {
- reg_pmu_set = (4 << 1) | (7 << 4) |
- (3 << 8) | (1 << 14) |
- (6 << 17) | (1 << 20) |
- (3 << 24);
- }
- } else {
- reg_pmu_set = (5 << 1) | (7 << 4) |
- (2 << 8) | (2 << 14) |
- (6 << 17) | (1 << 20) |
- (3 << 24) | (1 << 28);
- }
- REG_WRITE(ah, AR_PHY_PMU1, reg_pmu_set);
- if (!is_pmu_set(ah, AR_PHY_PMU1, reg_pmu_set))
- return;
- reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0xFFC00000)
- | (4 << 26);
- REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set);
- if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set))
- return;
- reg_pmu_set = (REG_READ(ah, AR_PHY_PMU2) & ~0x00200000)
- | (1 << 21);
- REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set);
- if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set))
- return;
- } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah) ||
- AR_SREV_9561(ah)) {
- reg_val = le32_to_cpu(pBase->swreg);
- REG_WRITE(ah, AR_PHY_PMU1, reg_val);
- if (AR_SREV_9561(ah))
- REG_WRITE(ah, AR_PHY_PMU2, 0x10200000);
- } else {
- /* Internal regulator is ON. Write swreg register. */
- reg_val = le32_to_cpu(pBase->swreg);
- REG_WRITE(ah, AR_RTC_REG_CONTROL1,
- REG_READ(ah, AR_RTC_REG_CONTROL1) &
- (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM));
- REG_WRITE(ah, AR_RTC_REG_CONTROL0, reg_val);
- /* Set REG_CONTROL1.SWREG_PROGRAM */
- REG_WRITE(ah, AR_RTC_REG_CONTROL1,
- REG_READ(ah,
- AR_RTC_REG_CONTROL1) |
- AR_RTC_REG_CONTROL1_SWREG_PROGRAM);
- }
- } else {
- if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
- REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0);
- while (REG_READ_FIELD(ah, AR_PHY_PMU2,
- AR_PHY_PMU2_PGM))
- udelay(10);
- REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1);
- while (!REG_READ_FIELD(ah, AR_PHY_PMU1,
- AR_PHY_PMU1_PWD))
- udelay(10);
- REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0x1);
- while (!REG_READ_FIELD(ah, AR_PHY_PMU2,
- AR_PHY_PMU2_PGM))
- udelay(10);
- } else if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
- REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1);
- else {
- reg_val = REG_READ(ah, AR_RTC_SLEEP_CLK) |
- AR_RTC_FORCE_SWREG_PRD;
- REG_WRITE(ah, AR_RTC_SLEEP_CLK, reg_val);
- }
- }
- }
- static void ar9003_hw_apply_tuning_caps(struct ath_hw *ah)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- u8 tuning_caps_param = eep->baseEepHeader.params_for_tuning_caps[0];
- if (AR_SREV_9340(ah) || AR_SREV_9531(ah))
- return;
- if (eep->baseEepHeader.featureEnable & 0x40) {
- tuning_caps_param &= 0x7f;
- REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPINDAC,
- tuning_caps_param);
- REG_RMW_FIELD(ah, AR_CH0_XTAL, AR_CH0_XTAL_CAPOUTDAC,
- tuning_caps_param);
- }
- }
- static void ar9003_hw_quick_drop_apply(struct ath_hw *ah, u16 freq)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
- int quick_drop;
- s32 t[3], f[3] = {5180, 5500, 5785};
- if (!(pBase->miscConfiguration & BIT(4)))
- return;
- if (AR_SREV_9300(ah) || AR_SREV_9580(ah) || AR_SREV_9340(ah)) {
- if (freq < 4000) {
- quick_drop = eep->modalHeader2G.quick_drop;
- } else {
- t[0] = eep->base_ext1.quick_drop_low;
- t[1] = eep->modalHeader5G.quick_drop;
- t[2] = eep->base_ext1.quick_drop_high;
- quick_drop = ar9003_hw_power_interpolate(freq, f, t, 3);
- }
- REG_RMW_FIELD(ah, AR_PHY_AGC, AR_PHY_AGC_QUICK_DROP, quick_drop);
- }
- }
- static void ar9003_hw_txend_to_xpa_off_apply(struct ath_hw *ah, bool is2ghz)
- {
- u32 value;
- value = ar9003_modal_header(ah, is2ghz)->txEndToXpaOff;
- REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
- AR_PHY_XPA_TIMING_CTL_TX_END_XPAB_OFF, value);
- REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
- AR_PHY_XPA_TIMING_CTL_TX_END_XPAA_OFF, value);
- }
- static void ar9003_hw_xpa_timing_control_apply(struct ath_hw *ah, bool is2ghz)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- u8 xpa_ctl;
- if (!(eep->baseEepHeader.featureEnable & 0x80))
- return;
- if (!AR_SREV_9300(ah) &&
- !AR_SREV_9340(ah) &&
- !AR_SREV_9580(ah) &&
- !AR_SREV_9531(ah) &&
- !AR_SREV_9561(ah))
- return;
- xpa_ctl = ar9003_modal_header(ah, is2ghz)->txFrameToXpaOn;
- if (is2ghz)
- REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
- AR_PHY_XPA_TIMING_CTL_FRAME_XPAB_ON, xpa_ctl);
- else
- REG_RMW_FIELD(ah, AR_PHY_XPA_TIMING_CTL,
- AR_PHY_XPA_TIMING_CTL_FRAME_XPAA_ON, xpa_ctl);
- }
- static void ar9003_hw_xlna_bias_strength_apply(struct ath_hw *ah, bool is2ghz)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- u8 bias;
- if (!(eep->baseEepHeader.miscConfiguration & 0x40))
- return;
- if (!AR_SREV_9300(ah))
- return;
- bias = ar9003_modal_header(ah, is2ghz)->xlna_bias_strength;
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS,
- bias & 0x3);
- bias >>= 2;
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS,
- bias & 0x3);
- bias >>= 2;
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4, AR_PHY_65NM_RXTX4_XLNA_BIAS,
- bias & 0x3);
- }
- static int ar9003_hw_get_thermometer(struct ath_hw *ah)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_base_eep_hdr *pBase = &eep->baseEepHeader;
- int thermometer = (pBase->miscConfiguration >> 1) & 0x3;
- return --thermometer;
- }
- static void ar9003_hw_thermometer_apply(struct ath_hw *ah)
- {
- struct ath9k_hw_capabilities *pCap = &ah->caps;
- int thermometer = ar9003_hw_get_thermometer(ah);
- u8 therm_on = (thermometer < 0) ? 0 : 1;
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
- AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
- if (pCap->chip_chainmask & BIT(1))
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
- AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
- if (pCap->chip_chainmask & BIT(2))
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
- AR_PHY_65NM_CH0_RXTX4_THERM_ON_OVR, therm_on);
- therm_on = (thermometer < 0) ? 0 : (thermometer == 0);
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH0_RXTX4,
- AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
- if (pCap->chip_chainmask & BIT(1)) {
- therm_on = (thermometer < 0) ? 0 : (thermometer == 1);
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH1_RXTX4,
- AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
- }
- if (pCap->chip_chainmask & BIT(2)) {
- therm_on = (thermometer < 0) ? 0 : (thermometer == 2);
- REG_RMW_FIELD(ah, AR_PHY_65NM_CH2_RXTX4,
- AR_PHY_65NM_CH0_RXTX4_THERM_ON, therm_on);
- }
- }
- static void ar9003_hw_thermo_cal_apply(struct ath_hw *ah)
- {
- u32 data, ko, kg;
- if (!AR_SREV_9462_20_OR_LATER(ah))
- return;
- ar9300_otp_read_word(ah, 1, &data);
- ko = data & 0xff;
- kg = (data >> 8) & 0xff;
- if (ko || kg) {
- REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3,
- AR_PHY_BB_THERM_ADC_3_THERM_ADC_OFFSET, ko);
- REG_RMW_FIELD(ah, AR_PHY_BB_THERM_ADC_3,
- AR_PHY_BB_THERM_ADC_3_THERM_ADC_SCALE_GAIN,
- kg + 256);
- }
- }
- static void ar9003_hw_apply_minccapwr_thresh(struct ath_hw *ah,
- bool is2ghz)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- const u_int32_t cca_ctrl[AR9300_MAX_CHAINS] = {
- AR_PHY_CCA_CTRL_0,
- AR_PHY_CCA_CTRL_1,
- AR_PHY_CCA_CTRL_2,
- };
- int chain;
- u32 val;
- if (is2ghz) {
- if (!(eep->base_ext1.misc_enable & BIT(2)))
- return;
- } else {
- if (!(eep->base_ext1.misc_enable & BIT(3)))
- return;
- }
- for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) {
- if (!(ah->caps.tx_chainmask & BIT(chain)))
- continue;
- val = ar9003_modal_header(ah, is2ghz)->noiseFloorThreshCh[chain];
- REG_RMW_FIELD(ah, cca_ctrl[chain],
- AR_PHY_EXT_CCA0_THRESH62_1, val);
- }
- }
- static void ath9k_hw_ar9300_set_board_values(struct ath_hw *ah,
- struct ath9k_channel *chan)
- {
- bool is2ghz = IS_CHAN_2GHZ(chan);
- ar9003_hw_xpa_timing_control_apply(ah, is2ghz);
- ar9003_hw_xpa_bias_level_apply(ah, is2ghz);
- ar9003_hw_ant_ctrl_apply(ah, is2ghz);
- ar9003_hw_drive_strength_apply(ah);
- ar9003_hw_xlna_bias_strength_apply(ah, is2ghz);
- ar9003_hw_atten_apply(ah, chan);
- ar9003_hw_quick_drop_apply(ah, chan->channel);
- if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) && !AR_SREV_9531(ah))
- ar9003_hw_internal_regulator_apply(ah);
- ar9003_hw_apply_tuning_caps(ah);
- ar9003_hw_apply_minccapwr_thresh(ah, is2ghz);
- ar9003_hw_txend_to_xpa_off_apply(ah, is2ghz);
- ar9003_hw_thermometer_apply(ah);
- ar9003_hw_thermo_cal_apply(ah);
- }
- static void ath9k_hw_ar9300_set_addac(struct ath_hw *ah,
- struct ath9k_channel *chan)
- {
- }
- /*
- * Returns the interpolated y value corresponding to the specified x value
- * from the np ordered pairs of data (px,py).
- * The pairs do not have to be in any order.
- * If the specified x value is less than any of the px,
- * the returned y value is equal to the py for the lowest px.
- * If the specified x value is greater than any of the px,
- * the returned y value is equal to the py for the highest px.
- */
- static int ar9003_hw_power_interpolate(int32_t x,
- int32_t *px, int32_t *py, u_int16_t np)
- {
- int ip = 0;
- int lx = 0, ly = 0, lhave = 0;
- int hx = 0, hy = 0, hhave = 0;
- int dx = 0;
- int y = 0;
- lhave = 0;
- hhave = 0;
- /* identify best lower and higher x calibration measurement */
- for (ip = 0; ip < np; ip++) {
- dx = x - px[ip];
- /* this measurement is higher than our desired x */
- if (dx <= 0) {
- if (!hhave || dx > (x - hx)) {
- /* new best higher x measurement */
- hx = px[ip];
- hy = py[ip];
- hhave = 1;
- }
- }
- /* this measurement is lower than our desired x */
- if (dx >= 0) {
- if (!lhave || dx < (x - lx)) {
- /* new best lower x measurement */
- lx = px[ip];
- ly = py[ip];
- lhave = 1;
- }
- }
- }
- /* the low x is good */
- if (lhave) {
- /* so is the high x */
- if (hhave) {
- /* they're the same, so just pick one */
- if (hx == lx)
- y = ly;
- else /* interpolate */
- y = interpolate(x, lx, hx, ly, hy);
- } else /* only low is good, use it */
- y = ly;
- } else if (hhave) /* only high is good, use it */
- y = hy;
- else /* nothing is good,this should never happen unless np=0, ???? */
- y = -(1 << 30);
- return y;
- }
- static u8 ar9003_hw_eeprom_get_tgt_pwr(struct ath_hw *ah,
- u16 rateIndex, u16 freq, bool is2GHz)
- {
- u16 numPiers, i;
- s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS];
- s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS];
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct cal_tgt_pow_legacy *pEepromTargetPwr;
- u8 *pFreqBin;
- if (is2GHz) {
- numPiers = AR9300_NUM_2G_20_TARGET_POWERS;
- pEepromTargetPwr = eep->calTargetPower2G;
- pFreqBin = eep->calTarget_freqbin_2G;
- } else {
- numPiers = AR9300_NUM_5G_20_TARGET_POWERS;
- pEepromTargetPwr = eep->calTargetPower5G;
- pFreqBin = eep->calTarget_freqbin_5G;
- }
- /*
- * create array of channels and targetpower from
- * targetpower piers stored on eeprom
- */
- for (i = 0; i < numPiers; i++) {
- freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz);
- targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
- }
- /* interpolate to get target power for given frequency */
- return (u8) ar9003_hw_power_interpolate((s32) freq,
- freqArray,
- targetPowerArray, numPiers);
- }
- static u8 ar9003_hw_eeprom_get_ht20_tgt_pwr(struct ath_hw *ah,
- u16 rateIndex,
- u16 freq, bool is2GHz)
- {
- u16 numPiers, i;
- s32 targetPowerArray[AR9300_NUM_5G_20_TARGET_POWERS];
- s32 freqArray[AR9300_NUM_5G_20_TARGET_POWERS];
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct cal_tgt_pow_ht *pEepromTargetPwr;
- u8 *pFreqBin;
- if (is2GHz) {
- numPiers = AR9300_NUM_2G_20_TARGET_POWERS;
- pEepromTargetPwr = eep->calTargetPower2GHT20;
- pFreqBin = eep->calTarget_freqbin_2GHT20;
- } else {
- numPiers = AR9300_NUM_5G_20_TARGET_POWERS;
- pEepromTargetPwr = eep->calTargetPower5GHT20;
- pFreqBin = eep->calTarget_freqbin_5GHT20;
- }
- /*
- * create array of channels and targetpower
- * from targetpower piers stored on eeprom
- */
- for (i = 0; i < numPiers; i++) {
- freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz);
- targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
- }
- /* interpolate to get target power for given frequency */
- return (u8) ar9003_hw_power_interpolate((s32) freq,
- freqArray,
- targetPowerArray, numPiers);
- }
- static u8 ar9003_hw_eeprom_get_ht40_tgt_pwr(struct ath_hw *ah,
- u16 rateIndex,
- u16 freq, bool is2GHz)
- {
- u16 numPiers, i;
- s32 targetPowerArray[AR9300_NUM_5G_40_TARGET_POWERS];
- s32 freqArray[AR9300_NUM_5G_40_TARGET_POWERS];
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct cal_tgt_pow_ht *pEepromTargetPwr;
- u8 *pFreqBin;
- if (is2GHz) {
- numPiers = AR9300_NUM_2G_40_TARGET_POWERS;
- pEepromTargetPwr = eep->calTargetPower2GHT40;
- pFreqBin = eep->calTarget_freqbin_2GHT40;
- } else {
- numPiers = AR9300_NUM_5G_40_TARGET_POWERS;
- pEepromTargetPwr = eep->calTargetPower5GHT40;
- pFreqBin = eep->calTarget_freqbin_5GHT40;
- }
- /*
- * create array of channels and targetpower from
- * targetpower piers stored on eeprom
- */
- for (i = 0; i < numPiers; i++) {
- freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], is2GHz);
- targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
- }
- /* interpolate to get target power for given frequency */
- return (u8) ar9003_hw_power_interpolate((s32) freq,
- freqArray,
- targetPowerArray, numPiers);
- }
- static u8 ar9003_hw_eeprom_get_cck_tgt_pwr(struct ath_hw *ah,
- u16 rateIndex, u16 freq)
- {
- u16 numPiers = AR9300_NUM_2G_CCK_TARGET_POWERS, i;
- s32 targetPowerArray[AR9300_NUM_2G_CCK_TARGET_POWERS];
- s32 freqArray[AR9300_NUM_2G_CCK_TARGET_POWERS];
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct cal_tgt_pow_legacy *pEepromTargetPwr = eep->calTargetPowerCck;
- u8 *pFreqBin = eep->calTarget_freqbin_Cck;
- /*
- * create array of channels and targetpower from
- * targetpower piers stored on eeprom
- */
- for (i = 0; i < numPiers; i++) {
- freqArray[i] = ath9k_hw_fbin2freq(pFreqBin[i], 1);
- targetPowerArray[i] = pEepromTargetPwr[i].tPow2x[rateIndex];
- }
- /* interpolate to get target power for given frequency */
- return (u8) ar9003_hw_power_interpolate((s32) freq,
- freqArray,
- targetPowerArray, numPiers);
- }
- static void ar9003_hw_selfgen_tpc_txpower(struct ath_hw *ah,
- struct ath9k_channel *chan,
- u8 *pwr_array)
- {
- u32 val;
- /* target power values for self generated frames (ACK,RTS/CTS) */
- if (IS_CHAN_2GHZ(chan)) {
- val = SM(pwr_array[ALL_TARGET_LEGACY_1L_5L], AR_TPC_ACK) |
- SM(pwr_array[ALL_TARGET_LEGACY_1L_5L], AR_TPC_CTS) |
- SM(0x3f, AR_TPC_CHIRP) | SM(0x3f, AR_TPC_RPT);
- } else {
- val = SM(pwr_array[ALL_TARGET_LEGACY_6_24], AR_TPC_ACK) |
- SM(pwr_array[ALL_TARGET_LEGACY_6_24], AR_TPC_CTS) |
- SM(0x3f, AR_TPC_CHIRP) | SM(0x3f, AR_TPC_RPT);
- }
- REG_WRITE(ah, AR_TPC, val);
- }
- /* Set tx power registers to array of values passed in */
- static int ar9003_hw_tx_power_regwrite(struct ath_hw *ah, u8 * pPwrArray)
- {
- #define POW_SM(_r, _s) (((_r) & 0x3f) << (_s))
- /* make sure forced gain is not set */
- REG_WRITE(ah, AR_PHY_TX_FORCED_GAIN, 0);
- /* Write the OFDM power per rate set */
- /* 6 (LSB), 9, 12, 18 (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(0),
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 16) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
- /* 24 (LSB), 36, 48, 54 (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(1),
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_54], 24) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_48], 16) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_36], 8) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 0));
- /* Write the CCK power per rate set */
- /* 1L (LSB), reserved, 2L, 2S (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(2),
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 24) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
- /* POW_SM(txPowerTimes2, 8) | this is reserved for AR9003 */
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0));
- /* 5.5L (LSB), 5.5S, 11L, 11S (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(3),
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_11S], 24) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_11L], 16) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_5S], 8) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
- );
- /* Write the power for duplicated frames - HT40 */
- /* dup40_cck (LSB), dup40_ofdm, ext20_cck, ext20_ofdm (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(8),
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 24) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 16) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_6_24], 8) |
- POW_SM(pPwrArray[ALL_TARGET_LEGACY_1L_5L], 0)
- );
- /* Write the HT20 power per rate set */
- /* 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(4),
- POW_SM(pPwrArray[ALL_TARGET_HT20_5], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_4], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_1_3_9_11_17_19], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_0_8_16], 0)
- );
- /* 6 (LSB), 7, 12, 13 (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(5),
- POW_SM(pPwrArray[ALL_TARGET_HT20_13], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_12], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_7], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_6], 0)
- );
- /* 14 (LSB), 15, 20, 21 */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(9),
- POW_SM(pPwrArray[ALL_TARGET_HT20_21], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_20], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_15], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_14], 0)
- );
- /* Mixed HT20 and HT40 rates */
- /* HT20 22 (LSB), HT20 23, HT40 22, HT40 23 (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(10),
- POW_SM(pPwrArray[ALL_TARGET_HT40_23], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_22], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_23], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT20_22], 0)
- );
- /*
- * Write the HT40 power per rate set
- * correct PAR difference between HT40 and HT20/LEGACY
- * 0/8/16 (LSB), 1-3/9-11/17-19, 4, 5 (MSB)
- */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(6),
- POW_SM(pPwrArray[ALL_TARGET_HT40_5], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_4], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_1_3_9_11_17_19], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_0_8_16], 0)
- );
- /* 6 (LSB), 7, 12, 13 (MSB) */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(7),
- POW_SM(pPwrArray[ALL_TARGET_HT40_13], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_12], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_7], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_6], 0)
- );
- /* 14 (LSB), 15, 20, 21 */
- REG_WRITE(ah, AR_PHY_POWER_TX_RATE(11),
- POW_SM(pPwrArray[ALL_TARGET_HT40_21], 24) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_20], 16) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_15], 8) |
- POW_SM(pPwrArray[ALL_TARGET_HT40_14], 0)
- );
- return 0;
- #undef POW_SM
- }
- static void ar9003_hw_get_legacy_target_powers(struct ath_hw *ah, u16 freq,
- u8 *targetPowerValT2,
- bool is2GHz)
- {
- targetPowerValT2[ALL_TARGET_LEGACY_6_24] =
- ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_6_24, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_LEGACY_36] =
- ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_36, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_LEGACY_48] =
- ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_48, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_LEGACY_54] =
- ar9003_hw_eeprom_get_tgt_pwr(ah, LEGACY_TARGET_RATE_54, freq,
- is2GHz);
- }
- static void ar9003_hw_get_cck_target_powers(struct ath_hw *ah, u16 freq,
- u8 *targetPowerValT2)
- {
- targetPowerValT2[ALL_TARGET_LEGACY_1L_5L] =
- ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_1L_5L,
- freq);
- targetPowerValT2[ALL_TARGET_LEGACY_5S] =
- ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_5S, freq);
- targetPowerValT2[ALL_TARGET_LEGACY_11L] =
- ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11L, freq);
- targetPowerValT2[ALL_TARGET_LEGACY_11S] =
- ar9003_hw_eeprom_get_cck_tgt_pwr(ah, LEGACY_TARGET_RATE_11S, freq);
- }
- static void ar9003_hw_get_ht20_target_powers(struct ath_hw *ah, u16 freq,
- u8 *targetPowerValT2, bool is2GHz)
- {
- targetPowerValT2[ALL_TARGET_HT20_0_8_16] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_1_3_9_11_17_19] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19,
- freq, is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_4] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_4, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_5] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_5, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_6] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_6, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_7] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_7, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_12] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_12, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_13] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_13, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_14] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_14, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_15] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_15, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_20] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_20, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_21] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_21, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_22] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_22, freq,
- is2GHz);
- targetPowerValT2[ALL_TARGET_HT20_23] =
- ar9003_hw_eeprom_get_ht20_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
- is2GHz);
- }
- static void ar9003_hw_get_ht40_target_powers(struct ath_hw *ah,
- u16 freq,
- u8 *targetPowerValT2,
- bool is2GHz)
- {
- /* XXX: hard code for now, need to get from eeprom struct */
- u8 ht40PowerIncForPdadc = 0;
- targetPowerValT2[ALL_TARGET_HT40_0_8_16] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_0_8_16, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_1_3_9_11_17_19] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_1_3_9_11_17_19,
- freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_4] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_4, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_5] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_5, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_6] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_6, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_7] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_7, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_12] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_12, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_13] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_13, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_14] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_14, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_15] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_15, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_20] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_20, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_21] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_21, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_22] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_22, freq,
- is2GHz) + ht40PowerIncForPdadc;
- targetPowerValT2[ALL_TARGET_HT40_23] =
- ar9003_hw_eeprom_get_ht40_tgt_pwr(ah, HT_TARGET_RATE_23, freq,
- is2GHz) + ht40PowerIncForPdadc;
- }
- static void ar9003_hw_get_target_power_eeprom(struct ath_hw *ah,
- struct ath9k_channel *chan,
- u8 *targetPowerValT2)
- {
- bool is2GHz = IS_CHAN_2GHZ(chan);
- unsigned int i = 0;
- struct ath_common *common = ath9k_hw_common(ah);
- u16 freq = chan->channel;
- if (is2GHz)
- ar9003_hw_get_cck_target_powers(ah, freq, targetPowerValT2);
- ar9003_hw_get_legacy_target_powers(ah, freq, targetPowerValT2, is2GHz);
- ar9003_hw_get_ht20_target_powers(ah, freq, targetPowerValT2, is2GHz);
- if (IS_CHAN_HT40(chan))
- ar9003_hw_get_ht40_target_powers(ah, freq, targetPowerValT2,
- is2GHz);
- for (i = 0; i < ar9300RateSize; i++) {
- ath_dbg(common, REGULATORY, "TPC[%02d] 0x%08x\n",
- i, targetPowerValT2[i]);
- }
- }
- static int ar9003_hw_cal_pier_get(struct ath_hw *ah,
- int mode,
- int ipier,
- int ichain,
- int *pfrequency,
- int *pcorrection,
- int *ptemperature, int *pvoltage)
- {
- u8 *pCalPier;
- struct ar9300_cal_data_per_freq_op_loop *pCalPierStruct;
- int is2GHz;
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ath_common *common = ath9k_hw_common(ah);
- if (ichain >= AR9300_MAX_CHAINS) {
- ath_dbg(common, EEPROM,
- "Invalid chain index, must be less than %d\n",
- AR9300_MAX_CHAINS);
- return -1;
- }
- if (mode) { /* 5GHz */
- if (ipier >= AR9300_NUM_5G_CAL_PIERS) {
- ath_dbg(common, EEPROM,
- "Invalid 5GHz cal pier index, must be less than %d\n",
- AR9300_NUM_5G_CAL_PIERS);
- return -1;
- }
- pCalPier = &(eep->calFreqPier5G[ipier]);
- pCalPierStruct = &(eep->calPierData5G[ichain][ipier]);
- is2GHz = 0;
- } else {
- if (ipier >= AR9300_NUM_2G_CAL_PIERS) {
- ath_dbg(common, EEPROM,
- "Invalid 2GHz cal pier index, must be less than %d\n",
- AR9300_NUM_2G_CAL_PIERS);
- return -1;
- }
- pCalPier = &(eep->calFreqPier2G[ipier]);
- pCalPierStruct = &(eep->calPierData2G[ichain][ipier]);
- is2GHz = 1;
- }
- *pfrequency = ath9k_hw_fbin2freq(*pCalPier, is2GHz);
- *pcorrection = pCalPierStruct->refPower;
- *ptemperature = pCalPierStruct->tempMeas;
- *pvoltage = pCalPierStruct->voltMeas;
- return 0;
- }
- static void ar9003_hw_power_control_override(struct ath_hw *ah,
- int frequency,
- int *correction,
- int *voltage, int *temperature)
- {
- int temp_slope = 0, temp_slope1 = 0, temp_slope2 = 0;
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- int f[8], t[8], t1[3], t2[3], i;
- REG_RMW(ah, AR_PHY_TPC_11_B0,
- (correction[0] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
- AR_PHY_TPC_OLPC_GAIN_DELTA);
- if (ah->caps.tx_chainmask & BIT(1))
- REG_RMW(ah, AR_PHY_TPC_11_B1,
- (correction[1] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
- AR_PHY_TPC_OLPC_GAIN_DELTA);
- if (ah->caps.tx_chainmask & BIT(2))
- REG_RMW(ah, AR_PHY_TPC_11_B2,
- (correction[2] << AR_PHY_TPC_OLPC_GAIN_DELTA_S),
- AR_PHY_TPC_OLPC_GAIN_DELTA);
- /* enable open loop power control on chip */
- REG_RMW(ah, AR_PHY_TPC_6_B0,
- (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
- AR_PHY_TPC_6_ERROR_EST_MODE);
- if (ah->caps.tx_chainmask & BIT(1))
- REG_RMW(ah, AR_PHY_TPC_6_B1,
- (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
- AR_PHY_TPC_6_ERROR_EST_MODE);
- if (ah->caps.tx_chainmask & BIT(2))
- REG_RMW(ah, AR_PHY_TPC_6_B2,
- (3 << AR_PHY_TPC_6_ERROR_EST_MODE_S),
- AR_PHY_TPC_6_ERROR_EST_MODE);
- /*
- * enable temperature compensation
- * Need to use register names
- */
- if (frequency < 4000) {
- temp_slope = eep->modalHeader2G.tempSlope;
- } else {
- if (AR_SREV_9550(ah)) {
- t[0] = eep->base_ext1.tempslopextension[2];
- t1[0] = eep->base_ext1.tempslopextension[3];
- t2[0] = eep->base_ext1.tempslopextension[4];
- f[0] = 5180;
- t[1] = eep->modalHeader5G.tempSlope;
- t1[1] = eep->base_ext1.tempslopextension[0];
- t2[1] = eep->base_ext1.tempslopextension[1];
- f[1] = 5500;
- t[2] = eep->base_ext1.tempslopextension[5];
- t1[2] = eep->base_ext1.tempslopextension[6];
- t2[2] = eep->base_ext1.tempslopextension[7];
- f[2] = 5785;
- temp_slope = ar9003_hw_power_interpolate(frequency,
- f, t, 3);
- temp_slope1 = ar9003_hw_power_interpolate(frequency,
- f, t1, 3);
- temp_slope2 = ar9003_hw_power_interpolate(frequency,
- f, t2, 3);
- goto tempslope;
- }
- if ((eep->baseEepHeader.miscConfiguration & 0x20) != 0) {
- for (i = 0; i < 8; i++) {
- t[i] = eep->base_ext1.tempslopextension[i];
- f[i] = FBIN2FREQ(eep->calFreqPier5G[i], 0);
- }
- temp_slope = ar9003_hw_power_interpolate((s32) frequency,
- f, t, 8);
- } else if (eep->base_ext2.tempSlopeLow != 0) {
- t[0] = eep->base_ext2.tempSlopeLow;
- f[0] = 5180;
- t[1] = eep->modalHeader5G.tempSlope;
- f[1] = 5500;
- t[2] = eep->base_ext2.tempSlopeHigh;
- f[2] = 5785;
- temp_slope = ar9003_hw_power_interpolate((s32) frequency,
- f, t, 3);
- } else {
- temp_slope = eep->modalHeader5G.tempSlope;
- }
- }
- tempslope:
- if (AR_SREV_9550(ah) || AR_SREV_9531(ah) || AR_SREV_9561(ah)) {
- u8 txmask = (eep->baseEepHeader.txrxMask & 0xf0) >> 4;
- /*
- * AR955x has tempSlope register for each chain.
- * Check whether temp_compensation feature is enabled or not.
- */
- if (eep->baseEepHeader.featureEnable & 0x1) {
- if (frequency < 4000) {
- if (txmask & BIT(0))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19,
- AR_PHY_TPC_19_ALPHA_THERM,
- eep->base_ext2.tempSlopeLow);
- if (txmask & BIT(1))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
- AR_PHY_TPC_19_ALPHA_THERM,
- temp_slope);
- if (txmask & BIT(2))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2,
- AR_PHY_TPC_19_ALPHA_THERM,
- eep->base_ext2.tempSlopeHigh);
- } else {
- if (txmask & BIT(0))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19,
- AR_PHY_TPC_19_ALPHA_THERM,
- temp_slope);
- if (txmask & BIT(1))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
- AR_PHY_TPC_19_ALPHA_THERM,
- temp_slope1);
- if (txmask & BIT(2))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2,
- AR_PHY_TPC_19_ALPHA_THERM,
- temp_slope2);
- }
- } else {
- /*
- * If temp compensation is not enabled,
- * set all registers to 0.
- */
- if (txmask & BIT(0))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19,
- AR_PHY_TPC_19_ALPHA_THERM, 0);
- if (txmask & BIT(1))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
- AR_PHY_TPC_19_ALPHA_THERM, 0);
- if (txmask & BIT(2))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B2,
- AR_PHY_TPC_19_ALPHA_THERM, 0);
- }
- } else {
- REG_RMW_FIELD(ah, AR_PHY_TPC_19,
- AR_PHY_TPC_19_ALPHA_THERM, temp_slope);
- }
- if (AR_SREV_9462_20_OR_LATER(ah))
- REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
- AR_PHY_TPC_19_B1_ALPHA_THERM, temp_slope);
- REG_RMW_FIELD(ah, AR_PHY_TPC_18, AR_PHY_TPC_18_THERM_CAL_VALUE,
- temperature[0]);
- }
- /* Apply the recorded correction values. */
- static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
- {
- int ichain, ipier, npier;
- int mode;
- int lfrequency[AR9300_MAX_CHAINS],
- lcorrection[AR9300_MAX_CHAINS],
- ltemperature[AR9300_MAX_CHAINS], lvoltage[AR9300_MAX_CHAINS];
- int hfrequency[AR9300_MAX_CHAINS],
- hcorrection[AR9300_MAX_CHAINS],
- htemperature[AR9300_MAX_CHAINS], hvoltage[AR9300_MAX_CHAINS];
- int fdiff;
- int correction[AR9300_MAX_CHAINS],
- voltage[AR9300_MAX_CHAINS], temperature[AR9300_MAX_CHAINS];
- int pfrequency, pcorrection, ptemperature, pvoltage;
- struct ath_common *common = ath9k_hw_common(ah);
- mode = (frequency >= 4000);
- if (mode)
- npier = AR9300_NUM_5G_CAL_PIERS;
- else
- npier = AR9300_NUM_2G_CAL_PIERS;
- for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
- lfrequency[ichain] = 0;
- hfrequency[ichain] = 100000;
- }
- /* identify best lower and higher frequency calibration measurement */
- for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
- for (ipier = 0; ipier < npier; ipier++) {
- if (!ar9003_hw_cal_pier_get(ah, mode, ipier, ichain,
- &pfrequency, &pcorrection,
- &ptemperature, &pvoltage)) {
- fdiff = frequency - pfrequency;
- /*
- * this measurement is higher than
- * our desired frequency
- */
- if (fdiff <= 0) {
- if (hfrequency[ichain] <= 0 ||
- hfrequency[ichain] >= 100000 ||
- fdiff >
- (frequency - hfrequency[ichain])) {
- /*
- * new best higher
- * frequency measurement
- */
- hfrequency[ichain] = pfrequency;
- hcorrection[ichain] =
- pcorrection;
- htemperature[ichain] =
- ptemperature;
- hvoltage[ichain] = pvoltage;
- }
- }
- if (fdiff >= 0) {
- if (lfrequency[ichain] <= 0
- || fdiff <
- (frequency - lfrequency[ichain])) {
- /*
- * new best lower
- * frequency measurement
- */
- lfrequency[ichain] = pfrequency;
- lcorrection[ichain] =
- pcorrection;
- ltemperature[ichain] =
- ptemperature;
- lvoltage[ichain] = pvoltage;
- }
- }
- }
- }
- }
- /* interpolate */
- for (ichain = 0; ichain < AR9300_MAX_CHAINS; ichain++) {
- ath_dbg(common, EEPROM, "ch=%d f=%d low=%d %d h=%d %d\n",
- ichain, frequency, lfrequency[ichain],
- lcorrection[ichain], hfrequency[ichain],
- hcorrection[ichain]);
- /* they're the same, so just pick one */
- if (hfrequency[ichain] == lfrequency[ichain]) {
- correction[ichain] = lcorrection[ichain];
- voltage[ichain] = lvoltage[ichain];
- temperature[ichain] = ltemperature[ichain];
- }
- /* the low frequency is good */
- else if (frequency - lfrequency[ichain] < 1000) {
- /* so is the high frequency, interpolate */
- if (hfrequency[ichain] - frequency < 1000) {
- correction[ichain] = interpolate(frequency,
- lfrequency[ichain],
- hfrequency[ichain],
- lcorrection[ichain],
- hcorrection[ichain]);
- temperature[ichain] = interpolate(frequency,
- lfrequency[ichain],
- hfrequency[ichain],
- ltemperature[ichain],
- htemperature[ichain]);
- voltage[ichain] = interpolate(frequency,
- lfrequency[ichain],
- hfrequency[ichain],
- lvoltage[ichain],
- hvoltage[ichain]);
- }
- /* only low is good, use it */
- else {
- correction[ichain] = lcorrection[ichain];
- temperature[ichain] = ltemperature[ichain];
- voltage[ichain] = lvoltage[ichain];
- }
- }
- /* only high is good, use it */
- else if (hfrequency[ichain] - frequency < 1000) {
- correction[ichain] = hcorrection[ichain];
- temperature[ichain] = htemperature[ichain];
- voltage[ichain] = hvoltage[ichain];
- } else { /* nothing is good, presume 0???? */
- correction[ichain] = 0;
- temperature[ichain] = 0;
- voltage[ichain] = 0;
- }
- }
- ar9003_hw_power_control_override(ah, frequency, correction, voltage,
- temperature);
- ath_dbg(common, EEPROM,
- "for frequency=%d, calibration correction = %d %d %d\n",
- frequency, correction[0], correction[1], correction[2]);
- return 0;
- }
- static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep,
- int idx,
- int edge,
- bool is2GHz)
- {
- struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G;
- struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
- if (is2GHz)
- return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]);
- else
- return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]);
- }
- static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep,
- int idx,
- unsigned int edge,
- u16 freq,
- bool is2GHz)
- {
- struct cal_ctl_data_2g *ctl_2g = eep->ctlPowerData_2G;
- struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G;
- u8 *ctl_freqbin = is2GHz ?
- &eep->ctl_freqbin_2G[idx][0] :
- &eep->ctl_freqbin_5G[idx][0];
- if (is2GHz) {
- if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq &&
- CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1]))
- return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]);
- } else {
- if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq &&
- CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1]))
- return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]);
- }
- return MAX_RATE_POWER;
- }
- /*
- * Find the maximum conformance test limit for the given channel and CTL info
- */
- static u16 ar9003_hw_get_max_edge_power(struct ar9300_eeprom *eep,
- u16 freq, int idx, bool is2GHz)
- {
- u16 twiceMaxEdgePower = MAX_RATE_POWER;
- u8 *ctl_freqbin = is2GHz ?
- &eep->ctl_freqbin_2G[idx][0] :
- &eep->ctl_freqbin_5G[idx][0];
- u16 num_edges = is2GHz ?
- AR9300_NUM_BAND_EDGES_2G : AR9300_NUM_BAND_EDGES_5G;
- unsigned int edge;
- /* Get the edge power */
- for (edge = 0;
- (edge < num_edges) && (ctl_freqbin[edge] != AR5416_BCHAN_UNUSED);
- edge++) {
- /*
- * If there's an exact channel match or an inband flag set
- * on the lower channel use the given rdEdgePower
- */
- if (freq == ath9k_hw_fbin2freq(ctl_freqbin[edge], is2GHz)) {
- twiceMaxEdgePower =
- ar9003_hw_get_direct_edge_power(eep, idx,
- edge, is2GHz);
- break;
- } else if ((edge > 0) &&
- (freq < ath9k_hw_fbin2freq(ctl_freqbin[edge],
- is2GHz))) {
- twiceMaxEdgePower =
- ar9003_hw_get_indirect_edge_power(eep, idx,
- edge, freq,
- is2GHz);
- /*
- * Leave loop - no more affecting edges possible in
- * this monotonic increasing list
- */
- break;
- }
- }
- if (is2GHz && !twiceMaxEdgePower)
- twiceMaxEdgePower = 60;
- return twiceMaxEdgePower;
- }
- static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah,
- struct ath9k_channel *chan,
- u8 *pPwrArray, u16 cfgCtl,
- u8 antenna_reduction,
- u16 powerLimit)
- {
- struct ath_common *common = ath9k_hw_common(ah);
- struct ar9300_eeprom *pEepData = &ah->eeprom.ar9300_eep;
- u16 twiceMaxEdgePower;
- int i;
- u16 scaledPower = 0, minCtlPower;
- static const u16 ctlModesFor11a[] = {
- CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40
- };
- static const u16 ctlModesFor11g[] = {
- CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT,
- CTL_11G_EXT, CTL_2GHT40
- };
- u16 numCtlModes;
- const u16 *pCtlMode;
- u16 ctlMode, freq;
- struct chan_centers centers;
- u8 *ctlIndex;
- u8 ctlNum;
- u16 twiceMinEdgePower;
- bool is2ghz = IS_CHAN_2GHZ(chan);
- ath9k_hw_get_channel_centers(ah, chan, ¢ers);
- scaledPower = ath9k_hw_get_scaled_power(ah, powerLimit,
- antenna_reduction);
- if (is2ghz) {
- /* Setup for CTL modes */
- /* CTL_11B, CTL_11G, CTL_2GHT20 */
- numCtlModes =
- ARRAY_SIZE(ctlModesFor11g) -
- SUB_NUM_CTL_MODES_AT_2G_40;
- pCtlMode = ctlModesFor11g;
- if (IS_CHAN_HT40(chan))
- /* All 2G CTL's */
- numCtlModes = ARRAY_SIZE(ctlModesFor11g);
- } else {
- /* Setup for CTL modes */
- /* CTL_11A, CTL_5GHT20 */
- numCtlModes = ARRAY_SIZE(ctlModesFor11a) -
- SUB_NUM_CTL_MODES_AT_5G_40;
- pCtlMode = ctlModesFor11a;
- if (IS_CHAN_HT40(chan))
- /* All 5G CTL's */
- numCtlModes = ARRAY_SIZE(ctlModesFor11a);
- }
- /*
- * For MIMO, need to apply regulatory caps individually across
- * dynamically running modes: CCK, OFDM, HT20, HT40
- *
- * The outer loop walks through each possible applicable runtime mode.
- * The inner loop walks through each ctlIndex entry in EEPROM.
- * The ctl value is encoded as [7:4] == test group, [3:0] == test mode.
- */
- for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
- bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
- (pCtlMode[ctlMode] == CTL_2GHT40);
- if (isHt40CtlMode)
- freq = centers.synth_center;
- else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
- freq = centers.ext_center;
- else
- freq = centers.ctl_center;
- ath_dbg(common, REGULATORY,
- "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, EXT_ADDITIVE %d\n",
- ctlMode, numCtlModes, isHt40CtlMode,
- (pCtlMode[ctlMode] & EXT_ADDITIVE));
- /* walk through each CTL index stored in EEPROM */
- if (is2ghz) {
- ctlIndex = pEepData->ctlIndex_2G;
- ctlNum = AR9300_NUM_CTLS_2G;
- } else {
- ctlIndex = pEepData->ctlIndex_5G;
- ctlNum = AR9300_NUM_CTLS_5G;
- }
- twiceMaxEdgePower = MAX_RATE_POWER;
- for (i = 0; (i < ctlNum) && ctlIndex[i]; i++) {
- ath_dbg(common, REGULATORY,
- "LOOP-Ctlidx %d: cfgCtl 0x%2.2x pCtlMode 0x%2.2x ctlIndex 0x%2.2x chan %d\n",
- i, cfgCtl, pCtlMode[ctlMode], ctlIndex[i],
- chan->channel);
- /*
- * compare test group from regulatory
- * channel list with test mode from pCtlMode
- * list
- */
- if ((((cfgCtl & ~CTL_MODE_M) |
- (pCtlMode[ctlMode] & CTL_MODE_M)) ==
- ctlIndex[i]) ||
- (((cfgCtl & ~CTL_MODE_M) |
- (pCtlMode[ctlMode] & CTL_MODE_M)) ==
- ((ctlIndex[i] & CTL_MODE_M) |
- SD_NO_CTL))) {
- twiceMinEdgePower =
- ar9003_hw_get_max_edge_power(pEepData,
- freq, i,
- is2ghz);
- if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL)
- /*
- * Find the minimum of all CTL
- * edge powers that apply to
- * this channel
- */
- twiceMaxEdgePower =
- min(twiceMaxEdgePower,
- twiceMinEdgePower);
- else {
- /* specific */
- twiceMaxEdgePower = twiceMinEdgePower;
- break;
- }
- }
- }
- minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
- ath_dbg(common, REGULATORY,
- "SEL-Min ctlMode %d pCtlMode %d 2xMaxEdge %d sP %d minCtlPwr %d\n",
- ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
- scaledPower, minCtlPower);
- /* Apply ctl mode to correct target power set */
- switch (pCtlMode[ctlMode]) {
- case CTL_11B:
- for (i = ALL_TARGET_LEGACY_1L_5L;
- i <= ALL_TARGET_LEGACY_11S; i++)
- pPwrArray[i] = (u8)min((u16)pPwrArray[i],
- minCtlPower);
- break;
- case CTL_11A:
- case CTL_11G:
- for (i = ALL_TARGET_LEGACY_6_24;
- i <= ALL_TARGET_LEGACY_54; i++)
- pPwrArray[i] = (u8)min((u16)pPwrArray[i],
- minCtlPower);
- break;
- case CTL_5GHT20:
- case CTL_2GHT20:
- for (i = ALL_TARGET_HT20_0_8_16;
- i <= ALL_TARGET_HT20_23; i++) {
- pPwrArray[i] = (u8)min((u16)pPwrArray[i],
- minCtlPower);
- if (ath9k_hw_mci_is_enabled(ah))
- pPwrArray[i] =
- (u8)min((u16)pPwrArray[i],
- ar9003_mci_get_max_txpower(ah,
- pCtlMode[ctlMode]));
- }
- break;
- case CTL_5GHT40:
- case CTL_2GHT40:
- for (i = ALL_TARGET_HT40_0_8_16;
- i <= ALL_TARGET_HT40_23; i++) {
- pPwrArray[i] = (u8)min((u16)pPwrArray[i],
- minCtlPower);
- if (ath9k_hw_mci_is_enabled(ah))
- pPwrArray[i] =
- (u8)min((u16)pPwrArray[i],
- ar9003_mci_get_max_txpower(ah,
- pCtlMode[ctlMode]));
- }
- break;
- default:
- break;
- }
- } /* end ctl mode checking */
- }
- static inline u8 mcsidx_to_tgtpwridx(unsigned int mcs_idx, u8 base_pwridx)
- {
- u8 mod_idx = mcs_idx % 8;
- if (mod_idx <= 3)
- return mod_idx ? (base_pwridx + 1) : base_pwridx;
- else
- return base_pwridx + 4 * (mcs_idx / 8) + mod_idx - 2;
- }
- static void ar9003_paprd_set_txpower(struct ath_hw *ah,
- struct ath9k_channel *chan,
- u8 *targetPowerValT2)
- {
- int i;
- if (!ar9003_is_paprd_enabled(ah))
- return;
- if (IS_CHAN_HT40(chan))
- i = ALL_TARGET_HT40_7;
- else
- i = ALL_TARGET_HT20_7;
- if (IS_CHAN_2GHZ(chan)) {
- if (!AR_SREV_9330(ah) && !AR_SREV_9340(ah) &&
- !AR_SREV_9462(ah) && !AR_SREV_9565(ah)) {
- if (IS_CHAN_HT40(chan))
- i = ALL_TARGET_HT40_0_8_16;
- else
- i = ALL_TARGET_HT20_0_8_16;
- }
- }
- ah->paprd_target_power = targetPowerValT2[i];
- }
- static void ath9k_hw_ar9300_set_txpower(struct ath_hw *ah,
- struct ath9k_channel *chan, u16 cfgCtl,
- u8 twiceAntennaReduction,
- u8 powerLimit, bool test)
- {
- struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
- struct ath_common *common = ath9k_hw_common(ah);
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- struct ar9300_modal_eep_header *modal_hdr;
- u8 targetPowerValT2[ar9300RateSize];
- u8 target_power_val_t2_eep[ar9300RateSize];
- u8 targetPowerValT2_tpc[ar9300RateSize];
- unsigned int i = 0, paprd_scale_factor = 0;
- u8 pwr_idx, min_pwridx = 0;
- memset(targetPowerValT2, 0 , sizeof(targetPowerValT2));
- /*
- * Get target powers from EEPROM - our baseline for TX Power
- */
- ar9003_hw_get_target_power_eeprom(ah, chan, targetPowerValT2);
- if (ar9003_is_paprd_enabled(ah)) {
- if (IS_CHAN_2GHZ(chan))
- modal_hdr = &eep->modalHeader2G;
- else
- modal_hdr = &eep->modalHeader5G;
- ah->paprd_ratemask =
- le32_to_cpu(modal_hdr->papdRateMaskHt20) &
- AR9300_PAPRD_RATE_MASK;
- ah->paprd_ratemask_ht40 =
- le32_to_cpu(modal_hdr->papdRateMaskHt40) &
- AR9300_PAPRD_RATE_MASK;
- paprd_scale_factor = ar9003_get_paprd_scale_factor(ah, chan);
- min_pwridx = IS_CHAN_HT40(chan) ? ALL_TARGET_HT40_0_8_16 :
- ALL_TARGET_HT20_0_8_16;
- if (!ah->paprd_table_write_done) {
- memcpy(target_power_val_t2_eep, targetPowerValT2,
- sizeof(targetPowerValT2));
- for (i = 0; i < 24; i++) {
- pwr_idx = mcsidx_to_tgtpwridx(i, min_pwridx);
- if (ah->paprd_ratemask & (1 << i)) {
- if (targetPowerValT2[pwr_idx] &&
- targetPowerValT2[pwr_idx] ==
- target_power_val_t2_eep[pwr_idx])
- targetPowerValT2[pwr_idx] -=
- paprd_scale_factor;
- }
- }
- }
- memcpy(target_power_val_t2_eep, targetPowerValT2,
- sizeof(targetPowerValT2));
- }
- ar9003_hw_set_power_per_rate_table(ah, chan,
- targetPowerValT2, cfgCtl,
- twiceAntennaReduction,
- powerLimit);
- memcpy(targetPowerValT2_tpc, targetPowerValT2,
- sizeof(targetPowerValT2));
- if (ar9003_is_paprd_enabled(ah)) {
- for (i = 0; i < ar9300RateSize; i++) {
- if ((ah->paprd_ratemask & (1 << i)) &&
- (abs(targetPowerValT2[i] -
- target_power_val_t2_eep[i]) >
- paprd_scale_factor)) {
- ah->paprd_ratemask &= ~(1 << i);
- ath_dbg(common, EEPROM,
- "paprd disabled for mcs %d\n", i);
- }
- }
- }
- regulatory->max_power_level = 0;
- for (i = 0; i < ar9300RateSize; i++) {
- if (targetPowerValT2[i] > regulatory->max_power_level)
- regulatory->max_power_level = targetPowerValT2[i];
- }
- ath9k_hw_update_regulatory_maxpower(ah);
- if (test)
- return;
- for (i = 0; i < ar9300RateSize; i++) {
- ath_dbg(common, REGULATORY, "TPC[%02d] 0x%08x\n",
- i, targetPowerValT2[i]);
- }
- /* Write target power array to registers */
- ar9003_hw_tx_power_regwrite(ah, targetPowerValT2);
- ar9003_hw_calibration_apply(ah, chan->channel);
- ar9003_paprd_set_txpower(ah, chan, targetPowerValT2);
- ar9003_hw_selfgen_tpc_txpower(ah, chan, targetPowerValT2);
- /* TPC initializations */
- if (ah->tpc_enabled) {
- u32 val;
- ar9003_hw_init_rate_txpower(ah, targetPowerValT2_tpc, chan);
- /* Enable TPC */
- REG_WRITE(ah, AR_PHY_PWRTX_MAX,
- AR_PHY_POWER_TX_RATE_MAX_TPC_ENABLE);
- /* Disable per chain power reduction */
- val = REG_READ(ah, AR_PHY_POWER_TX_SUB);
- if (AR_SREV_9340(ah))
- REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
- val & 0xFFFFFFC0);
- else
- REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
- val & 0xFFFFF000);
- } else {
- /* Disable TPC */
- REG_WRITE(ah, AR_PHY_PWRTX_MAX, 0);
- }
- }
- static u16 ath9k_hw_ar9300_get_spur_channel(struct ath_hw *ah,
- u16 i, bool is2GHz)
- {
- return AR_NO_SPUR;
- }
- s32 ar9003_hw_get_tx_gain_idx(struct ath_hw *ah)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- return (eep->baseEepHeader.txrxgain >> 4) & 0xf; /* bits 7:4 */
- }
- s32 ar9003_hw_get_rx_gain_idx(struct ath_hw *ah)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- return (eep->baseEepHeader.txrxgain) & 0xf; /* bits 3:0 */
- }
- u8 *ar9003_get_spur_chan_ptr(struct ath_hw *ah, bool is2ghz)
- {
- return ar9003_modal_header(ah, is2ghz)->spurChans;
- }
- unsigned int ar9003_get_paprd_scale_factor(struct ath_hw *ah,
- struct ath9k_channel *chan)
- {
- struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
- if (IS_CHAN_2GHZ(chan))
- return MS(le32_to_cpu(eep->modalHeader2G.papdRateMaskHt20),
- AR9300_PAPRD_SCALE_1);
- else {
- if (chan->channel >= 5700)
- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt20),
- AR9300_PAPRD_SCALE_1);
- else if (chan->channel >= 5400)
- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
- AR9300_PAPRD_SCALE_2);
- else
- return MS(le32_to_cpu(eep->modalHeader5G.papdRateMaskHt40),
- AR9300_PAPRD_SCALE_1);
- }
- }
- const struct eeprom_ops eep_ar9300_ops = {
- .check_eeprom = ath9k_hw_ar9300_check_eeprom,
- .get_eeprom = ath9k_hw_ar9300_get_eeprom,
- .fill_eeprom = ath9k_hw_ar9300_fill_eeprom,
- .dump_eeprom = ath9k_hw_ar9003_dump_eeprom,
- .get_eeprom_ver = ath9k_hw_ar9300_get_eeprom_ver,
- .get_eeprom_rev = ath9k_hw_ar9300_get_eeprom_rev,
- .set_board_values = ath9k_hw_ar9300_set_board_values,
- .set_addac = ath9k_hw_ar9300_set_addac,
- .set_txpower = ath9k_hw_ar9300_set_txpower,
- .get_spur_channel = ath9k_hw_ar9300_get_spur_channel
- };
|