sbchipc.h 171 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641
  1. /*
  2. * SiliconBackplane Chipcommon core hardware definitions.
  3. *
  4. * The chipcommon core provides chip identification, SB control,
  5. * JTAG, 0/1/2 UARTs, clock frequency control, a watchdog interrupt timer,
  6. * GPIO interface, extbus, and support for serial and parallel flashes.
  7. *
  8. * $Id: sbchipc.h 701163 2017-05-23 22:21:03Z $
  9. *
  10. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  11. *
  12. * Copyright (C) 1999-2020, Broadcom Corporation
  13. *
  14. * Unless you and Broadcom execute a separate written software license
  15. * agreement governing use of this software, this software is licensed to you
  16. * under the terms of the GNU General Public License version 2 (the "GPL"),
  17. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  18. * following added to such license:
  19. *
  20. * As a special exception, the copyright holders of this software give you
  21. * permission to link this software with independent modules, and to copy and
  22. * distribute the resulting executable under terms of your choice, provided that
  23. * you also meet, for each linked independent module, the terms and conditions of
  24. * the license of that module. An independent module is a module which is not
  25. * derived from this software. The special exception does not apply to any
  26. * modifications of the software.
  27. *
  28. * Notwithstanding the above, under no circumstances may you combine this
  29. * software in any way with any other Broadcom software provided under a license
  30. * other than the GPL, without Broadcom's express prior written consent.
  31. *
  32. *
  33. * <<Broadcom-WL-IPTag/Open:>>
  34. */
  35. #ifndef _SBCHIPC_H
  36. #define _SBCHIPC_H
  37. #if !defined(_LANGUAGE_ASSEMBLY) && !defined(__ASSEMBLY__)
  38. /* cpp contortions to concatenate w/arg prescan */
  39. #ifndef PAD
  40. #define _PADLINE(line) pad ## line
  41. #define _XSTR(line) _PADLINE(line)
  42. #define PAD _XSTR(__LINE__)
  43. #endif /* PAD */
  44. #define BCM_MASK32(msb, lsb) ((~0u >> (32u - (msb) - 1u)) & (~0u << (lsb)))
  45. /**
  46. * In chipcommon rev 49 the pmu registers have been moved from chipc to the pmu core if the
  47. * 'AOBPresent' bit of 'CoreCapabilitiesExt' is set. If this field is set, the traditional chipc to
  48. * [pmu|gci|sreng] register interface is deprecated and removed. These register blocks would instead
  49. * be assigned their respective chipc-specific address space and connected to the Always On
  50. * Backplane via the APB interface.
  51. */
  52. typedef volatile struct {
  53. uint32 PAD[384];
  54. uint32 pmucontrol; /* 0x600 */
  55. uint32 pmucapabilities; /* 0x604 */
  56. uint32 pmustatus; /* 0x608 */
  57. uint32 res_state; /* 0x60C */
  58. uint32 res_pending; /* 0x610 */
  59. uint32 pmutimer; /* 0x614 */
  60. uint32 min_res_mask; /* 0x618 */
  61. uint32 max_res_mask; /* 0x61C */
  62. uint32 res_table_sel; /* 0x620 */
  63. uint32 res_dep_mask;
  64. uint32 res_updn_timer;
  65. uint32 res_timer;
  66. uint32 clkstretch;
  67. uint32 pmuwatchdog;
  68. uint32 gpiosel; /* 0x638, rev >= 1 */
  69. uint32 gpioenable; /* 0x63c, rev >= 1 */
  70. uint32 res_req_timer_sel; /* 0x640 */
  71. uint32 res_req_timer; /* 0x644 */
  72. uint32 res_req_mask; /* 0x648 */
  73. uint32 core_cap_ext; /* 0x64C */
  74. uint32 chipcontrol_addr; /* 0x650 */
  75. uint32 chipcontrol_data; /* 0x654 */
  76. uint32 regcontrol_addr;
  77. uint32 regcontrol_data;
  78. uint32 pllcontrol_addr;
  79. uint32 pllcontrol_data;
  80. uint32 pmustrapopt; /* 0x668, corerev >= 28 */
  81. uint32 pmu_xtalfreq; /* 0x66C, pmurev >= 10 */
  82. uint32 retention_ctl; /* 0x670 */
  83. uint32 ILPPeriod; /* 0x674 */
  84. uint32 PAD[2];
  85. uint32 retention_grpidx; /* 0x680 */
  86. uint32 retention_grpctl; /* 0x684 */
  87. uint32 mac_res_req_timer; /* 0x688 */
  88. uint32 mac_res_req_mask; /* 0x68c */
  89. uint32 PAD[18];
  90. uint32 pmucontrol_ext; /* 0x6d8 */
  91. uint32 slowclkperiod; /* 0x6dc */
  92. uint32 pmu_statstimer_addr; /* 0x6e0 */
  93. uint32 pmu_statstimer_ctrl; /* 0x6e4 */
  94. uint32 pmu_statstimer_N; /* 0x6e8 */
  95. uint32 PAD[1];
  96. uint32 mac_res_req_timer1; /* 0x6f0 */
  97. uint32 mac_res_req_mask1; /* 0x6f4 */
  98. uint32 PAD[2];
  99. uint32 pmuintmask0; /* 0x700 */
  100. uint32 pmuintmask1; /* 0x704 */
  101. uint32 PAD[14];
  102. uint32 pmuintstatus; /* 0x740 */
  103. uint32 extwakeupstatus; /* 0x744 */
  104. uint32 watchdog_res_mask; /* 0x748 */
  105. uint32 PAD[1]; /* 0x74C */
  106. uint32 swscratch; /* 0x750 */
  107. uint32 PAD[3]; /* 0x754-0x75C */
  108. uint32 extwakemask0; /* 0x760 */
  109. uint32 extwakemask1; /* 0x764 */
  110. uint32 PAD[2]; /* 0x768-0x76C */
  111. uint32 extwakereqmask[2]; /* 0x770-0x774 */
  112. uint32 PAD[2]; /* 0x778-0x77C */
  113. uint32 pmuintctrl0; /* 0x780 */
  114. uint32 pmuintctrl1; /* 0x784 */
  115. uint32 PAD[2];
  116. uint32 extwakectrl[2]; /* 0x790 */
  117. uint32 PAD[7];
  118. uint32 fis_ctrl_status; /* 0x7b4 */
  119. uint32 fis_min_res_mask; /* 0x7b8 */
  120. uint32 PAD[1];
  121. uint32 PrecisionTmrCtrlStatus; /* 0x7c0 */
  122. } pmuregs_t;
  123. typedef struct eci_prerev35 {
  124. uint32 eci_output;
  125. uint32 eci_control;
  126. uint32 eci_inputlo;
  127. uint32 eci_inputmi;
  128. uint32 eci_inputhi;
  129. uint32 eci_inputintpolaritylo;
  130. uint32 eci_inputintpolaritymi;
  131. uint32 eci_inputintpolarityhi;
  132. uint32 eci_intmasklo;
  133. uint32 eci_intmaskmi;
  134. uint32 eci_intmaskhi;
  135. uint32 eci_eventlo;
  136. uint32 eci_eventmi;
  137. uint32 eci_eventhi;
  138. uint32 eci_eventmasklo;
  139. uint32 eci_eventmaskmi;
  140. uint32 eci_eventmaskhi;
  141. uint32 PAD[3];
  142. } eci_prerev35_t;
  143. typedef struct eci_rev35 {
  144. uint32 eci_outputlo;
  145. uint32 eci_outputhi;
  146. uint32 eci_controllo;
  147. uint32 eci_controlhi;
  148. uint32 eci_inputlo;
  149. uint32 eci_inputhi;
  150. uint32 eci_inputintpolaritylo;
  151. uint32 eci_inputintpolarityhi;
  152. uint32 eci_intmasklo;
  153. uint32 eci_intmaskhi;
  154. uint32 eci_eventlo;
  155. uint32 eci_eventhi;
  156. uint32 eci_eventmasklo;
  157. uint32 eci_eventmaskhi;
  158. uint32 eci_auxtx;
  159. uint32 eci_auxrx;
  160. uint32 eci_datatag;
  161. uint32 eci_uartescvalue;
  162. uint32 eci_autobaudctr;
  163. uint32 eci_uartfifolevel;
  164. } eci_rev35_t;
  165. typedef struct flash_config {
  166. uint32 PAD[19];
  167. /* Flash struct configuration registers (0x18c) for BCM4706 (corerev = 31) */
  168. uint32 flashstrconfig;
  169. } flash_config_t;
  170. typedef volatile struct {
  171. uint32 chipid; /* 0x0 */
  172. uint32 capabilities;
  173. uint32 corecontrol; /* corerev >= 1 */
  174. uint32 bist;
  175. /* OTP */
  176. uint32 otpstatus; /* 0x10, corerev >= 10 */
  177. uint32 otpcontrol;
  178. uint32 otpprog;
  179. uint32 otplayout; /* corerev >= 23 */
  180. /* Interrupt control */
  181. uint32 intstatus; /* 0x20 */
  182. uint32 intmask;
  183. /* Chip specific regs */
  184. uint32 chipcontrol; /* 0x28, rev >= 11 */
  185. uint32 chipstatus; /* 0x2c, rev >= 11 */
  186. /* Jtag Master */
  187. uint32 jtagcmd; /* 0x30, rev >= 10 */
  188. uint32 jtagir;
  189. uint32 jtagdr;
  190. uint32 jtagctrl;
  191. /* serial flash interface registers */
  192. uint32 flashcontrol; /* 0x40 */
  193. uint32 flashaddress;
  194. uint32 flashdata;
  195. uint32 otplayoutextension; /* rev >= 35 */
  196. /* Silicon backplane configuration broadcast control */
  197. uint32 broadcastaddress; /* 0x50 */
  198. uint32 broadcastdata;
  199. /* gpio - cleared only by power-on-reset */
  200. uint32 gpiopullup; /* 0x58, corerev >= 20 */
  201. uint32 gpiopulldown; /* 0x5c, corerev >= 20 */
  202. uint32 gpioin; /* 0x60 */
  203. uint32 gpioout; /* 0x64 */
  204. uint32 gpioouten; /* 0x68 */
  205. uint32 gpiocontrol; /* 0x6C */
  206. uint32 gpiointpolarity; /* 0x70 */
  207. uint32 gpiointmask; /* 0x74 */
  208. /* GPIO events corerev >= 11 */
  209. uint32 gpioevent;
  210. uint32 gpioeventintmask;
  211. /* Watchdog timer */
  212. uint32 watchdog; /* 0x80 */
  213. /* GPIO events corerev >= 11 */
  214. uint32 gpioeventintpolarity;
  215. /* GPIO based LED powersave registers corerev >= 16 */
  216. uint32 gpiotimerval; /* 0x88 */
  217. uint32 gpiotimeroutmask;
  218. /* clock control */
  219. uint32 clockcontrol_n; /* 0x90 */
  220. uint32 clockcontrol_sb; /* aka m0 */
  221. uint32 clockcontrol_pci; /* aka m1 */
  222. uint32 clockcontrol_m2; /* mii/uart/mipsref */
  223. uint32 clockcontrol_m3; /* cpu */
  224. uint32 clkdiv; /* corerev >= 3 */
  225. uint32 gpiodebugsel; /* corerev >= 28 */
  226. uint32 capabilities_ext; /* 0xac */
  227. /* pll delay registers (corerev >= 4) */
  228. uint32 pll_on_delay; /* 0xb0 */
  229. uint32 fref_sel_delay;
  230. uint32 slow_clk_ctl; /* 5 < corerev < 10 */
  231. uint32 PAD;
  232. /* Instaclock registers (corerev >= 10) */
  233. uint32 system_clk_ctl; /* 0xc0 */
  234. uint32 clkstatestretch;
  235. uint32 PAD[2];
  236. /* Indirect backplane access (corerev >= 22) */
  237. uint32 bp_addrlow; /* 0xd0 */
  238. uint32 bp_addrhigh;
  239. uint32 bp_data;
  240. uint32 PAD;
  241. uint32 bp_indaccess;
  242. /* SPI registers, corerev >= 37 */
  243. uint32 gsioctrl;
  244. uint32 gsioaddress;
  245. uint32 gsiodata;
  246. /* More clock dividers (corerev >= 32) */
  247. uint32 clkdiv2;
  248. /* FAB ID (corerev >= 40) */
  249. uint32 otpcontrol1;
  250. uint32 fabid; /* 0xf8 */
  251. /* In AI chips, pointer to erom */
  252. uint32 eromptr; /* 0xfc */
  253. /* ExtBus control registers (corerev >= 3) */
  254. uint32 pcmcia_config; /* 0x100 */
  255. uint32 pcmcia_memwait;
  256. uint32 pcmcia_attrwait;
  257. uint32 pcmcia_iowait;
  258. uint32 ide_config;
  259. uint32 ide_memwait;
  260. uint32 ide_attrwait;
  261. uint32 ide_iowait;
  262. uint32 prog_config;
  263. uint32 prog_waitcount;
  264. uint32 flash_config;
  265. uint32 flash_waitcount;
  266. uint32 SECI_config; /* 0x130 SECI configuration */
  267. uint32 SECI_status;
  268. uint32 SECI_statusmask;
  269. uint32 SECI_rxnibchanged;
  270. uint32 PAD[20];
  271. /* SROM interface (corerev >= 32) */
  272. uint32 sromcontrol; /* 0x190 */
  273. uint32 sromaddress;
  274. uint32 sromdata;
  275. uint32 PAD[1]; /* 0x19C */
  276. /* NAND flash registers for BCM4706 (corerev = 31) */
  277. uint32 nflashctrl; /* 0x1a0 */
  278. uint32 nflashconf;
  279. uint32 nflashcoladdr;
  280. uint32 nflashrowaddr;
  281. uint32 nflashdata;
  282. uint32 nflashwaitcnt0; /* 0x1b4 */
  283. uint32 PAD[2];
  284. uint32 seci_uart_data; /* 0x1C0 */
  285. uint32 seci_uart_bauddiv;
  286. uint32 seci_uart_fcr;
  287. uint32 seci_uart_lcr;
  288. uint32 seci_uart_mcr;
  289. uint32 seci_uart_lsr;
  290. uint32 seci_uart_msr;
  291. uint32 seci_uart_baudadj;
  292. /* Clock control and hardware workarounds (corerev >= 20) */
  293. uint32 clk_ctl_st; /* 0x1e0 */
  294. uint32 hw_war;
  295. uint32 powerctl; /* 0x1e8 */
  296. uint32 PAD[69];
  297. /* UARTs */
  298. uint8 uart0data; /* 0x300 */
  299. uint8 uart0imr;
  300. uint8 uart0fcr;
  301. uint8 uart0lcr;
  302. uint8 uart0mcr;
  303. uint8 uart0lsr;
  304. uint8 uart0msr;
  305. uint8 uart0scratch;
  306. uint8 PAD[248]; /* corerev >= 1 */
  307. uint8 uart1data; /* 0x400 */
  308. uint8 uart1imr;
  309. uint8 uart1fcr;
  310. uint8 uart1lcr;
  311. uint8 uart1mcr;
  312. uint8 uart1lsr;
  313. uint8 uart1msr;
  314. uint8 uart1scratch; /* 0x407 */
  315. uint32 PAD[50];
  316. uint32 sr_memrw_addr; /* 0x4d0 */
  317. uint32 sr_memrw_data; /* 0x4d4 */
  318. uint32 PAD[10];
  319. /* save/restore, corerev >= 48 */
  320. uint32 sr_capability; /* 0x500 */
  321. uint32 sr_control0; /* 0x504 */
  322. uint32 sr_control1; /* 0x508 */
  323. uint32 gpio_control; /* 0x50C */
  324. uint32 PAD[29];
  325. /* 2 SR engines case */
  326. uint32 sr1_control0; /* 0x584 */
  327. uint32 sr1_control1; /* 0x588 */
  328. uint32 PAD[29];
  329. /* PMU registers (corerev >= 20) */
  330. /* Note: all timers driven by ILP clock are updated asynchronously to HT/ALP.
  331. * The CPU must read them twice, compare, and retry if different.
  332. */
  333. uint32 pmucontrol; /* 0x600 */
  334. uint32 pmucapabilities;
  335. uint32 pmustatus;
  336. uint32 res_state;
  337. uint32 res_pending;
  338. uint32 pmutimer;
  339. uint32 min_res_mask;
  340. uint32 max_res_mask;
  341. uint32 res_table_sel;
  342. uint32 res_dep_mask;
  343. uint32 res_updn_timer;
  344. uint32 res_timer;
  345. uint32 clkstretch;
  346. uint32 pmuwatchdog;
  347. uint32 gpiosel; /* 0x638, rev >= 1 */
  348. uint32 gpioenable; /* 0x63c, rev >= 1 */
  349. uint32 res_req_timer_sel;
  350. uint32 res_req_timer;
  351. uint32 res_req_mask;
  352. uint32 core_cap_ext; /* 0x64c */
  353. uint32 chipcontrol_addr; /* 0x650 */
  354. uint32 chipcontrol_data; /* 0x654 */
  355. uint32 regcontrol_addr;
  356. uint32 regcontrol_data;
  357. uint32 pllcontrol_addr;
  358. uint32 pllcontrol_data;
  359. uint32 pmustrapopt; /* 0x668, corerev >= 28 */
  360. uint32 pmu_xtalfreq; /* 0x66C, pmurev >= 10 */
  361. uint32 retention_ctl; /* 0x670 */
  362. uint32 ILPPeriod; /* 0x674 */
  363. uint32 PAD[2];
  364. uint32 retention_grpidx; /* 0x680 */
  365. uint32 retention_grpctl; /* 0x684 */
  366. uint32 mac_res_req_timer; /* 0x688 */
  367. uint32 mac_res_req_mask; /* 0x68c */
  368. uint32 PAD[18];
  369. uint32 pmucontrol_ext; /* 0x6d8 */
  370. uint32 slowclkperiod; /* 0x6dc */
  371. uint32 pmu_statstimer_addr; /* 0x6e0 */
  372. uint32 pmu_statstimer_ctrl; /* 0x6e4 */
  373. uint32 pmu_statstimer_N; /* 0x6e8 */
  374. uint32 PAD[1];
  375. uint32 mac_res_req_timer1; /* 0x6f0 */
  376. uint32 mac_res_req_mask1; /* 0x6f4 */
  377. uint32 PAD[2];
  378. uint32 pmuintmask0; /* 0x700 */
  379. uint32 pmuintmask1; /* 0x704 */
  380. uint32 PAD[14];
  381. uint32 pmuintstatus; /* 0x740 */
  382. uint32 extwakeupstatus; /* 0x744 */
  383. uint32 PAD[6];
  384. uint32 extwakemask0; /* 0x760 */
  385. uint32 extwakemask1; /* 0x764 */
  386. uint32 PAD[2]; /* 0x768-0x76C */
  387. uint32 extwakereqmask[2]; /* 0x770-0x774 */
  388. uint32 PAD[2]; /* 0x778-0x77C */
  389. uint32 pmuintctrl0; /* 0x780 */
  390. uint32 PAD[3]; /* 0x784 - 0x78c */
  391. uint32 extwakectrl[1]; /* 0x790 */
  392. uint32 PAD[8];
  393. uint32 fis_ctrl_status; /* 0x7b4 */
  394. uint32 fis_min_res_mask; /* 0x7b8 */
  395. uint32 PAD[17];
  396. uint16 sromotp[512]; /* 0x800 */
  397. #ifdef CCNFLASH_SUPPORT
  398. /* Nand flash MLC controller registers (corerev >= 38) */
  399. uint32 nand_revision; /* 0xC00 */
  400. uint32 nand_cmd_start;
  401. uint32 nand_cmd_addr_x;
  402. uint32 nand_cmd_addr;
  403. uint32 nand_cmd_end_addr;
  404. uint32 nand_cs_nand_select;
  405. uint32 nand_cs_nand_xor;
  406. uint32 PAD;
  407. uint32 nand_spare_rd0;
  408. uint32 nand_spare_rd4;
  409. uint32 nand_spare_rd8;
  410. uint32 nand_spare_rd12;
  411. uint32 nand_spare_wr0;
  412. uint32 nand_spare_wr4;
  413. uint32 nand_spare_wr8;
  414. uint32 nand_spare_wr12;
  415. uint32 nand_acc_control;
  416. uint32 PAD;
  417. uint32 nand_config;
  418. uint32 PAD;
  419. uint32 nand_timing_1;
  420. uint32 nand_timing_2;
  421. uint32 nand_semaphore;
  422. uint32 PAD;
  423. uint32 nand_devid;
  424. uint32 nand_devid_x;
  425. uint32 nand_block_lock_status;
  426. uint32 nand_intfc_status;
  427. uint32 nand_ecc_corr_addr_x;
  428. uint32 nand_ecc_corr_addr;
  429. uint32 nand_ecc_unc_addr_x;
  430. uint32 nand_ecc_unc_addr;
  431. uint32 nand_read_error_count;
  432. uint32 nand_corr_stat_threshold;
  433. uint32 PAD[2];
  434. uint32 nand_read_addr_x;
  435. uint32 nand_read_addr;
  436. uint32 nand_page_program_addr_x;
  437. uint32 nand_page_program_addr;
  438. uint32 nand_copy_back_addr_x;
  439. uint32 nand_copy_back_addr;
  440. uint32 nand_block_erase_addr_x;
  441. uint32 nand_block_erase_addr;
  442. uint32 nand_inv_read_addr_x;
  443. uint32 nand_inv_read_addr;
  444. uint32 PAD[2];
  445. uint32 nand_blk_wr_protect;
  446. uint32 PAD[3];
  447. uint32 nand_acc_control_cs1;
  448. uint32 nand_config_cs1;
  449. uint32 nand_timing_1_cs1;
  450. uint32 nand_timing_2_cs1;
  451. uint32 PAD[20];
  452. uint32 nand_spare_rd16;
  453. uint32 nand_spare_rd20;
  454. uint32 nand_spare_rd24;
  455. uint32 nand_spare_rd28;
  456. uint32 nand_cache_addr;
  457. uint32 nand_cache_data;
  458. uint32 nand_ctrl_config;
  459. uint32 nand_ctrl_status;
  460. #endif /* CCNFLASH_SUPPORT */
  461. uint32 gci_corecaps0; /* GCI starting at 0xC00 */
  462. uint32 gci_corecaps1;
  463. uint32 gci_corecaps2;
  464. uint32 gci_corectrl;
  465. uint32 gci_corestat; /* 0xC10 */
  466. uint32 gci_intstat; /* 0xC14 */
  467. uint32 gci_intmask; /* 0xC18 */
  468. uint32 gci_wakemask; /* 0xC1C */
  469. uint32 gci_levelintstat; /* 0xC20 */
  470. uint32 gci_eventintstat; /* 0xC24 */
  471. uint32 PAD[6];
  472. uint32 gci_indirect_addr; /* 0xC40 */
  473. uint32 gci_gpioctl; /* 0xC44 */
  474. uint32 gci_gpiostatus;
  475. uint32 gci_gpiomask; /* 0xC4C */
  476. uint32 gci_eventsummary; /* 0xC50 */
  477. uint32 gci_miscctl; /* 0xC54 */
  478. uint32 gci_gpiointmask;
  479. uint32 gci_gpiowakemask;
  480. uint32 gci_input[32]; /* C60 */
  481. uint32 gci_event[32]; /* CE0 */
  482. uint32 gci_output[4]; /* D60 */
  483. uint32 gci_control_0; /* 0xD70 */
  484. uint32 gci_control_1; /* 0xD74 */
  485. uint32 gci_intpolreg; /* 0xD78 */
  486. uint32 gci_levelintmask; /* 0xD7C */
  487. uint32 gci_eventintmask; /* 0xD80 */
  488. uint32 PAD[3];
  489. uint32 gci_inbandlevelintmask; /* 0xD90 */
  490. uint32 gci_inbandeventintmask; /* 0xD94 */
  491. uint32 PAD[2];
  492. uint32 gci_seciauxtx; /* 0xDA0 */
  493. uint32 gci_seciauxrx; /* 0xDA4 */
  494. uint32 gci_secitx_datatag; /* 0xDA8 */
  495. uint32 gci_secirx_datatag; /* 0xDAC */
  496. uint32 gci_secitx_datamask; /* 0xDB0 */
  497. uint32 gci_seciusef0tx_reg; /* 0xDB4 */
  498. uint32 gci_secif0tx_offset; /* 0xDB8 */
  499. uint32 gci_secif0rx_offset; /* 0xDBC */
  500. uint32 gci_secif1tx_offset; /* 0xDC0 */
  501. uint32 gci_rxfifo_common_ctrl; /* 0xDC4 */
  502. uint32 gci_rxfifoctrl; /* 0xDC8 */
  503. uint32 gci_uartreadid; /* DCC */
  504. uint32 gci_seciuartescval; /* DD0 */
  505. uint32 PAD;
  506. uint32 gci_secififolevel; /* DD8 */
  507. uint32 gci_seciuartdata; /* DDC */
  508. uint32 gci_secibauddiv; /* DE0 */
  509. uint32 gci_secifcr; /* DE4 */
  510. uint32 gci_secilcr; /* DE8 */
  511. uint32 gci_secimcr; /* DEC */
  512. uint32 gci_secilsr; /* DF0 */
  513. uint32 gci_secimsr; /* DF4 */
  514. uint32 gci_baudadj; /* DF8 */
  515. uint32 PAD;
  516. uint32 gci_chipctrl; /* 0xE00 */
  517. uint32 gci_chipsts; /* 0xE04 */
  518. uint32 gci_gpioout; /* 0xE08 */
  519. uint32 gci_gpioout_read; /* 0xE0C */
  520. uint32 gci_mpwaketx; /* 0xE10 */
  521. uint32 gci_mpwakedetect; /* 0xE14 */
  522. uint32 gci_seciin_ctrl; /* 0xE18 */
  523. uint32 gci_seciout_ctrl; /* 0xE1C */
  524. uint32 gci_seciin_auxfifo_en; /* 0xE20 */
  525. uint32 gci_seciout_txen_txbr; /* 0xE24 */
  526. uint32 gci_seciin_rxbrstatus; /* 0xE28 */
  527. uint32 gci_seciin_rxerrstatus; /* 0xE2C */
  528. uint32 gci_seciin_fcstatus; /* 0xE30 */
  529. uint32 gci_seciout_txstatus; /* 0xE34 */
  530. uint32 gci_seciout_txbrstatus; /* 0xE38 */
  531. } chipcregs_t;
  532. #endif /* !_LANGUAGE_ASSEMBLY && !__ASSEMBLY__ */
  533. #define CC_CHIPID 0
  534. #define CC_CAPABILITIES 4
  535. #define CC_CHIPST 0x2c
  536. #define CC_EROMPTR 0xfc
  537. #define CC_OTPST 0x10
  538. #define CC_INTSTATUS 0x20
  539. #define CC_INTMASK 0x24
  540. #define CC_JTAGCMD 0x30
  541. #define CC_JTAGIR 0x34
  542. #define CC_JTAGDR 0x38
  543. #define CC_JTAGCTRL 0x3c
  544. #define CC_GPIOPU 0x58
  545. #define CC_GPIOPD 0x5c
  546. #define CC_GPIOIN 0x60
  547. #define CC_GPIOOUT 0x64
  548. #define CC_GPIOOUTEN 0x68
  549. #define CC_GPIOCTRL 0x6c
  550. #define CC_GPIOPOL 0x70
  551. #define CC_GPIOINTM 0x74
  552. #define CC_GPIOEVENT 0x78
  553. #define CC_GPIOEVENTMASK 0x7c
  554. #define CC_WATCHDOG 0x80
  555. #define CC_GPIOEVENTPOL 0x84
  556. #define CC_CLKC_N 0x90
  557. #define CC_CLKC_M0 0x94
  558. #define CC_CLKC_M1 0x98
  559. #define CC_CLKC_M2 0x9c
  560. #define CC_CLKC_M3 0xa0
  561. #define CC_CLKDIV 0xa4
  562. #define CC_CAP_EXT 0xac
  563. #define CC_SYS_CLK_CTL 0xc0
  564. #define CC_CLKDIV2 0xf0
  565. #define CC_CLK_CTL_ST SI_CLK_CTL_ST
  566. #define PMU_CTL 0x600
  567. #define PMU_CAP 0x604
  568. #define PMU_ST 0x608
  569. #define PMU_RES_STATE 0x60c
  570. #define PMU_RES_PENDING 0x610
  571. #define PMU_TIMER 0x614
  572. #define PMU_MIN_RES_MASK 0x618
  573. #define PMU_MAX_RES_MASK 0x61c
  574. #define CC_CHIPCTL_ADDR 0x650
  575. #define CC_CHIPCTL_DATA 0x654
  576. #define PMU_REG_CONTROL_ADDR 0x658
  577. #define PMU_REG_CONTROL_DATA 0x65C
  578. #define PMU_PLL_CONTROL_ADDR 0x660
  579. #define PMU_PLL_CONTROL_DATA 0x664
  580. #define CC_SROM_CTRL 0x190
  581. #define CC_SROM_ADDRESS 0x194u
  582. #define CC_SROM_DATA 0x198u
  583. #ifdef SROM16K_4364_ADDRSPACE
  584. #define CC_SROM_OTP 0xa000 /* SROM/OTP address space */
  585. #else
  586. #define CC_SROM_OTP 0x0800
  587. #endif // endif
  588. #define CC_GCI_INDIRECT_ADDR_REG 0xC40
  589. #define CC_GCI_CHIP_CTRL_REG 0xE00
  590. #define CC_GCI_CC_OFFSET_2 2
  591. #define CC_GCI_CC_OFFSET_5 5
  592. #define CC_SWD_CTRL 0x380
  593. #define CC_SWD_REQACK 0x384
  594. #define CC_SWD_DATA 0x388
  595. #define GPIO_SEL_0 0x00001111
  596. #define GPIO_SEL_1 0x11110000
  597. #define GPIO_SEL_8 0x00001111
  598. #define GPIO_SEL_9 0x11110000
  599. #define CHIPCTRLREG0 0x0
  600. #define CHIPCTRLREG1 0x1
  601. #define CHIPCTRLREG2 0x2
  602. #define CHIPCTRLREG3 0x3
  603. #define CHIPCTRLREG4 0x4
  604. #define CHIPCTRLREG5 0x5
  605. #define CHIPCTRLREG6 0x6
  606. #define REGCTRLREG4 0x4
  607. #define REGCTRLREG5 0x5
  608. #define REGCTRLREG6 0x6
  609. #define MINRESMASKREG 0x618
  610. #define MAXRESMASKREG 0x61c
  611. #define CHIPCTRLADDR 0x650
  612. #define CHIPCTRLDATA 0x654
  613. #define RSRCTABLEADDR 0x620
  614. #define PMU_RES_DEP_MASK 0x624
  615. #define RSRCUPDWNTIME 0x628
  616. #define PMUREG_RESREQ_MASK 0x68c
  617. #define PMUREG_RESREQ_TIMER 0x688
  618. #define PMUREG_RESREQ_MASK1 0x6f4
  619. #define PMUREG_RESREQ_TIMER1 0x6f0
  620. #define EXT_LPO_AVAIL 0x100
  621. #define LPO_SEL (1 << 0)
  622. #define CC_EXT_LPO_PU 0x200000
  623. #define GC_EXT_LPO_PU 0x2
  624. #define CC_INT_LPO_PU 0x100000
  625. #define GC_INT_LPO_PU 0x1
  626. #define EXT_LPO_SEL 0x8
  627. #define INT_LPO_SEL 0x4
  628. #define ENABLE_FINE_CBUCK_CTRL (1 << 30)
  629. #define REGCTRL5_PWM_AUTO_CTRL_MASK 0x007e0000
  630. #define REGCTRL5_PWM_AUTO_CTRL_SHIFT 17
  631. #define REGCTRL6_PWM_AUTO_CTRL_MASK 0x3fff0000
  632. #define REGCTRL6_PWM_AUTO_CTRL_SHIFT 16
  633. #define CC_BP_IND_ACCESS_START_SHIFT 9
  634. #define CC_BP_IND_ACCESS_START_MASK (1 << CC_BP_IND_ACCESS_START_SHIFT)
  635. #define CC_BP_IND_ACCESS_RDWR_SHIFT 8
  636. #define CC_BP_IND_ACCESS_RDWR_MASK (1 << CC_BP_IND_ACCESS_RDWR_SHIFT)
  637. #define CC_BP_IND_ACCESS_ERROR_SHIFT 10
  638. #define CC_BP_IND_ACCESS_ERROR_MASK (1 << CC_BP_IND_ACCESS_ERROR_SHIFT)
  639. #define LPO_SEL_TIMEOUT 1000
  640. #define LPO_FINAL_SEL_SHIFT 18
  641. #define LHL_LPO1_SEL 0
  642. #define LHL_LPO2_SEL 0x1
  643. #define LHL_32k_SEL 0x2
  644. #define LHL_EXT_SEL 0x3
  645. #define EXTLPO_BUF_PD 0x40
  646. #define LPO1_PD_EN 0x1
  647. #define LPO1_PD_SEL 0x6
  648. #define LPO1_PD_SEL_VAL 0x4
  649. #define LPO2_PD_EN 0x8
  650. #define LPO2_PD_SEL 0x30
  651. #define LPO2_PD_SEL_VAL 0x20
  652. #define OSC_32k_PD 0x80
  653. #define LHL_CLK_DET_CTL_AD_CNTR_CLK_SEL 0x3
  654. #define LHL_LPO_AUTO 0x0
  655. #define LHL_LPO1_ENAB 0x1
  656. #define LHL_LPO2_ENAB 0x2
  657. #define LHL_OSC_32k_ENAB 0x3
  658. #define LHL_EXT_LPO_ENAB 0x4
  659. #define RADIO_LPO_ENAB 0x5
  660. #define LHL_CLK_DET_CTL_ADR_LHL_CNTR_EN 0x4
  661. #define LHL_CLK_DET_CTL_ADR_LHL_CNTR_CLR 0x8
  662. #define LHL_CLK_DET_CNT 0xF0
  663. #define LHL_CLK_DET_CNT_SHIFT 4
  664. #define LPO_SEL_SHIFT 9
  665. #define LHL_MAIN_CTL_ADR_FINAL_CLK_SEL 0x3C0000
  666. #define LHL_MAIN_CTL_ADR_LHL_WLCLK_SEL 0x600
  667. #define CLK_DET_CNT_THRESH 8
  668. #ifdef SR_DEBUG
  669. #define SUBCORE_POWER_ON 0x0001
  670. #define PHY_POWER_ON 0x0010
  671. #define VDDM_POWER_ON 0x0100
  672. #define MEMLPLDO_POWER_ON 0x1000
  673. #define SUBCORE_POWER_ON_CHK 0x00040000
  674. #define PHY_POWER_ON_CHK 0x00080000
  675. #define VDDM_POWER_ON_CHK 0x00100000
  676. #define MEMLPLDO_POWER_ON_CHK 0x00200000
  677. #endif /* SR_DEBUG */
  678. #ifdef CCNFLASH_SUPPORT
  679. /* NAND flash support */
  680. #define CC_NAND_REVISION 0xC00
  681. #define CC_NAND_CMD_START 0xC04
  682. #define CC_NAND_CMD_ADDR 0xC0C
  683. #define CC_NAND_SPARE_RD_0 0xC20
  684. #define CC_NAND_SPARE_RD_4 0xC24
  685. #define CC_NAND_SPARE_RD_8 0xC28
  686. #define CC_NAND_SPARE_RD_C 0xC2C
  687. #define CC_NAND_CONFIG 0xC48
  688. #define CC_NAND_DEVID 0xC60
  689. #define CC_NAND_DEVID_EXT 0xC64
  690. #define CC_NAND_INTFC_STATUS 0xC6C
  691. #endif /* CCNFLASH_SUPPORT */
  692. /* chipid */
  693. #define CID_ID_MASK 0x0000ffff /**< Chip Id mask */
  694. #define CID_REV_MASK 0x000f0000 /**< Chip Revision mask */
  695. #define CID_REV_SHIFT 16 /**< Chip Revision shift */
  696. #define CID_PKG_MASK 0x00f00000 /**< Package Option mask */
  697. #define CID_PKG_SHIFT 20 /**< Package Option shift */
  698. #define CID_CC_MASK 0x0f000000 /**< CoreCount (corerev >= 4) */
  699. #define CID_CC_SHIFT 24
  700. #define CID_TYPE_MASK 0xf0000000 /**< Chip Type */
  701. #define CID_TYPE_SHIFT 28
  702. /* capabilities */
  703. #define CC_CAP_UARTS_MASK 0x00000003 /**< Number of UARTs */
  704. #define CC_CAP_MIPSEB 0x00000004 /**< MIPS is in big-endian mode */
  705. #define CC_CAP_UCLKSEL 0x00000018 /**< UARTs clock select */
  706. #define CC_CAP_UINTCLK 0x00000008 /**< UARTs are driven by internal divided clock */
  707. #define CC_CAP_UARTGPIO 0x00000020 /**< UARTs own GPIOs 15:12 */
  708. #define CC_CAP_EXTBUS_MASK 0x000000c0 /**< External bus mask */
  709. #define CC_CAP_EXTBUS_NONE 0x00000000 /**< No ExtBus present */
  710. #define CC_CAP_EXTBUS_FULL 0x00000040 /**< ExtBus: PCMCIA, IDE & Prog */
  711. #define CC_CAP_EXTBUS_PROG 0x00000080 /**< ExtBus: ProgIf only */
  712. #define CC_CAP_FLASH_MASK 0x00000700 /**< Type of flash */
  713. #define CC_CAP_PLL_MASK 0x00038000 /**< Type of PLL */
  714. #define CC_CAP_PWR_CTL 0x00040000 /**< Power control */
  715. #define CC_CAP_OTPSIZE 0x00380000 /**< OTP Size (0 = none) */
  716. #define CC_CAP_OTPSIZE_SHIFT 19 /**< OTP Size shift */
  717. #define CC_CAP_OTPSIZE_BASE 5 /**< OTP Size base */
  718. #define CC_CAP_JTAGP 0x00400000 /**< JTAG Master Present */
  719. #define CC_CAP_ROM 0x00800000 /**< Internal boot rom active */
  720. #define CC_CAP_BKPLN64 0x08000000 /**< 64-bit backplane */
  721. #define CC_CAP_PMU 0x10000000 /**< PMU Present, rev >= 20 */
  722. #define CC_CAP_ECI 0x20000000 /**< ECI Present, rev >= 21 */
  723. #define CC_CAP_SROM 0x40000000 /**< Srom Present, rev >= 32 */
  724. #define CC_CAP_NFLASH 0x80000000 /**< Nand flash present, rev >= 35 */
  725. #define CC_CAP2_SECI 0x00000001 /**< SECI Present, rev >= 36 */
  726. #define CC_CAP2_GSIO 0x00000002 /**< GSIO (spi/i2c) present, rev >= 37 */
  727. /* capabilities extension */
  728. #define CC_CAP_EXT_SECI_PRESENT 0x00000001 /**< SECI present */
  729. #define CC_CAP_EXT_GSIO_PRESENT 0x00000002 /**< GSIO present */
  730. #define CC_CAP_EXT_GCI_PRESENT 0x00000004 /**< GCI present */
  731. #define CC_CAP_EXT_SECI_PUART_PRESENT 0x00000008 /**< UART present */
  732. #define CC_CAP_EXT_AOB_PRESENT 0x00000040 /**< AOB present */
  733. #define CC_CAP_EXT_SWD_PRESENT 0x00000400 /**< SWD present */
  734. /* WL Channel Info to BT via GCI - bits 40 - 47 */
  735. #define GCI_WL_CHN_INFO_MASK (0xFF00)
  736. /* WL indication of MCHAN enabled/disabled to BT in awdl mode- bit 36 */
  737. #define GCI_WL_MCHAN_BIT_MASK (0x0010)
  738. #ifdef WLC_SW_DIVERSITY
  739. /* WL indication of SWDIV enabled/disabled to BT - bit 33 */
  740. #define GCI_WL_SWDIV_ANT_VALID_BIT_MASK (0x0002)
  741. #define GCI_SWDIV_ANT_VALID_SHIFT 0x1
  742. #define GCI_SWDIV_ANT_VALID_DISABLE 0x0
  743. #endif // endif
  744. /* WL Strobe to BT */
  745. #define GCI_WL_STROBE_BIT_MASK (0x0020)
  746. /* bits [51:48] - reserved for wlan TX pwr index */
  747. /* bits [55:52] btc mode indication */
  748. #define GCI_WL_BTC_MODE_SHIFT (20)
  749. #define GCI_WL_BTC_MODE_MASK (0xF << GCI_WL_BTC_MODE_SHIFT)
  750. #define GCI_WL_ANT_BIT_MASK (0x00c0)
  751. #define GCI_WL_ANT_SHIFT_BITS (6)
  752. /* PLL type */
  753. #define PLL_NONE 0x00000000
  754. #define PLL_TYPE1 0x00010000 /**< 48MHz base, 3 dividers */
  755. #define PLL_TYPE2 0x00020000 /**< 48MHz, 4 dividers */
  756. #define PLL_TYPE3 0x00030000 /**< 25MHz, 2 dividers */
  757. #define PLL_TYPE4 0x00008000 /**< 48MHz, 4 dividers */
  758. #define PLL_TYPE5 0x00018000 /**< 25MHz, 4 dividers */
  759. #define PLL_TYPE6 0x00028000 /**< 100/200 or 120/240 only */
  760. #define PLL_TYPE7 0x00038000 /**< 25MHz, 4 dividers */
  761. /* ILP clock */
  762. #define ILP_CLOCK 32000
  763. /* ALP clock on pre-PMU chips */
  764. #define ALP_CLOCK 20000000
  765. #ifdef CFG_SIM
  766. #define NS_ALP_CLOCK 84922
  767. #define NS_SLOW_ALP_CLOCK 84922
  768. #define NS_CPU_CLOCK 534500
  769. #define NS_SLOW_CPU_CLOCK 534500
  770. #define NS_SI_CLOCK 271750
  771. #define NS_SLOW_SI_CLOCK 271750
  772. #define NS_FAST_MEM_CLOCK 271750
  773. #define NS_MEM_CLOCK 271750
  774. #define NS_SLOW_MEM_CLOCK 271750
  775. #else
  776. #define NS_ALP_CLOCK 125000000
  777. #define NS_SLOW_ALP_CLOCK 100000000
  778. #define NS_CPU_CLOCK 1000000000
  779. #define NS_SLOW_CPU_CLOCK 800000000
  780. #define NS_SI_CLOCK 250000000
  781. #define NS_SLOW_SI_CLOCK 200000000
  782. #define NS_FAST_MEM_CLOCK 800000000
  783. #define NS_MEM_CLOCK 533000000
  784. #define NS_SLOW_MEM_CLOCK 400000000
  785. #endif /* CFG_SIM */
  786. #define ALP_CLOCK_53573 40000000
  787. /* HT clock */
  788. #define HT_CLOCK 80000000
  789. /* corecontrol */
  790. #define CC_UARTCLKO 0x00000001 /**< Drive UART with internal clock */
  791. #define CC_SE 0x00000002 /**< sync clk out enable (corerev >= 3) */
  792. #define CC_ASYNCGPIO 0x00000004 /**< 1=generate GPIO interrupt without backplane clock */
  793. #define CC_UARTCLKEN 0x00000008 /**< enable UART Clock (corerev > = 21 */
  794. /* retention_ctl */
  795. #define RCTL_MEM_RET_SLEEP_LOG_SHIFT 29
  796. #define RCTL_MEM_RET_SLEEP_LOG_MASK (1 << RCTL_MEM_RET_SLEEP_LOG_SHIFT)
  797. /* 4321 chipcontrol */
  798. #define CHIPCTRL_4321_PLL_DOWN 0x800000 /**< serdes PLL down override */
  799. /* Fields in the otpstatus register in rev >= 21 */
  800. #define OTPS_OL_MASK 0x000000ff
  801. #define OTPS_OL_MFG 0x00000001 /**< manuf row is locked */
  802. #define OTPS_OL_OR1 0x00000002 /**< otp redundancy row 1 is locked */
  803. #define OTPS_OL_OR2 0x00000004 /**< otp redundancy row 2 is locked */
  804. #define OTPS_OL_GU 0x00000008 /**< general use region is locked */
  805. #define OTPS_GUP_MASK 0x00000f00
  806. #define OTPS_GUP_SHIFT 8
  807. #define OTPS_GUP_HW 0x00000100 /**< h/w subregion is programmed */
  808. #define OTPS_GUP_SW 0x00000200 /**< s/w subregion is programmed */
  809. #define OTPS_GUP_CI 0x00000400 /**< chipid/pkgopt subregion is programmed */
  810. #define OTPS_GUP_FUSE 0x00000800 /**< fuse subregion is programmed */
  811. #define OTPS_READY 0x00001000
  812. #define OTPS_RV(x) (1 << (16 + (x))) /**< redundancy entry valid */
  813. #define OTPS_RV_MASK 0x0fff0000
  814. #define OTPS_PROGOK 0x40000000
  815. /* Fields in the otpcontrol register in rev >= 21 */
  816. #define OTPC_PROGSEL 0x00000001
  817. #define OTPC_PCOUNT_MASK 0x0000000e
  818. #define OTPC_PCOUNT_SHIFT 1
  819. #define OTPC_VSEL_MASK 0x000000f0
  820. #define OTPC_VSEL_SHIFT 4
  821. #define OTPC_TMM_MASK 0x00000700
  822. #define OTPC_TMM_SHIFT 8
  823. #define OTPC_ODM 0x00000800
  824. #define OTPC_PROGEN 0x80000000
  825. /* Fields in the 40nm otpcontrol register in rev >= 40 */
  826. #define OTPC_40NM_PROGSEL_SHIFT 0
  827. #define OTPC_40NM_PCOUNT_SHIFT 1
  828. #define OTPC_40NM_PCOUNT_WR 0xA
  829. #define OTPC_40NM_PCOUNT_V1X 0xB
  830. #define OTPC_40NM_REGCSEL_SHIFT 5
  831. #define OTPC_40NM_REGCSEL_DEF 0x4
  832. #define OTPC_40NM_PROGIN_SHIFT 8
  833. #define OTPC_40NM_R2X_SHIFT 10
  834. #define OTPC_40NM_ODM_SHIFT 11
  835. #define OTPC_40NM_DF_SHIFT 15
  836. #define OTPC_40NM_VSEL_SHIFT 16
  837. #define OTPC_40NM_VSEL_WR 0xA
  838. #define OTPC_40NM_VSEL_V1X 0xA
  839. #define OTPC_40NM_VSEL_R1X 0x5
  840. #define OTPC_40NM_COFAIL_SHIFT 30
  841. #define OTPC1_CPCSEL_SHIFT 0
  842. #define OTPC1_CPCSEL_DEF 6
  843. #define OTPC1_TM_SHIFT 8
  844. #define OTPC1_TM_WR 0x84
  845. #define OTPC1_TM_V1X 0x84
  846. #define OTPC1_TM_R1X 0x4
  847. #define OTPC1_CLK_EN_MASK 0x00020000
  848. #define OTPC1_CLK_DIV_MASK 0x00FC0000
  849. /* Fields in otpprog in rev >= 21 and HND OTP */
  850. #define OTPP_COL_MASK 0x000000ff
  851. #define OTPP_COL_SHIFT 0
  852. #define OTPP_ROW_MASK 0x0000ff00
  853. #define OTPP_ROW_MASK9 0x0001ff00 /* for ccrev >= 49 */
  854. #define OTPP_ROW_SHIFT 8
  855. #define OTPP_OC_MASK 0x0f000000
  856. #define OTPP_OC_SHIFT 24
  857. #define OTPP_READERR 0x10000000
  858. #define OTPP_VALUE_MASK 0x20000000
  859. #define OTPP_VALUE_SHIFT 29
  860. #define OTPP_START_BUSY 0x80000000
  861. #define OTPP_READ 0x40000000 /* HND OTP */
  862. /* Fields in otplayout register */
  863. #define OTPL_HWRGN_OFF_MASK 0x00000FFF
  864. #define OTPL_HWRGN_OFF_SHIFT 0
  865. #define OTPL_WRAP_REVID_MASK 0x00F80000
  866. #define OTPL_WRAP_REVID_SHIFT 19
  867. #define OTPL_WRAP_TYPE_MASK 0x00070000
  868. #define OTPL_WRAP_TYPE_SHIFT 16
  869. #define OTPL_WRAP_TYPE_65NM 0
  870. #define OTPL_WRAP_TYPE_40NM 1
  871. #define OTPL_WRAP_TYPE_28NM 2
  872. #define OTPL_ROW_SIZE_MASK 0x0000F000
  873. #define OTPL_ROW_SIZE_SHIFT 12
  874. /* otplayout reg corerev >= 36 */
  875. #define OTP_CISFORMAT_NEW 0x80000000
  876. /* Opcodes for OTPP_OC field */
  877. #define OTPPOC_READ 0
  878. #define OTPPOC_BIT_PROG 1
  879. #define OTPPOC_VERIFY 3
  880. #define OTPPOC_INIT 4
  881. #define OTPPOC_SET 5
  882. #define OTPPOC_RESET 6
  883. #define OTPPOC_OCST 7
  884. #define OTPPOC_ROW_LOCK 8
  885. #define OTPPOC_PRESCN_TEST 9
  886. /* Opcodes for OTPP_OC field (40NM) */
  887. #define OTPPOC_READ_40NM 0
  888. #define OTPPOC_PROG_ENABLE_40NM 1
  889. #define OTPPOC_PROG_DISABLE_40NM 2
  890. #define OTPPOC_VERIFY_40NM 3
  891. #define OTPPOC_WORD_VERIFY_1_40NM 4
  892. #define OTPPOC_ROW_LOCK_40NM 5
  893. #define OTPPOC_STBY_40NM 6
  894. #define OTPPOC_WAKEUP_40NM 7
  895. #define OTPPOC_WORD_VERIFY_0_40NM 8
  896. #define OTPPOC_PRESCN_TEST_40NM 9
  897. #define OTPPOC_BIT_PROG_40NM 10
  898. #define OTPPOC_WORDPROG_40NM 11
  899. #define OTPPOC_BURNIN_40NM 12
  900. #define OTPPOC_AUTORELOAD_40NM 13
  901. #define OTPPOC_OVST_READ_40NM 14
  902. #define OTPPOC_OVST_PROG_40NM 15
  903. /* Opcodes for OTPP_OC field (28NM) */
  904. #define OTPPOC_READ_28NM 0
  905. #define OTPPOC_READBURST_28NM 1
  906. #define OTPPOC_PROG_ENABLE_28NM 2
  907. #define OTPPOC_PROG_DISABLE_28NM 3
  908. #define OTPPOC_PRESCREEN_28NM 4
  909. #define OTPPOC_PRESCREEN_RP_28NM 5
  910. #define OTPPOC_FLUSH_28NM 6
  911. #define OTPPOC_NOP_28NM 7
  912. #define OTPPOC_PROG_ECC_28NM 8
  913. #define OTPPOC_PROG_ECC_READ_28NM 9
  914. #define OTPPOC_PROG_28NM 10
  915. #define OTPPOC_PROGRAM_RP_28NM 11
  916. #define OTPPOC_PROGRAM_OVST_28NM 12
  917. #define OTPPOC_RELOAD_28NM 13
  918. #define OTPPOC_ERASE_28NM 14
  919. #define OTPPOC_LOAD_RF_28NM 15
  920. #define OTPPOC_CTRL_WR_28NM 16
  921. #define OTPPOC_CTRL_RD_28NM 17
  922. #define OTPPOC_READ_HP_28NM 18
  923. #define OTPPOC_READ_OVST_28NM 19
  924. #define OTPPOC_READ_VERIFY0_28NM 20
  925. #define OTPPOC_READ_VERIFY1_28NM 21
  926. #define OTPPOC_READ_FORCE0_28NM 22
  927. #define OTPPOC_READ_FORCE1_28NM 23
  928. #define OTPPOC_BURNIN_28NM 24
  929. #define OTPPOC_PROGRAM_LOCK_28NM 25
  930. #define OTPPOC_PROGRAM_TESTCOL_28NM 26
  931. #define OTPPOC_READ_TESTCOL_28NM 27
  932. #define OTPPOC_READ_FOUT_28NM 28
  933. #define OTPPOC_SFT_RESET_28NM 29
  934. #define OTPP_OC_MASK_28NM 0x0f800000
  935. #define OTPP_OC_SHIFT_28NM 23
  936. #define OTPC_PROGEN_28NM 0x8
  937. #define OTPC_DBLERRCLR 0x20
  938. #define OTPC_CLK_EN_MASK 0x00000040
  939. #define OTPC_CLK_DIV_MASK 0x00000F80
  940. /* Fields in otplayoutextension */
  941. #define OTPLAYOUTEXT_FUSE_MASK 0x3FF
  942. /* Jtagm characteristics that appeared at a given corerev */
  943. #define JTAGM_CREV_OLD 10 /**< Old command set, 16bit max IR */
  944. #define JTAGM_CREV_IRP 22 /**< Able to do pause-ir */
  945. #define JTAGM_CREV_RTI 28 /**< Able to do return-to-idle */
  946. /* jtagcmd */
  947. #define JCMD_START 0x80000000
  948. #define JCMD_BUSY 0x80000000
  949. #define JCMD_STATE_MASK 0x60000000
  950. #define JCMD_STATE_TLR 0x00000000 /**< Test-logic-reset */
  951. #define JCMD_STATE_PIR 0x20000000 /**< Pause IR */
  952. #define JCMD_STATE_PDR 0x40000000 /**< Pause DR */
  953. #define JCMD_STATE_RTI 0x60000000 /**< Run-test-idle */
  954. #define JCMD0_ACC_MASK 0x0000f000
  955. #define JCMD0_ACC_IRDR 0x00000000
  956. #define JCMD0_ACC_DR 0x00001000
  957. #define JCMD0_ACC_IR 0x00002000
  958. #define JCMD0_ACC_RESET 0x00003000
  959. #define JCMD0_ACC_IRPDR 0x00004000
  960. #define JCMD0_ACC_PDR 0x00005000
  961. #define JCMD0_IRW_MASK 0x00000f00
  962. #define JCMD_ACC_MASK 0x000f0000 /**< Changes for corerev 11 */
  963. #define JCMD_ACC_IRDR 0x00000000
  964. #define JCMD_ACC_DR 0x00010000
  965. #define JCMD_ACC_IR 0x00020000
  966. #define JCMD_ACC_RESET 0x00030000
  967. #define JCMD_ACC_IRPDR 0x00040000
  968. #define JCMD_ACC_PDR 0x00050000
  969. #define JCMD_ACC_PIR 0x00060000
  970. #define JCMD_ACC_IRDR_I 0x00070000 /**< rev 28: return to run-test-idle */
  971. #define JCMD_ACC_DR_I 0x00080000 /**< rev 28: return to run-test-idle */
  972. #define JCMD_IRW_MASK 0x00001f00
  973. #define JCMD_IRW_SHIFT 8
  974. #define JCMD_DRW_MASK 0x0000003f
  975. /* jtagctrl */
  976. #define JCTRL_FORCE_CLK 4 /**< Force clock */
  977. #define JCTRL_EXT_EN 2 /**< Enable external targets */
  978. #define JCTRL_EN 1 /**< Enable Jtag master */
  979. #define JCTRL_TAPSEL_BIT 0x00000008 /**< JtagMasterCtrl tap_sel bit */
  980. /* swdmasterctrl */
  981. #define SWDCTRL_INT_EN 8 /**< Enable internal targets */
  982. #define SWDCTRL_FORCE_CLK 4 /**< Force clock */
  983. #define SWDCTRL_OVJTAG 2 /**< Enable shared SWD/JTAG pins */
  984. #define SWDCTRL_EN 1 /**< Enable Jtag master */
  985. /* Fields in clkdiv */
  986. #define CLKD_SFLASH 0x1f000000
  987. #define CLKD_SFLASH_SHIFT 24
  988. #define CLKD_OTP 0x000f0000
  989. #define CLKD_OTP_SHIFT 16
  990. #define CLKD_JTAG 0x00000f00
  991. #define CLKD_JTAG_SHIFT 8
  992. #define CLKD_UART 0x000000ff
  993. #define CLKD2_SROM 0x00000007
  994. #define CLKD2_SROMDIV_32 0
  995. #define CLKD2_SROMDIV_64 1
  996. #define CLKD2_SROMDIV_96 2
  997. #define CLKD2_SROMDIV_128 3
  998. #define CLKD2_SROMDIV_192 4
  999. #define CLKD2_SROMDIV_256 5
  1000. #define CLKD2_SROMDIV_384 6
  1001. #define CLKD2_SROMDIV_512 7
  1002. #define CLKD2_SWD 0xf8000000
  1003. #define CLKD2_SWD_SHIFT 27
  1004. /* intstatus/intmask */
  1005. #define CI_GPIO 0x00000001 /**< gpio intr */
  1006. #define CI_EI 0x00000002 /**< extif intr (corerev >= 3) */
  1007. #define CI_TEMP 0x00000004 /**< temp. ctrl intr (corerev >= 15) */
  1008. #define CI_SIRQ 0x00000008 /**< serial IRQ intr (corerev >= 15) */
  1009. #define CI_ECI 0x00000010 /**< eci intr (corerev >= 21) */
  1010. #define CI_PMU 0x00000020 /**< pmu intr (corerev >= 21) */
  1011. #define CI_UART 0x00000040 /**< uart intr (corerev >= 21) */
  1012. #define CI_WECI 0x00000080 /* eci wakeup intr (corerev >= 21) */
  1013. #define CI_WDRESET 0x80000000 /**< watchdog reset occurred */
  1014. /* slow_clk_ctl */
  1015. #define SCC_SS_MASK 0x00000007 /**< slow clock source mask */
  1016. #define SCC_SS_LPO 0x00000000 /**< source of slow clock is LPO */
  1017. #define SCC_SS_XTAL 0x00000001 /**< source of slow clock is crystal */
  1018. #define SCC_SS_PCI 0x00000002 /**< source of slow clock is PCI */
  1019. #define SCC_LF 0x00000200 /**< LPOFreqSel, 1: 160Khz, 0: 32KHz */
  1020. #define SCC_LP 0x00000400 /**< LPOPowerDown, 1: LPO is disabled,
  1021. * 0: LPO is enabled
  1022. */
  1023. #define SCC_FS 0x00000800 /**< ForceSlowClk, 1: sb/cores running on slow clock,
  1024. * 0: power logic control
  1025. */
  1026. #define SCC_IP 0x00001000 /**< IgnorePllOffReq, 1/0: power logic ignores/honors
  1027. * PLL clock disable requests from core
  1028. */
  1029. #define SCC_XC 0x00002000 /**< XtalControlEn, 1/0: power logic does/doesn't
  1030. * disable crystal when appropriate
  1031. */
  1032. #define SCC_XP 0x00004000 /**< XtalPU (RO), 1/0: crystal running/disabled */
  1033. #define SCC_CD_MASK 0xffff0000 /**< ClockDivider (SlowClk = 1/(4+divisor)) */
  1034. #define SCC_CD_SHIFT 16
  1035. /* system_clk_ctl */
  1036. #define SYCC_IE 0x00000001 /**< ILPen: Enable Idle Low Power */
  1037. #define SYCC_AE 0x00000002 /**< ALPen: Enable Active Low Power */
  1038. #define SYCC_FP 0x00000004 /**< ForcePLLOn */
  1039. #define SYCC_AR 0x00000008 /**< Force ALP (or HT if ALPen is not set */
  1040. #define SYCC_HR 0x00000010 /**< Force HT */
  1041. #define SYCC_CD_MASK 0xffff0000 /**< ClkDiv (ILP = 1/(4 * (divisor + 1)) */
  1042. #define SYCC_CD_SHIFT 16
  1043. /* watchdogcounter */
  1044. /* WL sub-system reset */
  1045. #define WD_SSRESET_PCIE_F0_EN 0x10000000
  1046. /* BT sub-system reset */
  1047. #define WD_SSRESET_PCIE_F1_EN 0x20000000
  1048. #define WD_SSRESET_PCIE_F2_EN 0x40000000
  1049. /* Both WL and BT sub-system reset */
  1050. #define WD_SSRESET_PCIE_ALL_FN_EN 0x80000000
  1051. #define WD_COUNTER_MASK 0x0fffffff
  1052. #define WD_ENABLE_MASK \
  1053. (WD_SSRESET_PCIE_F0_EN | WD_SSRESET_PCIE_F1_EN | \
  1054. WD_SSRESET_PCIE_F2_EN | WD_SSRESET_PCIE_ALL_FN_EN)
  1055. /* Indirect backplane access */
  1056. #define BPIA_BYTEEN 0x0000000f
  1057. #define BPIA_SZ1 0x00000001
  1058. #define BPIA_SZ2 0x00000003
  1059. #define BPIA_SZ4 0x00000007
  1060. #define BPIA_SZ8 0x0000000f
  1061. #define BPIA_WRITE 0x00000100
  1062. #define BPIA_START 0x00000200
  1063. #define BPIA_BUSY 0x00000200
  1064. #define BPIA_ERROR 0x00000400
  1065. /* pcmcia/prog/flash_config */
  1066. #define CF_EN 0x00000001 /**< enable */
  1067. #define CF_EM_MASK 0x0000000e /**< mode */
  1068. #define CF_EM_SHIFT 1
  1069. #define CF_EM_FLASH 0 /**< flash/asynchronous mode */
  1070. #define CF_EM_SYNC 2 /**< synchronous mode */
  1071. #define CF_EM_PCMCIA 4 /**< pcmcia mode */
  1072. #define CF_DS 0x00000010 /**< destsize: 0=8bit, 1=16bit */
  1073. #define CF_BS 0x00000020 /**< byteswap */
  1074. #define CF_CD_MASK 0x000000c0 /**< clock divider */
  1075. #define CF_CD_SHIFT 6
  1076. #define CF_CD_DIV2 0x00000000 /**< backplane/2 */
  1077. #define CF_CD_DIV3 0x00000040 /**< backplane/3 */
  1078. #define CF_CD_DIV4 0x00000080 /**< backplane/4 */
  1079. #define CF_CE 0x00000100 /**< clock enable */
  1080. #define CF_SB 0x00000200 /**< size/bytestrobe (synch only) */
  1081. /* pcmcia_memwait */
  1082. #define PM_W0_MASK 0x0000003f /**< waitcount0 */
  1083. #define PM_W1_MASK 0x00001f00 /**< waitcount1 */
  1084. #define PM_W1_SHIFT 8
  1085. #define PM_W2_MASK 0x001f0000 /**< waitcount2 */
  1086. #define PM_W2_SHIFT 16
  1087. #define PM_W3_MASK 0x1f000000 /**< waitcount3 */
  1088. #define PM_W3_SHIFT 24
  1089. /* pcmcia_attrwait */
  1090. #define PA_W0_MASK 0x0000003f /**< waitcount0 */
  1091. #define PA_W1_MASK 0x00001f00 /**< waitcount1 */
  1092. #define PA_W1_SHIFT 8
  1093. #define PA_W2_MASK 0x001f0000 /**< waitcount2 */
  1094. #define PA_W2_SHIFT 16
  1095. #define PA_W3_MASK 0x1f000000 /**< waitcount3 */
  1096. #define PA_W3_SHIFT 24
  1097. /* pcmcia_iowait */
  1098. #define PI_W0_MASK 0x0000003f /**< waitcount0 */
  1099. #define PI_W1_MASK 0x00001f00 /**< waitcount1 */
  1100. #define PI_W1_SHIFT 8
  1101. #define PI_W2_MASK 0x001f0000 /**< waitcount2 */
  1102. #define PI_W2_SHIFT 16
  1103. #define PI_W3_MASK 0x1f000000 /**< waitcount3 */
  1104. #define PI_W3_SHIFT 24
  1105. /* prog_waitcount */
  1106. #define PW_W0_MASK 0x0000001f /**< waitcount0 */
  1107. #define PW_W1_MASK 0x00001f00 /**< waitcount1 */
  1108. #define PW_W1_SHIFT 8
  1109. #define PW_W2_MASK 0x001f0000 /**< waitcount2 */
  1110. #define PW_W2_SHIFT 16
  1111. #define PW_W3_MASK 0x1f000000 /**< waitcount3 */
  1112. #define PW_W3_SHIFT 24
  1113. #define PW_W0 0x0000000c
  1114. #define PW_W1 0x00000a00
  1115. #define PW_W2 0x00020000
  1116. #define PW_W3 0x01000000
  1117. /* flash_waitcount */
  1118. #define FW_W0_MASK 0x0000003f /**< waitcount0 */
  1119. #define FW_W1_MASK 0x00001f00 /**< waitcount1 */
  1120. #define FW_W1_SHIFT 8
  1121. #define FW_W2_MASK 0x001f0000 /**< waitcount2 */
  1122. #define FW_W2_SHIFT 16
  1123. #define FW_W3_MASK 0x1f000000 /**< waitcount3 */
  1124. #define FW_W3_SHIFT 24
  1125. /* When Srom support present, fields in sromcontrol */
  1126. #define SRC_START 0x80000000
  1127. #define SRC_BUSY 0x80000000
  1128. #define SRC_OPCODE 0x60000000
  1129. #define SRC_OP_READ 0x00000000
  1130. #define SRC_OP_WRITE 0x20000000
  1131. #define SRC_OP_WRDIS 0x40000000
  1132. #define SRC_OP_WREN 0x60000000
  1133. #define SRC_OTPSEL 0x00000010
  1134. #define SRC_OTPPRESENT 0x00000020
  1135. #define SRC_LOCK 0x00000008
  1136. #define SRC_SIZE_MASK 0x00000006
  1137. #define SRC_SIZE_1K 0x00000000
  1138. #define SRC_SIZE_4K 0x00000002
  1139. #define SRC_SIZE_16K 0x00000004
  1140. #define SRC_SIZE_SHIFT 1
  1141. #define SRC_PRESENT 0x00000001
  1142. /* Fields in pmucontrol */
  1143. #define PCTL_ILP_DIV_MASK 0xffff0000
  1144. #define PCTL_ILP_DIV_SHIFT 16
  1145. #define PCTL_LQ_REQ_EN 0x00008000
  1146. #define PCTL_PLL_PLLCTL_UPD 0x00000400 /**< rev 2 */
  1147. #define PCTL_NOILP_ON_WAIT 0x00000200 /**< rev 1 */
  1148. #define PCTL_HT_REQ_EN 0x00000100
  1149. #define PCTL_ALP_REQ_EN 0x00000080
  1150. #define PCTL_XTALFREQ_MASK 0x0000007c
  1151. #define PCTL_XTALFREQ_SHIFT 2
  1152. #define PCTL_ILP_DIV_EN 0x00000002
  1153. #define PCTL_LPO_SEL 0x00000001
  1154. /* Fields in pmucontrol_ext */
  1155. #define PCTL_EXT_USE_LHL_TIMER 0x00000010
  1156. #define PCTL_EXT_FASTLPO_ENAB 0x00000080
  1157. #define PCTL_EXT_FASTLPO_SWENAB 0x00000200
  1158. #define PCTL_EXT_FASTSEQ_ENAB 0x00001000
  1159. #define PCTL_EXT_FASTLPO_PCIE_SWENAB 0x00004000 /**< rev33 for FLL1M */
  1160. #define DEFAULT_43012_MIN_RES_MASK 0x0f8bfe77
  1161. /* Retention Control */
  1162. #define PMU_RCTL_CLK_DIV_SHIFT 0
  1163. #define PMU_RCTL_CHAIN_LEN_SHIFT 12
  1164. #define PMU_RCTL_MACPHY_DISABLE_SHIFT 26
  1165. #define PMU_RCTL_MACPHY_DISABLE_MASK (1 << 26)
  1166. #define PMU_RCTL_LOGIC_DISABLE_SHIFT 27
  1167. #define PMU_RCTL_LOGIC_DISABLE_MASK (1 << 27)
  1168. #define PMU_RCTL_MEMSLP_LOG_SHIFT 28
  1169. #define PMU_RCTL_MEMSLP_LOG_MASK (1 << 28)
  1170. #define PMU_RCTL_MEMRETSLP_LOG_SHIFT 29
  1171. #define PMU_RCTL_MEMRETSLP_LOG_MASK (1 << 29)
  1172. /* Retention Group Control */
  1173. #define PMU_RCTLGRP_CHAIN_LEN_SHIFT 0
  1174. #define PMU_RCTLGRP_RMODE_ENABLE_SHIFT 14
  1175. #define PMU_RCTLGRP_RMODE_ENABLE_MASK (1 << 14)
  1176. #define PMU_RCTLGRP_DFT_ENABLE_SHIFT 15
  1177. #define PMU_RCTLGRP_DFT_ENABLE_MASK (1 << 15)
  1178. #define PMU_RCTLGRP_NSRST_DISABLE_SHIFT 16
  1179. #define PMU_RCTLGRP_NSRST_DISABLE_MASK (1 << 16)
  1180. /* Fields in clkstretch */
  1181. #define CSTRETCH_HT 0xffff0000
  1182. #define CSTRETCH_ALP 0x0000ffff
  1183. #define CSTRETCH_REDUCE_8 0x00080008
  1184. /* gpiotimerval */
  1185. #define GPIO_ONTIME_SHIFT 16
  1186. /* clockcontrol_n */
  1187. #define CN_N1_MASK 0x3f /**< n1 control */
  1188. #define CN_N2_MASK 0x3f00 /**< n2 control */
  1189. #define CN_N2_SHIFT 8
  1190. #define CN_PLLC_MASK 0xf0000 /**< pll control */
  1191. #define CN_PLLC_SHIFT 16
  1192. /* clockcontrol_sb/pci/uart */
  1193. #define CC_M1_MASK 0x3f /**< m1 control */
  1194. #define CC_M2_MASK 0x3f00 /**< m2 control */
  1195. #define CC_M2_SHIFT 8
  1196. #define CC_M3_MASK 0x3f0000 /**< m3 control */
  1197. #define CC_M3_SHIFT 16
  1198. #define CC_MC_MASK 0x1f000000 /**< mux control */
  1199. #define CC_MC_SHIFT 24
  1200. /* N3M Clock control magic field values */
  1201. #define CC_F6_2 0x02 /**< A factor of 2 in */
  1202. #define CC_F6_3 0x03 /**< 6-bit fields like */
  1203. #define CC_F6_4 0x05 /**< N1, M1 or M3 */
  1204. #define CC_F6_5 0x09
  1205. #define CC_F6_6 0x11
  1206. #define CC_F6_7 0x21
  1207. #define CC_F5_BIAS 5 /**< 5-bit fields get this added */
  1208. #define CC_MC_BYPASS 0x08
  1209. #define CC_MC_M1 0x04
  1210. #define CC_MC_M1M2 0x02
  1211. #define CC_MC_M1M2M3 0x01
  1212. #define CC_MC_M1M3 0x11
  1213. /* Type 2 Clock control magic field values */
  1214. #define CC_T2_BIAS 2 /**< n1, n2, m1 & m3 bias */
  1215. #define CC_T2M2_BIAS 3 /**< m2 bias */
  1216. #define CC_T2MC_M1BYP 1
  1217. #define CC_T2MC_M2BYP 2
  1218. #define CC_T2MC_M3BYP 4
  1219. /* Type 6 Clock control magic field values */
  1220. #define CC_T6_MMASK 1 /**< bits of interest in m */
  1221. #define CC_T6_M0 120000000 /**< sb clock for m = 0 */
  1222. #define CC_T6_M1 100000000 /**< sb clock for m = 1 */
  1223. #define SB2MIPS_T6(sb) (2 * (sb))
  1224. /* Common clock base */
  1225. #define CC_CLOCK_BASE1 24000000 /**< Half the clock freq */
  1226. #define CC_CLOCK_BASE2 12500000 /**< Alternate crystal on some PLLs */
  1227. /* Clock control values for 200MHz in 5350 */
  1228. #define CLKC_5350_N 0x0311
  1229. #define CLKC_5350_M 0x04020009
  1230. /* Flash types in the chipcommon capabilities register */
  1231. #define FLASH_NONE 0x000 /**< No flash */
  1232. #define SFLASH_ST 0x100 /**< ST serial flash */
  1233. #define SFLASH_AT 0x200 /**< Atmel serial flash */
  1234. #define NFLASH 0x300
  1235. #define PFLASH 0x700 /**< Parallel flash */
  1236. #define QSPIFLASH_ST 0x800
  1237. #define QSPIFLASH_AT 0x900
  1238. /* Bits in the ExtBus config registers */
  1239. #define CC_CFG_EN 0x0001 /**< Enable */
  1240. #define CC_CFG_EM_MASK 0x000e /**< Extif Mode */
  1241. #define CC_CFG_EM_ASYNC 0x0000 /**< Async/Parallel flash */
  1242. #define CC_CFG_EM_SYNC 0x0002 /**< Synchronous */
  1243. #define CC_CFG_EM_PCMCIA 0x0004 /**< PCMCIA */
  1244. #define CC_CFG_EM_IDE 0x0006 /**< IDE */
  1245. #define CC_CFG_DS 0x0010 /**< Data size, 0=8bit, 1=16bit */
  1246. #define CC_CFG_CD_MASK 0x00e0 /**< Sync: Clock divisor, rev >= 20 */
  1247. #define CC_CFG_CE 0x0100 /**< Sync: Clock enable, rev >= 20 */
  1248. #define CC_CFG_SB 0x0200 /**< Sync: Size/Bytestrobe, rev >= 20 */
  1249. #define CC_CFG_IS 0x0400 /**< Extif Sync Clk Select, rev >= 20 */
  1250. /* ExtBus address space */
  1251. #define CC_EB_BASE 0x1a000000 /**< Chipc ExtBus base address */
  1252. #define CC_EB_PCMCIA_MEM 0x1a000000 /**< PCMCIA 0 memory base address */
  1253. #define CC_EB_PCMCIA_IO 0x1a200000 /**< PCMCIA 0 I/O base address */
  1254. #define CC_EB_PCMCIA_CFG 0x1a400000 /**< PCMCIA 0 config base address */
  1255. #define CC_EB_IDE 0x1a800000 /**< IDE memory base */
  1256. #define CC_EB_PCMCIA1_MEM 0x1a800000 /**< PCMCIA 1 memory base address */
  1257. #define CC_EB_PCMCIA1_IO 0x1aa00000 /**< PCMCIA 1 I/O base address */
  1258. #define CC_EB_PCMCIA1_CFG 0x1ac00000 /**< PCMCIA 1 config base address */
  1259. #define CC_EB_PROGIF 0x1b000000 /**< ProgIF Async/Sync base address */
  1260. /* Start/busy bit in flashcontrol */
  1261. #define SFLASH_OPCODE 0x000000ff
  1262. #define SFLASH_ACTION 0x00000700
  1263. #define SFLASH_CS_ACTIVE 0x00001000 /**< Chip Select Active, rev >= 20 */
  1264. #define SFLASH_START 0x80000000
  1265. #define SFLASH_BUSY SFLASH_START
  1266. /* flashcontrol action codes */
  1267. #define SFLASH_ACT_OPONLY 0x0000 /**< Issue opcode only */
  1268. #define SFLASH_ACT_OP1D 0x0100 /**< opcode + 1 data byte */
  1269. #define SFLASH_ACT_OP3A 0x0200 /**< opcode + 3 addr bytes */
  1270. #define SFLASH_ACT_OP3A1D 0x0300 /**< opcode + 3 addr & 1 data bytes */
  1271. #define SFLASH_ACT_OP3A4D 0x0400 /**< opcode + 3 addr & 4 data bytes */
  1272. #define SFLASH_ACT_OP3A4X4D 0x0500 /**< opcode + 3 addr, 4 don't care & 4 data bytes */
  1273. #define SFLASH_ACT_OP3A1X4D 0x0700 /**< opcode + 3 addr, 1 don't care & 4 data bytes */
  1274. /* flashcontrol action+opcodes for ST flashes */
  1275. #define SFLASH_ST_WREN 0x0006 /**< Write Enable */
  1276. #define SFLASH_ST_WRDIS 0x0004 /**< Write Disable */
  1277. #define SFLASH_ST_RDSR 0x0105 /**< Read Status Register */
  1278. #define SFLASH_ST_WRSR 0x0101 /**< Write Status Register */
  1279. #define SFLASH_ST_READ 0x0303 /**< Read Data Bytes */
  1280. #define SFLASH_ST_PP 0x0302 /**< Page Program */
  1281. #define SFLASH_ST_SE 0x02d8 /**< Sector Erase */
  1282. #define SFLASH_ST_BE 0x00c7 /**< Bulk Erase */
  1283. #define SFLASH_ST_DP 0x00b9 /**< Deep Power-down */
  1284. #define SFLASH_ST_RES 0x03ab /**< Read Electronic Signature */
  1285. #define SFLASH_ST_CSA 0x1000 /**< Keep chip select asserted */
  1286. #define SFLASH_ST_SSE 0x0220 /**< Sub-sector Erase */
  1287. #define SFLASH_ST_READ4B 0x6313 /* Read Data Bytes in 4Byte address */
  1288. #define SFLASH_ST_PP4B 0x6312 /* Page Program in 4Byte address */
  1289. #define SFLASH_ST_SE4B 0x62dc /* Sector Erase in 4Byte address */
  1290. #define SFLASH_ST_SSE4B 0x6221 /* Sub-sector Erase */
  1291. #define SFLASH_MXIC_RDID 0x0390 /* Read Manufacture ID */
  1292. #define SFLASH_MXIC_MFID 0xc2 /* MXIC Manufacture ID */
  1293. /* Status register bits for ST flashes */
  1294. #define SFLASH_ST_WIP 0x01 /**< Write In Progress */
  1295. #define SFLASH_ST_WEL 0x02 /**< Write Enable Latch */
  1296. #define SFLASH_ST_BP_MASK 0x1c /**< Block Protect */
  1297. #define SFLASH_ST_BP_SHIFT 2
  1298. #define SFLASH_ST_SRWD 0x80 /**< Status Register Write Disable */
  1299. /* flashcontrol action+opcodes for Atmel flashes */
  1300. #define SFLASH_AT_READ 0x07e8
  1301. #define SFLASH_AT_PAGE_READ 0x07d2
  1302. #define SFLASH_AT_BUF1_READ
  1303. #define SFLASH_AT_BUF2_READ
  1304. #define SFLASH_AT_STATUS 0x01d7
  1305. #define SFLASH_AT_BUF1_WRITE 0x0384
  1306. #define SFLASH_AT_BUF2_WRITE 0x0387
  1307. #define SFLASH_AT_BUF1_ERASE_PROGRAM 0x0283
  1308. #define SFLASH_AT_BUF2_ERASE_PROGRAM 0x0286
  1309. #define SFLASH_AT_BUF1_PROGRAM 0x0288
  1310. #define SFLASH_AT_BUF2_PROGRAM 0x0289
  1311. #define SFLASH_AT_PAGE_ERASE 0x0281
  1312. #define SFLASH_AT_BLOCK_ERASE 0x0250
  1313. #define SFLASH_AT_BUF1_WRITE_ERASE_PROGRAM 0x0382
  1314. #define SFLASH_AT_BUF2_WRITE_ERASE_PROGRAM 0x0385
  1315. #define SFLASH_AT_BUF1_LOAD 0x0253
  1316. #define SFLASH_AT_BUF2_LOAD 0x0255
  1317. #define SFLASH_AT_BUF1_COMPARE 0x0260
  1318. #define SFLASH_AT_BUF2_COMPARE 0x0261
  1319. #define SFLASH_AT_BUF1_REPROGRAM 0x0258
  1320. #define SFLASH_AT_BUF2_REPROGRAM 0x0259
  1321. /* Status register bits for Atmel flashes */
  1322. #define SFLASH_AT_READY 0x80
  1323. #define SFLASH_AT_MISMATCH 0x40
  1324. #define SFLASH_AT_ID_MASK 0x38
  1325. #define SFLASH_AT_ID_SHIFT 3
  1326. /* SPI register bits, corerev >= 37 */
  1327. #define GSIO_START 0x80000000
  1328. #define GSIO_BUSY GSIO_START
  1329. /* GCI UART Function sel related */
  1330. #define MUXENAB_GCI_UART_MASK (0x00000f00)
  1331. #define MUXENAB_GCI_UART_SHIFT 8
  1332. #define MUXENAB_GCI_UART_FNSEL_MASK (0x00003000)
  1333. #define MUXENAB_GCI_UART_FNSEL_SHIFT 12
  1334. /*
  1335. * These are the UART port assignments, expressed as offsets from the base
  1336. * register. These assignments should hold for any serial port based on
  1337. * a 8250, 16450, or 16550(A).
  1338. */
  1339. #define UART_RX 0 /**< In: Receive buffer (DLAB=0) */
  1340. #define UART_TX 0 /**< Out: Transmit buffer (DLAB=0) */
  1341. #define UART_DLL 0 /**< Out: Divisor Latch Low (DLAB=1) */
  1342. #define UART_IER 1 /**< In/Out: Interrupt Enable Register (DLAB=0) */
  1343. #define UART_DLM 1 /**< Out: Divisor Latch High (DLAB=1) */
  1344. #define UART_IIR 2 /**< In: Interrupt Identity Register */
  1345. #define UART_FCR 2 /**< Out: FIFO Control Register */
  1346. #define UART_LCR 3 /**< Out: Line Control Register */
  1347. #define UART_MCR 4 /**< Out: Modem Control Register */
  1348. #define UART_LSR 5 /**< In: Line Status Register */
  1349. #define UART_MSR 6 /**< In: Modem Status Register */
  1350. #define UART_SCR 7 /**< I/O: Scratch Register */
  1351. #define UART_LCR_DLAB 0x80 /**< Divisor latch access bit */
  1352. #define UART_LCR_WLEN8 0x03 /**< Word length: 8 bits */
  1353. #define UART_MCR_OUT2 0x08 /**< MCR GPIO out 2 */
  1354. #define UART_MCR_LOOP 0x10 /**< Enable loopback test mode */
  1355. #define UART_LSR_RX_FIFO 0x80 /**< Receive FIFO error */
  1356. #define UART_LSR_TDHR 0x40 /**< Data-hold-register empty */
  1357. #define UART_LSR_THRE 0x20 /**< Transmit-hold-register empty */
  1358. #define UART_LSR_BREAK 0x10 /**< Break interrupt */
  1359. #define UART_LSR_FRAMING 0x08 /**< Framing error */
  1360. #define UART_LSR_PARITY 0x04 /**< Parity error */
  1361. #define UART_LSR_OVERRUN 0x02 /**< Overrun error */
  1362. #define UART_LSR_RXRDY 0x01 /**< Receiver ready */
  1363. #define UART_FCR_FIFO_ENABLE 1 /**< FIFO control register bit controlling FIFO enable/disable */
  1364. /* Interrupt Identity Register (IIR) bits */
  1365. #define UART_IIR_FIFO_MASK 0xc0 /**< IIR FIFO disable/enabled mask */
  1366. #define UART_IIR_INT_MASK 0xf /**< IIR interrupt ID source */
  1367. #define UART_IIR_MDM_CHG 0x0 /**< Modem status changed */
  1368. #define UART_IIR_NOINT 0x1 /**< No interrupt pending */
  1369. #define UART_IIR_THRE 0x2 /**< THR empty */
  1370. #define UART_IIR_RCVD_DATA 0x4 /**< Received data available */
  1371. #define UART_IIR_RCVR_STATUS 0x6 /**< Receiver status */
  1372. #define UART_IIR_CHAR_TIME 0xc /**< Character time */
  1373. /* Interrupt Enable Register (IER) bits */
  1374. #define UART_IER_PTIME 128 /**< Programmable THRE Interrupt Mode Enable */
  1375. #define UART_IER_EDSSI 8 /**< enable modem status interrupt */
  1376. #define UART_IER_ELSI 4 /**< enable receiver line status interrupt */
  1377. #define UART_IER_ETBEI 2 /**< enable transmitter holding register empty interrupt */
  1378. #define UART_IER_ERBFI 1 /**< enable data available interrupt */
  1379. /* pmustatus */
  1380. #define PST_SLOW_WR_PENDING 0x0400
  1381. #define PST_EXTLPOAVAIL 0x0100
  1382. #define PST_WDRESET 0x0080
  1383. #define PST_INTPEND 0x0040
  1384. #define PST_SBCLKST 0x0030
  1385. #define PST_SBCLKST_ILP 0x0010
  1386. #define PST_SBCLKST_ALP 0x0020
  1387. #define PST_SBCLKST_HT 0x0030
  1388. #define PST_ALPAVAIL 0x0008
  1389. #define PST_HTAVAIL 0x0004
  1390. #define PST_RESINIT 0x0003
  1391. #define PST_ILPFASTLPO 0x00010000
  1392. /* pmucapabilities */
  1393. #define PCAP_REV_MASK 0x000000ff
  1394. #define PCAP_RC_MASK 0x00001f00
  1395. #define PCAP_RC_SHIFT 8
  1396. #define PCAP_TC_MASK 0x0001e000
  1397. #define PCAP_TC_SHIFT 13
  1398. #define PCAP_PC_MASK 0x001e0000
  1399. #define PCAP_PC_SHIFT 17
  1400. #define PCAP_VC_MASK 0x01e00000
  1401. #define PCAP_VC_SHIFT 21
  1402. #define PCAP_CC_MASK 0x1e000000
  1403. #define PCAP_CC_SHIFT 25
  1404. #define PCAP5_PC_MASK 0x003e0000 /**< PMU corerev >= 5 */
  1405. #define PCAP5_PC_SHIFT 17
  1406. #define PCAP5_VC_MASK 0x07c00000
  1407. #define PCAP5_VC_SHIFT 22
  1408. #define PCAP5_CC_MASK 0xf8000000
  1409. #define PCAP5_CC_SHIFT 27
  1410. /* pmucapabilities ext */
  1411. #define PCAP_EXT_ST_NUM_SHIFT (8) /* stat timer number */
  1412. #define PCAP_EXT_ST_NUM_MASK (0xf << PCAP_EXT_ST_NUM_SHIFT)
  1413. #define PCAP_EXT_ST_SRC_NUM_SHIFT (12) /* stat timer source number */
  1414. #define PCAP_EXT_ST_SRC_NUM_MASK (0xf << PCAP_EXT_ST_SRC_NUM_SHIFT)
  1415. /* pmustattimer ctrl */
  1416. #define PMU_ST_SRC_SHIFT (0) /* stat timer source number */
  1417. #define PMU_ST_SRC_MASK (0xff << PMU_ST_SRC_SHIFT)
  1418. #define PMU_ST_CNT_MODE_SHIFT (10) /* stat timer count mode */
  1419. #define PMU_ST_CNT_MODE_MASK (0x3 << PMU_ST_CNT_MODE_SHIFT)
  1420. #define PMU_ST_EN_SHIFT (8) /* stat timer enable */
  1421. #define PMU_ST_EN_MASK (0x1 << PMU_ST_EN_SHIFT)
  1422. #define PMU_ST_ENAB 1
  1423. #define PMU_ST_DISAB 0
  1424. #define PMU_ST_INT_EN_SHIFT (9) /* stat timer enable */
  1425. #define PMU_ST_INT_EN_MASK (0x1 << PMU_ST_INT_EN_SHIFT)
  1426. #define PMU_ST_INT_ENAB 1
  1427. #define PMU_ST_INT_DISAB 0
  1428. /* CoreCapabilitiesExtension */
  1429. #define PCAP_EXT_USE_MUXED_ILP_CLK_MASK 0x04000000
  1430. /* PMU Resource Request Timer registers */
  1431. /* This is based on PmuRev0 */
  1432. #define PRRT_TIME_MASK 0x03ff
  1433. #define PRRT_INTEN 0x0400
  1434. /* ReqActive 25
  1435. * The hardware sets this field to 1 when the timer expires.
  1436. * Software writes this field to 1 to make immediate resource requests.
  1437. */
  1438. #define PRRT_REQ_ACTIVE 0x0800 /* To check h/w status */
  1439. #define PRRT_IMMEDIATE_RES_REQ 0x0800 /* macro for sw immediate res req */
  1440. #define PRRT_ALP_REQ 0x1000
  1441. #define PRRT_HT_REQ 0x2000
  1442. #define PRRT_HQ_REQ 0x4000
  1443. /* PMU Int Control register bits */
  1444. #define PMU_INTC_ALP_REQ 0x1
  1445. #define PMU_INTC_HT_REQ 0x2
  1446. #define PMU_INTC_HQ_REQ 0x4
  1447. /* bit 0 of the PMU interrupt vector is asserted if this mask is enabled */
  1448. #define RSRC_INTR_MASK_TIMER_INT_0 1
  1449. #define PMU_INTR_MASK_EXTWAKE_REQ_ACTIVE_0 (1 << 20)
  1450. /* bit 16 of the PMU interrupt vector - Stats Timer Interrupt */
  1451. #define PMU_INT_STAT_TIMER_INT_SHIFT 16
  1452. #define PMU_INT_STAT_TIMER_INT_MASK (1 << PMU_INT_STAT_TIMER_INT_SHIFT)
  1453. /* PMU resource bit position */
  1454. #define PMURES_BIT(bit) (1 << (bit))
  1455. /* PMU resource number limit */
  1456. #define PMURES_MAX_RESNUM 30
  1457. /* PMU chip control0 register */
  1458. #define PMU_CHIPCTL0 0
  1459. #define PMU_CC0_4369_XTALCORESIZE_BIAS_ADJ_START_VAL (0x20 << 0)
  1460. #define PMU_CC0_4369_XTALCORESIZE_BIAS_ADJ_START_MASK (0x3F << 0)
  1461. #define PMU_CC0_4369_XTALCORESIZE_BIAS_ADJ_NORMAL_VAL (0xF << 6)
  1462. #define PMU_CC0_4369_XTALCORESIZE_BIAS_ADJ_NORMAL_MASK (0x3F << 6)
  1463. #define PMU_CC0_4369_XTAL_RES_BYPASS_START_VAL (0 << 12)
  1464. #define PMU_CC0_4369_XTAL_RES_BYPASS_START_MASK (0x7 << 12)
  1465. #define PMU_CC0_4369_XTAL_RES_BYPASS_NORMAL_VAL (0x1 << 15)
  1466. #define PMU_CC0_4369_XTAL_RES_BYPASS_NORMAL_MASK (0x7 << 15)
  1467. /* clock req types */
  1468. #define PMU_CC1_CLKREQ_TYPE_SHIFT 19
  1469. #define PMU_CC1_CLKREQ_TYPE_MASK (1 << PMU_CC1_CLKREQ_TYPE_SHIFT)
  1470. #define CLKREQ_TYPE_CONFIG_OPENDRAIN 0
  1471. #define CLKREQ_TYPE_CONFIG_PUSHPULL 1
  1472. /* Power Control */
  1473. #define PWRCTL_ENAB_MEM_CLK_GATE_SHIFT 5
  1474. #define PWRCTL_AUTO_MEM_STBYRET 28
  1475. /* PMU chip control1 register */
  1476. #define PMU_CHIPCTL1 1
  1477. #define PMU_CC1_RXC_DLL_BYPASS 0x00010000
  1478. #define PMU_CC1_ENABLE_BBPLL_PWR_DOWN 0x00000010
  1479. #define PMU_CC1_IF_TYPE_MASK 0x00000030
  1480. #define PMU_CC1_IF_TYPE_RMII 0x00000000
  1481. #define PMU_CC1_IF_TYPE_MII 0x00000010
  1482. #define PMU_CC1_IF_TYPE_RGMII 0x00000020
  1483. #define PMU_CC1_SW_TYPE_MASK 0x000000c0
  1484. #define PMU_CC1_SW_TYPE_EPHY 0x00000000
  1485. #define PMU_CC1_SW_TYPE_EPHYMII 0x00000040
  1486. #define PMU_CC1_SW_TYPE_EPHYRMII 0x00000080
  1487. #define PMU_CC1_SW_TYPE_RGMII 0x000000c0
  1488. #define PMU_CC1_ENABLE_CLOSED_LOOP_MASK 0x00000080
  1489. #define PMU_CC1_ENABLE_CLOSED_LOOP 0x00000000
  1490. #define PMU_CC1_PWRSW_CLKSTRSTP_DELAY_MASK 0x00003F00u
  1491. #define PMU_CC1_PWRSW_CLKSTRSTP_DELAY 0x00000400u
  1492. /* PMU chip control2 register */
  1493. #define PMU_CC2_RFLDO3P3_PU_FORCE_ON (1 << 15)
  1494. #define PMU_CC2_RFLDO3P3_PU_CLEAR 0x00000000
  1495. #define PMU_CC2_WL2CDIG_I_PMU_SLEEP (1 << 16)
  1496. #define PMU_CHIPCTL2 2
  1497. #define PMU_CC2_FORCE_SUBCORE_PWR_SWITCH_ON (1 << 18)
  1498. #define PMU_CC2_FORCE_PHY_PWR_SWITCH_ON (1 << 19)
  1499. #define PMU_CC2_FORCE_VDDM_PWR_SWITCH_ON (1 << 20)
  1500. #define PMU_CC2_FORCE_MEMLPLDO_PWR_SWITCH_ON (1 << 21)
  1501. #define PMU_CC2_MASK_WL_DEV_WAKE (1 << 22)
  1502. #define PMU_CC2_INV_GPIO_POLARITY_PMU_WAKE (1 << 25)
  1503. #define PMU_CC2_GCI2_WAKE (1 << 31)
  1504. #define PMU_CC2_4369_XTALCORESIZE_BIAS_ADJ_START_VAL (0x3 << 26)
  1505. #define PMU_CC2_4369_XTALCORESIZE_BIAS_ADJ_START_MASK (0x3 << 26)
  1506. #define PMU_CC2_4369_XTALCORESIZE_BIAS_ADJ_NORMAL_VAL (0x0 << 28)
  1507. #define PMU_CC2_4369_XTALCORESIZE_BIAS_ADJ_NORMAL_MASK (0x3 << 28)
  1508. /* PMU chip control3 register */
  1509. #define PMU_CHIPCTL3 3
  1510. #define PMU_CC3_ENABLE_SDIO_WAKEUP_SHIFT 19
  1511. #define PMU_CC3_ENABLE_RF_SHIFT 22
  1512. #define PMU_CC3_RF_DISABLE_IVALUE_SHIFT 23
  1513. #define PMU_CC3_4369_XTALCORESIZE_PMOS_START_VAL (0x3F << 0)
  1514. #define PMU_CC3_4369_XTALCORESIZE_PMOS_START_MASK (0x3F << 0)
  1515. #define PMU_CC3_4369_XTALCORESIZE_PMOS_NORMAL_VAL (0x3F << 15)
  1516. #define PMU_CC3_4369_XTALCORESIZE_PMOS_NORMAL_MASK (0x3F << 15)
  1517. #define PMU_CC3_4369_XTALCORESIZE_NMOS_START_VAL (0x3F << 6)
  1518. #define PMU_CC3_4369_XTALCORESIZE_NMOS_START_MASK (0x3F << 6)
  1519. #define PMU_CC3_4369_XTALCORESIZE_NMOS_NORMAL_VAL (0x3F << 21)
  1520. #define PMU_CC3_4369_XTALCORESIZE_NMOS_NORMAL_MASK (0x3F << 21)
  1521. #define PMU_CC3_4369_XTALSEL_BIAS_RES_START_VAL (0x2 << 12)
  1522. #define PMU_CC3_4369_XTALSEL_BIAS_RES_START_MASK (0x7 << 12)
  1523. #define PMU_CC3_4369_XTALSEL_BIAS_RES_NORMAL_VAL (0x6 << 27)
  1524. #define PMU_CC3_4369_XTALSEL_BIAS_RES_NORMAL_MASK (0x7 << 27)
  1525. /* PMU chip control4 register */
  1526. #define PMU_CHIPCTL4 4
  1527. /* 53537 series moved switch_type and gmac_if_type to CC4 [15:14] and [13:12] */
  1528. #define PMU_CC4_IF_TYPE_MASK 0x00003000
  1529. #define PMU_CC4_IF_TYPE_RMII 0x00000000
  1530. #define PMU_CC4_IF_TYPE_MII 0x00001000
  1531. #define PMU_CC4_IF_TYPE_RGMII 0x00002000
  1532. #define PMU_CC4_SW_TYPE_MASK 0x0000c000
  1533. #define PMU_CC4_SW_TYPE_EPHY 0x00000000
  1534. #define PMU_CC4_SW_TYPE_EPHYMII 0x00004000
  1535. #define PMU_CC4_SW_TYPE_EPHYRMII 0x00008000
  1536. #define PMU_CC4_SW_TYPE_RGMII 0x0000c000
  1537. #define PMU_CC4_DISABLE_LQ_AVAIL (1<<27)
  1538. #define PMU_CC4_4369_MAIN_PD_CBUCK2VDDB_ON (1u << 15u)
  1539. #define PMU_CC4_4369_MAIN_PD_CBUCK2VDDRET_ON (1u << 16u)
  1540. #define PMU_CC4_4369_MAIN_PD_MEMLPLDO2VDDB_ON (1u << 17u)
  1541. #define PMU_CC4_4369_MAIN_PD_MEMLPDLO2VDDRET_ON (1u << 18u)
  1542. #define PMU_CC4_4369_AUX_PD_CBUCK2VDDB_ON (1u << 21u)
  1543. #define PMU_CC4_4369_AUX_PD_CBUCK2VDDRET_ON (1u << 22u)
  1544. #define PMU_CC4_4369_AUX_PD_MEMLPLDO2VDDB_ON (1u << 23u)
  1545. #define PMU_CC4_4369_AUX_PD_MEMLPLDO2VDDRET_ON (1u << 24u)
  1546. /* PMU chip control5 register */
  1547. #define PMU_CHIPCTL5 5
  1548. #define PMU_CC5_4369_SUBCORE_CBUCK2VDDB_ON (1u << 9u)
  1549. #define PMU_CC5_4369_SUBCORE_CBUCK2VDDRET_ON (1u << 10u)
  1550. #define PMU_CC5_4369_SUBCORE_MEMLPLDO2VDDB_ON (1u << 11u)
  1551. #define PMU_CC5_4369_SUBCORE_MEMLPLDO2VDDRET_ON (1u << 12u)
  1552. /* PMU chip control6 register */
  1553. #define PMU_CHIPCTL6 6
  1554. #define PMU_CC6_ENABLE_CLKREQ_WAKEUP (1 << 4)
  1555. #define PMU_CC6_ENABLE_PMU_WAKEUP_ALP (1 << 6)
  1556. #define PMU_CC6_ENABLE_PCIE_RETENTION (1 << 12)
  1557. #define PMU_CC6_ENABLE_PMU_EXT_PERST (1 << 13)
  1558. #define PMU_CC6_ENABLE_PMU_WAKEUP_PERST (1 << 14)
  1559. /* PMU chip control7 register */
  1560. #define PMU_CHIPCTL7 7
  1561. #define PMU_CC7_ENABLE_L2REFCLKPAD_PWRDWN (1 << 25)
  1562. #define PMU_CC7_ENABLE_MDIO_RESET_WAR (1 << 27)
  1563. /* 53537 series have gmca1 gmac_if_type in cc7 [7:6](defalut 0b01) */
  1564. #define PMU_CC7_IF_TYPE_MASK 0x000000c0
  1565. #define PMU_CC7_IF_TYPE_RMII 0x00000000
  1566. #define PMU_CC7_IF_TYPE_MII 0x00000040
  1567. #define PMU_CC7_IF_TYPE_RGMII 0x00000080
  1568. #define PMU_CHIPCTL8 8
  1569. #define PMU_CHIPCTL9 9
  1570. #define PMU_CHIPCTL10 10
  1571. #define PMU_CC10_PCIE_PWRSW_RESET0_CNT_SHIFT 0
  1572. #define PMU_CC10_PCIE_PWRSW_RESET0_CNT_MASK 0x000000ff
  1573. #define PMU_CC10_PCIE_PWRSW_RESET1_CNT_SHIFT 8
  1574. #define PMU_CC10_PCIE_PWRSW_RESET1_CNT_MASK 0x0000ff00
  1575. #define PMU_CC10_PCIE_PWRSW_UP_DLY_SHIFT 16
  1576. #define PMU_CC10_PCIE_PWRSW_UP_DLY_MASK 0x000f0000
  1577. #define PMU_CC10_PCIE_PWRSW_FORCE_PWROK_DLY_SHIFT 20
  1578. #define PMU_CC10_PCIE_PWRSW_FORCE_PWROK_DLY_MASK 0x00f00000
  1579. #define PMU_CC10_FORCE_PCIE_ON (1 << 24)
  1580. #define PMU_CC10_FORCE_PCIE_SW_ON (1 << 25)
  1581. #define PMU_CC10_FORCE_PCIE_RETNT_ON (1 << 26)
  1582. #define PMU_CC10_PCIE_PWRSW_RESET_CNT_4US 1
  1583. #define PMU_CC10_PCIE_PWRSW_RESET_CNT_8US 2
  1584. #define PMU_CC10_PCIE_PWRSW_UP_DLY_0US 0
  1585. #define PMU_CC10_PCIE_PWRSW_FORCE_PWROK_DLY_4US 1
  1586. #define PMU_CHIPCTL11 11
  1587. #define PMU_CHIPCTL12 12
  1588. /* PMU chip control13 register */
  1589. #define PMU_CHIPCTL13 13
  1590. #define PMU_CC13_SUBCORE_CBUCK2VDDB_OFF (1u << 0u)
  1591. #define PMU_CC13_SUBCORE_CBUCK2VDDRET_OFF (1u << 1u)
  1592. #define PMU_CC13_SUBCORE_MEMLPLDO2VDDB_OFF (1u << 2u)
  1593. #define PMU_CC13_SUBCORE_MEMLPLDO2VDDRET_OFF (1u << 3u)
  1594. #define PMU_CC13_MAIN_CBUCK2VDDB_OFF (1u << 4u)
  1595. #define PMU_CC13_MAIN_CBUCK2VDDRET_OFF (1u << 5u)
  1596. #define PMU_CC13_MAIN_MEMLPLDO2VDDB_OFF (1u << 6u)
  1597. #define PMU_CC13_MAIN_MEMLPLDO2VDDRET_OFF (1u << 7u)
  1598. #define PMU_CC13_AUX_CBUCK2VDDB_OFF (1u << 8u)
  1599. #define PMU_CC13_AUX_MEMLPLDO2VDDB_OFF (1u << 10u)
  1600. #define PMU_CC13_AUX_MEMLPLDO2VDDRET_OFF (1u << 11u)
  1601. #define PMU_CC13_AUX_CBUCK2VDDRET_OFF (1u << 12u)
  1602. #define PMU_CHIPCTL14 14
  1603. #define PMU_CHIPCTL15 15
  1604. #define PMU_CHIPCTL16 16
  1605. #define PMU_CC16_CLK4M_DIS (1 << 4)
  1606. #define PMU_CC16_FF_ZERO_ADJ (4 << 5)
  1607. /* PMU chip control14 register */
  1608. #define PMU_CC14_MAIN_VDDB2VDDRET_UP_DLY_MASK (0xF)
  1609. #define PMU_CC14_MAIN_VDDB2VDD_UP_DLY_MASK (0xF << 4)
  1610. #define PMU_CC14_AUX_VDDB2VDDRET_UP_DLY_MASK (0xF << 8)
  1611. #define PMU_CC14_AUX_VDDB2VDD_UP_DLY_MASK (0xF << 12)
  1612. #define PMU_CC14_PCIE_VDDB2VDDRET_UP_DLY_MASK (0xF << 16)
  1613. #define PMU_CC14_PCIE_VDDB2VDD_UP_DLY_MASK (0xF << 20)
  1614. /* PMU corerev and chip specific PLL controls.
  1615. * PMU<rev>_PLL<num>_XX where <rev> is PMU corerev and <num> is an arbitrary number
  1616. * to differentiate different PLLs controlled by the same PMU rev.
  1617. */
  1618. /* pllcontrol registers */
  1619. /* PDIV, div_phy, div_arm, div_adc, dith_sel, ioff, kpd_scale, lsb_sel, mash_sel, lf_c & lf_r */
  1620. #define PMU0_PLL0_PLLCTL0 0
  1621. #define PMU0_PLL0_PC0_PDIV_MASK 1
  1622. #define PMU0_PLL0_PC0_PDIV_FREQ 25000
  1623. #define PMU0_PLL0_PC0_DIV_ARM_MASK 0x00000038
  1624. #define PMU0_PLL0_PC0_DIV_ARM_SHIFT 3
  1625. #define PMU0_PLL0_PC0_DIV_ARM_BASE 8
  1626. /* PC0_DIV_ARM for PLLOUT_ARM */
  1627. #define PMU0_PLL0_PC0_DIV_ARM_110MHZ 0
  1628. #define PMU0_PLL0_PC0_DIV_ARM_97_7MHZ 1
  1629. #define PMU0_PLL0_PC0_DIV_ARM_88MHZ 2
  1630. #define PMU0_PLL0_PC0_DIV_ARM_80MHZ 3 /* Default */
  1631. #define PMU0_PLL0_PC0_DIV_ARM_73_3MHZ 4
  1632. #define PMU0_PLL0_PC0_DIV_ARM_67_7MHZ 5
  1633. #define PMU0_PLL0_PC0_DIV_ARM_62_9MHZ 6
  1634. #define PMU0_PLL0_PC0_DIV_ARM_58_6MHZ 7
  1635. /* Wildcard base, stop_mod, en_lf_tp, en_cal & lf_r2 */
  1636. #define PMU0_PLL0_PLLCTL1 1
  1637. #define PMU0_PLL0_PC1_WILD_INT_MASK 0xf0000000
  1638. #define PMU0_PLL0_PC1_WILD_INT_SHIFT 28
  1639. #define PMU0_PLL0_PC1_WILD_FRAC_MASK 0x0fffff00
  1640. #define PMU0_PLL0_PC1_WILD_FRAC_SHIFT 8
  1641. #define PMU0_PLL0_PC1_STOP_MOD 0x00000040
  1642. /* Wildcard base, vco_calvar, vco_swc, vco_var_selref, vso_ical & vco_sel_avdd */
  1643. #define PMU0_PLL0_PLLCTL2 2
  1644. #define PMU0_PLL0_PC2_WILD_INT_MASK 0xf
  1645. #define PMU0_PLL0_PC2_WILD_INT_SHIFT 4
  1646. /* pllcontrol registers */
  1647. /* ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>, p1div, p2div, _bypass_sdmod */
  1648. #define PMU1_PLL0_PLLCTL0 0
  1649. #define PMU1_PLL0_PC0_P1DIV_MASK 0x00f00000
  1650. #define PMU1_PLL0_PC0_P1DIV_SHIFT 20
  1651. #define PMU1_PLL0_PC0_P2DIV_MASK 0x0f000000
  1652. #define PMU1_PLL0_PC0_P2DIV_SHIFT 24
  1653. /* m<x>div */
  1654. #define PMU1_PLL0_PLLCTL1 1
  1655. #define PMU1_PLL0_PC1_M1DIV_MASK 0x000000ff
  1656. #define PMU1_PLL0_PC1_M1DIV_SHIFT 0
  1657. #define PMU1_PLL0_PC1_M2DIV_MASK 0x0000ff00
  1658. #define PMU1_PLL0_PC1_M2DIV_SHIFT 8
  1659. #define PMU1_PLL0_PC1_M3DIV_MASK 0x00ff0000
  1660. #define PMU1_PLL0_PC1_M3DIV_SHIFT 16
  1661. #define PMU1_PLL0_PC1_M4DIV_MASK 0xff000000
  1662. #define PMU1_PLL0_PC1_M4DIV_SHIFT 24
  1663. #define PMU1_PLL0_PC1_M4DIV_BY_9 9
  1664. #define PMU1_PLL0_PC1_M4DIV_BY_18 0x12
  1665. #define PMU1_PLL0_PC1_M4DIV_BY_36 0x24
  1666. #define PMU1_PLL0_PC1_M4DIV_BY_60 0x3C
  1667. #define PMU1_PLL0_PC1_M2_M4DIV_MASK 0xff00ff00
  1668. #define PMU1_PLL0_PC1_HOLD_LOAD_CH 0x28
  1669. #define DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT 8
  1670. #define DOT11MAC_880MHZ_CLK_DIVISOR_MASK (0xFF << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT)
  1671. #define DOT11MAC_880MHZ_CLK_DIVISOR_VAL (0xE << DOT11MAC_880MHZ_CLK_DIVISOR_SHIFT)
  1672. /* m<x>div, ndiv_dither_mfb, ndiv_mode, ndiv_int */
  1673. #define PMU1_PLL0_PLLCTL2 2
  1674. #define PMU1_PLL0_PC2_M5DIV_MASK 0x000000ff
  1675. #define PMU1_PLL0_PC2_M5DIV_SHIFT 0
  1676. #define PMU1_PLL0_PC2_M5DIV_BY_12 0xc
  1677. #define PMU1_PLL0_PC2_M5DIV_BY_18 0x12
  1678. #define PMU1_PLL0_PC2_M5DIV_BY_31 0x1f
  1679. #define PMU1_PLL0_PC2_M5DIV_BY_36 0x24
  1680. #define PMU1_PLL0_PC2_M5DIV_BY_42 0x2a
  1681. #define PMU1_PLL0_PC2_M5DIV_BY_60 0x3c
  1682. #define PMU1_PLL0_PC2_M6DIV_MASK 0x0000ff00
  1683. #define PMU1_PLL0_PC2_M6DIV_SHIFT 8
  1684. #define PMU1_PLL0_PC2_M6DIV_BY_18 0x12
  1685. #define PMU1_PLL0_PC2_M6DIV_BY_36 0x24
  1686. #define PMU1_PLL0_PC2_NDIV_MODE_MASK 0x000e0000
  1687. #define PMU1_PLL0_PC2_NDIV_MODE_SHIFT 17
  1688. #define PMU1_PLL0_PC2_NDIV_MODE_MASH 1
  1689. #define PMU1_PLL0_PC2_NDIV_MODE_MFB 2 /**< recommended for 4319 */
  1690. #define PMU1_PLL0_PC2_NDIV_INT_MASK 0x1ff00000
  1691. #define PMU1_PLL0_PC2_NDIV_INT_SHIFT 20
  1692. /* ndiv_frac */
  1693. #define PMU1_PLL0_PLLCTL3 3
  1694. #define PMU1_PLL0_PC3_NDIV_FRAC_MASK 0x00ffffff
  1695. #define PMU1_PLL0_PC3_NDIV_FRAC_SHIFT 0
  1696. /* pll_ctrl */
  1697. #define PMU1_PLL0_PLLCTL4 4
  1698. /* pll_ctrl, vco_rng, clkdrive_ch<x> */
  1699. #define PMU1_PLL0_PLLCTL5 5
  1700. #define PMU1_PLL0_PC5_CLK_DRV_MASK 0xffffff00
  1701. #define PMU1_PLL0_PC5_CLK_DRV_SHIFT 8
  1702. #define PMU1_PLL0_PC5_ASSERT_CH_MASK 0x3f000000
  1703. #define PMU1_PLL0_PC5_ASSERT_CH_SHIFT 24
  1704. #define PMU1_PLL0_PC5_DEASSERT_CH_MASK 0xff000000
  1705. #define PMU1_PLL0_PLLCTL6 6
  1706. #define PMU1_PLL0_PLLCTL7 7
  1707. #define PMU1_PLL0_PLLCTL8 8
  1708. #define PMU1_PLLCTL8_OPENLOOP_MASK (1 << 1)
  1709. #define PMU_PLL4350_OPENLOOP_MASK (1 << 7)
  1710. #define PMU1_PLL0_PLLCTL9 9
  1711. #define PMU1_PLL0_PLLCTL10 10
  1712. /* PMU rev 2 control words */
  1713. #define PMU2_PHY_PLL_PLLCTL 4
  1714. #define PMU2_SI_PLL_PLLCTL 10
  1715. /* PMU rev 2 */
  1716. /* pllcontrol registers */
  1717. /* ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>, p1div, p2div, _bypass_sdmod */
  1718. #define PMU2_PLL_PLLCTL0 0
  1719. #define PMU2_PLL_PC0_P1DIV_MASK 0x00f00000
  1720. #define PMU2_PLL_PC0_P1DIV_SHIFT 20
  1721. #define PMU2_PLL_PC0_P2DIV_MASK 0x0f000000
  1722. #define PMU2_PLL_PC0_P2DIV_SHIFT 24
  1723. /* m<x>div */
  1724. #define PMU2_PLL_PLLCTL1 1
  1725. #define PMU2_PLL_PC1_M1DIV_MASK 0x000000ff
  1726. #define PMU2_PLL_PC1_M1DIV_SHIFT 0
  1727. #define PMU2_PLL_PC1_M2DIV_MASK 0x0000ff00
  1728. #define PMU2_PLL_PC1_M2DIV_SHIFT 8
  1729. #define PMU2_PLL_PC1_M3DIV_MASK 0x00ff0000
  1730. #define PMU2_PLL_PC1_M3DIV_SHIFT 16
  1731. #define PMU2_PLL_PC1_M4DIV_MASK 0xff000000
  1732. #define PMU2_PLL_PC1_M4DIV_SHIFT 24
  1733. /* m<x>div, ndiv_dither_mfb, ndiv_mode, ndiv_int */
  1734. #define PMU2_PLL_PLLCTL2 2
  1735. #define PMU2_PLL_PC2_M5DIV_MASK 0x000000ff
  1736. #define PMU2_PLL_PC2_M5DIV_SHIFT 0
  1737. #define PMU2_PLL_PC2_M6DIV_MASK 0x0000ff00
  1738. #define PMU2_PLL_PC2_M6DIV_SHIFT 8
  1739. #define PMU2_PLL_PC2_NDIV_MODE_MASK 0x000e0000
  1740. #define PMU2_PLL_PC2_NDIV_MODE_SHIFT 17
  1741. #define PMU2_PLL_PC2_NDIV_INT_MASK 0x1ff00000
  1742. #define PMU2_PLL_PC2_NDIV_INT_SHIFT 20
  1743. /* ndiv_frac */
  1744. #define PMU2_PLL_PLLCTL3 3
  1745. #define PMU2_PLL_PC3_NDIV_FRAC_MASK 0x00ffffff
  1746. #define PMU2_PLL_PC3_NDIV_FRAC_SHIFT 0
  1747. /* pll_ctrl */
  1748. #define PMU2_PLL_PLLCTL4 4
  1749. /* pll_ctrl, vco_rng, clkdrive_ch<x> */
  1750. #define PMU2_PLL_PLLCTL5 5
  1751. #define PMU2_PLL_PC5_CLKDRIVE_CH1_MASK 0x00000f00
  1752. #define PMU2_PLL_PC5_CLKDRIVE_CH1_SHIFT 8
  1753. #define PMU2_PLL_PC5_CLKDRIVE_CH2_MASK 0x0000f000
  1754. #define PMU2_PLL_PC5_CLKDRIVE_CH2_SHIFT 12
  1755. #define PMU2_PLL_PC5_CLKDRIVE_CH3_MASK 0x000f0000
  1756. #define PMU2_PLL_PC5_CLKDRIVE_CH3_SHIFT 16
  1757. #define PMU2_PLL_PC5_CLKDRIVE_CH4_MASK 0x00f00000
  1758. #define PMU2_PLL_PC5_CLKDRIVE_CH4_SHIFT 20
  1759. #define PMU2_PLL_PC5_CLKDRIVE_CH5_MASK 0x0f000000
  1760. #define PMU2_PLL_PC5_CLKDRIVE_CH5_SHIFT 24
  1761. #define PMU2_PLL_PC5_CLKDRIVE_CH6_MASK 0xf0000000
  1762. #define PMU2_PLL_PC5_CLKDRIVE_CH6_SHIFT 28
  1763. /* PMU rev 5 (& 6) */
  1764. #define PMU5_PLL_P1P2_OFF 0
  1765. #define PMU5_PLL_P1_MASK 0x0f000000
  1766. #define PMU5_PLL_P1_SHIFT 24
  1767. #define PMU5_PLL_P2_MASK 0x00f00000
  1768. #define PMU5_PLL_P2_SHIFT 20
  1769. #define PMU5_PLL_M14_OFF 1
  1770. #define PMU5_PLL_MDIV_MASK 0x000000ff
  1771. #define PMU5_PLL_MDIV_WIDTH 8
  1772. #define PMU5_PLL_NM5_OFF 2
  1773. #define PMU5_PLL_NDIV_MASK 0xfff00000
  1774. #define PMU5_PLL_NDIV_SHIFT 20
  1775. #define PMU5_PLL_NDIV_MODE_MASK 0x000e0000
  1776. #define PMU5_PLL_NDIV_MODE_SHIFT 17
  1777. #define PMU5_PLL_FMAB_OFF 3
  1778. #define PMU5_PLL_MRAT_MASK 0xf0000000
  1779. #define PMU5_PLL_MRAT_SHIFT 28
  1780. #define PMU5_PLL_ABRAT_MASK 0x08000000
  1781. #define PMU5_PLL_ABRAT_SHIFT 27
  1782. #define PMU5_PLL_FDIV_MASK 0x07ffffff
  1783. #define PMU5_PLL_PLLCTL_OFF 4
  1784. #define PMU5_PLL_PCHI_OFF 5
  1785. #define PMU5_PLL_PCHI_MASK 0x0000003f
  1786. /* pmu XtalFreqRatio */
  1787. #define PMU_XTALFREQ_REG_ILPCTR_MASK 0x00001FFF
  1788. #define PMU_XTALFREQ_REG_MEASURE_MASK 0x80000000
  1789. #define PMU_XTALFREQ_REG_MEASURE_SHIFT 31
  1790. /* Divider allocation in 4716/47162/5356/5357 */
  1791. #define PMU5_MAINPLL_CPU 1
  1792. #define PMU5_MAINPLL_MEM 2
  1793. #define PMU5_MAINPLL_SI 3
  1794. #define PMU7_PLL_PLLCTL7 7
  1795. #define PMU7_PLL_CTL7_M4DIV_MASK 0xff000000
  1796. #define PMU7_PLL_CTL7_M4DIV_SHIFT 24
  1797. #define PMU7_PLL_CTL7_M4DIV_BY_6 6
  1798. #define PMU7_PLL_CTL7_M4DIV_BY_12 0xc
  1799. #define PMU7_PLL_CTL7_M4DIV_BY_24 0x18
  1800. #define PMU7_PLL_PLLCTL8 8
  1801. #define PMU7_PLL_CTL8_M5DIV_MASK 0x000000ff
  1802. #define PMU7_PLL_CTL8_M5DIV_SHIFT 0
  1803. #define PMU7_PLL_CTL8_M5DIV_BY_8 8
  1804. #define PMU7_PLL_CTL8_M5DIV_BY_12 0xc
  1805. #define PMU7_PLL_CTL8_M5DIV_BY_24 0x18
  1806. #define PMU7_PLL_CTL8_M6DIV_MASK 0x0000ff00
  1807. #define PMU7_PLL_CTL8_M6DIV_SHIFT 8
  1808. #define PMU7_PLL_CTL8_M6DIV_BY_12 0xc
  1809. #define PMU7_PLL_CTL8_M6DIV_BY_24 0x18
  1810. #define PMU7_PLL_PLLCTL11 11
  1811. #define PMU7_PLL_PLLCTL11_MASK 0xffffff00
  1812. #define PMU7_PLL_PLLCTL11_VAL 0x22222200
  1813. /* PMU rev 15 */
  1814. #define PMU15_PLL_PLLCTL0 0
  1815. #define PMU15_PLL_PC0_CLKSEL_MASK 0x00000003
  1816. #define PMU15_PLL_PC0_CLKSEL_SHIFT 0
  1817. #define PMU15_PLL_PC0_FREQTGT_MASK 0x003FFFFC
  1818. #define PMU15_PLL_PC0_FREQTGT_SHIFT 2
  1819. #define PMU15_PLL_PC0_PRESCALE_MASK 0x00C00000
  1820. #define PMU15_PLL_PC0_PRESCALE_SHIFT 22
  1821. #define PMU15_PLL_PC0_KPCTRL_MASK 0x07000000
  1822. #define PMU15_PLL_PC0_KPCTRL_SHIFT 24
  1823. #define PMU15_PLL_PC0_FCNTCTRL_MASK 0x38000000
  1824. #define PMU15_PLL_PC0_FCNTCTRL_SHIFT 27
  1825. #define PMU15_PLL_PC0_FDCMODE_MASK 0x40000000
  1826. #define PMU15_PLL_PC0_FDCMODE_SHIFT 30
  1827. #define PMU15_PLL_PC0_CTRLBIAS_MASK 0x80000000
  1828. #define PMU15_PLL_PC0_CTRLBIAS_SHIFT 31
  1829. #define PMU15_PLL_PLLCTL1 1
  1830. #define PMU15_PLL_PC1_BIAS_CTLM_MASK 0x00000060
  1831. #define PMU15_PLL_PC1_BIAS_CTLM_SHIFT 5
  1832. #define PMU15_PLL_PC1_BIAS_CTLM_RST_MASK 0x00000040
  1833. #define PMU15_PLL_PC1_BIAS_CTLM_RST_SHIFT 6
  1834. #define PMU15_PLL_PC1_BIAS_SS_DIVR_MASK 0x0001FF80
  1835. #define PMU15_PLL_PC1_BIAS_SS_DIVR_SHIFT 7
  1836. #define PMU15_PLL_PC1_BIAS_SS_RSTVAL_MASK 0x03FE0000
  1837. #define PMU15_PLL_PC1_BIAS_SS_RSTVAL_SHIFT 17
  1838. #define PMU15_PLL_PC1_BIAS_INTG_BW_MASK 0x0C000000
  1839. #define PMU15_PLL_PC1_BIAS_INTG_BW_SHIFT 26
  1840. #define PMU15_PLL_PC1_BIAS_INTG_BYP_MASK 0x10000000
  1841. #define PMU15_PLL_PC1_BIAS_INTG_BYP_SHIFT 28
  1842. #define PMU15_PLL_PC1_OPENLP_EN_MASK 0x40000000
  1843. #define PMU15_PLL_PC1_OPENLP_EN_SHIFT 30
  1844. #define PMU15_PLL_PLLCTL2 2
  1845. #define PMU15_PLL_PC2_CTEN_MASK 0x00000001
  1846. #define PMU15_PLL_PC2_CTEN_SHIFT 0
  1847. #define PMU15_PLL_PLLCTL3 3
  1848. #define PMU15_PLL_PC3_DITHER_EN_MASK 0x00000001
  1849. #define PMU15_PLL_PC3_DITHER_EN_SHIFT 0
  1850. #define PMU15_PLL_PC3_DCOCTLSP_MASK 0xFE000000
  1851. #define PMU15_PLL_PC3_DCOCTLSP_SHIFT 25
  1852. #define PMU15_PLL_PC3_DCOCTLSP_DIV2EN_MASK 0x01
  1853. #define PMU15_PLL_PC3_DCOCTLSP_DIV2EN_SHIFT 0
  1854. #define PMU15_PLL_PC3_DCOCTLSP_CH0EN_MASK 0x02
  1855. #define PMU15_PLL_PC3_DCOCTLSP_CH0EN_SHIFT 1
  1856. #define PMU15_PLL_PC3_DCOCTLSP_CH1EN_MASK 0x04
  1857. #define PMU15_PLL_PC3_DCOCTLSP_CH1EN_SHIFT 2
  1858. #define PMU15_PLL_PC3_DCOCTLSP_CH0SEL_MASK 0x18
  1859. #define PMU15_PLL_PC3_DCOCTLSP_CH0SEL_SHIFT 3
  1860. #define PMU15_PLL_PC3_DCOCTLSP_CH1SEL_MASK 0x60
  1861. #define PMU15_PLL_PC3_DCOCTLSP_CH1SEL_SHIFT 5
  1862. #define PMU15_PLL_PC3_DCOCTLSP_CHSEL_OUTP_DIV1 0
  1863. #define PMU15_PLL_PC3_DCOCTLSP_CHSEL_OUTP_DIV2 1
  1864. #define PMU15_PLL_PC3_DCOCTLSP_CHSEL_OUTP_DIV3 2
  1865. #define PMU15_PLL_PC3_DCOCTLSP_CHSEL_OUTP_DIV5 3
  1866. #define PMU15_PLL_PLLCTL4 4
  1867. #define PMU15_PLL_PC4_FLLCLK1_DIV_MASK 0x00000007
  1868. #define PMU15_PLL_PC4_FLLCLK1_DIV_SHIFT 0
  1869. #define PMU15_PLL_PC4_FLLCLK2_DIV_MASK 0x00000038
  1870. #define PMU15_PLL_PC4_FLLCLK2_DIV_SHIFT 3
  1871. #define PMU15_PLL_PC4_FLLCLK3_DIV_MASK 0x000001C0
  1872. #define PMU15_PLL_PC4_FLLCLK3_DIV_SHIFT 6
  1873. #define PMU15_PLL_PC4_DBGMODE_MASK 0x00000E00
  1874. #define PMU15_PLL_PC4_DBGMODE_SHIFT 9
  1875. #define PMU15_PLL_PC4_FLL480_CTLSP_LK_MASK 0x00001000
  1876. #define PMU15_PLL_PC4_FLL480_CTLSP_LK_SHIFT 12
  1877. #define PMU15_PLL_PC4_FLL480_CTLSP_MASK 0x000FE000
  1878. #define PMU15_PLL_PC4_FLL480_CTLSP_SHIFT 13
  1879. #define PMU15_PLL_PC4_DINPOL_MASK 0x00100000
  1880. #define PMU15_PLL_PC4_DINPOL_SHIFT 20
  1881. #define PMU15_PLL_PC4_CLKOUT_PD_MASK 0x00200000
  1882. #define PMU15_PLL_PC4_CLKOUT_PD_SHIFT 21
  1883. #define PMU15_PLL_PC4_CLKDIV2_PD_MASK 0x00400000
  1884. #define PMU15_PLL_PC4_CLKDIV2_PD_SHIFT 22
  1885. #define PMU15_PLL_PC4_CLKDIV4_PD_MASK 0x00800000
  1886. #define PMU15_PLL_PC4_CLKDIV4_PD_SHIFT 23
  1887. #define PMU15_PLL_PC4_CLKDIV8_PD_MASK 0x01000000
  1888. #define PMU15_PLL_PC4_CLKDIV8_PD_SHIFT 24
  1889. #define PMU15_PLL_PC4_CLKDIV16_PD_MASK 0x02000000
  1890. #define PMU15_PLL_PC4_CLKDIV16_PD_SHIFT 25
  1891. #define PMU15_PLL_PC4_TEST_EN_MASK 0x04000000
  1892. #define PMU15_PLL_PC4_TEST_EN_SHIFT 26
  1893. #define PMU15_PLL_PLLCTL5 5
  1894. #define PMU15_PLL_PC5_FREQTGT_MASK 0x000FFFFF
  1895. #define PMU15_PLL_PC5_FREQTGT_SHIFT 0
  1896. #define PMU15_PLL_PC5_DCOCTLSP_MASK 0x07F00000
  1897. #define PMU15_PLL_PC5_DCOCTLSP_SHIFT 20
  1898. #define PMU15_PLL_PC5_PRESCALE_MASK 0x18000000
  1899. #define PMU15_PLL_PC5_PRESCALE_SHIFT 27
  1900. #define PMU15_PLL_PLLCTL6 6
  1901. #define PMU15_PLL_PC6_FREQTGT_MASK 0x000FFFFF
  1902. #define PMU15_PLL_PC6_FREQTGT_SHIFT 0
  1903. #define PMU15_PLL_PC6_DCOCTLSP_MASK 0x07F00000
  1904. #define PMU15_PLL_PC6_DCOCTLSP_SHIFT 20
  1905. #define PMU15_PLL_PC6_PRESCALE_MASK 0x18000000
  1906. #define PMU15_PLL_PC6_PRESCALE_SHIFT 27
  1907. #define PMU15_FREQTGT_480_DEFAULT 0x19AB1
  1908. #define PMU15_FREQTGT_492_DEFAULT 0x1A4F5
  1909. #define PMU15_ARM_96MHZ 96000000 /**< 96 Mhz */
  1910. #define PMU15_ARM_98MHZ 98400000 /**< 98.4 Mhz */
  1911. #define PMU15_ARM_97MHZ 97000000 /**< 97 Mhz */
  1912. #define PMU17_PLLCTL2_NDIVTYPE_MASK 0x00000070
  1913. #define PMU17_PLLCTL2_NDIVTYPE_SHIFT 4
  1914. #define PMU17_PLLCTL2_NDIV_MODE_INT 0
  1915. #define PMU17_PLLCTL2_NDIV_MODE_INT1B8 1
  1916. #define PMU17_PLLCTL2_NDIV_MODE_MASH111 2
  1917. #define PMU17_PLLCTL2_NDIV_MODE_MASH111B8 3
  1918. #define PMU17_PLLCTL0_BBPLL_PWRDWN 0
  1919. #define PMU17_PLLCTL0_BBPLL_DRST 3
  1920. #define PMU17_PLLCTL0_BBPLL_DISBL_CLK 8
  1921. /* PLL usage in 4716/47162 */
  1922. #define PMU4716_MAINPLL_PLL0 12
  1923. /* PLL usage in 4335 */
  1924. #define PMU4335_PLL0_PC2_P1DIV_MASK 0x000f0000
  1925. #define PMU4335_PLL0_PC2_P1DIV_SHIFT 16
  1926. #define PMU4335_PLL0_PC2_NDIV_INT_MASK 0xff800000
  1927. #define PMU4335_PLL0_PC2_NDIV_INT_SHIFT 23
  1928. #define PMU4335_PLL0_PC1_MDIV2_MASK 0x0000ff00
  1929. #define PMU4335_PLL0_PC1_MDIV2_SHIFT 8
  1930. /* PLL usage in 4347 */
  1931. #define PMU4347_PLL0_PC2_P1DIV_MASK 0x000f0000
  1932. #define PMU4347_PLL0_PC2_P1DIV_SHIFT 16
  1933. #define PMU4347_PLL0_PC2_NDIV_INT_MASK 0x3ff00000
  1934. #define PMU4347_PLL0_PC2_NDIV_INT_SHIFT 20
  1935. #define PMU4347_PLL0_PC3_NDIV_FRAC_MASK 0x000fffff
  1936. #define PMU4347_PLL0_PC3_NDIV_FRAC_SHIFT 0
  1937. #define PMU4347_PLL1_PC5_P1DIV_MASK 0xc0000000
  1938. #define PMU4347_PLL1_PC5_P1DIV_SHIFT 30
  1939. #define PMU4347_PLL1_PC6_P1DIV_MASK 0x00000003
  1940. #define PMU4347_PLL1_PC6_P1DIV_SHIFT 0
  1941. #define PMU4347_PLL1_PC6_NDIV_INT_MASK 0x00000ffc
  1942. #define PMU4347_PLL1_PC6_NDIV_INT_SHIFT 2
  1943. #define PMU4347_PLL1_PC6_NDIV_FRAC_MASK 0xfffff000
  1944. #define PMU4347_PLL1_PC6_NDIV_FRAC_SHIFT 12
  1945. /* Even though the masks are same as 4347, separate macros are
  1946. created for 4369
  1947. */
  1948. /* PLL usage in 4369 */
  1949. #define PMU4369_PLL0_PC2_PDIV_MASK 0x000f0000
  1950. #define PMU4369_PLL0_PC2_PDIV_SHIFT 16
  1951. #define PMU4369_PLL0_PC2_NDIV_INT_MASK 0x3ff00000
  1952. #define PMU4369_PLL0_PC2_NDIV_INT_SHIFT 20
  1953. #define PMU4369_PLL0_PC3_NDIV_FRAC_MASK 0x000fffff
  1954. #define PMU4369_PLL0_PC3_NDIV_FRAC_SHIFT 0
  1955. #define PMU4369_PLL1_PC5_P1DIV_MASK 0xc0000000
  1956. #define PMU4369_PLL1_PC5_P1DIV_SHIFT 30
  1957. #define PMU4369_PLL1_PC6_P1DIV_MASK 0x00000003
  1958. #define PMU4369_PLL1_PC6_P1DIV_SHIFT 0
  1959. #define PMU4369_PLL1_PC6_NDIV_INT_MASK 0x00000ffc
  1960. #define PMU4369_PLL1_PC6_NDIV_INT_SHIFT 2
  1961. #define PMU4369_PLL1_PC6_NDIV_FRAC_MASK 0xfffff000
  1962. #define PMU4369_PLL1_PC6_NDIV_FRAC_SHIFT 12
  1963. /* 5357 Chip specific ChipControl register bits */
  1964. #define CCTRL5357_EXTPA (1<<14) /* extPA in ChipControl 1, bit 14 */
  1965. #define CCTRL5357_ANT_MUX_2o3 (1<<15) /* 2o3 in ChipControl 1, bit 15 */
  1966. #define CCTRL5357_NFLASH (1<<16) /* Nandflash in ChipControl 1, bit 16 */
  1967. /* 43217 Chip specific ChipControl register bits */
  1968. #define CCTRL43217_EXTPA_C0 (1<<13) /* core0 extPA in ChipControl 1, bit 13 */
  1969. #define CCTRL43217_EXTPA_C1 (1<<8) /* core1 extPA in ChipControl 1, bit 8 */
  1970. /* 43236 resources */
  1971. #define RES43236_REGULATOR 0
  1972. #define RES43236_ILP_REQUEST 1
  1973. #define RES43236_XTAL_PU 2
  1974. #define RES43236_ALP_AVAIL 3
  1975. #define RES43236_SI_PLL_ON 4
  1976. #define RES43236_HT_SI_AVAIL 5
  1977. /* 43236 chip-specific ChipControl register bits */
  1978. #define CCTRL43236_BT_COEXIST (1<<0) /**< 0 disable */
  1979. #define CCTRL43236_SECI (1<<1) /**< 0 SECI is disabled (JATG functional) */
  1980. #define CCTRL43236_EXT_LNA (1<<2) /**< 0 disable */
  1981. #define CCTRL43236_ANT_MUX_2o3 (1<<3) /**< 2o3 mux, chipcontrol bit 3 */
  1982. #define CCTRL43236_GSIO (1<<4) /**< 0 disable */
  1983. /* 43236 Chip specific ChipStatus register bits */
  1984. #define CST43236_SFLASH_MASK 0x00000040
  1985. #define CST43236_OTP_SEL_MASK 0x00000080
  1986. #define CST43236_OTP_SEL_SHIFT 7
  1987. #define CST43236_HSIC_MASK 0x00000100 /**< USB/HSIC */
  1988. #define CST43236_BP_CLK 0x00000200 /**< 120/96Mbps */
  1989. #define CST43236_BOOT_MASK 0x00001800
  1990. #define CST43236_BOOT_SHIFT 11
  1991. #define CST43236_BOOT_FROM_SRAM 0 /**< boot from SRAM, ARM in reset */
  1992. #define CST43236_BOOT_FROM_ROM 1 /**< boot from ROM */
  1993. #define CST43236_BOOT_FROM_FLASH 2 /**< boot from FLASH */
  1994. #define CST43236_BOOT_FROM_INVALID 3
  1995. #define PMU1_PLL0_CHIPCTL0 0
  1996. #define PMU1_PLL0_CHIPCTL1 1
  1997. #define PMU1_PLL0_CHIPCTL2 2
  1998. #define SOCDEVRAM_BP_ADDR 0x1E000000
  1999. #define SOCDEVRAM_ARM_ADDR 0x00800000
  2000. #define PMU_VREG0_I_SR_CNTL_EN_SHIFT 0
  2001. #define PMU_VREG0_DISABLE_PULLD_BT_SHIFT 2
  2002. #define PMU_VREG0_DISABLE_PULLD_WL_SHIFT 3
  2003. #define PMU_VREG0_CBUCKFSW_ADJ_SHIFT 7
  2004. #define PMU_VREG0_CBUCKFSW_ADJ_MASK 0x1F
  2005. #define PMU_VREG0_RAMP_SEL_SHIFT 13
  2006. #define PMU_VREG0_RAMP_SEL_MASK 0x7
  2007. #define PMU_VREG0_VFB_RSEL_SHIFT 17
  2008. #define PMU_VREG0_VFB_RSEL_MASK 3
  2009. #define PMU_VREG4_ADDR 4
  2010. #define PMU_VREG4_CLDO_PWM_SHIFT 4
  2011. #define PMU_VREG4_CLDO_PWM_MASK 0x7
  2012. #define PMU_VREG4_LPLDO1_SHIFT 15
  2013. #define PMU_VREG4_LPLDO1_MASK 0x7
  2014. #define PMU_VREG4_LPLDO1_1p20V 0
  2015. #define PMU_VREG4_LPLDO1_1p15V 1
  2016. #define PMU_VREG4_LPLDO1_1p10V 2
  2017. #define PMU_VREG4_LPLDO1_1p25V 3
  2018. #define PMU_VREG4_LPLDO1_1p05V 4
  2019. #define PMU_VREG4_LPLDO1_1p00V 5
  2020. #define PMU_VREG4_LPLDO1_0p95V 6
  2021. #define PMU_VREG4_LPLDO1_0p90V 7
  2022. /* 4350/4345 VREG4 settings */
  2023. #define PMU4350_VREG4_LPLDO1_1p10V 0
  2024. #define PMU4350_VREG4_LPLDO1_1p15V 1
  2025. #define PMU4350_VREG4_LPLDO1_1p21V 2
  2026. #define PMU4350_VREG4_LPLDO1_1p24V 3
  2027. #define PMU4350_VREG4_LPLDO1_0p90V 4
  2028. #define PMU4350_VREG4_LPLDO1_0p96V 5
  2029. #define PMU4350_VREG4_LPLDO1_1p01V 6
  2030. #define PMU4350_VREG4_LPLDO1_1p04V 7
  2031. #define PMU_VREG4_LPLDO2_LVM_SHIFT 18
  2032. #define PMU_VREG4_LPLDO2_LVM_MASK 0x7
  2033. #define PMU_VREG4_LPLDO2_HVM_SHIFT 21
  2034. #define PMU_VREG4_LPLDO2_HVM_MASK 0x7
  2035. #define PMU_VREG4_LPLDO2_LVM_HVM_MASK 0x3f
  2036. #define PMU_VREG4_LPLDO2_1p00V 0
  2037. #define PMU_VREG4_LPLDO2_1p15V 1
  2038. #define PMU_VREG4_LPLDO2_1p20V 2
  2039. #define PMU_VREG4_LPLDO2_1p10V 3
  2040. #define PMU_VREG4_LPLDO2_0p90V 4 /**< 4 - 7 is 0.90V */
  2041. #define PMU_VREG4_HSICLDO_BYPASS_SHIFT 27
  2042. #define PMU_VREG4_HSICLDO_BYPASS_MASK 0x1
  2043. #define PMU_VREG5_ADDR 5
  2044. #define PMU_VREG5_HSICAVDD_PD_SHIFT 6
  2045. #define PMU_VREG5_HSICAVDD_PD_MASK 0x1
  2046. #define PMU_VREG5_HSICDVDD_PD_SHIFT 11
  2047. #define PMU_VREG5_HSICDVDD_PD_MASK 0x1
  2048. /* 43228 chipstatus reg bits */
  2049. #define CST43228_OTP_PRESENT 0x2
  2050. /* 4360 Chip specific ChipControl register bits */
  2051. #define CCTRL4360_I2C_MODE (1 << 0)
  2052. #define CCTRL4360_UART_MODE (1 << 1)
  2053. #define CCTRL4360_SECI_MODE (1 << 2)
  2054. #define CCTRL4360_BTSWCTRL_MODE (1 << 3)
  2055. #define CCTRL4360_DISCRETE_FEMCTRL_MODE (1 << 4)
  2056. #define CCTRL4360_DIGITAL_PACTRL_MODE (1 << 5)
  2057. #define CCTRL4360_BTSWCTRL_AND_DIGPA_PRESENT (1 << 6)
  2058. #define CCTRL4360_EXTRA_GPIO_MODE (1 << 7)
  2059. #define CCTRL4360_EXTRA_FEMCTRL_MODE (1 << 8)
  2060. #define CCTRL4360_BT_LGCY_MODE (1 << 9)
  2061. #define CCTRL4360_CORE2FEMCTRL4_ON (1 << 21)
  2062. #define CCTRL4360_SECI_ON_GPIO01 (1 << 24)
  2063. /* 4360 Chip specific Regulator Control register bits */
  2064. #define RCTRL4360_RFLDO_PWR_DOWN (1 << 1)
  2065. /* 4360 PMU resources and chip status bits */
  2066. #define RES4360_REGULATOR 0
  2067. #define RES4360_ILP_AVAIL 1
  2068. #define RES4360_ILP_REQ 2
  2069. #define RES4360_XTAL_LDO_PU 3
  2070. #define RES4360_XTAL_PU 4
  2071. #define RES4360_ALP_AVAIL 5
  2072. #define RES4360_BBPLLPWRSW_PU 6
  2073. #define RES4360_HT_AVAIL 7
  2074. #define RES4360_OTP_PU 8
  2075. #define RES4360_AVB_PLL_PWRSW_PU 9
  2076. #define RES4360_PCIE_TL_CLK_AVAIL 10
  2077. #define CST4360_XTAL_40MZ 0x00000001
  2078. #define CST4360_SFLASH 0x00000002
  2079. #define CST4360_SPROM_PRESENT 0x00000004
  2080. #define CST4360_SFLASH_TYPE 0x00000004
  2081. #define CST4360_OTP_ENABLED 0x00000008
  2082. #define CST4360_REMAP_ROM 0x00000010
  2083. #define CST4360_RSRC_INIT_MODE_MASK 0x00000060
  2084. #define CST4360_RSRC_INIT_MODE_SHIFT 5
  2085. #define CST4360_ILP_DIVEN 0x00000080
  2086. #define CST4360_MODE_USB 0x00000100
  2087. #define CST4360_SPROM_SIZE_MASK 0x00000600
  2088. #define CST4360_SPROM_SIZE_SHIFT 9
  2089. #define CST4360_BBPLL_LOCK 0x00000800
  2090. #define CST4360_AVBBPLL_LOCK 0x00001000
  2091. #define CST4360_USBBBPLL_LOCK 0x00002000
  2092. #define CST4360_RSRC_INIT_MODE(cs) ((cs & CST4360_RSRC_INIT_MODE_MASK) >> \
  2093. CST4360_RSRC_INIT_MODE_SHIFT)
  2094. #define CCTRL_4360_UART_SEL 0x2
  2095. #define CST4360_RSRC_INIT_MODE(cs) ((cs & CST4360_RSRC_INIT_MODE_MASK) >> \
  2096. CST4360_RSRC_INIT_MODE_SHIFT)
  2097. #define PMU4360_CC1_GPIO7_OVRD (1<<23) /* GPIO7 override */
  2098. /* 43602 PMU resources based on pmu_params.xls version v0.95 */
  2099. #define RES43602_LPLDO_PU 0
  2100. #define RES43602_REGULATOR 1
  2101. #define RES43602_PMU_SLEEP 2
  2102. #define RES43602_RSVD_3 3
  2103. #define RES43602_XTALLDO_PU 4
  2104. #define RES43602_SERDES_PU 5
  2105. #define RES43602_BBPLL_PWRSW_PU 6
  2106. #define RES43602_SR_CLK_START 7
  2107. #define RES43602_SR_PHY_PWRSW 8
  2108. #define RES43602_SR_SUBCORE_PWRSW 9
  2109. #define RES43602_XTAL_PU 10
  2110. #define RES43602_PERST_OVR 11
  2111. #define RES43602_SR_CLK_STABLE 12
  2112. #define RES43602_SR_SAVE_RESTORE 13
  2113. #define RES43602_SR_SLEEP 14
  2114. #define RES43602_LQ_START 15
  2115. #define RES43602_LQ_AVAIL 16
  2116. #define RES43602_WL_CORE_RDY 17
  2117. #define RES43602_ILP_REQ 18
  2118. #define RES43602_ALP_AVAIL 19
  2119. #define RES43602_RADIO_PU 20
  2120. #define RES43602_RFLDO_PU 21
  2121. #define RES43602_HT_START 22
  2122. #define RES43602_HT_AVAIL 23
  2123. #define RES43602_MACPHY_CLKAVAIL 24
  2124. #define RES43602_PARLDO_PU 25
  2125. #define RES43602_RSVD_26 26
  2126. /* 43602 chip status bits */
  2127. #define CST43602_SPROM_PRESENT (1<<1)
  2128. #define CST43602_SPROM_SIZE (1<<10) /* 0 = 16K, 1 = 4K */
  2129. #define CST43602_BBPLL_LOCK (1<<11)
  2130. #define CST43602_RF_LDO_OUT_OK (1<<15) /* RF LDO output OK */
  2131. #define PMU43602_CC1_GPIO12_OVRD (1<<28) /* GPIO12 override */
  2132. #define PMU43602_CC2_PCIE_CLKREQ_L_WAKE_EN (1<<1) /* creates gated_pcie_wake, pmu_wakeup logic */
  2133. #define PMU43602_CC2_PCIE_PERST_L_WAKE_EN (1<<2) /* creates gated_pcie_wake, pmu_wakeup logic */
  2134. #define PMU43602_CC2_ENABLE_L2REFCLKPAD_PWRDWN (1<<3)
  2135. #define PMU43602_CC2_PMU_WAKE_ALP_AVAIL_EN (1<<5) /* enable pmu_wakeup to request for ALP_AVAIL */
  2136. #define PMU43602_CC2_PERST_L_EXTEND_EN (1<<9) /* extend perst_l until rsc PERST_OVR comes up */
  2137. #define PMU43602_CC2_FORCE_EXT_LPO (1<<19) /* 1=ext LPO clock is the final LPO clock */
  2138. #define PMU43602_CC2_XTAL32_SEL (1<<30) /* 0=ext_clock, 1=xtal */
  2139. #define CC_SR1_43602_SR_ASM_ADDR (0x0)
  2140. /* PLL CTL register values for open loop, used during S/R operation */
  2141. #define PMU43602_PLL_CTL6_VAL 0x68000528
  2142. #define PMU43602_PLL_CTL7_VAL 0x6
  2143. #define PMU43602_CC3_ARMCR4_DBG_CLK (1 << 29)
  2144. /* 4365 PMU resources */
  2145. #define RES4365_REGULATOR_PU 0
  2146. #define RES4365_XTALLDO_PU 1
  2147. #define RES4365_XTAL_PU 2
  2148. #define RES4365_CPU_PLLLDO_PU 3
  2149. #define RES4365_CPU_PLL_PU 4
  2150. #define RES4365_WL_CORE_RDY 5
  2151. #define RES4365_ILP_REQ 6
  2152. #define RES4365_ALP_AVAIL 7
  2153. #define RES4365_HT_AVAIL 8
  2154. #define RES4365_BB_PLLLDO_PU 9
  2155. #define RES4365_BB_PLL_PU 10
  2156. #define RES4365_MINIMU_PU 11
  2157. #define RES4365_RADIO_PU 12
  2158. #define RES4365_MACPHY_CLK_AVAIL 13
  2159. /* 43684 PMU resources */
  2160. #define RES43684_REGULATOR_PU 0
  2161. #define RES43684_PCIE_LDO_BG_PU 1
  2162. #define RES43684_XTAL_LDO_PU 2
  2163. #define RES43684_XTAL_PU 3
  2164. #define RES43684_CPU_PLL_LDO_PU 4
  2165. #define RES43684_CPU_PLL_PU 5
  2166. #define RES43684_WL_CORE_RDY 6
  2167. #define RES43684_ILP_REQ 7
  2168. #define RES43684_ALP_AVAIL 8
  2169. #define RES43684_HT_AVAIL 9
  2170. #define RES43684_BB_PLL_LDO_PU 10
  2171. #define RES43684_BB_PLL_PU 11
  2172. #define RES43684_MINI_PMU_PU 12
  2173. #define RES43684_RADIO_PU 13
  2174. #define RES43684_MACPHY_CLK_AVAIL 14
  2175. #define RES43684_PCIE_LDO_PU 15
  2176. /* 7271 PMU resources */
  2177. #define RES7271_REGULATOR_PU 0
  2178. #define RES7271_WL_CORE_RDY 1
  2179. #define RES7271_ILP_REQ 2
  2180. #define RES7271_ALP_AVAIL 3
  2181. #define RES7271_HT_AVAIL 4
  2182. #define RES7271_BB_PLL_PU 5
  2183. #define RES7271_MINIPMU_PU 6
  2184. #define RES7271_RADIO_PU 7
  2185. #define RES7271_MACPHY_CLK_AVAIL 8
  2186. /* 4349 related */
  2187. #define RES4349_LPLDO_PU 0
  2188. #define RES4349_BG_PU 1
  2189. #define RES4349_PMU_SLEEP 2
  2190. #define RES4349_PALDO3P3_PU 3
  2191. #define RES4349_CBUCK_LPOM_PU 4
  2192. #define RES4349_CBUCK_PFM_PU 5
  2193. #define RES4349_COLD_START_WAIT 6
  2194. #define RES4349_RSVD_7 7
  2195. #define RES4349_LNLDO_PU 8
  2196. #define RES4349_XTALLDO_PU 9
  2197. #define RES4349_LDO3P3_PU 10
  2198. #define RES4349_OTP_PU 11
  2199. #define RES4349_XTAL_PU 12
  2200. #define RES4349_SR_CLK_START 13
  2201. #define RES4349_LQ_AVAIL 14
  2202. #define RES4349_LQ_START 15
  2203. #define RES4349_PERST_OVR 16
  2204. #define RES4349_WL_CORE_RDY 17
  2205. #define RES4349_ILP_REQ 18
  2206. #define RES4349_ALP_AVAIL 19
  2207. #define RES4349_MINI_PMU 20
  2208. #define RES4349_RADIO_PU 21
  2209. #define RES4349_SR_CLK_STABLE 22
  2210. #define RES4349_SR_SAVE_RESTORE 23
  2211. #define RES4349_SR_PHY_PWRSW 24
  2212. #define RES4349_SR_VDDM_PWRSW 25
  2213. #define RES4349_SR_SUBCORE_PWRSW 26
  2214. #define RES4349_SR_SLEEP 27
  2215. #define RES4349_HT_START 28
  2216. #define RES4349_HT_AVAIL 29
  2217. #define RES4349_MACPHY_CLKAVAIL 30
  2218. /* 4373 PMU resources */
  2219. #define RES4373_LPLDO_PU 0
  2220. #define RES4373_BG_PU 1
  2221. #define RES4373_PMU_SLEEP 2
  2222. #define RES4373_PALDO3P3_PU 3
  2223. #define RES4373_CBUCK_LPOM_PU 4
  2224. #define RES4373_CBUCK_PFM_PU 5
  2225. #define RES4373_COLD_START_WAIT 6
  2226. #define RES4373_RSVD_7 7
  2227. #define RES4373_LNLDO_PU 8
  2228. #define RES4373_XTALLDO_PU 9
  2229. #define RES4373_LDO3P3_PU 10
  2230. #define RES4373_OTP_PU 11
  2231. #define RES4373_XTAL_PU 12
  2232. #define RES4373_SR_CLK_START 13
  2233. #define RES4373_LQ_AVAIL 14
  2234. #define RES4373_LQ_START 15
  2235. #define RES4373_PERST_OVR 16
  2236. #define RES4373_WL_CORE_RDY 17
  2237. #define RES4373_ILP_REQ 18
  2238. #define RES4373_ALP_AVAIL 19
  2239. #define RES4373_MINI_PMU 20
  2240. #define RES4373_RADIO_PU 21
  2241. #define RES4373_SR_CLK_STABLE 22
  2242. #define RES4373_SR_SAVE_RESTORE 23
  2243. #define RES4373_SR_PHY_PWRSW 24
  2244. #define RES4373_SR_VDDM_PWRSW 25
  2245. #define RES4373_SR_SUBCORE_PWRSW 26
  2246. #define RES4373_SR_SLEEP 27
  2247. #define RES4373_HT_START 28
  2248. #define RES4373_HT_AVAIL 29
  2249. #define RES4373_MACPHY_CLKAVAIL 30
  2250. /* SR Control0 bits */
  2251. #define CC_SR0_4349_SR_ENG_EN_MASK 0x1
  2252. #define CC_SR0_4349_SR_ENG_EN_SHIFT 0
  2253. #define CC_SR0_4349_SR_ENG_CLK_EN (1 << 1)
  2254. #define CC_SR0_4349_SR_RSRC_TRIGGER (0xC << 2)
  2255. #define CC_SR0_4349_SR_WD_MEM_MIN_DIV (0x3 << 6)
  2256. #define CC_SR0_4349_SR_MEM_STBY_ALLOW_MSK (1 << 16)
  2257. #define CC_SR0_4349_SR_MEM_STBY_ALLOW_SHIFT 16
  2258. #define CC_SR0_4349_SR_ENABLE_ILP (1 << 17)
  2259. #define CC_SR0_4349_SR_ENABLE_ALP (1 << 18)
  2260. #define CC_SR0_4349_SR_ENABLE_HT (1 << 19)
  2261. #define CC_SR0_4349_SR_ALLOW_PIC (3 << 20)
  2262. #define CC_SR0_4349_SR_PMU_MEM_DISABLE (1 << 30)
  2263. /* SR Control0 bits */
  2264. #define CC_SR0_4349_SR_ENG_EN_MASK 0x1
  2265. #define CC_SR0_4349_SR_ENG_EN_SHIFT 0
  2266. #define CC_SR0_4349_SR_ENG_CLK_EN (1 << 1)
  2267. #define CC_SR0_4349_SR_RSRC_TRIGGER (0xC << 2)
  2268. #define CC_SR0_4349_SR_WD_MEM_MIN_DIV (0x3 << 6)
  2269. #define CC_SR0_4349_SR_MEM_STBY_ALLOW (1 << 16)
  2270. #define CC_SR0_4349_SR_ENABLE_ILP (1 << 17)
  2271. #define CC_SR0_4349_SR_ENABLE_ALP (1 << 18)
  2272. #define CC_SR0_4349_SR_ENABLE_HT (1 << 19)
  2273. #define CC_SR0_4349_SR_ALLOW_PIC (3 << 20)
  2274. #define CC_SR0_4349_SR_PMU_MEM_DISABLE (1 << 30)
  2275. /* SR binary offset is at 8K */
  2276. #define CC_SR1_4349_SR_ASM_ADDR (0x10)
  2277. #define CST4349_CHIPMODE_SDIOD(cs) (((cs) & (1 << 6)) != 0) /* SDIO */
  2278. #define CST4349_CHIPMODE_PCIE(cs) (((cs) & (1 << 7)) != 0) /* PCIE */
  2279. #define CST4349_SPROM_PRESENT 0x00000010
  2280. /* 4373 related */
  2281. #define CST4373_CHIPMODE_USB20D(cs) (((cs) & (1 << 8)) != 0) /* USB */
  2282. #define CST4373_CHIPMODE_SDIOD(cs) (((cs) & (1 << 7)) != 0) /* SDIO */
  2283. #define CST4373_CHIPMODE_PCIE(cs) (((cs) & (1 << 6)) != 0) /* PCIE */
  2284. #define CST4373_SFLASH_PRESENT 0x00000010
  2285. #define VREG4_4349_MEMLPLDO_PWRUP_MASK (1 << 31)
  2286. #define VREG4_4349_MEMLPLDO_PWRUP_SHIFT (31)
  2287. #define VREG4_4349_LPLDO1_OUTPUT_VOLT_ADJ_MASK (0x7 << 15)
  2288. #define VREG4_4349_LPLDO1_OUTPUT_VOLT_ADJ_SHIFT (15)
  2289. #define CC2_4349_PHY_PWRSE_RST_CNT_MASK (0xF << 0)
  2290. #define CC2_4349_PHY_PWRSE_RST_CNT_SHIFT (0)
  2291. #define CC2_4349_VDDM_PWRSW_EN_MASK (1 << 20)
  2292. #define CC2_4349_VDDM_PWRSW_EN_SHIFT (20)
  2293. #define CC2_4349_MEMLPLDO_PWRSW_EN_MASK (1 << 21)
  2294. #define CC2_4349_MEMLPLDO_PWRSW_EN_SHIFT (21)
  2295. #define CC2_4349_SDIO_AOS_WAKEUP_MASK (1 << 24)
  2296. #define CC2_4349_SDIO_AOS_WAKEUP_SHIFT (24)
  2297. #define CC2_4349_PMUWAKE_EN_MASK (1 << 31)
  2298. #define CC2_4349_PMUWAKE_EN_SHIFT (31)
  2299. #define CC5_4349_MAC_PHY_CLK_8_DIV (1 << 27)
  2300. #define CC6_4349_PCIE_CLKREQ_WAKEUP_MASK (1 << 4)
  2301. #define CC6_4349_PCIE_CLKREQ_WAKEUP_SHIFT (4)
  2302. #define CC6_4349_PMU_WAKEUP_ALPAVAIL_MASK (1 << 6)
  2303. #define CC6_4349_PMU_WAKEUP_ALPAVAIL_SHIFT (6)
  2304. #define CC6_4349_PMU_EN_EXT_PERST_MASK (1 << 13)
  2305. #define CC6_4349_PMU_EN_L2_DEASSERT_MASK (1 << 14)
  2306. #define CC6_4349_PMU_EN_L2_DEASSERT_SHIF (14)
  2307. #define CC6_4349_PMU_ENABLE_L2REFCLKPAD_PWRDWN (1 << 15)
  2308. #define CC6_4349_PMU_EN_MDIO_MASK (1 << 16)
  2309. #define CC6_4349_PMU_EN_ASSERT_L2_MASK (1 << 25)
  2310. /* 4349 GCI function sel values */
  2311. /*
  2312. * Reference
  2313. * http://hwnbu-twiki.sj.broadcom.com/bin/view/Mwgroup/ToplevelArchitecture4349B0#Function_Sel
  2314. */
  2315. #define CC4349_FNSEL_HWDEF (0)
  2316. #define CC4349_FNSEL_SAMEASPIN (1)
  2317. #define CC4349_FNSEL_GPIO (2)
  2318. #define CC4349_FNSEL_FAST_UART (3)
  2319. #define CC4349_FNSEL_GCI0 (4)
  2320. #define CC4349_FNSEL_GCI1 (5)
  2321. #define CC4349_FNSEL_DGB_UART (6)
  2322. #define CC4349_FNSEL_I2C (7)
  2323. #define CC4349_FNSEL_SPROM (8)
  2324. #define CC4349_FNSEL_MISC0 (9)
  2325. #define CC4349_FNSEL_MISC1 (10)
  2326. #define CC4349_FNSEL_MISC2 (11)
  2327. #define CC4349_FNSEL_IND (12)
  2328. #define CC4349_FNSEL_PDN (13)
  2329. #define CC4349_FNSEL_PUP (14)
  2330. #define CC4349_FNSEL_TRISTATE (15)
  2331. /* 4364 related */
  2332. #define RES4364_LPLDO_PU 0
  2333. #define RES4364_BG_PU 1
  2334. #define RES4364_MEMLPLDO_PU 2
  2335. #define RES4364_PALDO3P3_PU 3
  2336. #define RES4364_CBUCK_1P2 4
  2337. #define RES4364_CBUCK_1V8 5
  2338. #define RES4364_COLD_START_WAIT 6
  2339. #define RES4364_SR_3x3_VDDM_PWRSW 7
  2340. #define RES4364_3x3_MACPHY_CLKAVAIL 8
  2341. #define RES4364_XTALLDO_PU 9
  2342. #define RES4364_LDO3P3_PU 10
  2343. #define RES4364_OTP_PU 11
  2344. #define RES4364_XTAL_PU 12
  2345. #define RES4364_SR_CLK_START 13
  2346. #define RES4364_3x3_RADIO_PU 14
  2347. #define RES4364_RF_LDO 15
  2348. #define RES4364_PERST_OVR 16
  2349. #define RES4364_WL_CORE_RDY 17
  2350. #define RES4364_ILP_REQ 18
  2351. #define RES4364_ALP_AVAIL 19
  2352. #define RES4364_1x1_MINI_PMU 20
  2353. #define RES4364_1x1_RADIO_PU 21
  2354. #define RES4364_SR_CLK_STABLE 22
  2355. #define RES4364_SR_SAVE_RESTORE 23
  2356. #define RES4364_SR_PHY_PWRSW 24
  2357. #define RES4364_SR_VDDM_PWRSW 25
  2358. #define RES4364_SR_SUBCORE_PWRSW 26
  2359. #define RES4364_SR_SLEEP 27
  2360. #define RES4364_HT_START 28
  2361. #define RES4364_HT_AVAIL 29
  2362. #define RES4364_MACPHY_CLKAVAIL 30
  2363. /* 4349 GPIO */
  2364. #define CC4349_PIN_GPIO_00 (0)
  2365. #define CC4349_PIN_GPIO_01 (1)
  2366. #define CC4349_PIN_GPIO_02 (2)
  2367. #define CC4349_PIN_GPIO_03 (3)
  2368. #define CC4349_PIN_GPIO_04 (4)
  2369. #define CC4349_PIN_GPIO_05 (5)
  2370. #define CC4349_PIN_GPIO_06 (6)
  2371. #define CC4349_PIN_GPIO_07 (7)
  2372. #define CC4349_PIN_GPIO_08 (8)
  2373. #define CC4349_PIN_GPIO_09 (9)
  2374. #define CC4349_PIN_GPIO_10 (10)
  2375. #define CC4349_PIN_GPIO_11 (11)
  2376. #define CC4349_PIN_GPIO_12 (12)
  2377. #define CC4349_PIN_GPIO_13 (13)
  2378. #define CC4349_PIN_GPIO_14 (14)
  2379. #define CC4349_PIN_GPIO_15 (15)
  2380. #define CC4349_PIN_GPIO_16 (16)
  2381. #define CC4349_PIN_GPIO_17 (17)
  2382. #define CC4349_PIN_GPIO_18 (18)
  2383. #define CC4349_PIN_GPIO_19 (19)
  2384. /* Mask used to decide whether HOSTWAKE MUX to be performed or not */
  2385. #define MUXENAB4349_HOSTWAKE_MASK (0x000000f0) /* configure GPIO for SDIO host_wake */
  2386. #define MUXENAB4349_HOSTWAKE_SHIFT 4
  2387. #define MUXENAB4349_GETIX(val, name) \
  2388. ((((val) & MUXENAB4349_ ## name ## _MASK) >> MUXENAB4349_ ## name ## _SHIFT) - 1)
  2389. #define CR4_4364_RAM_BASE (0x160000)
  2390. /* SR binary offset is at 8K */
  2391. #define CC_SR1_4364_SR_CORE0_ASM_ADDR (0x10)
  2392. #define CC_SR1_4364_SR_CORE1_ASM_ADDR (0x10)
  2393. #define CC_SR0_4364_SR_ENG_EN_MASK 0x1
  2394. #define CC_SR0_4364_SR_ENG_EN_SHIFT 0
  2395. #define CC_SR0_4364_SR_ENG_CLK_EN (1 << 1)
  2396. #define CC_SR0_4364_SR_RSRC_TRIGGER (0xC << 2)
  2397. #define CC_SR0_4364_SR_WD_MEM_MIN_DIV (0x3 << 6)
  2398. #define CC_SR0_4364_SR_MEM_STBY_ALLOW_MSK (1 << 16)
  2399. #define CC_SR0_4364_SR_MEM_STBY_ALLOW_SHIFT 16
  2400. #define CC_SR0_4364_SR_ENABLE_ILP (1 << 17)
  2401. #define CC_SR0_4364_SR_ENABLE_ALP (1 << 18)
  2402. #define CC_SR0_4364_SR_ENABLE_HT (1 << 19)
  2403. #define CC_SR0_4364_SR_INVERT_CLK (1 << 11)
  2404. #define CC_SR0_4364_SR_ALLOW_PIC (3 << 20)
  2405. #define CC_SR0_4364_SR_PMU_MEM_DISABLE (1 << 30)
  2406. #define PMU_4364_CC1_ENABLE_BBPLL_PWR_DWN (0x1 << 4)
  2407. #define PMU_4364_CC1_BBPLL_ARESET_LQ_TIME (0x1 << 8)
  2408. #define PMU_4364_CC1_BBPLL_ARESET_HT_UPTIME (0x1 << 10)
  2409. #define PMU_4364_CC1_BBPLL_DRESET_LQ_UPTIME (0x1 << 12)
  2410. #define PMU_4364_CC1_BBPLL_DRESET_HT_UPTIME (0x4 << 16)
  2411. #define PMU_4364_CC1_SUBCORE_PWRSW_UP_DELAY (0x8 << 20)
  2412. #define PMU_4364_CC1_SUBCORE_PWRSW_RESET_CNT (0x4 << 24)
  2413. #define PMU_4364_CC2_PHY_PWRSW_RESET_CNT (0x2 << 0)
  2414. #define PMU_4364_CC2_PHY_PWRSW_RESET_MASK (0x7)
  2415. #define PMU_4364_CC2_SEL_CHIPC_IF_FOR_SR (1 << 21)
  2416. #define PMU_4364_CC3_MEMLPLDO3x3_PWRSW_FORCE_MASK (1 << 23)
  2417. #define PMU_4364_CC3_MEMLPLDO1x1_PWRSW_FORCE_MASK (1 << 24)
  2418. #define PMU_4364_CC3_CBUCK1P2_PU_SR_VDDM_REQ_ON (1 << 25)
  2419. #define PMU_4364_CC3_MEMLPLDO3x3_PWRSW_FORCE_OFF (0)
  2420. #define PMU_4364_CC3_MEMLPLDO1x1_PWRSW_FORCE_OFF (0)
  2421. #define PMU_4364_CC5_DISABLE_BBPLL_CLKOUT6_DIV2_MASK (1 << 26)
  2422. #define PMU_4364_CC5_ENABLE_ARMCR4_DEBUG_CLK_MASK (1 << 4)
  2423. #define PMU_4364_CC5_DISABLE_BBPLL_CLKOUT6_DIV2 (1 << 26)
  2424. #define PMU_4364_CC5_ENABLE_ARMCR4_DEBUG_CLK_OFF (0)
  2425. #define PMU_4364_CC6_MDI_RESET_MASK (1 << 16)
  2426. #define PMU_4364_CC6_USE_CLK_REQ_MASK (1 << 18)
  2427. #define PMU_4364_CC6_HIGHER_CLK_REQ_ALP_MASK (1 << 20)
  2428. #define PMU_4364_CC6_HT_AVAIL_REQ_ALP_AVAIL_MASK (1 << 21)
  2429. #define PMU_4364_CC6_PHY_CLK_REQUESTS_ALP_AVAIL_MASK (1 << 22)
  2430. #define PMU_4364_CC6_MDI_RESET (1 << 16)
  2431. #define PMU_4364_CC6_USE_CLK_REQ (1 << 18)
  2432. #define PMU_4364_CC6_HIGHER_CLK_REQ_ALP (1 << 20)
  2433. #define PMU_4364_CC6_HT_AVAIL_REQ_ALP_AVAIL (1 << 21)
  2434. #define PMU_4364_CC6_PHY_CLK_REQUESTS_ALP_AVAIL (1 << 22)
  2435. #define PMU_4364_VREG0_DISABLE_BT_PULL_DOWN (1 << 2)
  2436. #define PMU_4364_VREG1_DISABLE_WL_PULL_DOWN (1 << 2)
  2437. /* Indices of PMU voltage regulator registers */
  2438. #define PMU_VREG_0 (0u)
  2439. #define PMU_VREG_1 (1u)
  2440. #define PMU_VREG_2 (2u)
  2441. #define PMU_VREG_3 (3u)
  2442. #define PMU_VREG_4 (4u)
  2443. #define PMU_VREG_5 (5u)
  2444. #define PMU_VREG_6 (6u)
  2445. #define PMU_VREG_7 (7u)
  2446. #define PMU_VREG_8 (8u)
  2447. #define PMU_VREG_9 (9u)
  2448. #define PMU_VREG_10 (10u)
  2449. #define PMU_VREG_11 (11u)
  2450. #define PMU_VREG_12 (12u)
  2451. #define PMU_VREG_13 (13u)
  2452. #define PMU_VREG_14 (14u)
  2453. #define PMU_VREG_15 (15u)
  2454. #define PMU_VREG_16 (16u)
  2455. /* 43012 Chipcommon ChipStatus bits */
  2456. #define CST43012_FLL_LOCK (1 << 13)
  2457. /* 43012 resources - End */
  2458. /* 43012 related Cbuck modes */
  2459. #define PMU_43012_VREG8_DYNAMIC_CBUCK_MODE0 0x00001c03
  2460. #define PMU_43012_VREG9_DYNAMIC_CBUCK_MODE0 0x00492490
  2461. #define PMU_43012_VREG8_DYNAMIC_CBUCK_MODE1 0x00001c03
  2462. #define PMU_43012_VREG9_DYNAMIC_CBUCK_MODE1 0x00490410
  2463. /* 43012 related dynamic cbuck mode mask */
  2464. #define PMU_43012_VREG8_DYNAMIC_CBUCK_MODE_MASK 0xFFFFFC07
  2465. #define PMU_43012_VREG9_DYNAMIC_CBUCK_MODE_MASK 0xFFFFFFFF
  2466. /* 4369 related VREG masks */
  2467. #define PMU_4369_VREG_5_MISCLDO_POWER_UP_MASK (1u << 11u)
  2468. #define PMU_4369_VREG_5_MISCLDO_POWER_UP_SHIFT 11u
  2469. #define PMU_4369_VREG_5_LPLDO_POWER_UP_MASK (1u << 27u)
  2470. #define PMU_4369_VREG_5_LPLDO_POWER_UP_SHIFT 27u
  2471. #define PMU_4369_VREG_5_MEMLPLDO_OP_VLT_ADJ_CTRL_MASK BCM_MASK32(31, 28)
  2472. #define PMU_4369_VREG_5_MEMLPLDO_OP_VLT_ADJ_CTRL_SHIFT 28u
  2473. #define PMU_4369_VREG_6_MEMLPLDO_POWER_UP_MASK (1u << 3u)
  2474. #define PMU_4369_VREG_6_MEMLPLDO_POWER_UP_SHIFT 3u
  2475. #define PMU_4369_VREG_7_PMU_FORCE_HP_MODE_MASK (1u << 27u)
  2476. #define PMU_4369_VREG_7_PMU_FORCE_HP_MODE_SHIFT 27u
  2477. #define PMU_4369_VREG_7_WL_PMU_LP_MODE_MASK (1u << 28u)
  2478. #define PMU_4369_VREG_7_WL_PMU_LP_MODE_SHIFT 28u
  2479. #define PMU_4369_VREG_7_WL_PMU_LV_MODE_MASK (1u << 29u)
  2480. #define PMU_4369_VREG_7_WL_PMU_LV_MODE_SHIFT 29u
  2481. #define PMU_4369_VREG8_ASR_OVADJ_LPPFM_MASK BCM_MASK32(4, 0)
  2482. #define PMU_4369_VREG8_ASR_OVADJ_LPPFM_SHIFT 0u
  2483. #define PMU_4369_VREG13_RSRC_EN_ASR_MASK4_MASK BCM_MASK32(10, 9)
  2484. #define PMU_4369_VREG13_RSRC_EN_ASR_MASK4_SHIFT 9u
  2485. #define PMU_4369_VREG14_RSRC_EN_CSR_MASK0_MASK (1u << 23u)
  2486. #define PMU_4369_VREG14_RSRC_EN_CSR_MASK0_SHIFT 23u
  2487. #define PMU_4369_VREG16_RSRC0_CBUCK_MODE_MASK BCM_MASK32(2, 0)
  2488. #define PMU_4369_VREG16_RSRC0_CBUCK_MODE_SHIFT 0u
  2489. #define PMU_4369_VREG16_RSRC0_ABUCK_MODE_MASK BCM_MASK32(17, 15)
  2490. #define PMU_4369_VREG16_RSRC0_ABUCK_MODE_SHIFT 15u
  2491. #define PMU_4369_VREG16_RSRC1_ABUCK_MODE_MASK BCM_MASK32(20, 18)
  2492. #define PMU_4369_VREG16_RSRC1_ABUCK_MODE_SHIFT 18u
  2493. /* 4364 related VREG masks */
  2494. #define PMU_4364_VREG3_DISABLE_WPT_REG_ON_PULL_DOWN (1 << 11)
  2495. #define PMU_4364_VREG4_MEMLPLDO_PU_ON (1 << 31)
  2496. #define PMU_4364_VREG4_LPLPDO_ADJ (3 << 16)
  2497. #define PMU_4364_VREG4_LPLPDO_ADJ_MASK (3 << 16)
  2498. #define PMU_4364_VREG5_MAC_CLK_1x1_AUTO (0x1 << 18)
  2499. #define PMU_4364_VREG5_SR_AUTO (0x1 << 20)
  2500. #define PMU_4364_VREG5_BT_PWM_MASK (0x1 << 21)
  2501. #define PMU_4364_VREG5_BT_AUTO (0x1 << 22)
  2502. #define PMU_4364_VREG5_WL2CLB_DVFS_EN_MASK (0x1 << 23)
  2503. #define PMU_4364_VREG5_BT_PWMK (0)
  2504. #define PMU_4364_VREG5_WL2CLB_DVFS_EN (0)
  2505. #define PMU_4364_VREG6_BBPLL_AUTO (0x1 << 17)
  2506. #define PMU_4364_VREG6_MINI_PMU_PWM (0x1 << 18)
  2507. #define PMU_4364_VREG6_LNLDO_AUTO (0x1 << 21)
  2508. #define PMU_4364_VREG6_PCIE_PWRDN_0_AUTO (0x1 << 23)
  2509. #define PMU_4364_VREG6_PCIE_PWRDN_1_AUTO (0x1 << 25)
  2510. #define PMU_4364_VREG6_MAC_CLK_3x3_PWM (0x1 << 27)
  2511. #define PMU_4364_VREG6_ENABLE_FINE_CTRL (0x1 << 30)
  2512. #define PMU_4364_PLL0_DISABLE_CHANNEL6 (0x1 << 18)
  2513. #define CC_GCI1_REG (0x1)
  2514. #define CC_GCI1_4364_IND_STATE_FOR_GPIO9_11 (0x0ccccccc)
  2515. #define CC2_4364_SDIO_AOS_WAKEUP_MASK (1 << 24)
  2516. #define CC2_4364_SDIO_AOS_WAKEUP_SHIFT (24)
  2517. #define CC6_4364_PCIE_CLKREQ_WAKEUP_MASK (1 << 4)
  2518. #define CC6_4364_PCIE_CLKREQ_WAKEUP_SHIFT (4)
  2519. #define CC6_4364_PMU_WAKEUP_ALPAVAIL_MASK (1 << 6)
  2520. #define CC6_4364_PMU_WAKEUP_ALPAVAIL_SHIFT (6)
  2521. #define CST4364_CHIPMODE_SDIOD(cs) (((cs) & (1 << 6)) != 0) /* SDIO */
  2522. #define CST4364_CHIPMODE_PCIE(cs) (((cs) & (1 << 7)) != 0) /* PCIE */
  2523. #define CST4364_SPROM_PRESENT 0x00000010
  2524. #define PMU_4364_MACCORE_0_RES_REQ_MASK 0x3FCBF7FF
  2525. #define PMU_4364_MACCORE_1_RES_REQ_MASK 0x7FFB3647
  2526. #define PMU_4364_RSDB_MODE (0)
  2527. #define PMU_4364_1x1_MODE (1)
  2528. #define PMU_4364_3x3_MODE (2)
  2529. #define PMU_4364_MAX_MASK_1x1 (0x7FFF3E47)
  2530. #define PMU_4364_MAX_MASK_RSDB (0x7FFFFFFF)
  2531. #define PMU_4364_MAX_MASK_3x3 (0x3FCFFFFF)
  2532. #define PMU_4364_SAVE_RESTORE_UPDNTIME_1x1 (0xC000C)
  2533. #define PMU_4364_SAVE_RESTORE_UPDNTIME_3x3 (0xF000F)
  2534. #define FORCE_CLK_ON 1
  2535. #define FORCE_CLK_OFF 0
  2536. #define PMU1_PLL0_SWITCH_MACCLOCK_120MHZ (0)
  2537. #define PMU1_PLL0_SWITCH_MACCLOCK_160MHZ (1)
  2538. #define TSF_CLK_FRAC_L_4364_120MHZ 0x8889
  2539. #define TSF_CLK_FRAC_H_4364_120MHZ 0x8
  2540. #define TSF_CLK_FRAC_L_4364_160MHZ 0x6666
  2541. #define TSF_CLK_FRAC_H_4364_160MHZ 0x6
  2542. #define PMU1_PLL0_PC1_M2DIV_VALUE_120MHZ 8
  2543. #define PMU1_PLL0_PC1_M2DIV_VALUE_160MHZ 6
  2544. /* 4347/4369 Related */
  2545. /*
  2546. * PMU VREG Definitions:
  2547. * http://confluence.broadcom.com/display/WLAN/BCM4347+PMU+Vreg+Control+Register
  2548. * http://confluence.broadcom.com/display/WLAN/BCM4369+PMU+Vreg+Control+Register
  2549. */
  2550. /* PMU VREG4 */
  2551. #define PMU_28NM_VREG4_WL_LDO_CNTL_EN (0x1 << 10)
  2552. /* PMU VREG6 */
  2553. #define PMU_28NM_VREG6_BTLDO3P3_PU (0x1 << 12)
  2554. /* PMU resources */
  2555. #define RES4347_MEMLPLDO_PU 0
  2556. #define RES4347_AAON 1
  2557. #define RES4347_PMU_SLEEP 2
  2558. #define RES4347_RESERVED_3 3
  2559. #define RES4347_LDO3P3_PU 4
  2560. #define RES4347_FAST_LPO_AVAIL 5
  2561. #define RES4347_XTAL_PU 6
  2562. #define RES4347_XTAL_STABLE 7
  2563. #define RES4347_PWRSW_DIG 8
  2564. #define RES4347_SR_DIG 9
  2565. #define RES4347_SLEEP_DIG 10
  2566. #define RES4347_PWRSW_AUX 11
  2567. #define RES4347_SR_AUX 12
  2568. #define RES4347_SLEEP_AUX 13
  2569. #define RES4347_PWRSW_MAIN 14
  2570. #define RES4347_SR_MAIN 15
  2571. #define RES4347_SLEEP_MAIN 16
  2572. #define RES4347_CORE_RDY_DIG 17
  2573. #define RES4347_CORE_RDY_AUX 18
  2574. #define RES4347_ALP_AVAIL 19
  2575. #define RES4347_RADIO_AUX_PU 20
  2576. #define RES4347_MINIPMU_AUX_PU 21
  2577. #define RES4347_CORE_RDY_MAIN 22
  2578. #define RES4347_RADIO_MAIN_PU 23
  2579. #define RES4347_MINIPMU_MAIN_PU 24
  2580. #define RES4347_PCIE_EP_PU 25
  2581. #define RES4347_COLD_START_WAIT 26
  2582. #define RES4347_ARMHTAVAIL 27
  2583. #define RES4347_HT_AVAIL 28
  2584. #define RES4347_MACPHY_AUX_CLK_AVAIL 29
  2585. #define RES4347_MACPHY_MAIN_CLK_AVAIL 30
  2586. #define RES4347_RESERVED_31 31
  2587. /* 4369 PMU Resources */
  2588. #define RES4369_DUMMY 0
  2589. #define RES4369_ABUCK 1
  2590. #define RES4369_PMU_SLEEP 2
  2591. #define RES4369_MISCLDO 3
  2592. #define RES4369_LDO3P3 4
  2593. #define RES4369_FAST_LPO_AVAIL 5
  2594. #define RES4369_XTAL_PU 6
  2595. #define RES4369_XTAL_STABLE 7
  2596. #define RES4369_PWRSW_DIG 8
  2597. #define RES4369_SR_DIG 9
  2598. #define RES4369_SLEEP_DIG 10
  2599. #define RES4369_PWRSW_AUX 11
  2600. #define RES4369_SR_AUX 12
  2601. #define RES4369_SLEEP_AUX 13
  2602. #define RES4369_PWRSW_MAIN 14
  2603. #define RES4369_SR_MAIN 15
  2604. #define RES4369_SLEEP_MAIN 16
  2605. #define RES4369_DIG_CORE_RDY 17
  2606. #define RES4369_CORE_RDY_AUX 18
  2607. #define RES4369_ALP_AVAIL 19
  2608. #define RES4369_RADIO_AUX_PU 20
  2609. #define RES4369_MINIPMU_AUX_PU 21
  2610. #define RES4369_CORE_RDY_MAIN 22
  2611. #define RES4369_RADIO_MAIN_PU 23
  2612. #define RES4369_MINIPMU_MAIN_PU 24
  2613. #define RES4369_PCIE_EP_PU 25
  2614. #define RES4369_COLD_START_WAIT 26
  2615. #define RES4369_ARMHTAVAIL 27
  2616. #define RES4369_HT_AVAIL 28
  2617. #define RES4369_MACPHY_AUX_CLK_AVAIL 29
  2618. #define RES4369_MACPHY_MAIN_CLK_AVAIL 30
  2619. /* chip status */
  2620. #define CST4347_CHIPMODE_SDIOD(cs) (((cs) & (1 << 6)) != 0) /* SDIO */
  2621. #define CST4347_CHIPMODE_PCIE(cs) (((cs) & (1 << 7)) != 0) /* PCIE */
  2622. #define CST4347_JTAG_STRAP_ENABLED(cs) (((cs) & (1 << 20)) != 0) /* JTAG strap st */
  2623. #define CST4347_SPROM_PRESENT 0x00000010
  2624. /* GCI chip status */
  2625. #define GCI_CS_4347_FLL1MHZ_LOCK_MASK (1 << 1)
  2626. /* GCI chip control registers */
  2627. #define GCI_CC7_AAON_BYPASS_PWRSW_SEL 13
  2628. #define GCI_CC7_AAON_BYPASS_PWRSW_SEQ_ON 14
  2629. /* PMU chip control registers */
  2630. #define CC2_4347_VASIP_MEMLPLDO_VDDB_OFF_MASK (1 << 11)
  2631. #define CC2_4347_VASIP_MEMLPLDO_VDDB_OFF_SHIFT 11
  2632. #define CC2_4347_MAIN_MEMLPLDO_VDDB_OFF_MASK (1 << 12)
  2633. #define CC2_4347_MAIN_MEMLPLDO_VDDB_OFF_SHIFT 12
  2634. #define CC2_4347_AUX_MEMLPLDO_VDDB_OFF_MASK (1 << 13)
  2635. #define CC2_4347_AUX_MEMLPLDO_VDDB_OFF_SHIFT 13
  2636. #define CC2_4347_VASIP_VDDRET_ON_MASK (1 << 14)
  2637. #define CC2_4347_VASIP_VDDRET_ON_SHIFT 14
  2638. #define CC2_4347_MAIN_VDDRET_ON_MASK (1 << 15)
  2639. #define CC2_4347_MAIN_VDDRET_ON_SHIFT 15
  2640. #define CC2_4347_AUX_VDDRET_ON_MASK (1 << 16)
  2641. #define CC2_4347_AUX_VDDRET_ON_SHIFT 16
  2642. #define CC2_4347_GCI2WAKE_MASK (1 << 31)
  2643. #define CC2_4347_GCI2WAKE_SHIFT 31
  2644. #define CC2_4347_SDIO_AOS_WAKEUP_MASK (1 << 24)
  2645. #define CC2_4347_SDIO_AOS_WAKEUP_SHIFT 24
  2646. #define CC4_4347_LHL_TIMER_SELECT (1 << 0)
  2647. #define CC6_4347_PWROK_WDT_EN_IN_MASK (1 << 6)
  2648. #define CC6_4347_PWROK_WDT_EN_IN_SHIFT 6
  2649. #define CC6_4347_SDIO_AOS_CHIP_WAKEUP_MASK (1 << 24)
  2650. #define CC6_4347_SDIO_AOS_CHIP_WAKEUP_SHIFT 24
  2651. #define PCIE_GPIO1_GPIO_PIN CC_GCI_GPIO_0
  2652. #define PCIE_PERST_GPIO_PIN CC_GCI_GPIO_1
  2653. #define PCIE_CLKREQ_GPIO_PIN CC_GCI_GPIO_2
  2654. #define VREG5_4347_MEMLPLDO_ADJ_MASK 0xF0000000
  2655. #define VREG5_4347_MEMLPLDO_ADJ_SHIFT 28
  2656. #define VREG5_4347_LPLDO_ADJ_MASK 0x00F00000
  2657. #define VREG5_4347_LPLDO_ADJ_SHIFT 20
  2658. /* lpldo/memlpldo voltage */
  2659. #define PMU_VREG5_LPLDO_VOLT_0_88 0xf /* 0.88v */
  2660. #define PMU_VREG5_LPLDO_VOLT_0_86 0xe /* 0.86v */
  2661. #define PMU_VREG5_LPLDO_VOLT_0_84 0xd /* 0.84v */
  2662. #define PMU_VREG5_LPLDO_VOLT_0_82 0xc /* 0.82v */
  2663. #define PMU_VREG5_LPLDO_VOLT_0_80 0xb /* 0.80v */
  2664. #define PMU_VREG5_LPLDO_VOLT_0_78 0xa /* 0.78v */
  2665. #define PMU_VREG5_LPLDO_VOLT_0_76 0x9 /* 0.76v */
  2666. #define PMU_VREG5_LPLDO_VOLT_0_74 0x8 /* 0.74v */
  2667. #define PMU_VREG5_LPLDO_VOLT_0_72 0x7 /* 0.72v */
  2668. #define PMU_VREG5_LPLDO_VOLT_1_10 0x6 /* 1.10v */
  2669. #define PMU_VREG5_LPLDO_VOLT_1_00 0x5 /* 1.00v */
  2670. #define PMU_VREG5_LPLDO_VOLT_0_98 0x4 /* 0.98v */
  2671. #define PMU_VREG5_LPLDO_VOLT_0_96 0x3 /* 0.96v */
  2672. #define PMU_VREG5_LPLDO_VOLT_0_94 0x2 /* 0.94v */
  2673. #define PMU_VREG5_LPLDO_VOLT_0_92 0x1 /* 0.92v */
  2674. #define PMU_VREG5_LPLDO_VOLT_0_90 0x0 /* 0.90v */
  2675. /* Save/Restore engine */
  2676. #define BM_ADDR_TO_SR_ADDR(bmaddr) ((bmaddr) >> 9)
  2677. /* Txfifo is 512KB for main core and 128KB for aux core
  2678. * We use first 12kB (0x3000) in BMC buffer for template in main core and
  2679. * 6.5kB (0x1A00) in aux core, followed by ASM code
  2680. */
  2681. #define SR_ASM_ADDR_MAIN_4347 (0x18)
  2682. #define SR_ASM_ADDR_AUX_4347 (0xd)
  2683. #define SR_ASM_ADDR_DIG_4347 (0x0)
  2684. #define SR_ASM_ADDR_MAIN_4369 BM_ADDR_TO_SR_ADDR(0xC00)
  2685. #define SR_ASM_ADDR_AUX_4369 BM_ADDR_TO_SR_ADDR(0xC00)
  2686. #define SR_ASM_ADDR_DIG_4369 (0x0)
  2687. /* 512 bytes block */
  2688. #define SR_ASM_ADDR_BLK_SIZE_SHIFT 9
  2689. /* SR Control0 bits */
  2690. #define SR0_SR_ENG_EN_MASK 0x1
  2691. #define SR0_SR_ENG_EN_SHIFT 0
  2692. #define SR0_SR_ENG_CLK_EN (1 << 1)
  2693. #define SR0_RSRC_TRIGGER (0xC << 2)
  2694. #define SR0_WD_MEM_MIN_DIV (0x3 << 6)
  2695. #define SR0_INVERT_SR_CLK (1 << 11)
  2696. #define SR0_MEM_STBY_ALLOW (1 << 16)
  2697. #define SR0_ENABLE_SR_ILP (1 << 17)
  2698. #define SR0_ENABLE_SR_ALP (1 << 18)
  2699. #define SR0_ENABLE_SR_HT (1 << 19)
  2700. #define SR0_ALLOW_PIC (3 << 20)
  2701. #define SR0_ENB_PMU_MEM_DISABLE (1 << 30)
  2702. /* SR Control0 bits for 4369 */
  2703. #define SR0_4369_SR_ENG_EN_MASK 0x1
  2704. #define SR0_4369_SR_ENG_EN_SHIFT 0
  2705. #define SR0_4369_SR_ENG_CLK_EN (1 << 1)
  2706. #define SR0_4369_RSRC_TRIGGER (0xC << 2)
  2707. #define SR0_4369_WD_MEM_MIN_DIV (0x2 << 6)
  2708. #define SR0_4369_INVERT_SR_CLK (1 << 11)
  2709. #define SR0_4369_MEM_STBY_ALLOW (1 << 16)
  2710. #define SR0_4369_ENABLE_SR_ILP (1 << 17)
  2711. #define SR0_4369_ENABLE_SR_ALP (1 << 18)
  2712. #define SR0_4369_ENABLE_SR_HT (1 << 19)
  2713. #define SR0_4369_ALLOW_PIC (3 << 20)
  2714. #define SR0_4369_ENB_PMU_MEM_DISABLE (1 << 30)
  2715. /* =========== LHL regs =========== */
  2716. /* 4369 LHL register settings */
  2717. #define LHL4369_UP_CNT 0
  2718. #define LHL4369_DN_CNT 2
  2719. #define LHL4369_PWRSW_EN_DWN_CNT (LHL4369_DN_CNT + 2)
  2720. #define LHL4369_ISO_EN_DWN_CNT (LHL4369_PWRSW_EN_DWN_CNT + 3)
  2721. #define LHL4369_SLB_EN_DWN_CNT (LHL4369_ISO_EN_DWN_CNT + 1)
  2722. #define LHL4369_ASR_CLK4M_DIS_DWN_CNT (LHL4369_DN_CNT)
  2723. #define LHL4369_ASR_LPPFM_MODE_DWN_CNT (LHL4369_DN_CNT)
  2724. #define LHL4369_ASR_MODE_SEL_DWN_CNT (LHL4369_DN_CNT)
  2725. #define LHL4369_ASR_MANUAL_MODE_DWN_CNT (LHL4369_DN_CNT)
  2726. #define LHL4369_ASR_ADJ_DWN_CNT (LHL4369_DN_CNT)
  2727. #define LHL4369_ASR_OVERI_DIS_DWN_CNT (LHL4369_DN_CNT)
  2728. #define LHL4369_ASR_TRIM_ADJ_DWN_CNT (LHL4369_DN_CNT)
  2729. #define LHL4369_VDDC_SW_DIS_DWN_CNT (LHL4369_SLB_EN_DWN_CNT + 1)
  2730. #define LHL4369_VMUX_ASR_SEL_DWN_CNT (LHL4369_VDDC_SW_DIS_DWN_CNT + 1)
  2731. #define LHL4369_CSR_ADJ_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2732. #define LHL4369_CSR_MODE_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2733. #define LHL4369_CSR_OVERI_DIS_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2734. #define LHL4369_HPBG_CHOP_DIS_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2735. #define LHL4369_SRBG_REF_SEL_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2736. #define LHL4369_PFM_PWR_SLICE_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2737. #define LHL4369_CSR_TRIM_ADJ_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2738. #define LHL4369_CSR_VOLTAGE_DWN_CNT (LHL4369_VMUX_ASR_SEL_DWN_CNT + 1)
  2739. #define LHL4369_HPBG_PU_EN_DWN_CNT (LHL4369_CSR_MODE_DWN_CNT + 1)
  2740. #define LHL4369_HPBG_PU_EN_UP_CNT (LHL4369_UP_CNT + 1)
  2741. #define LHL4369_CSR_ADJ_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2742. #define LHL4369_CSR_MODE_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2743. #define LHL4369_CSR_OVERI_DIS_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2744. #define LHL4369_HPBG_CHOP_DIS_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2745. #define LHL4369_SRBG_REF_SEL_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2746. #define LHL4369_PFM_PWR_SLICE_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2747. #define LHL4369_CSR_TRIM_ADJ_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2748. #define LHL4369_CSR_VOLTAGE_UP_CNT (LHL4369_HPBG_PU_EN_UP_CNT + 1)
  2749. #define LHL4369_VMUX_ASR_SEL_UP_CNT (LHL4369_CSR_MODE_UP_CNT + 1)
  2750. #define LHL4369_VDDC_SW_DIS_UP_CNT (LHL4369_VMUX_ASR_SEL_UP_CNT + 1)
  2751. #define LHL4369_SLB_EN_UP_CNT (LHL4369_VDDC_SW_DIS_UP_CNT + 8)
  2752. #define LHL4369_ISO_EN_UP_CNT (LHL4369_SLB_EN_UP_CNT + 1)
  2753. #define LHL4369_PWRSW_EN_UP_CNT (LHL4369_ISO_EN_UP_CNT + 3)
  2754. #define LHL4369_ASR_ADJ_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2755. #define LHL4369_ASR_CLK4M_DIS_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2756. #define LHL4369_ASR_LPPFM_MODE_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2757. #define LHL4369_ASR_MODE_SEL_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2758. #define LHL4369_ASR_MANUAL_MODE_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2759. #define LHL4369_ASR_OVERI_DIS_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2760. #define LHL4369_ASR_TRIM_ADJ_UP_CNT (LHL4369_PWRSW_EN_UP_CNT + 1)
  2761. /* MacResourceReqTimer0/1 */
  2762. #define MAC_RSRC_REQ_TIMER_INT_ENAB_SHIFT 24
  2763. #define MAC_RSRC_REQ_TIMER_FORCE_ALP_SHIFT 26
  2764. #define MAC_RSRC_REQ_TIMER_FORCE_HT_SHIFT 27
  2765. #define MAC_RSRC_REQ_TIMER_FORCE_HQ_SHIFT 28
  2766. #define MAC_RSRC_REQ_TIMER_CLKREQ_GRP_SEL_SHIFT 29
  2767. /* for pmu rev32 and higher */
  2768. #define PMU32_MAC_MAIN_RSRC_REQ_TIMER ((1 << MAC_RSRC_REQ_TIMER_INT_ENAB_SHIFT) | \
  2769. (1 << MAC_RSRC_REQ_TIMER_FORCE_ALP_SHIFT) | \
  2770. (1 << MAC_RSRC_REQ_TIMER_FORCE_HT_SHIFT) | \
  2771. (1 << MAC_RSRC_REQ_TIMER_FORCE_HQ_SHIFT) | \
  2772. (0 << MAC_RSRC_REQ_TIMER_CLKREQ_GRP_SEL_SHIFT))
  2773. #define PMU32_MAC_AUX_RSRC_REQ_TIMER ((1 << MAC_RSRC_REQ_TIMER_INT_ENAB_SHIFT) | \
  2774. (1 << MAC_RSRC_REQ_TIMER_FORCE_ALP_SHIFT) | \
  2775. (1 << MAC_RSRC_REQ_TIMER_FORCE_HT_SHIFT) | \
  2776. (1 << MAC_RSRC_REQ_TIMER_FORCE_HQ_SHIFT) | \
  2777. (0 << MAC_RSRC_REQ_TIMER_CLKREQ_GRP_SEL_SHIFT))
  2778. /* 4369 related: 4369 parameters
  2779. * http://www.sj.broadcom.com/projects/BCM4369/gallery_backend.RC6.0/design/backplane/pmu_params.xls
  2780. */
  2781. #define RES4369_DUMMY 0
  2782. #define RES4369_ABUCK 1
  2783. #define RES4369_PMU_SLEEP 2
  2784. #define RES4369_MISCLDO_PU 3
  2785. #define RES4369_LDO3P3_PU 4
  2786. #define RES4369_FAST_LPO_AVAIL 5
  2787. #define RES4369_XTAL_PU 6
  2788. #define RES4369_XTAL_STABLE 7
  2789. #define RES4369_PWRSW_DIG 8
  2790. #define RES4369_SR_DIG 9
  2791. #define RES4369_SLEEP_DIG 10
  2792. #define RES4369_PWRSW_AUX 11
  2793. #define RES4369_SR_AUX 12
  2794. #define RES4369_SLEEP_AUX 13
  2795. #define RES4369_PWRSW_MAIN 14
  2796. #define RES4369_SR_MAIN 15
  2797. #define RES4369_SLEEP_MAIN 16
  2798. #define RES4369_DIG_CORE_RDY 17
  2799. #define RES4369_CORE_RDY_AUX 18
  2800. #define RES4369_ALP_AVAIL 19
  2801. #define RES4369_RADIO_AUX_PU 20
  2802. #define RES4369_MINIPMU_AUX_PU 21
  2803. #define RES4369_CORE_RDY_MAIN 22
  2804. #define RES4369_RADIO_MAIN_PU 23
  2805. #define RES4369_MINIPMU_MAIN_PU 24
  2806. #define RES4369_PCIE_EP_PU 25
  2807. #define RES4369_COLD_START_WAIT 26
  2808. #define RES4369_ARMHTAVAIL 27
  2809. #define RES4369_HT_AVAIL 28
  2810. #define RES4369_MACPHY_AUX_CLK_AVAIL 29
  2811. #define RES4369_MACPHY_MAIN_CLK_AVAIL 30
  2812. #define RES4369_RESERVED_31 31
  2813. #define CST4369_CHIPMODE_SDIOD(cs) (((cs) & (1 << 6)) != 0) /* SDIO */
  2814. #define CST4369_CHIPMODE_PCIE(cs) (((cs) & (1 << 7)) != 0) /* PCIE */
  2815. #define CST4369_SPROM_PRESENT 0x00000010
  2816. #define PMU_4369_MACCORE_0_RES_REQ_MASK 0x3FCBF7FF
  2817. #define PMU_4369_MACCORE_1_RES_REQ_MASK 0x7FFB3647
  2818. /* 43430 PMU resources based on pmu_params.xls */
  2819. #define RES43430_LPLDO_PU 0
  2820. #define RES43430_BG_PU 1
  2821. #define RES43430_PMU_SLEEP 2
  2822. #define RES43430_RSVD_3 3
  2823. #define RES43430_CBUCK_LPOM_PU 4
  2824. #define RES43430_CBUCK_PFM_PU 5
  2825. #define RES43430_COLD_START_WAIT 6
  2826. #define RES43430_RSVD_7 7
  2827. #define RES43430_LNLDO_PU 8
  2828. #define RES43430_RSVD_9 9
  2829. #define RES43430_LDO3P3_PU 10
  2830. #define RES43430_OTP_PU 11
  2831. #define RES43430_XTAL_PU 12
  2832. #define RES43430_SR_CLK_START 13
  2833. #define RES43430_LQ_AVAIL 14
  2834. #define RES43430_LQ_START 15
  2835. #define RES43430_RSVD_16 16
  2836. #define RES43430_WL_CORE_RDY 17
  2837. #define RES43430_ILP_REQ 18
  2838. #define RES43430_ALP_AVAIL 19
  2839. #define RES43430_MINI_PMU 20
  2840. #define RES43430_RADIO_PU 21
  2841. #define RES43430_SR_CLK_STABLE 22
  2842. #define RES43430_SR_SAVE_RESTORE 23
  2843. #define RES43430_SR_PHY_PWRSW 24
  2844. #define RES43430_SR_VDDM_PWRSW 25
  2845. #define RES43430_SR_SUBCORE_PWRSW 26
  2846. #define RES43430_SR_SLEEP 27
  2847. #define RES43430_HT_START 28
  2848. #define RES43430_HT_AVAIL 29
  2849. #define RES43430_MACPHY_CLK_AVAIL 30
  2850. /* 43430 chip status bits */
  2851. #define CST43430_SDIO_MODE 0x00000001
  2852. #define CST43430_GSPI_MODE 0x00000002
  2853. #define CST43430_RSRC_INIT_MODE_0 0x00000080
  2854. #define CST43430_RSRC_INIT_MODE_1 0x00000100
  2855. #define CST43430_SEL0_SDIO 0x00000200
  2856. #define CST43430_SEL1_SDIO 0x00000400
  2857. #define CST43430_SEL2_SDIO 0x00000800
  2858. #define CST43430_BBPLL_LOCKED 0x00001000
  2859. #define CST43430_DBG_INST_DETECT 0x00004000
  2860. #define CST43430_CLB2WL_BT_READY 0x00020000
  2861. #define CST43430_JTAG_MODE 0x00100000
  2862. #define CST43430_HOST_IFACE 0x00400000
  2863. #define CST43430_TRIM_EN 0x00800000
  2864. #define CST43430_DIN_PACKAGE_OPTION 0x10000000
  2865. #define PMU43430_PLL0_PC2_P1DIV_MASK 0x0000000f
  2866. #define PMU43430_PLL0_PC2_P1DIV_SHIFT 0
  2867. #define PMU43430_PLL0_PC2_NDIV_INT_MASK 0x0000ff80
  2868. #define PMU43430_PLL0_PC2_NDIV_INT_SHIFT 7
  2869. #define PMU43430_PLL0_PC4_MDIV2_MASK 0x0000ff00
  2870. #define PMU43430_PLL0_PC4_MDIV2_SHIFT 8
  2871. /* 43430 chip SR definitions */
  2872. #define SRAM_43430_SR_ASM_ADDR 0x7f800
  2873. #define CC_SR1_43430_SR_ASM_ADDR ((SRAM_43430_SR_ASM_ADDR - 0x60000) >> 8)
  2874. /* 43430 PMU Chip Control bits */
  2875. #define CC2_43430_SDIO_AOS_WAKEUP_MASK (1 << 24)
  2876. #define CC2_43430_SDIO_AOS_WAKEUP_SHIFT (24)
  2877. #define PMU_MACCORE_0_RES_REQ_TIMER 0x1d000000
  2878. #define PMU_MACCORE_0_RES_REQ_MASK 0x5FF2364F
  2879. #define PMU43012_MAC_RES_REQ_TIMER 0x1D000000
  2880. #define PMU43012_MAC_RES_REQ_MASK 0x3FBBF7FF
  2881. #define PMU_MACCORE_1_RES_REQ_TIMER 0x1d000000
  2882. #define PMU_MACCORE_1_RES_REQ_MASK 0x5FF2364F
  2883. /* defines to detect active host interface in use */
  2884. #define CHIP_HOSTIF_PCIEMODE 0x1
  2885. #define CHIP_HOSTIF_USBMODE 0x2
  2886. #define CHIP_HOSTIF_SDIOMODE 0x4
  2887. #define CHIP_HOSTIF_PCIE(sih) (si_chip_hostif(sih) == CHIP_HOSTIF_PCIEMODE)
  2888. #define CHIP_HOSTIF_USB(sih) (si_chip_hostif(sih) == CHIP_HOSTIF_USBMODE)
  2889. #define CHIP_HOSTIF_SDIO(sih) (si_chip_hostif(sih) == CHIP_HOSTIF_SDIOMODE)
  2890. /* 4335 resources */
  2891. #define RES4335_LPLDO_PO 0
  2892. #define RES4335_PMU_BG_PU 1
  2893. #define RES4335_PMU_SLEEP 2
  2894. #define RES4335_RSVD_3 3
  2895. #define RES4335_CBUCK_LPOM_PU 4
  2896. #define RES4335_CBUCK_PFM_PU 5
  2897. #define RES4335_RSVD_6 6
  2898. #define RES4335_RSVD_7 7
  2899. #define RES4335_LNLDO_PU 8
  2900. #define RES4335_XTALLDO_PU 9
  2901. #define RES4335_LDO3P3_PU 10
  2902. #define RES4335_OTP_PU 11
  2903. #define RES4335_XTAL_PU 12
  2904. #define RES4335_SR_CLK_START 13
  2905. #define RES4335_LQ_AVAIL 14
  2906. #define RES4335_LQ_START 15
  2907. #define RES4335_RSVD_16 16
  2908. #define RES4335_WL_CORE_RDY 17
  2909. #define RES4335_ILP_REQ 18
  2910. #define RES4335_ALP_AVAIL 19
  2911. #define RES4335_MINI_PMU 20
  2912. #define RES4335_RADIO_PU 21
  2913. #define RES4335_SR_CLK_STABLE 22
  2914. #define RES4335_SR_SAVE_RESTORE 23
  2915. #define RES4335_SR_PHY_PWRSW 24
  2916. #define RES4335_SR_VDDM_PWRSW 25
  2917. #define RES4335_SR_SUBCORE_PWRSW 26
  2918. #define RES4335_SR_SLEEP 27
  2919. #define RES4335_HT_START 28
  2920. #define RES4335_HT_AVAIL 29
  2921. #define RES4335_MACPHY_CLKAVAIL 30
  2922. /* 4335 Chip specific ChipStatus register bits */
  2923. #define CST4335_SPROM_MASK 0x00000020
  2924. #define CST4335_SFLASH_MASK 0x00000040
  2925. #define CST4335_RES_INIT_MODE_SHIFT 7
  2926. #define CST4335_RES_INIT_MODE_MASK 0x00000180
  2927. #define CST4335_CHIPMODE_MASK 0xF
  2928. #define CST4335_CHIPMODE_SDIOD(cs) (((cs) & (1 << 0)) != 0) /* SDIO */
  2929. #define CST4335_CHIPMODE_GSPI(cs) (((cs) & (1 << 1)) != 0) /* gSPI */
  2930. #define CST4335_CHIPMODE_USB20D(cs) (((cs) & (1 << 2)) != 0) /**< HSIC || USBDA */
  2931. #define CST4335_CHIPMODE_PCIE(cs) (((cs) & (1 << 3)) != 0) /* PCIE */
  2932. /* 4335 Chip specific ChipControl1 register bits */
  2933. #define CCTRL1_4335_GPIO_SEL (1 << 0) /* 1=select GPIOs to be muxed out */
  2934. #define CCTRL1_4335_SDIO_HOST_WAKE (1 << 2) /* SDIO: 1=configure GPIO0 for host wake */
  2935. /* 4335 Chip specific ChipControl2 register bits */
  2936. #define CCTRL2_4335_AOSBLOCK (1 << 30)
  2937. #define CCTRL2_4335_PMUWAKE (1 << 31)
  2938. #define PATCHTBL_SIZE (0x800)
  2939. #define CR4_4335_RAM_BASE (0x180000)
  2940. #define CR4_4345_LT_C0_RAM_BASE (0x1b0000)
  2941. #define CR4_4345_GE_C0_RAM_BASE (0x198000)
  2942. #define CR4_4349_RAM_BASE (0x180000)
  2943. #define CR4_4349_RAM_BASE_FROM_REV_9 (0x160000)
  2944. #define CR4_4350_RAM_BASE (0x180000)
  2945. #define CR4_4360_RAM_BASE (0x0)
  2946. #define CR4_43602_RAM_BASE (0x180000)
  2947. #define CA7_4365_RAM_BASE (0x200000)
  2948. #define CR4_4373_RAM_BASE (0x160000)
  2949. #define CST4373_JTAG_ENABLE(cs) (((cs) & (1 << 0)) != 0)
  2950. #define CST4373_CHIPMODE_RSRC_INIT0(cs) (((cs) & (1 << 1)) != 0)
  2951. #define CST4373_SDIO_PADVDDIO(cs) (((cs) & (1 << 5)) != 0)
  2952. #define CST4373_USBHUB_BYPASS(cs) (((cs) & (1 << 9)) != 0)
  2953. #define STRAP4373_CHIPMODE_RSRC_INIT1 0x1
  2954. #define STRAP4373_VTRIM_EN 0x1
  2955. #define STRAP4373_SFLASH_PRESENT 0x1
  2956. #define OTP4373_SFLASH_BYTE_OFFSET 680
  2957. #define OTP4373_SFLASH_MASK 0x3F
  2958. #define OTP4373_SFLASH_PRESENT_MASK 0x1
  2959. #define OTP4373_SFLASH_TYPE_MASK 0x2
  2960. #define OTP4373_SFLASH_TYPE_SHIFT 0x1
  2961. #define OTP4373_SFLASH_CLKDIV_MASK 0x3C
  2962. #define OTP4373_SFLASH_CLKDIV_SHIFT 0x2
  2963. #define SPROM4373_OTP_SELECT 0x00000010
  2964. #define SPROM4373_OTP_PRESENT 0x00000020
  2965. #define CC4373_SFLASH_CLKDIV_MASK 0x1F000000
  2966. #define CC4373_SFLASH_CLKDIV_SHIFT 25
  2967. #define CR4_4347_RAM_BASE (0x170000)
  2968. #define CR4_4362_RAM_BASE (0x170000)
  2969. #define CR4_4369_RAM_BASE (0x170000)
  2970. #define CR4_4377_RAM_BASE (0x170000)
  2971. #define CR4_43751_RAM_BASE (0x170000)
  2972. #define CA7_4367_RAM_BASE (0x200000)
  2973. #define CR4_4378_RAM_BASE (0x352000)
  2974. #ifdef CHIPS_CUSTOMER_HW6
  2975. #define CA7_4368_RAM_BASE (0x200000)
  2976. #endif /* CHIPS_CUSTOMER_HW6 */
  2977. /* 4335 chip OTP present & OTP select bits. */
  2978. #define SPROM4335_OTP_SELECT 0x00000010
  2979. #define SPROM4335_OTP_PRESENT 0x00000020
  2980. /* 4335 GCI specific bits. */
  2981. #define CC4335_GCI_STRAP_OVERRIDE_SFLASH_PRESENT (1 << 24)
  2982. #define CC4335_GCI_STRAP_OVERRIDE_SFLASH_TYPE 25
  2983. #define CC4335_GCI_FUNC_SEL_PAD_SDIO 0x00707770
  2984. /* SFLASH clkdev specific bits. */
  2985. #define CC4335_SFLASH_CLKDIV_MASK 0x1F000000
  2986. #define CC4335_SFLASH_CLKDIV_SHIFT 25
  2987. /* 4335 OTP bits for SFLASH. */
  2988. #define CC4335_SROM_OTP_SFLASH 40
  2989. #define CC4335_SROM_OTP_SFLASH_PRESENT 0x1
  2990. #define CC4335_SROM_OTP_SFLASH_TYPE 0x2
  2991. #define CC4335_SROM_OTP_SFLASH_CLKDIV_MASK 0x003C
  2992. #define CC4335_SROM_OTP_SFLASH_CLKDIV_SHIFT 2
  2993. /* 4335 chip OTP present & OTP select bits. */
  2994. #define SPROM4335_OTP_SELECT 0x00000010
  2995. #define SPROM4335_OTP_PRESENT 0x00000020
  2996. /* 4335 GCI specific bits. */
  2997. #define CC4335_GCI_STRAP_OVERRIDE_SFLASH_PRESENT (1 << 24)
  2998. #define CC4335_GCI_STRAP_OVERRIDE_SFLASH_TYPE 25
  2999. #define CC4335_GCI_FUNC_SEL_PAD_SDIO 0x00707770
  3000. /* SFLASH clkdev specific bits. */
  3001. #define CC4335_SFLASH_CLKDIV_MASK 0x1F000000
  3002. #define CC4335_SFLASH_CLKDIV_SHIFT 25
  3003. /* 4335 OTP bits for SFLASH. */
  3004. #define CC4335_SROM_OTP_SFLASH 40
  3005. #define CC4335_SROM_OTP_SFLASH_PRESENT 0x1
  3006. #define CC4335_SROM_OTP_SFLASH_TYPE 0x2
  3007. #define CC4335_SROM_OTP_SFLASH_CLKDIV_MASK 0x003C
  3008. #define CC4335_SROM_OTP_SFLASH_CLKDIV_SHIFT 2
  3009. /* 4335 resources--END */
  3010. /* 43012 PMU resources based on pmu_params.xls - Start */
  3011. #define RES43012_MEMLPLDO_PU 0
  3012. #define RES43012_PMU_SLEEP 1
  3013. #define RES43012_FAST_LPO 2
  3014. #define RES43012_BTLPO_3P3 3
  3015. #define RES43012_SR_POK 4
  3016. #define RES43012_DUMMY_PWRSW 5
  3017. #define RES43012_DUMMY_LDO3P3 6
  3018. #define RES43012_DUMMY_BT_LDO3P3 7
  3019. #define RES43012_DUMMY_RADIO 8
  3020. #define RES43012_VDDB_VDDRET 9
  3021. #define RES43012_HV_LDO3P3 10
  3022. #define RES43012_OTP_PU 11
  3023. #define RES43012_XTAL_PU 12
  3024. #define RES43012_SR_CLK_START 13
  3025. #define RES43012_XTAL_STABLE 14
  3026. #define RES43012_FCBS 15
  3027. #define RES43012_CBUCK_MODE 16
  3028. #define RES43012_CORE_READY 17
  3029. #define RES43012_ILP_REQ 18
  3030. #define RES43012_ALP_AVAIL 19
  3031. #define RES43012_RADIOLDO_1P8 20
  3032. #define RES43012_MINI_PMU 21
  3033. #define RES43012_UNUSED 22
  3034. #define RES43012_SR_SAVE_RESTORE 23
  3035. #define RES43012_PHY_PWRSW 24
  3036. #define RES43012_VDDB_CLDO 25
  3037. #define RES43012_SUBCORE_PWRSW 26
  3038. #define RES43012_SR_SLEEP 27
  3039. #define RES43012_HT_START 28
  3040. #define RES43012_HT_AVAIL 29
  3041. #define RES43012_MACPHY_CLK_AVAIL 30
  3042. #define CST43012_SPROM_PRESENT 0x00000010
  3043. /* SR Control0 bits */
  3044. #define SR0_43012_SR_ENG_EN_MASK 0x1
  3045. #define SR0_43012_SR_ENG_EN_SHIFT 0
  3046. #define SR0_43012_SR_ENG_CLK_EN (1 << 1)
  3047. #define SR0_43012_SR_RSRC_TRIGGER (0xC << 2)
  3048. #define SR0_43012_SR_WD_MEM_MIN_DIV (0x3 << 6)
  3049. #define SR0_43012_SR_MEM_STBY_ALLOW_MSK (1 << 16)
  3050. #define SR0_43012_SR_MEM_STBY_ALLOW_SHIFT 16
  3051. #define SR0_43012_SR_ENABLE_ILP (1 << 17)
  3052. #define SR0_43012_SR_ENABLE_ALP (1 << 18)
  3053. #define SR0_43012_SR_ENABLE_HT (1 << 19)
  3054. #define SR0_43012_SR_ALLOW_PIC (3 << 20)
  3055. #define SR0_43012_SR_PMU_MEM_DISABLE (1 << 30)
  3056. #define CC_43012_VDDM_PWRSW_EN_MASK (1 << 20)
  3057. #define CC_43012_VDDM_PWRSW_EN_SHIFT (20)
  3058. #define CC_43012_SDIO_AOS_WAKEUP_MASK (1 << 24)
  3059. #define CC_43012_SDIO_AOS_WAKEUP_SHIFT (24)
  3060. /* 43012 - offset at 5K */
  3061. #define SR1_43012_SR_INIT_ADDR_MASK 0x3ff
  3062. #define SR1_43012_SR_ASM_ADDR 0xA
  3063. /* PLL usage in 43012 */
  3064. #define PMU43012_PLL0_PC0_NDIV_INT_MASK 0x0000003f
  3065. #define PMU43012_PLL0_PC0_NDIV_INT_SHIFT 0
  3066. #define PMU43012_PLL0_PC0_NDIV_FRAC_MASK 0xfffffc00
  3067. #define PMU43012_PLL0_PC0_NDIV_FRAC_SHIFT 10
  3068. #define PMU43012_PLL0_PC3_PDIV_MASK 0x00003c00
  3069. #define PMU43012_PLL0_PC3_PDIV_SHIFT 10
  3070. #define PMU43012_PLL_NDIV_FRAC_BITS 20
  3071. #define PMU43012_PLL_P_DIV_SCALE_BITS 10
  3072. #define CCTL_43012_ARM_OFFCOUNT_MASK 0x00000003
  3073. #define CCTL_43012_ARM_OFFCOUNT_SHIFT 0
  3074. #define CCTL_43012_ARM_ONCOUNT_MASK 0x0000000c
  3075. #define CCTL_43012_ARM_ONCOUNT_SHIFT 2
  3076. /* PMU Rev >= 30 */
  3077. #define PMU30_ALPCLK_ONEMHZ_ENAB 0x80000000
  3078. #define BCM7271_PMU30_ALPCLK_ONEMHZ_ENAB 0x00010000
  3079. /* 43012 PMU Chip Control Registers */
  3080. #define PMUCCTL02_43012_SUBCORE_PWRSW_FORCE_ON 0x00000010
  3081. #define PMUCCTL02_43012_PHY_PWRSW_FORCE_ON 0x00000040
  3082. #define PMUCCTL02_43012_LHL_TIMER_SELECT 0x00000800
  3083. #define PMUCCTL02_43012_RFLDO3P3_PU_FORCE_ON 0x00008000
  3084. #define PMUCCTL02_43012_WL2CDIG_I_PMU_SLEEP_ENAB 0x00010000
  3085. #define PMUCCTL02_43012_BTLDO3P3_PU_FORCE_OFF (1 << 12)
  3086. #define PMUCCTL04_43012_BBPLL_ENABLE_PWRDN 0x00100000
  3087. #define PMUCCTL04_43012_BBPLL_ENABLE_PWROFF 0x00200000
  3088. #define PMUCCTL04_43012_FORCE_BBPLL_ARESET 0x00400000
  3089. #define PMUCCTL04_43012_FORCE_BBPLL_DRESET 0x00800000
  3090. #define PMUCCTL04_43012_FORCE_BBPLL_PWRDN 0x01000000
  3091. #define PMUCCTL04_43012_FORCE_BBPLL_ISOONHIGH 0x02000000
  3092. #define PMUCCTL04_43012_FORCE_BBPLL_PWROFF 0x04000000
  3093. #define PMUCCTL04_43012_DISABLE_LQ_AVAIL 0x08000000
  3094. #define PMUCCTL04_43012_DISABLE_HT_AVAIL 0x10000000
  3095. #define PMUCCTL04_43012_USE_LOCK 0x20000000
  3096. #define PMUCCTL04_43012_OPEN_LOOP_ENABLE 0x40000000
  3097. #define PMUCCTL04_43012_FORCE_OPEN_LOOP 0x80000000
  3098. #define PMUCCTL05_43012_DISABLE_SPM_CLK (1 << 8)
  3099. #define PMUCCTL05_43012_RADIO_DIG_CLK_GATING_EN (1 << 14)
  3100. #define PMUCCTL06_43012_GCI2RDIG_USE_ASYNCAPB (1 << 31)
  3101. #define PMUCCTL08_43012_XTAL_CORE_SIZE_PMOS_NORMAL_MASK 0x00000FC0
  3102. #define PMUCCTL08_43012_XTAL_CORE_SIZE_PMOS_NORMAL_SHIFT 6
  3103. #define PMUCCTL08_43012_XTAL_CORE_SIZE_NMOS_NORMAL_MASK 0x00FC0000
  3104. #define PMUCCTL08_43012_XTAL_CORE_SIZE_NMOS_NORMAL_SHIFT 18
  3105. #define PMUCCTL08_43012_XTAL_SEL_BIAS_RES_NORMAL_MASK 0x07000000
  3106. #define PMUCCTL08_43012_XTAL_SEL_BIAS_RES_NORMAL_SHIFT 24
  3107. #define PMUCCTL09_43012_XTAL_CORESIZE_BIAS_ADJ_NORMAL_MASK 0x0003F000
  3108. #define PMUCCTL09_43012_XTAL_CORESIZE_BIAS_ADJ_NORMAL_SHIFT 12
  3109. #define PMUCCTL09_43012_XTAL_CORESIZE_RES_BYPASS_NORMAL_MASK 0x00000038
  3110. #define PMUCCTL09_43012_XTAL_CORESIZE_RES_BYPASS_NORMAL_SHIFT 3
  3111. #define PMUCCTL09_43012_XTAL_CORESIZE_BIAS_ADJ_STARTUP_MASK 0x00000FC0
  3112. #define PMUCCTL09_43012_XTAL_CORESIZE_BIAS_ADJ_STARTUP_SHIFT 6
  3113. /* during normal operation normal value is reduced for optimized power */
  3114. #define PMUCCTL09_43012_XTAL_CORESIZE_BIAS_ADJ_STARTUP_VAL 0x1F
  3115. #define PMUCCTL13_43012_FCBS_UP_TRIG_EN 0x00000400
  3116. #define PMUCCTL14_43012_ARMCM3_RESET_INITVAL 0x00000001
  3117. #define PMUCCTL14_43012_DOT11MAC_CLKEN_INITVAL 0x00000020
  3118. #define PMUCCTL14_43012_DOT11MAC_PHY_CLK_EN_INITVAL 0x00000080
  3119. #define PMUCCTL14_43012_DOT11MAC_PHY_CNTL_EN_INITVAL 0x00000200
  3120. #define PMUCCTL14_43012_SDIOD_RESET_INIVAL 0x00000400
  3121. #define PMUCCTL14_43012_SDIO_CLK_DMN_RESET_INITVAL 0x00001000
  3122. #define PMUCCTL14_43012_SOCRAM_CLKEN_INITVAL 0x00004000
  3123. #define PMUCCTL14_43012_M2MDMA_RESET_INITVAL 0x00008000
  3124. #define PMUCCTL14_43012_DISABLE_LQ_AVAIL 0x08000000
  3125. #define VREG6_43012_MEMLPLDO_ADJ_MASK 0x0000F000
  3126. #define VREG6_43012_MEMLPLDO_ADJ_SHIFT 12
  3127. #define VREG6_43012_LPLDO_ADJ_MASK 0x000000F0
  3128. #define VREG6_43012_LPLDO_ADJ_SHIFT 4
  3129. #define VREG7_43012_PWRSW_1P8_PU_MASK 0x00400000
  3130. #define VREG7_43012_PWRSW_1P8_PU_SHIFT 22
  3131. /* 4347 PMU Chip Control Registers */
  3132. #define PMUCCTL03_4347_XTAL_CORESIZE_PMOS_NORMAL_MASK 0x001F8000
  3133. #define PMUCCTL03_4347_XTAL_CORESIZE_PMOS_NORMAL_SHIFT 15
  3134. #define PMUCCTL03_4347_XTAL_CORESIZE_PMOS_NORMAL_VAL 0x3F
  3135. #define PMUCCTL03_4347_XTAL_CORESIZE_NMOS_NORMAL_MASK 0x07E00000
  3136. #define PMUCCTL03_4347_XTAL_CORESIZE_NMOS_NORMAL_SHIFT 21
  3137. #define PMUCCTL03_4347_XTAL_CORESIZE_NMOS_NORMAL_VAL 0x3F
  3138. #define PMUCCTL03_4347_XTAL_SEL_BIAS_RES_NORMAL_MASK 0x38000000
  3139. #define PMUCCTL03_4347_XTAL_SEL_BIAS_RES_NORMAL_SHIFT 27
  3140. #define PMUCCTL03_4347_XTAL_SEL_BIAS_RES_NORMAL_VAL 0x0
  3141. #define PMUCCTL00_4347_XTAL_CORESIZE_BIAS_ADJ_NORMAL_MASK 0x00000FC0
  3142. #define PMUCCTL00_4347_XTAL_CORESIZE_BIAS_ADJ_NORMAL_SHIFT 6
  3143. #define PMUCCTL00_4347_XTAL_CORESIZE_BIAS_ADJ_NORMAL_VAL 0x5
  3144. #define PMUCCTL00_4347_XTAL_RES_BYPASS_NORMAL_MASK 0x00038000
  3145. #define PMUCCTL00_4347_XTAL_RES_BYPASS_NORMAL_SHIFT 15
  3146. #define PMUCCTL00_4347_XTAL_RES_BYPASS_NORMAL_VAL 0x7
  3147. /* 4345 Chip specific ChipStatus register bits */
  3148. #define CST4345_SPROM_MASK 0x00000020
  3149. #define CST4345_SFLASH_MASK 0x00000040
  3150. #define CST4345_RES_INIT_MODE_SHIFT 7
  3151. #define CST4345_RES_INIT_MODE_MASK 0x00000180
  3152. #define CST4345_CHIPMODE_MASK 0x4000F
  3153. #define CST4345_CHIPMODE_SDIOD(cs) (((cs) & (1 << 0)) != 0) /* SDIO */
  3154. #define CST4345_CHIPMODE_GSPI(cs) (((cs) & (1 << 1)) != 0) /* gSPI */
  3155. #define CST4345_CHIPMODE_HSIC(cs) (((cs) & (1 << 2)) != 0) /* HSIC */
  3156. #define CST4345_CHIPMODE_PCIE(cs) (((cs) & (1 << 3)) != 0) /* PCIE */
  3157. #define CST4345_CHIPMODE_USB20D(cs) (((cs) & (1 << 18)) != 0) /* USBDA */
  3158. /* 4350 Chipcommon ChipStatus bits */
  3159. #define CST4350_SDIO_MODE 0x00000001
  3160. #define CST4350_HSIC20D_MODE 0x00000002
  3161. #define CST4350_BP_ON_HSIC_CLK 0x00000004
  3162. #define CST4350_PCIE_MODE 0x00000008
  3163. #define CST4350_USB20D_MODE 0x00000010
  3164. #define CST4350_USB30D_MODE 0x00000020
  3165. #define CST4350_SPROM_PRESENT 0x00000040
  3166. #define CST4350_RSRC_INIT_MODE_0 0x00000080
  3167. #define CST4350_RSRC_INIT_MODE_1 0x00000100
  3168. #define CST4350_SEL0_SDIO 0x00000200
  3169. #define CST4350_SEL1_SDIO 0x00000400
  3170. #define CST4350_SDIO_PAD_MODE 0x00000800
  3171. #define CST4350_BBPLL_LOCKED 0x00001000
  3172. #define CST4350_USBPLL_LOCKED 0x00002000
  3173. #define CST4350_LINE_STATE 0x0000C000
  3174. #define CST4350_SERDES_PIPE_PLLLOCK 0x00010000
  3175. #define CST4350_BT_READY 0x00020000
  3176. #define CST4350_SFLASH_PRESENT 0x00040000
  3177. #define CST4350_CPULESS_ENABLE 0x00080000
  3178. #define CST4350_STRAP_HOST_IFC_1 0x00100000
  3179. #define CST4350_STRAP_HOST_IFC_2 0x00200000
  3180. #define CST4350_STRAP_HOST_IFC_3 0x00400000
  3181. #define CST4350_RAW_SPROM_PRESENT 0x00800000
  3182. #define CST4350_APP_CLK_SWITCH_SEL_RDBACK 0x01000000
  3183. #define CST4350_RAW_RSRC_INIT_MODE_0 0x02000000
  3184. #define CST4350_SDIO_PAD_VDDIO 0x04000000
  3185. #define CST4350_GSPI_MODE 0x08000000
  3186. #define CST4350_PACKAGE_OPTION 0xF0000000
  3187. #define CST4350_PACKAGE_SHIFT 28
  3188. /* package option for 4350 */
  3189. #define CST4350_PACKAGE_WLCSP 0x0
  3190. #define CST4350_PACKAGE_PCIE 0x1
  3191. #define CST4350_PACKAGE_WLBGA 0x2
  3192. #define CST4350_PACKAGE_DBG 0x3
  3193. #define CST4350_PACKAGE_USB 0x4
  3194. #define CST4350_PACKAGE_USB_HSIC 0x4
  3195. #define CST4350_PKG_MODE(cs) ((cs & CST4350_PACKAGE_OPTION) >> CST4350_PACKAGE_SHIFT)
  3196. #define CST4350_PKG_WLCSP(cs) (CST4350_PKG_MODE(cs) == (CST4350_PACKAGE_WLCSP))
  3197. #define CST4350_PKG_PCIE(cs) (CST4350_PKG_MODE(cs) == (CST4350_PACKAGE_PCIE))
  3198. #define CST4350_PKG_WLBGA(cs) (CST4350_PKG_MODE(cs) == (CST4350_PACKAGE_WLBGA))
  3199. #define CST4350_PKG_USB(cs) (CST4350_PKG_MODE(cs) == (CST4350_PACKAGE_USB))
  3200. #define CST4350_PKG_USB_HSIC(cs) (CST4350_PKG_MODE(cs) == (CST4350_PACKAGE_USB_HSIC))
  3201. /* 4350C0 USB PACKAGE using raw_sprom_present to indicate 40mHz xtal */
  3202. #define CST4350_PKG_USB_40M(cs) (cs & CST4350_RAW_SPROM_PRESENT)
  3203. #define CST4350_CHIPMODE_SDIOD(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_SDIOD))
  3204. #define CST4350_CHIPMODE_USB20D(cs) ((CST4350_IFC_MODE(cs)) == (CST4350_IFC_MODE_USB20D))
  3205. #define CST4350_CHIPMODE_HSIC20D(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_HSIC20D))
  3206. #define CST4350_CHIPMODE_HSIC30D(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_HSIC30D))
  3207. #define CST4350_CHIPMODE_USB30D(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_USB30D))
  3208. #define CST4350_CHIPMODE_USB30D_WL(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_USB30D_WL))
  3209. #define CST4350_CHIPMODE_PCIE(cs) (CST4350_IFC_MODE(cs) == (CST4350_IFC_MODE_PCIE))
  3210. /* strap_host_ifc strap value */
  3211. #define CST4350_HOST_IFC_MASK 0x00700000
  3212. #define CST4350_HOST_IFC_SHIFT 20
  3213. /* host_ifc raw mode */
  3214. #define CST4350_IFC_MODE_SDIOD 0x0
  3215. #define CST4350_IFC_MODE_HSIC20D 0x1
  3216. #define CST4350_IFC_MODE_HSIC30D 0x2
  3217. #define CST4350_IFC_MODE_PCIE 0x3
  3218. #define CST4350_IFC_MODE_USB20D 0x4
  3219. #define CST4350_IFC_MODE_USB30D 0x5
  3220. #define CST4350_IFC_MODE_USB30D_WL 0x6
  3221. #define CST4350_IFC_MODE_USB30D_BT 0x7
  3222. #define CST4350_IFC_MODE(cs) ((cs & CST4350_HOST_IFC_MASK) >> CST4350_HOST_IFC_SHIFT)
  3223. /* 4350 PMU resources */
  3224. #define RES4350_LPLDO_PU 0
  3225. #define RES4350_PMU_BG_PU 1
  3226. #define RES4350_PMU_SLEEP 2
  3227. #define RES4350_RSVD_3 3
  3228. #define RES4350_CBUCK_LPOM_PU 4
  3229. #define RES4350_CBUCK_PFM_PU 5
  3230. #define RES4350_COLD_START_WAIT 6
  3231. #define RES4350_RSVD_7 7
  3232. #define RES4350_LNLDO_PU 8
  3233. #define RES4350_XTALLDO_PU 9
  3234. #define RES4350_LDO3P3_PU 10
  3235. #define RES4350_OTP_PU 11
  3236. #define RES4350_XTAL_PU 12
  3237. #define RES4350_SR_CLK_START 13
  3238. #define RES4350_LQ_AVAIL 14
  3239. #define RES4350_LQ_START 15
  3240. #define RES4350_PERST_OVR 16
  3241. #define RES4350_WL_CORE_RDY 17
  3242. #define RES4350_ILP_REQ 18
  3243. #define RES4350_ALP_AVAIL 19
  3244. #define RES4350_MINI_PMU 20
  3245. #define RES4350_RADIO_PU 21
  3246. #define RES4350_SR_CLK_STABLE 22
  3247. #define RES4350_SR_SAVE_RESTORE 23
  3248. #define RES4350_SR_PHY_PWRSW 24
  3249. #define RES4350_SR_VDDM_PWRSW 25
  3250. #define RES4350_SR_SUBCORE_PWRSW 26
  3251. #define RES4350_SR_SLEEP 27
  3252. #define RES4350_HT_START 28
  3253. #define RES4350_HT_AVAIL 29
  3254. #define RES4350_MACPHY_CLKAVAIL 30
  3255. #define MUXENAB4350_UART_MASK (0x0000000f)
  3256. #define MUXENAB4350_UART_SHIFT 0
  3257. #define MUXENAB4350_HOSTWAKE_MASK (0x000000f0) /**< configure GPIO for host_wake */
  3258. #define MUXENAB4350_HOSTWAKE_SHIFT 4
  3259. #define MUXENAB4349_UART_MASK (0xf)
  3260. #define CC4350_GPIO_COUNT 16
  3261. /* 4350 GCI function sel values */
  3262. #define CC4350_FNSEL_HWDEF (0)
  3263. #define CC4350_FNSEL_SAMEASPIN (1)
  3264. #define CC4350_FNSEL_UART (2)
  3265. #define CC4350_FNSEL_SFLASH (3)
  3266. #define CC4350_FNSEL_SPROM (4)
  3267. #define CC4350_FNSEL_I2C (5)
  3268. #define CC4350_FNSEL_MISC0 (6)
  3269. #define CC4350_FNSEL_GCI (7)
  3270. #define CC4350_FNSEL_MISC1 (8)
  3271. #define CC4350_FNSEL_MISC2 (9)
  3272. #define CC4350_FNSEL_PWDOG (10)
  3273. #define CC4350_FNSEL_IND (12)
  3274. #define CC4350_FNSEL_PDN (13)
  3275. #define CC4350_FNSEL_PUP (14)
  3276. #define CC4350_FNSEL_TRISTATE (15)
  3277. #define CC4350C_FNSEL_UART (3)
  3278. /* 4350 GPIO */
  3279. #define CC4350_PIN_GPIO_00 (0)
  3280. #define CC4350_PIN_GPIO_01 (1)
  3281. #define CC4350_PIN_GPIO_02 (2)
  3282. #define CC4350_PIN_GPIO_03 (3)
  3283. #define CC4350_PIN_GPIO_04 (4)
  3284. #define CC4350_PIN_GPIO_05 (5)
  3285. #define CC4350_PIN_GPIO_06 (6)
  3286. #define CC4350_PIN_GPIO_07 (7)
  3287. #define CC4350_PIN_GPIO_08 (8)
  3288. #define CC4350_PIN_GPIO_09 (9)
  3289. #define CC4350_PIN_GPIO_10 (10)
  3290. #define CC4350_PIN_GPIO_11 (11)
  3291. #define CC4350_PIN_GPIO_12 (12)
  3292. #define CC4350_PIN_GPIO_13 (13)
  3293. #define CC4350_PIN_GPIO_14 (14)
  3294. #define CC4350_PIN_GPIO_15 (15)
  3295. #define CC4350_RSVD_16_SHIFT 16
  3296. #define CC2_4350_PHY_PWRSW_UPTIME_MASK (0xf << 0)
  3297. #define CC2_4350_PHY_PWRSW_UPTIME_SHIFT (0)
  3298. #define CC2_4350_VDDM_PWRSW_UPDELAY_MASK (0xf << 4)
  3299. #define CC2_4350_VDDM_PWRSW_UPDELAY_SHIFT (4)
  3300. #define CC2_4350_VDDM_PWRSW_UPTIME_MASK (0xf << 8)
  3301. #define CC2_4350_VDDM_PWRSW_UPTIME_SHIFT (8)
  3302. #define CC2_4350_SBC_PWRSW_DNDELAY_MASK (0x3 << 12)
  3303. #define CC2_4350_SBC_PWRSW_DNDELAY_SHIFT (12)
  3304. #define CC2_4350_PHY_PWRSW_DNDELAY_MASK (0x3 << 14)
  3305. #define CC2_4350_PHY_PWRSW_DNDELAY_SHIFT (14)
  3306. #define CC2_4350_VDDM_PWRSW_DNDELAY_MASK (0x3 << 16)
  3307. #define CC2_4350_VDDM_PWRSW_DNDELAY_SHIFT (16)
  3308. #define CC2_4350_VDDM_PWRSW_EN_MASK (1 << 20)
  3309. #define CC2_4350_VDDM_PWRSW_EN_SHIFT (20)
  3310. #define CC2_4350_MEMLPLDO_PWRSW_EN_MASK (1 << 21)
  3311. #define CC2_4350_MEMLPLDO_PWRSW_EN_SHIFT (21)
  3312. #define CC2_4350_SDIO_AOS_WAKEUP_MASK (1 << 24)
  3313. #define CC2_4350_SDIO_AOS_WAKEUP_SHIFT (24)
  3314. /* Applies to 4335/4350/4345 */
  3315. #define CC3_SR_CLK_SR_MEM_MASK (1 << 0)
  3316. #define CC3_SR_CLK_SR_MEM_SHIFT (0)
  3317. #define CC3_SR_BIT1_TBD_MASK (1 << 1)
  3318. #define CC3_SR_BIT1_TBD_SHIFT (1)
  3319. #define CC3_SR_ENGINE_ENABLE_MASK (1 << 2)
  3320. #define CC3_SR_ENGINE_ENABLE_SHIFT (2)
  3321. #define CC3_SR_BIT3_TBD_MASK (1 << 3)
  3322. #define CC3_SR_BIT3_TBD_SHIFT (3)
  3323. #define CC3_SR_MINDIV_FAST_CLK_MASK (0xF << 4)
  3324. #define CC3_SR_MINDIV_FAST_CLK_SHIFT (4)
  3325. #define CC3_SR_R23_SR2_RISE_EDGE_TRIG_MASK (1 << 8)
  3326. #define CC3_SR_R23_SR2_RISE_EDGE_TRIG_SHIFT (8)
  3327. #define CC3_SR_R23_SR2_FALL_EDGE_TRIG_MASK (1 << 9)
  3328. #define CC3_SR_R23_SR2_FALL_EDGE_TRIG_SHIFT (9)
  3329. #define CC3_SR_R23_SR_RISE_EDGE_TRIG_MASK (1 << 10)
  3330. #define CC3_SR_R23_SR_RISE_EDGE_TRIG_SHIFT (10)
  3331. #define CC3_SR_R23_SR_FALL_EDGE_TRIG_MASK (1 << 11)
  3332. #define CC3_SR_R23_SR_FALL_EDGE_TRIG_SHIFT (11)
  3333. #define CC3_SR_NUM_CLK_HIGH_MASK (0x7 << 12)
  3334. #define CC3_SR_NUM_CLK_HIGH_SHIFT (12)
  3335. #define CC3_SR_BIT15_TBD_MASK (1 << 15)
  3336. #define CC3_SR_BIT15_TBD_SHIFT (15)
  3337. #define CC3_SR_PHY_FUNC_PIC_MASK (1 << 16)
  3338. #define CC3_SR_PHY_FUNC_PIC_SHIFT (16)
  3339. #define CC3_SR_BIT17_19_TBD_MASK (0x7 << 17)
  3340. #define CC3_SR_BIT17_19_TBD_SHIFT (17)
  3341. #define CC3_SR_CHIP_TRIGGER_1_MASK (1 << 20)
  3342. #define CC3_SR_CHIP_TRIGGER_1_SHIFT (20)
  3343. #define CC3_SR_CHIP_TRIGGER_2_MASK (1 << 21)
  3344. #define CC3_SR_CHIP_TRIGGER_2_SHIFT (21)
  3345. #define CC3_SR_CHIP_TRIGGER_3_MASK (1 << 22)
  3346. #define CC3_SR_CHIP_TRIGGER_3_SHIFT (22)
  3347. #define CC3_SR_CHIP_TRIGGER_4_MASK (1 << 23)
  3348. #define CC3_SR_CHIP_TRIGGER_4_SHIFT (23)
  3349. #define CC3_SR_ALLOW_SBC_FUNC_PIC_MASK (1 << 24)
  3350. #define CC3_SR_ALLOW_SBC_FUNC_PIC_SHIFT (24)
  3351. #define CC3_SR_BIT25_26_TBD_MASK (0x3 << 25)
  3352. #define CC3_SR_BIT25_26_TBD_SHIFT (25)
  3353. #define CC3_SR_ALLOW_SBC_STBY_MASK (1 << 27)
  3354. #define CC3_SR_ALLOW_SBC_STBY_SHIFT (27)
  3355. #define CC3_SR_GPIO_MUX_MASK (0xF << 28)
  3356. #define CC3_SR_GPIO_MUX_SHIFT (28)
  3357. /* Applies to 4335/4350/4345 */
  3358. #define CC4_SR_INIT_ADDR_MASK (0x3FF0000)
  3359. #define CC4_4350_SR_ASM_ADDR (0x30)
  3360. #define CC4_4350_C0_SR_ASM_ADDR (0x0)
  3361. #define CC4_4335_SR_ASM_ADDR (0x48)
  3362. #define CC4_4345_SR_ASM_ADDR (0x48)
  3363. #define CC4_SR_INIT_ADDR_SHIFT (16)
  3364. #define CC4_4350_EN_SR_CLK_ALP_MASK (1 << 30)
  3365. #define CC4_4350_EN_SR_CLK_ALP_SHIFT (30)
  3366. #define CC4_4350_EN_SR_CLK_HT_MASK (1 << 31)
  3367. #define CC4_4350_EN_SR_CLK_HT_SHIFT (31)
  3368. #define VREG4_4350_MEMLPDO_PU_MASK (1 << 31)
  3369. #define VREG4_4350_MEMLPDO_PU_SHIFT 31
  3370. #define VREG6_4350_SR_EXT_CLKDIR_MASK (1 << 20)
  3371. #define VREG6_4350_SR_EXT_CLKDIR_SHIFT 20
  3372. #define VREG6_4350_SR_EXT_CLKDIV_MASK (0x3 << 21)
  3373. #define VREG6_4350_SR_EXT_CLKDIV_SHIFT 21
  3374. #define VREG6_4350_SR_EXT_CLKEN_MASK (1 << 23)
  3375. #define VREG6_4350_SR_EXT_CLKEN_SHIFT 23
  3376. #define CC5_4350_PMU_EN_ASSERT_MASK (1 << 13)
  3377. #define CC5_4350_PMU_EN_ASSERT_SHIFT (13)
  3378. #define CC6_4350_PCIE_CLKREQ_WAKEUP_MASK (1 << 4)
  3379. #define CC6_4350_PCIE_CLKREQ_WAKEUP_SHIFT (4)
  3380. #define CC6_4350_PMU_WAKEUP_ALPAVAIL_MASK (1 << 6)
  3381. #define CC6_4350_PMU_WAKEUP_ALPAVAIL_SHIFT (6)
  3382. #define CC6_4350_PMU_EN_EXT_PERST_MASK (1 << 17)
  3383. #define CC6_4350_PMU_EN_EXT_PERST_SHIFT (17)
  3384. #define CC6_4350_PMU_EN_WAKEUP_MASK (1 << 18)
  3385. #define CC6_4350_PMU_EN_WAKEUP_SHIFT (18)
  3386. #define CC7_4350_PMU_EN_ASSERT_L2_MASK (1 << 26)
  3387. #define CC7_4350_PMU_EN_ASSERT_L2_SHIFT (26)
  3388. #define CC7_4350_PMU_EN_MDIO_MASK (1 << 27)
  3389. #define CC7_4350_PMU_EN_MDIO_SHIFT (27)
  3390. #define CC6_4345_PMU_EN_PERST_DEASSERT_MASK (1 << 13)
  3391. #define CC6_4345_PMU_EN_PERST_DEASSERT_SHIF (13)
  3392. #define CC6_4345_PMU_EN_L2_DEASSERT_MASK (1 << 14)
  3393. #define CC6_4345_PMU_EN_L2_DEASSERT_SHIF (14)
  3394. #define CC6_4345_PMU_EN_ASSERT_L2_MASK (1 << 15)
  3395. #define CC6_4345_PMU_EN_ASSERT_L2_SHIFT (15)
  3396. #define CC6_4345_PMU_EN_MDIO_MASK (1 << 24)
  3397. #define CC6_4345_PMU_EN_MDIO_SHIFT (24)
  3398. /* 4347 GCI function sel values */
  3399. #define CC4347_FNSEL_HWDEF (0)
  3400. #define CC4347_FNSEL_SAMEASPIN (1)
  3401. #define CC4347_FNSEL_GPIO0 (2)
  3402. #define CC4347_FNSEL_FUART (3)
  3403. #define CC4347_FNSEL_GCI0 (4)
  3404. #define CC4347_FNSEL_GCI1 (5)
  3405. #define CC4347_FNSEL_DBG_UART (6)
  3406. #define CC4347_FNSEL_SPI (7)
  3407. #define CC4347_FNSEL_SPROM (8)
  3408. #define CC4347_FNSEL_MISC0 (9)
  3409. #define CC4347_FNSEL_MISC1 (10)
  3410. #define CC4347_FNSEL_MISC2 (11)
  3411. #define CC4347_FNSEL_IND (12)
  3412. #define CC4347_FNSEL_PDN (13)
  3413. #define CC4347_FNSEL_PUP (14)
  3414. #define CC4347_FNSEL_TRISTATE (15)
  3415. /* 4347 GPIO */
  3416. #define CC4347_PIN_GPIO_02 (2)
  3417. #define CC4347_PIN_GPIO_03 (3)
  3418. #define CC4347_PIN_GPIO_04 (4)
  3419. #define CC4347_PIN_GPIO_05 (5)
  3420. #define CC4347_PIN_GPIO_06 (6)
  3421. #define CC4347_PIN_GPIO_07 (7)
  3422. #define CC4347_PIN_GPIO_08 (8)
  3423. #define CC4347_PIN_GPIO_09 (9)
  3424. #define CC4347_PIN_GPIO_10 (10)
  3425. #define CC4347_PIN_GPIO_11 (11)
  3426. #define CC4347_PIN_GPIO_12 (12)
  3427. #define CC4347_PIN_GPIO_13 (13)
  3428. /* GCI chipcontrol register indices */
  3429. #define CC_GCI_CHIPCTRL_00 (0)
  3430. #define CC_GCI_CHIPCTRL_01 (1)
  3431. #define CC_GCI_CHIPCTRL_02 (2)
  3432. #define CC_GCI_CHIPCTRL_03 (3)
  3433. #define CC_GCI_CHIPCTRL_04 (4)
  3434. #define CC_GCI_CHIPCTRL_05 (5)
  3435. #define CC_GCI_CHIPCTRL_06 (6)
  3436. #define CC_GCI_CHIPCTRL_07 (7)
  3437. #define CC_GCI_CHIPCTRL_08 (8)
  3438. #define CC_GCI_CHIPCTRL_09 (9)
  3439. #define CC_GCI_CHIPCTRL_10 (10)
  3440. #define CC_GCI_CHIPCTRL_10 (10)
  3441. #define CC_GCI_CHIPCTRL_11 (11)
  3442. #define CC_GCI_XTAL_BUFSTRG_NFC (0xff << 12)
  3443. #define CC_GCI_04_SDIO_DRVSTR_SHIFT 15
  3444. #define CC_GCI_04_SDIO_DRVSTR_MASK (0x0f << CC_GCI_04_SDIO_DRVSTR_SHIFT) /* 0x00078000 */
  3445. #define CC_GCI_04_SDIO_DRVSTR_OVERRIDE_BIT (1 << 18)
  3446. #define CC_GCI_04_SDIO_DRVSTR_DEFAULT_MA 14
  3447. #define CC_GCI_04_SDIO_DRVSTR_MIN_MA 2
  3448. #define CC_GCI_04_SDIO_DRVSTR_MAX_MA 16
  3449. #define CC_GCI_06_JTAG_SEL_SHIFT 4
  3450. #define CC_GCI_06_JTAG_SEL_MASK (1 << 4)
  3451. #define CC_GCI_NUMCHIPCTRLREGS(cap1) ((cap1 & 0xF00) >> 8)
  3452. #define CC_GCI_03_LPFLAGS_SFLASH_MASK (0xFFFFFF << 8)
  3453. #define CC_GCI_03_LPFLAGS_SFLASH_VAL (0xCCCCCC << 8)
  3454. #define GPIO_CTRL_REG_DISABLE_INTERRUPT (3 << 9)
  3455. #define GPIO_CTRL_REG_COUNT 40
  3456. /* GCI chipstatus register indices */
  3457. #define GCI_CHIPSTATUS_00 (0)
  3458. #define GCI_CHIPSTATUS_01 (1)
  3459. #define GCI_CHIPSTATUS_02 (2)
  3460. #define GCI_CHIPSTATUS_03 (3)
  3461. #define GCI_CHIPSTATUS_04 (4)
  3462. #define GCI_CHIPSTATUS_05 (5)
  3463. #define GCI_CHIPSTATUS_06 (6)
  3464. #define GCI_CHIPSTATUS_07 (7)
  3465. #define GCI_CHIPSTATUS_08 (8)
  3466. #define GCI_CHIPSTATUS_09 (9)
  3467. #define GCI_CHIPSTATUS_10 (10)
  3468. #define GCI_CHIPSTATUS_11 (11)
  3469. #define GCI_CHIPSTATUS_12 (12)
  3470. #define GCI_CHIPSTATUS_13 (13)
  3471. /* 43021 GCI chipstatus registers */
  3472. #define GCI43012_CHIPSTATUS_07_BBPLL_LOCK_MASK (1 << 3)
  3473. /* 4345 PMU resources */
  3474. #define RES4345_LPLDO_PU 0
  3475. #define RES4345_PMU_BG_PU 1
  3476. #define RES4345_PMU_SLEEP 2
  3477. #define RES4345_HSICLDO_PU 3
  3478. #define RES4345_CBUCK_LPOM_PU 4
  3479. #define RES4345_CBUCK_PFM_PU 5
  3480. #define RES4345_COLD_START_WAIT 6
  3481. #define RES4345_RSVD_7 7
  3482. #define RES4345_LNLDO_PU 8
  3483. #define RES4345_XTALLDO_PU 9
  3484. #define RES4345_LDO3P3_PU 10
  3485. #define RES4345_OTP_PU 11
  3486. #define RES4345_XTAL_PU 12
  3487. #define RES4345_SR_CLK_START 13
  3488. #define RES4345_LQ_AVAIL 14
  3489. #define RES4345_LQ_START 15
  3490. #define RES4345_PERST_OVR 16
  3491. #define RES4345_WL_CORE_RDY 17
  3492. #define RES4345_ILP_REQ 18
  3493. #define RES4345_ALP_AVAIL 19
  3494. #define RES4345_MINI_PMU 20
  3495. #define RES4345_RADIO_PU 21
  3496. #define RES4345_SR_CLK_STABLE 22
  3497. #define RES4345_SR_SAVE_RESTORE 23
  3498. #define RES4345_SR_PHY_PWRSW 24
  3499. #define RES4345_SR_VDDM_PWRSW 25
  3500. #define RES4345_SR_SUBCORE_PWRSW 26
  3501. #define RES4345_SR_SLEEP 27
  3502. #define RES4345_HT_START 28
  3503. #define RES4345_HT_AVAIL 29
  3504. #define RES4345_MACPHY_CLK_AVAIL 30
  3505. /* 43012 pins
  3506. * note: only the values set as default/used are added here.
  3507. */
  3508. #define CC43012_PIN_GPIO_00 (0)
  3509. #define CC43012_PIN_GPIO_01 (1)
  3510. #define CC43012_PIN_GPIO_02 (2)
  3511. #define CC43012_PIN_GPIO_03 (3)
  3512. #define CC43012_PIN_GPIO_04 (4)
  3513. #define CC43012_PIN_GPIO_05 (5)
  3514. #define CC43012_PIN_GPIO_06 (6)
  3515. #define CC43012_PIN_GPIO_07 (7)
  3516. #define CC43012_PIN_GPIO_08 (8)
  3517. #define CC43012_PIN_GPIO_09 (9)
  3518. #define CC43012_PIN_GPIO_10 (10)
  3519. #define CC43012_PIN_GPIO_11 (11)
  3520. #define CC43012_PIN_GPIO_12 (12)
  3521. #define CC43012_PIN_GPIO_13 (13)
  3522. #define CC43012_PIN_GPIO_14 (14)
  3523. #define CC43012_PIN_GPIO_15 (15)
  3524. /* 43012 GCI function sel values */
  3525. #define CC43012_FNSEL_HWDEF (0)
  3526. #define CC43012_FNSEL_SAMEASPIN (1)
  3527. #define CC43012_FNSEL_GPIO0 (2)
  3528. #define CC43012_FNSEL_GPIO1 (3)
  3529. #define CC43012_FNSEL_GCI0 (4)
  3530. #define CC43012_FNSEL_GCI1 (5)
  3531. #define CC43012_FNSEL_DBG_UART (6)
  3532. #define CC43012_FNSEL_I2C (7)
  3533. #define CC43012_FNSEL_BT_SFLASH (8)
  3534. #define CC43012_FNSEL_MISC0 (9)
  3535. #define CC43012_FNSEL_MISC1 (10)
  3536. #define CC43012_FNSEL_MISC2 (11)
  3537. #define CC43012_FNSEL_IND (12)
  3538. #define CC43012_FNSEL_PDN (13)
  3539. #define CC43012_FNSEL_PUP (14)
  3540. #define CC43012_FNSEL_TRI (15)
  3541. /* 4335 pins
  3542. * note: only the values set as default/used are added here.
  3543. */
  3544. #define CC4335_PIN_GPIO_00 (0)
  3545. #define CC4335_PIN_GPIO_01 (1)
  3546. #define CC4335_PIN_GPIO_02 (2)
  3547. #define CC4335_PIN_GPIO_03 (3)
  3548. #define CC4335_PIN_GPIO_04 (4)
  3549. #define CC4335_PIN_GPIO_05 (5)
  3550. #define CC4335_PIN_GPIO_06 (6)
  3551. #define CC4335_PIN_GPIO_07 (7)
  3552. #define CC4335_PIN_GPIO_08 (8)
  3553. #define CC4335_PIN_GPIO_09 (9)
  3554. #define CC4335_PIN_GPIO_10 (10)
  3555. #define CC4335_PIN_GPIO_11 (11)
  3556. #define CC4335_PIN_GPIO_12 (12)
  3557. #define CC4335_PIN_GPIO_13 (13)
  3558. #define CC4335_PIN_GPIO_14 (14)
  3559. #define CC4335_PIN_GPIO_15 (15)
  3560. #define CC4335_PIN_SDIO_CLK (16)
  3561. #define CC4335_PIN_SDIO_CMD (17)
  3562. #define CC4335_PIN_SDIO_DATA0 (18)
  3563. #define CC4335_PIN_SDIO_DATA1 (19)
  3564. #define CC4335_PIN_SDIO_DATA2 (20)
  3565. #define CC4335_PIN_SDIO_DATA3 (21)
  3566. #define CC4335_PIN_RF_SW_CTRL_6 (22)
  3567. #define CC4335_PIN_RF_SW_CTRL_7 (23)
  3568. #define CC4335_PIN_RF_SW_CTRL_8 (24)
  3569. #define CC4335_PIN_RF_SW_CTRL_9 (25)
  3570. /* Last GPIO Pad */
  3571. #define CC4335_PIN_GPIO_LAST (31)
  3572. /* 4335 GCI function sel values
  3573. */
  3574. #define CC4335_FNSEL_HWDEF (0)
  3575. #define CC4335_FNSEL_SAMEASPIN (1)
  3576. #define CC4335_FNSEL_GPIO0 (2)
  3577. #define CC4335_FNSEL_GPIO1 (3)
  3578. #define CC4335_FNSEL_GCI0 (4)
  3579. #define CC4335_FNSEL_GCI1 (5)
  3580. #define CC4335_FNSEL_UART (6)
  3581. #define CC4335_FNSEL_SFLASH (7)
  3582. #define CC4335_FNSEL_SPROM (8)
  3583. #define CC4335_FNSEL_MISC0 (9)
  3584. #define CC4335_FNSEL_MISC1 (10)
  3585. #define CC4335_FNSEL_MISC2 (11)
  3586. #define CC4335_FNSEL_IND (12)
  3587. #define CC4335_FNSEL_PDN (13)
  3588. #define CC4335_FNSEL_PUP (14)
  3589. #define CC4335_FNSEL_TRI (15)
  3590. /* GCI Core Control Reg */
  3591. #define GCI_CORECTRL_SR_MASK (1 << 0) /**< SECI block Reset */
  3592. #define GCI_CORECTRL_RSL_MASK (1 << 1) /**< ResetSECILogic */
  3593. #define GCI_CORECTRL_ES_MASK (1 << 2) /**< EnableSECI */
  3594. #define GCI_CORECTRL_FSL_MASK (1 << 3) /**< Force SECI Out Low */
  3595. #define GCI_CORECTRL_SOM_MASK (7 << 4) /**< SECI Op Mode */
  3596. #define GCI_CORECTRL_US_MASK (1 << 7) /**< Update SECI */
  3597. #define GCI_CORECTRL_BOS_MASK (1 << 8) /**< Break On Sleep */
  3598. #define GCI_CORECTRL_FORCEREGCLK_MASK (1 << 18) /* ForceRegClk */
  3599. /* 4345 pins
  3600. * note: only the values set as default/used are added here.
  3601. */
  3602. #define CC4345_PIN_GPIO_00 (0)
  3603. #define CC4345_PIN_GPIO_01 (1)
  3604. #define CC4345_PIN_GPIO_02 (2)
  3605. #define CC4345_PIN_GPIO_03 (3)
  3606. #define CC4345_PIN_GPIO_04 (4)
  3607. #define CC4345_PIN_GPIO_05 (5)
  3608. #define CC4345_PIN_GPIO_06 (6)
  3609. #define CC4345_PIN_GPIO_07 (7)
  3610. #define CC4345_PIN_GPIO_08 (8)
  3611. #define CC4345_PIN_GPIO_09 (9)
  3612. #define CC4345_PIN_GPIO_10 (10)
  3613. #define CC4345_PIN_GPIO_11 (11)
  3614. #define CC4345_PIN_GPIO_12 (12)
  3615. #define CC4345_PIN_GPIO_13 (13)
  3616. #define CC4345_PIN_GPIO_14 (14)
  3617. #define CC4345_PIN_GPIO_15 (15)
  3618. #define CC4345_PIN_GPIO_16 (16)
  3619. #define CC4345_PIN_SDIO_CLK (17)
  3620. #define CC4345_PIN_SDIO_CMD (18)
  3621. #define CC4345_PIN_SDIO_DATA0 (19)
  3622. #define CC4345_PIN_SDIO_DATA1 (20)
  3623. #define CC4345_PIN_SDIO_DATA2 (21)
  3624. #define CC4345_PIN_SDIO_DATA3 (22)
  3625. #define CC4345_PIN_RF_SW_CTRL_0 (23)
  3626. #define CC4345_PIN_RF_SW_CTRL_1 (24)
  3627. #define CC4345_PIN_RF_SW_CTRL_2 (25)
  3628. #define CC4345_PIN_RF_SW_CTRL_3 (26)
  3629. #define CC4345_PIN_RF_SW_CTRL_4 (27)
  3630. #define CC4345_PIN_RF_SW_CTRL_5 (28)
  3631. #define CC4345_PIN_RF_SW_CTRL_6 (29)
  3632. #define CC4345_PIN_RF_SW_CTRL_7 (30)
  3633. #define CC4345_PIN_RF_SW_CTRL_8 (31)
  3634. #define CC4345_PIN_RF_SW_CTRL_9 (32)
  3635. /* 4345 GCI function sel values
  3636. */
  3637. #define CC4345_FNSEL_HWDEF (0)
  3638. #define CC4345_FNSEL_SAMEASPIN (1)
  3639. #define CC4345_FNSEL_GPIO0 (2)
  3640. #define CC4345_FNSEL_GPIO1 (3)
  3641. #define CC4345_FNSEL_GCI0 (4)
  3642. #define CC4345_FNSEL_GCI1 (5)
  3643. #define CC4345_FNSEL_UART (6)
  3644. #define CC4345_FNSEL_SFLASH (7)
  3645. #define CC4345_FNSEL_SPROM (8)
  3646. #define CC4345_FNSEL_MISC0 (9)
  3647. #define CC4345_FNSEL_MISC1 (10)
  3648. #define CC4345_FNSEL_MISC2 (11)
  3649. #define CC4345_FNSEL_IND (12)
  3650. #define CC4345_FNSEL_PDN (13)
  3651. #define CC4345_FNSEL_PUP (14)
  3652. #define CC4345_FNSEL_TRI (15)
  3653. #define MUXENAB4345_UART_MASK (0x0000000f)
  3654. #define MUXENAB4345_UART_SHIFT 0
  3655. #define MUXENAB4345_HOSTWAKE_MASK (0x000000f0)
  3656. #define MUXENAB4345_HOSTWAKE_SHIFT 4
  3657. /* 4349 Group (4349, 4355, 4359) GCI AVS function sel values */
  3658. #define CC4349_GRP_GCI_AVS_CTRL_MASK (0xffe00000)
  3659. #define CC4349_GRP_GCI_AVS_CTRL_SHIFT (21)
  3660. #define CC4349_GRP_GCI_AVS_CTRL_ENAB (1 << 5)
  3661. /* 4345 GCI AVS function sel values */
  3662. #define CC4345_GCI_AVS_CTRL_MASK (0xfc)
  3663. #define CC4345_GCI_AVS_CTRL_SHIFT (2)
  3664. #define CC4345_GCI_AVS_CTRL_ENAB (1 << 5)
  3665. /* 43430 Pin */
  3666. #define CC43430_PIN_GPIO_00 (0)
  3667. #define CC43430_PIN_GPIO_01 (1)
  3668. #define CC43430_PIN_GPIO_02 (2)
  3669. #define CC43430_PIN_GPIO_07 (7)
  3670. #define CC43430_PIN_GPIO_08 (8)
  3671. #define CC43430_PIN_GPIO_09 (9)
  3672. #define CC43430_PIN_GPIO_10 (10)
  3673. #define CC43430_FNSEL_SDIO_INT (2)
  3674. #define CC43430_FNSEL_6_FAST_UART (6)
  3675. #define CC43430_FNSEL_10_FAST_UART (10)
  3676. #define MUXENAB43430_UART_MASK (0x0000000f)
  3677. #define MUXENAB43430_UART_SHIFT 0
  3678. #define MUXENAB43430_HOSTWAKE_MASK (0x000000f0) /* configure GPIO for SDIO host_wake */
  3679. #define MUXENAB43430_HOSTWAKE_SHIFT 4
  3680. #define CC43430_FNSEL_SAMEASPIN (1)
  3681. #define CC43430_RFSWCTRL_EN_MASK (0x7f8)
  3682. #define CC43430_RFSWCTRL_EN_SHIFT (3)
  3683. /* GCI GPIO for function sel GCI-0/GCI-1 */
  3684. #define CC_GCI_GPIO_0 (0)
  3685. #define CC_GCI_GPIO_1 (1)
  3686. #define CC_GCI_GPIO_2 (2)
  3687. #define CC_GCI_GPIO_3 (3)
  3688. #define CC_GCI_GPIO_4 (4)
  3689. #define CC_GCI_GPIO_5 (5)
  3690. #define CC_GCI_GPIO_6 (6)
  3691. #define CC_GCI_GPIO_7 (7)
  3692. #define CC_GCI_GPIO_8 (8)
  3693. #define CC_GCI_GPIO_9 (9)
  3694. #define CC_GCI_GPIO_10 (10)
  3695. #define CC_GCI_GPIO_11 (11)
  3696. #define CC_GCI_GPIO_12 (12)
  3697. #define CC_GCI_GPIO_13 (13)
  3698. #define CC_GCI_GPIO_14 (14)
  3699. #define CC_GCI_GPIO_15 (15)
  3700. /* indicates Invalid GPIO, e.g. when PAD GPIO doesn't map to GCI GPIO */
  3701. #define CC_GCI_GPIO_INVALID 0xFF
  3702. /* find the 4 bit mask given the bit position */
  3703. #define GCIMASK(pos) (((uint32)0xF) << pos)
  3704. /* get the value which can be used to directly OR with chipcontrol reg */
  3705. #define GCIPOSVAL(val, pos) ((((uint32)val) << pos) & GCIMASK(pos))
  3706. /* Extract nibble from a given position */
  3707. #define GCIGETNBL(val, pos) ((val >> pos) & 0xF)
  3708. /* find the 8 bit mask given the bit position */
  3709. #define GCIMASK_8B(pos) (((uint32)0xFF) << pos)
  3710. /* get the value which can be used to directly OR with chipcontrol reg */
  3711. #define GCIPOSVAL_8B(val, pos) ((((uint32)val) << pos) & GCIMASK_8B(pos))
  3712. /* Extract nibble from a given position */
  3713. #define GCIGETNBL_8B(val, pos) ((val >> pos) & 0xFF)
  3714. /* find the 4 bit mask given the bit position */
  3715. #define GCIMASK_4B(pos) (((uint32)0xF) << pos)
  3716. /* get the value which can be used to directly OR with chipcontrol reg */
  3717. #define GCIPOSVAL_4B(val, pos) ((((uint32)val) << pos) & GCIMASK_4B(pos))
  3718. /* Extract nibble from a given position */
  3719. #define GCIGETNBL_4B(val, pos) ((val >> pos) & 0xF)
  3720. /* 4335 GCI Intstatus(Mask)/WakeMask Register bits. */
  3721. #define GCI_INTSTATUS_RBI (1 << 0) /**< Rx Break Interrupt */
  3722. #define GCI_INTSTATUS_UB (1 << 1) /**< UART Break Interrupt */
  3723. #define GCI_INTSTATUS_SPE (1 << 2) /**< SECI Parity Error Interrupt */
  3724. #define GCI_INTSTATUS_SFE (1 << 3) /**< SECI Framing Error Interrupt */
  3725. #define GCI_INTSTATUS_SRITI (1 << 9) /**< SECI Rx Idle Timer Interrupt */
  3726. #define GCI_INTSTATUS_STFF (1 << 10) /**< SECI Tx FIFO Full Interrupt */
  3727. #define GCI_INTSTATUS_STFAE (1 << 11) /**< SECI Tx FIFO Almost Empty Intr */
  3728. #define GCI_INTSTATUS_SRFAF (1 << 12) /**< SECI Rx FIFO Almost Full */
  3729. #define GCI_INTSTATUS_SRFNE (1 << 14) /**< SECI Rx FIFO Not Empty */
  3730. #define GCI_INTSTATUS_SRFOF (1 << 15) /**< SECI Rx FIFO Not Empty Timeout */
  3731. #define GCI_INTSTATUS_EVENT (1 << 21) /* GCI Event Interrupt */
  3732. #define GCI_INTSTATUS_LEVELWAKE (1 << 22) /* GCI Wake Level Interrupt */
  3733. #define GCI_INTSTATUS_EVENTWAKE (1 << 23) /* GCI Wake Event Interrupt */
  3734. #define GCI_INTSTATUS_GPIOINT (1 << 25) /**< GCIGpioInt */
  3735. #define GCI_INTSTATUS_GPIOWAKE (1 << 26) /**< GCIGpioWake */
  3736. #define GCI_INTSTATUS_LHLWLWAKE (1 << 30) /* LHL WL wake */
  3737. /* 4335 GCI IntMask Register bits. */
  3738. #define GCI_INTMASK_RBI (1 << 0) /**< Rx Break Interrupt */
  3739. #define GCI_INTMASK_UB (1 << 1) /**< UART Break Interrupt */
  3740. #define GCI_INTMASK_SPE (1 << 2) /**< SECI Parity Error Interrupt */
  3741. #define GCI_INTMASK_SFE (1 << 3) /**< SECI Framing Error Interrupt */
  3742. #define GCI_INTMASK_SRITI (1 << 9) /**< SECI Rx Idle Timer Interrupt */
  3743. #define GCI_INTMASK_STFF (1 << 10) /**< SECI Tx FIFO Full Interrupt */
  3744. #define GCI_INTMASK_STFAE (1 << 11) /**< SECI Tx FIFO Almost Empty Intr */
  3745. #define GCI_INTMASK_SRFAF (1 << 12) /**< SECI Rx FIFO Almost Full */
  3746. #define GCI_INTMASK_SRFNE (1 << 14) /**< SECI Rx FIFO Not Empty */
  3747. #define GCI_INTMASK_SRFOF (1 << 15) /**< SECI Rx FIFO Not Empty Timeout */
  3748. #define GCI_INTMASK_EVENT (1 << 21) /* GCI Event Interrupt */
  3749. #define GCI_INTMASK_LEVELWAKE (1 << 22) /* GCI Wake Level Interrupt */
  3750. #define GCI_INTMASK_EVENTWAKE (1 << 23) /* GCI Wake Event Interrupt */
  3751. #define GCI_INTMASK_GPIOINT (1 << 25) /**< GCIGpioInt */
  3752. #define GCI_INTMASK_GPIOWAKE (1 << 26) /**< GCIGpioWake */
  3753. #define GCI_INTMASK_LHLWLWAKE (1 << 30) /* LHL WL wake */
  3754. /* 4335 GCI WakeMask Register bits. */
  3755. #define GCI_WAKEMASK_RBI (1 << 0) /**< Rx Break Interrupt */
  3756. #define GCI_WAKEMASK_UB (1 << 1) /**< UART Break Interrupt */
  3757. #define GCI_WAKEMASK_SPE (1 << 2) /**< SECI Parity Error Interrupt */
  3758. #define GCI_WAKEMASK_SFE (1 << 3) /**< SECI Framing Error Interrupt */
  3759. #define GCI_WAKE_SRITI (1 << 9) /**< SECI Rx Idle Timer Interrupt */
  3760. #define GCI_WAKEMASK_STFF (1 << 10) /**< SECI Tx FIFO Full Interrupt */
  3761. #define GCI_WAKEMASK_STFAE (1 << 11) /**< SECI Tx FIFO Almost Empty Intr */
  3762. #define GCI_WAKEMASK_SRFAF (1 << 12) /**< SECI Rx FIFO Almost Full */
  3763. #define GCI_WAKEMASK_SRFNE (1 << 14) /**< SECI Rx FIFO Not Empty */
  3764. #define GCI_WAKEMASK_SRFOF (1 << 15) /**< SECI Rx FIFO Not Empty Timeout */
  3765. #define GCI_WAKEMASK_EVENT (1 << 21) /* GCI Event Interrupt */
  3766. #define GCI_WAKEMASK_LEVELWAKE (1 << 22) /* GCI Wake Level Interrupt */
  3767. #define GCI_WAKEMASK_EVENTWAKE (1 << 23) /* GCI Wake Event Interrupt */
  3768. #define GCI_WAKEMASK_GPIOINT (1 << 25) /**< GCIGpioInt */
  3769. #define GCI_WAKEMASK_GPIOWAKE (1 << 26) /**< GCIGpioWake */
  3770. #define GCI_WAKEMASK_LHLWLWAKE (1 << 30) /* LHL WL wake */
  3771. #define GCI_WAKE_ON_GCI_GPIO1 1
  3772. #define GCI_WAKE_ON_GCI_GPIO2 2
  3773. #define GCI_WAKE_ON_GCI_GPIO3 3
  3774. #define GCI_WAKE_ON_GCI_GPIO4 4
  3775. #define GCI_WAKE_ON_GCI_GPIO5 5
  3776. #define GCI_WAKE_ON_GCI_GPIO6 6
  3777. #define GCI_WAKE_ON_GCI_GPIO7 7
  3778. #define GCI_WAKE_ON_GCI_GPIO8 8
  3779. #define GCI_WAKE_ON_GCI_SECI_IN 9
  3780. #define PMU_EXT_WAKE_MASK_0_SDIO (1 << 2)
  3781. /* =========== LHL regs =========== */
  3782. #define LHL_PWRSEQCTL_SLEEP_EN (1 << 0)
  3783. #define LHL_PWRSEQCTL_PMU_SLEEP_MODE (1 << 1)
  3784. #define LHL_PWRSEQCTL_PMU_FINAL_PMU_SLEEP_EN (1 << 2)
  3785. #define LHL_PWRSEQCTL_PMU_TOP_ISO_EN (1 << 3)
  3786. #define LHL_PWRSEQCTL_PMU_TOP_SLB_EN (1 << 4)
  3787. #define LHL_PWRSEQCTL_PMU_TOP_PWRSW_EN (1 << 5)
  3788. #define LHL_PWRSEQCTL_PMU_CLDO_PD (1 << 6)
  3789. #define LHL_PWRSEQCTL_PMU_LPLDO_PD (1 << 7)
  3790. #define LHL_PWRSEQCTL_PMU_RSRC6_EN (1 << 8)
  3791. #define PMU_SLEEP_MODE_0 (LHL_PWRSEQCTL_SLEEP_EN |\
  3792. LHL_PWRSEQCTL_PMU_FINAL_PMU_SLEEP_EN)
  3793. #define PMU_SLEEP_MODE_1 (LHL_PWRSEQCTL_SLEEP_EN |\
  3794. LHL_PWRSEQCTL_PMU_SLEEP_MODE |\
  3795. LHL_PWRSEQCTL_PMU_FINAL_PMU_SLEEP_EN |\
  3796. LHL_PWRSEQCTL_PMU_TOP_ISO_EN |\
  3797. LHL_PWRSEQCTL_PMU_TOP_SLB_EN |\
  3798. LHL_PWRSEQCTL_PMU_TOP_PWRSW_EN |\
  3799. LHL_PWRSEQCTL_PMU_CLDO_PD |\
  3800. LHL_PWRSEQCTL_PMU_RSRC6_EN)
  3801. #define PMU_SLEEP_MODE_2 (LHL_PWRSEQCTL_SLEEP_EN |\
  3802. LHL_PWRSEQCTL_PMU_SLEEP_MODE |\
  3803. LHL_PWRSEQCTL_PMU_FINAL_PMU_SLEEP_EN |\
  3804. LHL_PWRSEQCTL_PMU_TOP_ISO_EN |\
  3805. LHL_PWRSEQCTL_PMU_TOP_SLB_EN |\
  3806. LHL_PWRSEQCTL_PMU_TOP_PWRSW_EN |\
  3807. LHL_PWRSEQCTL_PMU_CLDO_PD |\
  3808. LHL_PWRSEQCTL_PMU_LPLDO_PD |\
  3809. LHL_PWRSEQCTL_PMU_RSRC6_EN)
  3810. #define LHL_PWRSEQ_CTL (0x000000ff)
  3811. /* LHL Top Level Power Up Control Register (lhl_top_pwrup_ctl_adr, Offset 0xE78)
  3812. * Top Level Counter values for isolation, retention, Power Switch control
  3813. */
  3814. #define LHL_PWRUP_ISOLATION_CNT (0x6 << 8)
  3815. #define LHL_PWRUP_RETENTION_CNT (0x5 << 16)
  3816. #define LHL_PWRUP_PWRSW_CNT (0x7 << 24)
  3817. /* Mask is taken only for isolation 8:13 , Retention 16:21 ,
  3818. * Power Switch control 24:29
  3819. */
  3820. #define LHL_PWRUP_CTL_MASK (0x3F3F3F00)
  3821. #define LHL_PWRUP_CTL (LHL_PWRUP_ISOLATION_CNT |\
  3822. LHL_PWRUP_RETENTION_CNT |\
  3823. LHL_PWRUP_PWRSW_CNT)
  3824. #define LHL_PWRUP_ISOLATION_CNT_4347 (0x7 << 8)
  3825. #define LHL_PWRUP_RETENTION_CNT_4347 (0x5 << 16)
  3826. #define LHL_PWRUP_PWRSW_CNT_4347 (0x7 << 24)
  3827. #define LHL_PWRUP_CTL_4347 (LHL_PWRUP_ISOLATION_CNT_4347 |\
  3828. LHL_PWRUP_RETENTION_CNT_4347 |\
  3829. LHL_PWRUP_PWRSW_CNT_4347)
  3830. #define LHL_PWRUP2_CLDO_DN_CNT (0x0)
  3831. #define LHL_PWRUP2_LPLDO_DN_CNT (0x0 << 8)
  3832. #define LHL_PWRUP2_RSRC6_DN_CN (0x4 << 16)
  3833. #define LHL_PWRUP2_RSRC7_DN_CN (0x0 << 24)
  3834. #define LHL_PWRUP2_CTL_MASK (0x3F3F3F3F)
  3835. #define LHL_PWRUP2_CTL (LHL_PWRUP2_CLDO_DN_CNT |\
  3836. LHL_PWRUP2_LPLDO_DN_CNT |\
  3837. LHL_PWRUP2_RSRC6_DN_CN |\
  3838. LHL_PWRUP2_RSRC7_DN_CN)
  3839. /* LHL Top Level Power Down Control Register (lhl_top_pwrdn_ctl_adr, Offset 0xE74) */
  3840. #define LHL_PWRDN_SLEEP_CNT (0x4)
  3841. #define LHL_PWRDN_CTL_MASK (0x3F)
  3842. /* LHL Top Level Power Down Control 2 Register (lhl_top_pwrdn2_ctl_adr, Offset 0xE80) */
  3843. #define LHL_PWRDN2_CLDO_DN_CNT (0x4)
  3844. #define LHL_PWRDN2_LPLDO_DN_CNT (0x4 << 8)
  3845. #define LHL_PWRDN2_RSRC6_DN_CN (0x3 << 16)
  3846. #define LHL_PWRDN2_RSRC7_DN_CN (0x0 << 24)
  3847. #define LHL_PWRDN2_CTL (LHL_PWRDN2_CLDO_DN_CNT |\
  3848. LHL_PWRDN2_LPLDO_DN_CNT |\
  3849. LHL_PWRDN2_RSRC6_DN_CN |\
  3850. LHL_PWRDN2_RSRC7_DN_CN)
  3851. #define LHL_PWRDN2_CTL_MASK (0x3F3F3F3F)
  3852. #define LHL_FAST_WRITE_EN (1 << 14)
  3853. /* WL ARM Timer0 Interrupt Mask (lhl_wl_armtim0_intrp_adr) */
  3854. #define LHL_WL_ARMTIM0_INTRP_EN 0x00000001
  3855. #define LHL_WL_ARMTIM0_INTRP_EDGE_TRIGGER 0x00000002
  3856. /* WL MAC Timer0 Interrupt Mask (lhl_wl_mactim0_intrp_adr) */
  3857. #define LHL_WL_MACTIM0_INTRP_EN 0x00000001
  3858. #define LHL_WL_MACTIM0_INTRP_EDGE_TRIGGER 0x00000002
  3859. /* LHL Wakeup Status (lhl_wkup_status_adr) */
  3860. #define LHL_WKUP_STATUS_WR_PENDING_ARMTIM0 0x00100000
  3861. /* WL ARM Timer0 Interrupt Status (lhl_wl_armtim0_st_adr) */
  3862. #define LHL_WL_ARMTIM0_ST_WL_ARMTIM_INT_ST 0x00000001
  3863. #define LHL_PS_MODE_0 0
  3864. #define LHL_PS_MODE_1 1
  3865. /* GCI EventIntMask Register SW bits */
  3866. #define GCI_MAILBOXDATA_TOWLAN (1 << 0)
  3867. #define GCI_MAILBOXDATA_TOBT (1 << 1)
  3868. #define GCI_MAILBOXDATA_TONFC (1 << 2)
  3869. #define GCI_MAILBOXDATA_TOGPS (1 << 3)
  3870. #define GCI_MAILBOXDATA_TOLTE (1 << 4)
  3871. #define GCI_MAILBOXACK_TOWLAN (1 << 8)
  3872. #define GCI_MAILBOXACK_TOBT (1 << 9)
  3873. #define GCI_MAILBOXACK_TONFC (1 << 10)
  3874. #define GCI_MAILBOXACK_TOGPS (1 << 11)
  3875. #define GCI_MAILBOXACK_TOLTE (1 << 12)
  3876. #define GCI_WAKE_TOWLAN (1 << 16)
  3877. #define GCI_WAKE_TOBT (1 << 17)
  3878. #define GCI_WAKE_TONFC (1 << 18)
  3879. #define GCI_WAKE_TOGPS (1 << 19)
  3880. #define GCI_WAKE_TOLTE (1 << 20)
  3881. #define GCI_SWREADY (1 << 24)
  3882. /* 4349 Group (4349, 4355, 4359) GCI SECI_OUT TX Status Regiser bits */
  3883. #define GCI_SECIOUT_TXSTATUS_TXHALT (1 << 0)
  3884. #define GCI_SECIOUT_TXSTATUS_TI (1 << 16)
  3885. /* 4335 MUX options. each nibble belongs to a setting. Non-zero value specifies a logic
  3886. * for now only UART for bootloader.
  3887. */
  3888. #define MUXENAB4335_UART_MASK (0x0000000f)
  3889. #define MUXENAB4335_UART_SHIFT 0
  3890. #define MUXENAB4335_HOSTWAKE_MASK (0x000000f0) /**< configure GPIO for SDIO host_wake */
  3891. #define MUXENAB4335_HOSTWAKE_SHIFT 4
  3892. #define MUXENAB4335_GETIX(val, name) \
  3893. ((((val) & MUXENAB4335_ ## name ## _MASK) >> MUXENAB4335_ ## name ## _SHIFT) - 1)
  3894. /* 43012 MUX options */
  3895. #define MUXENAB43012_HOSTWAKE_MASK (0x00000001)
  3896. #define MUXENAB43012_GETIX(val, name) (val - 1)
  3897. /*
  3898. * Maximum delay for the PMU state transition in us.
  3899. * This is an upper bound intended for spinwaits etc.
  3900. */
  3901. #define PMU_MAX_TRANSITION_DLY 15000
  3902. /* PMU resource up transition time in ILP cycles */
  3903. #define PMURES_UP_TRANSITION 2
  3904. /* 53573 PMU Resource */
  3905. #define RES53573_REGULATOR_PU 0
  3906. #define RES53573_XTALLDO_PU 1
  3907. #define RES53573_XTAL_PU 2
  3908. #define RES53573_MINI_PMU 3
  3909. #define RES53573_RADIO_PU 4
  3910. #define RES53573_ILP_REQ 5
  3911. #define RES53573_ALP_AVAIL 6
  3912. #define RES53573_CPUPLL_LDO_PU 7
  3913. #define RES53573_CPU_PLL_PU 8
  3914. #define RES53573_WLAN_BB_PLL_PU 9
  3915. #define RES53573_MISCPLL_LDO_PU 10
  3916. #define RES53573_MISCPLL_PU 11
  3917. #define RES53573_AUDIOPLL_PU 12
  3918. #define RES53573_PCIEPLL_LDO_PU 13
  3919. #define RES53573_PCIEPLL_PU 14
  3920. #define RES53573_DDRPLL_LDO_PU 15
  3921. #define RES53573_DDRPLL_PU 16
  3922. #define RES53573_HT_AVAIL 17
  3923. #define RES53573_MACPHY_CLK_AVAIL 18
  3924. #define RES53573_OTP_PU 19
  3925. #define RES53573_RSVD20 20
  3926. /* 53573 Chip status registers */
  3927. #define CST53573_LOCK_CPUPLL 0x00000001
  3928. #define CST53573_LOCK_MISCPLL 0x00000002
  3929. #define CST53573_LOCK_DDRPLL 0x00000004
  3930. #define CST53573_LOCK_PCIEPLL 0x00000008
  3931. #define CST53573_EPHY_ENERGY_DET 0x00001f00
  3932. #define CST53573_RAW_ENERGY 0x0003e000
  3933. #define CST53573_BBPLL_LOCKED_O 0x00040000
  3934. #define CST53573_SERDES_PIPE_PLLLOCK 0x00080000
  3935. #define CST53573_STRAP_PCIE_EP_MODE 0x00100000
  3936. #define CST53573_EPHY_PLL_LOCK 0x00200000
  3937. #define CST53573_AUDIO_PLL_LOCKED_O 0x00400000
  3938. #define CST53573_PCIE_LINK_IN_L11 0x01000000
  3939. #define CST53573_PCIE_LINK_IN_L12 0x02000000
  3940. #define CST53573_DIN_PACKAGEOPTION 0xf0000000
  3941. /* 53573 Chip control registers macro definitions */
  3942. #define PMU_53573_CHIPCTL1 1
  3943. #define PMU_53573_CC1_HT_CLK_REQ_CTRL_MASK 0x00000010
  3944. #define PMU_53573_CC1_HT_CLK_REQ_CTRL 0x00000010
  3945. #define PMU_53573_CHIPCTL3 3
  3946. #define PMU_53573_CC3_ENABLE_CLOSED_LOOP_MASK 0x00000010
  3947. #define PMU_53573_CC3_ENABLE_CLOSED_LOOP 0x00000000
  3948. #define PMU_53573_CC3_ENABLE_BBPLL_PWRDOWN_MASK 0x00000002
  3949. #define PMU_53573_CC3_ENABLE_BBPLL_PWRDOWN 0x00000002
  3950. #define CST53573_CHIPMODE_PCIE(cs) FALSE
  3951. /* SECI Status (0x134) & Mask (0x138) bits - Rev 35 */
  3952. #define SECI_STAT_BI (1 << 0) /* Break Interrupt */
  3953. #define SECI_STAT_SPE (1 << 1) /* Parity Error */
  3954. #define SECI_STAT_SFE (1 << 2) /* Parity Error */
  3955. #define SECI_STAT_SDU (1 << 3) /* Data Updated */
  3956. #define SECI_STAT_SADU (1 << 4) /* Auxiliary Data Updated */
  3957. #define SECI_STAT_SAS (1 << 6) /* AUX State */
  3958. #define SECI_STAT_SAS2 (1 << 7) /* AUX2 State */
  3959. #define SECI_STAT_SRITI (1 << 8) /* Idle Timer Interrupt */
  3960. #define SECI_STAT_STFF (1 << 9) /* Tx FIFO Full */
  3961. #define SECI_STAT_STFAE (1 << 10) /* Tx FIFO Almost Empty */
  3962. #define SECI_STAT_SRFE (1 << 11) /* Rx FIFO Empty */
  3963. #define SECI_STAT_SRFAF (1 << 12) /* Rx FIFO Almost Full */
  3964. #define SECI_STAT_SFCE (1 << 13) /* Flow Control Event */
  3965. /* SECI configuration */
  3966. #define SECI_MODE_UART 0x0
  3967. #define SECI_MODE_SECI 0x1
  3968. #define SECI_MODE_LEGACY_3WIRE_BT 0x2
  3969. #define SECI_MODE_LEGACY_3WIRE_WLAN 0x3
  3970. #define SECI_MODE_HALF_SECI 0x4
  3971. #define SECI_RESET (1 << 0)
  3972. #define SECI_RESET_BAR_UART (1 << 1)
  3973. #define SECI_ENAB_SECI_ECI (1 << 2)
  3974. #define SECI_ENAB_SECIOUT_DIS (1 << 3)
  3975. #define SECI_MODE_MASK 0x7
  3976. #define SECI_MODE_SHIFT 4 /* (bits 5, 6, 7) */
  3977. #define SECI_UPD_SECI (1 << 7)
  3978. #define SECI_AUX_TX_START (1 << 31)
  3979. #define SECI_SLIP_ESC_CHAR 0xDB
  3980. #define SECI_SIGNOFF_0 SECI_SLIP_ESC_CHAR
  3981. #define SECI_SIGNOFF_1 0
  3982. #define SECI_REFRESH_REQ 0xDA
  3983. /* seci clk_ctl_st bits */
  3984. #define CLKCTL_STS_HT_AVAIL_REQ (1 << 4)
  3985. #define CLKCTL_STS_SECI_CLK_REQ (1 << 8)
  3986. #define CLKCTL_STS_SECI_CLK_AVAIL (1 << 24)
  3987. #define SECI_UART_MSR_CTS_STATE (1 << 0)
  3988. #define SECI_UART_MSR_RTS_STATE (1 << 1)
  3989. #define SECI_UART_SECI_IN_STATE (1 << 2)
  3990. #define SECI_UART_SECI_IN2_STATE (1 << 3)
  3991. /* GCI RX FIFO Control Register */
  3992. #define GCI_RXF_LVL_MASK (0xFF << 0)
  3993. #define GCI_RXF_TIMEOUT_MASK (0xFF << 8)
  3994. /* GCI UART Registers' Bit definitions */
  3995. /* Seci Fifo Level Register */
  3996. #define SECI_TXF_LVL_MASK (0x3F << 8)
  3997. #define TXF_AE_LVL_DEFAULT 0x4
  3998. #define SECI_RXF_LVL_FC_MASK (0x3F << 16)
  3999. /* SeciUARTFCR Bit definitions */
  4000. #define SECI_UART_FCR_RFR (1 << 0)
  4001. #define SECI_UART_FCR_TFR (1 << 1)
  4002. #define SECI_UART_FCR_SR (1 << 2)
  4003. #define SECI_UART_FCR_THP (1 << 3)
  4004. #define SECI_UART_FCR_AB (1 << 4)
  4005. #define SECI_UART_FCR_ATOE (1 << 5)
  4006. #define SECI_UART_FCR_ARTSOE (1 << 6)
  4007. #define SECI_UART_FCR_ABV (1 << 7)
  4008. #define SECI_UART_FCR_ALM (1 << 8)
  4009. /* SECI UART LCR register bits */
  4010. #define SECI_UART_LCR_STOP_BITS (1 << 0) /* 0 - 1bit, 1 - 2bits */
  4011. #define SECI_UART_LCR_PARITY_EN (1 << 1)
  4012. #define SECI_UART_LCR_PARITY (1 << 2) /* 0 - odd, 1 - even */
  4013. #define SECI_UART_LCR_RX_EN (1 << 3)
  4014. #define SECI_UART_LCR_LBRK_CTRL (1 << 4) /* 1 => SECI_OUT held low */
  4015. #define SECI_UART_LCR_TXO_EN (1 << 5)
  4016. #define SECI_UART_LCR_RTSO_EN (1 << 6)
  4017. #define SECI_UART_LCR_SLIPMODE_EN (1 << 7)
  4018. #define SECI_UART_LCR_RXCRC_CHK (1 << 8)
  4019. #define SECI_UART_LCR_TXCRC_INV (1 << 9)
  4020. #define SECI_UART_LCR_TXCRC_LSBF (1 << 10)
  4021. #define SECI_UART_LCR_TXCRC_EN (1 << 11)
  4022. #define SECI_UART_LCR_RXSYNC_EN (1 << 12)
  4023. #define SECI_UART_MCR_TX_EN (1 << 0)
  4024. #define SECI_UART_MCR_PRTS (1 << 1)
  4025. #define SECI_UART_MCR_SWFLCTRL_EN (1 << 2)
  4026. #define SECI_UART_MCR_HIGHRATE_EN (1 << 3)
  4027. #define SECI_UART_MCR_LOOPBK_EN (1 << 4)
  4028. #define SECI_UART_MCR_AUTO_RTS (1 << 5)
  4029. #define SECI_UART_MCR_AUTO_TX_DIS (1 << 6)
  4030. #define SECI_UART_MCR_BAUD_ADJ_EN (1 << 7)
  4031. #define SECI_UART_MCR_XONOFF_RPT (1 << 9)
  4032. /* SeciUARTLSR Bit Mask */
  4033. #define SECI_UART_LSR_RXOVR_MASK (1 << 0)
  4034. #define SECI_UART_LSR_RFF_MASK (1 << 1)
  4035. #define SECI_UART_LSR_TFNE_MASK (1 << 2)
  4036. #define SECI_UART_LSR_TI_MASK (1 << 3)
  4037. #define SECI_UART_LSR_TPR_MASK (1 << 4)
  4038. #define SECI_UART_LSR_TXHALT_MASK (1 << 5)
  4039. /* SeciUARTMSR Bit Mask */
  4040. #define SECI_UART_MSR_CTSS_MASK (1 << 0)
  4041. #define SECI_UART_MSR_RTSS_MASK (1 << 1)
  4042. #define SECI_UART_MSR_SIS_MASK (1 << 2)
  4043. #define SECI_UART_MSR_SIS2_MASK (1 << 3)
  4044. /* SeciUARTData Bits */
  4045. #define SECI_UART_DATA_RF_NOT_EMPTY_BIT (1 << 12)
  4046. #define SECI_UART_DATA_RF_FULL_BIT (1 << 13)
  4047. #define SECI_UART_DATA_RF_OVRFLOW_BIT (1 << 14)
  4048. #define SECI_UART_DATA_FIFO_PTR_MASK 0xFF
  4049. #define SECI_UART_DATA_RF_RD_PTR_SHIFT 16
  4050. #define SECI_UART_DATA_RF_WR_PTR_SHIFT 24
  4051. /* LTECX: ltecxmux */
  4052. #define LTECX_EXTRACT_MUX(val, idx) (getbit4(&(val), (idx)))
  4053. /* LTECX: ltecxmux MODE */
  4054. #define LTECX_MUX_MODE_IDX 0
  4055. #define LTECX_MUX_MODE_WCI2 0x0
  4056. #define LTECX_MUX_MODE_GPIO 0x1
  4057. /* LTECX GPIO Information Index */
  4058. #define LTECX_NVRAM_FSYNC_IDX 0
  4059. #define LTECX_NVRAM_LTERX_IDX 1
  4060. #define LTECX_NVRAM_LTETX_IDX 2
  4061. #define LTECX_NVRAM_WLPRIO_IDX 3
  4062. /* LTECX WCI2 Information Index */
  4063. #define LTECX_NVRAM_WCI2IN_IDX 0
  4064. #define LTECX_NVRAM_WCI2OUT_IDX 1
  4065. /* LTECX: Macros to get GPIO/FNSEL/GCIGPIO */
  4066. #define LTECX_EXTRACT_PADNUM(val, idx) (getbit8(&(val), (idx)))
  4067. #define LTECX_EXTRACT_FNSEL(val, idx) (getbit4(&(val), (idx)))
  4068. #define LTECX_EXTRACT_GCIGPIO(val, idx) (getbit4(&(val), (idx)))
  4069. /* WLAN channel numbers - used from wifi.h */
  4070. /* WLAN BW */
  4071. #define ECI_BW_20 0x0
  4072. #define ECI_BW_25 0x1
  4073. #define ECI_BW_30 0x2
  4074. #define ECI_BW_35 0x3
  4075. #define ECI_BW_40 0x4
  4076. #define ECI_BW_45 0x5
  4077. #define ECI_BW_50 0x6
  4078. #define ECI_BW_ALL 0x7
  4079. /* WLAN - number of antenna */
  4080. #define WLAN_NUM_ANT1 TXANT_0
  4081. #define WLAN_NUM_ANT2 TXANT_1
  4082. /* otpctrl1 0xF4 */
  4083. #define OTPC_FORCE_PWR_OFF 0x02000000
  4084. /* chipcommon s/r registers introduced with cc rev >= 48 */
  4085. #define CC_SR_CTL0_ENABLE_MASK 0x1
  4086. #define CC_SR_CTL0_ENABLE_SHIFT 0
  4087. #define CC_SR_CTL0_EN_SR_ENG_CLK_SHIFT 1 /* sr_clk to sr_memory enable */
  4088. #define CC_SR_CTL0_RSRC_TRIGGER_SHIFT 2 /* Rising edge resource trigger 0 to sr_engine */
  4089. #define CC_SR_CTL0_MIN_DIV_SHIFT 6 /* Min division value for fast clk in sr_engine */
  4090. #define CC_SR_CTL0_EN_SBC_STBY_SHIFT 16 /* Allow Subcore mem StandBy? */
  4091. #define CC_SR_CTL0_EN_SR_ALP_CLK_MASK_SHIFT 18
  4092. #define CC_SR_CTL0_EN_SR_HT_CLK_SHIFT 19
  4093. #define CC_SR_CTL0_ALLOW_PIC_SHIFT 20 /* Allow pic to separate power domains */
  4094. #define CC_SR_CTL0_MAX_SR_LQ_CLK_CNT_SHIFT 25
  4095. #define CC_SR_CTL0_EN_MEM_DISABLE_FOR_SLEEP 30
  4096. #define CC_SR_CTL1_SR_INIT_MASK 0x3FF
  4097. #define CC_SR_CTL1_SR_INIT_SHIFT 0
  4098. #define ECI_INLO_PKTDUR_MASK 0x000000f0 /* [7:4] - 4 bits */
  4099. #define ECI_INLO_PKTDUR_SHIFT 4
  4100. /* gci chip control bits */
  4101. #define GCI_GPIO_CHIPCTRL_ENAB_IN_BIT 0
  4102. #define GCI_GPIO_CHIPCTRL_ENAB_OP_BIT 1
  4103. #define GCI_GPIO_CHIPCTRL_INVERT_BIT 2
  4104. #define GCI_GPIO_CHIPCTRL_PULLUP_BIT 3
  4105. #define GCI_GPIO_CHIPCTRL_PULLDN_BIT 4
  4106. #define GCI_GPIO_CHIPCTRL_ENAB_BTSIG_BIT 5
  4107. #define GCI_GPIO_CHIPCTRL_ENAB_OD_OP_BIT 6
  4108. #define GCI_GPIO_CHIPCTRL_ENAB_EXT_GPIO_BIT 7
  4109. /* gci GPIO input status bits */
  4110. #define GCI_GPIO_STS_VALUE_BIT 0
  4111. #define GCI_GPIO_STS_POS_EDGE_BIT 1
  4112. #define GCI_GPIO_STS_NEG_EDGE_BIT 2
  4113. #define GCI_GPIO_STS_FAST_EDGE_BIT 3
  4114. #define GCI_GPIO_STS_CLEAR 0xF
  4115. #define GCI_GPIO_STS_EDGE_TRIG_BIT 0
  4116. #define GCI_GPIO_STS_NEG_EDGE_TRIG_BIT 1
  4117. #define GCI_GPIO_STS_DUAL_EDGE_TRIG_BIT 2
  4118. #define GCI_GPIO_STS_WL_DIN_SELECT 6
  4119. #define GCI_GPIO_STS_VALUE (1 << GCI_GPIO_STS_VALUE_BIT)
  4120. /* SR Power Control */
  4121. #define SRPWR_DMN0_PCIE (0) /* PCIE */
  4122. #define SRPWR_DMN0_PCIE_SHIFT (SRPWR_DMN0_PCIE) /* PCIE */
  4123. #define SRPWR_DMN0_PCIE_MASK (1 << SRPWR_DMN0_PCIE_SHIFT) /* PCIE */
  4124. #define SRPWR_DMN1_ARMBPSD (1) /* ARM/BP/SDIO */
  4125. #define SRPWR_DMN1_ARMBPSD_SHIFT (SRPWR_DMN1_ARMBPSD) /* ARM/BP/SDIO */
  4126. #define SRPWR_DMN1_ARMBPSD_MASK (1 << SRPWR_DMN1_ARMBPSD_SHIFT) /* ARM/BP/SDIO */
  4127. #define SRPWR_DMN2_MACAUX (2) /* MAC/Phy Aux */
  4128. #define SRPWR_DMN2_MACAUX_SHIFT (SRPWR_DMN2_MACAUX) /* MAC/Phy Aux */
  4129. #define SRPWR_DMN2_MACAUX_MASK (1 << SRPWR_DMN2_MACAUX_SHIFT) /* MAC/Phy Aux */
  4130. #define SRPWR_DMN3_MACMAIN (3) /* MAC/Phy Main */
  4131. #define SRPWR_DMN3_MACMAIN_SHIFT (SRPWR_DMN3_MACMAIN) /* MAC/Phy Main */
  4132. #define SRPWR_DMN3_MACMAIN_MASK (1 << SRPWR_DMN3_MACMAIN_SHIFT) /* MAC/Phy Main */
  4133. #define SRPWR_DMN4_MACSCAN (4) /* MAC/Phy Scan */
  4134. #define SRPWR_DMN4_MACSCAN_SHIFT (SRPWR_DMN4_MACSCAN) /* MAC/Phy Scan */
  4135. #define SRPWR_DMN4_MACSCAN_MASK (1 << SRPWR_DMN4_MACSCAN_SHIFT) /* MAC/Phy Scan */
  4136. /* all power domain mask */
  4137. #define SRPWR_DMN_ALL_MASK(sih) si_srpwr_domain_all_mask(sih)
  4138. #define SRPWR_REQON_SHIFT (8) /* PowerOnRequest[11:8] */
  4139. #define SRPWR_REQON_MASK(sih) (SRPWR_DMN_ALL_MASK(sih) << SRPWR_REQON_SHIFT)
  4140. #define SRPWR_STATUS_SHIFT (16) /* ExtPwrStatus[19:16], RO */
  4141. #define SRPWR_STATUS_MASK(sih) (SRPWR_DMN_ALL_MASK(sih) << SRPWR_STATUS_SHIFT)
  4142. #define SRPWR_DMN_ID_SHIFT (28) /* PowerDomain[31:28], RO */
  4143. #define SRPWR_DMN_ID_MASK (0xF)
  4144. /* PMU Precision Usec Timer */
  4145. #define PMU_PREC_USEC_TIMER_ENABLE 0x1
  4146. /* FISCtrlStatus */
  4147. #define PMU_CLEAR_FIS_DONE_SHIFT 1u
  4148. #define PMU_CLEAR_FIS_DONE_MASK (1u << PMU_CLEAR_FIS_DONE_SHIFT)
  4149. #endif /* _SBCHIPC_H */