pinctrl-atlas7.c 152 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890
  1. /*
  2. * pinctrl pads, groups, functions for CSR SiRFatlasVII
  3. *
  4. * Copyright (c) 2011 - 2014 Cambridge Silicon Radio Limited, a CSR plc group
  5. * company.
  6. *
  7. * Licensed under GPLv2 or later.
  8. */
  9. #include <linux/module.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/io.h>
  12. #include <linux/bitops.h>
  13. #include <linux/irq.h>
  14. #include <linux/slab.h>
  15. #include <linux/clk.h>
  16. #include <linux/of.h>
  17. #include <linux/of_address.h>
  18. #include <linux/of_device.h>
  19. #include <linux/of_platform.h>
  20. #include <linux/of_irq.h>
  21. #include <linux/of_gpio.h>
  22. #include <linux/pinctrl/machine.h>
  23. #include <linux/pinctrl/pinconf.h>
  24. #include <linux/pinctrl/pinctrl.h>
  25. #include <linux/pinctrl/pinmux.h>
  26. #include <linux/pinctrl/consumer.h>
  27. #include <linux/pinctrl/pinconf-generic.h>
  28. #include <linux/gpio.h>
  29. /* Definition of Pad&Mux Properties */
  30. #define N 0
  31. /* The Bank contains input-disable regisgers */
  32. #define BANK_DS 0
  33. /* Clear Register offset */
  34. #define CLR_REG(r) ((r) + 0x04)
  35. /* Definition of multiple function select register */
  36. #define FUNC_CLEAR_MASK 0x7
  37. #define FUNC_GPIO 0
  38. #define FUNC_ANALOGUE 0x8
  39. #define ANA_CLEAR_MASK 0x1
  40. /* The Atlas7's Pad Type List */
  41. enum altas7_pad_type {
  42. PAD_T_4WE_PD = 0, /* ZIO_PAD3V_4WE_PD */
  43. PAD_T_4WE_PU, /* ZIO_PAD3V_4WE_PD */
  44. PAD_T_16ST, /* ZIO_PAD3V_SDCLK_PD */
  45. PAD_T_M31_0204_PD, /* PRDW0204SDGZ_M311311_PD */
  46. PAD_T_M31_0204_PU, /* PRDW0204SDGZ_M311311_PU */
  47. PAD_T_M31_0610_PD, /* PRUW0610SDGZ_M311311_PD */
  48. PAD_T_M31_0610_PU, /* PRUW0610SDGZ_M311311_PU */
  49. PAD_T_AD, /* PRDWUWHW08SCDG_HZ */
  50. };
  51. /* Raw value of Driver-Strength Bits */
  52. #define DS3 BIT(3)
  53. #define DS2 BIT(2)
  54. #define DS1 BIT(1)
  55. #define DS0 BIT(0)
  56. #define DSZ 0
  57. /* Drive-Strength Intermediate Values */
  58. #define DS_NULL -1
  59. #define DS_1BIT_IM_VAL DS0
  60. #define DS_1BIT_MASK 0x1
  61. #define DS_2BIT_IM_VAL (DS1 | DS0)
  62. #define DS_2BIT_MASK 0x3
  63. #define DS_4BIT_IM_VAL (DS3 | DS2 | DS1 | DS0)
  64. #define DS_4BIT_MASK 0xf
  65. /* The Drive-Strength of 4WE Pad DS1 0 CO */
  66. #define DS_4WE_3 (DS1 | DS0) /* 1 1 3 */
  67. #define DS_4WE_2 (DS1) /* 1 0 2 */
  68. #define DS_4WE_1 (DS0) /* 0 1 1 */
  69. #define DS_4WE_0 (DSZ) /* 0 0 0 */
  70. /* The Drive-Strength of 16st Pad DS3 2 1 0 CO */
  71. #define DS_16ST_15 (DS3 | DS2 | DS1 | DS0) /* 1 1 1 1 15 */
  72. #define DS_16ST_14 (DS3 | DS2 | DS0) /* 1 1 0 1 13 */
  73. #define DS_16ST_13 (DS3 | DS2 | DS1) /* 1 1 1 0 14 */
  74. #define DS_16ST_12 (DS2 | DS1 | DS0) /* 0 1 1 1 7 */
  75. #define DS_16ST_11 (DS2 | DS0) /* 0 1 0 1 5 */
  76. #define DS_16ST_10 (DS3 | DS1 | DS0) /* 1 0 1 1 11 */
  77. #define DS_16ST_9 (DS3 | DS0) /* 1 0 0 1 9 */
  78. #define DS_16ST_8 (DS1 | DS0) /* 0 0 1 1 3 */
  79. #define DS_16ST_7 (DS2 | DS1) /* 0 1 1 0 6 */
  80. #define DS_16ST_6 (DS3 | DS2) /* 1 1 0 0 12 */
  81. #define DS_16ST_5 (DS2) /* 0 1 0 0 4 */
  82. #define DS_16ST_4 (DS3 | DS1) /* 1 0 1 0 10 */
  83. #define DS_16ST_3 (DS1) /* 0 0 1 0 2 */
  84. #define DS_16ST_2 (DS0) /* 0 0 0 1 1 */
  85. #define DS_16ST_1 (DSZ) /* 0 0 0 0 0 */
  86. #define DS_16ST_0 (DS3) /* 1 0 0 0 8 */
  87. /* The Drive-Strength of M31 Pad DS0 CO */
  88. #define DS_M31_0 (DSZ) /* 0 0 */
  89. #define DS_M31_1 (DS0) /* 1 1 */
  90. /* Raw values of Pull Option Bits */
  91. #define PUN BIT(1)
  92. #define PD BIT(0)
  93. #define PE BIT(0)
  94. #define PZ 0
  95. /* Definition of Pull Types */
  96. #define PULL_UP 0
  97. #define HIGH_HYSTERESIS 1
  98. #define HIGH_Z 2
  99. #define PULL_DOWN 3
  100. #define PULL_DISABLE 4
  101. #define PULL_ENABLE 5
  102. #define PULL_UNKNOWN -1
  103. /* Pull Options for 4WE Pad PUN PD CO */
  104. #define P4WE_PULL_MASK 0x3
  105. #define P4WE_PULL_DOWN (PUN | PD) /* 1 1 3 */
  106. #define P4WE_HIGH_Z (PUN) /* 1 0 2 */
  107. #define P4WE_HIGH_HYSTERESIS (PD) /* 0 1 1 */
  108. #define P4WE_PULL_UP (PZ) /* 0 0 0 */
  109. /* Pull Options for 16ST Pad PUN PD CO */
  110. #define P16ST_PULL_MASK 0x3
  111. #define P16ST_PULL_DOWN (PUN | PD) /* 1 1 3 */
  112. #define P16ST_HIGH_Z (PUN) /* 1 0 2 */
  113. #define P16ST_PULL_UP (PZ) /* 0 0 0 */
  114. /* Pull Options for M31 Pad PE */
  115. #define PM31_PULL_MASK 0x1
  116. #define PM31_PULL_ENABLED (PE) /* 1 */
  117. #define PM31_PULL_DISABLED (PZ) /* 0 */
  118. /* Pull Options for A/D Pad PUN PD CO */
  119. #define PANGD_PULL_MASK 0x3
  120. #define PANGD_PULL_DOWN (PUN | PD) /* 1 1 3 */
  121. #define PANGD_HIGH_Z (PUN) /* 1 0 2 */
  122. #define PANGD_PULL_UP (PZ) /* 0 0 0 */
  123. /* Definition of Input Disable */
  124. #define DI_MASK 0x1
  125. #define DI_DISABLE 0x1
  126. #define DI_ENABLE 0x0
  127. /* Definition of Input Disable Value */
  128. #define DIV_MASK 0x1
  129. #define DIV_DISABLE 0x1
  130. #define DIV_ENABLE 0x0
  131. /* Number of Function input disable registers */
  132. #define NUM_OF_IN_DISABLE_REG 0x2
  133. /* Offset of Function input disable registers */
  134. #define IN_DISABLE_0_REG_SET 0x0A00
  135. #define IN_DISABLE_0_REG_CLR 0x0A04
  136. #define IN_DISABLE_1_REG_SET 0x0A08
  137. #define IN_DISABLE_1_REG_CLR 0x0A0C
  138. #define IN_DISABLE_VAL_0_REG_SET 0x0A80
  139. #define IN_DISABLE_VAL_0_REG_CLR 0x0A84
  140. #define IN_DISABLE_VAL_1_REG_SET 0x0A88
  141. #define IN_DISABLE_VAL_1_REG_CLR 0x0A8C
  142. struct dt_params {
  143. const char *property;
  144. int value;
  145. };
  146. /**
  147. * struct atlas7_pad_conf - Atlas7 Pad Configuration
  148. * @id The ID of this Pad.
  149. * @type: The type of this Pad.
  150. * @mux_reg: The mux register offset.
  151. * This register contains the mux.
  152. * @pupd_reg: The pull-up/down register offset.
  153. * @drvstr_reg: The drive-strength register offset.
  154. * @ad_ctrl_reg: The Analogue/Digital Control register.
  155. *
  156. * @mux_bit: The start bit of mux register.
  157. * @pupd_bit: The start bit of pull-up/down register.
  158. * @drvstr_bit: The start bit of drive-strength register.
  159. * @ad_ctrl_bit: The start bit of analogue/digital register.
  160. */
  161. struct atlas7_pad_config {
  162. const u32 id;
  163. u32 type;
  164. u32 mux_reg;
  165. u32 pupd_reg;
  166. u32 drvstr_reg;
  167. u32 ad_ctrl_reg;
  168. /* bits in register */
  169. u8 mux_bit;
  170. u8 pupd_bit;
  171. u8 drvstr_bit;
  172. u8 ad_ctrl_bit;
  173. };
  174. #define PADCONF(pad, t, mr, pr, dsr, adr, mb, pb, dsb, adb) \
  175. { \
  176. .id = pad, \
  177. .type = t, \
  178. .mux_reg = mr, \
  179. .pupd_reg = pr, \
  180. .drvstr_reg = dsr, \
  181. .ad_ctrl_reg = adr, \
  182. .mux_bit = mb, \
  183. .pupd_bit = pb, \
  184. .drvstr_bit = dsb, \
  185. .ad_ctrl_bit = adb, \
  186. }
  187. /**
  188. * struct atlas7_pad_status - Atlas7 Pad status
  189. */
  190. struct atlas7_pad_status {
  191. u8 func;
  192. u8 pull;
  193. u8 dstr;
  194. u8 reserved;
  195. };
  196. /**
  197. * struct atlas7_pad_mux - Atlas7 mux
  198. * @bank: The bank of this pad's registers on.
  199. * @pin : The ID of this Pad.
  200. * @func: The mux func on this Pad.
  201. * @dinput_reg: The Input-Disable register offset.
  202. * @dinput_bit: The start bit of Input-Disable register.
  203. * @dinput_val_reg: The Input-Disable-value register offset.
  204. * This register is used to set the value of this pad
  205. * if this pad was disabled.
  206. * @dinput_val_bit: The start bit of Input-Disable Value register.
  207. */
  208. struct atlas7_pad_mux {
  209. u32 bank;
  210. u32 pin;
  211. u32 func;
  212. u32 dinput_reg;
  213. u32 dinput_bit;
  214. u32 dinput_val_reg;
  215. u32 dinput_val_bit;
  216. };
  217. #define MUX(b, pad, f, dr, db, dvr, dvb) \
  218. { \
  219. .bank = b, \
  220. .pin = pad, \
  221. .func = f, \
  222. .dinput_reg = dr, \
  223. .dinput_bit = db, \
  224. .dinput_val_reg = dvr, \
  225. .dinput_val_bit = dvb, \
  226. }
  227. struct atlas7_grp_mux {
  228. unsigned int group;
  229. unsigned int pad_mux_count;
  230. const struct atlas7_pad_mux *pad_mux_list;
  231. };
  232. /**
  233. * struct sirfsoc_pin_group - describes a SiRFprimaII pin group
  234. * @name: the name of this specific pin group
  235. * @pins: an array of discrete physical pins used in this group, taken
  236. * from the driver-local pin enumeration space
  237. * @num_pins: the number of pins in this group array, i.e. the number of
  238. * elements in .pins so we can iterate over that array
  239. */
  240. struct atlas7_pin_group {
  241. const char *name;
  242. const unsigned int *pins;
  243. const unsigned num_pins;
  244. };
  245. #define GROUP(n, p) \
  246. { \
  247. .name = n, \
  248. .pins = p, \
  249. .num_pins = ARRAY_SIZE(p), \
  250. }
  251. struct atlas7_pmx_func {
  252. const char *name;
  253. const char * const *groups;
  254. const unsigned num_groups;
  255. const struct atlas7_grp_mux *grpmux;
  256. };
  257. #define FUNCTION(n, g, m) \
  258. { \
  259. .name = n, \
  260. .groups = g, \
  261. .num_groups = ARRAY_SIZE(g), \
  262. .grpmux = m, \
  263. }
  264. struct atlas7_pinctrl_data {
  265. struct pinctrl_pin_desc *pads;
  266. int pads_cnt;
  267. struct atlas7_pin_group *grps;
  268. int grps_cnt;
  269. struct atlas7_pmx_func *funcs;
  270. int funcs_cnt;
  271. struct atlas7_pad_config *confs;
  272. int confs_cnt;
  273. };
  274. /* Platform info of atlas7 pinctrl */
  275. #define ATLAS7_PINCTRL_REG_BANKS 2
  276. #define ATLAS7_PINCTRL_BANK_0_PINS 18
  277. #define ATLAS7_PINCTRL_BANK_1_PINS 141
  278. #define ATLAS7_PINCTRL_TOTAL_PINS \
  279. (ATLAS7_PINCTRL_BANK_0_PINS + ATLAS7_PINCTRL_BANK_1_PINS)
  280. /**
  281. * Atlas7 GPIO Chip
  282. */
  283. #define NGPIO_OF_BANK 32
  284. #define GPIO_TO_BANK(gpio) ((gpio) / NGPIO_OF_BANK)
  285. /* Registers of GPIO Controllers */
  286. #define ATLAS7_GPIO_BASE(g, b) ((g)->reg + 0x100 * (b))
  287. #define ATLAS7_GPIO_CTRL(b, i) ((b)->base + 4 * (i))
  288. #define ATLAS7_GPIO_INT_STATUS(b) ((b)->base + 0x8C)
  289. /* Definition bits of GPIO Control Registers */
  290. #define ATLAS7_GPIO_CTL_INTR_LOW_MASK BIT(0)
  291. #define ATLAS7_GPIO_CTL_INTR_HIGH_MASK BIT(1)
  292. #define ATLAS7_GPIO_CTL_INTR_TYPE_MASK BIT(2)
  293. #define ATLAS7_GPIO_CTL_INTR_EN_MASK BIT(3)
  294. #define ATLAS7_GPIO_CTL_INTR_STATUS_MASK BIT(4)
  295. #define ATLAS7_GPIO_CTL_OUT_EN_MASK BIT(5)
  296. #define ATLAS7_GPIO_CTL_DATAOUT_MASK BIT(6)
  297. #define ATLAS7_GPIO_CTL_DATAIN_MASK BIT(7)
  298. struct atlas7_gpio_bank {
  299. struct pinctrl_dev *pctldev;
  300. int id;
  301. int irq;
  302. void __iomem *base;
  303. unsigned int gpio_offset;
  304. unsigned int ngpio;
  305. const unsigned int *gpio_pins;
  306. u32 sleep_data[NGPIO_OF_BANK];
  307. };
  308. struct atlas7_gpio_chip {
  309. const char *name;
  310. void __iomem *reg;
  311. struct clk *clk;
  312. int nbank;
  313. spinlock_t lock;
  314. struct gpio_chip chip;
  315. struct atlas7_gpio_bank banks[0];
  316. };
  317. static inline struct atlas7_gpio_chip *to_atlas7_gpio(struct gpio_chip *gc)
  318. {
  319. return container_of(gc, struct atlas7_gpio_chip, chip);
  320. }
  321. /**
  322. * @dev: a pointer back to containing device
  323. * @virtbase: the offset to the controller in virtual memory
  324. */
  325. struct atlas7_pmx {
  326. struct device *dev;
  327. struct pinctrl_dev *pctl;
  328. struct pinctrl_desc pctl_desc;
  329. struct atlas7_pinctrl_data *pctl_data;
  330. void __iomem *regs[ATLAS7_PINCTRL_REG_BANKS];
  331. u32 status_ds[NUM_OF_IN_DISABLE_REG];
  332. u32 status_dsv[NUM_OF_IN_DISABLE_REG];
  333. struct atlas7_pad_status sleep_data[ATLAS7_PINCTRL_TOTAL_PINS];
  334. };
  335. /*
  336. * Pad list for the pinmux subsystem
  337. * refer to A7DA IO Summary - CS-314158-DD-4E.xls
  338. */
  339. /*Pads in IOC RTC & TOP */
  340. static const struct pinctrl_pin_desc atlas7_ioc_pads[] = {
  341. /* RTC PADs */
  342. PINCTRL_PIN(0, "rtc_gpio_0"),
  343. PINCTRL_PIN(1, "rtc_gpio_1"),
  344. PINCTRL_PIN(2, "rtc_gpio_2"),
  345. PINCTRL_PIN(3, "rtc_gpio_3"),
  346. PINCTRL_PIN(4, "low_bat_ind_b"),
  347. PINCTRL_PIN(5, "on_key_b"),
  348. PINCTRL_PIN(6, "ext_on"),
  349. PINCTRL_PIN(7, "mem_on"),
  350. PINCTRL_PIN(8, "core_on"),
  351. PINCTRL_PIN(9, "io_on"),
  352. PINCTRL_PIN(10, "can0_tx"),
  353. PINCTRL_PIN(11, "can0_rx"),
  354. PINCTRL_PIN(12, "spi0_clk"),
  355. PINCTRL_PIN(13, "spi0_cs_b"),
  356. PINCTRL_PIN(14, "spi0_io_0"),
  357. PINCTRL_PIN(15, "spi0_io_1"),
  358. PINCTRL_PIN(16, "spi0_io_2"),
  359. PINCTRL_PIN(17, "spi0_io_3"),
  360. /* TOP PADs */
  361. PINCTRL_PIN(18, "spi1_en"),
  362. PINCTRL_PIN(19, "spi1_clk"),
  363. PINCTRL_PIN(20, "spi1_din"),
  364. PINCTRL_PIN(21, "spi1_dout"),
  365. PINCTRL_PIN(22, "trg_spi_clk"),
  366. PINCTRL_PIN(23, "trg_spi_di"),
  367. PINCTRL_PIN(24, "trg_spi_do"),
  368. PINCTRL_PIN(25, "trg_spi_cs_b"),
  369. PINCTRL_PIN(26, "trg_acq_d1"),
  370. PINCTRL_PIN(27, "trg_irq_b"),
  371. PINCTRL_PIN(28, "trg_acq_d0"),
  372. PINCTRL_PIN(29, "trg_acq_clk"),
  373. PINCTRL_PIN(30, "trg_shutdown_b_out"),
  374. PINCTRL_PIN(31, "sdio2_clk"),
  375. PINCTRL_PIN(32, "sdio2_cmd"),
  376. PINCTRL_PIN(33, "sdio2_dat_0"),
  377. PINCTRL_PIN(34, "sdio2_dat_1"),
  378. PINCTRL_PIN(35, "sdio2_dat_2"),
  379. PINCTRL_PIN(36, "sdio2_dat_3"),
  380. PINCTRL_PIN(37, "df_ad_7"),
  381. PINCTRL_PIN(38, "df_ad_6"),
  382. PINCTRL_PIN(39, "df_ad_5"),
  383. PINCTRL_PIN(40, "df_ad_4"),
  384. PINCTRL_PIN(41, "df_ad_3"),
  385. PINCTRL_PIN(42, "df_ad_2"),
  386. PINCTRL_PIN(43, "df_ad_1"),
  387. PINCTRL_PIN(44, "df_ad_0"),
  388. PINCTRL_PIN(45, "df_dqs"),
  389. PINCTRL_PIN(46, "df_cle"),
  390. PINCTRL_PIN(47, "df_ale"),
  391. PINCTRL_PIN(48, "df_we_b"),
  392. PINCTRL_PIN(49, "df_re_b"),
  393. PINCTRL_PIN(50, "df_ry_by"),
  394. PINCTRL_PIN(51, "df_cs_b_1"),
  395. PINCTRL_PIN(52, "df_cs_b_0"),
  396. PINCTRL_PIN(53, "l_pclk"),
  397. PINCTRL_PIN(54, "l_lck"),
  398. PINCTRL_PIN(55, "l_fck"),
  399. PINCTRL_PIN(56, "l_de"),
  400. PINCTRL_PIN(57, "ldd_0"),
  401. PINCTRL_PIN(58, "ldd_1"),
  402. PINCTRL_PIN(59, "ldd_2"),
  403. PINCTRL_PIN(60, "ldd_3"),
  404. PINCTRL_PIN(61, "ldd_4"),
  405. PINCTRL_PIN(62, "ldd_5"),
  406. PINCTRL_PIN(63, "ldd_6"),
  407. PINCTRL_PIN(64, "ldd_7"),
  408. PINCTRL_PIN(65, "ldd_8"),
  409. PINCTRL_PIN(66, "ldd_9"),
  410. PINCTRL_PIN(67, "ldd_10"),
  411. PINCTRL_PIN(68, "ldd_11"),
  412. PINCTRL_PIN(69, "ldd_12"),
  413. PINCTRL_PIN(70, "ldd_13"),
  414. PINCTRL_PIN(71, "ldd_14"),
  415. PINCTRL_PIN(72, "ldd_15"),
  416. PINCTRL_PIN(73, "lcd_gpio_20"),
  417. PINCTRL_PIN(74, "vip_0"),
  418. PINCTRL_PIN(75, "vip_1"),
  419. PINCTRL_PIN(76, "vip_2"),
  420. PINCTRL_PIN(77, "vip_3"),
  421. PINCTRL_PIN(78, "vip_4"),
  422. PINCTRL_PIN(79, "vip_5"),
  423. PINCTRL_PIN(80, "vip_6"),
  424. PINCTRL_PIN(81, "vip_7"),
  425. PINCTRL_PIN(82, "vip_pxclk"),
  426. PINCTRL_PIN(83, "vip_hsync"),
  427. PINCTRL_PIN(84, "vip_vsync"),
  428. PINCTRL_PIN(85, "sdio3_clk"),
  429. PINCTRL_PIN(86, "sdio3_cmd"),
  430. PINCTRL_PIN(87, "sdio3_dat_0"),
  431. PINCTRL_PIN(88, "sdio3_dat_1"),
  432. PINCTRL_PIN(89, "sdio3_dat_2"),
  433. PINCTRL_PIN(90, "sdio3_dat_3"),
  434. PINCTRL_PIN(91, "sdio5_clk"),
  435. PINCTRL_PIN(92, "sdio5_cmd"),
  436. PINCTRL_PIN(93, "sdio5_dat_0"),
  437. PINCTRL_PIN(94, "sdio5_dat_1"),
  438. PINCTRL_PIN(95, "sdio5_dat_2"),
  439. PINCTRL_PIN(96, "sdio5_dat_3"),
  440. PINCTRL_PIN(97, "rgmii_txd_0"),
  441. PINCTRL_PIN(98, "rgmii_txd_1"),
  442. PINCTRL_PIN(99, "rgmii_txd_2"),
  443. PINCTRL_PIN(100, "rgmii_txd_3"),
  444. PINCTRL_PIN(101, "rgmii_txclk"),
  445. PINCTRL_PIN(102, "rgmii_tx_ctl"),
  446. PINCTRL_PIN(103, "rgmii_rxd_0"),
  447. PINCTRL_PIN(104, "rgmii_rxd_1"),
  448. PINCTRL_PIN(105, "rgmii_rxd_2"),
  449. PINCTRL_PIN(106, "rgmii_rxd_3"),
  450. PINCTRL_PIN(107, "rgmii_rx_clk"),
  451. PINCTRL_PIN(108, "rgmii_rxc_ctl"),
  452. PINCTRL_PIN(109, "rgmii_mdio"),
  453. PINCTRL_PIN(110, "rgmii_mdc"),
  454. PINCTRL_PIN(111, "rgmii_intr_n"),
  455. PINCTRL_PIN(112, "i2s_mclk"),
  456. PINCTRL_PIN(113, "i2s_bclk"),
  457. PINCTRL_PIN(114, "i2s_ws"),
  458. PINCTRL_PIN(115, "i2s_dout0"),
  459. PINCTRL_PIN(116, "i2s_dout1"),
  460. PINCTRL_PIN(117, "i2s_dout2"),
  461. PINCTRL_PIN(118, "i2s_din"),
  462. PINCTRL_PIN(119, "gpio_0"),
  463. PINCTRL_PIN(120, "gpio_1"),
  464. PINCTRL_PIN(121, "gpio_2"),
  465. PINCTRL_PIN(122, "gpio_3"),
  466. PINCTRL_PIN(123, "gpio_4"),
  467. PINCTRL_PIN(124, "gpio_5"),
  468. PINCTRL_PIN(125, "gpio_6"),
  469. PINCTRL_PIN(126, "gpio_7"),
  470. PINCTRL_PIN(127, "sda_0"),
  471. PINCTRL_PIN(128, "scl_0"),
  472. PINCTRL_PIN(129, "coex_pio_0"),
  473. PINCTRL_PIN(130, "coex_pio_1"),
  474. PINCTRL_PIN(131, "coex_pio_2"),
  475. PINCTRL_PIN(132, "coex_pio_3"),
  476. PINCTRL_PIN(133, "uart0_tx"),
  477. PINCTRL_PIN(134, "uart0_rx"),
  478. PINCTRL_PIN(135, "uart1_tx"),
  479. PINCTRL_PIN(136, "uart1_rx"),
  480. PINCTRL_PIN(137, "uart3_tx"),
  481. PINCTRL_PIN(138, "uart3_rx"),
  482. PINCTRL_PIN(139, "uart4_tx"),
  483. PINCTRL_PIN(140, "uart4_rx"),
  484. PINCTRL_PIN(141, "usp0_clk"),
  485. PINCTRL_PIN(142, "usp0_tx"),
  486. PINCTRL_PIN(143, "usp0_rx"),
  487. PINCTRL_PIN(144, "usp0_fs"),
  488. PINCTRL_PIN(145, "usp1_clk"),
  489. PINCTRL_PIN(146, "usp1_tx"),
  490. PINCTRL_PIN(147, "usp1_rx"),
  491. PINCTRL_PIN(148, "usp1_fs"),
  492. PINCTRL_PIN(149, "lvds_tx0d4p"),
  493. PINCTRL_PIN(150, "lvds_tx0d4n"),
  494. PINCTRL_PIN(151, "lvds_tx0d3p"),
  495. PINCTRL_PIN(152, "lvds_tx0d3n"),
  496. PINCTRL_PIN(153, "lvds_tx0d2p"),
  497. PINCTRL_PIN(154, "lvds_tx0d2n"),
  498. PINCTRL_PIN(155, "lvds_tx0d1p"),
  499. PINCTRL_PIN(156, "lvds_tx0d1n"),
  500. PINCTRL_PIN(157, "lvds_tx0d0p"),
  501. PINCTRL_PIN(158, "lvds_tx0d0n"),
  502. };
  503. struct atlas7_pad_config atlas7_ioc_pad_confs[] = {
  504. /* The Configuration of IOC_RTC Pads */
  505. PADCONF(0, 3, 0x0, 0x100, 0x200, -1, 0, 0, 0, 0),
  506. PADCONF(1, 3, 0x0, 0x100, 0x200, -1, 4, 2, 2, 0),
  507. PADCONF(2, 3, 0x0, 0x100, 0x200, -1, 8, 4, 4, 0),
  508. PADCONF(3, 5, 0x0, 0x100, 0x200, -1, 12, 6, 6, 0),
  509. PADCONF(4, 4, 0x0, 0x100, 0x200, -1, 16, 8, 8, 0),
  510. PADCONF(5, 4, 0x0, 0x100, 0x200, -1, 20, 10, 10, 0),
  511. PADCONF(6, 3, 0x0, 0x100, 0x200, -1, 24, 12, 12, 0),
  512. PADCONF(7, 3, 0x0, 0x100, 0x200, -1, 28, 14, 14, 0),
  513. PADCONF(8, 3, 0x8, 0x100, 0x200, -1, 0, 16, 16, 0),
  514. PADCONF(9, 3, 0x8, 0x100, 0x200, -1, 4, 18, 18, 0),
  515. PADCONF(10, 4, 0x8, 0x100, 0x200, -1, 8, 20, 20, 0),
  516. PADCONF(11, 4, 0x8, 0x100, 0x200, -1, 12, 22, 22, 0),
  517. PADCONF(12, 5, 0x8, 0x100, 0x200, -1, 16, 24, 24, 0),
  518. PADCONF(13, 6, 0x8, 0x100, 0x200, -1, 20, 26, 26, 0),
  519. PADCONF(14, 5, 0x8, 0x100, 0x200, -1, 24, 28, 28, 0),
  520. PADCONF(15, 5, 0x8, 0x100, 0x200, -1, 28, 30, 30, 0),
  521. PADCONF(16, 5, 0x10, 0x108, 0x208, -1, 0, 0, 0, 0),
  522. PADCONF(17, 5, 0x10, 0x108, 0x208, -1, 4, 2, 2, 0),
  523. /* The Configuration of IOC_TOP Pads */
  524. PADCONF(18, 5, 0x80, 0x180, 0x300, -1, 0, 0, 0, 0),
  525. PADCONF(19, 5, 0x80, 0x180, 0x300, -1, 4, 2, 2, 0),
  526. PADCONF(20, 5, 0x80, 0x180, 0x300, -1, 8, 4, 4, 0),
  527. PADCONF(21, 5, 0x80, 0x180, 0x300, -1, 12, 6, 6, 0),
  528. PADCONF(22, 5, 0x88, 0x188, 0x308, -1, 0, 0, 0, 0),
  529. PADCONF(23, 5, 0x88, 0x188, 0x308, -1, 4, 2, 2, 0),
  530. PADCONF(24, 5, 0x88, 0x188, 0x308, -1, 8, 4, 4, 0),
  531. PADCONF(25, 6, 0x88, 0x188, 0x308, -1, 12, 6, 6, 0),
  532. PADCONF(26, 5, 0x88, 0x188, 0x308, -1, 16, 8, 8, 0),
  533. PADCONF(27, 6, 0x88, 0x188, 0x308, -1, 20, 10, 10, 0),
  534. PADCONF(28, 5, 0x88, 0x188, 0x308, -1, 24, 12, 12, 0),
  535. PADCONF(29, 5, 0x88, 0x188, 0x308, -1, 28, 14, 14, 0),
  536. PADCONF(30, 5, 0x90, 0x188, 0x308, -1, 0, 16, 16, 0),
  537. PADCONF(31, 2, 0x98, 0x190, 0x310, -1, 0, 0, 0, 0),
  538. PADCONF(32, 1, 0x98, 0x190, 0x310, -1, 4, 2, 4, 0),
  539. PADCONF(33, 1, 0x98, 0x190, 0x310, -1, 8, 4, 6, 0),
  540. PADCONF(34, 1, 0x98, 0x190, 0x310, -1, 12, 6, 8, 0),
  541. PADCONF(35, 1, 0x98, 0x190, 0x310, -1, 16, 8, 10, 0),
  542. PADCONF(36, 1, 0x98, 0x190, 0x310, -1, 20, 10, 12, 0),
  543. PADCONF(37, 1, 0xa0, 0x198, 0x318, -1, 0, 0, 0, 0),
  544. PADCONF(38, 1, 0xa0, 0x198, 0x318, -1, 4, 2, 2, 0),
  545. PADCONF(39, 1, 0xa0, 0x198, 0x318, -1, 8, 4, 4, 0),
  546. PADCONF(40, 1, 0xa0, 0x198, 0x318, -1, 12, 6, 6, 0),
  547. PADCONF(41, 1, 0xa0, 0x198, 0x318, -1, 16, 8, 8, 0),
  548. PADCONF(42, 1, 0xa0, 0x198, 0x318, -1, 20, 10, 10, 0),
  549. PADCONF(43, 1, 0xa0, 0x198, 0x318, -1, 24, 12, 12, 0),
  550. PADCONF(44, 1, 0xa0, 0x198, 0x318, -1, 28, 14, 14, 0),
  551. PADCONF(45, 0, 0xa8, 0x198, 0x318, -1, 0, 16, 16, 0),
  552. PADCONF(46, 0, 0xa8, 0x198, 0x318, -1, 4, 18, 18, 0),
  553. PADCONF(47, 1, 0xa8, 0x198, 0x318, -1, 8, 20, 20, 0),
  554. PADCONF(48, 1, 0xa8, 0x198, 0x318, -1, 12, 22, 22, 0),
  555. PADCONF(49, 1, 0xa8, 0x198, 0x318, -1, 16, 24, 24, 0),
  556. PADCONF(50, 1, 0xa8, 0x198, 0x318, -1, 20, 26, 26, 0),
  557. PADCONF(51, 1, 0xa8, 0x198, 0x318, -1, 24, 28, 28, 0),
  558. PADCONF(52, 1, 0xa8, 0x198, 0x318, -1, 28, 30, 30, 0),
  559. PADCONF(53, 0, 0xb0, 0x1a0, 0x320, -1, 0, 0, 0, 0),
  560. PADCONF(54, 0, 0xb0, 0x1a0, 0x320, -1, 4, 2, 2, 0),
  561. PADCONF(55, 0, 0xb0, 0x1a0, 0x320, -1, 8, 4, 4, 0),
  562. PADCONF(56, 0, 0xb0, 0x1a0, 0x320, -1, 12, 6, 6, 0),
  563. PADCONF(57, 0, 0xb0, 0x1a0, 0x320, -1, 16, 8, 8, 0),
  564. PADCONF(58, 0, 0xb0, 0x1a0, 0x320, -1, 20, 10, 10, 0),
  565. PADCONF(59, 0, 0xb0, 0x1a0, 0x320, -1, 24, 12, 12, 0),
  566. PADCONF(60, 0, 0xb0, 0x1a0, 0x320, -1, 28, 14, 14, 0),
  567. PADCONF(61, 0, 0xb8, 0x1a0, 0x320, -1, 0, 16, 16, 0),
  568. PADCONF(62, 0, 0xb8, 0x1a0, 0x320, -1, 4, 18, 18, 0),
  569. PADCONF(63, 0, 0xb8, 0x1a0, 0x320, -1, 8, 20, 20, 0),
  570. PADCONF(64, 0, 0xb8, 0x1a0, 0x320, -1, 12, 22, 22, 0),
  571. PADCONF(65, 0, 0xb8, 0x1a0, 0x320, -1, 16, 24, 24, 0),
  572. PADCONF(66, 0, 0xb8, 0x1a0, 0x320, -1, 20, 26, 26, 0),
  573. PADCONF(67, 0, 0xb8, 0x1a0, 0x320, -1, 24, 28, 28, 0),
  574. PADCONF(68, 0, 0xb8, 0x1a0, 0x320, -1, 28, 30, 30, 0),
  575. PADCONF(69, 0, 0xc0, 0x1a8, 0x328, -1, 0, 0, 0, 0),
  576. PADCONF(70, 0, 0xc0, 0x1a8, 0x328, -1, 4, 2, 2, 0),
  577. PADCONF(71, 0, 0xc0, 0x1a8, 0x328, -1, 8, 4, 4, 0),
  578. PADCONF(72, 0, 0xc0, 0x1a8, 0x328, -1, 12, 6, 6, 0),
  579. PADCONF(73, 0, 0xc0, 0x1a8, 0x328, -1, 16, 8, 8, 0),
  580. PADCONF(74, 0, 0xc8, 0x1b0, 0x330, -1, 0, 0, 0, 0),
  581. PADCONF(75, 0, 0xc8, 0x1b0, 0x330, -1, 4, 2, 2, 0),
  582. PADCONF(76, 0, 0xc8, 0x1b0, 0x330, -1, 8, 4, 4, 0),
  583. PADCONF(77, 0, 0xc8, 0x1b0, 0x330, -1, 12, 6, 6, 0),
  584. PADCONF(78, 0, 0xc8, 0x1b0, 0x330, -1, 16, 8, 8, 0),
  585. PADCONF(79, 0, 0xc8, 0x1b0, 0x330, -1, 20, 10, 10, 0),
  586. PADCONF(80, 0, 0xc8, 0x1b0, 0x330, -1, 24, 12, 12, 0),
  587. PADCONF(81, 0, 0xc8, 0x1b0, 0x330, -1, 28, 14, 14, 0),
  588. PADCONF(82, 0, 0xd0, 0x1b0, 0x330, -1, 0, 16, 16, 0),
  589. PADCONF(83, 0, 0xd0, 0x1b0, 0x330, -1, 4, 18, 18, 0),
  590. PADCONF(84, 0, 0xd0, 0x1b0, 0x330, -1, 8, 20, 20, 0),
  591. PADCONF(85, 2, 0xd8, 0x1b8, 0x338, -1, 0, 0, 0, 0),
  592. PADCONF(86, 1, 0xd8, 0x1b8, 0x338, -1, 4, 4, 4, 0),
  593. PADCONF(87, 1, 0xd8, 0x1b8, 0x338, -1, 8, 6, 6, 0),
  594. PADCONF(88, 1, 0xd8, 0x1b8, 0x338, -1, 12, 8, 8, 0),
  595. PADCONF(89, 1, 0xd8, 0x1b8, 0x338, -1, 16, 10, 10, 0),
  596. PADCONF(90, 1, 0xd8, 0x1b8, 0x338, -1, 20, 12, 12, 0),
  597. PADCONF(91, 2, 0xe0, 0x1c0, 0x340, -1, 0, 0, 0, 0),
  598. PADCONF(92, 1, 0xe0, 0x1c0, 0x340, -1, 4, 4, 4, 0),
  599. PADCONF(93, 1, 0xe0, 0x1c0, 0x340, -1, 8, 6, 6, 0),
  600. PADCONF(94, 1, 0xe0, 0x1c0, 0x340, -1, 12, 8, 8, 0),
  601. PADCONF(95, 1, 0xe0, 0x1c0, 0x340, -1, 16, 10, 10, 0),
  602. PADCONF(96, 1, 0xe0, 0x1c0, 0x340, -1, 20, 12, 12, 0),
  603. PADCONF(97, 0, 0xe8, 0x1c8, 0x348, -1, 0, 0, 0, 0),
  604. PADCONF(98, 0, 0xe8, 0x1c8, 0x348, -1, 4, 2, 2, 0),
  605. PADCONF(99, 0, 0xe8, 0x1c8, 0x348, -1, 8, 4, 4, 0),
  606. PADCONF(100, 0, 0xe8, 0x1c8, 0x348, -1, 12, 6, 6, 0),
  607. PADCONF(101, 2, 0xe8, 0x1c8, 0x348, -1, 16, 8, 8, 0),
  608. PADCONF(102, 0, 0xe8, 0x1c8, 0x348, -1, 20, 12, 12, 0),
  609. PADCONF(103, 0, 0xe8, 0x1c8, 0x348, -1, 24, 14, 14, 0),
  610. PADCONF(104, 0, 0xe8, 0x1c8, 0x348, -1, 28, 16, 16, 0),
  611. PADCONF(105, 0, 0xf0, 0x1c8, 0x348, -1, 0, 18, 18, 0),
  612. PADCONF(106, 0, 0xf0, 0x1c8, 0x348, -1, 4, 20, 20, 0),
  613. PADCONF(107, 0, 0xf0, 0x1c8, 0x348, -1, 8, 22, 22, 0),
  614. PADCONF(108, 0, 0xf0, 0x1c8, 0x348, -1, 12, 24, 24, 0),
  615. PADCONF(109, 1, 0xf0, 0x1c8, 0x348, -1, 16, 26, 26, 0),
  616. PADCONF(110, 0, 0xf0, 0x1c8, 0x348, -1, 20, 28, 28, 0),
  617. PADCONF(111, 1, 0xf0, 0x1c8, 0x348, -1, 24, 30, 30, 0),
  618. PADCONF(112, 5, 0xf8, 0x200, 0x350, -1, 0, 0, 0, 0),
  619. PADCONF(113, 5, 0xf8, 0x200, 0x350, -1, 4, 2, 2, 0),
  620. PADCONF(114, 5, 0xf8, 0x200, 0x350, -1, 8, 4, 4, 0),
  621. PADCONF(115, 5, 0xf8, 0x200, 0x350, -1, 12, 6, 6, 0),
  622. PADCONF(116, 5, 0xf8, 0x200, 0x350, -1, 16, 8, 8, 0),
  623. PADCONF(117, 5, 0xf8, 0x200, 0x350, -1, 20, 10, 10, 0),
  624. PADCONF(118, 5, 0xf8, 0x200, 0x350, -1, 24, 12, 12, 0),
  625. PADCONF(119, 5, 0x100, 0x250, 0x358, -1, 0, 0, 0, 0),
  626. PADCONF(120, 5, 0x100, 0x250, 0x358, -1, 4, 2, 2, 0),
  627. PADCONF(121, 5, 0x100, 0x250, 0x358, -1, 8, 4, 4, 0),
  628. PADCONF(122, 5, 0x100, 0x250, 0x358, -1, 12, 6, 6, 0),
  629. PADCONF(123, 6, 0x100, 0x250, 0x358, -1, 16, 8, 8, 0),
  630. PADCONF(124, 6, 0x100, 0x250, 0x358, -1, 20, 10, 10, 0),
  631. PADCONF(125, 6, 0x100, 0x250, 0x358, -1, 24, 12, 12, 0),
  632. PADCONF(126, 6, 0x100, 0x250, 0x358, -1, 28, 14, 14, 0),
  633. PADCONF(127, 6, 0x108, 0x250, 0x358, -1, 16, 24, 24, 0),
  634. PADCONF(128, 6, 0x108, 0x250, 0x358, -1, 20, 26, 26, 0),
  635. PADCONF(129, 0, 0x110, 0x258, 0x360, -1, 0, 0, 0, 0),
  636. PADCONF(130, 0, 0x110, 0x258, 0x360, -1, 4, 2, 2, 0),
  637. PADCONF(131, 0, 0x110, 0x258, 0x360, -1, 8, 4, 4, 0),
  638. PADCONF(132, 0, 0x110, 0x258, 0x360, -1, 12, 6, 6, 0),
  639. PADCONF(133, 6, 0x118, 0x260, 0x368, -1, 0, 0, 0, 0),
  640. PADCONF(134, 6, 0x118, 0x260, 0x368, -1, 4, 2, 2, 0),
  641. PADCONF(135, 6, 0x118, 0x260, 0x368, -1, 16, 8, 8, 0),
  642. PADCONF(136, 6, 0x118, 0x260, 0x368, -1, 20, 10, 10, 0),
  643. PADCONF(137, 6, 0x118, 0x260, 0x368, -1, 24, 12, 12, 0),
  644. PADCONF(138, 6, 0x118, 0x260, 0x368, -1, 28, 14, 14, 0),
  645. PADCONF(139, 6, 0x120, 0x260, 0x368, -1, 0, 16, 16, 0),
  646. PADCONF(140, 6, 0x120, 0x260, 0x368, -1, 4, 18, 18, 0),
  647. PADCONF(141, 5, 0x128, 0x268, 0x378, -1, 0, 0, 0, 0),
  648. PADCONF(142, 5, 0x128, 0x268, 0x378, -1, 4, 2, 2, 0),
  649. PADCONF(143, 5, 0x128, 0x268, 0x378, -1, 8, 4, 4, 0),
  650. PADCONF(144, 5, 0x128, 0x268, 0x378, -1, 12, 6, 6, 0),
  651. PADCONF(145, 5, 0x128, 0x268, 0x378, -1, 16, 8, 8, 0),
  652. PADCONF(146, 5, 0x128, 0x268, 0x378, -1, 20, 10, 10, 0),
  653. PADCONF(147, 5, 0x128, 0x268, 0x378, -1, 24, 12, 12, 0),
  654. PADCONF(148, 5, 0x128, 0x268, 0x378, -1, 28, 14, 14, 0),
  655. PADCONF(149, 7, 0x130, 0x270, -1, 0x480, 0, 0, 0, 0),
  656. PADCONF(150, 7, 0x130, 0x270, -1, 0x480, 4, 2, 0, 1),
  657. PADCONF(151, 7, 0x130, 0x270, -1, 0x480, 8, 4, 0, 2),
  658. PADCONF(152, 7, 0x130, 0x270, -1, 0x480, 12, 6, 0, 3),
  659. PADCONF(153, 7, 0x130, 0x270, -1, 0x480, 16, 8, 0, 4),
  660. PADCONF(154, 7, 0x130, 0x270, -1, 0x480, 20, 10, 0, 5),
  661. PADCONF(155, 7, 0x130, 0x270, -1, 0x480, 24, 12, 0, 6),
  662. PADCONF(156, 7, 0x130, 0x270, -1, 0x480, 28, 14, 0, 7),
  663. PADCONF(157, 7, 0x138, 0x278, -1, 0x480, 0, 0, 0, 8),
  664. PADCONF(158, 7, 0x138, 0x278, -1, 0x480, 4, 2, 0, 9),
  665. };
  666. /* pin list of each pin group */
  667. static const unsigned int gnss_gpio_pins[] = { 119, 120, 121, 122, 123, 124,
  668. 125, 126, 127, 128, 22, 23, 24, 25, 26, 27, 28, 29, 30, };
  669. static const unsigned int lcd_vip_gpio_pins[] = { 74, 75, 76, 77, 78, 79, 80,
  670. 81, 82, 83, 84, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
  671. 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, };
  672. static const unsigned int sdio_i2s_gpio_pins[] = { 31, 32, 33, 34, 35, 36,
  673. 85, 86, 87, 88, 89, 90, 129, 130, 131, 132, 91, 92, 93, 94,
  674. 95, 96, 112, 113, 114, 115, 116, 117, 118, };
  675. static const unsigned int sp_rgmii_gpio_pins[] = { 97, 98, 99, 100, 101, 102,
  676. 103, 104, 105, 106, 107, 108, 109, 110, 111, 18, 19, 20, 21,
  677. 141, 142, 143, 144, 145, 146, 147, 148, };
  678. static const unsigned int lvds_gpio_pins[] = { 157, 158, 155, 156, 153, 154,
  679. 151, 152, 149, 150, };
  680. static const unsigned int uart_nand_gpio_pins[] = { 44, 43, 42, 41, 40, 39,
  681. 38, 37, 46, 47, 48, 49, 50, 52, 51, 45, 133, 134, 135, 136,
  682. 137, 138, 139, 140, };
  683. static const unsigned int rtc_gpio_pins[] = { 0, 1, 2, 3, 4, 10, 11, 12, 13,
  684. 14, 15, 16, 17, };
  685. static const unsigned int audio_ac97_pins[] = { 113, 118, 115, 114, };
  686. static const unsigned int audio_func_dbg_pins[] = { 141, 144, 44, 43, 42, 41,
  687. 40, 39, 38, 37, 74, 75, 76, 77, 78, 79, 81, 113, 114, 118,
  688. 115, 49, 50, 142, 143, 80, };
  689. static const unsigned int audio_i2s_pins[] = { 118, 115, 116, 117, 112, 113,
  690. 114, };
  691. static const unsigned int audio_i2s_2ch_pins[] = { 118, 115, 112, 113, 114, };
  692. static const unsigned int audio_i2s_extclk_pins[] = { 112, };
  693. static const unsigned int audio_uart0_pins[] = { 143, 142, 141, 144, };
  694. static const unsigned int audio_uart1_pins[] = { 147, 146, 145, 148, };
  695. static const unsigned int audio_uart2_pins0[] = { 20, 21, 19, 18, };
  696. static const unsigned int audio_uart2_pins1[] = { 109, 110, 101, 111, };
  697. static const unsigned int c_can_trnsvr_pins[] = { 1, };
  698. static const unsigned int c0_can_pins0[] = { 11, 10, };
  699. static const unsigned int c0_can_pins1[] = { 2, 3, };
  700. static const unsigned int c1_can_pins0[] = { 138, 137, };
  701. static const unsigned int c1_can_pins1[] = { 147, 146, };
  702. static const unsigned int c1_can_pins2[] = { 2, 3, };
  703. static const unsigned int ca_audio_lpc_pins[] = { 62, 63, 64, 65, 66, 67, 68,
  704. 69, 70, 71, };
  705. static const unsigned int ca_bt_lpc_pins[] = { 85, 86, 87, 88, 89, 90, };
  706. static const unsigned int ca_coex_pins[] = { 129, 130, 131, 132, };
  707. static const unsigned int ca_curator_lpc_pins[] = { 57, 58, 59, 60, };
  708. static const unsigned int ca_pcm_debug_pins[] = { 91, 93, 94, 92, };
  709. static const unsigned int ca_pio_pins[] = { 121, 122, 125, 126, 38, 37, 47,
  710. 49, 50, 54, 55, 56, };
  711. static const unsigned int ca_sdio_debug_pins[] = { 40, 39, 44, 43, 42, 41, };
  712. static const unsigned int ca_spi_pins[] = { 82, 79, 80, 81, };
  713. static const unsigned int ca_trb_pins[] = { 91, 93, 94, 95, 96, 78, 74, 75,
  714. 76, 77, };
  715. static const unsigned int ca_uart_debug_pins[] = { 136, 135, 134, 133, };
  716. static const unsigned int clkc_pins0[] = { 30, 47, };
  717. static const unsigned int clkc_pins1[] = { 78, 54, };
  718. static const unsigned int gn_gnss_i2c_pins[] = { 128, 127, };
  719. static const unsigned int gn_gnss_uart_nopause_pins[] = { 134, 133, };
  720. static const unsigned int gn_gnss_uart_pins[] = { 134, 133, 136, 135, };
  721. static const unsigned int gn_trg_spi_pins0[] = { 22, 25, 23, 24, };
  722. static const unsigned int gn_trg_spi_pins1[] = { 82, 79, 80, 81, };
  723. static const unsigned int cvbs_dbg_pins[] = { 54, 53, 82, 74, 75, 76, 77, 78,
  724. 79, 80, 81, 83, 84, 73, 55, 56, };
  725. static const unsigned int cvbs_dbg_test_pins0[] = { 57, };
  726. static const unsigned int cvbs_dbg_test_pins1[] = { 58, };
  727. static const unsigned int cvbs_dbg_test_pins2[] = { 59, };
  728. static const unsigned int cvbs_dbg_test_pins3[] = { 60, };
  729. static const unsigned int cvbs_dbg_test_pins4[] = { 61, };
  730. static const unsigned int cvbs_dbg_test_pins5[] = { 62, };
  731. static const unsigned int cvbs_dbg_test_pins6[] = { 63, };
  732. static const unsigned int cvbs_dbg_test_pins7[] = { 64, };
  733. static const unsigned int cvbs_dbg_test_pins8[] = { 65, };
  734. static const unsigned int cvbs_dbg_test_pins9[] = { 66, };
  735. static const unsigned int cvbs_dbg_test_pins10[] = { 67, };
  736. static const unsigned int cvbs_dbg_test_pins11[] = { 68, };
  737. static const unsigned int cvbs_dbg_test_pins12[] = { 69, };
  738. static const unsigned int cvbs_dbg_test_pins13[] = { 70, };
  739. static const unsigned int cvbs_dbg_test_pins14[] = { 71, };
  740. static const unsigned int cvbs_dbg_test_pins15[] = { 72, };
  741. static const unsigned int gn_gnss_power_pins[] = { 123, 124, 121, 122, 125,
  742. 120, };
  743. static const unsigned int gn_gnss_sw_status_pins[] = { 57, 58, 59, 60, 61,
  744. 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 53, 55, 56, 54, };
  745. static const unsigned int gn_gnss_eclk_pins[] = { 113, };
  746. static const unsigned int gn_gnss_irq1_pins0[] = { 112, };
  747. static const unsigned int gn_gnss_irq2_pins0[] = { 118, };
  748. static const unsigned int gn_gnss_tm_pins[] = { 115, };
  749. static const unsigned int gn_gnss_tsync_pins[] = { 114, };
  750. static const unsigned int gn_io_gnsssys_sw_cfg_pins[] = { 44, 43, 42, 41, 40,
  751. 39, 38, 37, 49, 50, 91, 92, 93, 94, 95, 96, };
  752. static const unsigned int gn_trg_pins0[] = { 29, 28, 26, 27, };
  753. static const unsigned int gn_trg_pins1[] = { 77, 76, 74, 75, };
  754. static const unsigned int gn_trg_shutdown_pins0[] = { 30, };
  755. static const unsigned int gn_trg_shutdown_pins1[] = { 83, };
  756. static const unsigned int gn_trg_shutdown_pins2[] = { 117, };
  757. static const unsigned int gn_trg_shutdown_pins3[] = { 123, };
  758. static const unsigned int i2c0_pins[] = { 128, 127, };
  759. static const unsigned int i2c1_pins[] = { 126, 125, };
  760. static const unsigned int jtag_pins0[] = { 125, 4, 2, 0, 1, 3, };
  761. static const unsigned int ks_kas_spi_pins0[] = { 141, 144, 143, 142, };
  762. static const unsigned int ld_ldd_pins[] = { 57, 58, 59, 60, 61, 62, 63, 64,
  763. 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80,
  764. 81, 56, 53, };
  765. static const unsigned int ld_ldd_16bit_pins[] = { 57, 58, 59, 60, 61, 62, 63,
  766. 64, 65, 66, 67, 68, 69, 70, 71, 72, 56, 53, };
  767. static const unsigned int ld_ldd_fck_pins[] = { 55, };
  768. static const unsigned int ld_ldd_lck_pins[] = { 54, };
  769. static const unsigned int lr_lcdrom_pins[] = { 73, 54, 57, 58, 59, 60, 61,
  770. 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 56, 53, 55, };
  771. static const unsigned int lvds_analog_pins[] = { 149, 150, 151, 152, 153, 154,
  772. 155, 156, 157, 158, };
  773. static const unsigned int nd_df_pins[] = { 44, 43, 42, 41, 40, 39, 38, 37,
  774. 47, 46, 52, 51, 45, 49, 50, 48, 124, };
  775. static const unsigned int nd_df_nowp_pins[] = { 44, 43, 42, 41, 40, 39, 38,
  776. 37, 47, 46, 52, 51, 45, 49, 50, 48, };
  777. static const unsigned int ps_pins[] = { 120, 119, };
  778. static const unsigned int pwc_core_on_pins[] = { 8, };
  779. static const unsigned int pwc_ext_on_pins[] = { 6, };
  780. static const unsigned int pwc_gpio3_clk_pins[] = { 3, };
  781. static const unsigned int pwc_io_on_pins[] = { 9, };
  782. static const unsigned int pwc_lowbatt_b_pins0[] = { 4, };
  783. static const unsigned int pwc_mem_on_pins[] = { 7, };
  784. static const unsigned int pwc_on_key_b_pins0[] = { 5, };
  785. static const unsigned int pwc_wakeup_src0_pins[] = { 0, };
  786. static const unsigned int pwc_wakeup_src1_pins[] = { 1, };
  787. static const unsigned int pwc_wakeup_src2_pins[] = { 2, };
  788. static const unsigned int pwc_wakeup_src3_pins[] = { 3, };
  789. static const unsigned int pw_cko0_pins0[] = { 123, };
  790. static const unsigned int pw_cko0_pins1[] = { 101, };
  791. static const unsigned int pw_cko0_pins2[] = { 82, };
  792. static const unsigned int pw_cko1_pins0[] = { 124, };
  793. static const unsigned int pw_cko1_pins1[] = { 110, };
  794. static const unsigned int pw_i2s01_clk_pins0[] = { 125, };
  795. static const unsigned int pw_i2s01_clk_pins1[] = { 117, };
  796. static const unsigned int pw_pwm0_pins[] = { 119, };
  797. static const unsigned int pw_pwm1_pins[] = { 120, };
  798. static const unsigned int pw_pwm2_pins0[] = { 121, };
  799. static const unsigned int pw_pwm2_pins1[] = { 98, };
  800. static const unsigned int pw_pwm3_pins0[] = { 122, };
  801. static const unsigned int pw_pwm3_pins1[] = { 73, };
  802. static const unsigned int pw_pwm_cpu_vol_pins0[] = { 121, };
  803. static const unsigned int pw_pwm_cpu_vol_pins1[] = { 98, };
  804. static const unsigned int pw_backlight_pins0[] = { 122, };
  805. static const unsigned int pw_backlight_pins1[] = { 73, };
  806. static const unsigned int rg_eth_mac_pins[] = { 108, 103, 104, 105, 106, 107,
  807. 102, 97, 98, 99, 100, 101, };
  808. static const unsigned int rg_gmac_phy_intr_n_pins[] = { 111, };
  809. static const unsigned int rg_rgmii_mac_pins[] = { 109, 110, };
  810. static const unsigned int rg_rgmii_phy_ref_clk_pins0[] = { 111, };
  811. static const unsigned int rg_rgmii_phy_ref_clk_pins1[] = { 53, };
  812. static const unsigned int sd0_pins[] = { 46, 47, 44, 43, 42, 41, 40, 39, 38,
  813. 37, };
  814. static const unsigned int sd0_4bit_pins[] = { 46, 47, 44, 43, 42, 41, };
  815. static const unsigned int sd1_pins[] = { 48, 49, 44, 43, 42, 41, 40, 39, 38,
  816. 37, };
  817. static const unsigned int sd1_4bit_pins0[] = { 48, 49, 44, 43, 42, 41, };
  818. static const unsigned int sd1_4bit_pins1[] = { 48, 49, 40, 39, 38, 37, };
  819. static const unsigned int sd2_pins0[] = { 124, 31, 32, 33, 34, 35, 36, 123, };
  820. static const unsigned int sd2_no_cdb_pins0[] = { 31, 32, 33, 34, 35, 36, 123, };
  821. static const unsigned int sd3_pins[] = { 85, 86, 87, 88, 89, 90, };
  822. static const unsigned int sd5_pins[] = { 91, 92, 93, 94, 95, 96, };
  823. static const unsigned int sd6_pins0[] = { 79, 78, 74, 75, 76, 77, };
  824. static const unsigned int sd6_pins1[] = { 101, 99, 100, 110, 109, 111, };
  825. static const unsigned int sp0_ext_ldo_on_pins[] = { 4, };
  826. static const unsigned int sp0_qspi_pins[] = { 12, 13, 14, 15, 16, 17, };
  827. static const unsigned int sp1_spi_pins[] = { 19, 20, 21, 18, };
  828. static const unsigned int tpiu_trace_pins[] = { 53, 56, 57, 58, 59, 60, 61,
  829. 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, };
  830. static const unsigned int uart0_pins[] = { 121, 120, 134, 133, };
  831. static const unsigned int uart0_nopause_pins[] = { 134, 133, };
  832. static const unsigned int uart1_pins[] = { 136, 135, };
  833. static const unsigned int uart2_pins[] = { 11, 10, };
  834. static const unsigned int uart3_pins0[] = { 125, 126, 138, 137, };
  835. static const unsigned int uart3_pins1[] = { 111, 109, 84, 83, };
  836. static const unsigned int uart3_pins2[] = { 140, 139, 138, 137, };
  837. static const unsigned int uart3_pins3[] = { 139, 140, 84, 83, };
  838. static const unsigned int uart3_nopause_pins0[] = { 138, 137, };
  839. static const unsigned int uart3_nopause_pins1[] = { 84, 83, };
  840. static const unsigned int uart4_pins0[] = { 122, 123, 140, 139, };
  841. static const unsigned int uart4_pins1[] = { 100, 99, 140, 139, };
  842. static const unsigned int uart4_pins2[] = { 117, 116, 140, 139, };
  843. static const unsigned int uart4_nopause_pins[] = { 140, 139, };
  844. static const unsigned int usb0_drvvbus_pins[] = { 51, };
  845. static const unsigned int usb1_drvvbus_pins[] = { 134, };
  846. static const unsigned int visbus_dout_pins[] = { 57, 58, 59, 60, 61, 62, 63,
  847. 64, 65, 66, 67, 68, 69, 70, 71, 72, 53, 54, 55, 56, 85, 86,
  848. 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, };
  849. static const unsigned int vi_vip1_pins[] = { 74, 75, 76, 77, 78, 79, 80, 81,
  850. 82, 83, 84, 103, 104, 105, 106, 107, 102, 97, 98, };
  851. static const unsigned int vi_vip1_ext_pins[] = { 74, 75, 76, 77, 78, 79, 80,
  852. 81, 82, 83, 84, 108, 103, 104, 105, 106, 107, 102, 97, 98,
  853. 99, 100, };
  854. static const unsigned int vi_vip1_low8bit_pins[] = { 74, 75, 76, 77, 78, 79,
  855. 80, 81, };
  856. static const unsigned int vi_vip1_high8bit_pins[] = { 82, 83, 84, 108, 103,
  857. 104, 105, 106, };
  858. /* definition of pin group table */
  859. struct atlas7_pin_group altas7_pin_groups[] = {
  860. GROUP("gnss_gpio_grp", gnss_gpio_pins),
  861. GROUP("lcd_vip_gpio_grp", lcd_vip_gpio_pins),
  862. GROUP("sdio_i2s_gpio_grp", sdio_i2s_gpio_pins),
  863. GROUP("sp_rgmii_gpio_grp", sp_rgmii_gpio_pins),
  864. GROUP("lvds_gpio_grp", lvds_gpio_pins),
  865. GROUP("uart_nand_gpio_grp", uart_nand_gpio_pins),
  866. GROUP("rtc_gpio_grp", rtc_gpio_pins),
  867. GROUP("audio_ac97_grp", audio_ac97_pins),
  868. GROUP("audio_func_dbg_grp", audio_func_dbg_pins),
  869. GROUP("audio_i2s_grp", audio_i2s_pins),
  870. GROUP("audio_i2s_2ch_grp", audio_i2s_2ch_pins),
  871. GROUP("audio_i2s_extclk_grp", audio_i2s_extclk_pins),
  872. GROUP("audio_uart0_grp", audio_uart0_pins),
  873. GROUP("audio_uart1_grp", audio_uart1_pins),
  874. GROUP("audio_uart2_grp0", audio_uart2_pins0),
  875. GROUP("audio_uart2_grp1", audio_uart2_pins1),
  876. GROUP("c_can_trnsvr_grp", c_can_trnsvr_pins),
  877. GROUP("c0_can_grp0", c0_can_pins0),
  878. GROUP("c0_can_grp1", c0_can_pins1),
  879. GROUP("c1_can_grp0", c1_can_pins0),
  880. GROUP("c1_can_grp1", c1_can_pins1),
  881. GROUP("c1_can_grp2", c1_can_pins2),
  882. GROUP("ca_audio_lpc_grp", ca_audio_lpc_pins),
  883. GROUP("ca_bt_lpc_grp", ca_bt_lpc_pins),
  884. GROUP("ca_coex_grp", ca_coex_pins),
  885. GROUP("ca_curator_lpc_grp", ca_curator_lpc_pins),
  886. GROUP("ca_pcm_debug_grp", ca_pcm_debug_pins),
  887. GROUP("ca_pio_grp", ca_pio_pins),
  888. GROUP("ca_sdio_debug_grp", ca_sdio_debug_pins),
  889. GROUP("ca_spi_grp", ca_spi_pins),
  890. GROUP("ca_trb_grp", ca_trb_pins),
  891. GROUP("ca_uart_debug_grp", ca_uart_debug_pins),
  892. GROUP("clkc_grp0", clkc_pins0),
  893. GROUP("clkc_grp1", clkc_pins1),
  894. GROUP("gn_gnss_i2c_grp", gn_gnss_i2c_pins),
  895. GROUP("gn_gnss_uart_nopause_grp", gn_gnss_uart_nopause_pins),
  896. GROUP("gn_gnss_uart_grp", gn_gnss_uart_pins),
  897. GROUP("gn_trg_spi_grp0", gn_trg_spi_pins0),
  898. GROUP("gn_trg_spi_grp1", gn_trg_spi_pins1),
  899. GROUP("cvbs_dbg_grp", cvbs_dbg_pins),
  900. GROUP("cvbs_dbg_test_grp0", cvbs_dbg_test_pins0),
  901. GROUP("cvbs_dbg_test_grp1", cvbs_dbg_test_pins1),
  902. GROUP("cvbs_dbg_test_grp2", cvbs_dbg_test_pins2),
  903. GROUP("cvbs_dbg_test_grp3", cvbs_dbg_test_pins3),
  904. GROUP("cvbs_dbg_test_grp4", cvbs_dbg_test_pins4),
  905. GROUP("cvbs_dbg_test_grp5", cvbs_dbg_test_pins5),
  906. GROUP("cvbs_dbg_test_grp6", cvbs_dbg_test_pins6),
  907. GROUP("cvbs_dbg_test_grp7", cvbs_dbg_test_pins7),
  908. GROUP("cvbs_dbg_test_grp8", cvbs_dbg_test_pins8),
  909. GROUP("cvbs_dbg_test_grp9", cvbs_dbg_test_pins9),
  910. GROUP("cvbs_dbg_test_grp10", cvbs_dbg_test_pins10),
  911. GROUP("cvbs_dbg_test_grp11", cvbs_dbg_test_pins11),
  912. GROUP("cvbs_dbg_test_grp12", cvbs_dbg_test_pins12),
  913. GROUP("cvbs_dbg_test_grp13", cvbs_dbg_test_pins13),
  914. GROUP("cvbs_dbg_test_grp14", cvbs_dbg_test_pins14),
  915. GROUP("cvbs_dbg_test_grp15", cvbs_dbg_test_pins15),
  916. GROUP("gn_gnss_power_grp", gn_gnss_power_pins),
  917. GROUP("gn_gnss_sw_status_grp", gn_gnss_sw_status_pins),
  918. GROUP("gn_gnss_eclk_grp", gn_gnss_eclk_pins),
  919. GROUP("gn_gnss_irq1_grp0", gn_gnss_irq1_pins0),
  920. GROUP("gn_gnss_irq2_grp0", gn_gnss_irq2_pins0),
  921. GROUP("gn_gnss_tm_grp", gn_gnss_tm_pins),
  922. GROUP("gn_gnss_tsync_grp", gn_gnss_tsync_pins),
  923. GROUP("gn_io_gnsssys_sw_cfg_grp", gn_io_gnsssys_sw_cfg_pins),
  924. GROUP("gn_trg_grp0", gn_trg_pins0),
  925. GROUP("gn_trg_grp1", gn_trg_pins1),
  926. GROUP("gn_trg_shutdown_grp0", gn_trg_shutdown_pins0),
  927. GROUP("gn_trg_shutdown_grp1", gn_trg_shutdown_pins1),
  928. GROUP("gn_trg_shutdown_grp2", gn_trg_shutdown_pins2),
  929. GROUP("gn_trg_shutdown_grp3", gn_trg_shutdown_pins3),
  930. GROUP("i2c0_grp", i2c0_pins),
  931. GROUP("i2c1_grp", i2c1_pins),
  932. GROUP("jtag_grp0", jtag_pins0),
  933. GROUP("ks_kas_spi_grp0", ks_kas_spi_pins0),
  934. GROUP("ld_ldd_grp", ld_ldd_pins),
  935. GROUP("ld_ldd_16bit_grp", ld_ldd_16bit_pins),
  936. GROUP("ld_ldd_fck_grp", ld_ldd_fck_pins),
  937. GROUP("ld_ldd_lck_grp", ld_ldd_lck_pins),
  938. GROUP("lr_lcdrom_grp", lr_lcdrom_pins),
  939. GROUP("lvds_analog_grp", lvds_analog_pins),
  940. GROUP("nd_df_grp", nd_df_pins),
  941. GROUP("nd_df_nowp_grp", nd_df_nowp_pins),
  942. GROUP("ps_grp", ps_pins),
  943. GROUP("pwc_core_on_grp", pwc_core_on_pins),
  944. GROUP("pwc_ext_on_grp", pwc_ext_on_pins),
  945. GROUP("pwc_gpio3_clk_grp", pwc_gpio3_clk_pins),
  946. GROUP("pwc_io_on_grp", pwc_io_on_pins),
  947. GROUP("pwc_lowbatt_b_grp0", pwc_lowbatt_b_pins0),
  948. GROUP("pwc_mem_on_grp", pwc_mem_on_pins),
  949. GROUP("pwc_on_key_b_grp0", pwc_on_key_b_pins0),
  950. GROUP("pwc_wakeup_src0_grp", pwc_wakeup_src0_pins),
  951. GROUP("pwc_wakeup_src1_grp", pwc_wakeup_src1_pins),
  952. GROUP("pwc_wakeup_src2_grp", pwc_wakeup_src2_pins),
  953. GROUP("pwc_wakeup_src3_grp", pwc_wakeup_src3_pins),
  954. GROUP("pw_cko0_grp0", pw_cko0_pins0),
  955. GROUP("pw_cko0_grp1", pw_cko0_pins1),
  956. GROUP("pw_cko0_grp2", pw_cko0_pins2),
  957. GROUP("pw_cko1_grp0", pw_cko1_pins0),
  958. GROUP("pw_cko1_grp1", pw_cko1_pins1),
  959. GROUP("pw_i2s01_clk_grp0", pw_i2s01_clk_pins0),
  960. GROUP("pw_i2s01_clk_grp1", pw_i2s01_clk_pins1),
  961. GROUP("pw_pwm0_grp", pw_pwm0_pins),
  962. GROUP("pw_pwm1_grp", pw_pwm1_pins),
  963. GROUP("pw_pwm2_grp0", pw_pwm2_pins0),
  964. GROUP("pw_pwm2_grp1", pw_pwm2_pins1),
  965. GROUP("pw_pwm3_grp0", pw_pwm3_pins0),
  966. GROUP("pw_pwm3_grp1", pw_pwm3_pins1),
  967. GROUP("pw_pwm_cpu_vol_grp0", pw_pwm_cpu_vol_pins0),
  968. GROUP("pw_pwm_cpu_vol_grp1", pw_pwm_cpu_vol_pins1),
  969. GROUP("pw_backlight_grp0", pw_backlight_pins0),
  970. GROUP("pw_backlight_grp1", pw_backlight_pins1),
  971. GROUP("rg_eth_mac_grp", rg_eth_mac_pins),
  972. GROUP("rg_gmac_phy_intr_n_grp", rg_gmac_phy_intr_n_pins),
  973. GROUP("rg_rgmii_mac_grp", rg_rgmii_mac_pins),
  974. GROUP("rg_rgmii_phy_ref_clk_grp0", rg_rgmii_phy_ref_clk_pins0),
  975. GROUP("rg_rgmii_phy_ref_clk_grp1", rg_rgmii_phy_ref_clk_pins1),
  976. GROUP("sd0_grp", sd0_pins),
  977. GROUP("sd0_4bit_grp", sd0_4bit_pins),
  978. GROUP("sd1_grp", sd1_pins),
  979. GROUP("sd1_4bit_grp0", sd1_4bit_pins0),
  980. GROUP("sd1_4bit_grp1", sd1_4bit_pins1),
  981. GROUP("sd2_grp0", sd2_pins0),
  982. GROUP("sd2_no_cdb_grp0", sd2_no_cdb_pins0),
  983. GROUP("sd3_grp", sd3_pins),
  984. GROUP("sd5_grp", sd5_pins),
  985. GROUP("sd6_grp0", sd6_pins0),
  986. GROUP("sd6_grp1", sd6_pins1),
  987. GROUP("sp0_ext_ldo_on_grp", sp0_ext_ldo_on_pins),
  988. GROUP("sp0_qspi_grp", sp0_qspi_pins),
  989. GROUP("sp1_spi_grp", sp1_spi_pins),
  990. GROUP("tpiu_trace_grp", tpiu_trace_pins),
  991. GROUP("uart0_grp", uart0_pins),
  992. GROUP("uart0_nopause_grp", uart0_nopause_pins),
  993. GROUP("uart1_grp", uart1_pins),
  994. GROUP("uart2_grp", uart2_pins),
  995. GROUP("uart3_grp0", uart3_pins0),
  996. GROUP("uart3_grp1", uart3_pins1),
  997. GROUP("uart3_grp2", uart3_pins2),
  998. GROUP("uart3_grp3", uart3_pins3),
  999. GROUP("uart3_nopause_grp0", uart3_nopause_pins0),
  1000. GROUP("uart3_nopause_grp1", uart3_nopause_pins1),
  1001. GROUP("uart4_grp0", uart4_pins0),
  1002. GROUP("uart4_grp1", uart4_pins1),
  1003. GROUP("uart4_grp2", uart4_pins2),
  1004. GROUP("uart4_nopause_grp", uart4_nopause_pins),
  1005. GROUP("usb0_drvvbus_grp", usb0_drvvbus_pins),
  1006. GROUP("usb1_drvvbus_grp", usb1_drvvbus_pins),
  1007. GROUP("visbus_dout_grp", visbus_dout_pins),
  1008. GROUP("vi_vip1_grp", vi_vip1_pins),
  1009. GROUP("vi_vip1_ext_grp", vi_vip1_ext_pins),
  1010. GROUP("vi_vip1_low8bit_grp", vi_vip1_low8bit_pins),
  1011. GROUP("vi_vip1_high8bit_grp", vi_vip1_high8bit_pins),
  1012. };
  1013. /* How many groups that a function can use */
  1014. static const char * const gnss_gpio_grp[] = { "gnss_gpio_grp", };
  1015. static const char * const lcd_vip_gpio_grp[] = { "lcd_vip_gpio_grp", };
  1016. static const char * const sdio_i2s_gpio_grp[] = { "sdio_i2s_gpio_grp", };
  1017. static const char * const sp_rgmii_gpio_grp[] = { "sp_rgmii_gpio_grp", };
  1018. static const char * const lvds_gpio_grp[] = { "lvds_gpio_grp", };
  1019. static const char * const uart_nand_gpio_grp[] = { "uart_nand_gpio_grp", };
  1020. static const char * const rtc_gpio_grp[] = { "rtc_gpio_grp", };
  1021. static const char * const audio_ac97_grp[] = { "audio_ac97_grp", };
  1022. static const char * const audio_func_dbg_grp[] = { "audio_func_dbg_grp", };
  1023. static const char * const audio_i2s_grp[] = { "audio_i2s_grp", };
  1024. static const char * const audio_i2s_2ch_grp[] = { "audio_i2s_2ch_grp", };
  1025. static const char * const audio_i2s_extclk_grp[] = { "audio_i2s_extclk_grp", };
  1026. static const char * const audio_uart0_grp[] = { "audio_uart0_grp", };
  1027. static const char * const audio_uart1_grp[] = { "audio_uart1_grp", };
  1028. static const char * const audio_uart2_grp0[] = { "audio_uart2_grp0", };
  1029. static const char * const audio_uart2_grp1[] = { "audio_uart2_grp1", };
  1030. static const char * const c_can_trnsvr_grp[] = { "c_can_trnsvr_grp", };
  1031. static const char * const c0_can_grp0[] = { "c0_can_grp0", };
  1032. static const char * const c0_can_grp1[] = { "c0_can_grp1", };
  1033. static const char * const c1_can_grp0[] = { "c1_can_grp0", };
  1034. static const char * const c1_can_grp1[] = { "c1_can_grp1", };
  1035. static const char * const c1_can_grp2[] = { "c1_can_grp2", };
  1036. static const char * const ca_audio_lpc_grp[] = { "ca_audio_lpc_grp", };
  1037. static const char * const ca_bt_lpc_grp[] = { "ca_bt_lpc_grp", };
  1038. static const char * const ca_coex_grp[] = { "ca_coex_grp", };
  1039. static const char * const ca_curator_lpc_grp[] = { "ca_curator_lpc_grp", };
  1040. static const char * const ca_pcm_debug_grp[] = { "ca_pcm_debug_grp", };
  1041. static const char * const ca_pio_grp[] = { "ca_pio_grp", };
  1042. static const char * const ca_sdio_debug_grp[] = { "ca_sdio_debug_grp", };
  1043. static const char * const ca_spi_grp[] = { "ca_spi_grp", };
  1044. static const char * const ca_trb_grp[] = { "ca_trb_grp", };
  1045. static const char * const ca_uart_debug_grp[] = { "ca_uart_debug_grp", };
  1046. static const char * const clkc_grp0[] = { "clkc_grp0", };
  1047. static const char * const clkc_grp1[] = { "clkc_grp1", };
  1048. static const char * const gn_gnss_i2c_grp[] = { "gn_gnss_i2c_grp", };
  1049. static const char * const gn_gnss_uart_nopause_grp[] = {
  1050. "gn_gnss_uart_nopause_grp", };
  1051. static const char * const gn_gnss_uart_grp[] = { "gn_gnss_uart_grp", };
  1052. static const char * const gn_trg_spi_grp0[] = { "gn_trg_spi_grp0", };
  1053. static const char * const gn_trg_spi_grp1[] = { "gn_trg_spi_grp1", };
  1054. static const char * const cvbs_dbg_grp[] = { "cvbs_dbg_grp", };
  1055. static const char * const cvbs_dbg_test_grp0[] = { "cvbs_dbg_test_grp0", };
  1056. static const char * const cvbs_dbg_test_grp1[] = { "cvbs_dbg_test_grp1", };
  1057. static const char * const cvbs_dbg_test_grp2[] = { "cvbs_dbg_test_grp2", };
  1058. static const char * const cvbs_dbg_test_grp3[] = { "cvbs_dbg_test_grp3", };
  1059. static const char * const cvbs_dbg_test_grp4[] = { "cvbs_dbg_test_grp4", };
  1060. static const char * const cvbs_dbg_test_grp5[] = { "cvbs_dbg_test_grp5", };
  1061. static const char * const cvbs_dbg_test_grp6[] = { "cvbs_dbg_test_grp6", };
  1062. static const char * const cvbs_dbg_test_grp7[] = { "cvbs_dbg_test_grp7", };
  1063. static const char * const cvbs_dbg_test_grp8[] = { "cvbs_dbg_test_grp8", };
  1064. static const char * const cvbs_dbg_test_grp9[] = { "cvbs_dbg_test_grp9", };
  1065. static const char * const cvbs_dbg_test_grp10[] = { "cvbs_dbg_test_grp10", };
  1066. static const char * const cvbs_dbg_test_grp11[] = { "cvbs_dbg_test_grp11", };
  1067. static const char * const cvbs_dbg_test_grp12[] = { "cvbs_dbg_test_grp12", };
  1068. static const char * const cvbs_dbg_test_grp13[] = { "cvbs_dbg_test_grp13", };
  1069. static const char * const cvbs_dbg_test_grp14[] = { "cvbs_dbg_test_grp14", };
  1070. static const char * const cvbs_dbg_test_grp15[] = { "cvbs_dbg_test_grp15", };
  1071. static const char * const gn_gnss_power_grp[] = { "gn_gnss_power_grp", };
  1072. static const char * const gn_gnss_sw_status_grp[] = {
  1073. "gn_gnss_sw_status_grp", };
  1074. static const char * const gn_gnss_eclk_grp[] = { "gn_gnss_eclk_grp", };
  1075. static const char * const gn_gnss_irq1_grp0[] = { "gn_gnss_irq1_grp0", };
  1076. static const char * const gn_gnss_irq2_grp0[] = { "gn_gnss_irq2_grp0", };
  1077. static const char * const gn_gnss_tm_grp[] = { "gn_gnss_tm_grp", };
  1078. static const char * const gn_gnss_tsync_grp[] = { "gn_gnss_tsync_grp", };
  1079. static const char * const gn_io_gnsssys_sw_cfg_grp[] = {
  1080. "gn_io_gnsssys_sw_cfg_grp", };
  1081. static const char * const gn_trg_grp0[] = { "gn_trg_grp0", };
  1082. static const char * const gn_trg_grp1[] = { "gn_trg_grp1", };
  1083. static const char * const gn_trg_shutdown_grp0[] = { "gn_trg_shutdown_grp0", };
  1084. static const char * const gn_trg_shutdown_grp1[] = { "gn_trg_shutdown_grp1", };
  1085. static const char * const gn_trg_shutdown_grp2[] = { "gn_trg_shutdown_grp2", };
  1086. static const char * const gn_trg_shutdown_grp3[] = { "gn_trg_shutdown_grp3", };
  1087. static const char * const i2c0_grp[] = { "i2c0_grp", };
  1088. static const char * const i2c1_grp[] = { "i2c1_grp", };
  1089. static const char * const jtag_grp0[] = { "jtag_grp0", };
  1090. static const char * const ks_kas_spi_grp0[] = { "ks_kas_spi_grp0", };
  1091. static const char * const ld_ldd_grp[] = { "ld_ldd_grp", };
  1092. static const char * const ld_ldd_16bit_grp[] = { "ld_ldd_16bit_grp", };
  1093. static const char * const ld_ldd_fck_grp[] = { "ld_ldd_fck_grp", };
  1094. static const char * const ld_ldd_lck_grp[] = { "ld_ldd_lck_grp", };
  1095. static const char * const lr_lcdrom_grp[] = { "lr_lcdrom_grp", };
  1096. static const char * const lvds_analog_grp[] = { "lvds_analog_grp", };
  1097. static const char * const nd_df_grp[] = { "nd_df_grp", };
  1098. static const char * const nd_df_nowp_grp[] = { "nd_df_nowp_grp", };
  1099. static const char * const ps_grp[] = { "ps_grp", };
  1100. static const char * const pwc_core_on_grp[] = { "pwc_core_on_grp", };
  1101. static const char * const pwc_ext_on_grp[] = { "pwc_ext_on_grp", };
  1102. static const char * const pwc_gpio3_clk_grp[] = { "pwc_gpio3_clk_grp", };
  1103. static const char * const pwc_io_on_grp[] = { "pwc_io_on_grp", };
  1104. static const char * const pwc_lowbatt_b_grp0[] = { "pwc_lowbatt_b_grp0", };
  1105. static const char * const pwc_mem_on_grp[] = { "pwc_mem_on_grp", };
  1106. static const char * const pwc_on_key_b_grp0[] = { "pwc_on_key_b_grp0", };
  1107. static const char * const pwc_wakeup_src0_grp[] = { "pwc_wakeup_src0_grp", };
  1108. static const char * const pwc_wakeup_src1_grp[] = { "pwc_wakeup_src1_grp", };
  1109. static const char * const pwc_wakeup_src2_grp[] = { "pwc_wakeup_src2_grp", };
  1110. static const char * const pwc_wakeup_src3_grp[] = { "pwc_wakeup_src3_grp", };
  1111. static const char * const pw_cko0_grp0[] = { "pw_cko0_grp0", };
  1112. static const char * const pw_cko0_grp1[] = { "pw_cko0_grp1", };
  1113. static const char * const pw_cko0_grp2[] = { "pw_cko0_grp2", };
  1114. static const char * const pw_cko1_grp0[] = { "pw_cko1_grp0", };
  1115. static const char * const pw_cko1_grp1[] = { "pw_cko1_grp1", };
  1116. static const char * const pw_i2s01_clk_grp0[] = { "pw_i2s01_clk_grp0", };
  1117. static const char * const pw_i2s01_clk_grp1[] = { "pw_i2s01_clk_grp1", };
  1118. static const char * const pw_pwm0_grp[] = { "pw_pwm0_grp", };
  1119. static const char * const pw_pwm1_grp[] = { "pw_pwm1_grp", };
  1120. static const char * const pw_pwm2_grp0[] = { "pw_pwm2_grp0", };
  1121. static const char * const pw_pwm2_grp1[] = { "pw_pwm2_grp1", };
  1122. static const char * const pw_pwm3_grp0[] = { "pw_pwm3_grp0", };
  1123. static const char * const pw_pwm3_grp1[] = { "pw_pwm3_grp1", };
  1124. static const char * const pw_pwm_cpu_vol_grp0[] = { "pw_pwm_cpu_vol_grp0", };
  1125. static const char * const pw_pwm_cpu_vol_grp1[] = { "pw_pwm_cpu_vol_grp1", };
  1126. static const char * const pw_backlight_grp0[] = { "pw_backlight_grp0", };
  1127. static const char * const pw_backlight_grp1[] = { "pw_backlight_grp1", };
  1128. static const char * const rg_eth_mac_grp[] = { "rg_eth_mac_grp", };
  1129. static const char * const rg_gmac_phy_intr_n_grp[] = {
  1130. "rg_gmac_phy_intr_n_grp", };
  1131. static const char * const rg_rgmii_mac_grp[] = { "rg_rgmii_mac_grp", };
  1132. static const char * const rg_rgmii_phy_ref_clk_grp0[] = {
  1133. "rg_rgmii_phy_ref_clk_grp0", };
  1134. static const char * const rg_rgmii_phy_ref_clk_grp1[] = {
  1135. "rg_rgmii_phy_ref_clk_grp1", };
  1136. static const char * const sd0_grp[] = { "sd0_grp", };
  1137. static const char * const sd0_4bit_grp[] = { "sd0_4bit_grp", };
  1138. static const char * const sd1_grp[] = { "sd1_grp", };
  1139. static const char * const sd1_4bit_grp0[] = { "sd1_4bit_grp0", };
  1140. static const char * const sd1_4bit_grp1[] = { "sd1_4bit_grp1", };
  1141. static const char * const sd2_grp0[] = { "sd2_grp0", };
  1142. static const char * const sd2_no_cdb_grp0[] = { "sd2_no_cdb_grp0", };
  1143. static const char * const sd3_grp[] = { "sd3_grp", };
  1144. static const char * const sd5_grp[] = { "sd5_grp", };
  1145. static const char * const sd6_grp0[] = { "sd6_grp0", };
  1146. static const char * const sd6_grp1[] = { "sd6_grp1", };
  1147. static const char * const sp0_ext_ldo_on_grp[] = { "sp0_ext_ldo_on_grp", };
  1148. static const char * const sp0_qspi_grp[] = { "sp0_qspi_grp", };
  1149. static const char * const sp1_spi_grp[] = { "sp1_spi_grp", };
  1150. static const char * const tpiu_trace_grp[] = { "tpiu_trace_grp", };
  1151. static const char * const uart0_grp[] = { "uart0_grp", };
  1152. static const char * const uart0_nopause_grp[] = { "uart0_nopause_grp", };
  1153. static const char * const uart1_grp[] = { "uart1_grp", };
  1154. static const char * const uart2_grp[] = { "uart2_grp", };
  1155. static const char * const uart3_grp0[] = { "uart3_grp0", };
  1156. static const char * const uart3_grp1[] = { "uart3_grp1", };
  1157. static const char * const uart3_grp2[] = { "uart3_grp2", };
  1158. static const char * const uart3_grp3[] = { "uart3_grp3", };
  1159. static const char * const uart3_nopause_grp0[] = { "uart3_nopause_grp0", };
  1160. static const char * const uart3_nopause_grp1[] = { "uart3_nopause_grp1", };
  1161. static const char * const uart4_grp0[] = { "uart4_grp0", };
  1162. static const char * const uart4_grp1[] = { "uart4_grp1", };
  1163. static const char * const uart4_grp2[] = { "uart4_grp2", };
  1164. static const char * const uart4_nopause_grp[] = { "uart4_nopause_grp", };
  1165. static const char * const usb0_drvvbus_grp[] = { "usb0_drvvbus_grp", };
  1166. static const char * const usb1_drvvbus_grp[] = { "usb1_drvvbus_grp", };
  1167. static const char * const visbus_dout_grp[] = { "visbus_dout_grp", };
  1168. static const char * const vi_vip1_grp[] = { "vi_vip1_grp", };
  1169. static const char * const vi_vip1_ext_grp[] = { "vi_vip1_ext_grp", };
  1170. static const char * const vi_vip1_low8bit_grp[] = { "vi_vip1_low8bit_grp", };
  1171. static const char * const vi_vip1_high8bit_grp[] = { "vi_vip1_high8bit_grp", };
  1172. static struct atlas7_pad_mux gnss_gpio_grp_pad_mux[] = {
  1173. MUX(1, 119, 0, N, N, N, N),
  1174. MUX(1, 120, 0, N, N, N, N),
  1175. MUX(1, 121, 0, N, N, N, N),
  1176. MUX(1, 122, 0, N, N, N, N),
  1177. MUX(1, 123, 0, N, N, N, N),
  1178. MUX(1, 124, 0, N, N, N, N),
  1179. MUX(1, 125, 0, N, N, N, N),
  1180. MUX(1, 126, 0, N, N, N, N),
  1181. MUX(1, 127, 0, N, N, N, N),
  1182. MUX(1, 128, 0, N, N, N, N),
  1183. MUX(1, 22, 0, N, N, N, N),
  1184. MUX(1, 23, 0, N, N, N, N),
  1185. MUX(1, 24, 0, N, N, N, N),
  1186. MUX(1, 25, 0, N, N, N, N),
  1187. MUX(1, 26, 0, N, N, N, N),
  1188. MUX(1, 27, 0, N, N, N, N),
  1189. MUX(1, 28, 0, N, N, N, N),
  1190. MUX(1, 29, 0, N, N, N, N),
  1191. MUX(1, 30, 0, N, N, N, N),
  1192. };
  1193. static struct atlas7_grp_mux gnss_gpio_grp_mux = {
  1194. .pad_mux_count = ARRAY_SIZE(gnss_gpio_grp_pad_mux),
  1195. .pad_mux_list = gnss_gpio_grp_pad_mux,
  1196. };
  1197. static struct atlas7_pad_mux lcd_vip_gpio_grp_pad_mux[] = {
  1198. MUX(1, 74, 0, N, N, N, N),
  1199. MUX(1, 75, 0, N, N, N, N),
  1200. MUX(1, 76, 0, N, N, N, N),
  1201. MUX(1, 77, 0, N, N, N, N),
  1202. MUX(1, 78, 0, N, N, N, N),
  1203. MUX(1, 79, 0, N, N, N, N),
  1204. MUX(1, 80, 0, N, N, N, N),
  1205. MUX(1, 81, 0, N, N, N, N),
  1206. MUX(1, 82, 0, N, N, N, N),
  1207. MUX(1, 83, 0, N, N, N, N),
  1208. MUX(1, 84, 0, N, N, N, N),
  1209. MUX(1, 53, 0, N, N, N, N),
  1210. MUX(1, 54, 0, N, N, N, N),
  1211. MUX(1, 55, 0, N, N, N, N),
  1212. MUX(1, 56, 0, N, N, N, N),
  1213. MUX(1, 57, 0, N, N, N, N),
  1214. MUX(1, 58, 0, N, N, N, N),
  1215. MUX(1, 59, 0, N, N, N, N),
  1216. MUX(1, 60, 0, N, N, N, N),
  1217. MUX(1, 61, 0, N, N, N, N),
  1218. MUX(1, 62, 0, N, N, N, N),
  1219. MUX(1, 63, 0, N, N, N, N),
  1220. MUX(1, 64, 0, N, N, N, N),
  1221. MUX(1, 65, 0, N, N, N, N),
  1222. MUX(1, 66, 0, N, N, N, N),
  1223. MUX(1, 67, 0, N, N, N, N),
  1224. MUX(1, 68, 0, N, N, N, N),
  1225. MUX(1, 69, 0, N, N, N, N),
  1226. MUX(1, 70, 0, N, N, N, N),
  1227. MUX(1, 71, 0, N, N, N, N),
  1228. MUX(1, 72, 0, N, N, N, N),
  1229. MUX(1, 73, 0, N, N, N, N),
  1230. };
  1231. static struct atlas7_grp_mux lcd_vip_gpio_grp_mux = {
  1232. .pad_mux_count = ARRAY_SIZE(lcd_vip_gpio_grp_pad_mux),
  1233. .pad_mux_list = lcd_vip_gpio_grp_pad_mux,
  1234. };
  1235. static struct atlas7_pad_mux sdio_i2s_gpio_grp_pad_mux[] = {
  1236. MUX(1, 31, 0, N, N, N, N),
  1237. MUX(1, 32, 0, N, N, N, N),
  1238. MUX(1, 33, 0, N, N, N, N),
  1239. MUX(1, 34, 0, N, N, N, N),
  1240. MUX(1, 35, 0, N, N, N, N),
  1241. MUX(1, 36, 0, N, N, N, N),
  1242. MUX(1, 85, 0, N, N, N, N),
  1243. MUX(1, 86, 0, N, N, N, N),
  1244. MUX(1, 87, 0, N, N, N, N),
  1245. MUX(1, 88, 0, N, N, N, N),
  1246. MUX(1, 89, 0, N, N, N, N),
  1247. MUX(1, 90, 0, N, N, N, N),
  1248. MUX(1, 129, 0, N, N, N, N),
  1249. MUX(1, 130, 0, N, N, N, N),
  1250. MUX(1, 131, 0, N, N, N, N),
  1251. MUX(1, 132, 0, N, N, N, N),
  1252. MUX(1, 91, 0, N, N, N, N),
  1253. MUX(1, 92, 0, N, N, N, N),
  1254. MUX(1, 93, 0, N, N, N, N),
  1255. MUX(1, 94, 0, N, N, N, N),
  1256. MUX(1, 95, 0, N, N, N, N),
  1257. MUX(1, 96, 0, N, N, N, N),
  1258. MUX(1, 112, 0, N, N, N, N),
  1259. MUX(1, 113, 0, N, N, N, N),
  1260. MUX(1, 114, 0, N, N, N, N),
  1261. MUX(1, 115, 0, N, N, N, N),
  1262. MUX(1, 116, 0, N, N, N, N),
  1263. MUX(1, 117, 0, N, N, N, N),
  1264. MUX(1, 118, 0, N, N, N, N),
  1265. };
  1266. static struct atlas7_grp_mux sdio_i2s_gpio_grp_mux = {
  1267. .pad_mux_count = ARRAY_SIZE(sdio_i2s_gpio_grp_pad_mux),
  1268. .pad_mux_list = sdio_i2s_gpio_grp_pad_mux,
  1269. };
  1270. static struct atlas7_pad_mux sp_rgmii_gpio_grp_pad_mux[] = {
  1271. MUX(1, 97, 0, N, N, N, N),
  1272. MUX(1, 98, 0, N, N, N, N),
  1273. MUX(1, 99, 0, N, N, N, N),
  1274. MUX(1, 100, 0, N, N, N, N),
  1275. MUX(1, 101, 0, N, N, N, N),
  1276. MUX(1, 102, 0, N, N, N, N),
  1277. MUX(1, 103, 0, N, N, N, N),
  1278. MUX(1, 104, 0, N, N, N, N),
  1279. MUX(1, 105, 0, N, N, N, N),
  1280. MUX(1, 106, 0, N, N, N, N),
  1281. MUX(1, 107, 0, N, N, N, N),
  1282. MUX(1, 108, 0, N, N, N, N),
  1283. MUX(1, 109, 0, N, N, N, N),
  1284. MUX(1, 110, 0, N, N, N, N),
  1285. MUX(1, 111, 0, N, N, N, N),
  1286. MUX(1, 18, 0, N, N, N, N),
  1287. MUX(1, 19, 0, N, N, N, N),
  1288. MUX(1, 20, 0, N, N, N, N),
  1289. MUX(1, 21, 0, N, N, N, N),
  1290. MUX(1, 141, 0, N, N, N, N),
  1291. MUX(1, 142, 0, N, N, N, N),
  1292. MUX(1, 143, 0, N, N, N, N),
  1293. MUX(1, 144, 0, N, N, N, N),
  1294. MUX(1, 145, 0, N, N, N, N),
  1295. MUX(1, 146, 0, N, N, N, N),
  1296. MUX(1, 147, 0, N, N, N, N),
  1297. MUX(1, 148, 0, N, N, N, N),
  1298. };
  1299. static struct atlas7_grp_mux sp_rgmii_gpio_grp_mux = {
  1300. .pad_mux_count = ARRAY_SIZE(sp_rgmii_gpio_grp_pad_mux),
  1301. .pad_mux_list = sp_rgmii_gpio_grp_pad_mux,
  1302. };
  1303. static struct atlas7_pad_mux lvds_gpio_grp_pad_mux[] = {
  1304. MUX(1, 157, 0, N, N, N, N),
  1305. MUX(1, 158, 0, N, N, N, N),
  1306. MUX(1, 155, 0, N, N, N, N),
  1307. MUX(1, 156, 0, N, N, N, N),
  1308. MUX(1, 153, 0, N, N, N, N),
  1309. MUX(1, 154, 0, N, N, N, N),
  1310. MUX(1, 151, 0, N, N, N, N),
  1311. MUX(1, 152, 0, N, N, N, N),
  1312. MUX(1, 149, 0, N, N, N, N),
  1313. MUX(1, 150, 0, N, N, N, N),
  1314. };
  1315. static struct atlas7_grp_mux lvds_gpio_grp_mux = {
  1316. .pad_mux_count = ARRAY_SIZE(lvds_gpio_grp_pad_mux),
  1317. .pad_mux_list = lvds_gpio_grp_pad_mux,
  1318. };
  1319. static struct atlas7_pad_mux uart_nand_gpio_grp_pad_mux[] = {
  1320. MUX(1, 44, 0, N, N, N, N),
  1321. MUX(1, 43, 0, N, N, N, N),
  1322. MUX(1, 42, 0, N, N, N, N),
  1323. MUX(1, 41, 0, N, N, N, N),
  1324. MUX(1, 40, 0, N, N, N, N),
  1325. MUX(1, 39, 0, N, N, N, N),
  1326. MUX(1, 38, 0, N, N, N, N),
  1327. MUX(1, 37, 0, N, N, N, N),
  1328. MUX(1, 46, 0, N, N, N, N),
  1329. MUX(1, 47, 0, N, N, N, N),
  1330. MUX(1, 48, 0, N, N, N, N),
  1331. MUX(1, 49, 0, N, N, N, N),
  1332. MUX(1, 50, 0, N, N, N, N),
  1333. MUX(1, 52, 0, N, N, N, N),
  1334. MUX(1, 51, 0, N, N, N, N),
  1335. MUX(1, 45, 0, N, N, N, N),
  1336. MUX(1, 133, 0, N, N, N, N),
  1337. MUX(1, 134, 0, N, N, N, N),
  1338. MUX(1, 135, 0, N, N, N, N),
  1339. MUX(1, 136, 0, N, N, N, N),
  1340. MUX(1, 137, 0, N, N, N, N),
  1341. MUX(1, 138, 0, N, N, N, N),
  1342. MUX(1, 139, 0, N, N, N, N),
  1343. MUX(1, 140, 0, N, N, N, N),
  1344. };
  1345. static struct atlas7_grp_mux uart_nand_gpio_grp_mux = {
  1346. .pad_mux_count = ARRAY_SIZE(uart_nand_gpio_grp_pad_mux),
  1347. .pad_mux_list = uart_nand_gpio_grp_pad_mux,
  1348. };
  1349. static struct atlas7_pad_mux rtc_gpio_grp_pad_mux[] = {
  1350. MUX(0, 0, 0, N, N, N, N),
  1351. MUX(0, 1, 0, N, N, N, N),
  1352. MUX(0, 2, 0, N, N, N, N),
  1353. MUX(0, 3, 0, N, N, N, N),
  1354. MUX(0, 4, 0, N, N, N, N),
  1355. MUX(0, 10, 0, N, N, N, N),
  1356. MUX(0, 11, 0, N, N, N, N),
  1357. MUX(0, 12, 0, N, N, N, N),
  1358. MUX(0, 13, 0, N, N, N, N),
  1359. MUX(0, 14, 0, N, N, N, N),
  1360. MUX(0, 15, 0, N, N, N, N),
  1361. MUX(0, 16, 0, N, N, N, N),
  1362. MUX(0, 17, 0, N, N, N, N),
  1363. };
  1364. static struct atlas7_grp_mux rtc_gpio_grp_mux = {
  1365. .pad_mux_count = ARRAY_SIZE(rtc_gpio_grp_pad_mux),
  1366. .pad_mux_list = rtc_gpio_grp_pad_mux,
  1367. };
  1368. static struct atlas7_pad_mux audio_ac97_grp_pad_mux[] = {
  1369. MUX(1, 113, 2, N, N, N, N),
  1370. MUX(1, 118, 2, N, N, N, N),
  1371. MUX(1, 115, 2, N, N, N, N),
  1372. MUX(1, 114, 2, N, N, N, N),
  1373. };
  1374. static struct atlas7_grp_mux audio_ac97_grp_mux = {
  1375. .pad_mux_count = ARRAY_SIZE(audio_ac97_grp_pad_mux),
  1376. .pad_mux_list = audio_ac97_grp_pad_mux,
  1377. };
  1378. static struct atlas7_pad_mux audio_func_dbg_grp_pad_mux[] = {
  1379. MUX(1, 141, 4, N, N, N, N),
  1380. MUX(1, 144, 4, N, N, N, N),
  1381. MUX(1, 44, 6, N, N, N, N),
  1382. MUX(1, 43, 6, N, N, N, N),
  1383. MUX(1, 42, 6, N, N, N, N),
  1384. MUX(1, 41, 6, N, N, N, N),
  1385. MUX(1, 40, 6, N, N, N, N),
  1386. MUX(1, 39, 6, N, N, N, N),
  1387. MUX(1, 38, 6, N, N, N, N),
  1388. MUX(1, 37, 6, N, N, N, N),
  1389. MUX(1, 74, 6, N, N, N, N),
  1390. MUX(1, 75, 6, N, N, N, N),
  1391. MUX(1, 76, 6, N, N, N, N),
  1392. MUX(1, 77, 6, N, N, N, N),
  1393. MUX(1, 78, 6, N, N, N, N),
  1394. MUX(1, 79, 6, N, N, N, N),
  1395. MUX(1, 81, 6, N, N, N, N),
  1396. MUX(1, 113, 6, N, N, N, N),
  1397. MUX(1, 114, 6, N, N, N, N),
  1398. MUX(1, 118, 6, N, N, N, N),
  1399. MUX(1, 115, 6, N, N, N, N),
  1400. MUX(1, 49, 6, N, N, N, N),
  1401. MUX(1, 50, 6, N, N, N, N),
  1402. MUX(1, 142, 4, N, N, N, N),
  1403. MUX(1, 143, 4, N, N, N, N),
  1404. MUX(1, 80, 6, N, N, N, N),
  1405. };
  1406. static struct atlas7_grp_mux audio_func_dbg_grp_mux = {
  1407. .pad_mux_count = ARRAY_SIZE(audio_func_dbg_grp_pad_mux),
  1408. .pad_mux_list = audio_func_dbg_grp_pad_mux,
  1409. };
  1410. static struct atlas7_pad_mux audio_i2s_grp_pad_mux[] = {
  1411. MUX(1, 118, 1, N, N, N, N),
  1412. MUX(1, 115, 1, N, N, N, N),
  1413. MUX(1, 116, 1, N, N, N, N),
  1414. MUX(1, 117, 1, N, N, N, N),
  1415. MUX(1, 112, 1, N, N, N, N),
  1416. MUX(1, 113, 1, N, N, N, N),
  1417. MUX(1, 114, 1, N, N, N, N),
  1418. };
  1419. static struct atlas7_grp_mux audio_i2s_grp_mux = {
  1420. .pad_mux_count = ARRAY_SIZE(audio_i2s_grp_pad_mux),
  1421. .pad_mux_list = audio_i2s_grp_pad_mux,
  1422. };
  1423. static struct atlas7_pad_mux audio_i2s_2ch_grp_pad_mux[] = {
  1424. MUX(1, 118, 1, N, N, N, N),
  1425. MUX(1, 115, 1, N, N, N, N),
  1426. MUX(1, 112, 1, N, N, N, N),
  1427. MUX(1, 113, 1, N, N, N, N),
  1428. MUX(1, 114, 1, N, N, N, N),
  1429. };
  1430. static struct atlas7_grp_mux audio_i2s_2ch_grp_mux = {
  1431. .pad_mux_count = ARRAY_SIZE(audio_i2s_2ch_grp_pad_mux),
  1432. .pad_mux_list = audio_i2s_2ch_grp_pad_mux,
  1433. };
  1434. static struct atlas7_pad_mux audio_i2s_extclk_grp_pad_mux[] = {
  1435. MUX(1, 112, 2, N, N, N, N),
  1436. };
  1437. static struct atlas7_grp_mux audio_i2s_extclk_grp_mux = {
  1438. .pad_mux_count = ARRAY_SIZE(audio_i2s_extclk_grp_pad_mux),
  1439. .pad_mux_list = audio_i2s_extclk_grp_pad_mux,
  1440. };
  1441. static struct atlas7_pad_mux audio_uart0_grp_pad_mux[] = {
  1442. MUX(1, 143, 1, N, N, N, N),
  1443. MUX(1, 142, 1, N, N, N, N),
  1444. MUX(1, 141, 1, N, N, N, N),
  1445. MUX(1, 144, 1, N, N, N, N),
  1446. };
  1447. static struct atlas7_grp_mux audio_uart0_grp_mux = {
  1448. .pad_mux_count = ARRAY_SIZE(audio_uart0_grp_pad_mux),
  1449. .pad_mux_list = audio_uart0_grp_pad_mux,
  1450. };
  1451. static struct atlas7_pad_mux audio_uart1_grp_pad_mux[] = {
  1452. MUX(1, 147, 1, N, N, N, N),
  1453. MUX(1, 146, 1, N, N, N, N),
  1454. MUX(1, 145, 1, N, N, N, N),
  1455. MUX(1, 148, 1, N, N, N, N),
  1456. };
  1457. static struct atlas7_grp_mux audio_uart1_grp_mux = {
  1458. .pad_mux_count = ARRAY_SIZE(audio_uart1_grp_pad_mux),
  1459. .pad_mux_list = audio_uart1_grp_pad_mux,
  1460. };
  1461. static struct atlas7_pad_mux audio_uart2_grp0_pad_mux[] = {
  1462. MUX(1, 20, 2, 0xa00, 24, 0xa80, 24),
  1463. MUX(1, 21, 2, 0xa00, 25, 0xa80, 25),
  1464. MUX(1, 19, 2, 0xa00, 23, 0xa80, 23),
  1465. MUX(1, 18, 2, 0xa00, 22, 0xa80, 22),
  1466. };
  1467. static struct atlas7_grp_mux audio_uart2_grp0_mux = {
  1468. .pad_mux_count = ARRAY_SIZE(audio_uart2_grp0_pad_mux),
  1469. .pad_mux_list = audio_uart2_grp0_pad_mux,
  1470. };
  1471. static struct atlas7_pad_mux audio_uart2_grp1_pad_mux[] = {
  1472. MUX(1, 109, 2, 0xa00, 24, 0xa80, 24),
  1473. MUX(1, 110, 2, 0xa00, 25, 0xa80, 25),
  1474. MUX(1, 101, 2, 0xa00, 23, 0xa80, 23),
  1475. MUX(1, 111, 2, 0xa00, 22, 0xa80, 22),
  1476. };
  1477. static struct atlas7_grp_mux audio_uart2_grp1_mux = {
  1478. .pad_mux_count = ARRAY_SIZE(audio_uart2_grp1_pad_mux),
  1479. .pad_mux_list = audio_uart2_grp1_pad_mux,
  1480. };
  1481. static struct atlas7_pad_mux c_can_trnsvr_grp_pad_mux[] = {
  1482. MUX(0, 1, 2, N, N, N, N),
  1483. };
  1484. static struct atlas7_grp_mux c_can_trnsvr_grp_mux = {
  1485. .pad_mux_count = ARRAY_SIZE(c_can_trnsvr_grp_pad_mux),
  1486. .pad_mux_list = c_can_trnsvr_grp_pad_mux,
  1487. };
  1488. static struct atlas7_pad_mux c0_can_grp0_pad_mux[] = {
  1489. MUX(0, 11, 1, 0xa08, 9, 0xa88, 9),
  1490. MUX(0, 10, 1, N, N, N, N),
  1491. };
  1492. static struct atlas7_grp_mux c0_can_grp0_mux = {
  1493. .pad_mux_count = ARRAY_SIZE(c0_can_grp0_pad_mux),
  1494. .pad_mux_list = c0_can_grp0_pad_mux,
  1495. };
  1496. static struct atlas7_pad_mux c0_can_grp1_pad_mux[] = {
  1497. MUX(0, 2, 5, 0xa08, 9, 0xa88, 9),
  1498. MUX(0, 3, 5, N, N, N, N),
  1499. };
  1500. static struct atlas7_grp_mux c0_can_grp1_mux = {
  1501. .pad_mux_count = ARRAY_SIZE(c0_can_grp1_pad_mux),
  1502. .pad_mux_list = c0_can_grp1_pad_mux,
  1503. };
  1504. static struct atlas7_pad_mux c1_can_grp0_pad_mux[] = {
  1505. MUX(1, 138, 2, 0xa00, 4, 0xa80, 4),
  1506. MUX(1, 137, 2, N, N, N, N),
  1507. };
  1508. static struct atlas7_grp_mux c1_can_grp0_mux = {
  1509. .pad_mux_count = ARRAY_SIZE(c1_can_grp0_pad_mux),
  1510. .pad_mux_list = c1_can_grp0_pad_mux,
  1511. };
  1512. static struct atlas7_pad_mux c1_can_grp1_pad_mux[] = {
  1513. MUX(1, 147, 2, 0xa00, 4, 0xa80, 4),
  1514. MUX(1, 146, 2, N, N, N, N),
  1515. };
  1516. static struct atlas7_grp_mux c1_can_grp1_mux = {
  1517. .pad_mux_count = ARRAY_SIZE(c1_can_grp1_pad_mux),
  1518. .pad_mux_list = c1_can_grp1_pad_mux,
  1519. };
  1520. static struct atlas7_pad_mux c1_can_grp2_pad_mux[] = {
  1521. MUX(0, 2, 2, 0xa00, 4, 0xa80, 4),
  1522. MUX(0, 3, 2, N, N, N, N),
  1523. };
  1524. static struct atlas7_grp_mux c1_can_grp2_mux = {
  1525. .pad_mux_count = ARRAY_SIZE(c1_can_grp2_pad_mux),
  1526. .pad_mux_list = c1_can_grp2_pad_mux,
  1527. };
  1528. static struct atlas7_pad_mux ca_audio_lpc_grp_pad_mux[] = {
  1529. MUX(1, 62, 4, N, N, N, N),
  1530. MUX(1, 63, 4, N, N, N, N),
  1531. MUX(1, 64, 4, N, N, N, N),
  1532. MUX(1, 65, 4, N, N, N, N),
  1533. MUX(1, 66, 4, N, N, N, N),
  1534. MUX(1, 67, 4, N, N, N, N),
  1535. MUX(1, 68, 4, N, N, N, N),
  1536. MUX(1, 69, 4, N, N, N, N),
  1537. MUX(1, 70, 4, N, N, N, N),
  1538. MUX(1, 71, 4, N, N, N, N),
  1539. };
  1540. static struct atlas7_grp_mux ca_audio_lpc_grp_mux = {
  1541. .pad_mux_count = ARRAY_SIZE(ca_audio_lpc_grp_pad_mux),
  1542. .pad_mux_list = ca_audio_lpc_grp_pad_mux,
  1543. };
  1544. static struct atlas7_pad_mux ca_bt_lpc_grp_pad_mux[] = {
  1545. MUX(1, 85, 5, N, N, N, N),
  1546. MUX(1, 86, 5, N, N, N, N),
  1547. MUX(1, 87, 5, N, N, N, N),
  1548. MUX(1, 88, 5, N, N, N, N),
  1549. MUX(1, 89, 5, N, N, N, N),
  1550. MUX(1, 90, 5, N, N, N, N),
  1551. };
  1552. static struct atlas7_grp_mux ca_bt_lpc_grp_mux = {
  1553. .pad_mux_count = ARRAY_SIZE(ca_bt_lpc_grp_pad_mux),
  1554. .pad_mux_list = ca_bt_lpc_grp_pad_mux,
  1555. };
  1556. static struct atlas7_pad_mux ca_coex_grp_pad_mux[] = {
  1557. MUX(1, 129, 1, N, N, N, N),
  1558. MUX(1, 130, 1, N, N, N, N),
  1559. MUX(1, 131, 1, N, N, N, N),
  1560. MUX(1, 132, 1, N, N, N, N),
  1561. };
  1562. static struct atlas7_grp_mux ca_coex_grp_mux = {
  1563. .pad_mux_count = ARRAY_SIZE(ca_coex_grp_pad_mux),
  1564. .pad_mux_list = ca_coex_grp_pad_mux,
  1565. };
  1566. static struct atlas7_pad_mux ca_curator_lpc_grp_pad_mux[] = {
  1567. MUX(1, 57, 4, N, N, N, N),
  1568. MUX(1, 58, 4, N, N, N, N),
  1569. MUX(1, 59, 4, N, N, N, N),
  1570. MUX(1, 60, 4, N, N, N, N),
  1571. };
  1572. static struct atlas7_grp_mux ca_curator_lpc_grp_mux = {
  1573. .pad_mux_count = ARRAY_SIZE(ca_curator_lpc_grp_pad_mux),
  1574. .pad_mux_list = ca_curator_lpc_grp_pad_mux,
  1575. };
  1576. static struct atlas7_pad_mux ca_pcm_debug_grp_pad_mux[] = {
  1577. MUX(1, 91, 5, N, N, N, N),
  1578. MUX(1, 93, 5, N, N, N, N),
  1579. MUX(1, 94, 5, N, N, N, N),
  1580. MUX(1, 92, 5, N, N, N, N),
  1581. };
  1582. static struct atlas7_grp_mux ca_pcm_debug_grp_mux = {
  1583. .pad_mux_count = ARRAY_SIZE(ca_pcm_debug_grp_pad_mux),
  1584. .pad_mux_list = ca_pcm_debug_grp_pad_mux,
  1585. };
  1586. static struct atlas7_pad_mux ca_pio_grp_pad_mux[] = {
  1587. MUX(1, 121, 2, N, N, N, N),
  1588. MUX(1, 122, 2, N, N, N, N),
  1589. MUX(1, 125, 6, N, N, N, N),
  1590. MUX(1, 126, 6, N, N, N, N),
  1591. MUX(1, 38, 5, N, N, N, N),
  1592. MUX(1, 37, 5, N, N, N, N),
  1593. MUX(1, 47, 5, N, N, N, N),
  1594. MUX(1, 49, 5, N, N, N, N),
  1595. MUX(1, 50, 5, N, N, N, N),
  1596. MUX(1, 54, 4, N, N, N, N),
  1597. MUX(1, 55, 4, N, N, N, N),
  1598. MUX(1, 56, 4, N, N, N, N),
  1599. };
  1600. static struct atlas7_grp_mux ca_pio_grp_mux = {
  1601. .pad_mux_count = ARRAY_SIZE(ca_pio_grp_pad_mux),
  1602. .pad_mux_list = ca_pio_grp_pad_mux,
  1603. };
  1604. static struct atlas7_pad_mux ca_sdio_debug_grp_pad_mux[] = {
  1605. MUX(1, 40, 5, N, N, N, N),
  1606. MUX(1, 39, 5, N, N, N, N),
  1607. MUX(1, 44, 5, N, N, N, N),
  1608. MUX(1, 43, 5, N, N, N, N),
  1609. MUX(1, 42, 5, N, N, N, N),
  1610. MUX(1, 41, 5, N, N, N, N),
  1611. };
  1612. static struct atlas7_grp_mux ca_sdio_debug_grp_mux = {
  1613. .pad_mux_count = ARRAY_SIZE(ca_sdio_debug_grp_pad_mux),
  1614. .pad_mux_list = ca_sdio_debug_grp_pad_mux,
  1615. };
  1616. static struct atlas7_pad_mux ca_spi_grp_pad_mux[] = {
  1617. MUX(1, 82, 5, N, N, N, N),
  1618. MUX(1, 79, 5, 0xa08, 6, 0xa88, 6),
  1619. MUX(1, 80, 5, N, N, N, N),
  1620. MUX(1, 81, 5, N, N, N, N),
  1621. };
  1622. static struct atlas7_grp_mux ca_spi_grp_mux = {
  1623. .pad_mux_count = ARRAY_SIZE(ca_spi_grp_pad_mux),
  1624. .pad_mux_list = ca_spi_grp_pad_mux,
  1625. };
  1626. static struct atlas7_pad_mux ca_trb_grp_pad_mux[] = {
  1627. MUX(1, 91, 4, N, N, N, N),
  1628. MUX(1, 93, 4, N, N, N, N),
  1629. MUX(1, 94, 4, N, N, N, N),
  1630. MUX(1, 95, 4, N, N, N, N),
  1631. MUX(1, 96, 4, N, N, N, N),
  1632. MUX(1, 78, 5, N, N, N, N),
  1633. MUX(1, 74, 5, N, N, N, N),
  1634. MUX(1, 75, 5, N, N, N, N),
  1635. MUX(1, 76, 5, N, N, N, N),
  1636. MUX(1, 77, 5, N, N, N, N),
  1637. };
  1638. static struct atlas7_grp_mux ca_trb_grp_mux = {
  1639. .pad_mux_count = ARRAY_SIZE(ca_trb_grp_pad_mux),
  1640. .pad_mux_list = ca_trb_grp_pad_mux,
  1641. };
  1642. static struct atlas7_pad_mux ca_uart_debug_grp_pad_mux[] = {
  1643. MUX(1, 136, 3, N, N, N, N),
  1644. MUX(1, 135, 3, N, N, N, N),
  1645. MUX(1, 134, 3, N, N, N, N),
  1646. MUX(1, 133, 3, N, N, N, N),
  1647. };
  1648. static struct atlas7_grp_mux ca_uart_debug_grp_mux = {
  1649. .pad_mux_count = ARRAY_SIZE(ca_uart_debug_grp_pad_mux),
  1650. .pad_mux_list = ca_uart_debug_grp_pad_mux,
  1651. };
  1652. static struct atlas7_pad_mux clkc_grp0_pad_mux[] = {
  1653. MUX(1, 30, 2, 0xa08, 14, 0xa88, 14),
  1654. MUX(1, 47, 6, N, N, N, N),
  1655. };
  1656. static struct atlas7_grp_mux clkc_grp0_mux = {
  1657. .pad_mux_count = ARRAY_SIZE(clkc_grp0_pad_mux),
  1658. .pad_mux_list = clkc_grp0_pad_mux,
  1659. };
  1660. static struct atlas7_pad_mux clkc_grp1_pad_mux[] = {
  1661. MUX(1, 78, 3, 0xa08, 14, 0xa88, 14),
  1662. MUX(1, 54, 5, N, N, N, N),
  1663. };
  1664. static struct atlas7_grp_mux clkc_grp1_mux = {
  1665. .pad_mux_count = ARRAY_SIZE(clkc_grp1_pad_mux),
  1666. .pad_mux_list = clkc_grp1_pad_mux,
  1667. };
  1668. static struct atlas7_pad_mux gn_gnss_i2c_grp_pad_mux[] = {
  1669. MUX(1, 128, 2, N, N, N, N),
  1670. MUX(1, 127, 2, N, N, N, N),
  1671. };
  1672. static struct atlas7_grp_mux gn_gnss_i2c_grp_mux = {
  1673. .pad_mux_count = ARRAY_SIZE(gn_gnss_i2c_grp_pad_mux),
  1674. .pad_mux_list = gn_gnss_i2c_grp_pad_mux,
  1675. };
  1676. static struct atlas7_pad_mux gn_gnss_uart_nopause_grp_pad_mux[] = {
  1677. MUX(1, 134, 4, N, N, N, N),
  1678. MUX(1, 133, 4, N, N, N, N),
  1679. };
  1680. static struct atlas7_grp_mux gn_gnss_uart_nopause_grp_mux = {
  1681. .pad_mux_count = ARRAY_SIZE(gn_gnss_uart_nopause_grp_pad_mux),
  1682. .pad_mux_list = gn_gnss_uart_nopause_grp_pad_mux,
  1683. };
  1684. static struct atlas7_pad_mux gn_gnss_uart_grp_pad_mux[] = {
  1685. MUX(1, 134, 4, N, N, N, N),
  1686. MUX(1, 133, 4, N, N, N, N),
  1687. MUX(1, 136, 4, N, N, N, N),
  1688. MUX(1, 135, 4, N, N, N, N),
  1689. };
  1690. static struct atlas7_grp_mux gn_gnss_uart_grp_mux = {
  1691. .pad_mux_count = ARRAY_SIZE(gn_gnss_uart_grp_pad_mux),
  1692. .pad_mux_list = gn_gnss_uart_grp_pad_mux,
  1693. };
  1694. static struct atlas7_pad_mux gn_trg_spi_grp0_pad_mux[] = {
  1695. MUX(1, 22, 1, N, N, N, N),
  1696. MUX(1, 25, 1, N, N, N, N),
  1697. MUX(1, 23, 1, 0xa00, 10, 0xa80, 10),
  1698. MUX(1, 24, 1, N, N, N, N),
  1699. };
  1700. static struct atlas7_grp_mux gn_trg_spi_grp0_mux = {
  1701. .pad_mux_count = ARRAY_SIZE(gn_trg_spi_grp0_pad_mux),
  1702. .pad_mux_list = gn_trg_spi_grp0_pad_mux,
  1703. };
  1704. static struct atlas7_pad_mux gn_trg_spi_grp1_pad_mux[] = {
  1705. MUX(1, 82, 3, N, N, N, N),
  1706. MUX(1, 79, 3, N, N, N, N),
  1707. MUX(1, 80, 3, 0xa00, 10, 0xa80, 10),
  1708. MUX(1, 81, 3, N, N, N, N),
  1709. };
  1710. static struct atlas7_grp_mux gn_trg_spi_grp1_mux = {
  1711. .pad_mux_count = ARRAY_SIZE(gn_trg_spi_grp1_pad_mux),
  1712. .pad_mux_list = gn_trg_spi_grp1_pad_mux,
  1713. };
  1714. static struct atlas7_pad_mux cvbs_dbg_grp_pad_mux[] = {
  1715. MUX(1, 54, 3, N, N, N, N),
  1716. MUX(1, 53, 3, N, N, N, N),
  1717. MUX(1, 82, 7, N, N, N, N),
  1718. MUX(1, 74, 7, N, N, N, N),
  1719. MUX(1, 75, 7, N, N, N, N),
  1720. MUX(1, 76, 7, N, N, N, N),
  1721. MUX(1, 77, 7, N, N, N, N),
  1722. MUX(1, 78, 7, N, N, N, N),
  1723. MUX(1, 79, 7, N, N, N, N),
  1724. MUX(1, 80, 7, N, N, N, N),
  1725. MUX(1, 81, 7, N, N, N, N),
  1726. MUX(1, 83, 7, N, N, N, N),
  1727. MUX(1, 84, 7, N, N, N, N),
  1728. MUX(1, 73, 3, N, N, N, N),
  1729. MUX(1, 55, 3, N, N, N, N),
  1730. MUX(1, 56, 3, N, N, N, N),
  1731. };
  1732. static struct atlas7_grp_mux cvbs_dbg_grp_mux = {
  1733. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_grp_pad_mux),
  1734. .pad_mux_list = cvbs_dbg_grp_pad_mux,
  1735. };
  1736. static struct atlas7_pad_mux cvbs_dbg_test_grp0_pad_mux[] = {
  1737. MUX(1, 57, 3, N, N, N, N),
  1738. };
  1739. static struct atlas7_grp_mux cvbs_dbg_test_grp0_mux = {
  1740. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp0_pad_mux),
  1741. .pad_mux_list = cvbs_dbg_test_grp0_pad_mux,
  1742. };
  1743. static struct atlas7_pad_mux cvbs_dbg_test_grp1_pad_mux[] = {
  1744. MUX(1, 58, 3, N, N, N, N),
  1745. };
  1746. static struct atlas7_grp_mux cvbs_dbg_test_grp1_mux = {
  1747. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp1_pad_mux),
  1748. .pad_mux_list = cvbs_dbg_test_grp1_pad_mux,
  1749. };
  1750. static struct atlas7_pad_mux cvbs_dbg_test_grp2_pad_mux[] = {
  1751. MUX(1, 59, 3, N, N, N, N),
  1752. };
  1753. static struct atlas7_grp_mux cvbs_dbg_test_grp2_mux = {
  1754. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp2_pad_mux),
  1755. .pad_mux_list = cvbs_dbg_test_grp2_pad_mux,
  1756. };
  1757. static struct atlas7_pad_mux cvbs_dbg_test_grp3_pad_mux[] = {
  1758. MUX(1, 60, 3, N, N, N, N),
  1759. };
  1760. static struct atlas7_grp_mux cvbs_dbg_test_grp3_mux = {
  1761. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp3_pad_mux),
  1762. .pad_mux_list = cvbs_dbg_test_grp3_pad_mux,
  1763. };
  1764. static struct atlas7_pad_mux cvbs_dbg_test_grp4_pad_mux[] = {
  1765. MUX(1, 61, 3, N, N, N, N),
  1766. };
  1767. static struct atlas7_grp_mux cvbs_dbg_test_grp4_mux = {
  1768. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp4_pad_mux),
  1769. .pad_mux_list = cvbs_dbg_test_grp4_pad_mux,
  1770. };
  1771. static struct atlas7_pad_mux cvbs_dbg_test_grp5_pad_mux[] = {
  1772. MUX(1, 62, 3, N, N, N, N),
  1773. };
  1774. static struct atlas7_grp_mux cvbs_dbg_test_grp5_mux = {
  1775. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp5_pad_mux),
  1776. .pad_mux_list = cvbs_dbg_test_grp5_pad_mux,
  1777. };
  1778. static struct atlas7_pad_mux cvbs_dbg_test_grp6_pad_mux[] = {
  1779. MUX(1, 63, 3, N, N, N, N),
  1780. };
  1781. static struct atlas7_grp_mux cvbs_dbg_test_grp6_mux = {
  1782. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp6_pad_mux),
  1783. .pad_mux_list = cvbs_dbg_test_grp6_pad_mux,
  1784. };
  1785. static struct atlas7_pad_mux cvbs_dbg_test_grp7_pad_mux[] = {
  1786. MUX(1, 64, 3, N, N, N, N),
  1787. };
  1788. static struct atlas7_grp_mux cvbs_dbg_test_grp7_mux = {
  1789. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp7_pad_mux),
  1790. .pad_mux_list = cvbs_dbg_test_grp7_pad_mux,
  1791. };
  1792. static struct atlas7_pad_mux cvbs_dbg_test_grp8_pad_mux[] = {
  1793. MUX(1, 65, 3, N, N, N, N),
  1794. };
  1795. static struct atlas7_grp_mux cvbs_dbg_test_grp8_mux = {
  1796. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp8_pad_mux),
  1797. .pad_mux_list = cvbs_dbg_test_grp8_pad_mux,
  1798. };
  1799. static struct atlas7_pad_mux cvbs_dbg_test_grp9_pad_mux[] = {
  1800. MUX(1, 66, 3, N, N, N, N),
  1801. };
  1802. static struct atlas7_grp_mux cvbs_dbg_test_grp9_mux = {
  1803. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp9_pad_mux),
  1804. .pad_mux_list = cvbs_dbg_test_grp9_pad_mux,
  1805. };
  1806. static struct atlas7_pad_mux cvbs_dbg_test_grp10_pad_mux[] = {
  1807. MUX(1, 67, 3, N, N, N, N),
  1808. };
  1809. static struct atlas7_grp_mux cvbs_dbg_test_grp10_mux = {
  1810. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp10_pad_mux),
  1811. .pad_mux_list = cvbs_dbg_test_grp10_pad_mux,
  1812. };
  1813. static struct atlas7_pad_mux cvbs_dbg_test_grp11_pad_mux[] = {
  1814. MUX(1, 68, 3, N, N, N, N),
  1815. };
  1816. static struct atlas7_grp_mux cvbs_dbg_test_grp11_mux = {
  1817. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp11_pad_mux),
  1818. .pad_mux_list = cvbs_dbg_test_grp11_pad_mux,
  1819. };
  1820. static struct atlas7_pad_mux cvbs_dbg_test_grp12_pad_mux[] = {
  1821. MUX(1, 69, 3, N, N, N, N),
  1822. };
  1823. static struct atlas7_grp_mux cvbs_dbg_test_grp12_mux = {
  1824. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp12_pad_mux),
  1825. .pad_mux_list = cvbs_dbg_test_grp12_pad_mux,
  1826. };
  1827. static struct atlas7_pad_mux cvbs_dbg_test_grp13_pad_mux[] = {
  1828. MUX(1, 70, 3, N, N, N, N),
  1829. };
  1830. static struct atlas7_grp_mux cvbs_dbg_test_grp13_mux = {
  1831. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp13_pad_mux),
  1832. .pad_mux_list = cvbs_dbg_test_grp13_pad_mux,
  1833. };
  1834. static struct atlas7_pad_mux cvbs_dbg_test_grp14_pad_mux[] = {
  1835. MUX(1, 71, 3, N, N, N, N),
  1836. };
  1837. static struct atlas7_grp_mux cvbs_dbg_test_grp14_mux = {
  1838. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp14_pad_mux),
  1839. .pad_mux_list = cvbs_dbg_test_grp14_pad_mux,
  1840. };
  1841. static struct atlas7_pad_mux cvbs_dbg_test_grp15_pad_mux[] = {
  1842. MUX(1, 72, 3, N, N, N, N),
  1843. };
  1844. static struct atlas7_grp_mux cvbs_dbg_test_grp15_mux = {
  1845. .pad_mux_count = ARRAY_SIZE(cvbs_dbg_test_grp15_pad_mux),
  1846. .pad_mux_list = cvbs_dbg_test_grp15_pad_mux,
  1847. };
  1848. static struct atlas7_pad_mux gn_gnss_power_grp_pad_mux[] = {
  1849. MUX(1, 123, 7, N, N, N, N),
  1850. MUX(1, 124, 7, N, N, N, N),
  1851. MUX(1, 121, 7, N, N, N, N),
  1852. MUX(1, 122, 7, N, N, N, N),
  1853. MUX(1, 125, 7, N, N, N, N),
  1854. MUX(1, 120, 7, N, N, N, N),
  1855. };
  1856. static struct atlas7_grp_mux gn_gnss_power_grp_mux = {
  1857. .pad_mux_count = ARRAY_SIZE(gn_gnss_power_grp_pad_mux),
  1858. .pad_mux_list = gn_gnss_power_grp_pad_mux,
  1859. };
  1860. static struct atlas7_pad_mux gn_gnss_sw_status_grp_pad_mux[] = {
  1861. MUX(1, 57, 7, N, N, N, N),
  1862. MUX(1, 58, 7, N, N, N, N),
  1863. MUX(1, 59, 7, N, N, N, N),
  1864. MUX(1, 60, 7, N, N, N, N),
  1865. MUX(1, 61, 7, N, N, N, N),
  1866. MUX(1, 62, 7, N, N, N, N),
  1867. MUX(1, 63, 7, N, N, N, N),
  1868. MUX(1, 64, 7, N, N, N, N),
  1869. MUX(1, 65, 7, N, N, N, N),
  1870. MUX(1, 66, 7, N, N, N, N),
  1871. MUX(1, 67, 7, N, N, N, N),
  1872. MUX(1, 68, 7, N, N, N, N),
  1873. MUX(1, 69, 7, N, N, N, N),
  1874. MUX(1, 70, 7, N, N, N, N),
  1875. MUX(1, 71, 7, N, N, N, N),
  1876. MUX(1, 72, 7, N, N, N, N),
  1877. MUX(1, 53, 7, N, N, N, N),
  1878. MUX(1, 55, 7, N, N, N, N),
  1879. MUX(1, 56, 7, 0xa08, 12, 0xa88, 12),
  1880. MUX(1, 54, 7, N, N, N, N),
  1881. };
  1882. static struct atlas7_grp_mux gn_gnss_sw_status_grp_mux = {
  1883. .pad_mux_count = ARRAY_SIZE(gn_gnss_sw_status_grp_pad_mux),
  1884. .pad_mux_list = gn_gnss_sw_status_grp_pad_mux,
  1885. };
  1886. static struct atlas7_pad_mux gn_gnss_eclk_grp_pad_mux[] = {
  1887. MUX(1, 113, 4, N, N, N, N),
  1888. };
  1889. static struct atlas7_grp_mux gn_gnss_eclk_grp_mux = {
  1890. .pad_mux_count = ARRAY_SIZE(gn_gnss_eclk_grp_pad_mux),
  1891. .pad_mux_list = gn_gnss_eclk_grp_pad_mux,
  1892. };
  1893. static struct atlas7_pad_mux gn_gnss_irq1_grp0_pad_mux[] = {
  1894. MUX(1, 112, 4, 0xa08, 10, 0xa88, 10),
  1895. };
  1896. static struct atlas7_grp_mux gn_gnss_irq1_grp0_mux = {
  1897. .pad_mux_count = ARRAY_SIZE(gn_gnss_irq1_grp0_pad_mux),
  1898. .pad_mux_list = gn_gnss_irq1_grp0_pad_mux,
  1899. };
  1900. static struct atlas7_pad_mux gn_gnss_irq2_grp0_pad_mux[] = {
  1901. MUX(1, 118, 4, 0xa08, 11, 0xa88, 11),
  1902. };
  1903. static struct atlas7_grp_mux gn_gnss_irq2_grp0_mux = {
  1904. .pad_mux_count = ARRAY_SIZE(gn_gnss_irq2_grp0_pad_mux),
  1905. .pad_mux_list = gn_gnss_irq2_grp0_pad_mux,
  1906. };
  1907. static struct atlas7_pad_mux gn_gnss_tm_grp_pad_mux[] = {
  1908. MUX(1, 115, 4, N, N, N, N),
  1909. };
  1910. static struct atlas7_grp_mux gn_gnss_tm_grp_mux = {
  1911. .pad_mux_count = ARRAY_SIZE(gn_gnss_tm_grp_pad_mux),
  1912. .pad_mux_list = gn_gnss_tm_grp_pad_mux,
  1913. };
  1914. static struct atlas7_pad_mux gn_gnss_tsync_grp_pad_mux[] = {
  1915. MUX(1, 114, 4, N, N, N, N),
  1916. };
  1917. static struct atlas7_grp_mux gn_gnss_tsync_grp_mux = {
  1918. .pad_mux_count = ARRAY_SIZE(gn_gnss_tsync_grp_pad_mux),
  1919. .pad_mux_list = gn_gnss_tsync_grp_pad_mux,
  1920. };
  1921. static struct atlas7_pad_mux gn_io_gnsssys_sw_cfg_grp_pad_mux[] = {
  1922. MUX(1, 44, 7, N, N, N, N),
  1923. MUX(1, 43, 7, N, N, N, N),
  1924. MUX(1, 42, 7, N, N, N, N),
  1925. MUX(1, 41, 7, N, N, N, N),
  1926. MUX(1, 40, 7, N, N, N, N),
  1927. MUX(1, 39, 7, N, N, N, N),
  1928. MUX(1, 38, 7, N, N, N, N),
  1929. MUX(1, 37, 7, N, N, N, N),
  1930. MUX(1, 49, 7, N, N, N, N),
  1931. MUX(1, 50, 7, N, N, N, N),
  1932. MUX(1, 91, 7, N, N, N, N),
  1933. MUX(1, 92, 7, N, N, N, N),
  1934. MUX(1, 93, 7, N, N, N, N),
  1935. MUX(1, 94, 7, N, N, N, N),
  1936. MUX(1, 95, 7, N, N, N, N),
  1937. MUX(1, 96, 7, N, N, N, N),
  1938. };
  1939. static struct atlas7_grp_mux gn_io_gnsssys_sw_cfg_grp_mux = {
  1940. .pad_mux_count = ARRAY_SIZE(gn_io_gnsssys_sw_cfg_grp_pad_mux),
  1941. .pad_mux_list = gn_io_gnsssys_sw_cfg_grp_pad_mux,
  1942. };
  1943. static struct atlas7_pad_mux gn_trg_grp0_pad_mux[] = {
  1944. MUX(1, 29, 1, 0xa00, 6, 0xa80, 6),
  1945. MUX(1, 28, 1, 0xa00, 7, 0xa80, 7),
  1946. MUX(1, 26, 1, 0xa00, 8, 0xa80, 8),
  1947. MUX(1, 27, 1, 0xa00, 9, 0xa80, 9),
  1948. };
  1949. static struct atlas7_grp_mux gn_trg_grp0_mux = {
  1950. .pad_mux_count = ARRAY_SIZE(gn_trg_grp0_pad_mux),
  1951. .pad_mux_list = gn_trg_grp0_pad_mux,
  1952. };
  1953. static struct atlas7_pad_mux gn_trg_grp1_pad_mux[] = {
  1954. MUX(1, 77, 3, 0xa00, 6, 0xa80, 6),
  1955. MUX(1, 76, 3, 0xa00, 7, 0xa80, 7),
  1956. MUX(1, 74, 3, 0xa00, 8, 0xa80, 8),
  1957. MUX(1, 75, 3, 0xa00, 9, 0xa80, 9),
  1958. };
  1959. static struct atlas7_grp_mux gn_trg_grp1_mux = {
  1960. .pad_mux_count = ARRAY_SIZE(gn_trg_grp1_pad_mux),
  1961. .pad_mux_list = gn_trg_grp1_pad_mux,
  1962. };
  1963. static struct atlas7_pad_mux gn_trg_shutdown_grp0_pad_mux[] = {
  1964. MUX(1, 30, 1, N, N, N, N),
  1965. };
  1966. static struct atlas7_grp_mux gn_trg_shutdown_grp0_mux = {
  1967. .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp0_pad_mux),
  1968. .pad_mux_list = gn_trg_shutdown_grp0_pad_mux,
  1969. };
  1970. static struct atlas7_pad_mux gn_trg_shutdown_grp1_pad_mux[] = {
  1971. MUX(1, 83, 3, N, N, N, N),
  1972. };
  1973. static struct atlas7_grp_mux gn_trg_shutdown_grp1_mux = {
  1974. .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp1_pad_mux),
  1975. .pad_mux_list = gn_trg_shutdown_grp1_pad_mux,
  1976. };
  1977. static struct atlas7_pad_mux gn_trg_shutdown_grp2_pad_mux[] = {
  1978. MUX(1, 117, 4, N, N, N, N),
  1979. };
  1980. static struct atlas7_grp_mux gn_trg_shutdown_grp2_mux = {
  1981. .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp2_pad_mux),
  1982. .pad_mux_list = gn_trg_shutdown_grp2_pad_mux,
  1983. };
  1984. static struct atlas7_pad_mux gn_trg_shutdown_grp3_pad_mux[] = {
  1985. MUX(1, 123, 5, N, N, N, N),
  1986. };
  1987. static struct atlas7_grp_mux gn_trg_shutdown_grp3_mux = {
  1988. .pad_mux_count = ARRAY_SIZE(gn_trg_shutdown_grp3_pad_mux),
  1989. .pad_mux_list = gn_trg_shutdown_grp3_pad_mux,
  1990. };
  1991. static struct atlas7_pad_mux i2c0_grp_pad_mux[] = {
  1992. MUX(1, 128, 1, N, N, N, N),
  1993. MUX(1, 127, 1, N, N, N, N),
  1994. };
  1995. static struct atlas7_grp_mux i2c0_grp_mux = {
  1996. .pad_mux_count = ARRAY_SIZE(i2c0_grp_pad_mux),
  1997. .pad_mux_list = i2c0_grp_pad_mux,
  1998. };
  1999. static struct atlas7_pad_mux i2c1_grp_pad_mux[] = {
  2000. MUX(1, 126, 4, N, N, N, N),
  2001. MUX(1, 125, 4, N, N, N, N),
  2002. };
  2003. static struct atlas7_grp_mux i2c1_grp_mux = {
  2004. .pad_mux_count = ARRAY_SIZE(i2c1_grp_pad_mux),
  2005. .pad_mux_list = i2c1_grp_pad_mux,
  2006. };
  2007. static struct atlas7_pad_mux jtag_grp0_pad_mux[] = {
  2008. MUX(1, 125, 5, 0xa08, 2, 0xa88, 2),
  2009. MUX(0, 4, 3, 0xa08, 3, 0xa88, 3),
  2010. MUX(0, 2, 3, N, N, N, N),
  2011. MUX(0, 0, 3, N, N, N, N),
  2012. MUX(0, 1, 3, N, N, N, N),
  2013. MUX(0, 3, 3, N, N, N, N),
  2014. };
  2015. static struct atlas7_grp_mux jtag_grp0_mux = {
  2016. .pad_mux_count = ARRAY_SIZE(jtag_grp0_pad_mux),
  2017. .pad_mux_list = jtag_grp0_pad_mux,
  2018. };
  2019. static struct atlas7_pad_mux ks_kas_spi_grp0_pad_mux[] = {
  2020. MUX(1, 141, 2, N, N, N, N),
  2021. MUX(1, 144, 2, 0xa08, 8, 0xa88, 8),
  2022. MUX(1, 143, 2, N, N, N, N),
  2023. MUX(1, 142, 2, N, N, N, N),
  2024. };
  2025. static struct atlas7_grp_mux ks_kas_spi_grp0_mux = {
  2026. .pad_mux_count = ARRAY_SIZE(ks_kas_spi_grp0_pad_mux),
  2027. .pad_mux_list = ks_kas_spi_grp0_pad_mux,
  2028. };
  2029. static struct atlas7_pad_mux ld_ldd_grp_pad_mux[] = {
  2030. MUX(1, 57, 1, N, N, N, N),
  2031. MUX(1, 58, 1, N, N, N, N),
  2032. MUX(1, 59, 1, N, N, N, N),
  2033. MUX(1, 60, 1, N, N, N, N),
  2034. MUX(1, 61, 1, N, N, N, N),
  2035. MUX(1, 62, 1, N, N, N, N),
  2036. MUX(1, 63, 1, N, N, N, N),
  2037. MUX(1, 64, 1, N, N, N, N),
  2038. MUX(1, 65, 1, N, N, N, N),
  2039. MUX(1, 66, 1, N, N, N, N),
  2040. MUX(1, 67, 1, N, N, N, N),
  2041. MUX(1, 68, 1, N, N, N, N),
  2042. MUX(1, 69, 1, N, N, N, N),
  2043. MUX(1, 70, 1, N, N, N, N),
  2044. MUX(1, 71, 1, N, N, N, N),
  2045. MUX(1, 72, 1, N, N, N, N),
  2046. MUX(1, 74, 2, N, N, N, N),
  2047. MUX(1, 75, 2, N, N, N, N),
  2048. MUX(1, 76, 2, N, N, N, N),
  2049. MUX(1, 77, 2, N, N, N, N),
  2050. MUX(1, 78, 2, N, N, N, N),
  2051. MUX(1, 79, 2, N, N, N, N),
  2052. MUX(1, 80, 2, N, N, N, N),
  2053. MUX(1, 81, 2, N, N, N, N),
  2054. MUX(1, 56, 1, N, N, N, N),
  2055. MUX(1, 53, 1, N, N, N, N),
  2056. };
  2057. static struct atlas7_grp_mux ld_ldd_grp_mux = {
  2058. .pad_mux_count = ARRAY_SIZE(ld_ldd_grp_pad_mux),
  2059. .pad_mux_list = ld_ldd_grp_pad_mux,
  2060. };
  2061. static struct atlas7_pad_mux ld_ldd_16bit_grp_pad_mux[] = {
  2062. MUX(1, 57, 1, N, N, N, N),
  2063. MUX(1, 58, 1, N, N, N, N),
  2064. MUX(1, 59, 1, N, N, N, N),
  2065. MUX(1, 60, 1, N, N, N, N),
  2066. MUX(1, 61, 1, N, N, N, N),
  2067. MUX(1, 62, 1, N, N, N, N),
  2068. MUX(1, 63, 1, N, N, N, N),
  2069. MUX(1, 64, 1, N, N, N, N),
  2070. MUX(1, 65, 1, N, N, N, N),
  2071. MUX(1, 66, 1, N, N, N, N),
  2072. MUX(1, 67, 1, N, N, N, N),
  2073. MUX(1, 68, 1, N, N, N, N),
  2074. MUX(1, 69, 1, N, N, N, N),
  2075. MUX(1, 70, 1, N, N, N, N),
  2076. MUX(1, 71, 1, N, N, N, N),
  2077. MUX(1, 72, 1, N, N, N, N),
  2078. MUX(1, 56, 1, N, N, N, N),
  2079. MUX(1, 53, 1, N, N, N, N),
  2080. };
  2081. static struct atlas7_grp_mux ld_ldd_16bit_grp_mux = {
  2082. .pad_mux_count = ARRAY_SIZE(ld_ldd_16bit_grp_pad_mux),
  2083. .pad_mux_list = ld_ldd_16bit_grp_pad_mux,
  2084. };
  2085. static struct atlas7_pad_mux ld_ldd_fck_grp_pad_mux[] = {
  2086. MUX(1, 55, 1, N, N, N, N),
  2087. };
  2088. static struct atlas7_grp_mux ld_ldd_fck_grp_mux = {
  2089. .pad_mux_count = ARRAY_SIZE(ld_ldd_fck_grp_pad_mux),
  2090. .pad_mux_list = ld_ldd_fck_grp_pad_mux,
  2091. };
  2092. static struct atlas7_pad_mux ld_ldd_lck_grp_pad_mux[] = {
  2093. MUX(1, 54, 1, N, N, N, N),
  2094. };
  2095. static struct atlas7_grp_mux ld_ldd_lck_grp_mux = {
  2096. .pad_mux_count = ARRAY_SIZE(ld_ldd_lck_grp_pad_mux),
  2097. .pad_mux_list = ld_ldd_lck_grp_pad_mux,
  2098. };
  2099. static struct atlas7_pad_mux lr_lcdrom_grp_pad_mux[] = {
  2100. MUX(1, 73, 2, N, N, N, N),
  2101. MUX(1, 54, 2, N, N, N, N),
  2102. MUX(1, 57, 2, N, N, N, N),
  2103. MUX(1, 58, 2, N, N, N, N),
  2104. MUX(1, 59, 2, N, N, N, N),
  2105. MUX(1, 60, 2, N, N, N, N),
  2106. MUX(1, 61, 2, N, N, N, N),
  2107. MUX(1, 62, 2, N, N, N, N),
  2108. MUX(1, 63, 2, N, N, N, N),
  2109. MUX(1, 64, 2, N, N, N, N),
  2110. MUX(1, 65, 2, N, N, N, N),
  2111. MUX(1, 66, 2, N, N, N, N),
  2112. MUX(1, 67, 2, N, N, N, N),
  2113. MUX(1, 68, 2, N, N, N, N),
  2114. MUX(1, 69, 2, N, N, N, N),
  2115. MUX(1, 70, 2, N, N, N, N),
  2116. MUX(1, 71, 2, N, N, N, N),
  2117. MUX(1, 72, 2, N, N, N, N),
  2118. MUX(1, 56, 2, N, N, N, N),
  2119. MUX(1, 53, 2, N, N, N, N),
  2120. MUX(1, 55, 2, N, N, N, N),
  2121. };
  2122. static struct atlas7_grp_mux lr_lcdrom_grp_mux = {
  2123. .pad_mux_count = ARRAY_SIZE(lr_lcdrom_grp_pad_mux),
  2124. .pad_mux_list = lr_lcdrom_grp_pad_mux,
  2125. };
  2126. static struct atlas7_pad_mux lvds_analog_grp_pad_mux[] = {
  2127. MUX(1, 149, 8, N, N, N, N),
  2128. MUX(1, 150, 8, N, N, N, N),
  2129. MUX(1, 151, 8, N, N, N, N),
  2130. MUX(1, 152, 8, N, N, N, N),
  2131. MUX(1, 153, 8, N, N, N, N),
  2132. MUX(1, 154, 8, N, N, N, N),
  2133. MUX(1, 155, 8, N, N, N, N),
  2134. MUX(1, 156, 8, N, N, N, N),
  2135. MUX(1, 157, 8, N, N, N, N),
  2136. MUX(1, 158, 8, N, N, N, N),
  2137. };
  2138. static struct atlas7_grp_mux lvds_analog_grp_mux = {
  2139. .pad_mux_count = ARRAY_SIZE(lvds_analog_grp_pad_mux),
  2140. .pad_mux_list = lvds_analog_grp_pad_mux,
  2141. };
  2142. static struct atlas7_pad_mux nd_df_grp_pad_mux[] = {
  2143. MUX(1, 44, 1, N, N, N, N),
  2144. MUX(1, 43, 1, N, N, N, N),
  2145. MUX(1, 42, 1, N, N, N, N),
  2146. MUX(1, 41, 1, N, N, N, N),
  2147. MUX(1, 40, 1, N, N, N, N),
  2148. MUX(1, 39, 1, N, N, N, N),
  2149. MUX(1, 38, 1, N, N, N, N),
  2150. MUX(1, 37, 1, N, N, N, N),
  2151. MUX(1, 47, 1, N, N, N, N),
  2152. MUX(1, 46, 1, N, N, N, N),
  2153. MUX(1, 52, 1, N, N, N, N),
  2154. MUX(1, 51, 1, N, N, N, N),
  2155. MUX(1, 45, 1, N, N, N, N),
  2156. MUX(1, 49, 1, N, N, N, N),
  2157. MUX(1, 50, 1, N, N, N, N),
  2158. MUX(1, 48, 1, N, N, N, N),
  2159. MUX(1, 124, 4, N, N, N, N),
  2160. };
  2161. static struct atlas7_grp_mux nd_df_grp_mux = {
  2162. .pad_mux_count = ARRAY_SIZE(nd_df_grp_pad_mux),
  2163. .pad_mux_list = nd_df_grp_pad_mux,
  2164. };
  2165. static struct atlas7_pad_mux nd_df_nowp_grp_pad_mux[] = {
  2166. MUX(1, 44, 1, N, N, N, N),
  2167. MUX(1, 43, 1, N, N, N, N),
  2168. MUX(1, 42, 1, N, N, N, N),
  2169. MUX(1, 41, 1, N, N, N, N),
  2170. MUX(1, 40, 1, N, N, N, N),
  2171. MUX(1, 39, 1, N, N, N, N),
  2172. MUX(1, 38, 1, N, N, N, N),
  2173. MUX(1, 37, 1, N, N, N, N),
  2174. MUX(1, 47, 1, N, N, N, N),
  2175. MUX(1, 46, 1, N, N, N, N),
  2176. MUX(1, 52, 1, N, N, N, N),
  2177. MUX(1, 51, 1, N, N, N, N),
  2178. MUX(1, 45, 1, N, N, N, N),
  2179. MUX(1, 49, 1, N, N, N, N),
  2180. MUX(1, 50, 1, N, N, N, N),
  2181. MUX(1, 48, 1, N, N, N, N),
  2182. };
  2183. static struct atlas7_grp_mux nd_df_nowp_grp_mux = {
  2184. .pad_mux_count = ARRAY_SIZE(nd_df_nowp_grp_pad_mux),
  2185. .pad_mux_list = nd_df_nowp_grp_pad_mux,
  2186. };
  2187. static struct atlas7_pad_mux ps_grp_pad_mux[] = {
  2188. MUX(1, 120, 2, N, N, N, N),
  2189. MUX(1, 119, 2, N, N, N, N),
  2190. };
  2191. static struct atlas7_grp_mux ps_grp_mux = {
  2192. .pad_mux_count = ARRAY_SIZE(ps_grp_pad_mux),
  2193. .pad_mux_list = ps_grp_pad_mux,
  2194. };
  2195. static struct atlas7_pad_mux pwc_core_on_grp_pad_mux[] = {
  2196. MUX(0, 8, 1, N, N, N, N),
  2197. };
  2198. static struct atlas7_grp_mux pwc_core_on_grp_mux = {
  2199. .pad_mux_count = ARRAY_SIZE(pwc_core_on_grp_pad_mux),
  2200. .pad_mux_list = pwc_core_on_grp_pad_mux,
  2201. };
  2202. static struct atlas7_pad_mux pwc_ext_on_grp_pad_mux[] = {
  2203. MUX(0, 6, 1, N, N, N, N),
  2204. };
  2205. static struct atlas7_grp_mux pwc_ext_on_grp_mux = {
  2206. .pad_mux_count = ARRAY_SIZE(pwc_ext_on_grp_pad_mux),
  2207. .pad_mux_list = pwc_ext_on_grp_pad_mux,
  2208. };
  2209. static struct atlas7_pad_mux pwc_gpio3_clk_grp_pad_mux[] = {
  2210. MUX(0, 3, 4, N, N, N, N),
  2211. };
  2212. static struct atlas7_grp_mux pwc_gpio3_clk_grp_mux = {
  2213. .pad_mux_count = ARRAY_SIZE(pwc_gpio3_clk_grp_pad_mux),
  2214. .pad_mux_list = pwc_gpio3_clk_grp_pad_mux,
  2215. };
  2216. static struct atlas7_pad_mux pwc_io_on_grp_pad_mux[] = {
  2217. MUX(0, 9, 1, N, N, N, N),
  2218. };
  2219. static struct atlas7_grp_mux pwc_io_on_grp_mux = {
  2220. .pad_mux_count = ARRAY_SIZE(pwc_io_on_grp_pad_mux),
  2221. .pad_mux_list = pwc_io_on_grp_pad_mux,
  2222. };
  2223. static struct atlas7_pad_mux pwc_lowbatt_b_grp0_pad_mux[] = {
  2224. MUX(0, 4, 1, 0xa08, 4, 0xa88, 4),
  2225. };
  2226. static struct atlas7_grp_mux pwc_lowbatt_b_grp0_mux = {
  2227. .pad_mux_count = ARRAY_SIZE(pwc_lowbatt_b_grp0_pad_mux),
  2228. .pad_mux_list = pwc_lowbatt_b_grp0_pad_mux,
  2229. };
  2230. static struct atlas7_pad_mux pwc_mem_on_grp_pad_mux[] = {
  2231. MUX(0, 7, 1, N, N, N, N),
  2232. };
  2233. static struct atlas7_grp_mux pwc_mem_on_grp_mux = {
  2234. .pad_mux_count = ARRAY_SIZE(pwc_mem_on_grp_pad_mux),
  2235. .pad_mux_list = pwc_mem_on_grp_pad_mux,
  2236. };
  2237. static struct atlas7_pad_mux pwc_on_key_b_grp0_pad_mux[] = {
  2238. MUX(0, 5, 1, 0xa08, 5, 0xa88, 5),
  2239. };
  2240. static struct atlas7_grp_mux pwc_on_key_b_grp0_mux = {
  2241. .pad_mux_count = ARRAY_SIZE(pwc_on_key_b_grp0_pad_mux),
  2242. .pad_mux_list = pwc_on_key_b_grp0_pad_mux,
  2243. };
  2244. static struct atlas7_pad_mux pwc_wakeup_src0_grp_pad_mux[] = {
  2245. MUX(0, 0, 1, N, N, N, N),
  2246. };
  2247. static struct atlas7_grp_mux pwc_wakeup_src0_grp_mux = {
  2248. .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src0_grp_pad_mux),
  2249. .pad_mux_list = pwc_wakeup_src0_grp_pad_mux,
  2250. };
  2251. static struct atlas7_pad_mux pwc_wakeup_src1_grp_pad_mux[] = {
  2252. MUX(0, 1, 1, N, N, N, N),
  2253. };
  2254. static struct atlas7_grp_mux pwc_wakeup_src1_grp_mux = {
  2255. .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src1_grp_pad_mux),
  2256. .pad_mux_list = pwc_wakeup_src1_grp_pad_mux,
  2257. };
  2258. static struct atlas7_pad_mux pwc_wakeup_src2_grp_pad_mux[] = {
  2259. MUX(0, 2, 1, N, N, N, N),
  2260. };
  2261. static struct atlas7_grp_mux pwc_wakeup_src2_grp_mux = {
  2262. .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src2_grp_pad_mux),
  2263. .pad_mux_list = pwc_wakeup_src2_grp_pad_mux,
  2264. };
  2265. static struct atlas7_pad_mux pwc_wakeup_src3_grp_pad_mux[] = {
  2266. MUX(0, 3, 1, N, N, N, N),
  2267. };
  2268. static struct atlas7_grp_mux pwc_wakeup_src3_grp_mux = {
  2269. .pad_mux_count = ARRAY_SIZE(pwc_wakeup_src3_grp_pad_mux),
  2270. .pad_mux_list = pwc_wakeup_src3_grp_pad_mux,
  2271. };
  2272. static struct atlas7_pad_mux pw_cko0_grp0_pad_mux[] = {
  2273. MUX(1, 123, 3, N, N, N, N),
  2274. };
  2275. static struct atlas7_grp_mux pw_cko0_grp0_mux = {
  2276. .pad_mux_count = ARRAY_SIZE(pw_cko0_grp0_pad_mux),
  2277. .pad_mux_list = pw_cko0_grp0_pad_mux,
  2278. };
  2279. static struct atlas7_pad_mux pw_cko0_grp1_pad_mux[] = {
  2280. MUX(1, 101, 4, N, N, N, N),
  2281. };
  2282. static struct atlas7_grp_mux pw_cko0_grp1_mux = {
  2283. .pad_mux_count = ARRAY_SIZE(pw_cko0_grp1_pad_mux),
  2284. .pad_mux_list = pw_cko0_grp1_pad_mux,
  2285. };
  2286. static struct atlas7_pad_mux pw_cko0_grp2_pad_mux[] = {
  2287. MUX(1, 82, 2, N, N, N, N),
  2288. };
  2289. static struct atlas7_grp_mux pw_cko0_grp2_mux = {
  2290. .pad_mux_count = ARRAY_SIZE(pw_cko0_grp2_pad_mux),
  2291. .pad_mux_list = pw_cko0_grp2_pad_mux,
  2292. };
  2293. static struct atlas7_pad_mux pw_cko1_grp0_pad_mux[] = {
  2294. MUX(1, 124, 3, N, N, N, N),
  2295. };
  2296. static struct atlas7_grp_mux pw_cko1_grp0_mux = {
  2297. .pad_mux_count = ARRAY_SIZE(pw_cko1_grp0_pad_mux),
  2298. .pad_mux_list = pw_cko1_grp0_pad_mux,
  2299. };
  2300. static struct atlas7_pad_mux pw_cko1_grp1_pad_mux[] = {
  2301. MUX(1, 110, 4, N, N, N, N),
  2302. };
  2303. static struct atlas7_grp_mux pw_cko1_grp1_mux = {
  2304. .pad_mux_count = ARRAY_SIZE(pw_cko1_grp1_pad_mux),
  2305. .pad_mux_list = pw_cko1_grp1_pad_mux,
  2306. };
  2307. static struct atlas7_pad_mux pw_i2s01_clk_grp0_pad_mux[] = {
  2308. MUX(1, 125, 3, N, N, N, N),
  2309. };
  2310. static struct atlas7_grp_mux pw_i2s01_clk_grp0_mux = {
  2311. .pad_mux_count = ARRAY_SIZE(pw_i2s01_clk_grp0_pad_mux),
  2312. .pad_mux_list = pw_i2s01_clk_grp0_pad_mux,
  2313. };
  2314. static struct atlas7_pad_mux pw_i2s01_clk_grp1_pad_mux[] = {
  2315. MUX(1, 117, 3, N, N, N, N),
  2316. };
  2317. static struct atlas7_grp_mux pw_i2s01_clk_grp1_mux = {
  2318. .pad_mux_count = ARRAY_SIZE(pw_i2s01_clk_grp1_pad_mux),
  2319. .pad_mux_list = pw_i2s01_clk_grp1_pad_mux,
  2320. };
  2321. static struct atlas7_pad_mux pw_pwm0_grp_pad_mux[] = {
  2322. MUX(1, 119, 3, N, N, N, N),
  2323. };
  2324. static struct atlas7_grp_mux pw_pwm0_grp_mux = {
  2325. .pad_mux_count = ARRAY_SIZE(pw_pwm0_grp_pad_mux),
  2326. .pad_mux_list = pw_pwm0_grp_pad_mux,
  2327. };
  2328. static struct atlas7_pad_mux pw_pwm1_grp_pad_mux[] = {
  2329. MUX(1, 120, 3, N, N, N, N),
  2330. };
  2331. static struct atlas7_grp_mux pw_pwm1_grp_mux = {
  2332. .pad_mux_count = ARRAY_SIZE(pw_pwm1_grp_pad_mux),
  2333. .pad_mux_list = pw_pwm1_grp_pad_mux,
  2334. };
  2335. static struct atlas7_pad_mux pw_pwm2_grp0_pad_mux[] = {
  2336. MUX(1, 121, 3, N, N, N, N),
  2337. };
  2338. static struct atlas7_grp_mux pw_pwm2_grp0_mux = {
  2339. .pad_mux_count = ARRAY_SIZE(pw_pwm2_grp0_pad_mux),
  2340. .pad_mux_list = pw_pwm2_grp0_pad_mux,
  2341. };
  2342. static struct atlas7_pad_mux pw_pwm2_grp1_pad_mux[] = {
  2343. MUX(1, 98, 3, N, N, N, N),
  2344. };
  2345. static struct atlas7_grp_mux pw_pwm2_grp1_mux = {
  2346. .pad_mux_count = ARRAY_SIZE(pw_pwm2_grp1_pad_mux),
  2347. .pad_mux_list = pw_pwm2_grp1_pad_mux,
  2348. };
  2349. static struct atlas7_pad_mux pw_pwm3_grp0_pad_mux[] = {
  2350. MUX(1, 122, 3, N, N, N, N),
  2351. };
  2352. static struct atlas7_grp_mux pw_pwm3_grp0_mux = {
  2353. .pad_mux_count = ARRAY_SIZE(pw_pwm3_grp0_pad_mux),
  2354. .pad_mux_list = pw_pwm3_grp0_pad_mux,
  2355. };
  2356. static struct atlas7_pad_mux pw_pwm3_grp1_pad_mux[] = {
  2357. MUX(1, 73, 4, N, N, N, N),
  2358. };
  2359. static struct atlas7_grp_mux pw_pwm3_grp1_mux = {
  2360. .pad_mux_count = ARRAY_SIZE(pw_pwm3_grp1_pad_mux),
  2361. .pad_mux_list = pw_pwm3_grp1_pad_mux,
  2362. };
  2363. static struct atlas7_pad_mux pw_pwm_cpu_vol_grp0_pad_mux[] = {
  2364. MUX(1, 121, 3, N, N, N, N),
  2365. };
  2366. static struct atlas7_grp_mux pw_pwm_cpu_vol_grp0_mux = {
  2367. .pad_mux_count = ARRAY_SIZE(pw_pwm_cpu_vol_grp0_pad_mux),
  2368. .pad_mux_list = pw_pwm_cpu_vol_grp0_pad_mux,
  2369. };
  2370. static struct atlas7_pad_mux pw_pwm_cpu_vol_grp1_pad_mux[] = {
  2371. MUX(1, 98, 3, N, N, N, N),
  2372. };
  2373. static struct atlas7_grp_mux pw_pwm_cpu_vol_grp1_mux = {
  2374. .pad_mux_count = ARRAY_SIZE(pw_pwm_cpu_vol_grp1_pad_mux),
  2375. .pad_mux_list = pw_pwm_cpu_vol_grp1_pad_mux,
  2376. };
  2377. static struct atlas7_pad_mux pw_backlight_grp0_pad_mux[] = {
  2378. MUX(1, 122, 3, N, N, N, N),
  2379. };
  2380. static struct atlas7_grp_mux pw_backlight_grp0_mux = {
  2381. .pad_mux_count = ARRAY_SIZE(pw_backlight_grp0_pad_mux),
  2382. .pad_mux_list = pw_backlight_grp0_pad_mux,
  2383. };
  2384. static struct atlas7_pad_mux pw_backlight_grp1_pad_mux[] = {
  2385. MUX(1, 73, 4, N, N, N, N),
  2386. };
  2387. static struct atlas7_grp_mux pw_backlight_grp1_mux = {
  2388. .pad_mux_count = ARRAY_SIZE(pw_backlight_grp1_pad_mux),
  2389. .pad_mux_list = pw_backlight_grp1_pad_mux,
  2390. };
  2391. static struct atlas7_pad_mux rg_eth_mac_grp_pad_mux[] = {
  2392. MUX(1, 108, 1, N, N, N, N),
  2393. MUX(1, 103, 1, N, N, N, N),
  2394. MUX(1, 104, 1, N, N, N, N),
  2395. MUX(1, 105, 1, N, N, N, N),
  2396. MUX(1, 106, 1, N, N, N, N),
  2397. MUX(1, 107, 1, N, N, N, N),
  2398. MUX(1, 102, 1, N, N, N, N),
  2399. MUX(1, 97, 1, N, N, N, N),
  2400. MUX(1, 98, 1, N, N, N, N),
  2401. MUX(1, 99, 1, N, N, N, N),
  2402. MUX(1, 100, 1, N, N, N, N),
  2403. MUX(1, 101, 1, N, N, N, N),
  2404. };
  2405. static struct atlas7_grp_mux rg_eth_mac_grp_mux = {
  2406. .pad_mux_count = ARRAY_SIZE(rg_eth_mac_grp_pad_mux),
  2407. .pad_mux_list = rg_eth_mac_grp_pad_mux,
  2408. };
  2409. static struct atlas7_pad_mux rg_gmac_phy_intr_n_grp_pad_mux[] = {
  2410. MUX(1, 111, 1, 0xa08, 13, 0xa88, 13),
  2411. };
  2412. static struct atlas7_grp_mux rg_gmac_phy_intr_n_grp_mux = {
  2413. .pad_mux_count = ARRAY_SIZE(rg_gmac_phy_intr_n_grp_pad_mux),
  2414. .pad_mux_list = rg_gmac_phy_intr_n_grp_pad_mux,
  2415. };
  2416. static struct atlas7_pad_mux rg_rgmii_mac_grp_pad_mux[] = {
  2417. MUX(1, 109, 1, N, N, N, N),
  2418. MUX(1, 110, 1, N, N, N, N),
  2419. };
  2420. static struct atlas7_grp_mux rg_rgmii_mac_grp_mux = {
  2421. .pad_mux_count = ARRAY_SIZE(rg_rgmii_mac_grp_pad_mux),
  2422. .pad_mux_list = rg_rgmii_mac_grp_pad_mux,
  2423. };
  2424. static struct atlas7_pad_mux rg_rgmii_phy_ref_clk_grp0_pad_mux[] = {
  2425. MUX(1, 111, 5, N, N, N, N),
  2426. };
  2427. static struct atlas7_grp_mux rg_rgmii_phy_ref_clk_grp0_mux = {
  2428. .pad_mux_count = ARRAY_SIZE(rg_rgmii_phy_ref_clk_grp0_pad_mux),
  2429. .pad_mux_list = rg_rgmii_phy_ref_clk_grp0_pad_mux,
  2430. };
  2431. static struct atlas7_pad_mux rg_rgmii_phy_ref_clk_grp1_pad_mux[] = {
  2432. MUX(1, 53, 4, N, N, N, N),
  2433. };
  2434. static struct atlas7_grp_mux rg_rgmii_phy_ref_clk_grp1_mux = {
  2435. .pad_mux_count = ARRAY_SIZE(rg_rgmii_phy_ref_clk_grp1_pad_mux),
  2436. .pad_mux_list = rg_rgmii_phy_ref_clk_grp1_pad_mux,
  2437. };
  2438. static struct atlas7_pad_mux sd0_grp_pad_mux[] = {
  2439. MUX(1, 46, 2, N, N, N, N),
  2440. MUX(1, 47, 2, N, N, N, N),
  2441. MUX(1, 44, 2, N, N, N, N),
  2442. MUX(1, 43, 2, N, N, N, N),
  2443. MUX(1, 42, 2, N, N, N, N),
  2444. MUX(1, 41, 2, N, N, N, N),
  2445. MUX(1, 40, 2, N, N, N, N),
  2446. MUX(1, 39, 2, N, N, N, N),
  2447. MUX(1, 38, 2, N, N, N, N),
  2448. MUX(1, 37, 2, N, N, N, N),
  2449. };
  2450. static struct atlas7_grp_mux sd0_grp_mux = {
  2451. .pad_mux_count = ARRAY_SIZE(sd0_grp_pad_mux),
  2452. .pad_mux_list = sd0_grp_pad_mux,
  2453. };
  2454. static struct atlas7_pad_mux sd0_4bit_grp_pad_mux[] = {
  2455. MUX(1, 46, 2, N, N, N, N),
  2456. MUX(1, 47, 2, N, N, N, N),
  2457. MUX(1, 44, 2, N, N, N, N),
  2458. MUX(1, 43, 2, N, N, N, N),
  2459. MUX(1, 42, 2, N, N, N, N),
  2460. MUX(1, 41, 2, N, N, N, N),
  2461. };
  2462. static struct atlas7_grp_mux sd0_4bit_grp_mux = {
  2463. .pad_mux_count = ARRAY_SIZE(sd0_4bit_grp_pad_mux),
  2464. .pad_mux_list = sd0_4bit_grp_pad_mux,
  2465. };
  2466. static struct atlas7_pad_mux sd1_grp_pad_mux[] = {
  2467. MUX(1, 48, 3, N, N, N, N),
  2468. MUX(1, 49, 3, N, N, N, N),
  2469. MUX(1, 44, 3, 0xa00, 0, 0xa80, 0),
  2470. MUX(1, 43, 3, 0xa00, 1, 0xa80, 1),
  2471. MUX(1, 42, 3, 0xa00, 2, 0xa80, 2),
  2472. MUX(1, 41, 3, 0xa00, 3, 0xa80, 3),
  2473. MUX(1, 40, 3, N, N, N, N),
  2474. MUX(1, 39, 3, N, N, N, N),
  2475. MUX(1, 38, 3, N, N, N, N),
  2476. MUX(1, 37, 3, N, N, N, N),
  2477. };
  2478. static struct atlas7_grp_mux sd1_grp_mux = {
  2479. .pad_mux_count = ARRAY_SIZE(sd1_grp_pad_mux),
  2480. .pad_mux_list = sd1_grp_pad_mux,
  2481. };
  2482. static struct atlas7_pad_mux sd1_4bit_grp0_pad_mux[] = {
  2483. MUX(1, 48, 3, N, N, N, N),
  2484. MUX(1, 49, 3, N, N, N, N),
  2485. MUX(1, 44, 3, 0xa00, 0, 0xa80, 0),
  2486. MUX(1, 43, 3, 0xa00, 1, 0xa80, 1),
  2487. MUX(1, 42, 3, 0xa00, 2, 0xa80, 2),
  2488. MUX(1, 41, 3, 0xa00, 3, 0xa80, 3),
  2489. };
  2490. static struct atlas7_grp_mux sd1_4bit_grp0_mux = {
  2491. .pad_mux_count = ARRAY_SIZE(sd1_4bit_grp0_pad_mux),
  2492. .pad_mux_list = sd1_4bit_grp0_pad_mux,
  2493. };
  2494. static struct atlas7_pad_mux sd1_4bit_grp1_pad_mux[] = {
  2495. MUX(1, 48, 3, N, N, N, N),
  2496. MUX(1, 49, 3, N, N, N, N),
  2497. MUX(1, 40, 4, 0xa00, 0, 0xa80, 0),
  2498. MUX(1, 39, 4, 0xa00, 1, 0xa80, 1),
  2499. MUX(1, 38, 4, 0xa00, 2, 0xa80, 2),
  2500. MUX(1, 37, 4, 0xa00, 3, 0xa80, 3),
  2501. };
  2502. static struct atlas7_grp_mux sd1_4bit_grp1_mux = {
  2503. .pad_mux_count = ARRAY_SIZE(sd1_4bit_grp1_pad_mux),
  2504. .pad_mux_list = sd1_4bit_grp1_pad_mux,
  2505. };
  2506. static struct atlas7_pad_mux sd2_grp0_pad_mux[] = {
  2507. MUX(1, 124, 2, 0xa08, 7, 0xa88, 7),
  2508. MUX(1, 31, 1, N, N, N, N),
  2509. MUX(1, 32, 1, N, N, N, N),
  2510. MUX(1, 33, 1, N, N, N, N),
  2511. MUX(1, 34, 1, N, N, N, N),
  2512. MUX(1, 35, 1, N, N, N, N),
  2513. MUX(1, 36, 1, N, N, N, N),
  2514. MUX(1, 123, 2, N, N, N, N),
  2515. };
  2516. static struct atlas7_grp_mux sd2_grp0_mux = {
  2517. .pad_mux_count = ARRAY_SIZE(sd2_grp0_pad_mux),
  2518. .pad_mux_list = sd2_grp0_pad_mux,
  2519. };
  2520. static struct atlas7_pad_mux sd2_no_cdb_grp0_pad_mux[] = {
  2521. MUX(1, 31, 1, N, N, N, N),
  2522. MUX(1, 32, 1, N, N, N, N),
  2523. MUX(1, 33, 1, N, N, N, N),
  2524. MUX(1, 34, 1, N, N, N, N),
  2525. MUX(1, 35, 1, N, N, N, N),
  2526. MUX(1, 36, 1, N, N, N, N),
  2527. MUX(1, 123, 2, N, N, N, N),
  2528. };
  2529. static struct atlas7_grp_mux sd2_no_cdb_grp0_mux = {
  2530. .pad_mux_count = ARRAY_SIZE(sd2_no_cdb_grp0_pad_mux),
  2531. .pad_mux_list = sd2_no_cdb_grp0_pad_mux,
  2532. };
  2533. static struct atlas7_pad_mux sd3_grp_pad_mux[] = {
  2534. MUX(1, 85, 1, N, N, N, N),
  2535. MUX(1, 86, 1, N, N, N, N),
  2536. MUX(1, 87, 1, N, N, N, N),
  2537. MUX(1, 88, 1, N, N, N, N),
  2538. MUX(1, 89, 1, N, N, N, N),
  2539. MUX(1, 90, 1, N, N, N, N),
  2540. };
  2541. static struct atlas7_grp_mux sd3_grp_mux = {
  2542. .pad_mux_count = ARRAY_SIZE(sd3_grp_pad_mux),
  2543. .pad_mux_list = sd3_grp_pad_mux,
  2544. };
  2545. static struct atlas7_pad_mux sd5_grp_pad_mux[] = {
  2546. MUX(1, 91, 1, N, N, N, N),
  2547. MUX(1, 92, 1, N, N, N, N),
  2548. MUX(1, 93, 1, N, N, N, N),
  2549. MUX(1, 94, 1, N, N, N, N),
  2550. MUX(1, 95, 1, N, N, N, N),
  2551. MUX(1, 96, 1, N, N, N, N),
  2552. };
  2553. static struct atlas7_grp_mux sd5_grp_mux = {
  2554. .pad_mux_count = ARRAY_SIZE(sd5_grp_pad_mux),
  2555. .pad_mux_list = sd5_grp_pad_mux,
  2556. };
  2557. static struct atlas7_pad_mux sd6_grp0_pad_mux[] = {
  2558. MUX(1, 79, 4, 0xa00, 27, 0xa80, 27),
  2559. MUX(1, 78, 4, 0xa00, 26, 0xa80, 26),
  2560. MUX(1, 74, 4, 0xa00, 28, 0xa80, 28),
  2561. MUX(1, 75, 4, 0xa00, 29, 0xa80, 29),
  2562. MUX(1, 76, 4, 0xa00, 30, 0xa80, 30),
  2563. MUX(1, 77, 4, 0xa00, 31, 0xa80, 31),
  2564. };
  2565. static struct atlas7_grp_mux sd6_grp0_mux = {
  2566. .pad_mux_count = ARRAY_SIZE(sd6_grp0_pad_mux),
  2567. .pad_mux_list = sd6_grp0_pad_mux,
  2568. };
  2569. static struct atlas7_pad_mux sd6_grp1_pad_mux[] = {
  2570. MUX(1, 101, 3, 0xa00, 27, 0xa80, 27),
  2571. MUX(1, 99, 3, 0xa00, 26, 0xa80, 26),
  2572. MUX(1, 100, 3, 0xa00, 28, 0xa80, 28),
  2573. MUX(1, 110, 3, 0xa00, 29, 0xa80, 29),
  2574. MUX(1, 109, 3, 0xa00, 30, 0xa80, 30),
  2575. MUX(1, 111, 3, 0xa00, 31, 0xa80, 31),
  2576. };
  2577. static struct atlas7_grp_mux sd6_grp1_mux = {
  2578. .pad_mux_count = ARRAY_SIZE(sd6_grp1_pad_mux),
  2579. .pad_mux_list = sd6_grp1_pad_mux,
  2580. };
  2581. static struct atlas7_pad_mux sp0_ext_ldo_on_grp_pad_mux[] = {
  2582. MUX(0, 4, 2, N, N, N, N),
  2583. };
  2584. static struct atlas7_grp_mux sp0_ext_ldo_on_grp_mux = {
  2585. .pad_mux_count = ARRAY_SIZE(sp0_ext_ldo_on_grp_pad_mux),
  2586. .pad_mux_list = sp0_ext_ldo_on_grp_pad_mux,
  2587. };
  2588. static struct atlas7_pad_mux sp0_qspi_grp_pad_mux[] = {
  2589. MUX(0, 12, 1, N, N, N, N),
  2590. MUX(0, 13, 1, N, N, N, N),
  2591. MUX(0, 14, 1, N, N, N, N),
  2592. MUX(0, 15, 1, N, N, N, N),
  2593. MUX(0, 16, 1, N, N, N, N),
  2594. MUX(0, 17, 1, N, N, N, N),
  2595. };
  2596. static struct atlas7_grp_mux sp0_qspi_grp_mux = {
  2597. .pad_mux_count = ARRAY_SIZE(sp0_qspi_grp_pad_mux),
  2598. .pad_mux_list = sp0_qspi_grp_pad_mux,
  2599. };
  2600. static struct atlas7_pad_mux sp1_spi_grp_pad_mux[] = {
  2601. MUX(1, 19, 1, N, N, N, N),
  2602. MUX(1, 20, 1, N, N, N, N),
  2603. MUX(1, 21, 1, N, N, N, N),
  2604. MUX(1, 18, 1, N, N, N, N),
  2605. };
  2606. static struct atlas7_grp_mux sp1_spi_grp_mux = {
  2607. .pad_mux_count = ARRAY_SIZE(sp1_spi_grp_pad_mux),
  2608. .pad_mux_list = sp1_spi_grp_pad_mux,
  2609. };
  2610. static struct atlas7_pad_mux tpiu_trace_grp_pad_mux[] = {
  2611. MUX(1, 53, 5, N, N, N, N),
  2612. MUX(1, 56, 5, N, N, N, N),
  2613. MUX(1, 57, 5, N, N, N, N),
  2614. MUX(1, 58, 5, N, N, N, N),
  2615. MUX(1, 59, 5, N, N, N, N),
  2616. MUX(1, 60, 5, N, N, N, N),
  2617. MUX(1, 61, 5, N, N, N, N),
  2618. MUX(1, 62, 5, N, N, N, N),
  2619. MUX(1, 63, 5, N, N, N, N),
  2620. MUX(1, 64, 5, N, N, N, N),
  2621. MUX(1, 65, 5, N, N, N, N),
  2622. MUX(1, 66, 5, N, N, N, N),
  2623. MUX(1, 67, 5, N, N, N, N),
  2624. MUX(1, 68, 5, N, N, N, N),
  2625. MUX(1, 69, 5, N, N, N, N),
  2626. MUX(1, 70, 5, N, N, N, N),
  2627. MUX(1, 71, 5, N, N, N, N),
  2628. MUX(1, 72, 5, N, N, N, N),
  2629. };
  2630. static struct atlas7_grp_mux tpiu_trace_grp_mux = {
  2631. .pad_mux_count = ARRAY_SIZE(tpiu_trace_grp_pad_mux),
  2632. .pad_mux_list = tpiu_trace_grp_pad_mux,
  2633. };
  2634. static struct atlas7_pad_mux uart0_grp_pad_mux[] = {
  2635. MUX(1, 121, 4, N, N, N, N),
  2636. MUX(1, 120, 4, N, N, N, N),
  2637. MUX(1, 134, 1, N, N, N, N),
  2638. MUX(1, 133, 1, N, N, N, N),
  2639. };
  2640. static struct atlas7_grp_mux uart0_grp_mux = {
  2641. .pad_mux_count = ARRAY_SIZE(uart0_grp_pad_mux),
  2642. .pad_mux_list = uart0_grp_pad_mux,
  2643. };
  2644. static struct atlas7_pad_mux uart0_nopause_grp_pad_mux[] = {
  2645. MUX(1, 134, 1, N, N, N, N),
  2646. MUX(1, 133, 1, N, N, N, N),
  2647. };
  2648. static struct atlas7_grp_mux uart0_nopause_grp_mux = {
  2649. .pad_mux_count = ARRAY_SIZE(uart0_nopause_grp_pad_mux),
  2650. .pad_mux_list = uart0_nopause_grp_pad_mux,
  2651. };
  2652. static struct atlas7_pad_mux uart1_grp_pad_mux[] = {
  2653. MUX(1, 136, 1, N, N, N, N),
  2654. MUX(1, 135, 1, N, N, N, N),
  2655. };
  2656. static struct atlas7_grp_mux uart1_grp_mux = {
  2657. .pad_mux_count = ARRAY_SIZE(uart1_grp_pad_mux),
  2658. .pad_mux_list = uart1_grp_pad_mux,
  2659. };
  2660. static struct atlas7_pad_mux uart2_grp_pad_mux[] = {
  2661. MUX(0, 11, 2, N, N, N, N),
  2662. MUX(0, 10, 2, N, N, N, N),
  2663. };
  2664. static struct atlas7_grp_mux uart2_grp_mux = {
  2665. .pad_mux_count = ARRAY_SIZE(uart2_grp_pad_mux),
  2666. .pad_mux_list = uart2_grp_pad_mux,
  2667. };
  2668. static struct atlas7_pad_mux uart3_grp0_pad_mux[] = {
  2669. MUX(1, 125, 2, 0xa08, 0, 0xa88, 0),
  2670. MUX(1, 126, 2, N, N, N, N),
  2671. MUX(1, 138, 1, 0xa00, 5, 0xa80, 5),
  2672. MUX(1, 137, 1, N, N, N, N),
  2673. };
  2674. static struct atlas7_grp_mux uart3_grp0_mux = {
  2675. .pad_mux_count = ARRAY_SIZE(uart3_grp0_pad_mux),
  2676. .pad_mux_list = uart3_grp0_pad_mux,
  2677. };
  2678. static struct atlas7_pad_mux uart3_grp1_pad_mux[] = {
  2679. MUX(1, 111, 4, 0xa08, 0, 0xa88, 0),
  2680. MUX(1, 109, 4, N, N, N, N),
  2681. MUX(1, 84, 2, 0xa00, 5, 0xa80, 5),
  2682. MUX(1, 83, 2, N, N, N, N),
  2683. };
  2684. static struct atlas7_grp_mux uart3_grp1_mux = {
  2685. .pad_mux_count = ARRAY_SIZE(uart3_grp1_pad_mux),
  2686. .pad_mux_list = uart3_grp1_pad_mux,
  2687. };
  2688. static struct atlas7_pad_mux uart3_grp2_pad_mux[] = {
  2689. MUX(1, 140, 2, 0xa08, 0, 0xa88, 0),
  2690. MUX(1, 139, 2, N, N, N, N),
  2691. MUX(1, 138, 1, 0xa00, 5, 0xa80, 5),
  2692. MUX(1, 137, 1, N, N, N, N),
  2693. };
  2694. static struct atlas7_grp_mux uart3_grp2_mux = {
  2695. .pad_mux_count = ARRAY_SIZE(uart3_grp2_pad_mux),
  2696. .pad_mux_list = uart3_grp2_pad_mux,
  2697. };
  2698. static struct atlas7_pad_mux uart3_grp3_pad_mux[] = {
  2699. MUX(1, 139, 2, N, N, N, N),
  2700. MUX(1, 140, 2, 0xa08, 0, 0xa88, 0),
  2701. MUX(1, 84, 2, 0xa00, 5, 0xa80, 5),
  2702. MUX(1, 83, 2, N, N, N, N),
  2703. };
  2704. static struct atlas7_grp_mux uart3_grp3_mux = {
  2705. .pad_mux_count = ARRAY_SIZE(uart3_grp3_pad_mux),
  2706. .pad_mux_list = uart3_grp3_pad_mux,
  2707. };
  2708. static struct atlas7_pad_mux uart3_nopause_grp0_pad_mux[] = {
  2709. MUX(1, 138, 1, 0xa00, 5, 0xa80, 5),
  2710. MUX(1, 137, 1, N, N, N, N),
  2711. };
  2712. static struct atlas7_grp_mux uart3_nopause_grp0_mux = {
  2713. .pad_mux_count = ARRAY_SIZE(uart3_nopause_grp0_pad_mux),
  2714. .pad_mux_list = uart3_nopause_grp0_pad_mux,
  2715. };
  2716. static struct atlas7_pad_mux uart3_nopause_grp1_pad_mux[] = {
  2717. MUX(1, 84, 2, 0xa00, 5, 0xa80, 5),
  2718. MUX(1, 83, 2, N, N, N, N),
  2719. };
  2720. static struct atlas7_grp_mux uart3_nopause_grp1_mux = {
  2721. .pad_mux_count = ARRAY_SIZE(uart3_nopause_grp1_pad_mux),
  2722. .pad_mux_list = uart3_nopause_grp1_pad_mux,
  2723. };
  2724. static struct atlas7_pad_mux uart4_grp0_pad_mux[] = {
  2725. MUX(1, 122, 4, 0xa08, 1, 0xa88, 1),
  2726. MUX(1, 123, 4, N, N, N, N),
  2727. MUX(1, 140, 1, N, N, N, N),
  2728. MUX(1, 139, 1, N, N, N, N),
  2729. };
  2730. static struct atlas7_grp_mux uart4_grp0_mux = {
  2731. .pad_mux_count = ARRAY_SIZE(uart4_grp0_pad_mux),
  2732. .pad_mux_list = uart4_grp0_pad_mux,
  2733. };
  2734. static struct atlas7_pad_mux uart4_grp1_pad_mux[] = {
  2735. MUX(1, 100, 4, 0xa08, 1, 0xa88, 1),
  2736. MUX(1, 99, 4, N, N, N, N),
  2737. MUX(1, 140, 1, N, N, N, N),
  2738. MUX(1, 139, 1, N, N, N, N),
  2739. };
  2740. static struct atlas7_grp_mux uart4_grp1_mux = {
  2741. .pad_mux_count = ARRAY_SIZE(uart4_grp1_pad_mux),
  2742. .pad_mux_list = uart4_grp1_pad_mux,
  2743. };
  2744. static struct atlas7_pad_mux uart4_grp2_pad_mux[] = {
  2745. MUX(1, 117, 2, 0xa08, 1, 0xa88, 1),
  2746. MUX(1, 116, 2, N, N, N, N),
  2747. MUX(1, 140, 1, N, N, N, N),
  2748. MUX(1, 139, 1, N, N, N, N),
  2749. };
  2750. static struct atlas7_grp_mux uart4_grp2_mux = {
  2751. .pad_mux_count = ARRAY_SIZE(uart4_grp2_pad_mux),
  2752. .pad_mux_list = uart4_grp2_pad_mux,
  2753. };
  2754. static struct atlas7_pad_mux uart4_nopause_grp_pad_mux[] = {
  2755. MUX(1, 140, 1, N, N, N, N),
  2756. MUX(1, 139, 1, N, N, N, N),
  2757. };
  2758. static struct atlas7_grp_mux uart4_nopause_grp_mux = {
  2759. .pad_mux_count = ARRAY_SIZE(uart4_nopause_grp_pad_mux),
  2760. .pad_mux_list = uart4_nopause_grp_pad_mux,
  2761. };
  2762. static struct atlas7_pad_mux usb0_drvvbus_grp_pad_mux[] = {
  2763. MUX(1, 51, 2, N, N, N, N),
  2764. };
  2765. static struct atlas7_grp_mux usb0_drvvbus_grp_mux = {
  2766. .pad_mux_count = ARRAY_SIZE(usb0_drvvbus_grp_pad_mux),
  2767. .pad_mux_list = usb0_drvvbus_grp_pad_mux,
  2768. };
  2769. static struct atlas7_pad_mux usb1_drvvbus_grp_pad_mux[] = {
  2770. MUX(1, 134, 2, N, N, N, N),
  2771. };
  2772. static struct atlas7_grp_mux usb1_drvvbus_grp_mux = {
  2773. .pad_mux_count = ARRAY_SIZE(usb1_drvvbus_grp_pad_mux),
  2774. .pad_mux_list = usb1_drvvbus_grp_pad_mux,
  2775. };
  2776. static struct atlas7_pad_mux visbus_dout_grp_pad_mux[] = {
  2777. MUX(1, 57, 6, N, N, N, N),
  2778. MUX(1, 58, 6, N, N, N, N),
  2779. MUX(1, 59, 6, N, N, N, N),
  2780. MUX(1, 60, 6, N, N, N, N),
  2781. MUX(1, 61, 6, N, N, N, N),
  2782. MUX(1, 62, 6, N, N, N, N),
  2783. MUX(1, 63, 6, N, N, N, N),
  2784. MUX(1, 64, 6, N, N, N, N),
  2785. MUX(1, 65, 6, N, N, N, N),
  2786. MUX(1, 66, 6, N, N, N, N),
  2787. MUX(1, 67, 6, N, N, N, N),
  2788. MUX(1, 68, 6, N, N, N, N),
  2789. MUX(1, 69, 6, N, N, N, N),
  2790. MUX(1, 70, 6, N, N, N, N),
  2791. MUX(1, 71, 6, N, N, N, N),
  2792. MUX(1, 72, 6, N, N, N, N),
  2793. MUX(1, 53, 6, N, N, N, N),
  2794. MUX(1, 54, 6, N, N, N, N),
  2795. MUX(1, 55, 6, N, N, N, N),
  2796. MUX(1, 56, 6, N, N, N, N),
  2797. MUX(1, 85, 6, N, N, N, N),
  2798. MUX(1, 86, 6, N, N, N, N),
  2799. MUX(1, 87, 6, N, N, N, N),
  2800. MUX(1, 88, 6, N, N, N, N),
  2801. MUX(1, 89, 6, N, N, N, N),
  2802. MUX(1, 90, 6, N, N, N, N),
  2803. MUX(1, 91, 6, N, N, N, N),
  2804. MUX(1, 92, 6, N, N, N, N),
  2805. MUX(1, 93, 6, N, N, N, N),
  2806. MUX(1, 94, 6, N, N, N, N),
  2807. MUX(1, 95, 6, N, N, N, N),
  2808. MUX(1, 96, 6, N, N, N, N),
  2809. };
  2810. static struct atlas7_grp_mux visbus_dout_grp_mux = {
  2811. .pad_mux_count = ARRAY_SIZE(visbus_dout_grp_pad_mux),
  2812. .pad_mux_list = visbus_dout_grp_pad_mux,
  2813. };
  2814. static struct atlas7_pad_mux vi_vip1_grp_pad_mux[] = {
  2815. MUX(1, 74, 1, N, N, N, N),
  2816. MUX(1, 75, 1, N, N, N, N),
  2817. MUX(1, 76, 1, N, N, N, N),
  2818. MUX(1, 77, 1, N, N, N, N),
  2819. MUX(1, 78, 1, N, N, N, N),
  2820. MUX(1, 79, 1, N, N, N, N),
  2821. MUX(1, 80, 1, N, N, N, N),
  2822. MUX(1, 81, 1, N, N, N, N),
  2823. MUX(1, 82, 1, N, N, N, N),
  2824. MUX(1, 83, 1, N, N, N, N),
  2825. MUX(1, 84, 1, N, N, N, N),
  2826. MUX(1, 103, 2, N, N, N, N),
  2827. MUX(1, 104, 2, N, N, N, N),
  2828. MUX(1, 105, 2, N, N, N, N),
  2829. MUX(1, 106, 2, N, N, N, N),
  2830. MUX(1, 107, 2, N, N, N, N),
  2831. MUX(1, 102, 2, N, N, N, N),
  2832. MUX(1, 97, 2, N, N, N, N),
  2833. MUX(1, 98, 2, N, N, N, N),
  2834. };
  2835. static struct atlas7_grp_mux vi_vip1_grp_mux = {
  2836. .pad_mux_count = ARRAY_SIZE(vi_vip1_grp_pad_mux),
  2837. .pad_mux_list = vi_vip1_grp_pad_mux,
  2838. };
  2839. static struct atlas7_pad_mux vi_vip1_ext_grp_pad_mux[] = {
  2840. MUX(1, 74, 1, N, N, N, N),
  2841. MUX(1, 75, 1, N, N, N, N),
  2842. MUX(1, 76, 1, N, N, N, N),
  2843. MUX(1, 77, 1, N, N, N, N),
  2844. MUX(1, 78, 1, N, N, N, N),
  2845. MUX(1, 79, 1, N, N, N, N),
  2846. MUX(1, 80, 1, N, N, N, N),
  2847. MUX(1, 81, 1, N, N, N, N),
  2848. MUX(1, 82, 1, N, N, N, N),
  2849. MUX(1, 83, 1, N, N, N, N),
  2850. MUX(1, 84, 1, N, N, N, N),
  2851. MUX(1, 108, 2, N, N, N, N),
  2852. MUX(1, 103, 2, N, N, N, N),
  2853. MUX(1, 104, 2, N, N, N, N),
  2854. MUX(1, 105, 2, N, N, N, N),
  2855. MUX(1, 106, 2, N, N, N, N),
  2856. MUX(1, 107, 2, N, N, N, N),
  2857. MUX(1, 102, 2, N, N, N, N),
  2858. MUX(1, 97, 2, N, N, N, N),
  2859. MUX(1, 98, 2, N, N, N, N),
  2860. MUX(1, 99, 2, N, N, N, N),
  2861. MUX(1, 100, 2, N, N, N, N),
  2862. };
  2863. static struct atlas7_grp_mux vi_vip1_ext_grp_mux = {
  2864. .pad_mux_count = ARRAY_SIZE(vi_vip1_ext_grp_pad_mux),
  2865. .pad_mux_list = vi_vip1_ext_grp_pad_mux,
  2866. };
  2867. static struct atlas7_pad_mux vi_vip1_low8bit_grp_pad_mux[] = {
  2868. MUX(1, 74, 1, N, N, N, N),
  2869. MUX(1, 75, 1, N, N, N, N),
  2870. MUX(1, 76, 1, N, N, N, N),
  2871. MUX(1, 77, 1, N, N, N, N),
  2872. MUX(1, 78, 1, N, N, N, N),
  2873. MUX(1, 79, 1, N, N, N, N),
  2874. MUX(1, 80, 1, N, N, N, N),
  2875. MUX(1, 81, 1, N, N, N, N),
  2876. };
  2877. static struct atlas7_grp_mux vi_vip1_low8bit_grp_mux = {
  2878. .pad_mux_count = ARRAY_SIZE(vi_vip1_low8bit_grp_pad_mux),
  2879. .pad_mux_list = vi_vip1_low8bit_grp_pad_mux,
  2880. };
  2881. static struct atlas7_pad_mux vi_vip1_high8bit_grp_pad_mux[] = {
  2882. MUX(1, 82, 1, N, N, N, N),
  2883. MUX(1, 83, 1, N, N, N, N),
  2884. MUX(1, 84, 1, N, N, N, N),
  2885. MUX(1, 108, 2, N, N, N, N),
  2886. MUX(1, 103, 2, N, N, N, N),
  2887. MUX(1, 104, 2, N, N, N, N),
  2888. MUX(1, 105, 2, N, N, N, N),
  2889. MUX(1, 106, 2, N, N, N, N),
  2890. };
  2891. static struct atlas7_grp_mux vi_vip1_high8bit_grp_mux = {
  2892. .pad_mux_count = ARRAY_SIZE(vi_vip1_high8bit_grp_pad_mux),
  2893. .pad_mux_list = vi_vip1_high8bit_grp_pad_mux,
  2894. };
  2895. static struct atlas7_pmx_func atlas7_pmx_functions[] = {
  2896. FUNCTION("gnss_gpio", gnss_gpio_grp, &gnss_gpio_grp_mux),
  2897. FUNCTION("lcd_vip_gpio", lcd_vip_gpio_grp, &lcd_vip_gpio_grp_mux),
  2898. FUNCTION("sdio_i2s_gpio", sdio_i2s_gpio_grp, &sdio_i2s_gpio_grp_mux),
  2899. FUNCTION("sp_rgmii_gpio", sp_rgmii_gpio_grp, &sp_rgmii_gpio_grp_mux),
  2900. FUNCTION("lvds_gpio", lvds_gpio_grp, &lvds_gpio_grp_mux),
  2901. FUNCTION("uart_nand_gpio",
  2902. uart_nand_gpio_grp,
  2903. &uart_nand_gpio_grp_mux),
  2904. FUNCTION("rtc_gpio", rtc_gpio_grp, &rtc_gpio_grp_mux),
  2905. FUNCTION("audio_ac97", audio_ac97_grp, &audio_ac97_grp_mux),
  2906. FUNCTION("audio_func_dbg",
  2907. audio_func_dbg_grp,
  2908. &audio_func_dbg_grp_mux),
  2909. FUNCTION("audio_i2s", audio_i2s_grp, &audio_i2s_grp_mux),
  2910. FUNCTION("audio_i2s_2ch", audio_i2s_2ch_grp, &audio_i2s_2ch_grp_mux),
  2911. FUNCTION("audio_i2s_extclk",
  2912. audio_i2s_extclk_grp,
  2913. &audio_i2s_extclk_grp_mux),
  2914. FUNCTION("audio_uart0", audio_uart0_grp, &audio_uart0_grp_mux),
  2915. FUNCTION("audio_uart1", audio_uart1_grp, &audio_uart1_grp_mux),
  2916. FUNCTION("audio_uart2_m0", audio_uart2_grp0, &audio_uart2_grp0_mux),
  2917. FUNCTION("audio_uart2_m1", audio_uart2_grp1, &audio_uart2_grp1_mux),
  2918. FUNCTION("c_can_trnsvr", c_can_trnsvr_grp, &c_can_trnsvr_grp_mux),
  2919. FUNCTION("c0_can_m0", c0_can_grp0, &c0_can_grp0_mux),
  2920. FUNCTION("c0_can_m1", c0_can_grp1, &c0_can_grp1_mux),
  2921. FUNCTION("c1_can_m0", c1_can_grp0, &c1_can_grp0_mux),
  2922. FUNCTION("c1_can_m1", c1_can_grp1, &c1_can_grp1_mux),
  2923. FUNCTION("c1_can_m2", c1_can_grp2, &c1_can_grp2_mux),
  2924. FUNCTION("ca_audio_lpc", ca_audio_lpc_grp, &ca_audio_lpc_grp_mux),
  2925. FUNCTION("ca_bt_lpc", ca_bt_lpc_grp, &ca_bt_lpc_grp_mux),
  2926. FUNCTION("ca_coex", ca_coex_grp, &ca_coex_grp_mux),
  2927. FUNCTION("ca_curator_lpc",
  2928. ca_curator_lpc_grp,
  2929. &ca_curator_lpc_grp_mux),
  2930. FUNCTION("ca_pcm_debug", ca_pcm_debug_grp, &ca_pcm_debug_grp_mux),
  2931. FUNCTION("ca_pio", ca_pio_grp, &ca_pio_grp_mux),
  2932. FUNCTION("ca_sdio_debug", ca_sdio_debug_grp, &ca_sdio_debug_grp_mux),
  2933. FUNCTION("ca_spi", ca_spi_grp, &ca_spi_grp_mux),
  2934. FUNCTION("ca_trb", ca_trb_grp, &ca_trb_grp_mux),
  2935. FUNCTION("ca_uart_debug", ca_uart_debug_grp, &ca_uart_debug_grp_mux),
  2936. FUNCTION("clkc_m0", clkc_grp0, &clkc_grp0_mux),
  2937. FUNCTION("clkc_m1", clkc_grp1, &clkc_grp1_mux),
  2938. FUNCTION("gn_gnss_i2c", gn_gnss_i2c_grp, &gn_gnss_i2c_grp_mux),
  2939. FUNCTION("gn_gnss_uart_nopause",
  2940. gn_gnss_uart_nopause_grp,
  2941. &gn_gnss_uart_nopause_grp_mux),
  2942. FUNCTION("gn_gnss_uart", gn_gnss_uart_grp, &gn_gnss_uart_grp_mux),
  2943. FUNCTION("gn_trg_spi_m0", gn_trg_spi_grp0, &gn_trg_spi_grp0_mux),
  2944. FUNCTION("gn_trg_spi_m1", gn_trg_spi_grp1, &gn_trg_spi_grp1_mux),
  2945. FUNCTION("cvbs_dbg", cvbs_dbg_grp, &cvbs_dbg_grp_mux),
  2946. FUNCTION("cvbs_dbg_test_m0",
  2947. cvbs_dbg_test_grp0,
  2948. &cvbs_dbg_test_grp0_mux),
  2949. FUNCTION("cvbs_dbg_test_m1",
  2950. cvbs_dbg_test_grp1,
  2951. &cvbs_dbg_test_grp1_mux),
  2952. FUNCTION("cvbs_dbg_test_m2",
  2953. cvbs_dbg_test_grp2,
  2954. &cvbs_dbg_test_grp2_mux),
  2955. FUNCTION("cvbs_dbg_test_m3",
  2956. cvbs_dbg_test_grp3,
  2957. &cvbs_dbg_test_grp3_mux),
  2958. FUNCTION("cvbs_dbg_test_m4",
  2959. cvbs_dbg_test_grp4,
  2960. &cvbs_dbg_test_grp4_mux),
  2961. FUNCTION("cvbs_dbg_test_m5",
  2962. cvbs_dbg_test_grp5,
  2963. &cvbs_dbg_test_grp5_mux),
  2964. FUNCTION("cvbs_dbg_test_m6",
  2965. cvbs_dbg_test_grp6,
  2966. &cvbs_dbg_test_grp6_mux),
  2967. FUNCTION("cvbs_dbg_test_m7",
  2968. cvbs_dbg_test_grp7,
  2969. &cvbs_dbg_test_grp7_mux),
  2970. FUNCTION("cvbs_dbg_test_m8",
  2971. cvbs_dbg_test_grp8,
  2972. &cvbs_dbg_test_grp8_mux),
  2973. FUNCTION("cvbs_dbg_test_m9",
  2974. cvbs_dbg_test_grp9,
  2975. &cvbs_dbg_test_grp9_mux),
  2976. FUNCTION("cvbs_dbg_test_m10",
  2977. cvbs_dbg_test_grp10,
  2978. &cvbs_dbg_test_grp10_mux),
  2979. FUNCTION("cvbs_dbg_test_m11",
  2980. cvbs_dbg_test_grp11,
  2981. &cvbs_dbg_test_grp11_mux),
  2982. FUNCTION("cvbs_dbg_test_m12",
  2983. cvbs_dbg_test_grp12,
  2984. &cvbs_dbg_test_grp12_mux),
  2985. FUNCTION("cvbs_dbg_test_m13",
  2986. cvbs_dbg_test_grp13,
  2987. &cvbs_dbg_test_grp13_mux),
  2988. FUNCTION("cvbs_dbg_test_m14",
  2989. cvbs_dbg_test_grp14,
  2990. &cvbs_dbg_test_grp14_mux),
  2991. FUNCTION("cvbs_dbg_test_m15",
  2992. cvbs_dbg_test_grp15,
  2993. &cvbs_dbg_test_grp15_mux),
  2994. FUNCTION("gn_gnss_power", gn_gnss_power_grp, &gn_gnss_power_grp_mux),
  2995. FUNCTION("gn_gnss_sw_status",
  2996. gn_gnss_sw_status_grp,
  2997. &gn_gnss_sw_status_grp_mux),
  2998. FUNCTION("gn_gnss_eclk", gn_gnss_eclk_grp, &gn_gnss_eclk_grp_mux),
  2999. FUNCTION("gn_gnss_irq1_m0",
  3000. gn_gnss_irq1_grp0,
  3001. &gn_gnss_irq1_grp0_mux),
  3002. FUNCTION("gn_gnss_irq2_m0",
  3003. gn_gnss_irq2_grp0,
  3004. &gn_gnss_irq2_grp0_mux),
  3005. FUNCTION("gn_gnss_tm", gn_gnss_tm_grp, &gn_gnss_tm_grp_mux),
  3006. FUNCTION("gn_gnss_tsync", gn_gnss_tsync_grp, &gn_gnss_tsync_grp_mux),
  3007. FUNCTION("gn_io_gnsssys_sw_cfg",
  3008. gn_io_gnsssys_sw_cfg_grp,
  3009. &gn_io_gnsssys_sw_cfg_grp_mux),
  3010. FUNCTION("gn_trg_m0", gn_trg_grp0, &gn_trg_grp0_mux),
  3011. FUNCTION("gn_trg_m1", gn_trg_grp1, &gn_trg_grp1_mux),
  3012. FUNCTION("gn_trg_shutdown_m0",
  3013. gn_trg_shutdown_grp0,
  3014. &gn_trg_shutdown_grp0_mux),
  3015. FUNCTION("gn_trg_shutdown_m1",
  3016. gn_trg_shutdown_grp1,
  3017. &gn_trg_shutdown_grp1_mux),
  3018. FUNCTION("gn_trg_shutdown_m2",
  3019. gn_trg_shutdown_grp2,
  3020. &gn_trg_shutdown_grp2_mux),
  3021. FUNCTION("gn_trg_shutdown_m3",
  3022. gn_trg_shutdown_grp3,
  3023. &gn_trg_shutdown_grp3_mux),
  3024. FUNCTION("i2c0", i2c0_grp, &i2c0_grp_mux),
  3025. FUNCTION("i2c1", i2c1_grp, &i2c1_grp_mux),
  3026. FUNCTION("jtag_m0", jtag_grp0, &jtag_grp0_mux),
  3027. FUNCTION("ks_kas_spi_m0", ks_kas_spi_grp0, &ks_kas_spi_grp0_mux),
  3028. FUNCTION("ld_ldd", ld_ldd_grp, &ld_ldd_grp_mux),
  3029. FUNCTION("ld_ldd_16bit", ld_ldd_16bit_grp, &ld_ldd_16bit_grp_mux),
  3030. FUNCTION("ld_ldd_fck", ld_ldd_fck_grp, &ld_ldd_fck_grp_mux),
  3031. FUNCTION("ld_ldd_lck", ld_ldd_lck_grp, &ld_ldd_lck_grp_mux),
  3032. FUNCTION("lr_lcdrom", lr_lcdrom_grp, &lr_lcdrom_grp_mux),
  3033. FUNCTION("lvds_analog", lvds_analog_grp, &lvds_analog_grp_mux),
  3034. FUNCTION("nd_df", nd_df_grp, &nd_df_grp_mux),
  3035. FUNCTION("nd_df_nowp", nd_df_nowp_grp, &nd_df_nowp_grp_mux),
  3036. FUNCTION("ps", ps_grp, &ps_grp_mux),
  3037. FUNCTION("pwc_core_on", pwc_core_on_grp, &pwc_core_on_grp_mux),
  3038. FUNCTION("pwc_ext_on", pwc_ext_on_grp, &pwc_ext_on_grp_mux),
  3039. FUNCTION("pwc_gpio3_clk", pwc_gpio3_clk_grp, &pwc_gpio3_clk_grp_mux),
  3040. FUNCTION("pwc_io_on", pwc_io_on_grp, &pwc_io_on_grp_mux),
  3041. FUNCTION("pwc_lowbatt_b_m0",
  3042. pwc_lowbatt_b_grp0,
  3043. &pwc_lowbatt_b_grp0_mux),
  3044. FUNCTION("pwc_mem_on", pwc_mem_on_grp, &pwc_mem_on_grp_mux),
  3045. FUNCTION("pwc_on_key_b_m0",
  3046. pwc_on_key_b_grp0,
  3047. &pwc_on_key_b_grp0_mux),
  3048. FUNCTION("pwc_wakeup_src0",
  3049. pwc_wakeup_src0_grp,
  3050. &pwc_wakeup_src0_grp_mux),
  3051. FUNCTION("pwc_wakeup_src1",
  3052. pwc_wakeup_src1_grp,
  3053. &pwc_wakeup_src1_grp_mux),
  3054. FUNCTION("pwc_wakeup_src2",
  3055. pwc_wakeup_src2_grp,
  3056. &pwc_wakeup_src2_grp_mux),
  3057. FUNCTION("pwc_wakeup_src3",
  3058. pwc_wakeup_src3_grp,
  3059. &pwc_wakeup_src3_grp_mux),
  3060. FUNCTION("pw_cko0_m0", pw_cko0_grp0, &pw_cko0_grp0_mux),
  3061. FUNCTION("pw_cko0_m1", pw_cko0_grp1, &pw_cko0_grp1_mux),
  3062. FUNCTION("pw_cko0_m2", pw_cko0_grp2, &pw_cko0_grp2_mux),
  3063. FUNCTION("pw_cko1_m0", pw_cko1_grp0, &pw_cko1_grp0_mux),
  3064. FUNCTION("pw_cko1_m1", pw_cko1_grp1, &pw_cko1_grp1_mux),
  3065. FUNCTION("pw_i2s01_clk_m0",
  3066. pw_i2s01_clk_grp0,
  3067. &pw_i2s01_clk_grp0_mux),
  3068. FUNCTION("pw_i2s01_clk_m1",
  3069. pw_i2s01_clk_grp1,
  3070. &pw_i2s01_clk_grp1_mux),
  3071. FUNCTION("pw_pwm0", pw_pwm0_grp, &pw_pwm0_grp_mux),
  3072. FUNCTION("pw_pwm1", pw_pwm1_grp, &pw_pwm1_grp_mux),
  3073. FUNCTION("pw_pwm2_m0", pw_pwm2_grp0, &pw_pwm2_grp0_mux),
  3074. FUNCTION("pw_pwm2_m1", pw_pwm2_grp1, &pw_pwm2_grp1_mux),
  3075. FUNCTION("pw_pwm3_m0", pw_pwm3_grp0, &pw_pwm3_grp0_mux),
  3076. FUNCTION("pw_pwm3_m1", pw_pwm3_grp1, &pw_pwm3_grp1_mux),
  3077. FUNCTION("pw_pwm_cpu_vol_m0",
  3078. pw_pwm_cpu_vol_grp0,
  3079. &pw_pwm_cpu_vol_grp0_mux),
  3080. FUNCTION("pw_pwm_cpu_vol_m1",
  3081. pw_pwm_cpu_vol_grp1,
  3082. &pw_pwm_cpu_vol_grp1_mux),
  3083. FUNCTION("pw_backlight_m0",
  3084. pw_backlight_grp0,
  3085. &pw_backlight_grp0_mux),
  3086. FUNCTION("pw_backlight_m1",
  3087. pw_backlight_grp1,
  3088. &pw_backlight_grp1_mux),
  3089. FUNCTION("rg_eth_mac", rg_eth_mac_grp, &rg_eth_mac_grp_mux),
  3090. FUNCTION("rg_gmac_phy_intr_n",
  3091. rg_gmac_phy_intr_n_grp,
  3092. &rg_gmac_phy_intr_n_grp_mux),
  3093. FUNCTION("rg_rgmii_mac", rg_rgmii_mac_grp, &rg_rgmii_mac_grp_mux),
  3094. FUNCTION("rg_rgmii_phy_ref_clk_m0",
  3095. rg_rgmii_phy_ref_clk_grp0,
  3096. &rg_rgmii_phy_ref_clk_grp0_mux),
  3097. FUNCTION("rg_rgmii_phy_ref_clk_m1",
  3098. rg_rgmii_phy_ref_clk_grp1,
  3099. &rg_rgmii_phy_ref_clk_grp1_mux),
  3100. FUNCTION("sd0", sd0_grp, &sd0_grp_mux),
  3101. FUNCTION("sd0_4bit", sd0_4bit_grp, &sd0_4bit_grp_mux),
  3102. FUNCTION("sd1", sd1_grp, &sd1_grp_mux),
  3103. FUNCTION("sd1_4bit_m0", sd1_4bit_grp0, &sd1_4bit_grp0_mux),
  3104. FUNCTION("sd1_4bit_m1", sd1_4bit_grp1, &sd1_4bit_grp1_mux),
  3105. FUNCTION("sd2_m0", sd2_grp0, &sd2_grp0_mux),
  3106. FUNCTION("sd2_no_cdb_m0", sd2_no_cdb_grp0, &sd2_no_cdb_grp0_mux),
  3107. FUNCTION("sd3", sd3_grp, &sd3_grp_mux),
  3108. FUNCTION("sd5", sd5_grp, &sd5_grp_mux),
  3109. FUNCTION("sd6_m0", sd6_grp0, &sd6_grp0_mux),
  3110. FUNCTION("sd6_m1", sd6_grp1, &sd6_grp1_mux),
  3111. FUNCTION("sp0_ext_ldo_on",
  3112. sp0_ext_ldo_on_grp,
  3113. &sp0_ext_ldo_on_grp_mux),
  3114. FUNCTION("sp0_qspi", sp0_qspi_grp, &sp0_qspi_grp_mux),
  3115. FUNCTION("sp1_spi", sp1_spi_grp, &sp1_spi_grp_mux),
  3116. FUNCTION("tpiu_trace", tpiu_trace_grp, &tpiu_trace_grp_mux),
  3117. FUNCTION("uart0", uart0_grp, &uart0_grp_mux),
  3118. FUNCTION("uart0_nopause", uart0_nopause_grp, &uart0_nopause_grp_mux),
  3119. FUNCTION("uart1", uart1_grp, &uart1_grp_mux),
  3120. FUNCTION("uart2", uart2_grp, &uart2_grp_mux),
  3121. FUNCTION("uart3_m0", uart3_grp0, &uart3_grp0_mux),
  3122. FUNCTION("uart3_m1", uart3_grp1, &uart3_grp1_mux),
  3123. FUNCTION("uart3_m2", uart3_grp2, &uart3_grp2_mux),
  3124. FUNCTION("uart3_m3", uart3_grp3, &uart3_grp3_mux),
  3125. FUNCTION("uart3_nopause_m0",
  3126. uart3_nopause_grp0,
  3127. &uart3_nopause_grp0_mux),
  3128. FUNCTION("uart3_nopause_m1",
  3129. uart3_nopause_grp1,
  3130. &uart3_nopause_grp1_mux),
  3131. FUNCTION("uart4_m0", uart4_grp0, &uart4_grp0_mux),
  3132. FUNCTION("uart4_m1", uart4_grp1, &uart4_grp1_mux),
  3133. FUNCTION("uart4_m2", uart4_grp2, &uart4_grp2_mux),
  3134. FUNCTION("uart4_nopause", uart4_nopause_grp, &uart4_nopause_grp_mux),
  3135. FUNCTION("usb0_drvvbus", usb0_drvvbus_grp, &usb0_drvvbus_grp_mux),
  3136. FUNCTION("usb1_drvvbus", usb1_drvvbus_grp, &usb1_drvvbus_grp_mux),
  3137. FUNCTION("visbus_dout", visbus_dout_grp, &visbus_dout_grp_mux),
  3138. FUNCTION("vi_vip1", vi_vip1_grp, &vi_vip1_grp_mux),
  3139. FUNCTION("vi_vip1_ext", vi_vip1_ext_grp, &vi_vip1_ext_grp_mux),
  3140. FUNCTION("vi_vip1_low8bit",
  3141. vi_vip1_low8bit_grp,
  3142. &vi_vip1_low8bit_grp_mux),
  3143. FUNCTION("vi_vip1_high8bit",
  3144. vi_vip1_high8bit_grp,
  3145. &vi_vip1_high8bit_grp_mux),
  3146. };
  3147. struct atlas7_pinctrl_data atlas7_ioc_data = {
  3148. .pads = (struct pinctrl_pin_desc *)atlas7_ioc_pads,
  3149. .pads_cnt = ARRAY_SIZE(atlas7_ioc_pads),
  3150. .grps = (struct atlas7_pin_group *)altas7_pin_groups,
  3151. .grps_cnt = ARRAY_SIZE(altas7_pin_groups),
  3152. .funcs = (struct atlas7_pmx_func *)atlas7_pmx_functions,
  3153. .funcs_cnt = ARRAY_SIZE(atlas7_pmx_functions),
  3154. .confs = (struct atlas7_pad_config *)atlas7_ioc_pad_confs,
  3155. .confs_cnt = ARRAY_SIZE(atlas7_ioc_pad_confs),
  3156. };
  3157. /* Simple map data structure */
  3158. struct map_data {
  3159. u8 idx;
  3160. u8 data;
  3161. };
  3162. /**
  3163. * struct atlas7_pull_info - Atlas7 Pad pull info
  3164. * @type:The type of this Pad.
  3165. * @mask:The mas value of this pin's pull bits.
  3166. * @v2s: The map of pull register value to pull status.
  3167. * @s2v: The map of pull status to pull register value.
  3168. */
  3169. struct atlas7_pull_info {
  3170. u8 pad_type;
  3171. u8 mask;
  3172. const struct map_data *v2s;
  3173. const struct map_data *s2v;
  3174. };
  3175. /* Pull Register value map to status */
  3176. static const struct map_data p4we_pull_v2s[] = {
  3177. { P4WE_PULL_UP, PULL_UP },
  3178. { P4WE_HIGH_HYSTERESIS, HIGH_HYSTERESIS },
  3179. { P4WE_HIGH_Z, HIGH_Z },
  3180. { P4WE_PULL_DOWN, PULL_DOWN },
  3181. };
  3182. static const struct map_data p16st_pull_v2s[] = {
  3183. { P16ST_PULL_UP, PULL_UP },
  3184. { PD, PULL_UNKNOWN },
  3185. { P16ST_HIGH_Z, HIGH_Z },
  3186. { P16ST_PULL_DOWN, PULL_DOWN },
  3187. };
  3188. static const struct map_data pm31_pull_v2s[] = {
  3189. { PM31_PULL_DISABLED, PULL_DOWN },
  3190. { PM31_PULL_ENABLED, PULL_UP },
  3191. };
  3192. static const struct map_data pangd_pull_v2s[] = {
  3193. { PANGD_PULL_UP, PULL_UP },
  3194. { PD, PULL_UNKNOWN },
  3195. { PANGD_HIGH_Z, HIGH_Z },
  3196. { PANGD_PULL_DOWN, PULL_DOWN },
  3197. };
  3198. /* Pull status map to register value */
  3199. static const struct map_data p4we_pull_s2v[] = {
  3200. { PULL_UP, P4WE_PULL_UP },
  3201. { HIGH_HYSTERESIS, P4WE_HIGH_HYSTERESIS },
  3202. { HIGH_Z, P4WE_HIGH_Z },
  3203. { PULL_DOWN, P4WE_PULL_DOWN },
  3204. { PULL_DISABLE, -1 },
  3205. { PULL_ENABLE, -1 },
  3206. };
  3207. static const struct map_data p16st_pull_s2v[] = {
  3208. { PULL_UP, P16ST_PULL_UP },
  3209. { HIGH_HYSTERESIS, -1 },
  3210. { HIGH_Z, P16ST_HIGH_Z },
  3211. { PULL_DOWN, P16ST_PULL_DOWN },
  3212. { PULL_DISABLE, -1 },
  3213. { PULL_ENABLE, -1 },
  3214. };
  3215. static const struct map_data pm31_pull_s2v[] = {
  3216. { PULL_UP, PM31_PULL_ENABLED },
  3217. { HIGH_HYSTERESIS, -1 },
  3218. { HIGH_Z, -1 },
  3219. { PULL_DOWN, PM31_PULL_DISABLED },
  3220. { PULL_DISABLE, -1 },
  3221. { PULL_ENABLE, -1 },
  3222. };
  3223. static const struct map_data pangd_pull_s2v[] = {
  3224. { PULL_UP, PANGD_PULL_UP },
  3225. { HIGH_HYSTERESIS, -1 },
  3226. { HIGH_Z, PANGD_HIGH_Z },
  3227. { PULL_DOWN, PANGD_PULL_DOWN },
  3228. { PULL_DISABLE, -1 },
  3229. { PULL_ENABLE, -1 },
  3230. };
  3231. static const struct atlas7_pull_info atlas7_pull_map[] = {
  3232. { PAD_T_4WE_PD, P4WE_PULL_MASK, p4we_pull_v2s, p4we_pull_s2v },
  3233. { PAD_T_4WE_PU, P4WE_PULL_MASK, p4we_pull_v2s, p4we_pull_s2v },
  3234. { PAD_T_16ST, P16ST_PULL_MASK, p16st_pull_v2s, p16st_pull_s2v },
  3235. { PAD_T_M31_0204_PD, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
  3236. { PAD_T_M31_0204_PU, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
  3237. { PAD_T_M31_0610_PD, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
  3238. { PAD_T_M31_0610_PU, PM31_PULL_MASK, pm31_pull_v2s, pm31_pull_s2v },
  3239. { PAD_T_AD, PANGD_PULL_MASK, pangd_pull_v2s, pangd_pull_s2v },
  3240. };
  3241. /**
  3242. * struct atlas7_ds_ma_info - Atlas7 Pad DriveStrength & currents info
  3243. * @ma: The Drive Strength in current value .
  3244. * @ds_16st: The correspond raw value of 16st pad.
  3245. * @ds_4we: The correspond raw value of 4we pad.
  3246. * @ds_0204m31: The correspond raw value of 0204m31 pad.
  3247. * @ds_0610m31: The correspond raw value of 0610m31 pad.
  3248. */
  3249. struct atlas7_ds_ma_info {
  3250. u32 ma;
  3251. u32 ds_16st;
  3252. u32 ds_4we;
  3253. u32 ds_0204m31;
  3254. u32 ds_0610m31;
  3255. };
  3256. static const struct atlas7_ds_ma_info atlas7_ma2ds_map[] = {
  3257. { 2, DS_16ST_0, DS_4WE_0, DS_M31_0, DS_NULL },
  3258. { 4, DS_16ST_1, DS_NULL, DS_M31_1, DS_NULL },
  3259. { 6, DS_16ST_2, DS_NULL, DS_NULL, DS_M31_0 },
  3260. { 8, DS_16ST_3, DS_4WE_1, DS_NULL, DS_NULL },
  3261. { 10, DS_16ST_4, DS_NULL, DS_NULL, DS_M31_1 },
  3262. { 12, DS_16ST_5, DS_NULL, DS_NULL, DS_NULL },
  3263. { 14, DS_16ST_6, DS_NULL, DS_NULL, DS_NULL },
  3264. { 16, DS_16ST_7, DS_4WE_2, DS_NULL, DS_NULL },
  3265. { 18, DS_16ST_8, DS_NULL, DS_NULL, DS_NULL },
  3266. { 20, DS_16ST_9, DS_NULL, DS_NULL, DS_NULL },
  3267. { 22, DS_16ST_10, DS_NULL, DS_NULL, DS_NULL },
  3268. { 24, DS_16ST_11, DS_NULL, DS_NULL, DS_NULL },
  3269. { 26, DS_16ST_12, DS_NULL, DS_NULL, DS_NULL },
  3270. { 28, DS_16ST_13, DS_4WE_3, DS_NULL, DS_NULL },
  3271. { 30, DS_16ST_14, DS_NULL, DS_NULL, DS_NULL },
  3272. { 32, DS_16ST_15, DS_NULL, DS_NULL, DS_NULL },
  3273. };
  3274. /**
  3275. * struct atlas7_ds_info - Atlas7 Pad DriveStrength info
  3276. * @type: The type of this Pad.
  3277. * @mask: The mask value of this pin's pull bits.
  3278. * @imval: The immediate value of drives trength register.
  3279. */
  3280. struct atlas7_ds_info {
  3281. u8 type;
  3282. u8 mask;
  3283. u8 imval;
  3284. u8 reserved;
  3285. };
  3286. static const struct atlas7_ds_info atlas7_ds_map[] = {
  3287. { PAD_T_4WE_PD, DS_2BIT_MASK, DS_2BIT_IM_VAL },
  3288. { PAD_T_4WE_PU, DS_2BIT_MASK, DS_2BIT_IM_VAL },
  3289. { PAD_T_16ST, DS_4BIT_MASK, DS_4BIT_IM_VAL },
  3290. { PAD_T_M31_0204_PD, DS_1BIT_MASK, DS_1BIT_IM_VAL },
  3291. { PAD_T_M31_0204_PU, DS_1BIT_MASK, DS_1BIT_IM_VAL },
  3292. { PAD_T_M31_0610_PD, DS_1BIT_MASK, DS_1BIT_IM_VAL },
  3293. { PAD_T_M31_0610_PU, DS_1BIT_MASK, DS_1BIT_IM_VAL },
  3294. { PAD_T_AD, DS_NULL, DS_NULL },
  3295. };
  3296. static inline u32 atlas7_pin_to_bank(u32 pin)
  3297. {
  3298. return (pin >= ATLAS7_PINCTRL_BANK_0_PINS) ? 1 : 0;
  3299. }
  3300. static int atlas7_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
  3301. {
  3302. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3303. return pmx->pctl_data->funcs_cnt;
  3304. }
  3305. static const char *atlas7_pmx_get_func_name(struct pinctrl_dev *pctldev,
  3306. u32 selector)
  3307. {
  3308. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3309. return pmx->pctl_data->funcs[selector].name;
  3310. }
  3311. static int atlas7_pmx_get_func_groups(struct pinctrl_dev *pctldev,
  3312. u32 selector, const char * const **groups,
  3313. u32 * const num_groups)
  3314. {
  3315. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3316. *groups = pmx->pctl_data->funcs[selector].groups;
  3317. *num_groups = pmx->pctl_data->funcs[selector].num_groups;
  3318. return 0;
  3319. }
  3320. static void __atlas7_pmx_pin_input_disable_set(struct atlas7_pmx *pmx,
  3321. const struct atlas7_pad_mux *mux)
  3322. {
  3323. /* Set Input Disable to avoid input glitches
  3324. *
  3325. * All Input-Disable Control registers are located on IOCRTC.
  3326. * So the regs bank is always 0.
  3327. *
  3328. */
  3329. if (mux->dinput_reg && mux->dinput_val_reg) {
  3330. writel(DI_MASK << mux->dinput_bit,
  3331. pmx->regs[BANK_DS] + CLR_REG(mux->dinput_reg));
  3332. writel(DI_DISABLE << mux->dinput_bit,
  3333. pmx->regs[BANK_DS] + mux->dinput_reg);
  3334. writel(DIV_MASK << mux->dinput_val_bit,
  3335. pmx->regs[BANK_DS] + CLR_REG(mux->dinput_val_reg));
  3336. writel(DIV_DISABLE << mux->dinput_val_bit,
  3337. pmx->regs[BANK_DS] + mux->dinput_val_reg);
  3338. }
  3339. }
  3340. static void __atlas7_pmx_pin_input_disable_clr(struct atlas7_pmx *pmx,
  3341. const struct atlas7_pad_mux *mux)
  3342. {
  3343. /* Clear Input Disable to avoid input glitches */
  3344. if (mux->dinput_reg && mux->dinput_val_reg) {
  3345. writel(DI_MASK << mux->dinput_bit,
  3346. pmx->regs[BANK_DS] + CLR_REG(mux->dinput_reg));
  3347. writel(DI_ENABLE << mux->dinput_bit,
  3348. pmx->regs[BANK_DS] + mux->dinput_reg);
  3349. writel(DIV_MASK << mux->dinput_val_bit,
  3350. pmx->regs[BANK_DS] + CLR_REG(mux->dinput_val_reg));
  3351. writel(DIV_ENABLE << mux->dinput_val_bit,
  3352. pmx->regs[BANK_DS] + mux->dinput_val_reg);
  3353. }
  3354. }
  3355. static int __atlas7_pmx_pin_ad_sel(struct atlas7_pmx *pmx,
  3356. struct atlas7_pad_config *conf,
  3357. u32 bank, u32 ad_sel)
  3358. {
  3359. unsigned long regv;
  3360. /* Write to clear register to clear A/D selector */
  3361. writel(ANA_CLEAR_MASK << conf->ad_ctrl_bit,
  3362. pmx->regs[bank] + CLR_REG(conf->ad_ctrl_reg));
  3363. /* Set target pad A/D selector */
  3364. regv = readl(pmx->regs[bank] + conf->ad_ctrl_reg);
  3365. regv &= ~(ANA_CLEAR_MASK << conf->ad_ctrl_bit);
  3366. writel(regv | (ad_sel << conf->ad_ctrl_bit),
  3367. pmx->regs[bank] + conf->ad_ctrl_reg);
  3368. regv = readl(pmx->regs[bank] + conf->ad_ctrl_reg);
  3369. pr_debug("bank:%d reg:0x%04x val:0x%08lx\n",
  3370. bank, conf->ad_ctrl_reg, regv);
  3371. return 0;
  3372. }
  3373. static int __atlas7_pmx_pin_analog_enable(struct atlas7_pmx *pmx,
  3374. struct atlas7_pad_config *conf, u32 bank)
  3375. {
  3376. /* Only PAD_T_AD pins can change between Analogue&Digital */
  3377. if (conf->type != PAD_T_AD)
  3378. return -EINVAL;
  3379. return __atlas7_pmx_pin_ad_sel(pmx, conf, bank, 0);
  3380. }
  3381. static int __atlas7_pmx_pin_digital_enable(struct atlas7_pmx *pmx,
  3382. struct atlas7_pad_config *conf, u32 bank)
  3383. {
  3384. /* Other type pads are always digital */
  3385. if (conf->type != PAD_T_AD)
  3386. return 0;
  3387. return __atlas7_pmx_pin_ad_sel(pmx, conf, bank, 1);
  3388. }
  3389. static int __atlas7_pmx_pin_enable(struct atlas7_pmx *pmx,
  3390. u32 pin, u32 func)
  3391. {
  3392. struct atlas7_pad_config *conf;
  3393. u32 bank;
  3394. int ret;
  3395. unsigned long regv;
  3396. pr_debug("PMX DUMP ### pin#%d func:%d #### START >>>\n",
  3397. pin, func);
  3398. /* Get this Pad's descriptor from PINCTRL */
  3399. conf = &pmx->pctl_data->confs[pin];
  3400. bank = atlas7_pin_to_bank(pin);
  3401. /* Just enable the analog function of this pad */
  3402. if (FUNC_ANALOGUE == func) {
  3403. ret = __atlas7_pmx_pin_analog_enable(pmx, conf, bank);
  3404. if (ret)
  3405. dev_err(pmx->dev,
  3406. "Convert pad#%d to analog failed, ret=%d\n",
  3407. pin, ret);
  3408. return ret;
  3409. }
  3410. /* Set Pads from analog to digital */
  3411. ret = __atlas7_pmx_pin_digital_enable(pmx, conf, bank);
  3412. if (ret) {
  3413. dev_err(pmx->dev,
  3414. "Convert pad#%d to digital failed, ret=%d\n",
  3415. pin, ret);
  3416. return ret;
  3417. }
  3418. /* Write to clear register to clear current function */
  3419. writel(FUNC_CLEAR_MASK << conf->mux_bit,
  3420. pmx->regs[bank] + CLR_REG(conf->mux_reg));
  3421. /* Set target pad mux function */
  3422. regv = readl(pmx->regs[bank] + conf->mux_reg);
  3423. regv &= ~(FUNC_CLEAR_MASK << conf->mux_bit);
  3424. writel(regv | (func << conf->mux_bit),
  3425. pmx->regs[bank] + conf->mux_reg);
  3426. regv = readl(pmx->regs[bank] + conf->mux_reg);
  3427. pr_debug("bank:%d reg:0x%04x val:0x%08lx\n",
  3428. bank, conf->mux_reg, regv);
  3429. return 0;
  3430. }
  3431. static int atlas7_pmx_set_mux(struct pinctrl_dev *pctldev,
  3432. u32 func_selector, u32 group_selector)
  3433. {
  3434. int idx, ret;
  3435. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3436. struct atlas7_pmx_func *pmx_func;
  3437. struct atlas7_pin_group *pin_grp;
  3438. const struct atlas7_grp_mux *grp_mux;
  3439. const struct atlas7_pad_mux *mux;
  3440. pmx_func = &pmx->pctl_data->funcs[func_selector];
  3441. pin_grp = &pmx->pctl_data->grps[group_selector];
  3442. pr_debug("PMX DUMP ### Function:[%s] Group:[%s] #### START >>>\n",
  3443. pmx_func->name, pin_grp->name);
  3444. grp_mux = pmx_func->grpmux;
  3445. for (idx = 0; idx < grp_mux->pad_mux_count; idx++) {
  3446. mux = &grp_mux->pad_mux_list[idx];
  3447. __atlas7_pmx_pin_input_disable_set(pmx, mux);
  3448. ret = __atlas7_pmx_pin_enable(pmx, mux->pin, mux->func);
  3449. if (ret) {
  3450. dev_err(pmx->dev,
  3451. "FUNC:%s GRP:%s PIN#%d.%d failed, ret=%d\n",
  3452. pmx_func->name, pin_grp->name,
  3453. mux->pin, mux->func, ret);
  3454. BUG_ON(1);
  3455. }
  3456. __atlas7_pmx_pin_input_disable_clr(pmx, mux);
  3457. }
  3458. pr_debug("PMX DUMP ### Function:[%s] Group:[%s] #### END <<<\n",
  3459. pmx_func->name, pin_grp->name);
  3460. return 0;
  3461. }
  3462. static u32 convert_current_to_drive_strength(u32 type, u32 ma)
  3463. {
  3464. int idx;
  3465. for (idx = 0; idx < ARRAY_SIZE(atlas7_ma2ds_map); idx++) {
  3466. if (atlas7_ma2ds_map[idx].ma != ma)
  3467. continue;
  3468. if (type == PAD_T_4WE_PD || type == PAD_T_4WE_PU)
  3469. return atlas7_ma2ds_map[idx].ds_4we;
  3470. else if (type == PAD_T_16ST)
  3471. return atlas7_ma2ds_map[idx].ds_16st;
  3472. else if (type == PAD_T_M31_0204_PD || type == PAD_T_M31_0204_PU)
  3473. return atlas7_ma2ds_map[idx].ds_0204m31;
  3474. else if (type == PAD_T_M31_0610_PD || type == PAD_T_M31_0610_PU)
  3475. return atlas7_ma2ds_map[idx].ds_0610m31;
  3476. }
  3477. return DS_NULL;
  3478. }
  3479. static int altas7_pinctrl_set_pull_sel(struct pinctrl_dev *pctldev,
  3480. u32 pin, u32 sel)
  3481. {
  3482. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3483. struct atlas7_pad_config *conf = &pmx->pctl_data->confs[pin];
  3484. const struct atlas7_pull_info *pull_info;
  3485. u32 bank;
  3486. unsigned long regv;
  3487. void __iomem *pull_sel_reg;
  3488. bank = atlas7_pin_to_bank(pin);
  3489. pull_info = &atlas7_pull_map[conf->type];
  3490. pull_sel_reg = pmx->regs[bank] + conf->pupd_reg;
  3491. /* Retrieve correspond register value from table by sel */
  3492. regv = pull_info->s2v[sel].data & pull_info->mask;
  3493. /* Clear & Set new value to pull register */
  3494. writel(pull_info->mask << conf->pupd_bit, CLR_REG(pull_sel_reg));
  3495. writel(regv << conf->pupd_bit, pull_sel_reg);
  3496. pr_debug("PIN_CFG ### SET PIN#%d PULL SELECTOR:%d == OK ####\n",
  3497. pin, sel);
  3498. return 0;
  3499. }
  3500. static int __altas7_pinctrl_set_drive_strength_sel(struct pinctrl_dev *pctldev,
  3501. u32 pin, u32 sel)
  3502. {
  3503. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3504. struct atlas7_pad_config *conf = &pmx->pctl_data->confs[pin];
  3505. const struct atlas7_ds_info *ds_info;
  3506. u32 bank;
  3507. void __iomem *ds_sel_reg;
  3508. ds_info = &atlas7_ds_map[conf->type];
  3509. if (sel & (~(ds_info->mask)))
  3510. goto unsupport;
  3511. bank = atlas7_pin_to_bank(pin);
  3512. ds_sel_reg = pmx->regs[bank] + conf->drvstr_reg;
  3513. writel(ds_info->imval << conf->drvstr_bit, CLR_REG(ds_sel_reg));
  3514. writel(sel << conf->drvstr_bit, ds_sel_reg);
  3515. return 0;
  3516. unsupport:
  3517. pr_err("Pad#%d type[%d] doesn't support ds code[%d]!\n",
  3518. pin, conf->type, sel);
  3519. return -ENOTSUPP;
  3520. }
  3521. static int altas7_pinctrl_set_drive_strength_sel(struct pinctrl_dev *pctldev,
  3522. u32 pin, u32 ma)
  3523. {
  3524. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3525. struct atlas7_pad_config *conf = &pmx->pctl_data->confs[pin];
  3526. u32 type = conf->type;
  3527. u32 sel;
  3528. int ret;
  3529. sel = convert_current_to_drive_strength(conf->type, ma);
  3530. if (DS_NULL == sel) {
  3531. pr_err("Pad#%d type[%d] doesn't support ds current[%d]!\n",
  3532. pin, type, ma);
  3533. return -ENOTSUPP;
  3534. }
  3535. ret = __altas7_pinctrl_set_drive_strength_sel(pctldev,
  3536. pin, sel);
  3537. pr_debug("PIN_CFG ### SET PIN#%d DS:%d MA:%d == %s ####\n",
  3538. pin, sel, ma, ret?"FAILED":"OK");
  3539. return ret;
  3540. }
  3541. static int atlas7_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
  3542. struct pinctrl_gpio_range *range, u32 pin)
  3543. {
  3544. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3545. u32 idx;
  3546. dev_dbg(pmx->dev,
  3547. "atlas7_pmx_gpio_request_enable: pin=%d\n", pin);
  3548. for (idx = 0; idx < range->npins; idx++) {
  3549. if (pin == range->pins[idx])
  3550. break;
  3551. }
  3552. if (idx >= range->npins) {
  3553. dev_err(pmx->dev,
  3554. "The pin#%d could not be requested as GPIO!!\n",
  3555. pin);
  3556. return -EPERM;
  3557. }
  3558. __atlas7_pmx_pin_enable(pmx, pin, FUNC_GPIO);
  3559. return 0;
  3560. }
  3561. static struct pinmux_ops atlas7_pinmux_ops = {
  3562. .get_functions_count = atlas7_pmx_get_funcs_count,
  3563. .get_function_name = atlas7_pmx_get_func_name,
  3564. .get_function_groups = atlas7_pmx_get_func_groups,
  3565. .set_mux = atlas7_pmx_set_mux,
  3566. .gpio_request_enable = atlas7_pmx_gpio_request_enable,
  3567. };
  3568. static int atlas7_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
  3569. {
  3570. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3571. return pmx->pctl_data->grps_cnt;
  3572. }
  3573. static const char *atlas7_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
  3574. u32 group)
  3575. {
  3576. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3577. return pmx->pctl_data->grps[group].name;
  3578. }
  3579. static int atlas7_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
  3580. u32 group, const u32 **pins, u32 *num_pins)
  3581. {
  3582. struct atlas7_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
  3583. *num_pins = pmx->pctl_data->grps[group].num_pins;
  3584. *pins = pmx->pctl_data->grps[group].pins;
  3585. return 0;
  3586. }
  3587. static int atlas7_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
  3588. struct device_node *np_config,
  3589. struct pinctrl_map **map,
  3590. u32 *num_maps)
  3591. {
  3592. return pinconf_generic_dt_node_to_map(pctldev, np_config, map,
  3593. num_maps, PIN_MAP_TYPE_INVALID);
  3594. }
  3595. static void atlas7_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
  3596. struct pinctrl_map *map, u32 num_maps)
  3597. {
  3598. kfree(map);
  3599. }
  3600. static const struct pinctrl_ops atlas7_pinctrl_ops = {
  3601. .get_groups_count = atlas7_pinctrl_get_groups_count,
  3602. .get_group_name = atlas7_pinctrl_get_group_name,
  3603. .get_group_pins = atlas7_pinctrl_get_group_pins,
  3604. .dt_node_to_map = atlas7_pinctrl_dt_node_to_map,
  3605. .dt_free_map = atlas7_pinctrl_dt_free_map,
  3606. };
  3607. static int atlas7_pin_config_set(struct pinctrl_dev *pctldev,
  3608. unsigned pin, unsigned long *configs,
  3609. unsigned num_configs)
  3610. {
  3611. u16 param, arg;
  3612. int idx, err;
  3613. for (idx = 0; idx < num_configs; idx++) {
  3614. param = pinconf_to_config_param(configs[idx]);
  3615. arg = pinconf_to_config_argument(configs[idx]);
  3616. pr_debug("PMX CFG###### ATLAS7 PIN#%d [%s] CONFIG PARAM:%d ARG:%d >>>>>\n",
  3617. pin, atlas7_ioc_pads[pin].name, param, arg);
  3618. switch (param) {
  3619. case PIN_CONFIG_BIAS_PULL_UP:
  3620. err = altas7_pinctrl_set_pull_sel(pctldev,
  3621. pin, PULL_UP);
  3622. if (err)
  3623. return err;
  3624. break;
  3625. case PIN_CONFIG_BIAS_PULL_DOWN:
  3626. err = altas7_pinctrl_set_pull_sel(pctldev,
  3627. pin, PULL_DOWN);
  3628. if (err)
  3629. return err;
  3630. break;
  3631. case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  3632. err = altas7_pinctrl_set_pull_sel(pctldev,
  3633. pin, HIGH_HYSTERESIS);
  3634. if (err)
  3635. return err;
  3636. break;
  3637. case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
  3638. err = altas7_pinctrl_set_pull_sel(pctldev,
  3639. pin, HIGH_Z);
  3640. if (err)
  3641. return err;
  3642. break;
  3643. case PIN_CONFIG_DRIVE_STRENGTH:
  3644. err = altas7_pinctrl_set_drive_strength_sel(pctldev,
  3645. pin, arg);
  3646. if (err)
  3647. return err;
  3648. break;
  3649. default:
  3650. return -ENOTSUPP;
  3651. }
  3652. pr_debug("PMX CFG###### ATLAS7 PIN#%d [%s] CONFIG PARAM:%d ARG:%d <<<<\n",
  3653. pin, atlas7_ioc_pads[pin].name, param, arg);
  3654. }
  3655. return 0;
  3656. }
  3657. static int atlas7_pin_config_group_set(struct pinctrl_dev *pctldev,
  3658. unsigned group, unsigned long *configs,
  3659. unsigned num_configs)
  3660. {
  3661. const unsigned *pins;
  3662. unsigned npins;
  3663. int i, ret;
  3664. ret = atlas7_pinctrl_get_group_pins(pctldev, group, &pins, &npins);
  3665. if (ret)
  3666. return ret;
  3667. for (i = 0; i < npins; i++) {
  3668. if (atlas7_pin_config_set(pctldev, pins[i],
  3669. configs, num_configs))
  3670. return -ENOTSUPP;
  3671. }
  3672. return 0;
  3673. }
  3674. static const struct pinconf_ops atlas7_pinconf_ops = {
  3675. .pin_config_set = atlas7_pin_config_set,
  3676. .pin_config_group_set = atlas7_pin_config_group_set,
  3677. .is_generic = true,
  3678. };
  3679. static int atlas7_pinmux_probe(struct platform_device *pdev)
  3680. {
  3681. int ret, idx;
  3682. struct atlas7_pmx *pmx;
  3683. struct device_node *np = pdev->dev.of_node;
  3684. u32 banks = ATLAS7_PINCTRL_REG_BANKS;
  3685. /* Create state holders etc for this driver */
  3686. pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
  3687. if (!pmx)
  3688. return -ENOMEM;
  3689. pmx->dev = &pdev->dev;
  3690. pmx->pctl_data = &atlas7_ioc_data;
  3691. pmx->pctl_desc.name = "pinctrl-atlas7";
  3692. pmx->pctl_desc.pins = pmx->pctl_data->pads;
  3693. pmx->pctl_desc.npins = pmx->pctl_data->pads_cnt;
  3694. pmx->pctl_desc.pctlops = &atlas7_pinctrl_ops;
  3695. pmx->pctl_desc.pmxops = &atlas7_pinmux_ops;
  3696. pmx->pctl_desc.confops = &atlas7_pinconf_ops;
  3697. for (idx = 0; idx < banks; idx++) {
  3698. pmx->regs[idx] = of_iomap(np, idx);
  3699. if (!pmx->regs[idx]) {
  3700. dev_err(&pdev->dev,
  3701. "can't map ioc bank#%d registers\n", idx);
  3702. ret = -ENOMEM;
  3703. goto unmap_io;
  3704. }
  3705. }
  3706. /* Now register the pin controller and all pins it handles */
  3707. pmx->pctl = pinctrl_register(&pmx->pctl_desc, &pdev->dev, pmx);
  3708. if (IS_ERR(pmx->pctl)) {
  3709. dev_err(&pdev->dev, "could not register atlas7 pinmux driver\n");
  3710. ret = PTR_ERR(pmx->pctl);
  3711. goto unmap_io;
  3712. }
  3713. platform_set_drvdata(pdev, pmx);
  3714. dev_info(&pdev->dev, "initialized atlas7 pinmux driver\n");
  3715. return 0;
  3716. unmap_io:
  3717. for (idx = 0; idx < banks; idx++) {
  3718. if (!pmx->regs[idx])
  3719. break;
  3720. iounmap(pmx->regs[idx]);
  3721. }
  3722. return ret;
  3723. }
  3724. #ifdef CONFIG_PM_SLEEP
  3725. static int atlas7_pinmux_suspend_noirq(struct device *dev)
  3726. {
  3727. struct atlas7_pmx *pmx = dev_get_drvdata(dev);
  3728. struct atlas7_pad_status *status;
  3729. struct atlas7_pad_config *conf;
  3730. const struct atlas7_ds_info *ds_info;
  3731. const struct atlas7_pull_info *pull_info;
  3732. int idx;
  3733. u32 bank;
  3734. unsigned long regv;
  3735. for (idx = 0; idx < pmx->pctl_desc.npins; idx++) {
  3736. /* Get this Pad's descriptor from PINCTRL */
  3737. conf = &pmx->pctl_data->confs[idx];
  3738. bank = atlas7_pin_to_bank(idx);
  3739. status = &pmx->sleep_data[idx];
  3740. /* Save Function selector */
  3741. regv = readl(pmx->regs[bank] + conf->mux_reg);
  3742. status->func = (regv >> conf->mux_bit) & FUNC_CLEAR_MASK;
  3743. /* Check if Pad is in Analogue selector */
  3744. if (conf->ad_ctrl_reg == -1)
  3745. goto save_ds_sel;
  3746. regv = readl(pmx->regs[bank] + conf->ad_ctrl_reg);
  3747. if (!(regv & (conf->ad_ctrl_bit << ANA_CLEAR_MASK)))
  3748. status->func = FUNC_ANALOGUE;
  3749. save_ds_sel:
  3750. if (conf->drvstr_reg == -1)
  3751. goto save_pull_sel;
  3752. /* Save Drive Strength selector */
  3753. ds_info = &atlas7_ds_map[conf->type];
  3754. regv = readl(pmx->regs[bank] + conf->drvstr_reg);
  3755. status->dstr = (regv >> conf->drvstr_bit) & ds_info->mask;
  3756. save_pull_sel:
  3757. /* Save Pull selector */
  3758. pull_info = &atlas7_pull_map[conf->type];
  3759. regv = readl(pmx->regs[bank] + conf->pupd_reg);
  3760. regv = (regv >> conf->pupd_bit) & pull_info->mask;
  3761. status->pull = pull_info->v2s[regv].data;
  3762. }
  3763. /*
  3764. * Save disable input selector, this selector is not for Pin,
  3765. * but for Mux function.
  3766. */
  3767. for (idx = 0; idx < NUM_OF_IN_DISABLE_REG; idx++) {
  3768. pmx->status_ds[idx] = readl(pmx->regs[BANK_DS] +
  3769. IN_DISABLE_0_REG_SET + 0x8 * idx);
  3770. pmx->status_dsv[idx] = readl(pmx->regs[BANK_DS] +
  3771. IN_DISABLE_VAL_0_REG_SET + 0x8 * idx);
  3772. }
  3773. return 0;
  3774. }
  3775. static int atlas7_pinmux_resume_noirq(struct device *dev)
  3776. {
  3777. struct atlas7_pmx *pmx = dev_get_drvdata(dev);
  3778. struct atlas7_pad_status *status;
  3779. struct atlas7_pad_config *conf;
  3780. int idx;
  3781. u32 bank;
  3782. for (idx = 0; idx < pmx->pctl_desc.npins; idx++) {
  3783. /* Get this Pad's descriptor from PINCTRL */
  3784. conf = &pmx->pctl_data->confs[idx];
  3785. bank = atlas7_pin_to_bank(idx);
  3786. status = &pmx->sleep_data[idx];
  3787. /* Restore Function selector */
  3788. __atlas7_pmx_pin_enable(pmx, idx, (u32)status->func & 0xff);
  3789. if (FUNC_ANALOGUE == status->func)
  3790. goto restore_pull_sel;
  3791. /* Restore Drive Strength selector */
  3792. __altas7_pinctrl_set_drive_strength_sel(pmx->pctl, idx,
  3793. (u32)status->dstr & 0xff);
  3794. restore_pull_sel:
  3795. /* Restore Pull selector */
  3796. altas7_pinctrl_set_pull_sel(pmx->pctl, idx,
  3797. (u32)status->pull & 0xff);
  3798. }
  3799. /*
  3800. * Restore disable input selector, this selector is not for Pin,
  3801. * but for Mux function
  3802. */
  3803. for (idx = 0; idx < NUM_OF_IN_DISABLE_REG; idx++) {
  3804. writel(~0, pmx->regs[BANK_DS] +
  3805. IN_DISABLE_0_REG_CLR + 0x8 * idx);
  3806. writel(pmx->status_ds[idx], pmx->regs[BANK_DS] +
  3807. IN_DISABLE_0_REG_SET + 0x8 * idx);
  3808. writel(~0, pmx->regs[BANK_DS] +
  3809. IN_DISABLE_VAL_0_REG_CLR + 0x8 * idx);
  3810. writel(pmx->status_dsv[idx], pmx->regs[BANK_DS] +
  3811. IN_DISABLE_VAL_0_REG_SET + 0x8 * idx);
  3812. }
  3813. return 0;
  3814. }
  3815. static const struct dev_pm_ops atlas7_pinmux_pm_ops = {
  3816. .suspend_noirq = atlas7_pinmux_suspend_noirq,
  3817. .resume_noirq = atlas7_pinmux_resume_noirq,
  3818. .freeze_noirq = atlas7_pinmux_suspend_noirq,
  3819. .restore_noirq = atlas7_pinmux_resume_noirq,
  3820. };
  3821. #endif
  3822. static const struct of_device_id atlas7_pinmux_ids[] = {
  3823. { .compatible = "sirf,atlas7-ioc",},
  3824. {},
  3825. };
  3826. static struct platform_driver atlas7_pinmux_driver = {
  3827. .driver = {
  3828. .name = "atlas7-ioc",
  3829. .of_match_table = atlas7_pinmux_ids,
  3830. #ifdef CONFIG_PM_SLEEP
  3831. .pm = &atlas7_pinmux_pm_ops,
  3832. #endif
  3833. },
  3834. .probe = atlas7_pinmux_probe,
  3835. };
  3836. static int __init atlas7_pinmux_init(void)
  3837. {
  3838. return platform_driver_register(&atlas7_pinmux_driver);
  3839. }
  3840. arch_initcall(atlas7_pinmux_init);
  3841. /**
  3842. * The Following is GPIO Code
  3843. */
  3844. static inline struct
  3845. atlas7_gpio_bank *atlas7_gpio_to_bank(struct atlas7_gpio_chip *a7gc, u32 gpio)
  3846. {
  3847. return &a7gc->banks[GPIO_TO_BANK(gpio)];
  3848. }
  3849. static int __atlas7_gpio_to_pin(struct atlas7_gpio_chip *a7gc, u32 gpio)
  3850. {
  3851. struct atlas7_gpio_bank *bank;
  3852. u32 ofs;
  3853. bank = atlas7_gpio_to_bank(a7gc, gpio);
  3854. ofs = gpio - bank->gpio_offset;
  3855. if (ofs >= bank->ngpio)
  3856. return -ENODEV;
  3857. return bank->gpio_pins[ofs];
  3858. }
  3859. static void atlas7_gpio_irq_ack(struct irq_data *d)
  3860. {
  3861. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  3862. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
  3863. struct atlas7_gpio_bank *bank;
  3864. void __iomem *ctrl_reg;
  3865. u32 val, pin_in_bank;
  3866. unsigned long flags;
  3867. bank = atlas7_gpio_to_bank(a7gc, d->hwirq);
  3868. pin_in_bank = d->hwirq - bank->gpio_offset;
  3869. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  3870. spin_lock_irqsave(&a7gc->lock, flags);
  3871. val = readl(ctrl_reg);
  3872. /* clear interrupt status */
  3873. writel(val, ctrl_reg);
  3874. spin_unlock_irqrestore(&a7gc->lock, flags);
  3875. }
  3876. static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx)
  3877. {
  3878. struct atlas7_gpio_bank *bank;
  3879. void __iomem *ctrl_reg;
  3880. u32 val, pin_in_bank;
  3881. bank = atlas7_gpio_to_bank(a7gc, idx);
  3882. pin_in_bank = idx - bank->gpio_offset;
  3883. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  3884. val = readl(ctrl_reg);
  3885. val &= ~(ATLAS7_GPIO_CTL_INTR_EN_MASK |
  3886. ATLAS7_GPIO_CTL_INTR_STATUS_MASK);
  3887. writel(val, ctrl_reg);
  3888. }
  3889. static void atlas7_gpio_irq_mask(struct irq_data *d)
  3890. {
  3891. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  3892. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
  3893. unsigned long flags;
  3894. spin_lock_irqsave(&a7gc->lock, flags);
  3895. __atlas7_gpio_irq_mask(a7gc, d->hwirq);
  3896. spin_unlock_irqrestore(&a7gc->lock, flags);
  3897. }
  3898. static void atlas7_gpio_irq_unmask(struct irq_data *d)
  3899. {
  3900. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  3901. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
  3902. struct atlas7_gpio_bank *bank;
  3903. void __iomem *ctrl_reg;
  3904. u32 val, pin_in_bank;
  3905. unsigned long flags;
  3906. bank = atlas7_gpio_to_bank(a7gc, d->hwirq);
  3907. pin_in_bank = d->hwirq - bank->gpio_offset;
  3908. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  3909. spin_lock_irqsave(&a7gc->lock, flags);
  3910. val = readl(ctrl_reg);
  3911. val &= ~ATLAS7_GPIO_CTL_INTR_STATUS_MASK;
  3912. val |= ATLAS7_GPIO_CTL_INTR_EN_MASK;
  3913. writel(val, ctrl_reg);
  3914. spin_unlock_irqrestore(&a7gc->lock, flags);
  3915. }
  3916. static int atlas7_gpio_irq_type(struct irq_data *d,
  3917. unsigned int type)
  3918. {
  3919. struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
  3920. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
  3921. struct atlas7_gpio_bank *bank;
  3922. void __iomem *ctrl_reg;
  3923. u32 val, pin_in_bank;
  3924. unsigned long flags;
  3925. bank = atlas7_gpio_to_bank(a7gc, d->hwirq);
  3926. pin_in_bank = d->hwirq - bank->gpio_offset;
  3927. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  3928. spin_lock_irqsave(&a7gc->lock, flags);
  3929. val = readl(ctrl_reg);
  3930. val &= ~(ATLAS7_GPIO_CTL_INTR_STATUS_MASK |
  3931. ATLAS7_GPIO_CTL_INTR_EN_MASK);
  3932. switch (type) {
  3933. case IRQ_TYPE_NONE:
  3934. break;
  3935. case IRQ_TYPE_EDGE_RISING:
  3936. val |= ATLAS7_GPIO_CTL_INTR_HIGH_MASK |
  3937. ATLAS7_GPIO_CTL_INTR_TYPE_MASK;
  3938. val &= ~ATLAS7_GPIO_CTL_INTR_LOW_MASK;
  3939. break;
  3940. case IRQ_TYPE_EDGE_FALLING:
  3941. val &= ~ATLAS7_GPIO_CTL_INTR_HIGH_MASK;
  3942. val |= ATLAS7_GPIO_CTL_INTR_LOW_MASK |
  3943. ATLAS7_GPIO_CTL_INTR_TYPE_MASK;
  3944. break;
  3945. case IRQ_TYPE_EDGE_BOTH:
  3946. val |= ATLAS7_GPIO_CTL_INTR_HIGH_MASK |
  3947. ATLAS7_GPIO_CTL_INTR_LOW_MASK |
  3948. ATLAS7_GPIO_CTL_INTR_TYPE_MASK;
  3949. break;
  3950. case IRQ_TYPE_LEVEL_LOW:
  3951. val &= ~(ATLAS7_GPIO_CTL_INTR_HIGH_MASK |
  3952. ATLAS7_GPIO_CTL_INTR_TYPE_MASK);
  3953. val |= ATLAS7_GPIO_CTL_INTR_LOW_MASK;
  3954. break;
  3955. case IRQ_TYPE_LEVEL_HIGH:
  3956. val |= ATLAS7_GPIO_CTL_INTR_HIGH_MASK;
  3957. val &= ~(ATLAS7_GPIO_CTL_INTR_LOW_MASK |
  3958. ATLAS7_GPIO_CTL_INTR_TYPE_MASK);
  3959. break;
  3960. }
  3961. writel(val, ctrl_reg);
  3962. spin_unlock_irqrestore(&a7gc->lock, flags);
  3963. return 0;
  3964. }
  3965. static struct irq_chip atlas7_gpio_irq_chip = {
  3966. .name = "atlas7-gpio-irq",
  3967. .irq_ack = atlas7_gpio_irq_ack,
  3968. .irq_mask = atlas7_gpio_irq_mask,
  3969. .irq_unmask = atlas7_gpio_irq_unmask,
  3970. .irq_set_type = atlas7_gpio_irq_type,
  3971. };
  3972. static void atlas7_gpio_handle_irq(struct irq_desc *desc)
  3973. {
  3974. struct gpio_chip *gc = irq_desc_get_handler_data(desc);
  3975. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc);
  3976. struct atlas7_gpio_bank *bank = NULL;
  3977. u32 status, ctrl;
  3978. int pin_in_bank = 0, idx;
  3979. struct irq_chip *chip = irq_desc_get_chip(desc);
  3980. unsigned int irq = irq_desc_get_irq(desc);
  3981. for (idx = 0; idx < a7gc->nbank; idx++) {
  3982. bank = &a7gc->banks[idx];
  3983. if (bank->irq == irq)
  3984. break;
  3985. }
  3986. BUG_ON(idx == a7gc->nbank);
  3987. chained_irq_enter(chip, desc);
  3988. status = readl(ATLAS7_GPIO_INT_STATUS(bank));
  3989. if (!status) {
  3990. pr_warn("%s: gpio [%s] status %#x no interrupt is flaged\n",
  3991. __func__, gc->label, status);
  3992. handle_bad_irq(desc);
  3993. return;
  3994. }
  3995. while (status) {
  3996. ctrl = readl(ATLAS7_GPIO_CTRL(bank, pin_in_bank));
  3997. /*
  3998. * Here we must check whether the corresponding GPIO's
  3999. * interrupt has been enabled, otherwise just skip it
  4000. */
  4001. if ((status & 0x1) && (ctrl & ATLAS7_GPIO_CTL_INTR_EN_MASK)) {
  4002. pr_debug("%s: chip[%s] gpio:%d happens\n",
  4003. __func__, gc->label,
  4004. bank->gpio_offset + pin_in_bank);
  4005. generic_handle_irq(
  4006. irq_find_mapping(gc->irqdomain,
  4007. bank->gpio_offset + pin_in_bank));
  4008. }
  4009. if (++pin_in_bank >= bank->ngpio)
  4010. break;
  4011. status = status >> 1;
  4012. }
  4013. chained_irq_exit(chip, desc);
  4014. }
  4015. static void __atlas7_gpio_set_input(struct atlas7_gpio_chip *a7gc,
  4016. unsigned int gpio)
  4017. {
  4018. struct atlas7_gpio_bank *bank;
  4019. void __iomem *ctrl_reg;
  4020. u32 val, pin_in_bank;
  4021. bank = atlas7_gpio_to_bank(a7gc, gpio);
  4022. pin_in_bank = gpio - bank->gpio_offset;
  4023. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  4024. val = readl(ctrl_reg);
  4025. val &= ~ATLAS7_GPIO_CTL_OUT_EN_MASK;
  4026. writel(val, ctrl_reg);
  4027. }
  4028. static int atlas7_gpio_request(struct gpio_chip *chip,
  4029. unsigned int gpio)
  4030. {
  4031. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
  4032. int ret;
  4033. unsigned long flags;
  4034. ret = __atlas7_gpio_to_pin(a7gc, gpio);
  4035. if (ret < 0)
  4036. return ret;
  4037. if (pinctrl_request_gpio(chip->base + gpio))
  4038. return -ENODEV;
  4039. spin_lock_irqsave(&a7gc->lock, flags);
  4040. /*
  4041. * default status:
  4042. * set direction as input and mask irq
  4043. */
  4044. __atlas7_gpio_set_input(a7gc, gpio);
  4045. __atlas7_gpio_irq_mask(a7gc, gpio);
  4046. spin_unlock_irqrestore(&a7gc->lock, flags);
  4047. return 0;
  4048. }
  4049. static void atlas7_gpio_free(struct gpio_chip *chip,
  4050. unsigned int gpio)
  4051. {
  4052. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
  4053. unsigned long flags;
  4054. spin_lock_irqsave(&a7gc->lock, flags);
  4055. __atlas7_gpio_irq_mask(a7gc, gpio);
  4056. __atlas7_gpio_set_input(a7gc, gpio);
  4057. spin_unlock_irqrestore(&a7gc->lock, flags);
  4058. pinctrl_free_gpio(chip->base + gpio);
  4059. }
  4060. static int atlas7_gpio_direction_input(struct gpio_chip *chip,
  4061. unsigned int gpio)
  4062. {
  4063. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
  4064. unsigned long flags;
  4065. spin_lock_irqsave(&a7gc->lock, flags);
  4066. __atlas7_gpio_set_input(a7gc, gpio);
  4067. spin_unlock_irqrestore(&a7gc->lock, flags);
  4068. return 0;
  4069. }
  4070. static void __atlas7_gpio_set_output(struct atlas7_gpio_chip *a7gc,
  4071. unsigned int gpio, int value)
  4072. {
  4073. struct atlas7_gpio_bank *bank;
  4074. void __iomem *ctrl_reg;
  4075. u32 out_ctrl, pin_in_bank;
  4076. bank = atlas7_gpio_to_bank(a7gc, gpio);
  4077. pin_in_bank = gpio - bank->gpio_offset;
  4078. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  4079. out_ctrl = readl(ctrl_reg);
  4080. if (value)
  4081. out_ctrl |= ATLAS7_GPIO_CTL_DATAOUT_MASK;
  4082. else
  4083. out_ctrl &= ~ATLAS7_GPIO_CTL_DATAOUT_MASK;
  4084. out_ctrl &= ~ATLAS7_GPIO_CTL_INTR_EN_MASK;
  4085. out_ctrl |= ATLAS7_GPIO_CTL_OUT_EN_MASK;
  4086. writel(out_ctrl, ctrl_reg);
  4087. }
  4088. static int atlas7_gpio_direction_output(struct gpio_chip *chip,
  4089. unsigned int gpio, int value)
  4090. {
  4091. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
  4092. unsigned long flags;
  4093. spin_lock_irqsave(&a7gc->lock, flags);
  4094. __atlas7_gpio_set_output(a7gc, gpio, value);
  4095. spin_unlock_irqrestore(&a7gc->lock, flags);
  4096. return 0;
  4097. }
  4098. static int atlas7_gpio_get_value(struct gpio_chip *chip,
  4099. unsigned int gpio)
  4100. {
  4101. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
  4102. struct atlas7_gpio_bank *bank;
  4103. u32 val, pin_in_bank;
  4104. unsigned long flags;
  4105. bank = atlas7_gpio_to_bank(a7gc, gpio);
  4106. pin_in_bank = gpio - bank->gpio_offset;
  4107. spin_lock_irqsave(&a7gc->lock, flags);
  4108. val = readl(ATLAS7_GPIO_CTRL(bank, pin_in_bank));
  4109. spin_unlock_irqrestore(&a7gc->lock, flags);
  4110. return !!(val & ATLAS7_GPIO_CTL_DATAIN_MASK);
  4111. }
  4112. static void atlas7_gpio_set_value(struct gpio_chip *chip,
  4113. unsigned int gpio, int value)
  4114. {
  4115. struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip);
  4116. struct atlas7_gpio_bank *bank;
  4117. void __iomem *ctrl_reg;
  4118. u32 ctrl, pin_in_bank;
  4119. unsigned long flags;
  4120. bank = atlas7_gpio_to_bank(a7gc, gpio);
  4121. pin_in_bank = gpio - bank->gpio_offset;
  4122. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin_in_bank);
  4123. spin_lock_irqsave(&a7gc->lock, flags);
  4124. ctrl = readl(ctrl_reg);
  4125. if (value)
  4126. ctrl |= ATLAS7_GPIO_CTL_DATAOUT_MASK;
  4127. else
  4128. ctrl &= ~ATLAS7_GPIO_CTL_DATAOUT_MASK;
  4129. writel(ctrl, ctrl_reg);
  4130. spin_unlock_irqrestore(&a7gc->lock, flags);
  4131. }
  4132. static const struct of_device_id atlas7_gpio_ids[] = {
  4133. { .compatible = "sirf,atlas7-gpio", },
  4134. {},
  4135. };
  4136. static int atlas7_gpio_probe(struct platform_device *pdev)
  4137. {
  4138. struct device_node *np = pdev->dev.of_node;
  4139. struct atlas7_gpio_chip *a7gc;
  4140. struct gpio_chip *chip;
  4141. u32 nbank;
  4142. int ret, idx;
  4143. ret = of_property_read_u32(np, "gpio-banks", &nbank);
  4144. if (ret) {
  4145. dev_err(&pdev->dev,
  4146. "Could not find GPIO bank info,ret=%d!\n",
  4147. ret);
  4148. return ret;
  4149. }
  4150. /* retrieve gpio descriptor data */
  4151. a7gc = devm_kzalloc(&pdev->dev, sizeof(*a7gc) +
  4152. sizeof(struct atlas7_gpio_bank) * nbank, GFP_KERNEL);
  4153. if (!a7gc)
  4154. return -ENOMEM;
  4155. /* Get Gpio clk */
  4156. a7gc->clk = of_clk_get(np, 0);
  4157. if (!IS_ERR(a7gc->clk)) {
  4158. ret = clk_prepare_enable(a7gc->clk);
  4159. if (ret) {
  4160. dev_err(&pdev->dev,
  4161. "Could not enable clock!\n");
  4162. return ret;
  4163. }
  4164. }
  4165. /* Get Gpio Registers */
  4166. a7gc->reg = of_iomap(np, 0);
  4167. if (!a7gc->reg) {
  4168. dev_err(&pdev->dev, "Could not map GPIO Registers!\n");
  4169. return -ENOMEM;
  4170. }
  4171. a7gc->nbank = nbank;
  4172. spin_lock_init(&a7gc->lock);
  4173. /* Setup GPIO Chip */
  4174. chip = &a7gc->chip;
  4175. chip->request = atlas7_gpio_request;
  4176. chip->free = atlas7_gpio_free;
  4177. chip->direction_input = atlas7_gpio_direction_input;
  4178. chip->get = atlas7_gpio_get_value;
  4179. chip->direction_output = atlas7_gpio_direction_output;
  4180. chip->set = atlas7_gpio_set_value;
  4181. chip->base = -1;
  4182. /* Each chip can support 32 pins at one bank */
  4183. chip->ngpio = NGPIO_OF_BANK * nbank;
  4184. chip->label = kstrdup(np->name, GFP_KERNEL);
  4185. chip->of_node = np;
  4186. chip->of_gpio_n_cells = 2;
  4187. chip->dev = &pdev->dev;
  4188. /* Add gpio chip to system */
  4189. ret = gpiochip_add(chip);
  4190. if (ret) {
  4191. dev_err(&pdev->dev,
  4192. "%s: error in probe function with status %d\n",
  4193. np->name, ret);
  4194. goto failed;
  4195. }
  4196. /* Add gpio chip to irq subsystem */
  4197. ret = gpiochip_irqchip_add(chip, &atlas7_gpio_irq_chip,
  4198. 0, handle_level_irq, IRQ_TYPE_NONE);
  4199. if (ret) {
  4200. dev_err(&pdev->dev,
  4201. "could not connect irqchip to gpiochip\n");
  4202. goto failed;
  4203. }
  4204. for (idx = 0; idx < nbank; idx++) {
  4205. struct gpio_pin_range *pin_range;
  4206. struct atlas7_gpio_bank *bank;
  4207. bank = &a7gc->banks[idx];
  4208. /* Set ctrl registers' base of this bank */
  4209. bank->base = ATLAS7_GPIO_BASE(a7gc, idx);
  4210. /* Get interrupt number from DTS */
  4211. ret = of_irq_get(np, idx);
  4212. if (ret == -EPROBE_DEFER) {
  4213. dev_err(&pdev->dev,
  4214. "Unable to find IRQ number. ret=%d\n", ret);
  4215. goto failed;
  4216. }
  4217. bank->irq = ret;
  4218. gpiochip_set_chained_irqchip(chip, &atlas7_gpio_irq_chip,
  4219. bank->irq, atlas7_gpio_handle_irq);
  4220. /* Records gpio_pin_range to a7gc */
  4221. list_for_each_entry(pin_range, &chip->pin_ranges, node) {
  4222. struct pinctrl_gpio_range *range;
  4223. range = &pin_range->range;
  4224. if (range->id == NGPIO_OF_BANK * idx) {
  4225. bank->gpio_offset = range->id;
  4226. bank->ngpio = range->npins;
  4227. bank->gpio_pins = range->pins;
  4228. bank->pctldev = pin_range->pctldev;
  4229. break;
  4230. }
  4231. }
  4232. BUG_ON(!bank->pctldev);
  4233. }
  4234. platform_set_drvdata(pdev, a7gc);
  4235. dev_info(&pdev->dev, "add to system.\n");
  4236. return 0;
  4237. failed:
  4238. return ret;
  4239. }
  4240. #ifdef CONFIG_PM_SLEEP
  4241. static int atlas7_gpio_suspend_noirq(struct device *dev)
  4242. {
  4243. struct atlas7_gpio_chip *a7gc = dev_get_drvdata(dev);
  4244. struct atlas7_gpio_bank *bank;
  4245. void __iomem *ctrl_reg;
  4246. u32 idx, pin;
  4247. for (idx = 0; idx < a7gc->nbank; idx++) {
  4248. bank = &a7gc->banks[idx];
  4249. for (pin = 0; pin < bank->ngpio; pin++) {
  4250. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin);
  4251. bank->sleep_data[pin] = readl(ctrl_reg);
  4252. }
  4253. }
  4254. return 0;
  4255. }
  4256. static int atlas7_gpio_resume_noirq(struct device *dev)
  4257. {
  4258. struct atlas7_gpio_chip *a7gc = dev_get_drvdata(dev);
  4259. struct atlas7_gpio_bank *bank;
  4260. void __iomem *ctrl_reg;
  4261. u32 idx, pin;
  4262. for (idx = 0; idx < a7gc->nbank; idx++) {
  4263. bank = &a7gc->banks[idx];
  4264. for (pin = 0; pin < bank->ngpio; pin++) {
  4265. ctrl_reg = ATLAS7_GPIO_CTRL(bank, pin);
  4266. writel(bank->sleep_data[pin], ctrl_reg);
  4267. }
  4268. }
  4269. return 0;
  4270. }
  4271. static const struct dev_pm_ops atlas7_gpio_pm_ops = {
  4272. .suspend_noirq = atlas7_gpio_suspend_noirq,
  4273. .resume_noirq = atlas7_gpio_resume_noirq,
  4274. .freeze_noirq = atlas7_gpio_suspend_noirq,
  4275. .restore_noirq = atlas7_gpio_resume_noirq,
  4276. };
  4277. #endif
  4278. static struct platform_driver atlas7_gpio_driver = {
  4279. .driver = {
  4280. .name = "atlas7-gpio",
  4281. .of_match_table = atlas7_gpio_ids,
  4282. #ifdef CONFIG_PM_SLEEP
  4283. .pm = &atlas7_gpio_pm_ops,
  4284. #endif
  4285. },
  4286. .probe = atlas7_gpio_probe,
  4287. };
  4288. static int __init atlas7_gpio_init(void)
  4289. {
  4290. return platform_driver_register(&atlas7_gpio_driver);
  4291. }
  4292. subsys_initcall(atlas7_gpio_init);
  4293. MODULE_DESCRIPTION("SIRFSOC Atlas7 pin control driver");
  4294. MODULE_LICENSE("GPL");