pinctrl-ingenic.c 174 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Ingenic SoCs pinctrl driver
  4. *
  5. * Copyright (c) 2017 Paul Cercueil <paul@crapouillou.net>
  6. * Copyright (c) 2017, 2019 Paul Boddie <paul@boddie.org.uk>
  7. * Copyright (c) 2019, 2020 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
  8. */
  9. #include <linux/compiler.h>
  10. #include <linux/gpio/driver.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/io.h>
  13. #include <linux/kernel.h>
  14. #include <linux/mod_devicetable.h>
  15. #include <linux/of.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/property.h>
  18. #include <linux/regmap.h>
  19. #include <linux/seq_file.h>
  20. #include <linux/slab.h>
  21. #include <linux/pinctrl/consumer.h>
  22. #include <linux/pinctrl/pinconf-generic.h>
  23. #include <linux/pinctrl/pinconf.h>
  24. #include <linux/pinctrl/pinctrl.h>
  25. #include <linux/pinctrl/pinmux.h>
  26. #include "core.h"
  27. #include "pinconf.h"
  28. #include "pinmux.h"
  29. #define GPIO_PIN 0x00
  30. #define GPIO_MSK 0x20
  31. #define JZ4730_GPIO_DATA 0x00
  32. #define JZ4730_GPIO_GPDIR 0x04
  33. #define JZ4730_GPIO_GPPUR 0x0c
  34. #define JZ4730_GPIO_GPALR 0x10
  35. #define JZ4730_GPIO_GPAUR 0x14
  36. #define JZ4730_GPIO_GPIDLR 0x18
  37. #define JZ4730_GPIO_GPIDUR 0x1c
  38. #define JZ4730_GPIO_GPIER 0x20
  39. #define JZ4730_GPIO_GPIMR 0x24
  40. #define JZ4730_GPIO_GPFR 0x28
  41. #define JZ4740_GPIO_DATA 0x10
  42. #define JZ4740_GPIO_PULL_DIS 0x30
  43. #define JZ4740_GPIO_FUNC 0x40
  44. #define JZ4740_GPIO_SELECT 0x50
  45. #define JZ4740_GPIO_DIR 0x60
  46. #define JZ4740_GPIO_TRIG 0x70
  47. #define JZ4740_GPIO_FLAG 0x80
  48. #define JZ4770_GPIO_INT 0x10
  49. #define JZ4770_GPIO_PAT1 0x30
  50. #define JZ4770_GPIO_PAT0 0x40
  51. #define JZ4770_GPIO_FLAG 0x50
  52. #define JZ4770_GPIO_PEN 0x70
  53. #define X1830_GPIO_PEL 0x110
  54. #define X1830_GPIO_PEH 0x120
  55. #define X1830_GPIO_SR 0x150
  56. #define X1830_GPIO_SMT 0x160
  57. #define X2000_GPIO_EDG 0x70
  58. #define X2000_GPIO_PEPU 0x80
  59. #define X2000_GPIO_PEPD 0x90
  60. #define X2000_GPIO_SR 0xd0
  61. #define X2000_GPIO_SMT 0xe0
  62. #define REG_SET(x) ((x) + 0x4)
  63. #define REG_CLEAR(x) ((x) + 0x8)
  64. #define REG_PZ_BASE(x) ((x) * 7)
  65. #define REG_PZ_GID2LD(x) ((x) * 7 + 0xf0)
  66. #define GPIO_PULL_DIS 0
  67. #define GPIO_PULL_UP 1
  68. #define GPIO_PULL_DOWN 2
  69. #define PINS_PER_GPIO_CHIP 32
  70. #define JZ4730_PINS_PER_PAIRED_REG 16
  71. #define INGENIC_PIN_GROUP_FUNCS(_name_, id, funcs) \
  72. { \
  73. .grp = PINCTRL_PINGROUP(_name_, id##_pins, ARRAY_SIZE(id##_pins)), \
  74. .data = funcs, \
  75. }
  76. #define INGENIC_PIN_GROUP(_name_, id, func) \
  77. { \
  78. .grp = PINCTRL_PINGROUP(_name_, id##_pins, ARRAY_SIZE(id##_pins)), \
  79. .data = (void *)func, \
  80. }
  81. #define INGENIC_PIN_FUNCTION(_name_, id) \
  82. { \
  83. .func = PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups)), \
  84. .data = NULL, \
  85. }
  86. enum jz_version {
  87. ID_JZ4730,
  88. ID_JZ4740,
  89. ID_JZ4725B,
  90. ID_JZ4750,
  91. ID_JZ4755,
  92. ID_JZ4760,
  93. ID_JZ4770,
  94. ID_JZ4775,
  95. ID_JZ4780,
  96. ID_X1000,
  97. ID_X1500,
  98. ID_X1830,
  99. ID_X2000,
  100. ID_X2100,
  101. };
  102. struct ingenic_chip_info {
  103. unsigned int num_chips;
  104. unsigned int reg_offset;
  105. enum jz_version version;
  106. const struct group_desc *groups;
  107. unsigned int num_groups;
  108. const struct function_desc *functions;
  109. unsigned int num_functions;
  110. const u32 *pull_ups, *pull_downs;
  111. const struct regmap_access_table *access_table;
  112. };
  113. struct ingenic_pinctrl {
  114. struct device *dev;
  115. struct regmap *map;
  116. struct pinctrl_dev *pctl;
  117. struct pinctrl_pin_desc *pdesc;
  118. const struct ingenic_chip_info *info;
  119. struct gpio_chip *gc;
  120. };
  121. struct ingenic_gpio_chip {
  122. struct ingenic_pinctrl *jzpc;
  123. struct gpio_chip gc;
  124. unsigned int irq, reg_base;
  125. };
  126. static const unsigned long enabled_socs =
  127. IS_ENABLED(CONFIG_MACH_JZ4730) << ID_JZ4730 |
  128. IS_ENABLED(CONFIG_MACH_JZ4740) << ID_JZ4740 |
  129. IS_ENABLED(CONFIG_MACH_JZ4725B) << ID_JZ4725B |
  130. IS_ENABLED(CONFIG_MACH_JZ4750) << ID_JZ4750 |
  131. IS_ENABLED(CONFIG_MACH_JZ4755) << ID_JZ4755 |
  132. IS_ENABLED(CONFIG_MACH_JZ4760) << ID_JZ4760 |
  133. IS_ENABLED(CONFIG_MACH_JZ4770) << ID_JZ4770 |
  134. IS_ENABLED(CONFIG_MACH_JZ4775) << ID_JZ4775 |
  135. IS_ENABLED(CONFIG_MACH_JZ4780) << ID_JZ4780 |
  136. IS_ENABLED(CONFIG_MACH_X1000) << ID_X1000 |
  137. IS_ENABLED(CONFIG_MACH_X1500) << ID_X1500 |
  138. IS_ENABLED(CONFIG_MACH_X1830) << ID_X1830 |
  139. IS_ENABLED(CONFIG_MACH_X2000) << ID_X2000 |
  140. IS_ENABLED(CONFIG_MACH_X2100) << ID_X2100;
  141. static bool
  142. is_soc_or_above(const struct ingenic_pinctrl *jzpc, enum jz_version version)
  143. {
  144. return (enabled_socs >> version) &&
  145. (!(enabled_socs & GENMASK(version - 1, 0))
  146. || jzpc->info->version >= version);
  147. }
  148. static const u32 jz4730_pull_ups[4] = {
  149. 0x3fa3320f, 0xf200ffff, 0xffffffff, 0xffffffff,
  150. };
  151. static const u32 jz4730_pull_downs[4] = {
  152. 0x00000df0, 0x0dff0000, 0x00000000, 0x00000000,
  153. };
  154. static int jz4730_mmc_1bit_pins[] = { 0x27, 0x26, 0x22, };
  155. static int jz4730_mmc_4bit_pins[] = { 0x23, 0x24, 0x25, };
  156. static int jz4730_uart0_data_pins[] = { 0x7e, 0x7f, };
  157. static int jz4730_uart1_data_pins[] = { 0x18, 0x19, };
  158. static int jz4730_uart2_data_pins[] = { 0x6f, 0x7d, };
  159. static int jz4730_uart3_data_pins[] = { 0x10, 0x15, };
  160. static int jz4730_uart3_hwflow_pins[] = { 0x11, 0x17, };
  161. static int jz4730_lcd_8bit_pins[] = {
  162. 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
  163. 0x3a, 0x39, 0x38,
  164. };
  165. static int jz4730_lcd_16bit_pins[] = {
  166. 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
  167. };
  168. static int jz4730_lcd_special_pins[] = { 0x3d, 0x3c, 0x3e, 0x3f, };
  169. static int jz4730_lcd_generic_pins[] = { 0x3b, };
  170. static int jz4730_nand_cs1_pins[] = { 0x53, };
  171. static int jz4730_nand_cs2_pins[] = { 0x54, };
  172. static int jz4730_nand_cs3_pins[] = { 0x55, };
  173. static int jz4730_nand_cs4_pins[] = { 0x56, };
  174. static int jz4730_nand_cs5_pins[] = { 0x57, };
  175. static int jz4730_pwm_pwm0_pins[] = { 0x5e, };
  176. static int jz4730_pwm_pwm1_pins[] = { 0x5f, };
  177. static u8 jz4730_lcd_8bit_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, };
  178. static const struct group_desc jz4730_groups[] = {
  179. INGENIC_PIN_GROUP("mmc-1bit", jz4730_mmc_1bit, 1),
  180. INGENIC_PIN_GROUP("mmc-4bit", jz4730_mmc_4bit, 1),
  181. INGENIC_PIN_GROUP("uart0-data", jz4730_uart0_data, 1),
  182. INGENIC_PIN_GROUP("uart1-data", jz4730_uart1_data, 1),
  183. INGENIC_PIN_GROUP("uart2-data", jz4730_uart2_data, 1),
  184. INGENIC_PIN_GROUP("uart3-data", jz4730_uart3_data, 1),
  185. INGENIC_PIN_GROUP("uart3-hwflow", jz4730_uart3_hwflow, 1),
  186. INGENIC_PIN_GROUP_FUNCS("lcd-8bit", jz4730_lcd_8bit, jz4730_lcd_8bit_funcs),
  187. INGENIC_PIN_GROUP("lcd-16bit", jz4730_lcd_16bit, 1),
  188. INGENIC_PIN_GROUP("lcd-special", jz4730_lcd_special, 1),
  189. INGENIC_PIN_GROUP("lcd-generic", jz4730_lcd_generic, 1),
  190. INGENIC_PIN_GROUP("nand-cs1", jz4730_nand_cs1, 1),
  191. INGENIC_PIN_GROUP("nand-cs2", jz4730_nand_cs2, 1),
  192. INGENIC_PIN_GROUP("nand-cs3", jz4730_nand_cs3, 1),
  193. INGENIC_PIN_GROUP("nand-cs4", jz4730_nand_cs4, 1),
  194. INGENIC_PIN_GROUP("nand-cs5", jz4730_nand_cs5, 1),
  195. INGENIC_PIN_GROUP("pwm0", jz4730_pwm_pwm0, 1),
  196. INGENIC_PIN_GROUP("pwm1", jz4730_pwm_pwm1, 1),
  197. };
  198. static const char *jz4730_mmc_groups[] = { "mmc-1bit", "mmc-4bit", };
  199. static const char *jz4730_uart0_groups[] = { "uart0-data", };
  200. static const char *jz4730_uart1_groups[] = { "uart1-data", };
  201. static const char *jz4730_uart2_groups[] = { "uart2-data", };
  202. static const char *jz4730_uart3_groups[] = { "uart3-data", "uart3-hwflow", };
  203. static const char *jz4730_lcd_groups[] = {
  204. "lcd-8bit", "lcd-16bit", "lcd-special", "lcd-generic",
  205. };
  206. static const char *jz4730_nand_groups[] = {
  207. "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", "nand-cs5",
  208. };
  209. static const char *jz4730_pwm0_groups[] = { "pwm0", };
  210. static const char *jz4730_pwm1_groups[] = { "pwm1", };
  211. static const struct function_desc jz4730_functions[] = {
  212. INGENIC_PIN_FUNCTION("mmc", jz4730_mmc),
  213. INGENIC_PIN_FUNCTION("uart0", jz4730_uart0),
  214. INGENIC_PIN_FUNCTION("uart1", jz4730_uart1),
  215. INGENIC_PIN_FUNCTION("uart2", jz4730_uart2),
  216. INGENIC_PIN_FUNCTION("uart3", jz4730_uart3),
  217. INGENIC_PIN_FUNCTION("lcd", jz4730_lcd),
  218. INGENIC_PIN_FUNCTION("nand", jz4730_nand),
  219. INGENIC_PIN_FUNCTION("pwm0", jz4730_pwm0),
  220. INGENIC_PIN_FUNCTION("pwm1", jz4730_pwm1),
  221. };
  222. static const struct ingenic_chip_info jz4730_chip_info = {
  223. .num_chips = 4,
  224. .reg_offset = 0x30,
  225. .version = ID_JZ4730,
  226. .groups = jz4730_groups,
  227. .num_groups = ARRAY_SIZE(jz4730_groups),
  228. .functions = jz4730_functions,
  229. .num_functions = ARRAY_SIZE(jz4730_functions),
  230. .pull_ups = jz4730_pull_ups,
  231. .pull_downs = jz4730_pull_downs,
  232. };
  233. static const u32 jz4740_pull_ups[4] = {
  234. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
  235. };
  236. static const u32 jz4740_pull_downs[4] = {
  237. 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  238. };
  239. static int jz4740_mmc_1bit_pins[] = { 0x69, 0x68, 0x6a, };
  240. static int jz4740_mmc_4bit_pins[] = { 0x6b, 0x6c, 0x6d, };
  241. static int jz4740_uart0_data_pins[] = { 0x7a, 0x79, };
  242. static int jz4740_uart0_hwflow_pins[] = { 0x7e, 0x7f, };
  243. static int jz4740_uart1_data_pins[] = { 0x7e, 0x7f, };
  244. static int jz4740_lcd_8bit_pins[] = {
  245. 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
  246. 0x52, 0x53, 0x54,
  247. };
  248. static int jz4740_lcd_16bit_pins[] = {
  249. 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
  250. };
  251. static int jz4740_lcd_18bit_pins[] = { 0x50, 0x51, };
  252. static int jz4740_lcd_special_pins[] = { 0x31, 0x32, 0x56, 0x57, };
  253. static int jz4740_lcd_generic_pins[] = { 0x55, };
  254. static int jz4740_nand_cs1_pins[] = { 0x39, };
  255. static int jz4740_nand_cs2_pins[] = { 0x3a, };
  256. static int jz4740_nand_cs3_pins[] = { 0x3b, };
  257. static int jz4740_nand_cs4_pins[] = { 0x3c, };
  258. static int jz4740_nand_fre_fwe_pins[] = { 0x5c, 0x5d, };
  259. static int jz4740_pwm_pwm0_pins[] = { 0x77, };
  260. static int jz4740_pwm_pwm1_pins[] = { 0x78, };
  261. static int jz4740_pwm_pwm2_pins[] = { 0x79, };
  262. static int jz4740_pwm_pwm3_pins[] = { 0x7a, };
  263. static int jz4740_pwm_pwm4_pins[] = { 0x7b, };
  264. static int jz4740_pwm_pwm5_pins[] = { 0x7c, };
  265. static int jz4740_pwm_pwm6_pins[] = { 0x7e, };
  266. static int jz4740_pwm_pwm7_pins[] = { 0x7f, };
  267. static const struct group_desc jz4740_groups[] = {
  268. INGENIC_PIN_GROUP("mmc-1bit", jz4740_mmc_1bit, 0),
  269. INGENIC_PIN_GROUP("mmc-4bit", jz4740_mmc_4bit, 0),
  270. INGENIC_PIN_GROUP("uart0-data", jz4740_uart0_data, 1),
  271. INGENIC_PIN_GROUP("uart0-hwflow", jz4740_uart0_hwflow, 1),
  272. INGENIC_PIN_GROUP("uart1-data", jz4740_uart1_data, 2),
  273. INGENIC_PIN_GROUP("lcd-8bit", jz4740_lcd_8bit, 0),
  274. INGENIC_PIN_GROUP("lcd-16bit", jz4740_lcd_16bit, 0),
  275. INGENIC_PIN_GROUP("lcd-18bit", jz4740_lcd_18bit, 0),
  276. INGENIC_PIN_GROUP("lcd-special", jz4740_lcd_special, 0),
  277. INGENIC_PIN_GROUP("lcd-generic", jz4740_lcd_generic, 0),
  278. INGENIC_PIN_GROUP("nand-cs1", jz4740_nand_cs1, 0),
  279. INGENIC_PIN_GROUP("nand-cs2", jz4740_nand_cs2, 0),
  280. INGENIC_PIN_GROUP("nand-cs3", jz4740_nand_cs3, 0),
  281. INGENIC_PIN_GROUP("nand-cs4", jz4740_nand_cs4, 0),
  282. INGENIC_PIN_GROUP("nand-fre-fwe", jz4740_nand_fre_fwe, 0),
  283. INGENIC_PIN_GROUP("pwm0", jz4740_pwm_pwm0, 0),
  284. INGENIC_PIN_GROUP("pwm1", jz4740_pwm_pwm1, 0),
  285. INGENIC_PIN_GROUP("pwm2", jz4740_pwm_pwm2, 0),
  286. INGENIC_PIN_GROUP("pwm3", jz4740_pwm_pwm3, 0),
  287. INGENIC_PIN_GROUP("pwm4", jz4740_pwm_pwm4, 0),
  288. INGENIC_PIN_GROUP("pwm5", jz4740_pwm_pwm5, 0),
  289. INGENIC_PIN_GROUP("pwm6", jz4740_pwm_pwm6, 0),
  290. INGENIC_PIN_GROUP("pwm7", jz4740_pwm_pwm7, 0),
  291. };
  292. static const char *jz4740_mmc_groups[] = { "mmc-1bit", "mmc-4bit", };
  293. static const char *jz4740_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  294. static const char *jz4740_uart1_groups[] = { "uart1-data", };
  295. static const char *jz4740_lcd_groups[] = {
  296. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-special", "lcd-generic",
  297. };
  298. static const char *jz4740_nand_groups[] = {
  299. "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", "nand-fre-fwe",
  300. };
  301. static const char *jz4740_pwm0_groups[] = { "pwm0", };
  302. static const char *jz4740_pwm1_groups[] = { "pwm1", };
  303. static const char *jz4740_pwm2_groups[] = { "pwm2", };
  304. static const char *jz4740_pwm3_groups[] = { "pwm3", };
  305. static const char *jz4740_pwm4_groups[] = { "pwm4", };
  306. static const char *jz4740_pwm5_groups[] = { "pwm5", };
  307. static const char *jz4740_pwm6_groups[] = { "pwm6", };
  308. static const char *jz4740_pwm7_groups[] = { "pwm7", };
  309. static const struct function_desc jz4740_functions[] = {
  310. INGENIC_PIN_FUNCTION("mmc", jz4740_mmc),
  311. INGENIC_PIN_FUNCTION("uart0", jz4740_uart0),
  312. INGENIC_PIN_FUNCTION("uart1", jz4740_uart1),
  313. INGENIC_PIN_FUNCTION("lcd", jz4740_lcd),
  314. INGENIC_PIN_FUNCTION("nand", jz4740_nand),
  315. INGENIC_PIN_FUNCTION("pwm0", jz4740_pwm0),
  316. INGENIC_PIN_FUNCTION("pwm1", jz4740_pwm1),
  317. INGENIC_PIN_FUNCTION("pwm2", jz4740_pwm2),
  318. INGENIC_PIN_FUNCTION("pwm3", jz4740_pwm3),
  319. INGENIC_PIN_FUNCTION("pwm4", jz4740_pwm4),
  320. INGENIC_PIN_FUNCTION("pwm5", jz4740_pwm5),
  321. INGENIC_PIN_FUNCTION("pwm6", jz4740_pwm6),
  322. INGENIC_PIN_FUNCTION("pwm7", jz4740_pwm7),
  323. };
  324. static const struct ingenic_chip_info jz4740_chip_info = {
  325. .num_chips = 4,
  326. .reg_offset = 0x100,
  327. .version = ID_JZ4740,
  328. .groups = jz4740_groups,
  329. .num_groups = ARRAY_SIZE(jz4740_groups),
  330. .functions = jz4740_functions,
  331. .num_functions = ARRAY_SIZE(jz4740_functions),
  332. .pull_ups = jz4740_pull_ups,
  333. .pull_downs = jz4740_pull_downs,
  334. };
  335. static int jz4725b_mmc0_1bit_pins[] = { 0x48, 0x49, 0x5c, };
  336. static int jz4725b_mmc0_4bit_pins[] = { 0x5d, 0x5b, 0x56, };
  337. static int jz4725b_mmc1_1bit_pins[] = { 0x7a, 0x7b, 0x7c, };
  338. static int jz4725b_mmc1_4bit_pins[] = { 0x7d, 0x7e, 0x7f, };
  339. static int jz4725b_uart_data_pins[] = { 0x4c, 0x4d, };
  340. static int jz4725b_lcd_8bit_pins[] = {
  341. 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  342. 0x72, 0x73, 0x74,
  343. };
  344. static int jz4725b_lcd_16bit_pins[] = {
  345. 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
  346. };
  347. static int jz4725b_lcd_18bit_pins[] = { 0x70, 0x71, };
  348. static int jz4725b_lcd_24bit_pins[] = { 0x76, 0x77, 0x78, 0x79, };
  349. static int jz4725b_lcd_special_pins[] = { 0x76, 0x77, 0x78, 0x79, };
  350. static int jz4725b_lcd_generic_pins[] = { 0x75, };
  351. static int jz4725b_nand_cs1_pins[] = { 0x55, };
  352. static int jz4725b_nand_cs2_pins[] = { 0x56, };
  353. static int jz4725b_nand_cs3_pins[] = { 0x57, };
  354. static int jz4725b_nand_cs4_pins[] = { 0x58, };
  355. static int jz4725b_nand_cle_ale_pins[] = { 0x48, 0x49 };
  356. static int jz4725b_nand_fre_fwe_pins[] = { 0x5c, 0x5d };
  357. static int jz4725b_pwm_pwm0_pins[] = { 0x4a, };
  358. static int jz4725b_pwm_pwm1_pins[] = { 0x4b, };
  359. static int jz4725b_pwm_pwm2_pins[] = { 0x4c, };
  360. static int jz4725b_pwm_pwm3_pins[] = { 0x4d, };
  361. static int jz4725b_pwm_pwm4_pins[] = { 0x4e, };
  362. static int jz4725b_pwm_pwm5_pins[] = { 0x4f, };
  363. static u8 jz4725b_mmc0_4bit_funcs[] = { 1, 0, 1, };
  364. static const struct group_desc jz4725b_groups[] = {
  365. INGENIC_PIN_GROUP("mmc0-1bit", jz4725b_mmc0_1bit, 1),
  366. INGENIC_PIN_GROUP_FUNCS("mmc0-4bit", jz4725b_mmc0_4bit,
  367. jz4725b_mmc0_4bit_funcs),
  368. INGENIC_PIN_GROUP("mmc1-1bit", jz4725b_mmc1_1bit, 0),
  369. INGENIC_PIN_GROUP("mmc1-4bit", jz4725b_mmc1_4bit, 0),
  370. INGENIC_PIN_GROUP("uart-data", jz4725b_uart_data, 1),
  371. INGENIC_PIN_GROUP("lcd-8bit", jz4725b_lcd_8bit, 0),
  372. INGENIC_PIN_GROUP("lcd-16bit", jz4725b_lcd_16bit, 0),
  373. INGENIC_PIN_GROUP("lcd-18bit", jz4725b_lcd_18bit, 0),
  374. INGENIC_PIN_GROUP("lcd-24bit", jz4725b_lcd_24bit, 1),
  375. INGENIC_PIN_GROUP("lcd-special", jz4725b_lcd_special, 0),
  376. INGENIC_PIN_GROUP("lcd-generic", jz4725b_lcd_generic, 0),
  377. INGENIC_PIN_GROUP("nand-cs1", jz4725b_nand_cs1, 0),
  378. INGENIC_PIN_GROUP("nand-cs2", jz4725b_nand_cs2, 0),
  379. INGENIC_PIN_GROUP("nand-cs3", jz4725b_nand_cs3, 0),
  380. INGENIC_PIN_GROUP("nand-cs4", jz4725b_nand_cs4, 0),
  381. INGENIC_PIN_GROUP("nand-cle-ale", jz4725b_nand_cle_ale, 0),
  382. INGENIC_PIN_GROUP("nand-fre-fwe", jz4725b_nand_fre_fwe, 0),
  383. INGENIC_PIN_GROUP("pwm0", jz4725b_pwm_pwm0, 0),
  384. INGENIC_PIN_GROUP("pwm1", jz4725b_pwm_pwm1, 0),
  385. INGENIC_PIN_GROUP("pwm2", jz4725b_pwm_pwm2, 0),
  386. INGENIC_PIN_GROUP("pwm3", jz4725b_pwm_pwm3, 0),
  387. INGENIC_PIN_GROUP("pwm4", jz4725b_pwm_pwm4, 0),
  388. INGENIC_PIN_GROUP("pwm5", jz4725b_pwm_pwm5, 0),
  389. };
  390. static const char *jz4725b_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", };
  391. static const char *jz4725b_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", };
  392. static const char *jz4725b_uart_groups[] = { "uart-data", };
  393. static const char *jz4725b_lcd_groups[] = {
  394. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-24bit",
  395. "lcd-special", "lcd-generic",
  396. };
  397. static const char *jz4725b_nand_groups[] = {
  398. "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4",
  399. "nand-cle-ale", "nand-fre-fwe",
  400. };
  401. static const char *jz4725b_pwm0_groups[] = { "pwm0", };
  402. static const char *jz4725b_pwm1_groups[] = { "pwm1", };
  403. static const char *jz4725b_pwm2_groups[] = { "pwm2", };
  404. static const char *jz4725b_pwm3_groups[] = { "pwm3", };
  405. static const char *jz4725b_pwm4_groups[] = { "pwm4", };
  406. static const char *jz4725b_pwm5_groups[] = { "pwm5", };
  407. static const struct function_desc jz4725b_functions[] = {
  408. INGENIC_PIN_FUNCTION("mmc0", jz4725b_mmc0),
  409. INGENIC_PIN_FUNCTION("mmc1", jz4725b_mmc1),
  410. INGENIC_PIN_FUNCTION("uart", jz4725b_uart),
  411. INGENIC_PIN_FUNCTION("nand", jz4725b_nand),
  412. INGENIC_PIN_FUNCTION("pwm0", jz4725b_pwm0),
  413. INGENIC_PIN_FUNCTION("pwm1", jz4725b_pwm1),
  414. INGENIC_PIN_FUNCTION("pwm2", jz4725b_pwm2),
  415. INGENIC_PIN_FUNCTION("pwm3", jz4725b_pwm3),
  416. INGENIC_PIN_FUNCTION("pwm4", jz4725b_pwm4),
  417. INGENIC_PIN_FUNCTION("pwm5", jz4725b_pwm5),
  418. INGENIC_PIN_FUNCTION("lcd", jz4725b_lcd),
  419. };
  420. static const struct ingenic_chip_info jz4725b_chip_info = {
  421. .num_chips = 4,
  422. .reg_offset = 0x100,
  423. .version = ID_JZ4725B,
  424. .groups = jz4725b_groups,
  425. .num_groups = ARRAY_SIZE(jz4725b_groups),
  426. .functions = jz4725b_functions,
  427. .num_functions = ARRAY_SIZE(jz4725b_functions),
  428. .pull_ups = jz4740_pull_ups,
  429. .pull_downs = jz4740_pull_downs,
  430. };
  431. static const u32 jz4750_pull_ups[6] = {
  432. 0xffffffff, 0xffffffff, 0x3fffffff, 0x7fffffff, 0x1fff3fff, 0x00ffffff,
  433. };
  434. static const u32 jz4750_pull_downs[6] = {
  435. 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  436. };
  437. static int jz4750_uart0_data_pins[] = { 0xa4, 0xa5, };
  438. static int jz4750_uart0_hwflow_pins[] = { 0xa6, 0xa7, };
  439. static int jz4750_uart1_data_pins[] = { 0x90, 0x91, };
  440. static int jz4750_uart1_hwflow_pins[] = { 0x92, 0x93, };
  441. static int jz4750_uart2_data_pins[] = { 0x9b, 0x9a, };
  442. static int jz4750_uart3_data_pins[] = { 0xb0, 0xb1, };
  443. static int jz4750_uart3_hwflow_pins[] = { 0xb2, 0xb3, };
  444. static int jz4750_mmc0_1bit_pins[] = { 0xa8, 0xa9, 0xa0, };
  445. static int jz4750_mmc0_4bit_pins[] = { 0xa1, 0xa2, 0xa3, };
  446. static int jz4750_mmc0_8bit_pins[] = { 0xa4, 0xa5, 0xa6, 0xa7, };
  447. static int jz4750_mmc1_1bit_pins[] = { 0xae, 0xaf, 0xaa, };
  448. static int jz4750_mmc1_4bit_pins[] = { 0xab, 0xac, 0xad, };
  449. static int jz4750_i2c_pins[] = { 0x8c, 0x8d, };
  450. static int jz4750_cim_pins[] = {
  451. 0x89, 0x8b, 0x8a, 0x88,
  452. 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
  453. };
  454. static int jz4750_lcd_8bit_pins[] = {
  455. 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  456. 0x72, 0x73, 0x74,
  457. };
  458. static int jz4750_lcd_16bit_pins[] = {
  459. 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
  460. };
  461. static int jz4750_lcd_18bit_pins[] = { 0x70, 0x71, };
  462. static int jz4750_lcd_24bit_pins[] = { 0x76, 0x77, 0x78, 0x79, 0xb2, 0xb3, };
  463. static int jz4750_lcd_special_pins[] = { 0x76, 0x77, 0x78, 0x79, };
  464. static int jz4750_lcd_generic_pins[] = { 0x75, };
  465. static int jz4750_nand_cs1_pins[] = { 0x55, };
  466. static int jz4750_nand_cs2_pins[] = { 0x56, };
  467. static int jz4750_nand_cs3_pins[] = { 0x57, };
  468. static int jz4750_nand_cs4_pins[] = { 0x58, };
  469. static int jz4750_nand_fre_fwe_pins[] = { 0x5c, 0x5d, };
  470. static int jz4750_pwm_pwm0_pins[] = { 0x94, };
  471. static int jz4750_pwm_pwm1_pins[] = { 0x95, };
  472. static int jz4750_pwm_pwm2_pins[] = { 0x96, };
  473. static int jz4750_pwm_pwm3_pins[] = { 0x97, };
  474. static int jz4750_pwm_pwm4_pins[] = { 0x98, };
  475. static int jz4750_pwm_pwm5_pins[] = { 0x99, };
  476. static const struct group_desc jz4750_groups[] = {
  477. INGENIC_PIN_GROUP("uart0-data", jz4750_uart0_data, 1),
  478. INGENIC_PIN_GROUP("uart0-hwflow", jz4750_uart0_hwflow, 1),
  479. INGENIC_PIN_GROUP("uart1-data", jz4750_uart1_data, 0),
  480. INGENIC_PIN_GROUP("uart1-hwflow", jz4750_uart1_hwflow, 0),
  481. INGENIC_PIN_GROUP("uart2-data", jz4750_uart2_data, 1),
  482. INGENIC_PIN_GROUP("uart3-data", jz4750_uart3_data, 0),
  483. INGENIC_PIN_GROUP("uart3-hwflow", jz4750_uart3_hwflow, 0),
  484. INGENIC_PIN_GROUP("mmc0-1bit", jz4750_mmc0_1bit, 0),
  485. INGENIC_PIN_GROUP("mmc0-4bit", jz4750_mmc0_4bit, 0),
  486. INGENIC_PIN_GROUP("mmc0-8bit", jz4750_mmc0_8bit, 0),
  487. INGENIC_PIN_GROUP("mmc1-1bit", jz4750_mmc1_1bit, 0),
  488. INGENIC_PIN_GROUP("mmc1-4bit", jz4750_mmc1_4bit, 0),
  489. INGENIC_PIN_GROUP("i2c-data", jz4750_i2c, 0),
  490. INGENIC_PIN_GROUP("cim-data", jz4750_cim, 0),
  491. INGENIC_PIN_GROUP("lcd-8bit", jz4750_lcd_8bit, 0),
  492. INGENIC_PIN_GROUP("lcd-16bit", jz4750_lcd_16bit, 0),
  493. INGENIC_PIN_GROUP("lcd-18bit", jz4750_lcd_18bit, 0),
  494. INGENIC_PIN_GROUP("lcd-24bit", jz4750_lcd_24bit, 1),
  495. INGENIC_PIN_GROUP("lcd-special", jz4750_lcd_special, 0),
  496. INGENIC_PIN_GROUP("lcd-generic", jz4750_lcd_generic, 0),
  497. INGENIC_PIN_GROUP("nand-cs1", jz4750_nand_cs1, 0),
  498. INGENIC_PIN_GROUP("nand-cs2", jz4750_nand_cs2, 0),
  499. INGENIC_PIN_GROUP("nand-cs3", jz4750_nand_cs3, 0),
  500. INGENIC_PIN_GROUP("nand-cs4", jz4750_nand_cs4, 0),
  501. INGENIC_PIN_GROUP("nand-fre-fwe", jz4750_nand_fre_fwe, 0),
  502. INGENIC_PIN_GROUP("pwm0", jz4750_pwm_pwm0, 0),
  503. INGENIC_PIN_GROUP("pwm1", jz4750_pwm_pwm1, 0),
  504. INGENIC_PIN_GROUP("pwm2", jz4750_pwm_pwm2, 0),
  505. INGENIC_PIN_GROUP("pwm3", jz4750_pwm_pwm3, 0),
  506. INGENIC_PIN_GROUP("pwm4", jz4750_pwm_pwm4, 0),
  507. INGENIC_PIN_GROUP("pwm5", jz4750_pwm_pwm5, 0),
  508. };
  509. static const char *jz4750_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  510. static const char *jz4750_uart1_groups[] = { "uart1-data", "uart1-hwflow", };
  511. static const char *jz4750_uart2_groups[] = { "uart2-data", };
  512. static const char *jz4750_uart3_groups[] = { "uart3-data", "uart3-hwflow", };
  513. static const char *jz4750_mmc0_groups[] = {
  514. "mmc0-1bit", "mmc0-4bit", "mmc0-8bit",
  515. };
  516. static const char *jz4750_mmc1_groups[] = { "mmc0-1bit", "mmc0-4bit", };
  517. static const char *jz4750_i2c_groups[] = { "i2c-data", };
  518. static const char *jz4750_cim_groups[] = { "cim-data", };
  519. static const char *jz4750_lcd_groups[] = {
  520. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-24bit",
  521. "lcd-special", "lcd-generic",
  522. };
  523. static const char *jz4750_nand_groups[] = {
  524. "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", "nand-fre-fwe",
  525. };
  526. static const char *jz4750_pwm0_groups[] = { "pwm0", };
  527. static const char *jz4750_pwm1_groups[] = { "pwm1", };
  528. static const char *jz4750_pwm2_groups[] = { "pwm2", };
  529. static const char *jz4750_pwm3_groups[] = { "pwm3", };
  530. static const char *jz4750_pwm4_groups[] = { "pwm4", };
  531. static const char *jz4750_pwm5_groups[] = { "pwm5", };
  532. static const struct function_desc jz4750_functions[] = {
  533. INGENIC_PIN_FUNCTION("uart0", jz4750_uart0),
  534. INGENIC_PIN_FUNCTION("uart1", jz4750_uart1),
  535. INGENIC_PIN_FUNCTION("uart2", jz4750_uart2),
  536. INGENIC_PIN_FUNCTION("uart3", jz4750_uart3),
  537. INGENIC_PIN_FUNCTION("mmc0", jz4750_mmc0),
  538. INGENIC_PIN_FUNCTION("mmc1", jz4750_mmc1),
  539. INGENIC_PIN_FUNCTION("i2c", jz4750_i2c),
  540. INGENIC_PIN_FUNCTION("cim", jz4750_cim),
  541. INGENIC_PIN_FUNCTION("lcd", jz4750_lcd),
  542. INGENIC_PIN_FUNCTION("nand", jz4750_nand),
  543. INGENIC_PIN_FUNCTION("pwm0", jz4750_pwm0),
  544. INGENIC_PIN_FUNCTION("pwm1", jz4750_pwm1),
  545. INGENIC_PIN_FUNCTION("pwm2", jz4750_pwm2),
  546. INGENIC_PIN_FUNCTION("pwm3", jz4750_pwm3),
  547. INGENIC_PIN_FUNCTION("pwm4", jz4750_pwm4),
  548. INGENIC_PIN_FUNCTION("pwm5", jz4750_pwm5),
  549. };
  550. static const struct ingenic_chip_info jz4750_chip_info = {
  551. .num_chips = 6,
  552. .reg_offset = 0x100,
  553. .version = ID_JZ4750,
  554. .groups = jz4750_groups,
  555. .num_groups = ARRAY_SIZE(jz4750_groups),
  556. .functions = jz4750_functions,
  557. .num_functions = ARRAY_SIZE(jz4750_functions),
  558. .pull_ups = jz4750_pull_ups,
  559. .pull_downs = jz4750_pull_downs,
  560. };
  561. static const u32 jz4755_pull_ups[6] = {
  562. 0xffffffff, 0xffffffff, 0x0fffffff, 0xffffffff, 0x33dc3fff, 0x0000fc00,
  563. };
  564. static const u32 jz4755_pull_downs[6] = {
  565. 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  566. };
  567. static int jz4755_uart0_data_pins[] = { 0x7c, 0x7d, };
  568. static int jz4755_uart0_hwflow_pins[] = { 0x7e, 0x7f, };
  569. static int jz4755_uart1_data_pins[] = { 0x97, 0x99, };
  570. static int jz4755_uart2_data_pins[] = { 0x9f, };
  571. static int jz4755_ssi_dt_b_pins[] = { 0x3b, };
  572. static int jz4755_ssi_dt_f_pins[] = { 0xa1, };
  573. static int jz4755_ssi_dr_b_pins[] = { 0x3c, };
  574. static int jz4755_ssi_dr_f_pins[] = { 0xa2, };
  575. static int jz4755_ssi_clk_b_pins[] = { 0x3a, };
  576. static int jz4755_ssi_clk_f_pins[] = { 0xa0, };
  577. static int jz4755_ssi_gpc_b_pins[] = { 0x3e, };
  578. static int jz4755_ssi_gpc_f_pins[] = { 0xa4, };
  579. static int jz4755_ssi_ce0_b_pins[] = { 0x3d, };
  580. static int jz4755_ssi_ce0_f_pins[] = { 0xa3, };
  581. static int jz4755_ssi_ce1_b_pins[] = { 0x3f, };
  582. static int jz4755_ssi_ce1_f_pins[] = { 0xa5, };
  583. static int jz4755_mmc0_1bit_pins[] = { 0x2f, 0x50, 0x5c, };
  584. static int jz4755_mmc0_4bit_pins[] = { 0x5d, 0x5b, 0x51, };
  585. static int jz4755_mmc1_1bit_pins[] = { 0x3a, 0x3d, 0x3c, };
  586. static int jz4755_mmc1_4bit_pins[] = { 0x3b, 0x3e, 0x3f, };
  587. static int jz4755_i2c_pins[] = { 0x8c, 0x8d, };
  588. static int jz4755_cim_pins[] = {
  589. 0x89, 0x8b, 0x8a, 0x88,
  590. 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
  591. };
  592. static int jz4755_lcd_8bit_pins[] = {
  593. 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  594. 0x72, 0x73, 0x74,
  595. };
  596. static int jz4755_lcd_16bit_pins[] = {
  597. 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
  598. };
  599. static int jz4755_lcd_18bit_pins[] = { 0x70, 0x71, };
  600. static int jz4755_lcd_24bit_pins[] = { 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, };
  601. static int jz4755_lcd_special_pins[] = { 0x76, 0x77, 0x78, 0x79, };
  602. static int jz4755_lcd_generic_pins[] = { 0x75, };
  603. static int jz4755_nand_cs1_pins[] = { 0x55, };
  604. static int jz4755_nand_cs2_pins[] = { 0x56, };
  605. static int jz4755_nand_cs3_pins[] = { 0x57, };
  606. static int jz4755_nand_cs4_pins[] = { 0x58, };
  607. static int jz4755_nand_fre_fwe_pins[] = { 0x5c, 0x5d, };
  608. static int jz4755_pwm_pwm0_pins[] = { 0x94, };
  609. static int jz4755_pwm_pwm1_pins[] = { 0xab, };
  610. static int jz4755_pwm_pwm2_pins[] = { 0x96, };
  611. static int jz4755_pwm_pwm3_pins[] = { 0x97, };
  612. static int jz4755_pwm_pwm4_pins[] = { 0x98, };
  613. static int jz4755_pwm_pwm5_pins[] = { 0x99, };
  614. static u8 jz4755_mmc0_1bit_funcs[] = { 2, 2, 1, };
  615. static u8 jz4755_mmc0_4bit_funcs[] = { 1, 0, 1, };
  616. static u8 jz4755_lcd_24bit_funcs[] = { 1, 1, 1, 1, 0, 0, };
  617. static const struct group_desc jz4755_groups[] = {
  618. INGENIC_PIN_GROUP("uart0-data", jz4755_uart0_data, 0),
  619. INGENIC_PIN_GROUP("uart0-hwflow", jz4755_uart0_hwflow, 0),
  620. INGENIC_PIN_GROUP("uart1-data", jz4755_uart1_data, 1),
  621. INGENIC_PIN_GROUP("uart2-data", jz4755_uart2_data, 1),
  622. INGENIC_PIN_GROUP("ssi-dt-b", jz4755_ssi_dt_b, 0),
  623. INGENIC_PIN_GROUP("ssi-dt-f", jz4755_ssi_dt_f, 0),
  624. INGENIC_PIN_GROUP("ssi-dr-b", jz4755_ssi_dr_b, 0),
  625. INGENIC_PIN_GROUP("ssi-dr-f", jz4755_ssi_dr_f, 0),
  626. INGENIC_PIN_GROUP("ssi-clk-b", jz4755_ssi_clk_b, 0),
  627. INGENIC_PIN_GROUP("ssi-clk-f", jz4755_ssi_clk_f, 0),
  628. INGENIC_PIN_GROUP("ssi-gpc-b", jz4755_ssi_gpc_b, 0),
  629. INGENIC_PIN_GROUP("ssi-gpc-f", jz4755_ssi_gpc_f, 0),
  630. INGENIC_PIN_GROUP("ssi-ce0-b", jz4755_ssi_ce0_b, 0),
  631. INGENIC_PIN_GROUP("ssi-ce0-f", jz4755_ssi_ce0_f, 0),
  632. INGENIC_PIN_GROUP("ssi-ce1-b", jz4755_ssi_ce1_b, 0),
  633. INGENIC_PIN_GROUP("ssi-ce1-f", jz4755_ssi_ce1_f, 0),
  634. INGENIC_PIN_GROUP_FUNCS("mmc0-1bit", jz4755_mmc0_1bit,
  635. jz4755_mmc0_1bit_funcs),
  636. INGENIC_PIN_GROUP_FUNCS("mmc0-4bit", jz4755_mmc0_4bit,
  637. jz4755_mmc0_4bit_funcs),
  638. INGENIC_PIN_GROUP("mmc1-1bit", jz4755_mmc1_1bit, 1),
  639. INGENIC_PIN_GROUP("mmc1-4bit", jz4755_mmc1_4bit, 1),
  640. INGENIC_PIN_GROUP("i2c-data", jz4755_i2c, 0),
  641. INGENIC_PIN_GROUP("cim-data", jz4755_cim, 0),
  642. INGENIC_PIN_GROUP("lcd-8bit", jz4755_lcd_8bit, 0),
  643. INGENIC_PIN_GROUP("lcd-16bit", jz4755_lcd_16bit, 0),
  644. INGENIC_PIN_GROUP("lcd-18bit", jz4755_lcd_18bit, 0),
  645. INGENIC_PIN_GROUP_FUNCS("lcd-24bit", jz4755_lcd_24bit,
  646. jz4755_lcd_24bit_funcs),
  647. INGENIC_PIN_GROUP("lcd-special", jz4755_lcd_special, 0),
  648. INGENIC_PIN_GROUP("lcd-generic", jz4755_lcd_generic, 0),
  649. INGENIC_PIN_GROUP("nand-cs1", jz4755_nand_cs1, 0),
  650. INGENIC_PIN_GROUP("nand-cs2", jz4755_nand_cs2, 0),
  651. INGENIC_PIN_GROUP("nand-cs3", jz4755_nand_cs3, 0),
  652. INGENIC_PIN_GROUP("nand-cs4", jz4755_nand_cs4, 0),
  653. INGENIC_PIN_GROUP("nand-fre-fwe", jz4755_nand_fre_fwe, 0),
  654. INGENIC_PIN_GROUP("pwm0", jz4755_pwm_pwm0, 0),
  655. INGENIC_PIN_GROUP("pwm1", jz4755_pwm_pwm1, 1),
  656. INGENIC_PIN_GROUP("pwm2", jz4755_pwm_pwm2, 0),
  657. INGENIC_PIN_GROUP("pwm3", jz4755_pwm_pwm3, 0),
  658. INGENIC_PIN_GROUP("pwm4", jz4755_pwm_pwm4, 0),
  659. INGENIC_PIN_GROUP("pwm5", jz4755_pwm_pwm5, 0),
  660. };
  661. static const char *jz4755_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  662. static const char *jz4755_uart1_groups[] = { "uart1-data", };
  663. static const char *jz4755_uart2_groups[] = { "uart2-data", };
  664. static const char *jz4755_ssi_groups[] = {
  665. "ssi-dt-b", "ssi-dt-f",
  666. "ssi-dr-b", "ssi-dr-f",
  667. "ssi-clk-b", "ssi-clk-f",
  668. "ssi-gpc-b", "ssi-gpc-f",
  669. "ssi-ce0-b", "ssi-ce0-f",
  670. "ssi-ce1-b", "ssi-ce1-f",
  671. };
  672. static const char *jz4755_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", };
  673. static const char *jz4755_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", };
  674. static const char *jz4755_i2c_groups[] = { "i2c-data", };
  675. static const char *jz4755_cim_groups[] = { "cim-data", };
  676. static const char *jz4755_lcd_groups[] = {
  677. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-24bit",
  678. "lcd-special", "lcd-generic",
  679. };
  680. static const char *jz4755_nand_groups[] = {
  681. "nand-cs1", "nand-cs2", "nand-cs3", "nand-cs4", "nand-fre-fwe",
  682. };
  683. static const char *jz4755_pwm0_groups[] = { "pwm0", };
  684. static const char *jz4755_pwm1_groups[] = { "pwm1", };
  685. static const char *jz4755_pwm2_groups[] = { "pwm2", };
  686. static const char *jz4755_pwm3_groups[] = { "pwm3", };
  687. static const char *jz4755_pwm4_groups[] = { "pwm4", };
  688. static const char *jz4755_pwm5_groups[] = { "pwm5", };
  689. static const struct function_desc jz4755_functions[] = {
  690. INGENIC_PIN_FUNCTION("uart0", jz4755_uart0),
  691. INGENIC_PIN_FUNCTION("uart1", jz4755_uart1),
  692. INGENIC_PIN_FUNCTION("uart2", jz4755_uart2),
  693. INGENIC_PIN_FUNCTION("ssi", jz4755_ssi),
  694. INGENIC_PIN_FUNCTION("mmc0", jz4755_mmc0),
  695. INGENIC_PIN_FUNCTION("mmc1", jz4755_mmc1),
  696. INGENIC_PIN_FUNCTION("i2c", jz4755_i2c),
  697. INGENIC_PIN_FUNCTION("cim", jz4755_cim),
  698. INGENIC_PIN_FUNCTION("lcd", jz4755_lcd),
  699. INGENIC_PIN_FUNCTION("nand", jz4755_nand),
  700. INGENIC_PIN_FUNCTION("pwm0", jz4755_pwm0),
  701. INGENIC_PIN_FUNCTION("pwm1", jz4755_pwm1),
  702. INGENIC_PIN_FUNCTION("pwm2", jz4755_pwm2),
  703. INGENIC_PIN_FUNCTION("pwm3", jz4755_pwm3),
  704. INGENIC_PIN_FUNCTION("pwm4", jz4755_pwm4),
  705. INGENIC_PIN_FUNCTION("pwm5", jz4755_pwm5),
  706. };
  707. static const struct ingenic_chip_info jz4755_chip_info = {
  708. .num_chips = 6,
  709. .reg_offset = 0x100,
  710. .version = ID_JZ4755,
  711. .groups = jz4755_groups,
  712. .num_groups = ARRAY_SIZE(jz4755_groups),
  713. .functions = jz4755_functions,
  714. .num_functions = ARRAY_SIZE(jz4755_functions),
  715. .pull_ups = jz4755_pull_ups,
  716. .pull_downs = jz4755_pull_downs,
  717. };
  718. static const u32 jz4760_pull_ups[6] = {
  719. 0xffffffff, 0xfffcf3ff, 0xffffffff, 0xffffcfff, 0xfffffb7c, 0x0000000f,
  720. };
  721. static const u32 jz4760_pull_downs[6] = {
  722. 0x00000000, 0x00030c00, 0x00000000, 0x00003000, 0x00000483, 0x00000ff0,
  723. };
  724. static int jz4760_uart0_data_pins[] = { 0xa0, 0xa3, };
  725. static int jz4760_uart0_hwflow_pins[] = { 0xa1, 0xa2, };
  726. static int jz4760_uart1_data_pins[] = { 0x7a, 0x7c, };
  727. static int jz4760_uart1_hwflow_pins[] = { 0x7b, 0x7d, };
  728. static int jz4760_uart2_data_pins[] = { 0x5c, 0x5e, };
  729. static int jz4760_uart2_hwflow_pins[] = { 0x5d, 0x5f, };
  730. static int jz4760_uart3_data_pins[] = { 0x6c, 0x85, };
  731. static int jz4760_uart3_hwflow_pins[] = { 0x88, 0x89, };
  732. static int jz4760_ssi0_dt_a_pins[] = { 0x15, };
  733. static int jz4760_ssi0_dt_b_pins[] = { 0x35, };
  734. static int jz4760_ssi0_dt_d_pins[] = { 0x75, };
  735. static int jz4760_ssi0_dt_e_pins[] = { 0x91, };
  736. static int jz4760_ssi0_dr_a_pins[] = { 0x14, };
  737. static int jz4760_ssi0_dr_b_pins[] = { 0x34, };
  738. static int jz4760_ssi0_dr_d_pins[] = { 0x74, };
  739. static int jz4760_ssi0_dr_e_pins[] = { 0x8e, };
  740. static int jz4760_ssi0_clk_a_pins[] = { 0x12, };
  741. static int jz4760_ssi0_clk_b_pins[] = { 0x3c, };
  742. static int jz4760_ssi0_clk_d_pins[] = { 0x78, };
  743. static int jz4760_ssi0_clk_e_pins[] = { 0x8f, };
  744. static int jz4760_ssi0_gpc_b_pins[] = { 0x3e, };
  745. static int jz4760_ssi0_gpc_d_pins[] = { 0x76, };
  746. static int jz4760_ssi0_gpc_e_pins[] = { 0x93, };
  747. static int jz4760_ssi0_ce0_a_pins[] = { 0x13, };
  748. static int jz4760_ssi0_ce0_b_pins[] = { 0x3d, };
  749. static int jz4760_ssi0_ce0_d_pins[] = { 0x79, };
  750. static int jz4760_ssi0_ce0_e_pins[] = { 0x90, };
  751. static int jz4760_ssi0_ce1_b_pins[] = { 0x3f, };
  752. static int jz4760_ssi0_ce1_d_pins[] = { 0x77, };
  753. static int jz4760_ssi0_ce1_e_pins[] = { 0x92, };
  754. static int jz4760_ssi1_dt_b_9_pins[] = { 0x29, };
  755. static int jz4760_ssi1_dt_b_21_pins[] = { 0x35, };
  756. static int jz4760_ssi1_dt_d_12_pins[] = { 0x6c, };
  757. static int jz4760_ssi1_dt_d_21_pins[] = { 0x75, };
  758. static int jz4760_ssi1_dt_e_pins[] = { 0x91, };
  759. static int jz4760_ssi1_dt_f_pins[] = { 0xa3, };
  760. static int jz4760_ssi1_dr_b_6_pins[] = { 0x26, };
  761. static int jz4760_ssi1_dr_b_20_pins[] = { 0x34, };
  762. static int jz4760_ssi1_dr_d_13_pins[] = { 0x6d, };
  763. static int jz4760_ssi1_dr_d_20_pins[] = { 0x74, };
  764. static int jz4760_ssi1_dr_e_pins[] = { 0x8e, };
  765. static int jz4760_ssi1_dr_f_pins[] = { 0xa0, };
  766. static int jz4760_ssi1_clk_b_7_pins[] = { 0x27, };
  767. static int jz4760_ssi1_clk_b_28_pins[] = { 0x3c, };
  768. static int jz4760_ssi1_clk_d_pins[] = { 0x78, };
  769. static int jz4760_ssi1_clk_e_7_pins[] = { 0x87, };
  770. static int jz4760_ssi1_clk_e_15_pins[] = { 0x8f, };
  771. static int jz4760_ssi1_clk_f_pins[] = { 0xa2, };
  772. static int jz4760_ssi1_gpc_b_pins[] = { 0x3e, };
  773. static int jz4760_ssi1_gpc_d_pins[] = { 0x76, };
  774. static int jz4760_ssi1_gpc_e_pins[] = { 0x93, };
  775. static int jz4760_ssi1_ce0_b_8_pins[] = { 0x28, };
  776. static int jz4760_ssi1_ce0_b_29_pins[] = { 0x3d, };
  777. static int jz4760_ssi1_ce0_d_pins[] = { 0x79, };
  778. static int jz4760_ssi1_ce0_e_6_pins[] = { 0x86, };
  779. static int jz4760_ssi1_ce0_e_16_pins[] = { 0x90, };
  780. static int jz4760_ssi1_ce0_f_pins[] = { 0xa1, };
  781. static int jz4760_ssi1_ce1_b_pins[] = { 0x3f, };
  782. static int jz4760_ssi1_ce1_d_pins[] = { 0x77, };
  783. static int jz4760_ssi1_ce1_e_pins[] = { 0x92, };
  784. static int jz4760_mmc0_1bit_a_pins[] = { 0x12, 0x13, 0x14, };
  785. static int jz4760_mmc0_4bit_a_pins[] = { 0x15, 0x16, 0x17, };
  786. static int jz4760_mmc0_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  787. static int jz4760_mmc0_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  788. static int jz4760_mmc0_8bit_e_pins[] = { 0x98, 0x99, 0x9a, 0x9b, };
  789. static int jz4760_mmc1_1bit_d_pins[] = { 0x78, 0x79, 0x74, };
  790. static int jz4760_mmc1_4bit_d_pins[] = { 0x75, 0x76, 0x77, };
  791. static int jz4760_mmc1_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  792. static int jz4760_mmc1_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  793. static int jz4760_mmc1_8bit_e_pins[] = { 0x98, 0x99, 0x9a, 0x9b, };
  794. static int jz4760_mmc2_1bit_b_pins[] = { 0x3c, 0x3d, 0x34, };
  795. static int jz4760_mmc2_4bit_b_pins[] = { 0x35, 0x3e, 0x3f, };
  796. static int jz4760_mmc2_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  797. static int jz4760_mmc2_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  798. static int jz4760_mmc2_8bit_e_pins[] = { 0x98, 0x99, 0x9a, 0x9b, };
  799. static int jz4760_nemc_8bit_data_pins[] = {
  800. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  801. };
  802. static int jz4760_nemc_16bit_data_pins[] = {
  803. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  804. };
  805. static int jz4760_nemc_cle_ale_pins[] = { 0x20, 0x21, };
  806. static int jz4760_nemc_addr_pins[] = { 0x22, 0x23, 0x24, 0x25, };
  807. static int jz4760_nemc_rd_we_pins[] = { 0x10, 0x11, };
  808. static int jz4760_nemc_frd_fwe_pins[] = { 0x12, 0x13, };
  809. static int jz4760_nemc_wait_pins[] = { 0x1b, };
  810. static int jz4760_nemc_cs1_pins[] = { 0x15, };
  811. static int jz4760_nemc_cs2_pins[] = { 0x16, };
  812. static int jz4760_nemc_cs3_pins[] = { 0x17, };
  813. static int jz4760_nemc_cs4_pins[] = { 0x18, };
  814. static int jz4760_nemc_cs5_pins[] = { 0x19, };
  815. static int jz4760_nemc_cs6_pins[] = { 0x1a, };
  816. static int jz4760_i2c0_pins[] = { 0x7e, 0x7f, };
  817. static int jz4760_i2c1_pins[] = { 0x9e, 0x9f, };
  818. static int jz4760_cim_pins[] = {
  819. 0x26, 0x27, 0x28, 0x29,
  820. 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
  821. };
  822. static int jz4760_lcd_8bit_pins[] = {
  823. 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x4c,
  824. 0x4d, 0x52, 0x53,
  825. };
  826. static int jz4760_lcd_16bit_pins[] = {
  827. 0x4e, 0x4f, 0x50, 0x51, 0x56, 0x57, 0x58, 0x59,
  828. };
  829. static int jz4760_lcd_18bit_pins[] = {
  830. 0x5a, 0x5b,
  831. };
  832. static int jz4760_lcd_24bit_pins[] = {
  833. 0x40, 0x41, 0x4a, 0x4b, 0x54, 0x55,
  834. };
  835. static int jz4760_lcd_special_pins[] = { 0x54, 0x4a, 0x41, 0x40, };
  836. static int jz4760_lcd_generic_pins[] = { 0x49, };
  837. static int jz4760_pwm_pwm0_pins[] = { 0x80, };
  838. static int jz4760_pwm_pwm1_pins[] = { 0x81, };
  839. static int jz4760_pwm_pwm2_pins[] = { 0x82, };
  840. static int jz4760_pwm_pwm3_pins[] = { 0x83, };
  841. static int jz4760_pwm_pwm4_pins[] = { 0x84, };
  842. static int jz4760_pwm_pwm5_pins[] = { 0x85, };
  843. static int jz4760_pwm_pwm6_pins[] = { 0x6a, };
  844. static int jz4760_pwm_pwm7_pins[] = { 0x6b, };
  845. static int jz4760_otg_pins[] = { 0x8a, };
  846. static u8 jz4760_uart3_data_funcs[] = { 0, 1, };
  847. static u8 jz4760_mmc0_1bit_a_funcs[] = { 1, 1, 0, };
  848. static const struct group_desc jz4760_groups[] = {
  849. INGENIC_PIN_GROUP("uart0-data", jz4760_uart0_data, 0),
  850. INGENIC_PIN_GROUP("uart0-hwflow", jz4760_uart0_hwflow, 0),
  851. INGENIC_PIN_GROUP("uart1-data", jz4760_uart1_data, 0),
  852. INGENIC_PIN_GROUP("uart1-hwflow", jz4760_uart1_hwflow, 0),
  853. INGENIC_PIN_GROUP("uart2-data", jz4760_uart2_data, 0),
  854. INGENIC_PIN_GROUP("uart2-hwflow", jz4760_uart2_hwflow, 0),
  855. INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4760_uart3_data,
  856. jz4760_uart3_data_funcs),
  857. INGENIC_PIN_GROUP("uart3-hwflow", jz4760_uart3_hwflow, 0),
  858. INGENIC_PIN_GROUP("ssi0-dt-a", jz4760_ssi0_dt_a, 2),
  859. INGENIC_PIN_GROUP("ssi0-dt-b", jz4760_ssi0_dt_b, 1),
  860. INGENIC_PIN_GROUP("ssi0-dt-d", jz4760_ssi0_dt_d, 1),
  861. INGENIC_PIN_GROUP("ssi0-dt-e", jz4760_ssi0_dt_e, 0),
  862. INGENIC_PIN_GROUP("ssi0-dr-a", jz4760_ssi0_dr_a, 1),
  863. INGENIC_PIN_GROUP("ssi0-dr-b", jz4760_ssi0_dr_b, 1),
  864. INGENIC_PIN_GROUP("ssi0-dr-d", jz4760_ssi0_dr_d, 1),
  865. INGENIC_PIN_GROUP("ssi0-dr-e", jz4760_ssi0_dr_e, 0),
  866. INGENIC_PIN_GROUP("ssi0-clk-a", jz4760_ssi0_clk_a, 2),
  867. INGENIC_PIN_GROUP("ssi0-clk-b", jz4760_ssi0_clk_b, 1),
  868. INGENIC_PIN_GROUP("ssi0-clk-d", jz4760_ssi0_clk_d, 1),
  869. INGENIC_PIN_GROUP("ssi0-clk-e", jz4760_ssi0_clk_e, 0),
  870. INGENIC_PIN_GROUP("ssi0-gpc-b", jz4760_ssi0_gpc_b, 1),
  871. INGENIC_PIN_GROUP("ssi0-gpc-d", jz4760_ssi0_gpc_d, 1),
  872. INGENIC_PIN_GROUP("ssi0-gpc-e", jz4760_ssi0_gpc_e, 0),
  873. INGENIC_PIN_GROUP("ssi0-ce0-a", jz4760_ssi0_ce0_a, 2),
  874. INGENIC_PIN_GROUP("ssi0-ce0-b", jz4760_ssi0_ce0_b, 1),
  875. INGENIC_PIN_GROUP("ssi0-ce0-d", jz4760_ssi0_ce0_d, 1),
  876. INGENIC_PIN_GROUP("ssi0-ce0-e", jz4760_ssi0_ce0_e, 0),
  877. INGENIC_PIN_GROUP("ssi0-ce1-b", jz4760_ssi0_ce1_b, 1),
  878. INGENIC_PIN_GROUP("ssi0-ce1-d", jz4760_ssi0_ce1_d, 1),
  879. INGENIC_PIN_GROUP("ssi0-ce1-e", jz4760_ssi0_ce1_e, 0),
  880. INGENIC_PIN_GROUP("ssi1-dt-b-9", jz4760_ssi1_dt_b_9, 2),
  881. INGENIC_PIN_GROUP("ssi1-dt-b-21", jz4760_ssi1_dt_b_21, 2),
  882. INGENIC_PIN_GROUP("ssi1-dt-d-12", jz4760_ssi1_dt_d_12, 2),
  883. INGENIC_PIN_GROUP("ssi1-dt-d-21", jz4760_ssi1_dt_d_21, 2),
  884. INGENIC_PIN_GROUP("ssi1-dt-e", jz4760_ssi1_dt_e, 1),
  885. INGENIC_PIN_GROUP("ssi1-dt-f", jz4760_ssi1_dt_f, 2),
  886. INGENIC_PIN_GROUP("ssi1-dr-b-6", jz4760_ssi1_dr_b_6, 2),
  887. INGENIC_PIN_GROUP("ssi1-dr-b-20", jz4760_ssi1_dr_b_20, 2),
  888. INGENIC_PIN_GROUP("ssi1-dr-d-13", jz4760_ssi1_dr_d_13, 2),
  889. INGENIC_PIN_GROUP("ssi1-dr-d-20", jz4760_ssi1_dr_d_20, 2),
  890. INGENIC_PIN_GROUP("ssi1-dr-e", jz4760_ssi1_dr_e, 1),
  891. INGENIC_PIN_GROUP("ssi1-dr-f", jz4760_ssi1_dr_f, 2),
  892. INGENIC_PIN_GROUP("ssi1-clk-b-7", jz4760_ssi1_clk_b_7, 2),
  893. INGENIC_PIN_GROUP("ssi1-clk-b-28", jz4760_ssi1_clk_b_28, 2),
  894. INGENIC_PIN_GROUP("ssi1-clk-d", jz4760_ssi1_clk_d, 2),
  895. INGENIC_PIN_GROUP("ssi1-clk-e-7", jz4760_ssi1_clk_e_7, 2),
  896. INGENIC_PIN_GROUP("ssi1-clk-e-15", jz4760_ssi1_clk_e_15, 1),
  897. INGENIC_PIN_GROUP("ssi1-clk-f", jz4760_ssi1_clk_f, 2),
  898. INGENIC_PIN_GROUP("ssi1-gpc-b", jz4760_ssi1_gpc_b, 2),
  899. INGENIC_PIN_GROUP("ssi1-gpc-d", jz4760_ssi1_gpc_d, 2),
  900. INGENIC_PIN_GROUP("ssi1-gpc-e", jz4760_ssi1_gpc_e, 1),
  901. INGENIC_PIN_GROUP("ssi1-ce0-b-8", jz4760_ssi1_ce0_b_8, 2),
  902. INGENIC_PIN_GROUP("ssi1-ce0-b-29", jz4760_ssi1_ce0_b_29, 2),
  903. INGENIC_PIN_GROUP("ssi1-ce0-d", jz4760_ssi1_ce0_d, 2),
  904. INGENIC_PIN_GROUP("ssi1-ce0-e-6", jz4760_ssi1_ce0_e_6, 2),
  905. INGENIC_PIN_GROUP("ssi1-ce0-e-16", jz4760_ssi1_ce0_e_16, 1),
  906. INGENIC_PIN_GROUP("ssi1-ce0-f", jz4760_ssi1_ce0_f, 2),
  907. INGENIC_PIN_GROUP("ssi1-ce1-b", jz4760_ssi1_ce1_b, 2),
  908. INGENIC_PIN_GROUP("ssi1-ce1-d", jz4760_ssi1_ce1_d, 2),
  909. INGENIC_PIN_GROUP("ssi1-ce1-e", jz4760_ssi1_ce1_e, 1),
  910. INGENIC_PIN_GROUP_FUNCS("mmc0-1bit-a", jz4760_mmc0_1bit_a,
  911. jz4760_mmc0_1bit_a_funcs),
  912. INGENIC_PIN_GROUP("mmc0-4bit-a", jz4760_mmc0_4bit_a, 1),
  913. INGENIC_PIN_GROUP("mmc0-1bit-e", jz4760_mmc0_1bit_e, 0),
  914. INGENIC_PIN_GROUP("mmc0-4bit-e", jz4760_mmc0_4bit_e, 0),
  915. INGENIC_PIN_GROUP("mmc0-8bit-e", jz4760_mmc0_8bit_e, 0),
  916. INGENIC_PIN_GROUP("mmc1-1bit-d", jz4760_mmc1_1bit_d, 0),
  917. INGENIC_PIN_GROUP("mmc1-4bit-d", jz4760_mmc1_4bit_d, 0),
  918. INGENIC_PIN_GROUP("mmc1-1bit-e", jz4760_mmc1_1bit_e, 1),
  919. INGENIC_PIN_GROUP("mmc1-4bit-e", jz4760_mmc1_4bit_e, 1),
  920. INGENIC_PIN_GROUP("mmc1-8bit-e", jz4760_mmc1_8bit_e, 1),
  921. INGENIC_PIN_GROUP("mmc2-1bit-b", jz4760_mmc2_1bit_b, 0),
  922. INGENIC_PIN_GROUP("mmc2-4bit-b", jz4760_mmc2_4bit_b, 0),
  923. INGENIC_PIN_GROUP("mmc2-1bit-e", jz4760_mmc2_1bit_e, 2),
  924. INGENIC_PIN_GROUP("mmc2-4bit-e", jz4760_mmc2_4bit_e, 2),
  925. INGENIC_PIN_GROUP("mmc2-8bit-e", jz4760_mmc2_8bit_e, 2),
  926. INGENIC_PIN_GROUP("nemc-8bit-data", jz4760_nemc_8bit_data, 0),
  927. INGENIC_PIN_GROUP("nemc-16bit-data", jz4760_nemc_16bit_data, 0),
  928. INGENIC_PIN_GROUP("nemc-cle-ale", jz4760_nemc_cle_ale, 0),
  929. INGENIC_PIN_GROUP("nemc-addr", jz4760_nemc_addr, 0),
  930. INGENIC_PIN_GROUP("nemc-rd-we", jz4760_nemc_rd_we, 0),
  931. INGENIC_PIN_GROUP("nemc-frd-fwe", jz4760_nemc_frd_fwe, 0),
  932. INGENIC_PIN_GROUP("nemc-wait", jz4760_nemc_wait, 0),
  933. INGENIC_PIN_GROUP("nemc-cs1", jz4760_nemc_cs1, 0),
  934. INGENIC_PIN_GROUP("nemc-cs2", jz4760_nemc_cs2, 0),
  935. INGENIC_PIN_GROUP("nemc-cs3", jz4760_nemc_cs3, 0),
  936. INGENIC_PIN_GROUP("nemc-cs4", jz4760_nemc_cs4, 0),
  937. INGENIC_PIN_GROUP("nemc-cs5", jz4760_nemc_cs5, 0),
  938. INGENIC_PIN_GROUP("nemc-cs6", jz4760_nemc_cs6, 0),
  939. INGENIC_PIN_GROUP("i2c0-data", jz4760_i2c0, 0),
  940. INGENIC_PIN_GROUP("i2c1-data", jz4760_i2c1, 0),
  941. INGENIC_PIN_GROUP("cim-data", jz4760_cim, 0),
  942. INGENIC_PIN_GROUP("lcd-8bit", jz4760_lcd_8bit, 0),
  943. INGENIC_PIN_GROUP("lcd-16bit", jz4760_lcd_16bit, 0),
  944. INGENIC_PIN_GROUP("lcd-18bit", jz4760_lcd_18bit, 0),
  945. INGENIC_PIN_GROUP("lcd-24bit", jz4760_lcd_24bit, 0),
  946. INGENIC_PIN_GROUP("lcd-special", jz4760_lcd_special, 1),
  947. INGENIC_PIN_GROUP("lcd-generic", jz4760_lcd_generic, 0),
  948. INGENIC_PIN_GROUP("pwm0", jz4760_pwm_pwm0, 0),
  949. INGENIC_PIN_GROUP("pwm1", jz4760_pwm_pwm1, 0),
  950. INGENIC_PIN_GROUP("pwm2", jz4760_pwm_pwm2, 0),
  951. INGENIC_PIN_GROUP("pwm3", jz4760_pwm_pwm3, 0),
  952. INGENIC_PIN_GROUP("pwm4", jz4760_pwm_pwm4, 0),
  953. INGENIC_PIN_GROUP("pwm5", jz4760_pwm_pwm5, 0),
  954. INGENIC_PIN_GROUP("pwm6", jz4760_pwm_pwm6, 0),
  955. INGENIC_PIN_GROUP("pwm7", jz4760_pwm_pwm7, 0),
  956. INGENIC_PIN_GROUP("otg-vbus", jz4760_otg, 0),
  957. };
  958. static const char *jz4760_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  959. static const char *jz4760_uart1_groups[] = { "uart1-data", "uart1-hwflow", };
  960. static const char *jz4760_uart2_groups[] = { "uart2-data", "uart2-hwflow", };
  961. static const char *jz4760_uart3_groups[] = { "uart3-data", "uart3-hwflow", };
  962. static const char *jz4760_ssi0_groups[] = {
  963. "ssi0-dt-a", "ssi0-dt-b", "ssi0-dt-d", "ssi0-dt-e",
  964. "ssi0-dr-a", "ssi0-dr-b", "ssi0-dr-d", "ssi0-dr-e",
  965. "ssi0-clk-a", "ssi0-clk-b", "ssi0-clk-d", "ssi0-clk-e",
  966. "ssi0-gpc-b", "ssi0-gpc-d", "ssi0-gpc-e",
  967. "ssi0-ce0-a", "ssi0-ce0-b", "ssi0-ce0-d", "ssi0-ce0-e",
  968. "ssi0-ce1-b", "ssi0-ce1-d", "ssi0-ce1-e",
  969. };
  970. static const char *jz4760_ssi1_groups[] = {
  971. "ssi1-dt-b-9", "ssi1-dt-b-21", "ssi1-dt-d-12", "ssi1-dt-d-21", "ssi1-dt-e", "ssi1-dt-f",
  972. "ssi1-dr-b-6", "ssi1-dr-b-20", "ssi1-dr-d-13", "ssi1-dr-d-20", "ssi1-dr-e", "ssi1-dr-f",
  973. "ssi1-clk-b-7", "ssi1-clk-b-28", "ssi1-clk-d", "ssi1-clk-e-7", "ssi1-clk-e-15", "ssi1-clk-f",
  974. "ssi1-gpc-b", "ssi1-gpc-d", "ssi1-gpc-e",
  975. "ssi1-ce0-b-8", "ssi1-ce0-b-29", "ssi1-ce0-d", "ssi1-ce0-e-6", "ssi1-ce0-e-16", "ssi1-ce0-f",
  976. "ssi1-ce1-b", "ssi1-ce1-d", "ssi1-ce1-e",
  977. };
  978. static const char *jz4760_mmc0_groups[] = {
  979. "mmc0-1bit-a", "mmc0-4bit-a",
  980. "mmc0-1bit-e", "mmc0-4bit-e", "mmc0-8bit-e",
  981. };
  982. static const char *jz4760_mmc1_groups[] = {
  983. "mmc1-1bit-d", "mmc1-4bit-d",
  984. "mmc1-1bit-e", "mmc1-4bit-e", "mmc1-8bit-e",
  985. };
  986. static const char *jz4760_mmc2_groups[] = {
  987. "mmc2-1bit-b", "mmc2-4bit-b",
  988. "mmc2-1bit-e", "mmc2-4bit-e", "mmc2-8bit-e",
  989. };
  990. static const char *jz4760_nemc_groups[] = {
  991. "nemc-8bit-data", "nemc-16bit-data", "nemc-cle-ale",
  992. "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait",
  993. };
  994. static const char *jz4760_cs1_groups[] = { "nemc-cs1", };
  995. static const char *jz4760_cs2_groups[] = { "nemc-cs2", };
  996. static const char *jz4760_cs3_groups[] = { "nemc-cs3", };
  997. static const char *jz4760_cs4_groups[] = { "nemc-cs4", };
  998. static const char *jz4760_cs5_groups[] = { "nemc-cs5", };
  999. static const char *jz4760_cs6_groups[] = { "nemc-cs6", };
  1000. static const char *jz4760_i2c0_groups[] = { "i2c0-data", };
  1001. static const char *jz4760_i2c1_groups[] = { "i2c1-data", };
  1002. static const char *jz4760_cim_groups[] = { "cim-data", };
  1003. static const char *jz4760_lcd_groups[] = {
  1004. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-24bit",
  1005. "lcd-special", "lcd-generic",
  1006. };
  1007. static const char *jz4760_pwm0_groups[] = { "pwm0", };
  1008. static const char *jz4760_pwm1_groups[] = { "pwm1", };
  1009. static const char *jz4760_pwm2_groups[] = { "pwm2", };
  1010. static const char *jz4760_pwm3_groups[] = { "pwm3", };
  1011. static const char *jz4760_pwm4_groups[] = { "pwm4", };
  1012. static const char *jz4760_pwm5_groups[] = { "pwm5", };
  1013. static const char *jz4760_pwm6_groups[] = { "pwm6", };
  1014. static const char *jz4760_pwm7_groups[] = { "pwm7", };
  1015. static const char *jz4760_otg_groups[] = { "otg-vbus", };
  1016. static const struct function_desc jz4760_functions[] = {
  1017. INGENIC_PIN_FUNCTION("uart0", jz4760_uart0),
  1018. INGENIC_PIN_FUNCTION("uart1", jz4760_uart1),
  1019. INGENIC_PIN_FUNCTION("uart2", jz4760_uart2),
  1020. INGENIC_PIN_FUNCTION("uart3", jz4760_uart3),
  1021. INGENIC_PIN_FUNCTION("ssi0", jz4760_ssi0),
  1022. INGENIC_PIN_FUNCTION("ssi1", jz4760_ssi1),
  1023. INGENIC_PIN_FUNCTION("mmc0", jz4760_mmc0),
  1024. INGENIC_PIN_FUNCTION("mmc1", jz4760_mmc1),
  1025. INGENIC_PIN_FUNCTION("mmc2", jz4760_mmc2),
  1026. INGENIC_PIN_FUNCTION("nemc", jz4760_nemc),
  1027. INGENIC_PIN_FUNCTION("nemc-cs1", jz4760_cs1),
  1028. INGENIC_PIN_FUNCTION("nemc-cs2", jz4760_cs2),
  1029. INGENIC_PIN_FUNCTION("nemc-cs3", jz4760_cs3),
  1030. INGENIC_PIN_FUNCTION("nemc-cs4", jz4760_cs4),
  1031. INGENIC_PIN_FUNCTION("nemc-cs5", jz4760_cs5),
  1032. INGENIC_PIN_FUNCTION("nemc-cs6", jz4760_cs6),
  1033. INGENIC_PIN_FUNCTION("i2c0", jz4760_i2c0),
  1034. INGENIC_PIN_FUNCTION("i2c1", jz4760_i2c1),
  1035. INGENIC_PIN_FUNCTION("cim", jz4760_cim),
  1036. INGENIC_PIN_FUNCTION("lcd", jz4760_lcd),
  1037. INGENIC_PIN_FUNCTION("pwm0", jz4760_pwm0),
  1038. INGENIC_PIN_FUNCTION("pwm1", jz4760_pwm1),
  1039. INGENIC_PIN_FUNCTION("pwm2", jz4760_pwm2),
  1040. INGENIC_PIN_FUNCTION("pwm3", jz4760_pwm3),
  1041. INGENIC_PIN_FUNCTION("pwm4", jz4760_pwm4),
  1042. INGENIC_PIN_FUNCTION("pwm5", jz4760_pwm5),
  1043. INGENIC_PIN_FUNCTION("pwm6", jz4760_pwm6),
  1044. INGENIC_PIN_FUNCTION("pwm7", jz4760_pwm7),
  1045. INGENIC_PIN_FUNCTION("otg", jz4760_otg),
  1046. };
  1047. static const struct ingenic_chip_info jz4760_chip_info = {
  1048. .num_chips = 6,
  1049. .reg_offset = 0x100,
  1050. .version = ID_JZ4760,
  1051. .groups = jz4760_groups,
  1052. .num_groups = ARRAY_SIZE(jz4760_groups),
  1053. .functions = jz4760_functions,
  1054. .num_functions = ARRAY_SIZE(jz4760_functions),
  1055. .pull_ups = jz4760_pull_ups,
  1056. .pull_downs = jz4760_pull_downs,
  1057. };
  1058. static const u32 jz4770_pull_ups[6] = {
  1059. 0x3fffffff, 0xfff0f3fc, 0xffffffff, 0xffff4fff, 0xfffffb7c, 0x0024f00f,
  1060. };
  1061. static const u32 jz4770_pull_downs[6] = {
  1062. 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x005b0ff0,
  1063. };
  1064. static int jz4770_uart0_data_pins[] = { 0xa0, 0xa3, };
  1065. static int jz4770_uart0_hwflow_pins[] = { 0xa1, 0xa2, };
  1066. static int jz4770_uart1_data_pins[] = { 0x7a, 0x7c, };
  1067. static int jz4770_uart1_hwflow_pins[] = { 0x7b, 0x7d, };
  1068. static int jz4770_uart2_data_pins[] = { 0x5c, 0x5e, };
  1069. static int jz4770_uart2_hwflow_pins[] = { 0x5d, 0x5f, };
  1070. static int jz4770_uart3_data_pins[] = { 0x6c, 0x85, };
  1071. static int jz4770_uart3_hwflow_pins[] = { 0x88, 0x89, };
  1072. static int jz4770_ssi0_dt_a_pins[] = { 0x15, };
  1073. static int jz4770_ssi0_dt_b_pins[] = { 0x35, };
  1074. static int jz4770_ssi0_dt_d_pins[] = { 0x75, };
  1075. static int jz4770_ssi0_dt_e_pins[] = { 0x91, };
  1076. static int jz4770_ssi0_dr_a_pins[] = { 0x14, };
  1077. static int jz4770_ssi0_dr_b_pins[] = { 0x34, };
  1078. static int jz4770_ssi0_dr_d_pins[] = { 0x74, };
  1079. static int jz4770_ssi0_dr_e_pins[] = { 0x8e, };
  1080. static int jz4770_ssi0_clk_a_pins[] = { 0x12, };
  1081. static int jz4770_ssi0_clk_b_pins[] = { 0x3c, };
  1082. static int jz4770_ssi0_clk_d_pins[] = { 0x78, };
  1083. static int jz4770_ssi0_clk_e_pins[] = { 0x8f, };
  1084. static int jz4770_ssi0_gpc_b_pins[] = { 0x3e, };
  1085. static int jz4770_ssi0_gpc_d_pins[] = { 0x76, };
  1086. static int jz4770_ssi0_gpc_e_pins[] = { 0x93, };
  1087. static int jz4770_ssi0_ce0_a_pins[] = { 0x13, };
  1088. static int jz4770_ssi0_ce0_b_pins[] = { 0x3d, };
  1089. static int jz4770_ssi0_ce0_d_pins[] = { 0x79, };
  1090. static int jz4770_ssi0_ce0_e_pins[] = { 0x90, };
  1091. static int jz4770_ssi0_ce1_b_pins[] = { 0x3f, };
  1092. static int jz4770_ssi0_ce1_d_pins[] = { 0x77, };
  1093. static int jz4770_ssi0_ce1_e_pins[] = { 0x92, };
  1094. static int jz4770_ssi1_dt_b_pins[] = { 0x35, };
  1095. static int jz4770_ssi1_dt_d_pins[] = { 0x75, };
  1096. static int jz4770_ssi1_dt_e_pins[] = { 0x91, };
  1097. static int jz4770_ssi1_dr_b_pins[] = { 0x34, };
  1098. static int jz4770_ssi1_dr_d_pins[] = { 0x74, };
  1099. static int jz4770_ssi1_dr_e_pins[] = { 0x8e, };
  1100. static int jz4770_ssi1_clk_b_pins[] = { 0x3c, };
  1101. static int jz4770_ssi1_clk_d_pins[] = { 0x78, };
  1102. static int jz4770_ssi1_clk_e_pins[] = { 0x8f, };
  1103. static int jz4770_ssi1_gpc_b_pins[] = { 0x3e, };
  1104. static int jz4770_ssi1_gpc_d_pins[] = { 0x76, };
  1105. static int jz4770_ssi1_gpc_e_pins[] = { 0x93, };
  1106. static int jz4770_ssi1_ce0_b_pins[] = { 0x3d, };
  1107. static int jz4770_ssi1_ce0_d_pins[] = { 0x79, };
  1108. static int jz4770_ssi1_ce0_e_pins[] = { 0x90, };
  1109. static int jz4770_ssi1_ce1_b_pins[] = { 0x3f, };
  1110. static int jz4770_ssi1_ce1_d_pins[] = { 0x77, };
  1111. static int jz4770_ssi1_ce1_e_pins[] = { 0x92, };
  1112. static int jz4770_mmc0_1bit_a_pins[] = { 0x12, 0x13, 0x14, };
  1113. static int jz4770_mmc0_4bit_a_pins[] = { 0x15, 0x16, 0x17, };
  1114. static int jz4770_mmc0_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  1115. static int jz4770_mmc0_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  1116. static int jz4770_mmc0_8bit_e_pins[] = { 0x98, 0x99, 0x9a, 0x9b, };
  1117. static int jz4770_mmc1_1bit_d_pins[] = { 0x78, 0x79, 0x74, };
  1118. static int jz4770_mmc1_4bit_d_pins[] = { 0x75, 0x76, 0x77, };
  1119. static int jz4770_mmc1_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  1120. static int jz4770_mmc1_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  1121. static int jz4770_mmc1_8bit_e_pins[] = { 0x98, 0x99, 0x9a, 0x9b, };
  1122. static int jz4770_mmc2_1bit_b_pins[] = { 0x3c, 0x3d, 0x34, };
  1123. static int jz4770_mmc2_4bit_b_pins[] = { 0x35, 0x3e, 0x3f, };
  1124. static int jz4770_mmc2_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  1125. static int jz4770_mmc2_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  1126. static int jz4770_mmc2_8bit_e_pins[] = { 0x98, 0x99, 0x9a, 0x9b, };
  1127. static int jz4770_nemc_8bit_data_pins[] = {
  1128. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  1129. };
  1130. static int jz4770_nemc_16bit_data_pins[] = {
  1131. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  1132. };
  1133. static int jz4770_nemc_cle_ale_pins[] = { 0x20, 0x21, };
  1134. static int jz4770_nemc_addr_pins[] = { 0x22, 0x23, 0x24, 0x25, };
  1135. static int jz4770_nemc_rd_we_pins[] = { 0x10, 0x11, };
  1136. static int jz4770_nemc_frd_fwe_pins[] = { 0x12, 0x13, };
  1137. static int jz4770_nemc_wait_pins[] = { 0x1b, };
  1138. static int jz4770_nemc_cs1_pins[] = { 0x15, };
  1139. static int jz4770_nemc_cs2_pins[] = { 0x16, };
  1140. static int jz4770_nemc_cs3_pins[] = { 0x17, };
  1141. static int jz4770_nemc_cs4_pins[] = { 0x18, };
  1142. static int jz4770_nemc_cs5_pins[] = { 0x19, };
  1143. static int jz4770_nemc_cs6_pins[] = { 0x1a, };
  1144. static int jz4770_i2c0_pins[] = { 0x7e, 0x7f, };
  1145. static int jz4770_i2c1_pins[] = { 0x9e, 0x9f, };
  1146. static int jz4770_i2c2_pins[] = { 0xb0, 0xb1, };
  1147. static int jz4770_cim_8bit_pins[] = {
  1148. 0x26, 0x27, 0x28, 0x29,
  1149. 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
  1150. };
  1151. static int jz4770_cim_12bit_pins[] = {
  1152. 0x32, 0x33, 0xb0, 0xb1,
  1153. };
  1154. static int jz4770_lcd_8bit_pins[] = {
  1155. 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x4c, 0x4d,
  1156. 0x48, 0x52, 0x53,
  1157. };
  1158. static int jz4770_lcd_16bit_pins[] = {
  1159. 0x4e, 0x4f, 0x50, 0x51, 0x56, 0x57, 0x58, 0x59,
  1160. };
  1161. static int jz4770_lcd_18bit_pins[] = {
  1162. 0x5a, 0x5b,
  1163. };
  1164. static int jz4770_lcd_24bit_pins[] = {
  1165. 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
  1166. 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
  1167. 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
  1168. 0x58, 0x59, 0x5a, 0x5b,
  1169. };
  1170. static int jz4770_lcd_special_pins[] = { 0x54, 0x4a, 0x41, 0x40, };
  1171. static int jz4770_lcd_generic_pins[] = { 0x49, };
  1172. static int jz4770_pwm_pwm0_pins[] = { 0x80, };
  1173. static int jz4770_pwm_pwm1_pins[] = { 0x81, };
  1174. static int jz4770_pwm_pwm2_pins[] = { 0x82, };
  1175. static int jz4770_pwm_pwm3_pins[] = { 0x83, };
  1176. static int jz4770_pwm_pwm4_pins[] = { 0x84, };
  1177. static int jz4770_pwm_pwm5_pins[] = { 0x85, };
  1178. static int jz4770_pwm_pwm6_pins[] = { 0x6a, };
  1179. static int jz4770_pwm_pwm7_pins[] = { 0x6b, };
  1180. static int jz4770_mac_rmii_pins[] = {
  1181. 0xa9, 0xab, 0xaa, 0xac, 0xa5, 0xa4, 0xad, 0xae, 0xa6, 0xa8,
  1182. };
  1183. static int jz4770_mac_mii_pins[] = {
  1184. 0x7b, 0x7a, 0x7d, 0x7c, 0xa7, 0x24, 0xaf,
  1185. };
  1186. static const struct group_desc jz4770_groups[] = {
  1187. INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data, 0),
  1188. INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow, 0),
  1189. INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data, 0),
  1190. INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow, 0),
  1191. INGENIC_PIN_GROUP("uart2-data", jz4770_uart2_data, 0),
  1192. INGENIC_PIN_GROUP("uart2-hwflow", jz4770_uart2_hwflow, 0),
  1193. INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4770_uart3_data,
  1194. jz4760_uart3_data_funcs),
  1195. INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow, 0),
  1196. INGENIC_PIN_GROUP("ssi0-dt-a", jz4770_ssi0_dt_a, 2),
  1197. INGENIC_PIN_GROUP("ssi0-dt-b", jz4770_ssi0_dt_b, 1),
  1198. INGENIC_PIN_GROUP("ssi0-dt-d", jz4770_ssi0_dt_d, 1),
  1199. INGENIC_PIN_GROUP("ssi0-dt-e", jz4770_ssi0_dt_e, 0),
  1200. INGENIC_PIN_GROUP("ssi0-dr-a", jz4770_ssi0_dr_a, 1),
  1201. INGENIC_PIN_GROUP("ssi0-dr-b", jz4770_ssi0_dr_b, 1),
  1202. INGENIC_PIN_GROUP("ssi0-dr-d", jz4770_ssi0_dr_d, 1),
  1203. INGENIC_PIN_GROUP("ssi0-dr-e", jz4770_ssi0_dr_e, 0),
  1204. INGENIC_PIN_GROUP("ssi0-clk-a", jz4770_ssi0_clk_a, 2),
  1205. INGENIC_PIN_GROUP("ssi0-clk-b", jz4770_ssi0_clk_b, 1),
  1206. INGENIC_PIN_GROUP("ssi0-clk-d", jz4770_ssi0_clk_d, 1),
  1207. INGENIC_PIN_GROUP("ssi0-clk-e", jz4770_ssi0_clk_e, 0),
  1208. INGENIC_PIN_GROUP("ssi0-gpc-b", jz4770_ssi0_gpc_b, 1),
  1209. INGENIC_PIN_GROUP("ssi0-gpc-d", jz4770_ssi0_gpc_d, 1),
  1210. INGENIC_PIN_GROUP("ssi0-gpc-e", jz4770_ssi0_gpc_e, 0),
  1211. INGENIC_PIN_GROUP("ssi0-ce0-a", jz4770_ssi0_ce0_a, 2),
  1212. INGENIC_PIN_GROUP("ssi0-ce0-b", jz4770_ssi0_ce0_b, 1),
  1213. INGENIC_PIN_GROUP("ssi0-ce0-d", jz4770_ssi0_ce0_d, 1),
  1214. INGENIC_PIN_GROUP("ssi0-ce0-e", jz4770_ssi0_ce0_e, 0),
  1215. INGENIC_PIN_GROUP("ssi0-ce1-b", jz4770_ssi0_ce1_b, 1),
  1216. INGENIC_PIN_GROUP("ssi0-ce1-d", jz4770_ssi0_ce1_d, 1),
  1217. INGENIC_PIN_GROUP("ssi0-ce1-e", jz4770_ssi0_ce1_e, 0),
  1218. INGENIC_PIN_GROUP("ssi1-dt-b", jz4770_ssi1_dt_b, 2),
  1219. INGENIC_PIN_GROUP("ssi1-dt-d", jz4770_ssi1_dt_d, 2),
  1220. INGENIC_PIN_GROUP("ssi1-dt-e", jz4770_ssi1_dt_e, 1),
  1221. INGENIC_PIN_GROUP("ssi1-dr-b", jz4770_ssi1_dr_b, 2),
  1222. INGENIC_PIN_GROUP("ssi1-dr-d", jz4770_ssi1_dr_d, 2),
  1223. INGENIC_PIN_GROUP("ssi1-dr-e", jz4770_ssi1_dr_e, 1),
  1224. INGENIC_PIN_GROUP("ssi1-clk-b", jz4770_ssi1_clk_b, 2),
  1225. INGENIC_PIN_GROUP("ssi1-clk-d", jz4770_ssi1_clk_d, 2),
  1226. INGENIC_PIN_GROUP("ssi1-clk-e", jz4770_ssi1_clk_e, 1),
  1227. INGENIC_PIN_GROUP("ssi1-gpc-b", jz4770_ssi1_gpc_b, 2),
  1228. INGENIC_PIN_GROUP("ssi1-gpc-d", jz4770_ssi1_gpc_d, 2),
  1229. INGENIC_PIN_GROUP("ssi1-gpc-e", jz4770_ssi1_gpc_e, 1),
  1230. INGENIC_PIN_GROUP("ssi1-ce0-b", jz4770_ssi1_ce0_b, 2),
  1231. INGENIC_PIN_GROUP("ssi1-ce0-d", jz4770_ssi1_ce0_d, 2),
  1232. INGENIC_PIN_GROUP("ssi1-ce0-e", jz4770_ssi1_ce0_e, 1),
  1233. INGENIC_PIN_GROUP("ssi1-ce1-b", jz4770_ssi1_ce1_b, 2),
  1234. INGENIC_PIN_GROUP("ssi1-ce1-d", jz4770_ssi1_ce1_d, 2),
  1235. INGENIC_PIN_GROUP("ssi1-ce1-e", jz4770_ssi1_ce1_e, 1),
  1236. INGENIC_PIN_GROUP_FUNCS("mmc0-1bit-a", jz4770_mmc0_1bit_a,
  1237. jz4760_mmc0_1bit_a_funcs),
  1238. INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a, 1),
  1239. INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e, 0),
  1240. INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e, 0),
  1241. INGENIC_PIN_GROUP("mmc0-8bit-e", jz4770_mmc0_8bit_e, 0),
  1242. INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d, 0),
  1243. INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d, 0),
  1244. INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e, 1),
  1245. INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e, 1),
  1246. INGENIC_PIN_GROUP("mmc1-8bit-e", jz4770_mmc1_8bit_e, 1),
  1247. INGENIC_PIN_GROUP("mmc2-1bit-b", jz4770_mmc2_1bit_b, 0),
  1248. INGENIC_PIN_GROUP("mmc2-4bit-b", jz4770_mmc2_4bit_b, 0),
  1249. INGENIC_PIN_GROUP("mmc2-1bit-e", jz4770_mmc2_1bit_e, 2),
  1250. INGENIC_PIN_GROUP("mmc2-4bit-e", jz4770_mmc2_4bit_e, 2),
  1251. INGENIC_PIN_GROUP("mmc2-8bit-e", jz4770_mmc2_8bit_e, 2),
  1252. INGENIC_PIN_GROUP("nemc-8bit-data", jz4770_nemc_8bit_data, 0),
  1253. INGENIC_PIN_GROUP("nemc-16bit-data", jz4770_nemc_16bit_data, 0),
  1254. INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale, 0),
  1255. INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr, 0),
  1256. INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we, 0),
  1257. INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe, 0),
  1258. INGENIC_PIN_GROUP("nemc-wait", jz4770_nemc_wait, 0),
  1259. INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1, 0),
  1260. INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2, 0),
  1261. INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3, 0),
  1262. INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4, 0),
  1263. INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5, 0),
  1264. INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6, 0),
  1265. INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0, 0),
  1266. INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1, 0),
  1267. INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2, 2),
  1268. INGENIC_PIN_GROUP("cim-data-8bit", jz4770_cim_8bit, 0),
  1269. INGENIC_PIN_GROUP("cim-data-12bit", jz4770_cim_12bit, 0),
  1270. INGENIC_PIN_GROUP("lcd-8bit", jz4770_lcd_8bit, 0),
  1271. INGENIC_PIN_GROUP("lcd-16bit", jz4770_lcd_16bit, 0),
  1272. INGENIC_PIN_GROUP("lcd-18bit", jz4770_lcd_18bit, 0),
  1273. INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit, 0),
  1274. INGENIC_PIN_GROUP("lcd-special", jz4770_lcd_special, 1),
  1275. INGENIC_PIN_GROUP("lcd-generic", jz4770_lcd_generic, 0),
  1276. INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0, 0),
  1277. INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1, 0),
  1278. INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2, 0),
  1279. INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3, 0),
  1280. INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4, 0),
  1281. INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5, 0),
  1282. INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6, 0),
  1283. INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7, 0),
  1284. INGENIC_PIN_GROUP("mac-rmii", jz4770_mac_rmii, 0),
  1285. INGENIC_PIN_GROUP("mac-mii", jz4770_mac_mii, 0),
  1286. INGENIC_PIN_GROUP("otg-vbus", jz4760_otg, 0),
  1287. };
  1288. static const char *jz4770_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  1289. static const char *jz4770_uart1_groups[] = { "uart1-data", "uart1-hwflow", };
  1290. static const char *jz4770_uart2_groups[] = { "uart2-data", "uart2-hwflow", };
  1291. static const char *jz4770_uart3_groups[] = { "uart3-data", "uart3-hwflow", };
  1292. static const char *jz4770_ssi0_groups[] = {
  1293. "ssi0-dt-a", "ssi0-dt-b", "ssi0-dt-d", "ssi0-dt-e",
  1294. "ssi0-dr-a", "ssi0-dr-b", "ssi0-dr-d", "ssi0-dr-e",
  1295. "ssi0-clk-a", "ssi0-clk-b", "ssi0-clk-d", "ssi0-clk-e",
  1296. "ssi0-gpc-b", "ssi0-gpc-d", "ssi0-gpc-e",
  1297. "ssi0-ce0-a", "ssi0-ce0-b", "ssi0-ce0-d", "ssi0-ce0-e",
  1298. "ssi0-ce1-b", "ssi0-ce1-d", "ssi0-ce1-e",
  1299. };
  1300. static const char *jz4770_ssi1_groups[] = {
  1301. "ssi1-dt-b", "ssi1-dt-d", "ssi1-dt-e",
  1302. "ssi1-dr-b", "ssi1-dr-d", "ssi1-dr-e",
  1303. "ssi1-clk-b", "ssi1-clk-d", "ssi1-clk-e",
  1304. "ssi1-gpc-b", "ssi1-gpc-d", "ssi1-gpc-e",
  1305. "ssi1-ce0-b", "ssi1-ce0-d", "ssi1-ce0-e",
  1306. "ssi1-ce1-b", "ssi1-ce1-d", "ssi1-ce1-e",
  1307. };
  1308. static const char *jz4770_mmc0_groups[] = {
  1309. "mmc0-1bit-a", "mmc0-4bit-a",
  1310. "mmc0-1bit-e", "mmc0-4bit-e", "mmc0-8bit-e",
  1311. };
  1312. static const char *jz4770_mmc1_groups[] = {
  1313. "mmc1-1bit-d", "mmc1-4bit-d",
  1314. "mmc1-1bit-e", "mmc1-4bit-e", "mmc1-8bit-e",
  1315. };
  1316. static const char *jz4770_mmc2_groups[] = {
  1317. "mmc2-1bit-b", "mmc2-4bit-b",
  1318. "mmc2-1bit-e", "mmc2-4bit-e", "mmc2-8bit-e",
  1319. };
  1320. static const char *jz4770_nemc_groups[] = {
  1321. "nemc-8bit-data", "nemc-16bit-data", "nemc-cle-ale",
  1322. "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait",
  1323. };
  1324. static const char *jz4770_cs1_groups[] = { "nemc-cs1", };
  1325. static const char *jz4770_cs2_groups[] = { "nemc-cs2", };
  1326. static const char *jz4770_cs3_groups[] = { "nemc-cs3", };
  1327. static const char *jz4770_cs4_groups[] = { "nemc-cs4", };
  1328. static const char *jz4770_cs5_groups[] = { "nemc-cs5", };
  1329. static const char *jz4770_cs6_groups[] = { "nemc-cs6", };
  1330. static const char *jz4770_i2c0_groups[] = { "i2c0-data", };
  1331. static const char *jz4770_i2c1_groups[] = { "i2c1-data", };
  1332. static const char *jz4770_i2c2_groups[] = { "i2c2-data", };
  1333. static const char *jz4770_cim_groups[] = { "cim-data-8bit", "cim-data-12bit", };
  1334. static const char *jz4770_lcd_groups[] = {
  1335. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-24bit",
  1336. "lcd-special", "lcd-generic",
  1337. };
  1338. static const char *jz4770_pwm0_groups[] = { "pwm0", };
  1339. static const char *jz4770_pwm1_groups[] = { "pwm1", };
  1340. static const char *jz4770_pwm2_groups[] = { "pwm2", };
  1341. static const char *jz4770_pwm3_groups[] = { "pwm3", };
  1342. static const char *jz4770_pwm4_groups[] = { "pwm4", };
  1343. static const char *jz4770_pwm5_groups[] = { "pwm5", };
  1344. static const char *jz4770_pwm6_groups[] = { "pwm6", };
  1345. static const char *jz4770_pwm7_groups[] = { "pwm7", };
  1346. static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", };
  1347. static const struct function_desc jz4770_functions[] = {
  1348. INGENIC_PIN_FUNCTION("uart0", jz4770_uart0),
  1349. INGENIC_PIN_FUNCTION("uart1", jz4770_uart1),
  1350. INGENIC_PIN_FUNCTION("uart2", jz4770_uart2),
  1351. INGENIC_PIN_FUNCTION("uart3", jz4770_uart3),
  1352. INGENIC_PIN_FUNCTION("ssi0", jz4770_ssi0),
  1353. INGENIC_PIN_FUNCTION("ssi1", jz4770_ssi1),
  1354. INGENIC_PIN_FUNCTION("mmc0", jz4770_mmc0),
  1355. INGENIC_PIN_FUNCTION("mmc1", jz4770_mmc1),
  1356. INGENIC_PIN_FUNCTION("mmc2", jz4770_mmc2),
  1357. INGENIC_PIN_FUNCTION("nemc", jz4770_nemc),
  1358. INGENIC_PIN_FUNCTION("nemc-cs1", jz4770_cs1),
  1359. INGENIC_PIN_FUNCTION("nemc-cs2", jz4770_cs2),
  1360. INGENIC_PIN_FUNCTION("nemc-cs3", jz4770_cs3),
  1361. INGENIC_PIN_FUNCTION("nemc-cs4", jz4770_cs4),
  1362. INGENIC_PIN_FUNCTION("nemc-cs5", jz4770_cs5),
  1363. INGENIC_PIN_FUNCTION("nemc-cs6", jz4770_cs6),
  1364. INGENIC_PIN_FUNCTION("i2c0", jz4770_i2c0),
  1365. INGENIC_PIN_FUNCTION("i2c1", jz4770_i2c1),
  1366. INGENIC_PIN_FUNCTION("i2c2", jz4770_i2c2),
  1367. INGENIC_PIN_FUNCTION("cim", jz4770_cim),
  1368. INGENIC_PIN_FUNCTION("lcd", jz4770_lcd),
  1369. INGENIC_PIN_FUNCTION("pwm0", jz4770_pwm0),
  1370. INGENIC_PIN_FUNCTION("pwm1", jz4770_pwm1),
  1371. INGENIC_PIN_FUNCTION("pwm2", jz4770_pwm2),
  1372. INGENIC_PIN_FUNCTION("pwm3", jz4770_pwm3),
  1373. INGENIC_PIN_FUNCTION("pwm4", jz4770_pwm4),
  1374. INGENIC_PIN_FUNCTION("pwm5", jz4770_pwm5),
  1375. INGENIC_PIN_FUNCTION("pwm6", jz4770_pwm6),
  1376. INGENIC_PIN_FUNCTION("pwm7", jz4770_pwm7),
  1377. INGENIC_PIN_FUNCTION("mac", jz4770_mac),
  1378. INGENIC_PIN_FUNCTION("otg", jz4760_otg),
  1379. };
  1380. static const struct ingenic_chip_info jz4770_chip_info = {
  1381. .num_chips = 6,
  1382. .reg_offset = 0x100,
  1383. .version = ID_JZ4770,
  1384. .groups = jz4770_groups,
  1385. .num_groups = ARRAY_SIZE(jz4770_groups),
  1386. .functions = jz4770_functions,
  1387. .num_functions = ARRAY_SIZE(jz4770_functions),
  1388. .pull_ups = jz4770_pull_ups,
  1389. .pull_downs = jz4770_pull_downs,
  1390. };
  1391. static const u32 jz4775_pull_ups[7] = {
  1392. 0x28ff00ff, 0xf030f3fc, 0x0fffffff, 0xfffe4000, 0xf0f0000c, 0x0000f00f, 0x0000f3c0,
  1393. };
  1394. static const u32 jz4775_pull_downs[7] = {
  1395. 0x00000000, 0x00030c03, 0x00000000, 0x00008000, 0x00000403, 0x00000ff0, 0x00030c00,
  1396. };
  1397. static int jz4775_uart0_data_pins[] = { 0xa0, 0xa3, };
  1398. static int jz4775_uart0_hwflow_pins[] = { 0xa1, 0xa2, };
  1399. static int jz4775_uart1_data_pins[] = { 0x7a, 0x7c, };
  1400. static int jz4775_uart1_hwflow_pins[] = { 0x7b, 0x7d, };
  1401. static int jz4775_uart2_data_c_pins[] = { 0x54, 0x4a, };
  1402. static int jz4775_uart2_data_f_pins[] = { 0xa5, 0xa4, };
  1403. static int jz4775_uart3_data_pins[] = { 0x1e, 0x1f, };
  1404. static int jz4775_ssi_dt_a_pins[] = { 0x13, };
  1405. static int jz4775_ssi_dt_d_pins[] = { 0x75, };
  1406. static int jz4775_ssi_dr_a_pins[] = { 0x14, };
  1407. static int jz4775_ssi_dr_d_pins[] = { 0x74, };
  1408. static int jz4775_ssi_clk_a_pins[] = { 0x12, };
  1409. static int jz4775_ssi_clk_d_pins[] = { 0x78, };
  1410. static int jz4775_ssi_gpc_pins[] = { 0x76, };
  1411. static int jz4775_ssi_ce0_a_pins[] = { 0x17, };
  1412. static int jz4775_ssi_ce0_d_pins[] = { 0x79, };
  1413. static int jz4775_ssi_ce1_pins[] = { 0x77, };
  1414. static int jz4775_mmc0_1bit_a_pins[] = { 0x12, 0x13, 0x14, };
  1415. static int jz4775_mmc0_4bit_a_pins[] = { 0x15, 0x16, 0x17, };
  1416. static int jz4775_mmc0_8bit_a_pins[] = { 0x04, 0x05, 0x06, 0x07, };
  1417. static int jz4775_mmc0_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  1418. static int jz4775_mmc0_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  1419. static int jz4775_mmc1_1bit_d_pins[] = { 0x78, 0x79, 0x74, };
  1420. static int jz4775_mmc1_4bit_d_pins[] = { 0x75, 0x76, 0x77, };
  1421. static int jz4775_mmc1_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  1422. static int jz4775_mmc1_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  1423. static int jz4775_mmc2_1bit_b_pins[] = { 0x3c, 0x3d, 0x34, };
  1424. static int jz4775_mmc2_4bit_b_pins[] = { 0x35, 0x3e, 0x3f, };
  1425. static int jz4775_mmc2_1bit_e_pins[] = { 0x9c, 0x9d, 0x94, };
  1426. static int jz4775_mmc2_4bit_e_pins[] = { 0x95, 0x96, 0x97, };
  1427. static int jz4775_nemc_8bit_data_pins[] = {
  1428. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  1429. };
  1430. static int jz4775_nemc_16bit_data_pins[] = {
  1431. 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1,
  1432. };
  1433. static int jz4775_nemc_cle_ale_pins[] = { 0x20, 0x21, };
  1434. static int jz4775_nemc_addr_pins[] = { 0x22, 0x23, 0x24, 0x25, };
  1435. static int jz4775_nemc_rd_we_pins[] = { 0x10, 0x11, };
  1436. static int jz4775_nemc_frd_fwe_pins[] = { 0x12, 0x13, };
  1437. static int jz4775_nemc_wait_pins[] = { 0x1b, };
  1438. static int jz4775_nemc_cs1_pins[] = { 0x15, };
  1439. static int jz4775_nemc_cs2_pins[] = { 0x16, };
  1440. static int jz4775_nemc_cs3_pins[] = { 0x17, };
  1441. static int jz4775_i2c0_pins[] = { 0x7e, 0x7f, };
  1442. static int jz4775_i2c1_pins[] = { 0x9e, 0x9f, };
  1443. static int jz4775_i2c2_pins[] = { 0x80, 0x83, };
  1444. static int jz4775_i2s_data_tx_pins[] = { 0xa3, };
  1445. static int jz4775_i2s_data_rx_pins[] = { 0xa2, };
  1446. static int jz4775_i2s_clk_txrx_pins[] = { 0xa0, 0xa1, };
  1447. static int jz4775_i2s_sysclk_pins[] = { 0x83, };
  1448. static int jz4775_dmic_pins[] = { 0xaa, 0xab, };
  1449. static int jz4775_cim_pins[] = {
  1450. 0x26, 0x27, 0x28, 0x29,
  1451. 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
  1452. };
  1453. static int jz4775_lcd_8bit_pins[] = {
  1454. 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x4c, 0x4d,
  1455. 0x48, 0x52, 0x53,
  1456. };
  1457. static int jz4775_lcd_16bit_pins[] = {
  1458. 0x4e, 0x4f, 0x50, 0x51, 0x56, 0x57, 0x58, 0x59,
  1459. };
  1460. static int jz4775_lcd_18bit_pins[] = {
  1461. 0x5a, 0x5b,
  1462. };
  1463. static int jz4775_lcd_24bit_pins[] = {
  1464. 0x40, 0x41, 0x4a, 0x4b, 0x54, 0x55,
  1465. };
  1466. static int jz4775_lcd_special_pins[] = { 0x54, 0x4a, 0x41, 0x40, };
  1467. static int jz4775_lcd_generic_pins[] = { 0x49, };
  1468. static int jz4775_pwm_pwm0_pins[] = { 0x80, };
  1469. static int jz4775_pwm_pwm1_pins[] = { 0x81, };
  1470. static int jz4775_pwm_pwm2_pins[] = { 0x82, };
  1471. static int jz4775_pwm_pwm3_pins[] = { 0x83, };
  1472. static int jz4775_mac_rmii_pins[] = {
  1473. 0xa9, 0xab, 0xaa, 0xac, 0xa5, 0xa4, 0xad, 0xae, 0xa6, 0xa8,
  1474. };
  1475. static int jz4775_mac_mii_pins[] = {
  1476. 0x7b, 0x7a, 0x7d, 0x7c, 0xa7, 0x24, 0xaf,
  1477. };
  1478. static int jz4775_mac_rgmii_pins[] = {
  1479. 0xa9, 0x7b, 0x7a, 0xab, 0xaa, 0xac, 0x7d, 0x7c, 0xa5, 0xa4,
  1480. 0xad, 0xae, 0xa7, 0xa6,
  1481. };
  1482. static int jz4775_mac_gmii_pins[] = {
  1483. 0x31, 0x30, 0x2f, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a,
  1484. 0xa8, 0x28, 0x24, 0xaf,
  1485. };
  1486. static int jz4775_otg_pins[] = { 0x8a, };
  1487. static u8 jz4775_uart3_data_funcs[] = { 0, 1, };
  1488. static u8 jz4775_mac_mii_funcs[] = { 1, 1, 1, 1, 0, 1, 0, };
  1489. static u8 jz4775_mac_rgmii_funcs[] = {
  1490. 0, 1, 1, 0, 0, 0, 1, 1, 0, 0,
  1491. 0, 0, 0, 0,
  1492. };
  1493. static u8 jz4775_mac_gmii_funcs[] = {
  1494. 1, 1, 1, 1, 1, 1, 1, 1,
  1495. 0, 1, 1, 0,
  1496. };
  1497. static const struct group_desc jz4775_groups[] = {
  1498. INGENIC_PIN_GROUP("uart0-data", jz4775_uart0_data, 0),
  1499. INGENIC_PIN_GROUP("uart0-hwflow", jz4775_uart0_hwflow, 0),
  1500. INGENIC_PIN_GROUP("uart1-data", jz4775_uart1_data, 0),
  1501. INGENIC_PIN_GROUP("uart1-hwflow", jz4775_uart1_hwflow, 0),
  1502. INGENIC_PIN_GROUP("uart2-data-c", jz4775_uart2_data_c, 2),
  1503. INGENIC_PIN_GROUP("uart2-data-f", jz4775_uart2_data_f, 1),
  1504. INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4775_uart3_data,
  1505. jz4775_uart3_data_funcs),
  1506. INGENIC_PIN_GROUP("ssi-dt-a", jz4775_ssi_dt_a, 2),
  1507. INGENIC_PIN_GROUP("ssi-dt-d", jz4775_ssi_dt_d, 1),
  1508. INGENIC_PIN_GROUP("ssi-dr-a", jz4775_ssi_dr_a, 2),
  1509. INGENIC_PIN_GROUP("ssi-dr-d", jz4775_ssi_dr_d, 1),
  1510. INGENIC_PIN_GROUP("ssi-clk-a", jz4775_ssi_clk_a, 2),
  1511. INGENIC_PIN_GROUP("ssi-clk-d", jz4775_ssi_clk_d, 1),
  1512. INGENIC_PIN_GROUP("ssi-gpc", jz4775_ssi_gpc, 1),
  1513. INGENIC_PIN_GROUP("ssi-ce0-a", jz4775_ssi_ce0_a, 2),
  1514. INGENIC_PIN_GROUP("ssi-ce0-d", jz4775_ssi_ce0_d, 1),
  1515. INGENIC_PIN_GROUP("ssi-ce1", jz4775_ssi_ce1, 1),
  1516. INGENIC_PIN_GROUP("mmc0-1bit-a", jz4775_mmc0_1bit_a, 1),
  1517. INGENIC_PIN_GROUP("mmc0-4bit-a", jz4775_mmc0_4bit_a, 1),
  1518. INGENIC_PIN_GROUP("mmc0-8bit-a", jz4775_mmc0_8bit_a, 1),
  1519. INGENIC_PIN_GROUP("mmc0-1bit-e", jz4775_mmc0_1bit_e, 0),
  1520. INGENIC_PIN_GROUP("mmc0-4bit-e", jz4775_mmc0_4bit_e, 0),
  1521. INGENIC_PIN_GROUP("mmc1-1bit-d", jz4775_mmc1_1bit_d, 0),
  1522. INGENIC_PIN_GROUP("mmc1-4bit-d", jz4775_mmc1_4bit_d, 0),
  1523. INGENIC_PIN_GROUP("mmc1-1bit-e", jz4775_mmc1_1bit_e, 1),
  1524. INGENIC_PIN_GROUP("mmc1-4bit-e", jz4775_mmc1_4bit_e, 1),
  1525. INGENIC_PIN_GROUP("mmc2-1bit-b", jz4775_mmc2_1bit_b, 0),
  1526. INGENIC_PIN_GROUP("mmc2-4bit-b", jz4775_mmc2_4bit_b, 0),
  1527. INGENIC_PIN_GROUP("mmc2-1bit-e", jz4775_mmc2_1bit_e, 2),
  1528. INGENIC_PIN_GROUP("mmc2-4bit-e", jz4775_mmc2_4bit_e, 2),
  1529. INGENIC_PIN_GROUP("nemc-8bit-data", jz4775_nemc_8bit_data, 0),
  1530. INGENIC_PIN_GROUP("nemc-16bit-data", jz4775_nemc_16bit_data, 1),
  1531. INGENIC_PIN_GROUP("nemc-cle-ale", jz4775_nemc_cle_ale, 0),
  1532. INGENIC_PIN_GROUP("nemc-addr", jz4775_nemc_addr, 0),
  1533. INGENIC_PIN_GROUP("nemc-rd-we", jz4775_nemc_rd_we, 0),
  1534. INGENIC_PIN_GROUP("nemc-frd-fwe", jz4775_nemc_frd_fwe, 0),
  1535. INGENIC_PIN_GROUP("nemc-wait", jz4775_nemc_wait, 0),
  1536. INGENIC_PIN_GROUP("nemc-cs1", jz4775_nemc_cs1, 0),
  1537. INGENIC_PIN_GROUP("nemc-cs2", jz4775_nemc_cs2, 0),
  1538. INGENIC_PIN_GROUP("nemc-cs3", jz4775_nemc_cs3, 0),
  1539. INGENIC_PIN_GROUP("i2c0-data", jz4775_i2c0, 0),
  1540. INGENIC_PIN_GROUP("i2c1-data", jz4775_i2c1, 0),
  1541. INGENIC_PIN_GROUP("i2c2-data", jz4775_i2c2, 1),
  1542. INGENIC_PIN_GROUP("i2s-data-tx", jz4775_i2s_data_tx, 1),
  1543. INGENIC_PIN_GROUP("i2s-data-rx", jz4775_i2s_data_rx, 1),
  1544. INGENIC_PIN_GROUP("i2s-clk-txrx", jz4775_i2s_clk_txrx, 1),
  1545. INGENIC_PIN_GROUP("i2s-sysclk", jz4775_i2s_sysclk, 2),
  1546. INGENIC_PIN_GROUP("dmic", jz4775_dmic, 1),
  1547. INGENIC_PIN_GROUP("cim-data", jz4775_cim, 0),
  1548. INGENIC_PIN_GROUP("lcd-8bit", jz4775_lcd_8bit, 0),
  1549. INGENIC_PIN_GROUP("lcd-16bit", jz4775_lcd_16bit, 0),
  1550. INGENIC_PIN_GROUP("lcd-18bit", jz4775_lcd_18bit, 0),
  1551. INGENIC_PIN_GROUP("lcd-24bit", jz4775_lcd_24bit, 0),
  1552. INGENIC_PIN_GROUP("lcd-generic", jz4775_lcd_generic, 0),
  1553. INGENIC_PIN_GROUP("lcd-special", jz4775_lcd_special, 1),
  1554. INGENIC_PIN_GROUP("pwm0", jz4775_pwm_pwm0, 0),
  1555. INGENIC_PIN_GROUP("pwm1", jz4775_pwm_pwm1, 0),
  1556. INGENIC_PIN_GROUP("pwm2", jz4775_pwm_pwm2, 0),
  1557. INGENIC_PIN_GROUP("pwm3", jz4775_pwm_pwm3, 0),
  1558. INGENIC_PIN_GROUP("mac-rmii", jz4775_mac_rmii, 0),
  1559. INGENIC_PIN_GROUP_FUNCS("mac-mii", jz4775_mac_mii,
  1560. jz4775_mac_mii_funcs),
  1561. INGENIC_PIN_GROUP_FUNCS("mac-rgmii", jz4775_mac_rgmii,
  1562. jz4775_mac_rgmii_funcs),
  1563. INGENIC_PIN_GROUP_FUNCS("mac-gmii", jz4775_mac_gmii,
  1564. jz4775_mac_gmii_funcs),
  1565. INGENIC_PIN_GROUP("otg-vbus", jz4775_otg, 0),
  1566. };
  1567. static const char *jz4775_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  1568. static const char *jz4775_uart1_groups[] = { "uart1-data", "uart1-hwflow", };
  1569. static const char *jz4775_uart2_groups[] = { "uart2-data-c", "uart2-data-f", };
  1570. static const char *jz4775_uart3_groups[] = { "uart3-data", };
  1571. static const char *jz4775_ssi_groups[] = {
  1572. "ssi-dt-a", "ssi-dt-d",
  1573. "ssi-dr-a", "ssi-dr-d",
  1574. "ssi-clk-a", "ssi-clk-d",
  1575. "ssi-gpc",
  1576. "ssi-ce0-a", "ssi-ce0-d",
  1577. "ssi-ce1",
  1578. };
  1579. static const char *jz4775_mmc0_groups[] = {
  1580. "mmc0-1bit-a", "mmc0-4bit-a", "mmc0-8bit-a",
  1581. "mmc0-1bit-e", "mmc0-4bit-e",
  1582. };
  1583. static const char *jz4775_mmc1_groups[] = {
  1584. "mmc1-1bit-d", "mmc1-4bit-d",
  1585. "mmc1-1bit-e", "mmc1-4bit-e",
  1586. };
  1587. static const char *jz4775_mmc2_groups[] = {
  1588. "mmc2-1bit-b", "mmc2-4bit-b",
  1589. "mmc2-1bit-e", "mmc2-4bit-e",
  1590. };
  1591. static const char *jz4775_nemc_groups[] = {
  1592. "nemc-8bit-data", "nemc-16bit-data", "nemc-cle-ale",
  1593. "nemc-addr", "nemc-rd-we", "nemc-frd-fwe", "nemc-wait",
  1594. };
  1595. static const char *jz4775_cs1_groups[] = { "nemc-cs1", };
  1596. static const char *jz4775_cs2_groups[] = { "nemc-cs2", };
  1597. static const char *jz4775_cs3_groups[] = { "nemc-cs3", };
  1598. static const char *jz4775_i2c0_groups[] = { "i2c0-data", };
  1599. static const char *jz4775_i2c1_groups[] = { "i2c1-data", };
  1600. static const char *jz4775_i2c2_groups[] = { "i2c2-data", };
  1601. static const char *jz4775_i2s_groups[] = {
  1602. "i2s-data-tx", "i2s-data-rx", "i2s-clk-txrx", "i2s-sysclk",
  1603. };
  1604. static const char *jz4775_dmic_groups[] = { "dmic", };
  1605. static const char *jz4775_cim_groups[] = { "cim-data", };
  1606. static const char *jz4775_lcd_groups[] = {
  1607. "lcd-8bit", "lcd-16bit", "lcd-18bit", "lcd-24bit",
  1608. "lcd-special", "lcd-generic",
  1609. };
  1610. static const char *jz4775_pwm0_groups[] = { "pwm0", };
  1611. static const char *jz4775_pwm1_groups[] = { "pwm1", };
  1612. static const char *jz4775_pwm2_groups[] = { "pwm2", };
  1613. static const char *jz4775_pwm3_groups[] = { "pwm3", };
  1614. static const char *jz4775_mac_groups[] = {
  1615. "mac-rmii", "mac-mii", "mac-rgmii", "mac-gmii",
  1616. };
  1617. static const char *jz4775_otg_groups[] = { "otg-vbus", };
  1618. static const struct function_desc jz4775_functions[] = {
  1619. INGENIC_PIN_FUNCTION("uart0", jz4775_uart0),
  1620. INGENIC_PIN_FUNCTION("uart1", jz4775_uart1),
  1621. INGENIC_PIN_FUNCTION("uart2", jz4775_uart2),
  1622. INGENIC_PIN_FUNCTION("uart3", jz4775_uart3),
  1623. INGENIC_PIN_FUNCTION("ssi", jz4775_ssi),
  1624. INGENIC_PIN_FUNCTION("mmc0", jz4775_mmc0),
  1625. INGENIC_PIN_FUNCTION("mmc1", jz4775_mmc1),
  1626. INGENIC_PIN_FUNCTION("mmc2", jz4775_mmc2),
  1627. INGENIC_PIN_FUNCTION("nemc", jz4775_nemc),
  1628. INGENIC_PIN_FUNCTION("nemc-cs1", jz4775_cs1),
  1629. INGENIC_PIN_FUNCTION("nemc-cs2", jz4775_cs2),
  1630. INGENIC_PIN_FUNCTION("nemc-cs3", jz4775_cs3),
  1631. INGENIC_PIN_FUNCTION("i2c0", jz4775_i2c0),
  1632. INGENIC_PIN_FUNCTION("i2c1", jz4775_i2c1),
  1633. INGENIC_PIN_FUNCTION("i2c2", jz4775_i2c2),
  1634. INGENIC_PIN_FUNCTION("i2s", jz4775_i2s),
  1635. INGENIC_PIN_FUNCTION("dmic", jz4775_dmic),
  1636. INGENIC_PIN_FUNCTION("cim", jz4775_cim),
  1637. INGENIC_PIN_FUNCTION("lcd", jz4775_lcd),
  1638. INGENIC_PIN_FUNCTION("pwm0", jz4775_pwm0),
  1639. INGENIC_PIN_FUNCTION("pwm1", jz4775_pwm1),
  1640. INGENIC_PIN_FUNCTION("pwm2", jz4775_pwm2),
  1641. INGENIC_PIN_FUNCTION("pwm3", jz4775_pwm3),
  1642. INGENIC_PIN_FUNCTION("mac", jz4775_mac),
  1643. INGENIC_PIN_FUNCTION("otg", jz4775_otg),
  1644. };
  1645. static const struct ingenic_chip_info jz4775_chip_info = {
  1646. .num_chips = 7,
  1647. .reg_offset = 0x100,
  1648. .version = ID_JZ4775,
  1649. .groups = jz4775_groups,
  1650. .num_groups = ARRAY_SIZE(jz4775_groups),
  1651. .functions = jz4775_functions,
  1652. .num_functions = ARRAY_SIZE(jz4775_functions),
  1653. .pull_ups = jz4775_pull_ups,
  1654. .pull_downs = jz4775_pull_downs,
  1655. };
  1656. static const u32 jz4780_pull_ups[6] = {
  1657. 0x3fffffff, 0xfff0f3fc, 0x0fffffff, 0xffff4fff, 0xfffffb7c, 0x7fa7f00f,
  1658. };
  1659. static const u32 jz4780_pull_downs[6] = {
  1660. 0x00000000, 0x000f0c03, 0x00000000, 0x0000b000, 0x00000483, 0x00580ff0,
  1661. };
  1662. static int jz4780_uart2_data_pins[] = { 0x66, 0x67, };
  1663. static int jz4780_uart2_hwflow_pins[] = { 0x65, 0x64, };
  1664. static int jz4780_uart4_data_pins[] = { 0x54, 0x4a, };
  1665. static int jz4780_ssi0_dt_a_19_pins[] = { 0x13, };
  1666. static int jz4780_ssi0_dt_a_21_pins[] = { 0x15, };
  1667. static int jz4780_ssi0_dt_a_28_pins[] = { 0x1c, };
  1668. static int jz4780_ssi0_dt_b_pins[] = { 0x3d, };
  1669. static int jz4780_ssi0_dt_d_pins[] = { 0x79, };
  1670. static int jz4780_ssi0_dr_a_20_pins[] = { 0x14, };
  1671. static int jz4780_ssi0_dr_a_27_pins[] = { 0x1b, };
  1672. static int jz4780_ssi0_dr_b_pins[] = { 0x34, };
  1673. static int jz4780_ssi0_dr_d_pins[] = { 0x74, };
  1674. static int jz4780_ssi0_clk_a_pins[] = { 0x12, };
  1675. static int jz4780_ssi0_clk_b_5_pins[] = { 0x25, };
  1676. static int jz4780_ssi0_clk_b_28_pins[] = { 0x3c, };
  1677. static int jz4780_ssi0_clk_d_pins[] = { 0x78, };
  1678. static int jz4780_ssi0_gpc_b_pins[] = { 0x3e, };
  1679. static int jz4780_ssi0_gpc_d_pins[] = { 0x76, };
  1680. static int jz4780_ssi0_ce0_a_23_pins[] = { 0x17, };
  1681. static int jz4780_ssi0_ce0_a_25_pins[] = { 0x19, };
  1682. static int jz4780_ssi0_ce0_b_pins[] = { 0x3f, };
  1683. static int jz4780_ssi0_ce0_d_pins[] = { 0x77, };
  1684. static int jz4780_ssi0_ce1_b_pins[] = { 0x35, };
  1685. static int jz4780_ssi0_ce1_d_pins[] = { 0x75, };
  1686. static int jz4780_ssi1_dt_b_pins[] = { 0x3d, };
  1687. static int jz4780_ssi1_dt_d_pins[] = { 0x79, };
  1688. static int jz4780_ssi1_dr_b_pins[] = { 0x34, };
  1689. static int jz4780_ssi1_dr_d_pins[] = { 0x74, };
  1690. static int jz4780_ssi1_clk_b_pins[] = { 0x3c, };
  1691. static int jz4780_ssi1_clk_d_pins[] = { 0x78, };
  1692. static int jz4780_ssi1_gpc_b_pins[] = { 0x3e, };
  1693. static int jz4780_ssi1_gpc_d_pins[] = { 0x76, };
  1694. static int jz4780_ssi1_ce0_b_pins[] = { 0x3f, };
  1695. static int jz4780_ssi1_ce0_d_pins[] = { 0x77, };
  1696. static int jz4780_ssi1_ce1_b_pins[] = { 0x35, };
  1697. static int jz4780_ssi1_ce1_d_pins[] = { 0x75, };
  1698. static int jz4780_mmc0_8bit_a_pins[] = { 0x04, 0x05, 0x06, 0x07, 0x18, };
  1699. static int jz4780_i2c3_pins[] = { 0x6a, 0x6b, };
  1700. static int jz4780_i2c4_e_pins[] = { 0x8c, 0x8d, };
  1701. static int jz4780_i2c4_f_pins[] = { 0xb9, 0xb8, };
  1702. static int jz4780_i2s_data_tx_pins[] = { 0x87, };
  1703. static int jz4780_i2s_data_rx_pins[] = { 0x86, };
  1704. static int jz4780_i2s_clk_txrx_pins[] = { 0x6c, 0x6d, };
  1705. static int jz4780_i2s_clk_rx_pins[] = { 0x88, 0x89, };
  1706. static int jz4780_i2s_sysclk_pins[] = { 0x85, };
  1707. static int jz4780_dmic_pins[] = { 0x32, 0x33, };
  1708. static int jz4780_hdmi_ddc_pins[] = { 0xb9, 0xb8, };
  1709. static u8 jz4780_i2s_clk_txrx_funcs[] = { 1, 0, };
  1710. static const struct group_desc jz4780_groups[] = {
  1711. INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data, 0),
  1712. INGENIC_PIN_GROUP("uart0-hwflow", jz4770_uart0_hwflow, 0),
  1713. INGENIC_PIN_GROUP("uart1-data", jz4770_uart1_data, 0),
  1714. INGENIC_PIN_GROUP("uart1-hwflow", jz4770_uart1_hwflow, 0),
  1715. INGENIC_PIN_GROUP("uart2-data", jz4780_uart2_data, 1),
  1716. INGENIC_PIN_GROUP("uart2-hwflow", jz4780_uart2_hwflow, 1),
  1717. INGENIC_PIN_GROUP_FUNCS("uart3-data", jz4770_uart3_data,
  1718. jz4760_uart3_data_funcs),
  1719. INGENIC_PIN_GROUP("uart3-hwflow", jz4770_uart3_hwflow, 0),
  1720. INGENIC_PIN_GROUP("uart4-data", jz4780_uart4_data, 2),
  1721. INGENIC_PIN_GROUP("ssi0-dt-a-19", jz4780_ssi0_dt_a_19, 2),
  1722. INGENIC_PIN_GROUP("ssi0-dt-a-21", jz4780_ssi0_dt_a_21, 2),
  1723. INGENIC_PIN_GROUP("ssi0-dt-a-28", jz4780_ssi0_dt_a_28, 2),
  1724. INGENIC_PIN_GROUP("ssi0-dt-b", jz4780_ssi0_dt_b, 1),
  1725. INGENIC_PIN_GROUP("ssi0-dt-d", jz4780_ssi0_dt_d, 1),
  1726. INGENIC_PIN_GROUP("ssi0-dt-e", jz4770_ssi0_dt_e, 0),
  1727. INGENIC_PIN_GROUP("ssi0-dr-a-20", jz4780_ssi0_dr_a_20, 2),
  1728. INGENIC_PIN_GROUP("ssi0-dr-a-27", jz4780_ssi0_dr_a_27, 2),
  1729. INGENIC_PIN_GROUP("ssi0-dr-b", jz4780_ssi0_dr_b, 1),
  1730. INGENIC_PIN_GROUP("ssi0-dr-d", jz4780_ssi0_dr_d, 1),
  1731. INGENIC_PIN_GROUP("ssi0-dr-e", jz4770_ssi0_dr_e, 0),
  1732. INGENIC_PIN_GROUP("ssi0-clk-a", jz4780_ssi0_clk_a, 2),
  1733. INGENIC_PIN_GROUP("ssi0-clk-b-5", jz4780_ssi0_clk_b_5, 1),
  1734. INGENIC_PIN_GROUP("ssi0-clk-b-28", jz4780_ssi0_clk_b_28, 1),
  1735. INGENIC_PIN_GROUP("ssi0-clk-d", jz4780_ssi0_clk_d, 1),
  1736. INGENIC_PIN_GROUP("ssi0-clk-e", jz4770_ssi0_clk_e, 0),
  1737. INGENIC_PIN_GROUP("ssi0-gpc-b", jz4780_ssi0_gpc_b, 1),
  1738. INGENIC_PIN_GROUP("ssi0-gpc-d", jz4780_ssi0_gpc_d, 1),
  1739. INGENIC_PIN_GROUP("ssi0-gpc-e", jz4770_ssi0_gpc_e, 0),
  1740. INGENIC_PIN_GROUP("ssi0-ce0-a-23", jz4780_ssi0_ce0_a_23, 2),
  1741. INGENIC_PIN_GROUP("ssi0-ce0-a-25", jz4780_ssi0_ce0_a_25, 2),
  1742. INGENIC_PIN_GROUP("ssi0-ce0-b", jz4780_ssi0_ce0_b, 1),
  1743. INGENIC_PIN_GROUP("ssi0-ce0-d", jz4780_ssi0_ce0_d, 1),
  1744. INGENIC_PIN_GROUP("ssi0-ce0-e", jz4770_ssi0_ce0_e, 0),
  1745. INGENIC_PIN_GROUP("ssi0-ce1-b", jz4780_ssi0_ce1_b, 1),
  1746. INGENIC_PIN_GROUP("ssi0-ce1-d", jz4780_ssi0_ce1_d, 1),
  1747. INGENIC_PIN_GROUP("ssi0-ce1-e", jz4770_ssi0_ce1_e, 0),
  1748. INGENIC_PIN_GROUP("ssi1-dt-b", jz4780_ssi1_dt_b, 2),
  1749. INGENIC_PIN_GROUP("ssi1-dt-d", jz4780_ssi1_dt_d, 2),
  1750. INGENIC_PIN_GROUP("ssi1-dt-e", jz4770_ssi1_dt_e, 1),
  1751. INGENIC_PIN_GROUP("ssi1-dr-b", jz4780_ssi1_dr_b, 2),
  1752. INGENIC_PIN_GROUP("ssi1-dr-d", jz4780_ssi1_dr_d, 2),
  1753. INGENIC_PIN_GROUP("ssi1-dr-e", jz4770_ssi1_dr_e, 1),
  1754. INGENIC_PIN_GROUP("ssi1-clk-b", jz4780_ssi1_clk_b, 2),
  1755. INGENIC_PIN_GROUP("ssi1-clk-d", jz4780_ssi1_clk_d, 2),
  1756. INGENIC_PIN_GROUP("ssi1-clk-e", jz4770_ssi1_clk_e, 1),
  1757. INGENIC_PIN_GROUP("ssi1-gpc-b", jz4780_ssi1_gpc_b, 2),
  1758. INGENIC_PIN_GROUP("ssi1-gpc-d", jz4780_ssi1_gpc_d, 2),
  1759. INGENIC_PIN_GROUP("ssi1-gpc-e", jz4770_ssi1_gpc_e, 1),
  1760. INGENIC_PIN_GROUP("ssi1-ce0-b", jz4780_ssi1_ce0_b, 2),
  1761. INGENIC_PIN_GROUP("ssi1-ce0-d", jz4780_ssi1_ce0_d, 2),
  1762. INGENIC_PIN_GROUP("ssi1-ce0-e", jz4770_ssi1_ce0_e, 1),
  1763. INGENIC_PIN_GROUP("ssi1-ce1-b", jz4780_ssi1_ce1_b, 2),
  1764. INGENIC_PIN_GROUP("ssi1-ce1-d", jz4780_ssi1_ce1_d, 2),
  1765. INGENIC_PIN_GROUP("ssi1-ce1-e", jz4770_ssi1_ce1_e, 1),
  1766. INGENIC_PIN_GROUP_FUNCS("mmc0-1bit-a", jz4770_mmc0_1bit_a,
  1767. jz4760_mmc0_1bit_a_funcs),
  1768. INGENIC_PIN_GROUP("mmc0-4bit-a", jz4770_mmc0_4bit_a, 1),
  1769. INGENIC_PIN_GROUP("mmc0-8bit-a", jz4780_mmc0_8bit_a, 1),
  1770. INGENIC_PIN_GROUP("mmc0-1bit-e", jz4770_mmc0_1bit_e, 0),
  1771. INGENIC_PIN_GROUP("mmc0-4bit-e", jz4770_mmc0_4bit_e, 0),
  1772. INGENIC_PIN_GROUP("mmc1-1bit-d", jz4770_mmc1_1bit_d, 0),
  1773. INGENIC_PIN_GROUP("mmc1-4bit-d", jz4770_mmc1_4bit_d, 0),
  1774. INGENIC_PIN_GROUP("mmc1-1bit-e", jz4770_mmc1_1bit_e, 1),
  1775. INGENIC_PIN_GROUP("mmc1-4bit-e", jz4770_mmc1_4bit_e, 1),
  1776. INGENIC_PIN_GROUP("mmc2-1bit-b", jz4770_mmc2_1bit_b, 0),
  1777. INGENIC_PIN_GROUP("mmc2-4bit-b", jz4770_mmc2_4bit_b, 0),
  1778. INGENIC_PIN_GROUP("mmc2-1bit-e", jz4770_mmc2_1bit_e, 2),
  1779. INGENIC_PIN_GROUP("mmc2-4bit-e", jz4770_mmc2_4bit_e, 2),
  1780. INGENIC_PIN_GROUP("nemc-data", jz4770_nemc_8bit_data, 0),
  1781. INGENIC_PIN_GROUP("nemc-cle-ale", jz4770_nemc_cle_ale, 0),
  1782. INGENIC_PIN_GROUP("nemc-addr", jz4770_nemc_addr, 0),
  1783. INGENIC_PIN_GROUP("nemc-rd-we", jz4770_nemc_rd_we, 0),
  1784. INGENIC_PIN_GROUP("nemc-frd-fwe", jz4770_nemc_frd_fwe, 0),
  1785. INGENIC_PIN_GROUP("nemc-wait", jz4770_nemc_wait, 0),
  1786. INGENIC_PIN_GROUP("nemc-cs1", jz4770_nemc_cs1, 0),
  1787. INGENIC_PIN_GROUP("nemc-cs2", jz4770_nemc_cs2, 0),
  1788. INGENIC_PIN_GROUP("nemc-cs3", jz4770_nemc_cs3, 0),
  1789. INGENIC_PIN_GROUP("nemc-cs4", jz4770_nemc_cs4, 0),
  1790. INGENIC_PIN_GROUP("nemc-cs5", jz4770_nemc_cs5, 0),
  1791. INGENIC_PIN_GROUP("nemc-cs6", jz4770_nemc_cs6, 0),
  1792. INGENIC_PIN_GROUP("i2c0-data", jz4770_i2c0, 0),
  1793. INGENIC_PIN_GROUP("i2c1-data", jz4770_i2c1, 0),
  1794. INGENIC_PIN_GROUP("i2c2-data", jz4770_i2c2, 2),
  1795. INGENIC_PIN_GROUP("i2c3-data", jz4780_i2c3, 1),
  1796. INGENIC_PIN_GROUP("i2c4-data-e", jz4780_i2c4_e, 1),
  1797. INGENIC_PIN_GROUP("i2c4-data-f", jz4780_i2c4_f, 1),
  1798. INGENIC_PIN_GROUP("i2s-data-tx", jz4780_i2s_data_tx, 0),
  1799. INGENIC_PIN_GROUP("i2s-data-rx", jz4780_i2s_data_rx, 0),
  1800. INGENIC_PIN_GROUP_FUNCS("i2s-clk-txrx", jz4780_i2s_clk_txrx,
  1801. jz4780_i2s_clk_txrx_funcs),
  1802. INGENIC_PIN_GROUP("i2s-clk-rx", jz4780_i2s_clk_rx, 1),
  1803. INGENIC_PIN_GROUP("i2s-sysclk", jz4780_i2s_sysclk, 2),
  1804. INGENIC_PIN_GROUP("dmic", jz4780_dmic, 1),
  1805. INGENIC_PIN_GROUP("hdmi-ddc", jz4780_hdmi_ddc, 0),
  1806. INGENIC_PIN_GROUP("cim-data", jz4770_cim_8bit, 0),
  1807. INGENIC_PIN_GROUP("cim-data-12bit", jz4770_cim_12bit, 0),
  1808. INGENIC_PIN_GROUP("lcd-8bit", jz4770_lcd_8bit, 0),
  1809. INGENIC_PIN_GROUP("lcd-16bit", jz4770_lcd_16bit, 0),
  1810. INGENIC_PIN_GROUP("lcd-18bit", jz4770_lcd_18bit, 0),
  1811. INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit, 0),
  1812. INGENIC_PIN_GROUP("lcd-special", jz4770_lcd_special, 1),
  1813. INGENIC_PIN_GROUP("lcd-generic", jz4770_lcd_generic, 0),
  1814. INGENIC_PIN_GROUP("pwm0", jz4770_pwm_pwm0, 0),
  1815. INGENIC_PIN_GROUP("pwm1", jz4770_pwm_pwm1, 0),
  1816. INGENIC_PIN_GROUP("pwm2", jz4770_pwm_pwm2, 0),
  1817. INGENIC_PIN_GROUP("pwm3", jz4770_pwm_pwm3, 0),
  1818. INGENIC_PIN_GROUP("pwm4", jz4770_pwm_pwm4, 0),
  1819. INGENIC_PIN_GROUP("pwm5", jz4770_pwm_pwm5, 0),
  1820. INGENIC_PIN_GROUP("pwm6", jz4770_pwm_pwm6, 0),
  1821. INGENIC_PIN_GROUP("pwm7", jz4770_pwm_pwm7, 0),
  1822. };
  1823. static const char *jz4780_uart2_groups[] = { "uart2-data", "uart2-hwflow", };
  1824. static const char *jz4780_uart4_groups[] = { "uart4-data", };
  1825. static const char *jz4780_ssi0_groups[] = {
  1826. "ssi0-dt-a-19", "ssi0-dt-a-21", "ssi0-dt-a-28", "ssi0-dt-b", "ssi0-dt-d", "ssi0-dt-e",
  1827. "ssi0-dr-a-20", "ssi0-dr-a-27", "ssi0-dr-b", "ssi0-dr-d", "ssi0-dr-e",
  1828. "ssi0-clk-a", "ssi0-clk-b-5", "ssi0-clk-b-28", "ssi0-clk-d", "ssi0-clk-e",
  1829. "ssi0-gpc-b", "ssi0-gpc-d", "ssi0-gpc-e",
  1830. "ssi0-ce0-a-23", "ssi0-ce0-a-25", "ssi0-ce0-b", "ssi0-ce0-d", "ssi0-ce0-e",
  1831. "ssi0-ce1-b", "ssi0-ce1-d", "ssi0-ce1-e",
  1832. };
  1833. static const char *jz4780_ssi1_groups[] = {
  1834. "ssi1-dt-b", "ssi1-dt-d", "ssi1-dt-e",
  1835. "ssi1-dr-b", "ssi1-dr-d", "ssi1-dr-e",
  1836. "ssi1-clk-b", "ssi1-clk-d", "ssi1-clk-e",
  1837. "ssi1-gpc-b", "ssi1-gpc-d", "ssi1-gpc-e",
  1838. "ssi1-ce0-b", "ssi1-ce0-d", "ssi1-ce0-e",
  1839. "ssi1-ce1-b", "ssi1-ce1-d", "ssi1-ce1-e",
  1840. };
  1841. static const char *jz4780_mmc0_groups[] = {
  1842. "mmc0-1bit-a", "mmc0-4bit-a", "mmc0-8bit-a",
  1843. "mmc0-1bit-e", "mmc0-4bit-e",
  1844. };
  1845. static const char *jz4780_mmc1_groups[] = {
  1846. "mmc1-1bit-d", "mmc1-4bit-d", "mmc1-1bit-e", "mmc1-4bit-e",
  1847. };
  1848. static const char *jz4780_mmc2_groups[] = {
  1849. "mmc2-1bit-b", "mmc2-4bit-b", "mmc2-1bit-e", "mmc2-4bit-e",
  1850. };
  1851. static const char *jz4780_nemc_groups[] = {
  1852. "nemc-data", "nemc-cle-ale", "nemc-addr",
  1853. "nemc-rd-we", "nemc-frd-fwe", "nemc-wait",
  1854. };
  1855. static const char *jz4780_i2c3_groups[] = { "i2c3-data", };
  1856. static const char *jz4780_i2c4_groups[] = { "i2c4-data-e", "i2c4-data-f", };
  1857. static const char *jz4780_i2s_groups[] = {
  1858. "i2s-data-tx", "i2s-data-rx", "i2s-clk-txrx", "i2s-clk-rx", "i2s-sysclk",
  1859. };
  1860. static const char *jz4780_dmic_groups[] = { "dmic", };
  1861. static const char *jz4780_cim_groups[] = { "cim-data", };
  1862. static const char *jz4780_hdmi_ddc_groups[] = { "hdmi-ddc", };
  1863. static const struct function_desc jz4780_functions[] = {
  1864. INGENIC_PIN_FUNCTION("uart0", jz4770_uart0),
  1865. INGENIC_PIN_FUNCTION("uart1", jz4770_uart1),
  1866. INGENIC_PIN_FUNCTION("uart2", jz4780_uart2),
  1867. INGENIC_PIN_FUNCTION("uart3", jz4770_uart3),
  1868. INGENIC_PIN_FUNCTION("uart4", jz4780_uart4),
  1869. INGENIC_PIN_FUNCTION("ssi0", jz4780_ssi0),
  1870. INGENIC_PIN_FUNCTION("ssi1", jz4780_ssi1),
  1871. INGENIC_PIN_FUNCTION("mmc0", jz4780_mmc0),
  1872. INGENIC_PIN_FUNCTION("mmc1", jz4780_mmc1),
  1873. INGENIC_PIN_FUNCTION("mmc2", jz4780_mmc2),
  1874. INGENIC_PIN_FUNCTION("nemc", jz4780_nemc),
  1875. INGENIC_PIN_FUNCTION("nemc-cs1", jz4770_cs1),
  1876. INGENIC_PIN_FUNCTION("nemc-cs2", jz4770_cs2),
  1877. INGENIC_PIN_FUNCTION("nemc-cs3", jz4770_cs3),
  1878. INGENIC_PIN_FUNCTION("nemc-cs4", jz4770_cs4),
  1879. INGENIC_PIN_FUNCTION("nemc-cs5", jz4770_cs5),
  1880. INGENIC_PIN_FUNCTION("nemc-cs6", jz4770_cs6),
  1881. INGENIC_PIN_FUNCTION("i2c0", jz4770_i2c0),
  1882. INGENIC_PIN_FUNCTION("i2c1", jz4770_i2c1),
  1883. INGENIC_PIN_FUNCTION("i2c2", jz4770_i2c2),
  1884. INGENIC_PIN_FUNCTION("i2c3", jz4780_i2c3),
  1885. INGENIC_PIN_FUNCTION("i2c4", jz4780_i2c4),
  1886. INGENIC_PIN_FUNCTION("i2s", jz4780_i2s),
  1887. INGENIC_PIN_FUNCTION("dmic", jz4780_dmic),
  1888. INGENIC_PIN_FUNCTION("cim", jz4780_cim),
  1889. INGENIC_PIN_FUNCTION("lcd", jz4770_lcd),
  1890. INGENIC_PIN_FUNCTION("pwm0", jz4770_pwm0),
  1891. INGENIC_PIN_FUNCTION("pwm1", jz4770_pwm1),
  1892. INGENIC_PIN_FUNCTION("pwm2", jz4770_pwm2),
  1893. INGENIC_PIN_FUNCTION("pwm3", jz4770_pwm3),
  1894. INGENIC_PIN_FUNCTION("pwm4", jz4770_pwm4),
  1895. INGENIC_PIN_FUNCTION("pwm5", jz4770_pwm5),
  1896. INGENIC_PIN_FUNCTION("pwm6", jz4770_pwm6),
  1897. INGENIC_PIN_FUNCTION("pwm7", jz4770_pwm7),
  1898. INGENIC_PIN_FUNCTION("hdmi-ddc", jz4780_hdmi_ddc),
  1899. };
  1900. static const struct ingenic_chip_info jz4780_chip_info = {
  1901. .num_chips = 6,
  1902. .reg_offset = 0x100,
  1903. .version = ID_JZ4780,
  1904. .groups = jz4780_groups,
  1905. .num_groups = ARRAY_SIZE(jz4780_groups),
  1906. .functions = jz4780_functions,
  1907. .num_functions = ARRAY_SIZE(jz4780_functions),
  1908. .pull_ups = jz4780_pull_ups,
  1909. .pull_downs = jz4780_pull_downs,
  1910. };
  1911. static const u32 x1000_pull_ups[4] = {
  1912. 0xffffffff, 0xfdffffff, 0x0dffffff, 0x0000003f,
  1913. };
  1914. static const u32 x1000_pull_downs[4] = {
  1915. 0x00000000, 0x02000000, 0x02000000, 0x00000000,
  1916. };
  1917. static int x1000_uart0_data_pins[] = { 0x4a, 0x4b, };
  1918. static int x1000_uart0_hwflow_pins[] = { 0x4c, 0x4d, };
  1919. static int x1000_uart1_data_a_pins[] = { 0x04, 0x05, };
  1920. static int x1000_uart1_data_d_pins[] = { 0x62, 0x63, };
  1921. static int x1000_uart1_hwflow_pins[] = { 0x64, 0x65, };
  1922. static int x1000_uart2_data_a_pins[] = { 0x02, 0x03, };
  1923. static int x1000_uart2_data_d_pins[] = { 0x65, 0x64, };
  1924. static int x1000_sfc_data_pins[] = { 0x1d, 0x1c, 0x1e, 0x1f, };
  1925. static int x1000_sfc_clk_pins[] = { 0x1a, };
  1926. static int x1000_sfc_ce_pins[] = { 0x1b, };
  1927. static int x1000_ssi_dt_a_22_pins[] = { 0x16, };
  1928. static int x1000_ssi_dt_a_29_pins[] = { 0x1d, };
  1929. static int x1000_ssi_dt_d_pins[] = { 0x62, };
  1930. static int x1000_ssi_dr_a_23_pins[] = { 0x17, };
  1931. static int x1000_ssi_dr_a_28_pins[] = { 0x1c, };
  1932. static int x1000_ssi_dr_d_pins[] = { 0x63, };
  1933. static int x1000_ssi_clk_a_24_pins[] = { 0x18, };
  1934. static int x1000_ssi_clk_a_26_pins[] = { 0x1a, };
  1935. static int x1000_ssi_clk_d_pins[] = { 0x60, };
  1936. static int x1000_ssi_gpc_a_20_pins[] = { 0x14, };
  1937. static int x1000_ssi_gpc_a_31_pins[] = { 0x1f, };
  1938. static int x1000_ssi_ce0_a_25_pins[] = { 0x19, };
  1939. static int x1000_ssi_ce0_a_27_pins[] = { 0x1b, };
  1940. static int x1000_ssi_ce0_d_pins[] = { 0x61, };
  1941. static int x1000_ssi_ce1_a_21_pins[] = { 0x15, };
  1942. static int x1000_ssi_ce1_a_30_pins[] = { 0x1e, };
  1943. static int x1000_mmc0_1bit_pins[] = { 0x18, 0x19, 0x17, };
  1944. static int x1000_mmc0_4bit_pins[] = { 0x16, 0x15, 0x14, };
  1945. static int x1000_mmc0_8bit_pins[] = { 0x13, 0x12, 0x11, 0x10, };
  1946. static int x1000_mmc1_1bit_pins[] = { 0x40, 0x41, 0x42, };
  1947. static int x1000_mmc1_4bit_pins[] = { 0x43, 0x44, 0x45, };
  1948. static int x1000_emc_8bit_data_pins[] = {
  1949. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  1950. };
  1951. static int x1000_emc_16bit_data_pins[] = {
  1952. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  1953. };
  1954. static int x1000_emc_addr_pins[] = {
  1955. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  1956. 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
  1957. };
  1958. static int x1000_emc_rd_we_pins[] = { 0x30, 0x31, };
  1959. static int x1000_emc_wait_pins[] = { 0x34, };
  1960. static int x1000_emc_cs1_pins[] = { 0x32, };
  1961. static int x1000_emc_cs2_pins[] = { 0x33, };
  1962. static int x1000_i2c0_pins[] = { 0x38, 0x37, };
  1963. static int x1000_i2c1_a_pins[] = { 0x01, 0x00, };
  1964. static int x1000_i2c1_c_pins[] = { 0x5b, 0x5a, };
  1965. static int x1000_i2c2_pins[] = { 0x61, 0x60, };
  1966. static int x1000_i2s_data_tx_pins[] = { 0x24, };
  1967. static int x1000_i2s_data_rx_pins[] = { 0x23, };
  1968. static int x1000_i2s_clk_txrx_pins[] = { 0x21, 0x22, };
  1969. static int x1000_i2s_sysclk_pins[] = { 0x20, };
  1970. static int x1000_dmic_if0_pins[] = { 0x35, 0x36, };
  1971. static int x1000_dmic_if1_pins[] = { 0x25, };
  1972. static int x1000_cim_pins[] = {
  1973. 0x08, 0x09, 0x0a, 0x0b,
  1974. 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c,
  1975. };
  1976. static int x1000_lcd_8bit_pins[] = {
  1977. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  1978. 0x30, 0x31, 0x32, 0x33, 0x34,
  1979. };
  1980. static int x1000_lcd_16bit_pins[] = {
  1981. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  1982. };
  1983. static int x1000_pwm_pwm0_pins[] = { 0x59, };
  1984. static int x1000_pwm_pwm1_pins[] = { 0x5a, };
  1985. static int x1000_pwm_pwm2_pins[] = { 0x5b, };
  1986. static int x1000_pwm_pwm3_pins[] = { 0x26, };
  1987. static int x1000_pwm_pwm4_pins[] = { 0x58, };
  1988. static int x1000_mac_pins[] = {
  1989. 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x26,
  1990. };
  1991. static const struct group_desc x1000_groups[] = {
  1992. INGENIC_PIN_GROUP("uart0-data", x1000_uart0_data, 0),
  1993. INGENIC_PIN_GROUP("uart0-hwflow", x1000_uart0_hwflow, 0),
  1994. INGENIC_PIN_GROUP("uart1-data-a", x1000_uart1_data_a, 2),
  1995. INGENIC_PIN_GROUP("uart1-data-d", x1000_uart1_data_d, 1),
  1996. INGENIC_PIN_GROUP("uart1-hwflow", x1000_uart1_hwflow, 1),
  1997. INGENIC_PIN_GROUP("uart2-data-a", x1000_uart2_data_a, 2),
  1998. INGENIC_PIN_GROUP("uart2-data-d", x1000_uart2_data_d, 0),
  1999. INGENIC_PIN_GROUP("sfc-data", x1000_sfc_data, 1),
  2000. INGENIC_PIN_GROUP("sfc-clk", x1000_sfc_clk, 1),
  2001. INGENIC_PIN_GROUP("sfc-ce", x1000_sfc_ce, 1),
  2002. INGENIC_PIN_GROUP("ssi-dt-a-22", x1000_ssi_dt_a_22, 2),
  2003. INGENIC_PIN_GROUP("ssi-dt-a-29", x1000_ssi_dt_a_29, 2),
  2004. INGENIC_PIN_GROUP("ssi-dt-d", x1000_ssi_dt_d, 0),
  2005. INGENIC_PIN_GROUP("ssi-dr-a-23", x1000_ssi_dr_a_23, 2),
  2006. INGENIC_PIN_GROUP("ssi-dr-a-28", x1000_ssi_dr_a_28, 2),
  2007. INGENIC_PIN_GROUP("ssi-dr-d", x1000_ssi_dr_d, 0),
  2008. INGENIC_PIN_GROUP("ssi-clk-a-24", x1000_ssi_clk_a_24, 2),
  2009. INGENIC_PIN_GROUP("ssi-clk-a-26", x1000_ssi_clk_a_26, 2),
  2010. INGENIC_PIN_GROUP("ssi-clk-d", x1000_ssi_clk_d, 0),
  2011. INGENIC_PIN_GROUP("ssi-gpc-a-20", x1000_ssi_gpc_a_20, 2),
  2012. INGENIC_PIN_GROUP("ssi-gpc-a-31", x1000_ssi_gpc_a_31, 2),
  2013. INGENIC_PIN_GROUP("ssi-ce0-a-25", x1000_ssi_ce0_a_25, 2),
  2014. INGENIC_PIN_GROUP("ssi-ce0-a-27", x1000_ssi_ce0_a_27, 2),
  2015. INGENIC_PIN_GROUP("ssi-ce0-d", x1000_ssi_ce0_d, 0),
  2016. INGENIC_PIN_GROUP("ssi-ce1-a-21", x1000_ssi_ce1_a_21, 2),
  2017. INGENIC_PIN_GROUP("ssi-ce1-a-30", x1000_ssi_ce1_a_30, 2),
  2018. INGENIC_PIN_GROUP("mmc0-1bit", x1000_mmc0_1bit, 1),
  2019. INGENIC_PIN_GROUP("mmc0-4bit", x1000_mmc0_4bit, 1),
  2020. INGENIC_PIN_GROUP("mmc0-8bit", x1000_mmc0_8bit, 1),
  2021. INGENIC_PIN_GROUP("mmc1-1bit", x1000_mmc1_1bit, 0),
  2022. INGENIC_PIN_GROUP("mmc1-4bit", x1000_mmc1_4bit, 0),
  2023. INGENIC_PIN_GROUP("emc-8bit-data", x1000_emc_8bit_data, 0),
  2024. INGENIC_PIN_GROUP("emc-16bit-data", x1000_emc_16bit_data, 0),
  2025. INGENIC_PIN_GROUP("emc-addr", x1000_emc_addr, 0),
  2026. INGENIC_PIN_GROUP("emc-rd-we", x1000_emc_rd_we, 0),
  2027. INGENIC_PIN_GROUP("emc-wait", x1000_emc_wait, 0),
  2028. INGENIC_PIN_GROUP("emc-cs1", x1000_emc_cs1, 0),
  2029. INGENIC_PIN_GROUP("emc-cs2", x1000_emc_cs2, 0),
  2030. INGENIC_PIN_GROUP("i2c0-data", x1000_i2c0, 0),
  2031. INGENIC_PIN_GROUP("i2c1-data-a", x1000_i2c1_a, 2),
  2032. INGENIC_PIN_GROUP("i2c1-data-c", x1000_i2c1_c, 0),
  2033. INGENIC_PIN_GROUP("i2c2-data", x1000_i2c2, 1),
  2034. INGENIC_PIN_GROUP("i2s-data-tx", x1000_i2s_data_tx, 1),
  2035. INGENIC_PIN_GROUP("i2s-data-rx", x1000_i2s_data_rx, 1),
  2036. INGENIC_PIN_GROUP("i2s-clk-txrx", x1000_i2s_clk_txrx, 1),
  2037. INGENIC_PIN_GROUP("i2s-sysclk", x1000_i2s_sysclk, 1),
  2038. INGENIC_PIN_GROUP("dmic-if0", x1000_dmic_if0, 0),
  2039. INGENIC_PIN_GROUP("dmic-if1", x1000_dmic_if1, 1),
  2040. INGENIC_PIN_GROUP("cim-data", x1000_cim, 2),
  2041. INGENIC_PIN_GROUP("lcd-8bit", x1000_lcd_8bit, 1),
  2042. INGENIC_PIN_GROUP("lcd-16bit", x1000_lcd_16bit, 1),
  2043. INGENIC_PIN_GROUP("pwm0", x1000_pwm_pwm0, 0),
  2044. INGENIC_PIN_GROUP("pwm1", x1000_pwm_pwm1, 1),
  2045. INGENIC_PIN_GROUP("pwm2", x1000_pwm_pwm2, 1),
  2046. INGENIC_PIN_GROUP("pwm3", x1000_pwm_pwm3, 2),
  2047. INGENIC_PIN_GROUP("pwm4", x1000_pwm_pwm4, 0),
  2048. INGENIC_PIN_GROUP("mac", x1000_mac, 1),
  2049. };
  2050. static const char *x1000_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  2051. static const char *x1000_uart1_groups[] = {
  2052. "uart1-data-a", "uart1-data-d", "uart1-hwflow",
  2053. };
  2054. static const char *x1000_uart2_groups[] = { "uart2-data-a", "uart2-data-d", };
  2055. static const char *x1000_sfc_groups[] = { "sfc-data", "sfc-clk", "sfc-ce", };
  2056. static const char *x1000_ssi_groups[] = {
  2057. "ssi-dt-a-22", "ssi-dt-a-29", "ssi-dt-d",
  2058. "ssi-dr-a-23", "ssi-dr-a-28", "ssi-dr-d",
  2059. "ssi-clk-a-24", "ssi-clk-a-26", "ssi-clk-d",
  2060. "ssi-gpc-a-20", "ssi-gpc-a-31",
  2061. "ssi-ce0-a-25", "ssi-ce0-a-27", "ssi-ce0-d",
  2062. "ssi-ce1-a-21", "ssi-ce1-a-30",
  2063. };
  2064. static const char *x1000_mmc0_groups[] = {
  2065. "mmc0-1bit", "mmc0-4bit", "mmc0-8bit",
  2066. };
  2067. static const char *x1000_mmc1_groups[] = {
  2068. "mmc1-1bit", "mmc1-4bit",
  2069. };
  2070. static const char *x1000_emc_groups[] = {
  2071. "emc-8bit-data", "emc-16bit-data",
  2072. "emc-addr", "emc-rd-we", "emc-wait",
  2073. };
  2074. static const char *x1000_cs1_groups[] = { "emc-cs1", };
  2075. static const char *x1000_cs2_groups[] = { "emc-cs2", };
  2076. static const char *x1000_i2c0_groups[] = { "i2c0-data", };
  2077. static const char *x1000_i2c1_groups[] = { "i2c1-data-a", "i2c1-data-c", };
  2078. static const char *x1000_i2c2_groups[] = { "i2c2-data", };
  2079. static const char *x1000_i2s_groups[] = {
  2080. "i2s-data-tx", "i2s-data-rx", "i2s-clk-txrx", "i2s-sysclk",
  2081. };
  2082. static const char *x1000_dmic_groups[] = { "dmic-if0", "dmic-if1", };
  2083. static const char *x1000_cim_groups[] = { "cim-data", };
  2084. static const char *x1000_lcd_groups[] = { "lcd-8bit", "lcd-16bit", };
  2085. static const char *x1000_pwm0_groups[] = { "pwm0", };
  2086. static const char *x1000_pwm1_groups[] = { "pwm1", };
  2087. static const char *x1000_pwm2_groups[] = { "pwm2", };
  2088. static const char *x1000_pwm3_groups[] = { "pwm3", };
  2089. static const char *x1000_pwm4_groups[] = { "pwm4", };
  2090. static const char *x1000_mac_groups[] = { "mac", };
  2091. static const struct function_desc x1000_functions[] = {
  2092. INGENIC_PIN_FUNCTION("uart0", x1000_uart0),
  2093. INGENIC_PIN_FUNCTION("uart1", x1000_uart1),
  2094. INGENIC_PIN_FUNCTION("uart2", x1000_uart2),
  2095. INGENIC_PIN_FUNCTION("sfc", x1000_sfc),
  2096. INGENIC_PIN_FUNCTION("ssi", x1000_ssi),
  2097. INGENIC_PIN_FUNCTION("mmc0", x1000_mmc0),
  2098. INGENIC_PIN_FUNCTION("mmc1", x1000_mmc1),
  2099. INGENIC_PIN_FUNCTION("emc", x1000_emc),
  2100. INGENIC_PIN_FUNCTION("emc-cs1", x1000_cs1),
  2101. INGENIC_PIN_FUNCTION("emc-cs2", x1000_cs2),
  2102. INGENIC_PIN_FUNCTION("i2c0", x1000_i2c0),
  2103. INGENIC_PIN_FUNCTION("i2c1", x1000_i2c1),
  2104. INGENIC_PIN_FUNCTION("i2c2", x1000_i2c2),
  2105. INGENIC_PIN_FUNCTION("i2s", x1000_i2s),
  2106. INGENIC_PIN_FUNCTION("dmic", x1000_dmic),
  2107. INGENIC_PIN_FUNCTION("cim", x1000_cim),
  2108. INGENIC_PIN_FUNCTION("lcd", x1000_lcd),
  2109. INGENIC_PIN_FUNCTION("pwm0", x1000_pwm0),
  2110. INGENIC_PIN_FUNCTION("pwm1", x1000_pwm1),
  2111. INGENIC_PIN_FUNCTION("pwm2", x1000_pwm2),
  2112. INGENIC_PIN_FUNCTION("pwm3", x1000_pwm3),
  2113. INGENIC_PIN_FUNCTION("pwm4", x1000_pwm4),
  2114. INGENIC_PIN_FUNCTION("mac", x1000_mac),
  2115. };
  2116. static const struct regmap_range x1000_access_ranges[] = {
  2117. regmap_reg_range(0x000, 0x400 - 4),
  2118. regmap_reg_range(0x700, 0x800 - 4),
  2119. };
  2120. /* shared with X1500 */
  2121. static const struct regmap_access_table x1000_access_table = {
  2122. .yes_ranges = x1000_access_ranges,
  2123. .n_yes_ranges = ARRAY_SIZE(x1000_access_ranges),
  2124. };
  2125. static const struct ingenic_chip_info x1000_chip_info = {
  2126. .num_chips = 4,
  2127. .reg_offset = 0x100,
  2128. .version = ID_X1000,
  2129. .groups = x1000_groups,
  2130. .num_groups = ARRAY_SIZE(x1000_groups),
  2131. .functions = x1000_functions,
  2132. .num_functions = ARRAY_SIZE(x1000_functions),
  2133. .pull_ups = x1000_pull_ups,
  2134. .pull_downs = x1000_pull_downs,
  2135. .access_table = &x1000_access_table,
  2136. };
  2137. static int x1500_uart0_data_pins[] = { 0x4a, 0x4b, };
  2138. static int x1500_uart0_hwflow_pins[] = { 0x4c, 0x4d, };
  2139. static int x1500_uart1_data_a_pins[] = { 0x04, 0x05, };
  2140. static int x1500_uart1_data_d_pins[] = { 0x62, 0x63, };
  2141. static int x1500_uart1_hwflow_pins[] = { 0x64, 0x65, };
  2142. static int x1500_uart2_data_a_pins[] = { 0x02, 0x03, };
  2143. static int x1500_uart2_data_d_pins[] = { 0x65, 0x64, };
  2144. static int x1500_mmc_1bit_pins[] = { 0x18, 0x19, 0x17, };
  2145. static int x1500_mmc_4bit_pins[] = { 0x16, 0x15, 0x14, };
  2146. static int x1500_i2c0_pins[] = { 0x38, 0x37, };
  2147. static int x1500_i2c1_a_pins[] = { 0x01, 0x00, };
  2148. static int x1500_i2c1_c_pins[] = { 0x5b, 0x5a, };
  2149. static int x1500_i2c2_pins[] = { 0x61, 0x60, };
  2150. static int x1500_i2s_data_tx_pins[] = { 0x24, };
  2151. static int x1500_i2s_data_rx_pins[] = { 0x23, };
  2152. static int x1500_i2s_clk_txrx_pins[] = { 0x21, 0x22, };
  2153. static int x1500_i2s_sysclk_pins[] = { 0x20, };
  2154. static int x1500_dmic_if0_pins[] = { 0x35, 0x36, };
  2155. static int x1500_dmic_if1_pins[] = { 0x25, };
  2156. static int x1500_cim_pins[] = {
  2157. 0x08, 0x09, 0x0a, 0x0b,
  2158. 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c,
  2159. };
  2160. static int x1500_pwm_pwm0_pins[] = { 0x59, };
  2161. static int x1500_pwm_pwm1_pins[] = { 0x5a, };
  2162. static int x1500_pwm_pwm2_pins[] = { 0x5b, };
  2163. static int x1500_pwm_pwm3_pins[] = { 0x26, };
  2164. static int x1500_pwm_pwm4_pins[] = { 0x58, };
  2165. static const struct group_desc x1500_groups[] = {
  2166. INGENIC_PIN_GROUP("uart0-data", x1500_uart0_data, 0),
  2167. INGENIC_PIN_GROUP("uart0-hwflow", x1500_uart0_hwflow, 0),
  2168. INGENIC_PIN_GROUP("uart1-data-a", x1500_uart1_data_a, 2),
  2169. INGENIC_PIN_GROUP("uart1-data-d", x1500_uart1_data_d, 1),
  2170. INGENIC_PIN_GROUP("uart1-hwflow", x1500_uart1_hwflow, 1),
  2171. INGENIC_PIN_GROUP("uart2-data-a", x1500_uart2_data_a, 2),
  2172. INGENIC_PIN_GROUP("uart2-data-d", x1500_uart2_data_d, 0),
  2173. INGENIC_PIN_GROUP("sfc-data", x1000_sfc_data, 1),
  2174. INGENIC_PIN_GROUP("sfc-clk", x1000_sfc_clk, 1),
  2175. INGENIC_PIN_GROUP("sfc-ce", x1000_sfc_ce, 1),
  2176. INGENIC_PIN_GROUP("mmc-1bit", x1500_mmc_1bit, 1),
  2177. INGENIC_PIN_GROUP("mmc-4bit", x1500_mmc_4bit, 1),
  2178. INGENIC_PIN_GROUP("i2c0-data", x1500_i2c0, 0),
  2179. INGENIC_PIN_GROUP("i2c1-data-a", x1500_i2c1_a, 2),
  2180. INGENIC_PIN_GROUP("i2c1-data-c", x1500_i2c1_c, 0),
  2181. INGENIC_PIN_GROUP("i2c2-data", x1500_i2c2, 1),
  2182. INGENIC_PIN_GROUP("i2s-data-tx", x1500_i2s_data_tx, 1),
  2183. INGENIC_PIN_GROUP("i2s-data-rx", x1500_i2s_data_rx, 1),
  2184. INGENIC_PIN_GROUP("i2s-clk-txrx", x1500_i2s_clk_txrx, 1),
  2185. INGENIC_PIN_GROUP("i2s-sysclk", x1500_i2s_sysclk, 1),
  2186. INGENIC_PIN_GROUP("dmic-if0", x1500_dmic_if0, 0),
  2187. INGENIC_PIN_GROUP("dmic-if1", x1500_dmic_if1, 1),
  2188. INGENIC_PIN_GROUP("cim-data", x1500_cim, 2),
  2189. INGENIC_PIN_GROUP("pwm0", x1500_pwm_pwm0, 0),
  2190. INGENIC_PIN_GROUP("pwm1", x1500_pwm_pwm1, 1),
  2191. INGENIC_PIN_GROUP("pwm2", x1500_pwm_pwm2, 1),
  2192. INGENIC_PIN_GROUP("pwm3", x1500_pwm_pwm3, 2),
  2193. INGENIC_PIN_GROUP("pwm4", x1500_pwm_pwm4, 0),
  2194. };
  2195. static const char *x1500_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  2196. static const char *x1500_uart1_groups[] = {
  2197. "uart1-data-a", "uart1-data-d", "uart1-hwflow",
  2198. };
  2199. static const char *x1500_uart2_groups[] = { "uart2-data-a", "uart2-data-d", };
  2200. static const char *x1500_mmc_groups[] = { "mmc-1bit", "mmc-4bit", };
  2201. static const char *x1500_i2c0_groups[] = { "i2c0-data", };
  2202. static const char *x1500_i2c1_groups[] = { "i2c1-data-a", "i2c1-data-c", };
  2203. static const char *x1500_i2c2_groups[] = { "i2c2-data", };
  2204. static const char *x1500_i2s_groups[] = {
  2205. "i2s-data-tx", "i2s-data-rx", "i2s-clk-txrx", "i2s-sysclk",
  2206. };
  2207. static const char *x1500_dmic_groups[] = { "dmic-if0", "dmic-if1", };
  2208. static const char *x1500_cim_groups[] = { "cim-data", };
  2209. static const char *x1500_pwm0_groups[] = { "pwm0", };
  2210. static const char *x1500_pwm1_groups[] = { "pwm1", };
  2211. static const char *x1500_pwm2_groups[] = { "pwm2", };
  2212. static const char *x1500_pwm3_groups[] = { "pwm3", };
  2213. static const char *x1500_pwm4_groups[] = { "pwm4", };
  2214. static const struct function_desc x1500_functions[] = {
  2215. INGENIC_PIN_FUNCTION("uart0", x1500_uart0),
  2216. INGENIC_PIN_FUNCTION("uart1", x1500_uart1),
  2217. INGENIC_PIN_FUNCTION("uart2", x1500_uart2),
  2218. INGENIC_PIN_FUNCTION("sfc", x1000_sfc),
  2219. INGENIC_PIN_FUNCTION("mmc", x1500_mmc),
  2220. INGENIC_PIN_FUNCTION("i2c0", x1500_i2c0),
  2221. INGENIC_PIN_FUNCTION("i2c1", x1500_i2c1),
  2222. INGENIC_PIN_FUNCTION("i2c2", x1500_i2c2),
  2223. INGENIC_PIN_FUNCTION("i2s", x1500_i2s),
  2224. INGENIC_PIN_FUNCTION("dmic", x1500_dmic),
  2225. INGENIC_PIN_FUNCTION("cim", x1500_cim),
  2226. INGENIC_PIN_FUNCTION("pwm0", x1500_pwm0),
  2227. INGENIC_PIN_FUNCTION("pwm1", x1500_pwm1),
  2228. INGENIC_PIN_FUNCTION("pwm2", x1500_pwm2),
  2229. INGENIC_PIN_FUNCTION("pwm3", x1500_pwm3),
  2230. INGENIC_PIN_FUNCTION("pwm4", x1500_pwm4),
  2231. };
  2232. static const struct ingenic_chip_info x1500_chip_info = {
  2233. .num_chips = 4,
  2234. .reg_offset = 0x100,
  2235. .version = ID_X1500,
  2236. .groups = x1500_groups,
  2237. .num_groups = ARRAY_SIZE(x1500_groups),
  2238. .functions = x1500_functions,
  2239. .num_functions = ARRAY_SIZE(x1500_functions),
  2240. .pull_ups = x1000_pull_ups,
  2241. .pull_downs = x1000_pull_downs,
  2242. .access_table = &x1000_access_table,
  2243. };
  2244. static const u32 x1830_pull_ups[4] = {
  2245. 0x5fdfffc0, 0xffffefff, 0x1ffffbff, 0x0fcff3fc,
  2246. };
  2247. static const u32 x1830_pull_downs[4] = {
  2248. 0x5fdfffc0, 0xffffefff, 0x1ffffbff, 0x0fcff3fc,
  2249. };
  2250. static int x1830_uart0_data_pins[] = { 0x33, 0x36, };
  2251. static int x1830_uart0_hwflow_pins[] = { 0x34, 0x35, };
  2252. static int x1830_uart1_data_pins[] = { 0x38, 0x37, };
  2253. static int x1830_sfc_data_pins[] = { 0x17, 0x18, 0x1a, 0x19, };
  2254. static int x1830_sfc_clk_pins[] = { 0x1b, };
  2255. static int x1830_sfc_ce_pins[] = { 0x1c, };
  2256. static int x1830_ssi0_dt_pins[] = { 0x4c, };
  2257. static int x1830_ssi0_dr_pins[] = { 0x4b, };
  2258. static int x1830_ssi0_clk_pins[] = { 0x4f, };
  2259. static int x1830_ssi0_gpc_pins[] = { 0x4d, };
  2260. static int x1830_ssi0_ce0_pins[] = { 0x50, };
  2261. static int x1830_ssi0_ce1_pins[] = { 0x4e, };
  2262. static int x1830_ssi1_dt_c_pins[] = { 0x53, };
  2263. static int x1830_ssi1_dt_d_pins[] = { 0x62, };
  2264. static int x1830_ssi1_dr_c_pins[] = { 0x54, };
  2265. static int x1830_ssi1_dr_d_pins[] = { 0x63, };
  2266. static int x1830_ssi1_clk_c_pins[] = { 0x57, };
  2267. static int x1830_ssi1_clk_d_pins[] = { 0x66, };
  2268. static int x1830_ssi1_gpc_c_pins[] = { 0x55, };
  2269. static int x1830_ssi1_gpc_d_pins[] = { 0x64, };
  2270. static int x1830_ssi1_ce0_c_pins[] = { 0x58, };
  2271. static int x1830_ssi1_ce0_d_pins[] = { 0x67, };
  2272. static int x1830_ssi1_ce1_c_pins[] = { 0x56, };
  2273. static int x1830_ssi1_ce1_d_pins[] = { 0x65, };
  2274. static int x1830_mmc0_1bit_pins[] = { 0x24, 0x25, 0x20, };
  2275. static int x1830_mmc0_4bit_pins[] = { 0x21, 0x22, 0x23, };
  2276. static int x1830_mmc1_1bit_pins[] = { 0x42, 0x43, 0x44, };
  2277. static int x1830_mmc1_4bit_pins[] = { 0x45, 0x46, 0x47, };
  2278. static int x1830_i2c0_pins[] = { 0x0c, 0x0d, };
  2279. static int x1830_i2c1_pins[] = { 0x39, 0x3a, };
  2280. static int x1830_i2c2_pins[] = { 0x5b, 0x5c, };
  2281. static int x1830_i2s_data_tx_pins[] = { 0x53, };
  2282. static int x1830_i2s_data_rx_pins[] = { 0x54, };
  2283. static int x1830_i2s_clk_txrx_pins[] = { 0x58, 0x52, };
  2284. static int x1830_i2s_clk_rx_pins[] = { 0x56, 0x55, };
  2285. static int x1830_i2s_sysclk_pins[] = { 0x57, };
  2286. static int x1830_dmic_if0_pins[] = { 0x48, 0x59, };
  2287. static int x1830_dmic_if1_pins[] = { 0x5a, };
  2288. static int x1830_lcd_tft_8bit_pins[] = {
  2289. 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
  2290. 0x68, 0x73, 0x72, 0x69,
  2291. };
  2292. static int x1830_lcd_tft_24bit_pins[] = {
  2293. 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71,
  2294. 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b,
  2295. };
  2296. static int x1830_lcd_slcd_8bit_pins[] = {
  2297. 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x6c, 0x6d,
  2298. 0x69, 0x72, 0x73, 0x7b, 0x7a,
  2299. };
  2300. static int x1830_lcd_slcd_16bit_pins[] = {
  2301. 0x6e, 0x6f, 0x70, 0x71, 0x76, 0x77, 0x78, 0x79,
  2302. };
  2303. static int x1830_pwm_pwm0_b_pins[] = { 0x31, };
  2304. static int x1830_pwm_pwm0_c_pins[] = { 0x4b, };
  2305. static int x1830_pwm_pwm1_b_pins[] = { 0x32, };
  2306. static int x1830_pwm_pwm1_c_pins[] = { 0x4c, };
  2307. static int x1830_pwm_pwm2_c_8_pins[] = { 0x48, };
  2308. static int x1830_pwm_pwm2_c_13_pins[] = { 0x4d, };
  2309. static int x1830_pwm_pwm3_c_9_pins[] = { 0x49, };
  2310. static int x1830_pwm_pwm3_c_14_pins[] = { 0x4e, };
  2311. static int x1830_pwm_pwm4_c_15_pins[] = { 0x4f, };
  2312. static int x1830_pwm_pwm4_c_25_pins[] = { 0x59, };
  2313. static int x1830_pwm_pwm5_c_16_pins[] = { 0x50, };
  2314. static int x1830_pwm_pwm5_c_26_pins[] = { 0x5a, };
  2315. static int x1830_pwm_pwm6_c_17_pins[] = { 0x51, };
  2316. static int x1830_pwm_pwm6_c_27_pins[] = { 0x5b, };
  2317. static int x1830_pwm_pwm7_c_18_pins[] = { 0x52, };
  2318. static int x1830_pwm_pwm7_c_28_pins[] = { 0x5c, };
  2319. static int x1830_mac_pins[] = {
  2320. 0x29, 0x30, 0x2f, 0x28, 0x2e, 0x2d, 0x2a, 0x2b, 0x26, 0x27,
  2321. };
  2322. static const struct group_desc x1830_groups[] = {
  2323. INGENIC_PIN_GROUP("uart0-data", x1830_uart0_data, 0),
  2324. INGENIC_PIN_GROUP("uart0-hwflow", x1830_uart0_hwflow, 0),
  2325. INGENIC_PIN_GROUP("uart1-data", x1830_uart1_data, 0),
  2326. INGENIC_PIN_GROUP("sfc-data", x1830_sfc_data, 1),
  2327. INGENIC_PIN_GROUP("sfc-clk", x1830_sfc_clk, 1),
  2328. INGENIC_PIN_GROUP("sfc-ce", x1830_sfc_ce, 1),
  2329. INGENIC_PIN_GROUP("ssi0-dt", x1830_ssi0_dt, 0),
  2330. INGENIC_PIN_GROUP("ssi0-dr", x1830_ssi0_dr, 0),
  2331. INGENIC_PIN_GROUP("ssi0-clk", x1830_ssi0_clk, 0),
  2332. INGENIC_PIN_GROUP("ssi0-gpc", x1830_ssi0_gpc, 0),
  2333. INGENIC_PIN_GROUP("ssi0-ce0", x1830_ssi0_ce0, 0),
  2334. INGENIC_PIN_GROUP("ssi0-ce1", x1830_ssi0_ce1, 0),
  2335. INGENIC_PIN_GROUP("ssi1-dt-c", x1830_ssi1_dt_c, 1),
  2336. INGENIC_PIN_GROUP("ssi1-dr-c", x1830_ssi1_dr_c, 1),
  2337. INGENIC_PIN_GROUP("ssi1-clk-c", x1830_ssi1_clk_c, 1),
  2338. INGENIC_PIN_GROUP("ssi1-gpc-c", x1830_ssi1_gpc_c, 1),
  2339. INGENIC_PIN_GROUP("ssi1-ce0-c", x1830_ssi1_ce0_c, 1),
  2340. INGENIC_PIN_GROUP("ssi1-ce1-c", x1830_ssi1_ce1_c, 1),
  2341. INGENIC_PIN_GROUP("ssi1-dt-d", x1830_ssi1_dt_d, 2),
  2342. INGENIC_PIN_GROUP("ssi1-dr-d", x1830_ssi1_dr_d, 2),
  2343. INGENIC_PIN_GROUP("ssi1-clk-d", x1830_ssi1_clk_d, 2),
  2344. INGENIC_PIN_GROUP("ssi1-gpc-d", x1830_ssi1_gpc_d, 2),
  2345. INGENIC_PIN_GROUP("ssi1-ce0-d", x1830_ssi1_ce0_d, 2),
  2346. INGENIC_PIN_GROUP("ssi1-ce1-d", x1830_ssi1_ce1_d, 2),
  2347. INGENIC_PIN_GROUP("mmc0-1bit", x1830_mmc0_1bit, 0),
  2348. INGENIC_PIN_GROUP("mmc0-4bit", x1830_mmc0_4bit, 0),
  2349. INGENIC_PIN_GROUP("mmc1-1bit", x1830_mmc1_1bit, 0),
  2350. INGENIC_PIN_GROUP("mmc1-4bit", x1830_mmc1_4bit, 0),
  2351. INGENIC_PIN_GROUP("i2c0-data", x1830_i2c0, 1),
  2352. INGENIC_PIN_GROUP("i2c1-data", x1830_i2c1, 0),
  2353. INGENIC_PIN_GROUP("i2c2-data", x1830_i2c2, 1),
  2354. INGENIC_PIN_GROUP("i2s-data-tx", x1830_i2s_data_tx, 0),
  2355. INGENIC_PIN_GROUP("i2s-data-rx", x1830_i2s_data_rx, 0),
  2356. INGENIC_PIN_GROUP("i2s-clk-txrx", x1830_i2s_clk_txrx, 0),
  2357. INGENIC_PIN_GROUP("i2s-clk-rx", x1830_i2s_clk_rx, 0),
  2358. INGENIC_PIN_GROUP("i2s-sysclk", x1830_i2s_sysclk, 0),
  2359. INGENIC_PIN_GROUP("dmic-if0", x1830_dmic_if0, 2),
  2360. INGENIC_PIN_GROUP("dmic-if1", x1830_dmic_if1, 2),
  2361. INGENIC_PIN_GROUP("lcd-tft-8bit", x1830_lcd_tft_8bit, 0),
  2362. INGENIC_PIN_GROUP("lcd-tft-24bit", x1830_lcd_tft_24bit, 0),
  2363. INGENIC_PIN_GROUP("lcd-slcd-8bit", x1830_lcd_slcd_8bit, 1),
  2364. INGENIC_PIN_GROUP("lcd-slcd-16bit", x1830_lcd_slcd_16bit, 1),
  2365. INGENIC_PIN_GROUP("pwm0-b", x1830_pwm_pwm0_b, 0),
  2366. INGENIC_PIN_GROUP("pwm0-c", x1830_pwm_pwm0_c, 1),
  2367. INGENIC_PIN_GROUP("pwm1-b", x1830_pwm_pwm1_b, 0),
  2368. INGENIC_PIN_GROUP("pwm1-c", x1830_pwm_pwm1_c, 1),
  2369. INGENIC_PIN_GROUP("pwm2-c-8", x1830_pwm_pwm2_c_8, 0),
  2370. INGENIC_PIN_GROUP("pwm2-c-13", x1830_pwm_pwm2_c_13, 1),
  2371. INGENIC_PIN_GROUP("pwm3-c-9", x1830_pwm_pwm3_c_9, 0),
  2372. INGENIC_PIN_GROUP("pwm3-c-14", x1830_pwm_pwm3_c_14, 1),
  2373. INGENIC_PIN_GROUP("pwm4-c-15", x1830_pwm_pwm4_c_15, 1),
  2374. INGENIC_PIN_GROUP("pwm4-c-25", x1830_pwm_pwm4_c_25, 0),
  2375. INGENIC_PIN_GROUP("pwm5-c-16", x1830_pwm_pwm5_c_16, 1),
  2376. INGENIC_PIN_GROUP("pwm5-c-26", x1830_pwm_pwm5_c_26, 0),
  2377. INGENIC_PIN_GROUP("pwm6-c-17", x1830_pwm_pwm6_c_17, 1),
  2378. INGENIC_PIN_GROUP("pwm6-c-27", x1830_pwm_pwm6_c_27, 0),
  2379. INGENIC_PIN_GROUP("pwm7-c-18", x1830_pwm_pwm7_c_18, 1),
  2380. INGENIC_PIN_GROUP("pwm7-c-28", x1830_pwm_pwm7_c_28, 0),
  2381. INGENIC_PIN_GROUP("mac", x1830_mac, 0),
  2382. };
  2383. static const char *x1830_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  2384. static const char *x1830_uart1_groups[] = { "uart1-data", };
  2385. static const char *x1830_sfc_groups[] = { "sfc-data", "sfc-clk", "sfc-ce", };
  2386. static const char *x1830_ssi0_groups[] = {
  2387. "ssi0-dt", "ssi0-dr", "ssi0-clk", "ssi0-gpc", "ssi0-ce0", "ssi0-ce1",
  2388. };
  2389. static const char *x1830_ssi1_groups[] = {
  2390. "ssi1-dt-c", "ssi1-dt-d",
  2391. "ssi1-dr-c", "ssi1-dr-d",
  2392. "ssi1-clk-c", "ssi1-clk-d",
  2393. "ssi1-gpc-c", "ssi1-gpc-d",
  2394. "ssi1-ce0-c", "ssi1-ce0-d",
  2395. "ssi1-ce1-c", "ssi1-ce1-d",
  2396. };
  2397. static const char *x1830_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", };
  2398. static const char *x1830_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", };
  2399. static const char *x1830_i2c0_groups[] = { "i2c0-data", };
  2400. static const char *x1830_i2c1_groups[] = { "i2c1-data", };
  2401. static const char *x1830_i2c2_groups[] = { "i2c2-data", };
  2402. static const char *x1830_i2s_groups[] = {
  2403. "i2s-data-tx", "i2s-data-rx", "i2s-clk-txrx", "i2s-clk-rx", "i2s-sysclk",
  2404. };
  2405. static const char *x1830_dmic_groups[] = { "dmic-if0", "dmic-if1", };
  2406. static const char *x1830_lcd_groups[] = {
  2407. "lcd-tft-8bit", "lcd-tft-24bit", "lcd-slcd-8bit", "lcd-slcd-16bit",
  2408. };
  2409. static const char *x1830_pwm0_groups[] = { "pwm0-b", "pwm0-c", };
  2410. static const char *x1830_pwm1_groups[] = { "pwm1-b", "pwm1-c", };
  2411. static const char *x1830_pwm2_groups[] = { "pwm2-c-8", "pwm2-c-13", };
  2412. static const char *x1830_pwm3_groups[] = { "pwm3-c-9", "pwm3-c-14", };
  2413. static const char *x1830_pwm4_groups[] = { "pwm4-c-15", "pwm4-c-25", };
  2414. static const char *x1830_pwm5_groups[] = { "pwm5-c-16", "pwm5-c-26", };
  2415. static const char *x1830_pwm6_groups[] = { "pwm6-c-17", "pwm6-c-27", };
  2416. static const char *x1830_pwm7_groups[] = { "pwm7-c-18", "pwm7-c-28", };
  2417. static const char *x1830_mac_groups[] = { "mac", };
  2418. static const struct function_desc x1830_functions[] = {
  2419. INGENIC_PIN_FUNCTION("uart0", x1830_uart0),
  2420. INGENIC_PIN_FUNCTION("uart1", x1830_uart1),
  2421. INGENIC_PIN_FUNCTION("sfc", x1830_sfc),
  2422. INGENIC_PIN_FUNCTION("ssi0", x1830_ssi0),
  2423. INGENIC_PIN_FUNCTION("ssi1", x1830_ssi1),
  2424. INGENIC_PIN_FUNCTION("mmc0", x1830_mmc0),
  2425. INGENIC_PIN_FUNCTION("mmc1", x1830_mmc1),
  2426. INGENIC_PIN_FUNCTION("i2c0", x1830_i2c0),
  2427. INGENIC_PIN_FUNCTION("i2c1", x1830_i2c1),
  2428. INGENIC_PIN_FUNCTION("i2c2", x1830_i2c2),
  2429. INGENIC_PIN_FUNCTION("i2s", x1830_i2s),
  2430. INGENIC_PIN_FUNCTION("dmic", x1830_dmic),
  2431. INGENIC_PIN_FUNCTION("lcd", x1830_lcd),
  2432. INGENIC_PIN_FUNCTION("pwm0", x1830_pwm0),
  2433. INGENIC_PIN_FUNCTION("pwm1", x1830_pwm1),
  2434. INGENIC_PIN_FUNCTION("pwm2", x1830_pwm2),
  2435. INGENIC_PIN_FUNCTION("pwm3", x1830_pwm3),
  2436. INGENIC_PIN_FUNCTION("pwm4", x1830_pwm4),
  2437. INGENIC_PIN_FUNCTION("pwm5", x1830_pwm5),
  2438. INGENIC_PIN_FUNCTION("pwm6", x1830_pwm6),
  2439. INGENIC_PIN_FUNCTION("pwm7", x1830_pwm7),
  2440. INGENIC_PIN_FUNCTION("mac", x1830_mac),
  2441. };
  2442. static const struct regmap_range x1830_access_ranges[] = {
  2443. regmap_reg_range(0x0000, 0x4000 - 4),
  2444. regmap_reg_range(0x7000, 0x8000 - 4),
  2445. };
  2446. static const struct regmap_access_table x1830_access_table = {
  2447. .yes_ranges = x1830_access_ranges,
  2448. .n_yes_ranges = ARRAY_SIZE(x1830_access_ranges),
  2449. };
  2450. static const struct ingenic_chip_info x1830_chip_info = {
  2451. .num_chips = 4,
  2452. .reg_offset = 0x1000,
  2453. .version = ID_X1830,
  2454. .groups = x1830_groups,
  2455. .num_groups = ARRAY_SIZE(x1830_groups),
  2456. .functions = x1830_functions,
  2457. .num_functions = ARRAY_SIZE(x1830_functions),
  2458. .pull_ups = x1830_pull_ups,
  2459. .pull_downs = x1830_pull_downs,
  2460. .access_table = &x1830_access_table,
  2461. };
  2462. static const u32 x2000_pull_ups[5] = {
  2463. 0x0003ffff, 0xffffffff, 0x1ff0ffff, 0xc7fe3f3f, 0x8fff003f,
  2464. };
  2465. static const u32 x2000_pull_downs[5] = {
  2466. 0x0003ffff, 0xffffffff, 0x1ff0ffff, 0x00000000, 0x8fff003f,
  2467. };
  2468. static int x2000_uart0_data_pins[] = { 0x77, 0x78, };
  2469. static int x2000_uart0_hwflow_pins[] = { 0x79, 0x7a, };
  2470. static int x2000_uart1_data_pins[] = { 0x57, 0x58, };
  2471. static int x2000_uart1_hwflow_pins[] = { 0x55, 0x56, };
  2472. static int x2000_uart2_data_pins[] = { 0x7e, 0x7f, };
  2473. static int x2000_uart3_data_c_pins[] = { 0x59, 0x5a, };
  2474. static int x2000_uart3_data_d_pins[] = { 0x62, 0x63, };
  2475. static int x2000_uart3_hwflow_c_pins[] = { 0x5b, 0x5c, };
  2476. static int x2000_uart3_hwflow_d_pins[] = { 0x60, 0x61, };
  2477. static int x2000_uart4_data_a_pins[] = { 0x02, 0x03, };
  2478. static int x2000_uart4_data_c_pins[] = { 0x4b, 0x4c, };
  2479. static int x2000_uart4_hwflow_a_pins[] = { 0x00, 0x01, };
  2480. static int x2000_uart4_hwflow_c_pins[] = { 0x49, 0x4a, };
  2481. static int x2000_uart5_data_a_pins[] = { 0x04, 0x05, };
  2482. static int x2000_uart5_data_c_pins[] = { 0x45, 0x46, };
  2483. static int x2000_uart6_data_a_pins[] = { 0x06, 0x07, };
  2484. static int x2000_uart6_data_c_pins[] = { 0x47, 0x48, };
  2485. static int x2000_uart7_data_a_pins[] = { 0x08, 0x09, };
  2486. static int x2000_uart7_data_c_pins[] = { 0x41, 0x42, };
  2487. static int x2000_uart8_data_pins[] = { 0x3c, 0x3d, };
  2488. static int x2000_uart9_data_pins[] = { 0x3e, 0x3f, };
  2489. static int x2000_sfc_data_if0_d_pins[] = { 0x73, 0x74, 0x75, 0x76, };
  2490. static int x2000_sfc_data_if0_e_pins[] = { 0x92, 0x93, 0x94, 0x95, };
  2491. static int x2000_sfc_data_if1_pins[] = { 0x77, 0x78, 0x79, 0x7a, };
  2492. static int x2000_sfc_clk_d_pins[] = { 0x71, };
  2493. static int x2000_sfc_clk_e_pins[] = { 0x90, };
  2494. static int x2000_sfc_ce_d_pins[] = { 0x72, };
  2495. static int x2000_sfc_ce_e_pins[] = { 0x91, };
  2496. static int x2000_ssi0_dt_b_pins[] = { 0x3e, };
  2497. static int x2000_ssi0_dt_d_pins[] = { 0x69, };
  2498. static int x2000_ssi0_dr_b_pins[] = { 0x3d, };
  2499. static int x2000_ssi0_dr_d_pins[] = { 0x6a, };
  2500. static int x2000_ssi0_clk_b_pins[] = { 0x3f, };
  2501. static int x2000_ssi0_clk_d_pins[] = { 0x68, };
  2502. static int x2000_ssi0_ce_b_pins[] = { 0x3c, };
  2503. static int x2000_ssi0_ce_d_pins[] = { 0x6d, };
  2504. static int x2000_ssi1_dt_c_pins[] = { 0x4b, };
  2505. static int x2000_ssi1_dt_d_pins[] = { 0x72, };
  2506. static int x2000_ssi1_dt_e_pins[] = { 0x91, };
  2507. static int x2000_ssi1_dr_c_pins[] = { 0x4a, };
  2508. static int x2000_ssi1_dr_d_pins[] = { 0x73, };
  2509. static int x2000_ssi1_dr_e_pins[] = { 0x92, };
  2510. static int x2000_ssi1_clk_c_pins[] = { 0x4c, };
  2511. static int x2000_ssi1_clk_d_pins[] = { 0x71, };
  2512. static int x2000_ssi1_clk_e_pins[] = { 0x90, };
  2513. static int x2000_ssi1_ce_c_pins[] = { 0x49, };
  2514. static int x2000_ssi1_ce_d_pins[] = { 0x76, };
  2515. static int x2000_ssi1_ce_e_pins[] = { 0x95, };
  2516. static int x2000_mmc0_1bit_pins[] = { 0x71, 0x72, 0x73, };
  2517. static int x2000_mmc0_4bit_pins[] = { 0x74, 0x75, 0x75, };
  2518. static int x2000_mmc0_8bit_pins[] = { 0x77, 0x78, 0x79, 0x7a, };
  2519. static int x2000_mmc1_1bit_pins[] = { 0x68, 0x69, 0x6a, };
  2520. static int x2000_mmc1_4bit_pins[] = { 0x6b, 0x6c, 0x6d, };
  2521. static int x2000_mmc2_1bit_pins[] = { 0x80, 0x81, 0x82, };
  2522. static int x2000_mmc2_4bit_pins[] = { 0x83, 0x84, 0x85, };
  2523. static int x2000_emc_8bit_data_pins[] = {
  2524. 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
  2525. };
  2526. static int x2000_emc_16bit_data_pins[] = {
  2527. 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
  2528. };
  2529. static int x2000_emc_addr_pins[] = {
  2530. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  2531. 0x28, 0x29, 0x2a, 0x2b, 0x2c,
  2532. };
  2533. static int x2000_emc_rd_we_pins[] = { 0x2d, 0x2e, };
  2534. static int x2000_emc_wait_pins[] = { 0x2f, };
  2535. static int x2000_emc_cs1_pins[] = { 0x57, };
  2536. static int x2000_emc_cs2_pins[] = { 0x58, };
  2537. static int x2000_i2c0_pins[] = { 0x4e, 0x4d, };
  2538. static int x2000_i2c1_c_pins[] = { 0x58, 0x57, };
  2539. static int x2000_i2c1_d_pins[] = { 0x6c, 0x6b, };
  2540. static int x2000_i2c2_b_pins[] = { 0x37, 0x36, };
  2541. static int x2000_i2c2_d_pins[] = { 0x75, 0x74, };
  2542. static int x2000_i2c2_e_pins[] = { 0x94, 0x93, };
  2543. static int x2000_i2c3_a_pins[] = { 0x11, 0x10, };
  2544. static int x2000_i2c3_d_pins[] = { 0x7f, 0x7e, };
  2545. static int x2000_i2c4_c_pins[] = { 0x5a, 0x59, };
  2546. static int x2000_i2c4_d_pins[] = { 0x61, 0x60, };
  2547. static int x2000_i2c5_c_pins[] = { 0x5c, 0x5b, };
  2548. static int x2000_i2c5_d_pins[] = { 0x65, 0x64, };
  2549. static int x2000_i2s1_data_tx_pins[] = { 0x47, };
  2550. static int x2000_i2s1_data_rx_pins[] = { 0x44, };
  2551. static int x2000_i2s1_clk_tx_pins[] = { 0x45, 0x46, };
  2552. static int x2000_i2s1_clk_rx_pins[] = { 0x42, 0x43, };
  2553. static int x2000_i2s1_sysclk_tx_pins[] = { 0x48, };
  2554. static int x2000_i2s1_sysclk_rx_pins[] = { 0x41, };
  2555. static int x2000_i2s2_data_rx0_pins[] = { 0x0a, };
  2556. static int x2000_i2s2_data_rx1_pins[] = { 0x0b, };
  2557. static int x2000_i2s2_data_rx2_pins[] = { 0x0c, };
  2558. static int x2000_i2s2_data_rx3_pins[] = { 0x0d, };
  2559. static int x2000_i2s2_clk_rx_pins[] = { 0x11, 0x09, };
  2560. static int x2000_i2s2_sysclk_rx_pins[] = { 0x07, };
  2561. static int x2000_i2s3_data_tx0_pins[] = { 0x03, };
  2562. static int x2000_i2s3_data_tx1_pins[] = { 0x04, };
  2563. static int x2000_i2s3_data_tx2_pins[] = { 0x05, };
  2564. static int x2000_i2s3_data_tx3_pins[] = { 0x06, };
  2565. static int x2000_i2s3_clk_tx_pins[] = { 0x10, 0x02, };
  2566. static int x2000_i2s3_sysclk_tx_pins[] = { 0x00, };
  2567. static int x2000_dmic_if0_pins[] = { 0x54, 0x55, };
  2568. static int x2000_dmic_if1_pins[] = { 0x56, };
  2569. static int x2000_dmic_if2_pins[] = { 0x57, };
  2570. static int x2000_dmic_if3_pins[] = { 0x58, };
  2571. static int x2000_cim_8bit_pins[] = {
  2572. 0x0e, 0x0c, 0x0d, 0x4f,
  2573. 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  2574. };
  2575. static int x2000_cim_12bit_pins[] = { 0x08, 0x09, 0x0a, 0x0b, };
  2576. static int x2000_lcd_tft_8bit_pins[] = {
  2577. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  2578. 0x38, 0x3a, 0x39, 0x3b,
  2579. };
  2580. static int x2000_lcd_tft_16bit_pins[] = {
  2581. 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
  2582. };
  2583. static int x2000_lcd_tft_18bit_pins[] = {
  2584. 0x30, 0x31,
  2585. };
  2586. static int x2000_lcd_tft_24bit_pins[] = {
  2587. 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
  2588. };
  2589. static int x2000_lcd_slcd_8bit_pins[] = {
  2590. 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
  2591. 0x3a, 0x38, 0x3b, 0x30, 0x39,
  2592. };
  2593. static int x2000_pwm_pwm0_c_pins[] = { 0x40, };
  2594. static int x2000_pwm_pwm0_d_pins[] = { 0x7e, };
  2595. static int x2000_pwm_pwm1_c_pins[] = { 0x41, };
  2596. static int x2000_pwm_pwm1_d_pins[] = { 0x7f, };
  2597. static int x2000_pwm_pwm2_c_pins[] = { 0x42, };
  2598. static int x2000_pwm_pwm2_e_pins[] = { 0x80, };
  2599. static int x2000_pwm_pwm3_c_pins[] = { 0x43, };
  2600. static int x2000_pwm_pwm3_e_pins[] = { 0x81, };
  2601. static int x2000_pwm_pwm4_c_pins[] = { 0x44, };
  2602. static int x2000_pwm_pwm4_e_pins[] = { 0x82, };
  2603. static int x2000_pwm_pwm5_c_pins[] = { 0x45, };
  2604. static int x2000_pwm_pwm5_e_pins[] = { 0x83, };
  2605. static int x2000_pwm_pwm6_c_pins[] = { 0x46, };
  2606. static int x2000_pwm_pwm6_e_pins[] = { 0x84, };
  2607. static int x2000_pwm_pwm7_c_pins[] = { 0x47, };
  2608. static int x2000_pwm_pwm7_e_pins[] = { 0x85, };
  2609. static int x2000_pwm_pwm8_pins[] = { 0x48, };
  2610. static int x2000_pwm_pwm9_pins[] = { 0x49, };
  2611. static int x2000_pwm_pwm10_pins[] = { 0x4a, };
  2612. static int x2000_pwm_pwm11_pins[] = { 0x4b, };
  2613. static int x2000_pwm_pwm12_pins[] = { 0x4c, };
  2614. static int x2000_pwm_pwm13_pins[] = { 0x4d, };
  2615. static int x2000_pwm_pwm14_pins[] = { 0x4e, };
  2616. static int x2000_pwm_pwm15_pins[] = { 0x4f, };
  2617. static int x2000_mac0_rmii_pins[] = {
  2618. 0x4b, 0x47, 0x46, 0x4a, 0x43, 0x42, 0x4c, 0x4d, 0x4e, 0x41,
  2619. };
  2620. static int x2000_mac0_rgmii_pins[] = {
  2621. 0x4b, 0x49, 0x48, 0x47, 0x46, 0x4a, 0x45, 0x44, 0x43, 0x42,
  2622. 0x4c, 0x4d, 0x4f, 0x4e, 0x41,
  2623. };
  2624. static int x2000_mac1_rmii_pins[] = {
  2625. 0x32, 0x2d, 0x2c, 0x31, 0x29, 0x28, 0x33, 0x34, 0x35, 0x37,
  2626. };
  2627. static int x2000_mac1_rgmii_pins[] = {
  2628. 0x32, 0x2f, 0x2e, 0x2d, 0x2c, 0x31, 0x2b, 0x2a, 0x29, 0x28,
  2629. 0x33, 0x34, 0x36, 0x35, 0x37,
  2630. };
  2631. static int x2000_otg_pins[] = { 0x96, };
  2632. static u8 x2000_cim_8bit_funcs[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, };
  2633. static const struct group_desc x2000_groups[] = {
  2634. INGENIC_PIN_GROUP("uart0-data", x2000_uart0_data, 2),
  2635. INGENIC_PIN_GROUP("uart0-hwflow", x2000_uart0_hwflow, 2),
  2636. INGENIC_PIN_GROUP("uart1-data", x2000_uart1_data, 1),
  2637. INGENIC_PIN_GROUP("uart1-hwflow", x2000_uart1_hwflow, 1),
  2638. INGENIC_PIN_GROUP("uart2-data", x2000_uart2_data, 0),
  2639. INGENIC_PIN_GROUP("uart3-data-c", x2000_uart3_data_c, 0),
  2640. INGENIC_PIN_GROUP("uart3-data-d", x2000_uart3_data_d, 1),
  2641. INGENIC_PIN_GROUP("uart3-hwflow-c", x2000_uart3_hwflow_c, 0),
  2642. INGENIC_PIN_GROUP("uart3-hwflow-d", x2000_uart3_hwflow_d, 1),
  2643. INGENIC_PIN_GROUP("uart4-data-a", x2000_uart4_data_a, 1),
  2644. INGENIC_PIN_GROUP("uart4-data-c", x2000_uart4_data_c, 3),
  2645. INGENIC_PIN_GROUP("uart4-hwflow-a", x2000_uart4_hwflow_a, 1),
  2646. INGENIC_PIN_GROUP("uart4-hwflow-c", x2000_uart4_hwflow_c, 3),
  2647. INGENIC_PIN_GROUP("uart5-data-a", x2000_uart5_data_a, 1),
  2648. INGENIC_PIN_GROUP("uart5-data-c", x2000_uart5_data_c, 3),
  2649. INGENIC_PIN_GROUP("uart6-data-a", x2000_uart6_data_a, 1),
  2650. INGENIC_PIN_GROUP("uart6-data-c", x2000_uart6_data_c, 3),
  2651. INGENIC_PIN_GROUP("uart7-data-a", x2000_uart7_data_a, 1),
  2652. INGENIC_PIN_GROUP("uart7-data-c", x2000_uart7_data_c, 3),
  2653. INGENIC_PIN_GROUP("uart8-data", x2000_uart8_data, 3),
  2654. INGENIC_PIN_GROUP("uart9-data", x2000_uart9_data, 3),
  2655. INGENIC_PIN_GROUP("sfc-data-if0-d", x2000_sfc_data_if0_d, 1),
  2656. INGENIC_PIN_GROUP("sfc-data-if0-e", x2000_sfc_data_if0_e, 0),
  2657. INGENIC_PIN_GROUP("sfc-data-if1", x2000_sfc_data_if1, 1),
  2658. INGENIC_PIN_GROUP("sfc-clk-d", x2000_sfc_clk_d, 1),
  2659. INGENIC_PIN_GROUP("sfc-clk-e", x2000_sfc_clk_e, 0),
  2660. INGENIC_PIN_GROUP("sfc-ce-d", x2000_sfc_ce_d, 1),
  2661. INGENIC_PIN_GROUP("sfc-ce-e", x2000_sfc_ce_e, 0),
  2662. INGENIC_PIN_GROUP("ssi0-dt-b", x2000_ssi0_dt_b, 1),
  2663. INGENIC_PIN_GROUP("ssi0-dt-d", x2000_ssi0_dt_d, 1),
  2664. INGENIC_PIN_GROUP("ssi0-dr-b", x2000_ssi0_dr_b, 1),
  2665. INGENIC_PIN_GROUP("ssi0-dr-d", x2000_ssi0_dr_d, 1),
  2666. INGENIC_PIN_GROUP("ssi0-clk-b", x2000_ssi0_clk_b, 1),
  2667. INGENIC_PIN_GROUP("ssi0-clk-d", x2000_ssi0_clk_d, 1),
  2668. INGENIC_PIN_GROUP("ssi0-ce-b", x2000_ssi0_ce_b, 1),
  2669. INGENIC_PIN_GROUP("ssi0-ce-d", x2000_ssi0_ce_d, 1),
  2670. INGENIC_PIN_GROUP("ssi1-dt-c", x2000_ssi1_dt_c, 2),
  2671. INGENIC_PIN_GROUP("ssi1-dt-d", x2000_ssi1_dt_d, 2),
  2672. INGENIC_PIN_GROUP("ssi1-dt-e", x2000_ssi1_dt_e, 1),
  2673. INGENIC_PIN_GROUP("ssi1-dr-c", x2000_ssi1_dr_c, 2),
  2674. INGENIC_PIN_GROUP("ssi1-dr-d", x2000_ssi1_dr_d, 2),
  2675. INGENIC_PIN_GROUP("ssi1-dr-e", x2000_ssi1_dr_e, 1),
  2676. INGENIC_PIN_GROUP("ssi1-clk-c", x2000_ssi1_clk_c, 2),
  2677. INGENIC_PIN_GROUP("ssi1-clk-d", x2000_ssi1_clk_d, 2),
  2678. INGENIC_PIN_GROUP("ssi1-clk-e", x2000_ssi1_clk_e, 1),
  2679. INGENIC_PIN_GROUP("ssi1-ce-c", x2000_ssi1_ce_c, 2),
  2680. INGENIC_PIN_GROUP("ssi1-ce-d", x2000_ssi1_ce_d, 2),
  2681. INGENIC_PIN_GROUP("ssi1-ce-e", x2000_ssi1_ce_e, 1),
  2682. INGENIC_PIN_GROUP("mmc0-1bit", x2000_mmc0_1bit, 0),
  2683. INGENIC_PIN_GROUP("mmc0-4bit", x2000_mmc0_4bit, 0),
  2684. INGENIC_PIN_GROUP("mmc0-8bit", x2000_mmc0_8bit, 0),
  2685. INGENIC_PIN_GROUP("mmc1-1bit", x2000_mmc1_1bit, 0),
  2686. INGENIC_PIN_GROUP("mmc1-4bit", x2000_mmc1_4bit, 0),
  2687. INGENIC_PIN_GROUP("mmc2-1bit", x2000_mmc2_1bit, 0),
  2688. INGENIC_PIN_GROUP("mmc2-4bit", x2000_mmc2_4bit, 0),
  2689. INGENIC_PIN_GROUP("emc-8bit-data", x2000_emc_8bit_data, 0),
  2690. INGENIC_PIN_GROUP("emc-16bit-data", x2000_emc_16bit_data, 0),
  2691. INGENIC_PIN_GROUP("emc-addr", x2000_emc_addr, 0),
  2692. INGENIC_PIN_GROUP("emc-rd-we", x2000_emc_rd_we, 0),
  2693. INGENIC_PIN_GROUP("emc-wait", x2000_emc_wait, 0),
  2694. INGENIC_PIN_GROUP("emc-cs1", x2000_emc_cs1, 3),
  2695. INGENIC_PIN_GROUP("emc-cs2", x2000_emc_cs2, 3),
  2696. INGENIC_PIN_GROUP("i2c0-data", x2000_i2c0, 3),
  2697. INGENIC_PIN_GROUP("i2c1-data-c", x2000_i2c1_c, 2),
  2698. INGENIC_PIN_GROUP("i2c1-data-d", x2000_i2c1_d, 1),
  2699. INGENIC_PIN_GROUP("i2c2-data-b", x2000_i2c2_b, 2),
  2700. INGENIC_PIN_GROUP("i2c2-data-d", x2000_i2c2_d, 2),
  2701. INGENIC_PIN_GROUP("i2c2-data-e", x2000_i2c2_e, 1),
  2702. INGENIC_PIN_GROUP("i2c3-data-a", x2000_i2c3_a, 0),
  2703. INGENIC_PIN_GROUP("i2c3-data-d", x2000_i2c3_d, 1),
  2704. INGENIC_PIN_GROUP("i2c4-data-c", x2000_i2c4_c, 1),
  2705. INGENIC_PIN_GROUP("i2c4-data-d", x2000_i2c4_d, 2),
  2706. INGENIC_PIN_GROUP("i2c5-data-c", x2000_i2c5_c, 1),
  2707. INGENIC_PIN_GROUP("i2c5-data-d", x2000_i2c5_d, 1),
  2708. INGENIC_PIN_GROUP("i2s1-data-tx", x2000_i2s1_data_tx, 2),
  2709. INGENIC_PIN_GROUP("i2s1-data-rx", x2000_i2s1_data_rx, 2),
  2710. INGENIC_PIN_GROUP("i2s1-clk-tx", x2000_i2s1_clk_tx, 2),
  2711. INGENIC_PIN_GROUP("i2s1-clk-rx", x2000_i2s1_clk_rx, 2),
  2712. INGENIC_PIN_GROUP("i2s1-sysclk-tx", x2000_i2s1_sysclk_tx, 2),
  2713. INGENIC_PIN_GROUP("i2s1-sysclk-rx", x2000_i2s1_sysclk_rx, 2),
  2714. INGENIC_PIN_GROUP("i2s2-data-rx0", x2000_i2s2_data_rx0, 2),
  2715. INGENIC_PIN_GROUP("i2s2-data-rx1", x2000_i2s2_data_rx1, 2),
  2716. INGENIC_PIN_GROUP("i2s2-data-rx2", x2000_i2s2_data_rx2, 2),
  2717. INGENIC_PIN_GROUP("i2s2-data-rx3", x2000_i2s2_data_rx3, 2),
  2718. INGENIC_PIN_GROUP("i2s2-clk-rx", x2000_i2s2_clk_rx, 2),
  2719. INGENIC_PIN_GROUP("i2s2-sysclk-rx", x2000_i2s2_sysclk_rx, 2),
  2720. INGENIC_PIN_GROUP("i2s3-data-tx0", x2000_i2s3_data_tx0, 2),
  2721. INGENIC_PIN_GROUP("i2s3-data-tx1", x2000_i2s3_data_tx1, 2),
  2722. INGENIC_PIN_GROUP("i2s3-data-tx2", x2000_i2s3_data_tx2, 2),
  2723. INGENIC_PIN_GROUP("i2s3-data-tx3", x2000_i2s3_data_tx3, 2),
  2724. INGENIC_PIN_GROUP("i2s3-clk-tx", x2000_i2s3_clk_tx, 2),
  2725. INGENIC_PIN_GROUP("i2s3-sysclk-tx", x2000_i2s3_sysclk_tx, 2),
  2726. INGENIC_PIN_GROUP("dmic-if0", x2000_dmic_if0, 0),
  2727. INGENIC_PIN_GROUP("dmic-if1", x2000_dmic_if1, 0),
  2728. INGENIC_PIN_GROUP("dmic-if2", x2000_dmic_if2, 0),
  2729. INGENIC_PIN_GROUP("dmic-if3", x2000_dmic_if3, 0),
  2730. INGENIC_PIN_GROUP_FUNCS("cim-data-8bit", x2000_cim_8bit,
  2731. x2000_cim_8bit_funcs),
  2732. INGENIC_PIN_GROUP("cim-data-12bit", x2000_cim_12bit, 0),
  2733. INGENIC_PIN_GROUP("lcd-tft-8bit", x2000_lcd_tft_8bit, 1),
  2734. INGENIC_PIN_GROUP("lcd-tft-16bit", x2000_lcd_tft_16bit, 1),
  2735. INGENIC_PIN_GROUP("lcd-tft-18bit", x2000_lcd_tft_18bit, 1),
  2736. INGENIC_PIN_GROUP("lcd-tft-24bit", x2000_lcd_tft_24bit, 1),
  2737. INGENIC_PIN_GROUP("lcd-slcd-8bit", x2000_lcd_slcd_8bit, 2),
  2738. INGENIC_PIN_GROUP("lcd-slcd-16bit", x2000_lcd_tft_16bit, 2),
  2739. INGENIC_PIN_GROUP("pwm0-c", x2000_pwm_pwm0_c, 0),
  2740. INGENIC_PIN_GROUP("pwm0-d", x2000_pwm_pwm0_d, 2),
  2741. INGENIC_PIN_GROUP("pwm1-c", x2000_pwm_pwm1_c, 0),
  2742. INGENIC_PIN_GROUP("pwm1-d", x2000_pwm_pwm1_d, 2),
  2743. INGENIC_PIN_GROUP("pwm2-c", x2000_pwm_pwm2_c, 0),
  2744. INGENIC_PIN_GROUP("pwm2-e", x2000_pwm_pwm2_e, 1),
  2745. INGENIC_PIN_GROUP("pwm3-c", x2000_pwm_pwm3_c, 0),
  2746. INGENIC_PIN_GROUP("pwm3-e", x2000_pwm_pwm3_e, 1),
  2747. INGENIC_PIN_GROUP("pwm4-c", x2000_pwm_pwm4_c, 0),
  2748. INGENIC_PIN_GROUP("pwm4-e", x2000_pwm_pwm4_e, 1),
  2749. INGENIC_PIN_GROUP("pwm5-c", x2000_pwm_pwm5_c, 0),
  2750. INGENIC_PIN_GROUP("pwm5-e", x2000_pwm_pwm5_e, 1),
  2751. INGENIC_PIN_GROUP("pwm6-c", x2000_pwm_pwm6_c, 0),
  2752. INGENIC_PIN_GROUP("pwm6-e", x2000_pwm_pwm6_e, 1),
  2753. INGENIC_PIN_GROUP("pwm7-c", x2000_pwm_pwm7_c, 0),
  2754. INGENIC_PIN_GROUP("pwm7-e", x2000_pwm_pwm7_e, 1),
  2755. INGENIC_PIN_GROUP("pwm8", x2000_pwm_pwm8, 0),
  2756. INGENIC_PIN_GROUP("pwm9", x2000_pwm_pwm9, 0),
  2757. INGENIC_PIN_GROUP("pwm10", x2000_pwm_pwm10, 0),
  2758. INGENIC_PIN_GROUP("pwm11", x2000_pwm_pwm11, 0),
  2759. INGENIC_PIN_GROUP("pwm12", x2000_pwm_pwm12, 0),
  2760. INGENIC_PIN_GROUP("pwm13", x2000_pwm_pwm13, 0),
  2761. INGENIC_PIN_GROUP("pwm14", x2000_pwm_pwm14, 0),
  2762. INGENIC_PIN_GROUP("pwm15", x2000_pwm_pwm15, 0),
  2763. INGENIC_PIN_GROUP("mac0-rmii", x2000_mac0_rmii, 1),
  2764. INGENIC_PIN_GROUP("mac0-rgmii", x2000_mac0_rgmii, 1),
  2765. INGENIC_PIN_GROUP("mac1-rmii", x2000_mac1_rmii, 3),
  2766. INGENIC_PIN_GROUP("mac1-rgmii", x2000_mac1_rgmii, 3),
  2767. INGENIC_PIN_GROUP("otg-vbus", x2000_otg, 0),
  2768. };
  2769. static const char *x2000_uart0_groups[] = { "uart0-data", "uart0-hwflow", };
  2770. static const char *x2000_uart1_groups[] = { "uart1-data", "uart1-hwflow", };
  2771. static const char *x2000_uart2_groups[] = { "uart2-data", };
  2772. static const char *x2000_uart3_groups[] = {
  2773. "uart3-data-c", "uart3-data-d", "uart3-hwflow-c", "uart3-hwflow-d",
  2774. };
  2775. static const char *x2000_uart4_groups[] = {
  2776. "uart4-data-a", "uart4-data-c", "uart4-hwflow-a", "uart4-hwflow-c",
  2777. };
  2778. static const char *x2000_uart5_groups[] = { "uart5-data-a", "uart5-data-c", };
  2779. static const char *x2000_uart6_groups[] = { "uart6-data-a", "uart6-data-c", };
  2780. static const char *x2000_uart7_groups[] = { "uart7-data-a", "uart7-data-c", };
  2781. static const char *x2000_uart8_groups[] = { "uart8-data", };
  2782. static const char *x2000_uart9_groups[] = { "uart9-data", };
  2783. static const char *x2000_sfc_groups[] = {
  2784. "sfc-data-if0-d", "sfc-data-if0-e", "sfc-data-if1",
  2785. "sfc-clk-d", "sfc-clk-e", "sfc-ce-d", "sfc-ce-e",
  2786. };
  2787. static const char *x2000_ssi0_groups[] = {
  2788. "ssi0-dt-b", "ssi0-dt-d",
  2789. "ssi0-dr-b", "ssi0-dr-d",
  2790. "ssi0-clk-b", "ssi0-clk-d",
  2791. "ssi0-ce-b", "ssi0-ce-d",
  2792. };
  2793. static const char *x2000_ssi1_groups[] = {
  2794. "ssi1-dt-c", "ssi1-dt-d", "ssi1-dt-e",
  2795. "ssi1-dr-c", "ssi1-dr-d", "ssi1-dr-e",
  2796. "ssi1-clk-c", "ssi1-clk-d", "ssi1-clk-e",
  2797. "ssi1-ce-c", "ssi1-ce-d", "ssi1-ce-e",
  2798. };
  2799. static const char *x2000_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", "mmc0-8bit", };
  2800. static const char *x2000_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", };
  2801. static const char *x2000_mmc2_groups[] = { "mmc2-1bit", "mmc2-4bit", };
  2802. static const char *x2000_emc_groups[] = {
  2803. "emc-8bit-data", "emc-16bit-data",
  2804. "emc-addr", "emc-rd-we", "emc-wait",
  2805. };
  2806. static const char *x2000_cs1_groups[] = { "emc-cs1", };
  2807. static const char *x2000_cs2_groups[] = { "emc-cs2", };
  2808. static const char *x2000_i2c0_groups[] = { "i2c0-data", };
  2809. static const char *x2000_i2c1_groups[] = { "i2c1-data-c", "i2c1-data-d", };
  2810. static const char *x2000_i2c2_groups[] = { "i2c2-data-b", "i2c2-data-d", };
  2811. static const char *x2000_i2c3_groups[] = { "i2c3-data-a", "i2c3-data-d", };
  2812. static const char *x2000_i2c4_groups[] = { "i2c4-data-c", "i2c4-data-d", };
  2813. static const char *x2000_i2c5_groups[] = { "i2c5-data-c", "i2c5-data-d", };
  2814. static const char *x2000_i2s1_groups[] = {
  2815. "i2s1-data-tx", "i2s1-data-rx",
  2816. "i2s1-clk-tx", "i2s1-clk-rx",
  2817. "i2s1-sysclk-tx", "i2s1-sysclk-rx",
  2818. };
  2819. static const char *x2000_i2s2_groups[] = {
  2820. "i2s2-data-rx0", "i2s2-data-rx1", "i2s2-data-rx2", "i2s2-data-rx3",
  2821. "i2s2-clk-rx", "i2s2-sysclk-rx",
  2822. };
  2823. static const char *x2000_i2s3_groups[] = {
  2824. "i2s3-data-tx0", "i2s3-data-tx1", "i2s3-data-tx2", "i2s3-data-tx3",
  2825. "i2s3-clk-tx", "i2s3-sysclk-tx",
  2826. };
  2827. static const char *x2000_dmic_groups[] = {
  2828. "dmic-if0", "dmic-if1", "dmic-if2", "dmic-if3",
  2829. };
  2830. static const char *x2000_cim_groups[] = { "cim-data-8bit", "cim-data-12bit", };
  2831. static const char *x2000_lcd_groups[] = {
  2832. "lcd-tft-8bit", "lcd-tft-16bit", "lcd-tft-18bit", "lcd-tft-24bit",
  2833. "lcd-slcd-8bit", "lcd-slcd-16bit",
  2834. };
  2835. static const char *x2000_pwm0_groups[] = { "pwm0-c", "pwm0-d", };
  2836. static const char *x2000_pwm1_groups[] = { "pwm1-c", "pwm1-d", };
  2837. static const char *x2000_pwm2_groups[] = { "pwm2-c", "pwm2-e", };
  2838. static const char *x2000_pwm3_groups[] = { "pwm3-c", "pwm3-r", };
  2839. static const char *x2000_pwm4_groups[] = { "pwm4-c", "pwm4-e", };
  2840. static const char *x2000_pwm5_groups[] = { "pwm5-c", "pwm5-e", };
  2841. static const char *x2000_pwm6_groups[] = { "pwm6-c", "pwm6-e", };
  2842. static const char *x2000_pwm7_groups[] = { "pwm7-c", "pwm7-e", };
  2843. static const char *x2000_pwm8_groups[] = { "pwm8", };
  2844. static const char *x2000_pwm9_groups[] = { "pwm9", };
  2845. static const char *x2000_pwm10_groups[] = { "pwm10", };
  2846. static const char *x2000_pwm11_groups[] = { "pwm11", };
  2847. static const char *x2000_pwm12_groups[] = { "pwm12", };
  2848. static const char *x2000_pwm13_groups[] = { "pwm13", };
  2849. static const char *x2000_pwm14_groups[] = { "pwm14", };
  2850. static const char *x2000_pwm15_groups[] = { "pwm15", };
  2851. static const char *x2000_mac0_groups[] = { "mac0-rmii", "mac0-rgmii", };
  2852. static const char *x2000_mac1_groups[] = { "mac1-rmii", "mac1-rgmii", };
  2853. static const char *x2000_otg_groups[] = { "otg-vbus", };
  2854. static const struct function_desc x2000_functions[] = {
  2855. INGENIC_PIN_FUNCTION("uart0", x2000_uart0),
  2856. INGENIC_PIN_FUNCTION("uart1", x2000_uart1),
  2857. INGENIC_PIN_FUNCTION("uart2", x2000_uart2),
  2858. INGENIC_PIN_FUNCTION("uart3", x2000_uart3),
  2859. INGENIC_PIN_FUNCTION("uart4", x2000_uart4),
  2860. INGENIC_PIN_FUNCTION("uart5", x2000_uart5),
  2861. INGENIC_PIN_FUNCTION("uart6", x2000_uart6),
  2862. INGENIC_PIN_FUNCTION("uart7", x2000_uart7),
  2863. INGENIC_PIN_FUNCTION("uart8", x2000_uart8),
  2864. INGENIC_PIN_FUNCTION("uart9", x2000_uart9),
  2865. INGENIC_PIN_FUNCTION("sfc", x2000_sfc),
  2866. INGENIC_PIN_FUNCTION("ssi0", x2000_ssi0),
  2867. INGENIC_PIN_FUNCTION("ssi1", x2000_ssi1),
  2868. INGENIC_PIN_FUNCTION("mmc0", x2000_mmc0),
  2869. INGENIC_PIN_FUNCTION("mmc1", x2000_mmc1),
  2870. INGENIC_PIN_FUNCTION("mmc2", x2000_mmc2),
  2871. INGENIC_PIN_FUNCTION("emc", x2000_emc),
  2872. INGENIC_PIN_FUNCTION("emc-cs1", x2000_cs1),
  2873. INGENIC_PIN_FUNCTION("emc-cs2", x2000_cs2),
  2874. INGENIC_PIN_FUNCTION("i2c0", x2000_i2c0),
  2875. INGENIC_PIN_FUNCTION("i2c1", x2000_i2c1),
  2876. INGENIC_PIN_FUNCTION("i2c2", x2000_i2c2),
  2877. INGENIC_PIN_FUNCTION("i2c3", x2000_i2c3),
  2878. INGENIC_PIN_FUNCTION("i2c4", x2000_i2c4),
  2879. INGENIC_PIN_FUNCTION("i2c5", x2000_i2c5),
  2880. INGENIC_PIN_FUNCTION("i2s1", x2000_i2s1),
  2881. INGENIC_PIN_FUNCTION("i2s2", x2000_i2s2),
  2882. INGENIC_PIN_FUNCTION("i2s3", x2000_i2s3),
  2883. INGENIC_PIN_FUNCTION("dmic", x2000_dmic),
  2884. INGENIC_PIN_FUNCTION("cim", x2000_cim),
  2885. INGENIC_PIN_FUNCTION("lcd", x2000_lcd),
  2886. INGENIC_PIN_FUNCTION("pwm0", x2000_pwm0),
  2887. INGENIC_PIN_FUNCTION("pwm1", x2000_pwm1),
  2888. INGENIC_PIN_FUNCTION("pwm2", x2000_pwm2),
  2889. INGENIC_PIN_FUNCTION("pwm3", x2000_pwm3),
  2890. INGENIC_PIN_FUNCTION("pwm4", x2000_pwm4),
  2891. INGENIC_PIN_FUNCTION("pwm5", x2000_pwm5),
  2892. INGENIC_PIN_FUNCTION("pwm6", x2000_pwm6),
  2893. INGENIC_PIN_FUNCTION("pwm7", x2000_pwm7),
  2894. INGENIC_PIN_FUNCTION("pwm8", x2000_pwm8),
  2895. INGENIC_PIN_FUNCTION("pwm9", x2000_pwm9),
  2896. INGENIC_PIN_FUNCTION("pwm10", x2000_pwm10),
  2897. INGENIC_PIN_FUNCTION("pwm11", x2000_pwm11),
  2898. INGENIC_PIN_FUNCTION("pwm12", x2000_pwm12),
  2899. INGENIC_PIN_FUNCTION("pwm13", x2000_pwm13),
  2900. INGENIC_PIN_FUNCTION("pwm14", x2000_pwm14),
  2901. INGENIC_PIN_FUNCTION("pwm15", x2000_pwm15),
  2902. INGENIC_PIN_FUNCTION("mac0", x2000_mac0),
  2903. INGENIC_PIN_FUNCTION("mac1", x2000_mac1),
  2904. INGENIC_PIN_FUNCTION("otg", x2000_otg),
  2905. };
  2906. static const struct regmap_range x2000_access_ranges[] = {
  2907. regmap_reg_range(0x000, 0x500 - 4),
  2908. regmap_reg_range(0x700, 0x800 - 4),
  2909. };
  2910. /* shared with X2100 */
  2911. static const struct regmap_access_table x2000_access_table = {
  2912. .yes_ranges = x2000_access_ranges,
  2913. .n_yes_ranges = ARRAY_SIZE(x2000_access_ranges),
  2914. };
  2915. static const struct ingenic_chip_info x2000_chip_info = {
  2916. .num_chips = 5,
  2917. .reg_offset = 0x100,
  2918. .version = ID_X2000,
  2919. .groups = x2000_groups,
  2920. .num_groups = ARRAY_SIZE(x2000_groups),
  2921. .functions = x2000_functions,
  2922. .num_functions = ARRAY_SIZE(x2000_functions),
  2923. .pull_ups = x2000_pull_ups,
  2924. .pull_downs = x2000_pull_downs,
  2925. .access_table = &x2000_access_table,
  2926. };
  2927. static const u32 x2100_pull_ups[5] = {
  2928. 0x0003ffff, 0xffffffff, 0x1ff0ffff, 0xc7fe3f3f, 0x0fbf003f,
  2929. };
  2930. static const u32 x2100_pull_downs[5] = {
  2931. 0x0003ffff, 0xffffffff, 0x1ff0ffff, 0x00000000, 0x0fbf003f,
  2932. };
  2933. static int x2100_mac_pins[] = {
  2934. 0x4b, 0x47, 0x46, 0x4a, 0x43, 0x42, 0x4c, 0x4d, 0x4f, 0x41,
  2935. };
  2936. static const struct group_desc x2100_groups[] = {
  2937. INGENIC_PIN_GROUP("uart0-data", x2000_uart0_data, 2),
  2938. INGENIC_PIN_GROUP("uart0-hwflow", x2000_uart0_hwflow, 2),
  2939. INGENIC_PIN_GROUP("uart1-data", x2000_uart1_data, 1),
  2940. INGENIC_PIN_GROUP("uart1-hwflow", x2000_uart1_hwflow, 1),
  2941. INGENIC_PIN_GROUP("uart2-data", x2000_uart2_data, 0),
  2942. INGENIC_PIN_GROUP("uart3-data-c", x2000_uart3_data_c, 0),
  2943. INGENIC_PIN_GROUP("uart3-data-d", x2000_uart3_data_d, 1),
  2944. INGENIC_PIN_GROUP("uart3-hwflow-c", x2000_uart3_hwflow_c, 0),
  2945. INGENIC_PIN_GROUP("uart3-hwflow-d", x2000_uart3_hwflow_d, 1),
  2946. INGENIC_PIN_GROUP("uart4-data-a", x2000_uart4_data_a, 1),
  2947. INGENIC_PIN_GROUP("uart4-data-c", x2000_uart4_data_c, 3),
  2948. INGENIC_PIN_GROUP("uart4-hwflow-a", x2000_uart4_hwflow_a, 1),
  2949. INGENIC_PIN_GROUP("uart4-hwflow-c", x2000_uart4_hwflow_c, 3),
  2950. INGENIC_PIN_GROUP("uart5-data-a", x2000_uart5_data_a, 1),
  2951. INGENIC_PIN_GROUP("uart5-data-c", x2000_uart5_data_c, 3),
  2952. INGENIC_PIN_GROUP("uart6-data-a", x2000_uart6_data_a, 1),
  2953. INGENIC_PIN_GROUP("uart6-data-c", x2000_uart6_data_c, 3),
  2954. INGENIC_PIN_GROUP("uart7-data-a", x2000_uart7_data_a, 1),
  2955. INGENIC_PIN_GROUP("uart7-data-c", x2000_uart7_data_c, 3),
  2956. INGENIC_PIN_GROUP("uart8-data", x2000_uart8_data, 3),
  2957. INGENIC_PIN_GROUP("uart9-data", x2000_uart9_data, 3),
  2958. INGENIC_PIN_GROUP("sfc-data-if0-d", x2000_sfc_data_if0_d, 1),
  2959. INGENIC_PIN_GROUP("sfc-data-if0-e", x2000_sfc_data_if0_e, 0),
  2960. INGENIC_PIN_GROUP("sfc-data-if1", x2000_sfc_data_if1, 1),
  2961. INGENIC_PIN_GROUP("sfc-clk-d", x2000_sfc_clk_d, 1),
  2962. INGENIC_PIN_GROUP("sfc-clk-e", x2000_sfc_clk_e, 0),
  2963. INGENIC_PIN_GROUP("sfc-ce-d", x2000_sfc_ce_d, 1),
  2964. INGENIC_PIN_GROUP("sfc-ce-e", x2000_sfc_ce_e, 0),
  2965. INGENIC_PIN_GROUP("ssi0-dt-b", x2000_ssi0_dt_b, 1),
  2966. INGENIC_PIN_GROUP("ssi0-dt-d", x2000_ssi0_dt_d, 1),
  2967. INGENIC_PIN_GROUP("ssi0-dr-b", x2000_ssi0_dr_b, 1),
  2968. INGENIC_PIN_GROUP("ssi0-dr-d", x2000_ssi0_dr_d, 1),
  2969. INGENIC_PIN_GROUP("ssi0-clk-b", x2000_ssi0_clk_b, 1),
  2970. INGENIC_PIN_GROUP("ssi0-clk-d", x2000_ssi0_clk_d, 1),
  2971. INGENIC_PIN_GROUP("ssi0-ce-b", x2000_ssi0_ce_b, 1),
  2972. INGENIC_PIN_GROUP("ssi0-ce-d", x2000_ssi0_ce_d, 1),
  2973. INGENIC_PIN_GROUP("ssi1-dt-c", x2000_ssi1_dt_c, 2),
  2974. INGENIC_PIN_GROUP("ssi1-dt-d", x2000_ssi1_dt_d, 2),
  2975. INGENIC_PIN_GROUP("ssi1-dt-e", x2000_ssi1_dt_e, 1),
  2976. INGENIC_PIN_GROUP("ssi1-dr-c", x2000_ssi1_dr_c, 2),
  2977. INGENIC_PIN_GROUP("ssi1-dr-d", x2000_ssi1_dr_d, 2),
  2978. INGENIC_PIN_GROUP("ssi1-dr-e", x2000_ssi1_dr_e, 1),
  2979. INGENIC_PIN_GROUP("ssi1-clk-c", x2000_ssi1_clk_c, 2),
  2980. INGENIC_PIN_GROUP("ssi1-clk-d", x2000_ssi1_clk_d, 2),
  2981. INGENIC_PIN_GROUP("ssi1-clk-e", x2000_ssi1_clk_e, 1),
  2982. INGENIC_PIN_GROUP("ssi1-ce-c", x2000_ssi1_ce_c, 2),
  2983. INGENIC_PIN_GROUP("ssi1-ce-d", x2000_ssi1_ce_d, 2),
  2984. INGENIC_PIN_GROUP("ssi1-ce-e", x2000_ssi1_ce_e, 1),
  2985. INGENIC_PIN_GROUP("mmc0-1bit", x2000_mmc0_1bit, 0),
  2986. INGENIC_PIN_GROUP("mmc0-4bit", x2000_mmc0_4bit, 0),
  2987. INGENIC_PIN_GROUP("mmc0-8bit", x2000_mmc0_8bit, 0),
  2988. INGENIC_PIN_GROUP("mmc1-1bit", x2000_mmc1_1bit, 0),
  2989. INGENIC_PIN_GROUP("mmc1-4bit", x2000_mmc1_4bit, 0),
  2990. INGENIC_PIN_GROUP("mmc2-1bit", x2000_mmc2_1bit, 0),
  2991. INGENIC_PIN_GROUP("mmc2-4bit", x2000_mmc2_4bit, 0),
  2992. INGENIC_PIN_GROUP("emc-8bit-data", x2000_emc_8bit_data, 0),
  2993. INGENIC_PIN_GROUP("emc-16bit-data", x2000_emc_16bit_data, 0),
  2994. INGENIC_PIN_GROUP("emc-addr", x2000_emc_addr, 0),
  2995. INGENIC_PIN_GROUP("emc-rd-we", x2000_emc_rd_we, 0),
  2996. INGENIC_PIN_GROUP("emc-wait", x2000_emc_wait, 0),
  2997. INGENIC_PIN_GROUP("emc-cs1", x2000_emc_cs1, 3),
  2998. INGENIC_PIN_GROUP("emc-cs2", x2000_emc_cs2, 3),
  2999. INGENIC_PIN_GROUP("i2c0-data", x2000_i2c0, 3),
  3000. INGENIC_PIN_GROUP("i2c1-data-c", x2000_i2c1_c, 2),
  3001. INGENIC_PIN_GROUP("i2c1-data-d", x2000_i2c1_d, 1),
  3002. INGENIC_PIN_GROUP("i2c2-data-b", x2000_i2c2_b, 2),
  3003. INGENIC_PIN_GROUP("i2c2-data-d", x2000_i2c2_d, 2),
  3004. INGENIC_PIN_GROUP("i2c2-data-e", x2000_i2c2_e, 1),
  3005. INGENIC_PIN_GROUP("i2c3-data-a", x2000_i2c3_a, 0),
  3006. INGENIC_PIN_GROUP("i2c3-data-d", x2000_i2c3_d, 1),
  3007. INGENIC_PIN_GROUP("i2c4-data-c", x2000_i2c4_c, 1),
  3008. INGENIC_PIN_GROUP("i2c4-data-d", x2000_i2c4_d, 2),
  3009. INGENIC_PIN_GROUP("i2c5-data-c", x2000_i2c5_c, 1),
  3010. INGENIC_PIN_GROUP("i2c5-data-d", x2000_i2c5_d, 1),
  3011. INGENIC_PIN_GROUP("i2s1-data-tx", x2000_i2s1_data_tx, 2),
  3012. INGENIC_PIN_GROUP("i2s1-data-rx", x2000_i2s1_data_rx, 2),
  3013. INGENIC_PIN_GROUP("i2s1-clk-tx", x2000_i2s1_clk_tx, 2),
  3014. INGENIC_PIN_GROUP("i2s1-clk-rx", x2000_i2s1_clk_rx, 2),
  3015. INGENIC_PIN_GROUP("i2s1-sysclk-tx", x2000_i2s1_sysclk_tx, 2),
  3016. INGENIC_PIN_GROUP("i2s1-sysclk-rx", x2000_i2s1_sysclk_rx, 2),
  3017. INGENIC_PIN_GROUP("i2s2-data-rx0", x2000_i2s2_data_rx0, 2),
  3018. INGENIC_PIN_GROUP("i2s2-data-rx1", x2000_i2s2_data_rx1, 2),
  3019. INGENIC_PIN_GROUP("i2s2-data-rx2", x2000_i2s2_data_rx2, 2),
  3020. INGENIC_PIN_GROUP("i2s2-data-rx3", x2000_i2s2_data_rx3, 2),
  3021. INGENIC_PIN_GROUP("i2s2-clk-rx", x2000_i2s2_clk_rx, 2),
  3022. INGENIC_PIN_GROUP("i2s2-sysclk-rx", x2000_i2s2_sysclk_rx, 2),
  3023. INGENIC_PIN_GROUP("i2s3-data-tx0", x2000_i2s3_data_tx0, 2),
  3024. INGENIC_PIN_GROUP("i2s3-data-tx1", x2000_i2s3_data_tx1, 2),
  3025. INGENIC_PIN_GROUP("i2s3-data-tx2", x2000_i2s3_data_tx2, 2),
  3026. INGENIC_PIN_GROUP("i2s3-data-tx3", x2000_i2s3_data_tx3, 2),
  3027. INGENIC_PIN_GROUP("i2s3-clk-tx", x2000_i2s3_clk_tx, 2),
  3028. INGENIC_PIN_GROUP("i2s3-sysclk-tx", x2000_i2s3_sysclk_tx, 2),
  3029. INGENIC_PIN_GROUP("dmic-if0", x2000_dmic_if0, 0),
  3030. INGENIC_PIN_GROUP("dmic-if1", x2000_dmic_if1, 0),
  3031. INGENIC_PIN_GROUP("dmic-if2", x2000_dmic_if2, 0),
  3032. INGENIC_PIN_GROUP("dmic-if3", x2000_dmic_if3, 0),
  3033. INGENIC_PIN_GROUP_FUNCS("cim-data-8bit", x2000_cim_8bit,
  3034. x2000_cim_8bit_funcs),
  3035. INGENIC_PIN_GROUP("cim-data-12bit", x2000_cim_12bit, 0),
  3036. INGENIC_PIN_GROUP("lcd-tft-8bit", x2000_lcd_tft_8bit, 1),
  3037. INGENIC_PIN_GROUP("lcd-tft-16bit", x2000_lcd_tft_16bit, 1),
  3038. INGENIC_PIN_GROUP("lcd-tft-18bit", x2000_lcd_tft_18bit, 1),
  3039. INGENIC_PIN_GROUP("lcd-tft-24bit", x2000_lcd_tft_24bit, 1),
  3040. INGENIC_PIN_GROUP("lcd-slcd-8bit", x2000_lcd_slcd_8bit, 2),
  3041. INGENIC_PIN_GROUP("lcd-slcd-16bit", x2000_lcd_tft_16bit, 2),
  3042. INGENIC_PIN_GROUP("pwm0-c", x2000_pwm_pwm0_c, 0),
  3043. INGENIC_PIN_GROUP("pwm0-d", x2000_pwm_pwm0_d, 2),
  3044. INGENIC_PIN_GROUP("pwm1-c", x2000_pwm_pwm1_c, 0),
  3045. INGENIC_PIN_GROUP("pwm1-d", x2000_pwm_pwm1_d, 2),
  3046. INGENIC_PIN_GROUP("pwm2-c", x2000_pwm_pwm2_c, 0),
  3047. INGENIC_PIN_GROUP("pwm2-e", x2000_pwm_pwm2_e, 1),
  3048. INGENIC_PIN_GROUP("pwm3-c", x2000_pwm_pwm3_c, 0),
  3049. INGENIC_PIN_GROUP("pwm3-e", x2000_pwm_pwm3_e, 1),
  3050. INGENIC_PIN_GROUP("pwm4-c", x2000_pwm_pwm4_c, 0),
  3051. INGENIC_PIN_GROUP("pwm4-e", x2000_pwm_pwm4_e, 1),
  3052. INGENIC_PIN_GROUP("pwm5-c", x2000_pwm_pwm5_c, 0),
  3053. INGENIC_PIN_GROUP("pwm5-e", x2000_pwm_pwm5_e, 1),
  3054. INGENIC_PIN_GROUP("pwm6-c", x2000_pwm_pwm6_c, 0),
  3055. INGENIC_PIN_GROUP("pwm6-e", x2000_pwm_pwm6_e, 1),
  3056. INGENIC_PIN_GROUP("pwm7-c", x2000_pwm_pwm7_c, 0),
  3057. INGENIC_PIN_GROUP("pwm7-e", x2000_pwm_pwm7_e, 1),
  3058. INGENIC_PIN_GROUP("pwm8", x2000_pwm_pwm8, 0),
  3059. INGENIC_PIN_GROUP("pwm9", x2000_pwm_pwm9, 0),
  3060. INGENIC_PIN_GROUP("pwm10", x2000_pwm_pwm10, 0),
  3061. INGENIC_PIN_GROUP("pwm11", x2000_pwm_pwm11, 0),
  3062. INGENIC_PIN_GROUP("pwm12", x2000_pwm_pwm12, 0),
  3063. INGENIC_PIN_GROUP("pwm13", x2000_pwm_pwm13, 0),
  3064. INGENIC_PIN_GROUP("pwm14", x2000_pwm_pwm14, 0),
  3065. INGENIC_PIN_GROUP("pwm15", x2000_pwm_pwm15, 0),
  3066. INGENIC_PIN_GROUP("mac", x2100_mac, 1),
  3067. };
  3068. static const char *x2100_mac_groups[] = { "mac", };
  3069. static const struct function_desc x2100_functions[] = {
  3070. INGENIC_PIN_FUNCTION("uart0", x2000_uart0),
  3071. INGENIC_PIN_FUNCTION("uart1", x2000_uart1),
  3072. INGENIC_PIN_FUNCTION("uart2", x2000_uart2),
  3073. INGENIC_PIN_FUNCTION("uart3", x2000_uart3),
  3074. INGENIC_PIN_FUNCTION("uart4", x2000_uart4),
  3075. INGENIC_PIN_FUNCTION("uart5", x2000_uart5),
  3076. INGENIC_PIN_FUNCTION("uart6", x2000_uart6),
  3077. INGENIC_PIN_FUNCTION("uart7", x2000_uart7),
  3078. INGENIC_PIN_FUNCTION("uart8", x2000_uart8),
  3079. INGENIC_PIN_FUNCTION("uart9", x2000_uart9),
  3080. INGENIC_PIN_FUNCTION("sfc", x2000_sfc),
  3081. INGENIC_PIN_FUNCTION("ssi0", x2000_ssi0),
  3082. INGENIC_PIN_FUNCTION("ssi1", x2000_ssi1),
  3083. INGENIC_PIN_FUNCTION("mmc0", x2000_mmc0),
  3084. INGENIC_PIN_FUNCTION("mmc1", x2000_mmc1),
  3085. INGENIC_PIN_FUNCTION("mmc2", x2000_mmc2),
  3086. INGENIC_PIN_FUNCTION("emc", x2000_emc),
  3087. INGENIC_PIN_FUNCTION("emc-cs1", x2000_cs1),
  3088. INGENIC_PIN_FUNCTION("emc-cs2", x2000_cs2),
  3089. INGENIC_PIN_FUNCTION("i2c0", x2000_i2c0),
  3090. INGENIC_PIN_FUNCTION("i2c1", x2000_i2c1),
  3091. INGENIC_PIN_FUNCTION("i2c2", x2000_i2c2),
  3092. INGENIC_PIN_FUNCTION("i2c3", x2000_i2c3),
  3093. INGENIC_PIN_FUNCTION("i2c4", x2000_i2c4),
  3094. INGENIC_PIN_FUNCTION("i2c5", x2000_i2c5),
  3095. INGENIC_PIN_FUNCTION("i2s1", x2000_i2s1),
  3096. INGENIC_PIN_FUNCTION("i2s2", x2000_i2s2),
  3097. INGENIC_PIN_FUNCTION("i2s3", x2000_i2s3),
  3098. INGENIC_PIN_FUNCTION("dmic", x2000_dmic),
  3099. INGENIC_PIN_FUNCTION("cim", x2000_cim),
  3100. INGENIC_PIN_FUNCTION("lcd", x2000_lcd),
  3101. INGENIC_PIN_FUNCTION("pwm0", x2000_pwm0),
  3102. INGENIC_PIN_FUNCTION("pwm1", x2000_pwm1),
  3103. INGENIC_PIN_FUNCTION("pwm2", x2000_pwm2),
  3104. INGENIC_PIN_FUNCTION("pwm3", x2000_pwm3),
  3105. INGENIC_PIN_FUNCTION("pwm4", x2000_pwm4),
  3106. INGENIC_PIN_FUNCTION("pwm5", x2000_pwm5),
  3107. INGENIC_PIN_FUNCTION("pwm6", x2000_pwm6),
  3108. INGENIC_PIN_FUNCTION("pwm7", x2000_pwm7),
  3109. INGENIC_PIN_FUNCTION("pwm8", x2000_pwm8),
  3110. INGENIC_PIN_FUNCTION("pwm9", x2000_pwm9),
  3111. INGENIC_PIN_FUNCTION("pwm10", x2000_pwm10),
  3112. INGENIC_PIN_FUNCTION("pwm11", x2000_pwm11),
  3113. INGENIC_PIN_FUNCTION("pwm12", x2000_pwm12),
  3114. INGENIC_PIN_FUNCTION("pwm13", x2000_pwm13),
  3115. INGENIC_PIN_FUNCTION("pwm14", x2000_pwm14),
  3116. INGENIC_PIN_FUNCTION("pwm15", x2000_pwm15),
  3117. INGENIC_PIN_FUNCTION("mac", x2100_mac),
  3118. };
  3119. static const struct ingenic_chip_info x2100_chip_info = {
  3120. .num_chips = 5,
  3121. .reg_offset = 0x100,
  3122. .version = ID_X2100,
  3123. .groups = x2100_groups,
  3124. .num_groups = ARRAY_SIZE(x2100_groups),
  3125. .functions = x2100_functions,
  3126. .num_functions = ARRAY_SIZE(x2100_functions),
  3127. .pull_ups = x2100_pull_ups,
  3128. .pull_downs = x2100_pull_downs,
  3129. .access_table = &x2000_access_table,
  3130. };
  3131. static u32 ingenic_gpio_read_reg(struct ingenic_gpio_chip *jzgc, u8 reg)
  3132. {
  3133. unsigned int val;
  3134. regmap_read(jzgc->jzpc->map, jzgc->reg_base + reg, &val);
  3135. return (u32) val;
  3136. }
  3137. static void ingenic_gpio_set_bit(struct ingenic_gpio_chip *jzgc,
  3138. u8 reg, u8 offset, bool set)
  3139. {
  3140. if (!is_soc_or_above(jzgc->jzpc, ID_JZ4740)) {
  3141. regmap_update_bits(jzgc->jzpc->map, jzgc->reg_base + reg,
  3142. BIT(offset), set ? BIT(offset) : 0);
  3143. return;
  3144. }
  3145. if (set)
  3146. reg = REG_SET(reg);
  3147. else
  3148. reg = REG_CLEAR(reg);
  3149. regmap_write(jzgc->jzpc->map, jzgc->reg_base + reg, BIT(offset));
  3150. }
  3151. static void ingenic_gpio_shadow_set_bit(struct ingenic_gpio_chip *jzgc,
  3152. u8 reg, u8 offset, bool set)
  3153. {
  3154. if (set)
  3155. reg = REG_SET(reg);
  3156. else
  3157. reg = REG_CLEAR(reg);
  3158. regmap_write(jzgc->jzpc->map, REG_PZ_BASE(
  3159. jzgc->jzpc->info->reg_offset) + reg, BIT(offset));
  3160. }
  3161. static void ingenic_gpio_shadow_set_bit_load(struct ingenic_gpio_chip *jzgc)
  3162. {
  3163. regmap_write(jzgc->jzpc->map, REG_PZ_GID2LD(
  3164. jzgc->jzpc->info->reg_offset),
  3165. jzgc->gc.base / PINS_PER_GPIO_CHIP);
  3166. }
  3167. static void jz4730_gpio_set_bits(struct ingenic_gpio_chip *jzgc,
  3168. u8 reg_upper, u8 reg_lower, u8 offset, u8 value)
  3169. {
  3170. /*
  3171. * JZ4730 function and IRQ registers support two-bits-per-pin
  3172. * definitions, split into two groups of 16.
  3173. */
  3174. u8 reg = offset < JZ4730_PINS_PER_PAIRED_REG ? reg_lower : reg_upper;
  3175. unsigned int idx = offset % JZ4730_PINS_PER_PAIRED_REG;
  3176. unsigned int mask = GENMASK(1, 0) << idx * 2;
  3177. regmap_update_bits(jzgc->jzpc->map, jzgc->reg_base + reg, mask, value << (idx * 2));
  3178. }
  3179. static inline bool ingenic_gpio_get_value(struct ingenic_gpio_chip *jzgc,
  3180. u8 offset)
  3181. {
  3182. unsigned int val = ingenic_gpio_read_reg(jzgc, GPIO_PIN);
  3183. return !!(val & BIT(offset));
  3184. }
  3185. static void ingenic_gpio_set_value(struct ingenic_gpio_chip *jzgc,
  3186. u8 offset, int value)
  3187. {
  3188. if (is_soc_or_above(jzgc->jzpc, ID_JZ4770))
  3189. ingenic_gpio_set_bit(jzgc, JZ4770_GPIO_PAT0, offset, !!value);
  3190. else if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3191. ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, offset, !!value);
  3192. else
  3193. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_DATA, offset, !!value);
  3194. }
  3195. static void irq_set_type(struct ingenic_gpio_chip *jzgc,
  3196. u8 offset, unsigned int type)
  3197. {
  3198. u8 reg1, reg2;
  3199. bool val1, val2, val3;
  3200. switch (type) {
  3201. case IRQ_TYPE_EDGE_BOTH:
  3202. val1 = val2 = false;
  3203. val3 = true;
  3204. break;
  3205. case IRQ_TYPE_EDGE_RISING:
  3206. val1 = val2 = true;
  3207. val3 = false;
  3208. break;
  3209. case IRQ_TYPE_EDGE_FALLING:
  3210. val1 = val3 = false;
  3211. val2 = true;
  3212. break;
  3213. case IRQ_TYPE_LEVEL_HIGH:
  3214. val1 = true;
  3215. val2 = val3 = false;
  3216. break;
  3217. case IRQ_TYPE_LEVEL_LOW:
  3218. default:
  3219. val1 = val2 = val3 = false;
  3220. break;
  3221. }
  3222. if (is_soc_or_above(jzgc->jzpc, ID_JZ4770)) {
  3223. reg1 = JZ4770_GPIO_PAT1;
  3224. reg2 = JZ4770_GPIO_PAT0;
  3225. } else if (is_soc_or_above(jzgc->jzpc, ID_JZ4740)) {
  3226. reg1 = JZ4740_GPIO_TRIG;
  3227. reg2 = JZ4740_GPIO_DIR;
  3228. } else {
  3229. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_GPDIR, offset, false);
  3230. jz4730_gpio_set_bits(jzgc, JZ4730_GPIO_GPIDUR,
  3231. JZ4730_GPIO_GPIDLR, offset, (val2 << 1) | val1);
  3232. return;
  3233. }
  3234. if (is_soc_or_above(jzgc->jzpc, ID_X2000)) {
  3235. ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, val1);
  3236. ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, val2);
  3237. ingenic_gpio_shadow_set_bit_load(jzgc);
  3238. ingenic_gpio_set_bit(jzgc, X2000_GPIO_EDG, offset, val3);
  3239. } else if (is_soc_or_above(jzgc->jzpc, ID_X1000)) {
  3240. ingenic_gpio_shadow_set_bit(jzgc, reg2, offset, val1);
  3241. ingenic_gpio_shadow_set_bit(jzgc, reg1, offset, val2);
  3242. ingenic_gpio_shadow_set_bit_load(jzgc);
  3243. } else {
  3244. ingenic_gpio_set_bit(jzgc, reg2, offset, val1);
  3245. ingenic_gpio_set_bit(jzgc, reg1, offset, val2);
  3246. }
  3247. }
  3248. static void ingenic_gpio_irq_mask(struct irq_data *irqd)
  3249. {
  3250. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3251. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3252. irq_hw_number_t irq = irqd_to_hwirq(irqd);
  3253. if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3254. ingenic_gpio_set_bit(jzgc, GPIO_MSK, irq, true);
  3255. else
  3256. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_GPIMR, irq, true);
  3257. }
  3258. static void ingenic_gpio_irq_unmask(struct irq_data *irqd)
  3259. {
  3260. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3261. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3262. irq_hw_number_t irq = irqd_to_hwirq(irqd);
  3263. if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3264. ingenic_gpio_set_bit(jzgc, GPIO_MSK, irq, false);
  3265. else
  3266. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_GPIMR, irq, false);
  3267. }
  3268. static void ingenic_gpio_irq_enable(struct irq_data *irqd)
  3269. {
  3270. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3271. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3272. irq_hw_number_t irq = irqd_to_hwirq(irqd);
  3273. gpiochip_enable_irq(gc, irq);
  3274. if (is_soc_or_above(jzgc->jzpc, ID_JZ4770))
  3275. ingenic_gpio_set_bit(jzgc, JZ4770_GPIO_INT, irq, true);
  3276. else if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3277. ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, true);
  3278. else
  3279. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_GPIER, irq, true);
  3280. ingenic_gpio_irq_unmask(irqd);
  3281. }
  3282. static void ingenic_gpio_irq_disable(struct irq_data *irqd)
  3283. {
  3284. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3285. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3286. irq_hw_number_t irq = irqd_to_hwirq(irqd);
  3287. ingenic_gpio_irq_mask(irqd);
  3288. if (is_soc_or_above(jzgc->jzpc, ID_JZ4770))
  3289. ingenic_gpio_set_bit(jzgc, JZ4770_GPIO_INT, irq, false);
  3290. else if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3291. ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, false);
  3292. else
  3293. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_GPIER, irq, false);
  3294. gpiochip_disable_irq(gc, irq);
  3295. }
  3296. static void ingenic_gpio_irq_ack(struct irq_data *irqd)
  3297. {
  3298. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3299. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3300. irq_hw_number_t irq = irqd_to_hwirq(irqd);
  3301. bool high;
  3302. if ((irqd_get_trigger_type(irqd) == IRQ_TYPE_EDGE_BOTH) &&
  3303. !is_soc_or_above(jzgc->jzpc, ID_X2000)) {
  3304. /*
  3305. * Switch to an interrupt for the opposite edge to the one that
  3306. * triggered the interrupt being ACKed.
  3307. */
  3308. high = ingenic_gpio_get_value(jzgc, irq);
  3309. if (high)
  3310. irq_set_type(jzgc, irq, IRQ_TYPE_LEVEL_LOW);
  3311. else
  3312. irq_set_type(jzgc, irq, IRQ_TYPE_LEVEL_HIGH);
  3313. }
  3314. if (is_soc_or_above(jzgc->jzpc, ID_JZ4770))
  3315. ingenic_gpio_set_bit(jzgc, JZ4770_GPIO_FLAG, irq, false);
  3316. else if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3317. ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, irq, true);
  3318. else
  3319. ingenic_gpio_set_bit(jzgc, JZ4730_GPIO_GPFR, irq, false);
  3320. }
  3321. static int ingenic_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
  3322. {
  3323. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3324. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3325. irq_hw_number_t irq = irqd_to_hwirq(irqd);
  3326. switch (type) {
  3327. case IRQ_TYPE_EDGE_BOTH:
  3328. case IRQ_TYPE_EDGE_RISING:
  3329. case IRQ_TYPE_EDGE_FALLING:
  3330. irq_set_handler_locked(irqd, handle_edge_irq);
  3331. break;
  3332. case IRQ_TYPE_LEVEL_HIGH:
  3333. case IRQ_TYPE_LEVEL_LOW:
  3334. irq_set_handler_locked(irqd, handle_level_irq);
  3335. break;
  3336. default:
  3337. irq_set_handler_locked(irqd, handle_bad_irq);
  3338. }
  3339. if ((type == IRQ_TYPE_EDGE_BOTH) && !is_soc_or_above(jzgc->jzpc, ID_X2000)) {
  3340. /*
  3341. * The hardware does not support interrupts on both edges. The
  3342. * best we can do is to set up a single-edge interrupt and then
  3343. * switch to the opposing edge when ACKing the interrupt.
  3344. */
  3345. bool high = ingenic_gpio_get_value(jzgc, irq);
  3346. type = high ? IRQ_TYPE_LEVEL_LOW : IRQ_TYPE_LEVEL_HIGH;
  3347. }
  3348. irq_set_type(jzgc, irq, type);
  3349. return 0;
  3350. }
  3351. static int ingenic_gpio_irq_set_wake(struct irq_data *irqd, unsigned int on)
  3352. {
  3353. struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd);
  3354. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3355. return irq_set_irq_wake(jzgc->irq, on);
  3356. }
  3357. static void ingenic_gpio_irq_handler(struct irq_desc *desc)
  3358. {
  3359. struct gpio_chip *gc = irq_desc_get_handler_data(desc);
  3360. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3361. struct irq_chip *irq_chip = irq_data_get_irq_chip(&desc->irq_data);
  3362. unsigned long flag, i;
  3363. chained_irq_enter(irq_chip, desc);
  3364. if (is_soc_or_above(jzgc->jzpc, ID_JZ4770))
  3365. flag = ingenic_gpio_read_reg(jzgc, JZ4770_GPIO_FLAG);
  3366. else if (is_soc_or_above(jzgc->jzpc, ID_JZ4740))
  3367. flag = ingenic_gpio_read_reg(jzgc, JZ4740_GPIO_FLAG);
  3368. else
  3369. flag = ingenic_gpio_read_reg(jzgc, JZ4730_GPIO_GPFR);
  3370. for_each_set_bit(i, &flag, 32)
  3371. generic_handle_domain_irq(gc->irq.domain, i);
  3372. chained_irq_exit(irq_chip, desc);
  3373. }
  3374. static void ingenic_gpio_set(struct gpio_chip *gc,
  3375. unsigned int offset, int value)
  3376. {
  3377. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3378. ingenic_gpio_set_value(jzgc, offset, value);
  3379. }
  3380. static int ingenic_gpio_get(struct gpio_chip *gc, unsigned int offset)
  3381. {
  3382. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3383. return (int) ingenic_gpio_get_value(jzgc, offset);
  3384. }
  3385. static int ingenic_gpio_direction_output(struct gpio_chip *gc,
  3386. unsigned int offset, int value)
  3387. {
  3388. ingenic_gpio_set(gc, offset, value);
  3389. return pinctrl_gpio_direction_output(gc, offset);
  3390. }
  3391. static inline void ingenic_config_pin(struct ingenic_pinctrl *jzpc,
  3392. unsigned int pin, unsigned int reg, bool set)
  3393. {
  3394. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3395. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3396. if (set) {
  3397. if (is_soc_or_above(jzpc, ID_JZ4740))
  3398. regmap_write(jzpc->map, offt * jzpc->info->reg_offset +
  3399. REG_SET(reg), BIT(idx));
  3400. else
  3401. regmap_set_bits(jzpc->map, offt * jzpc->info->reg_offset +
  3402. reg, BIT(idx));
  3403. } else {
  3404. if (is_soc_or_above(jzpc, ID_JZ4740))
  3405. regmap_write(jzpc->map, offt * jzpc->info->reg_offset +
  3406. REG_CLEAR(reg), BIT(idx));
  3407. else
  3408. regmap_clear_bits(jzpc->map, offt * jzpc->info->reg_offset +
  3409. reg, BIT(idx));
  3410. }
  3411. }
  3412. static inline void ingenic_shadow_config_pin(struct ingenic_pinctrl *jzpc,
  3413. unsigned int pin, u8 reg, bool set)
  3414. {
  3415. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3416. regmap_write(jzpc->map, REG_PZ_BASE(jzpc->info->reg_offset) +
  3417. (set ? REG_SET(reg) : REG_CLEAR(reg)), BIT(idx));
  3418. }
  3419. static inline void ingenic_shadow_config_pin_load(struct ingenic_pinctrl *jzpc,
  3420. unsigned int pin)
  3421. {
  3422. regmap_write(jzpc->map, REG_PZ_GID2LD(jzpc->info->reg_offset),
  3423. pin / PINS_PER_GPIO_CHIP);
  3424. }
  3425. static inline void jz4730_config_pin_function(struct ingenic_pinctrl *jzpc,
  3426. unsigned int pin, u8 reg_upper, u8 reg_lower, u8 value)
  3427. {
  3428. /*
  3429. * JZ4730 function and IRQ registers support two-bits-per-pin
  3430. * definitions, split into two groups of 16.
  3431. */
  3432. unsigned int idx = pin % JZ4730_PINS_PER_PAIRED_REG;
  3433. unsigned int mask = GENMASK(1, 0) << idx * 2;
  3434. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3435. u8 reg = (pin % PINS_PER_GPIO_CHIP) < JZ4730_PINS_PER_PAIRED_REG ? reg_lower : reg_upper;
  3436. regmap_update_bits(jzpc->map, offt * jzpc->info->reg_offset + reg,
  3437. mask, value << (idx * 2));
  3438. }
  3439. static inline bool ingenic_get_pin_config(struct ingenic_pinctrl *jzpc,
  3440. unsigned int pin, unsigned int reg)
  3441. {
  3442. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3443. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3444. unsigned int val;
  3445. regmap_read(jzpc->map, offt * jzpc->info->reg_offset + reg, &val);
  3446. return val & BIT(idx);
  3447. }
  3448. static int ingenic_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
  3449. {
  3450. struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc);
  3451. struct ingenic_pinctrl *jzpc = jzgc->jzpc;
  3452. unsigned int pin = gc->base + offset;
  3453. if (is_soc_or_above(jzpc, ID_JZ4770)) {
  3454. if (ingenic_get_pin_config(jzpc, pin, JZ4770_GPIO_INT) ||
  3455. ingenic_get_pin_config(jzpc, pin, JZ4770_GPIO_PAT1))
  3456. return GPIO_LINE_DIRECTION_IN;
  3457. return GPIO_LINE_DIRECTION_OUT;
  3458. } else if (!is_soc_or_above(jzpc, ID_JZ4740)) {
  3459. if (!ingenic_get_pin_config(jzpc, pin, JZ4730_GPIO_GPDIR))
  3460. return GPIO_LINE_DIRECTION_IN;
  3461. return GPIO_LINE_DIRECTION_OUT;
  3462. }
  3463. if (ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_SELECT))
  3464. return GPIO_LINE_DIRECTION_IN;
  3465. if (ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_DIR))
  3466. return GPIO_LINE_DIRECTION_OUT;
  3467. return GPIO_LINE_DIRECTION_IN;
  3468. }
  3469. static const struct pinctrl_ops ingenic_pctlops = {
  3470. .get_groups_count = pinctrl_generic_get_group_count,
  3471. .get_group_name = pinctrl_generic_get_group_name,
  3472. .get_group_pins = pinctrl_generic_get_group_pins,
  3473. .dt_node_to_map = pinconf_generic_dt_node_to_map_all,
  3474. .dt_free_map = pinconf_generic_dt_free_map,
  3475. };
  3476. static int ingenic_gpio_irq_request(struct irq_data *data)
  3477. {
  3478. struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
  3479. irq_hw_number_t irq = irqd_to_hwirq(data);
  3480. int ret;
  3481. ret = pinctrl_gpio_direction_input(gpio_chip, irq);
  3482. if (ret)
  3483. return ret;
  3484. return gpiochip_reqres_irq(gpio_chip, irq);
  3485. }
  3486. static void ingenic_gpio_irq_release(struct irq_data *data)
  3487. {
  3488. struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
  3489. irq_hw_number_t irq = irqd_to_hwirq(data);
  3490. return gpiochip_relres_irq(gpio_chip, irq);
  3491. }
  3492. static void ingenic_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p)
  3493. {
  3494. struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
  3495. seq_printf(p, "%s", gpio_chip->label);
  3496. }
  3497. static const struct irq_chip ingenic_gpio_irqchip = {
  3498. .irq_enable = ingenic_gpio_irq_enable,
  3499. .irq_disable = ingenic_gpio_irq_disable,
  3500. .irq_unmask = ingenic_gpio_irq_unmask,
  3501. .irq_mask = ingenic_gpio_irq_mask,
  3502. .irq_ack = ingenic_gpio_irq_ack,
  3503. .irq_set_type = ingenic_gpio_irq_set_type,
  3504. .irq_set_wake = ingenic_gpio_irq_set_wake,
  3505. .irq_request_resources = ingenic_gpio_irq_request,
  3506. .irq_release_resources = ingenic_gpio_irq_release,
  3507. .irq_print_chip = ingenic_gpio_irq_print_chip,
  3508. .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE,
  3509. };
  3510. static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc,
  3511. int pin, int func)
  3512. {
  3513. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3514. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3515. dev_dbg(jzpc->dev, "set pin P%c%u to function %u\n",
  3516. 'A' + offt, idx, func);
  3517. if (is_soc_or_above(jzpc, ID_X1000)) {
  3518. ingenic_shadow_config_pin(jzpc, pin, JZ4770_GPIO_INT, false);
  3519. ingenic_shadow_config_pin(jzpc, pin, GPIO_MSK, false);
  3520. ingenic_shadow_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, func & 0x2);
  3521. ingenic_shadow_config_pin(jzpc, pin, JZ4770_GPIO_PAT0, func & 0x1);
  3522. ingenic_shadow_config_pin_load(jzpc, pin);
  3523. } else if (is_soc_or_above(jzpc, ID_JZ4770)) {
  3524. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_INT, false);
  3525. ingenic_config_pin(jzpc, pin, GPIO_MSK, false);
  3526. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, func & 0x2);
  3527. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT0, func & 0x1);
  3528. } else if (is_soc_or_above(jzpc, ID_JZ4740)) {
  3529. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, true);
  3530. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_TRIG, func & 0x2);
  3531. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, func & 0x1);
  3532. } else {
  3533. ingenic_config_pin(jzpc, pin, JZ4730_GPIO_GPIER, false);
  3534. jz4730_config_pin_function(jzpc, pin, JZ4730_GPIO_GPAUR, JZ4730_GPIO_GPALR, func);
  3535. }
  3536. return 0;
  3537. }
  3538. static int ingenic_pinmux_set_mux(struct pinctrl_dev *pctldev,
  3539. unsigned int selector, unsigned int group)
  3540. {
  3541. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  3542. struct function_desc *func;
  3543. struct group_desc *grp;
  3544. unsigned int i;
  3545. uintptr_t mode;
  3546. u8 *pin_modes;
  3547. func = pinmux_generic_get_function(pctldev, selector);
  3548. if (!func)
  3549. return -EINVAL;
  3550. grp = pinctrl_generic_get_group(pctldev, group);
  3551. if (!grp)
  3552. return -EINVAL;
  3553. dev_dbg(pctldev->dev, "enable function %s group %s\n",
  3554. func->func.name, grp->grp.name);
  3555. mode = (uintptr_t)grp->data;
  3556. if (mode <= 3) {
  3557. for (i = 0; i < grp->grp.npins; i++)
  3558. ingenic_pinmux_set_pin_fn(jzpc, grp->grp.pins[i], mode);
  3559. } else {
  3560. pin_modes = grp->data;
  3561. for (i = 0; i < grp->grp.npins; i++)
  3562. ingenic_pinmux_set_pin_fn(jzpc, grp->grp.pins[i], pin_modes[i]);
  3563. }
  3564. return 0;
  3565. }
  3566. static int ingenic_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
  3567. struct pinctrl_gpio_range *range,
  3568. unsigned int pin, bool input)
  3569. {
  3570. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  3571. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3572. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3573. dev_dbg(pctldev->dev, "set pin P%c%u to %sput\n",
  3574. 'A' + offt, idx, input ? "in" : "out");
  3575. if (is_soc_or_above(jzpc, ID_X1000)) {
  3576. ingenic_shadow_config_pin(jzpc, pin, JZ4770_GPIO_INT, false);
  3577. ingenic_shadow_config_pin(jzpc, pin, GPIO_MSK, true);
  3578. ingenic_shadow_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, input);
  3579. ingenic_shadow_config_pin_load(jzpc, pin);
  3580. } else if (is_soc_or_above(jzpc, ID_JZ4770)) {
  3581. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_INT, false);
  3582. ingenic_config_pin(jzpc, pin, GPIO_MSK, true);
  3583. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT1, input);
  3584. } else if (is_soc_or_above(jzpc, ID_JZ4740)) {
  3585. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, false);
  3586. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_DIR, !input);
  3587. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, false);
  3588. } else {
  3589. ingenic_config_pin(jzpc, pin, JZ4730_GPIO_GPIER, false);
  3590. ingenic_config_pin(jzpc, pin, JZ4730_GPIO_GPDIR, !input);
  3591. jz4730_config_pin_function(jzpc, pin, JZ4730_GPIO_GPAUR, JZ4730_GPIO_GPALR, 0);
  3592. }
  3593. return 0;
  3594. }
  3595. static const struct pinmux_ops ingenic_pmxops = {
  3596. .get_functions_count = pinmux_generic_get_function_count,
  3597. .get_function_name = pinmux_generic_get_function_name,
  3598. .get_function_groups = pinmux_generic_get_function_groups,
  3599. .set_mux = ingenic_pinmux_set_mux,
  3600. .gpio_set_direction = ingenic_pinmux_gpio_set_direction,
  3601. };
  3602. static int ingenic_pinconf_get(struct pinctrl_dev *pctldev,
  3603. unsigned int pin, unsigned long *config)
  3604. {
  3605. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  3606. enum pin_config_param param = pinconf_to_config_param(*config);
  3607. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3608. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3609. unsigned int arg = 1;
  3610. unsigned int bias, reg;
  3611. bool pull, pullup, pulldown;
  3612. if (is_soc_or_above(jzpc, ID_X2000)) {
  3613. pullup = ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPU) &&
  3614. !ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPD) &&
  3615. (jzpc->info->pull_ups[offt] & BIT(idx));
  3616. pulldown = ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPD) &&
  3617. !ingenic_get_pin_config(jzpc, pin, X2000_GPIO_PEPU) &&
  3618. (jzpc->info->pull_downs[offt] & BIT(idx));
  3619. } else if (is_soc_or_above(jzpc, ID_X1830)) {
  3620. unsigned int half = PINS_PER_GPIO_CHIP / 2;
  3621. unsigned int idxh = (pin % half) * 2;
  3622. if (idx < half)
  3623. regmap_read(jzpc->map, offt * jzpc->info->reg_offset +
  3624. X1830_GPIO_PEL, &bias);
  3625. else
  3626. regmap_read(jzpc->map, offt * jzpc->info->reg_offset +
  3627. X1830_GPIO_PEH, &bias);
  3628. bias = (bias >> idxh) & (GPIO_PULL_UP | GPIO_PULL_DOWN);
  3629. pullup = (bias == GPIO_PULL_UP) && (jzpc->info->pull_ups[offt] & BIT(idx));
  3630. pulldown = (bias == GPIO_PULL_DOWN) && (jzpc->info->pull_downs[offt] & BIT(idx));
  3631. } else {
  3632. if (is_soc_or_above(jzpc, ID_JZ4770))
  3633. pull = !ingenic_get_pin_config(jzpc, pin, JZ4770_GPIO_PEN);
  3634. else if (is_soc_or_above(jzpc, ID_JZ4740))
  3635. pull = !ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_PULL_DIS);
  3636. else
  3637. pull = ingenic_get_pin_config(jzpc, pin, JZ4730_GPIO_GPPUR);
  3638. pullup = pull && (jzpc->info->pull_ups[offt] & BIT(idx));
  3639. pulldown = pull && (jzpc->info->pull_downs[offt] & BIT(idx));
  3640. }
  3641. switch (param) {
  3642. case PIN_CONFIG_BIAS_DISABLE:
  3643. if (pullup || pulldown)
  3644. return -EINVAL;
  3645. break;
  3646. case PIN_CONFIG_BIAS_PULL_UP:
  3647. if (!pullup)
  3648. return -EINVAL;
  3649. break;
  3650. case PIN_CONFIG_BIAS_PULL_DOWN:
  3651. if (!pulldown)
  3652. return -EINVAL;
  3653. break;
  3654. case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  3655. if (is_soc_or_above(jzpc, ID_X2000))
  3656. reg = X2000_GPIO_SMT;
  3657. else if (is_soc_or_above(jzpc, ID_X1830))
  3658. reg = X1830_GPIO_SMT;
  3659. else
  3660. return -EINVAL;
  3661. arg = !!ingenic_get_pin_config(jzpc, pin, reg);
  3662. break;
  3663. case PIN_CONFIG_SLEW_RATE:
  3664. if (is_soc_or_above(jzpc, ID_X2000))
  3665. reg = X2000_GPIO_SR;
  3666. else if (is_soc_or_above(jzpc, ID_X1830))
  3667. reg = X1830_GPIO_SR;
  3668. else
  3669. return -EINVAL;
  3670. arg = !!ingenic_get_pin_config(jzpc, pin, reg);
  3671. break;
  3672. default:
  3673. return -ENOTSUPP;
  3674. }
  3675. *config = pinconf_to_config_packed(param, arg);
  3676. return 0;
  3677. }
  3678. static void ingenic_set_bias(struct ingenic_pinctrl *jzpc,
  3679. unsigned int pin, unsigned int bias)
  3680. {
  3681. if (is_soc_or_above(jzpc, ID_X2000)) {
  3682. switch (bias) {
  3683. case GPIO_PULL_UP:
  3684. ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
  3685. ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, true);
  3686. break;
  3687. case GPIO_PULL_DOWN:
  3688. ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
  3689. ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, true);
  3690. break;
  3691. case GPIO_PULL_DIS:
  3692. default:
  3693. ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPU, false);
  3694. ingenic_config_pin(jzpc, pin, X2000_GPIO_PEPD, false);
  3695. }
  3696. } else if (is_soc_or_above(jzpc, ID_X1830)) {
  3697. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3698. unsigned int half = PINS_PER_GPIO_CHIP / 2;
  3699. unsigned int idxh = (pin % half) * 2;
  3700. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3701. if (idx < half) {
  3702. regmap_write(jzpc->map, offt * jzpc->info->reg_offset +
  3703. REG_CLEAR(X1830_GPIO_PEL), 3 << idxh);
  3704. regmap_write(jzpc->map, offt * jzpc->info->reg_offset +
  3705. REG_SET(X1830_GPIO_PEL), bias << idxh);
  3706. } else {
  3707. regmap_write(jzpc->map, offt * jzpc->info->reg_offset +
  3708. REG_CLEAR(X1830_GPIO_PEH), 3 << idxh);
  3709. regmap_write(jzpc->map, offt * jzpc->info->reg_offset +
  3710. REG_SET(X1830_GPIO_PEH), bias << idxh);
  3711. }
  3712. } else if (is_soc_or_above(jzpc, ID_JZ4770)) {
  3713. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PEN, !bias);
  3714. } else if (is_soc_or_above(jzpc, ID_JZ4740)) {
  3715. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_PULL_DIS, !bias);
  3716. } else {
  3717. ingenic_config_pin(jzpc, pin, JZ4730_GPIO_GPPUR, bias);
  3718. }
  3719. }
  3720. static void ingenic_set_schmitt_trigger(struct ingenic_pinctrl *jzpc,
  3721. unsigned int pin, bool enable)
  3722. {
  3723. if (is_soc_or_above(jzpc, ID_X2000))
  3724. ingenic_config_pin(jzpc, pin, X2000_GPIO_SMT, enable);
  3725. else
  3726. ingenic_config_pin(jzpc, pin, X1830_GPIO_SMT, enable);
  3727. }
  3728. static void ingenic_set_output_level(struct ingenic_pinctrl *jzpc,
  3729. unsigned int pin, bool high)
  3730. {
  3731. if (is_soc_or_above(jzpc, ID_JZ4770))
  3732. ingenic_config_pin(jzpc, pin, JZ4770_GPIO_PAT0, high);
  3733. else if (is_soc_or_above(jzpc, ID_JZ4740))
  3734. ingenic_config_pin(jzpc, pin, JZ4740_GPIO_DATA, high);
  3735. else
  3736. ingenic_config_pin(jzpc, pin, JZ4730_GPIO_DATA, high);
  3737. }
  3738. static void ingenic_set_slew_rate(struct ingenic_pinctrl *jzpc,
  3739. unsigned int pin, unsigned int slew)
  3740. {
  3741. if (is_soc_or_above(jzpc, ID_X2000))
  3742. ingenic_config_pin(jzpc, pin, X2000_GPIO_SR, slew);
  3743. else
  3744. ingenic_config_pin(jzpc, pin, X1830_GPIO_SR, slew);
  3745. }
  3746. static int ingenic_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
  3747. unsigned long *configs, unsigned int num_configs)
  3748. {
  3749. struct ingenic_pinctrl *jzpc = pinctrl_dev_get_drvdata(pctldev);
  3750. unsigned int idx = pin % PINS_PER_GPIO_CHIP;
  3751. unsigned int offt = pin / PINS_PER_GPIO_CHIP;
  3752. unsigned int cfg, arg;
  3753. int ret;
  3754. for (cfg = 0; cfg < num_configs; cfg++) {
  3755. switch (pinconf_to_config_param(configs[cfg])) {
  3756. case PIN_CONFIG_BIAS_DISABLE:
  3757. case PIN_CONFIG_BIAS_PULL_UP:
  3758. case PIN_CONFIG_BIAS_PULL_DOWN:
  3759. case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  3760. case PIN_CONFIG_OUTPUT:
  3761. case PIN_CONFIG_SLEW_RATE:
  3762. continue;
  3763. default:
  3764. return -ENOTSUPP;
  3765. }
  3766. }
  3767. for (cfg = 0; cfg < num_configs; cfg++) {
  3768. arg = pinconf_to_config_argument(configs[cfg]);
  3769. switch (pinconf_to_config_param(configs[cfg])) {
  3770. case PIN_CONFIG_BIAS_DISABLE:
  3771. dev_dbg(jzpc->dev, "disable pull-over for pin P%c%u\n",
  3772. 'A' + offt, idx);
  3773. ingenic_set_bias(jzpc, pin, GPIO_PULL_DIS);
  3774. break;
  3775. case PIN_CONFIG_BIAS_PULL_UP:
  3776. if (!(jzpc->info->pull_ups[offt] & BIT(idx)))
  3777. return -EINVAL;
  3778. dev_dbg(jzpc->dev, "set pull-up for pin P%c%u\n",
  3779. 'A' + offt, idx);
  3780. ingenic_set_bias(jzpc, pin, GPIO_PULL_UP);
  3781. break;
  3782. case PIN_CONFIG_BIAS_PULL_DOWN:
  3783. if (!(jzpc->info->pull_downs[offt] & BIT(idx)))
  3784. return -EINVAL;
  3785. dev_dbg(jzpc->dev, "set pull-down for pin P%c%u\n",
  3786. 'A' + offt, idx);
  3787. ingenic_set_bias(jzpc, pin, GPIO_PULL_DOWN);
  3788. break;
  3789. case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
  3790. if (!is_soc_or_above(jzpc, ID_X1830))
  3791. return -EINVAL;
  3792. ingenic_set_schmitt_trigger(jzpc, pin, arg);
  3793. break;
  3794. case PIN_CONFIG_OUTPUT:
  3795. ret = pinctrl_gpio_direction_output(jzpc->gc,
  3796. pin - jzpc->gc->base);
  3797. if (ret)
  3798. return ret;
  3799. ingenic_set_output_level(jzpc, pin, arg);
  3800. break;
  3801. case PIN_CONFIG_SLEW_RATE:
  3802. if (!is_soc_or_above(jzpc, ID_X1830))
  3803. return -EINVAL;
  3804. ingenic_set_slew_rate(jzpc, pin, arg);
  3805. break;
  3806. default:
  3807. /* unreachable */
  3808. break;
  3809. }
  3810. }
  3811. return 0;
  3812. }
  3813. static int ingenic_pinconf_group_get(struct pinctrl_dev *pctldev,
  3814. unsigned int group, unsigned long *config)
  3815. {
  3816. const unsigned int *pins;
  3817. unsigned int i, npins, old = 0;
  3818. int ret;
  3819. ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
  3820. if (ret)
  3821. return ret;
  3822. for (i = 0; i < npins; i++) {
  3823. if (ingenic_pinconf_get(pctldev, pins[i], config))
  3824. return -ENOTSUPP;
  3825. /* configs do not match between two pins */
  3826. if (i && (old != *config))
  3827. return -ENOTSUPP;
  3828. old = *config;
  3829. }
  3830. return 0;
  3831. }
  3832. static int ingenic_pinconf_group_set(struct pinctrl_dev *pctldev,
  3833. unsigned int group, unsigned long *configs,
  3834. unsigned int num_configs)
  3835. {
  3836. const unsigned int *pins;
  3837. unsigned int i, npins;
  3838. int ret;
  3839. ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins);
  3840. if (ret)
  3841. return ret;
  3842. for (i = 0; i < npins; i++) {
  3843. ret = ingenic_pinconf_set(pctldev,
  3844. pins[i], configs, num_configs);
  3845. if (ret)
  3846. return ret;
  3847. }
  3848. return 0;
  3849. }
  3850. static const struct pinconf_ops ingenic_confops = {
  3851. .is_generic = true,
  3852. .pin_config_get = ingenic_pinconf_get,
  3853. .pin_config_set = ingenic_pinconf_set,
  3854. .pin_config_group_get = ingenic_pinconf_group_get,
  3855. .pin_config_group_set = ingenic_pinconf_group_set,
  3856. };
  3857. static const struct regmap_config ingenic_pinctrl_regmap_config = {
  3858. .reg_bits = 32,
  3859. .val_bits = 32,
  3860. .reg_stride = 4,
  3861. };
  3862. static const struct of_device_id ingenic_gpio_of_matches[] __initconst = {
  3863. { .compatible = "ingenic,jz4730-gpio" },
  3864. { .compatible = "ingenic,jz4740-gpio" },
  3865. { .compatible = "ingenic,jz4725b-gpio" },
  3866. { .compatible = "ingenic,jz4750-gpio" },
  3867. { .compatible = "ingenic,jz4755-gpio" },
  3868. { .compatible = "ingenic,jz4760-gpio" },
  3869. { .compatible = "ingenic,jz4770-gpio" },
  3870. { .compatible = "ingenic,jz4775-gpio" },
  3871. { .compatible = "ingenic,jz4780-gpio" },
  3872. { .compatible = "ingenic,x1000-gpio" },
  3873. { .compatible = "ingenic,x1830-gpio" },
  3874. { .compatible = "ingenic,x2000-gpio" },
  3875. { .compatible = "ingenic,x2100-gpio" },
  3876. {},
  3877. };
  3878. static int __init ingenic_gpio_probe(struct ingenic_pinctrl *jzpc,
  3879. struct fwnode_handle *fwnode)
  3880. {
  3881. struct ingenic_gpio_chip *jzgc;
  3882. struct device *dev = jzpc->dev;
  3883. struct gpio_irq_chip *girq;
  3884. unsigned int bank;
  3885. int err;
  3886. err = fwnode_property_read_u32(fwnode, "reg", &bank);
  3887. if (err) {
  3888. dev_err(dev, "Cannot read \"reg\" property: %i\n", err);
  3889. return err;
  3890. }
  3891. jzgc = devm_kzalloc(dev, sizeof(*jzgc), GFP_KERNEL);
  3892. if (!jzgc)
  3893. return -ENOMEM;
  3894. jzpc->gc = &jzgc->gc;
  3895. jzgc->jzpc = jzpc;
  3896. jzgc->reg_base = bank * jzpc->info->reg_offset;
  3897. jzgc->gc.label = devm_kasprintf(dev, GFP_KERNEL, "GPIO%c", 'A' + bank);
  3898. if (!jzgc->gc.label)
  3899. return -ENOMEM;
  3900. /* DO NOT EXPAND THIS: FOR BACKWARD GPIO NUMBERSPACE COMPATIBIBILITY
  3901. * ONLY: WORK TO TRANSITION CONSUMERS TO USE THE GPIO DESCRIPTOR API IN
  3902. * <linux/gpio/consumer.h> INSTEAD.
  3903. */
  3904. jzgc->gc.base = bank * 32;
  3905. jzgc->gc.ngpio = 32;
  3906. jzgc->gc.parent = dev;
  3907. jzgc->gc.fwnode = fwnode;
  3908. jzgc->gc.owner = THIS_MODULE;
  3909. jzgc->gc.set = ingenic_gpio_set;
  3910. jzgc->gc.get = ingenic_gpio_get;
  3911. jzgc->gc.direction_input = pinctrl_gpio_direction_input;
  3912. jzgc->gc.direction_output = ingenic_gpio_direction_output;
  3913. jzgc->gc.get_direction = ingenic_gpio_get_direction;
  3914. jzgc->gc.request = gpiochip_generic_request;
  3915. jzgc->gc.free = gpiochip_generic_free;
  3916. err = fwnode_irq_get(fwnode, 0);
  3917. if (err < 0)
  3918. return err;
  3919. if (!err)
  3920. return -EINVAL;
  3921. jzgc->irq = err;
  3922. girq = &jzgc->gc.irq;
  3923. gpio_irq_chip_set_chip(girq, &ingenic_gpio_irqchip);
  3924. girq->parent_handler = ingenic_gpio_irq_handler;
  3925. girq->num_parents = 1;
  3926. girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
  3927. GFP_KERNEL);
  3928. if (!girq->parents)
  3929. return -ENOMEM;
  3930. girq->parents[0] = jzgc->irq;
  3931. girq->default_type = IRQ_TYPE_NONE;
  3932. girq->handler = handle_level_irq;
  3933. err = devm_gpiochip_add_data(dev, &jzgc->gc, jzgc);
  3934. if (err)
  3935. return err;
  3936. return 0;
  3937. }
  3938. static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
  3939. {
  3940. struct device *dev = &pdev->dev;
  3941. struct ingenic_pinctrl *jzpc;
  3942. struct pinctrl_desc *pctl_desc;
  3943. void __iomem *base;
  3944. const struct ingenic_chip_info *chip_info;
  3945. struct regmap_config regmap_config;
  3946. struct fwnode_handle *fwnode;
  3947. unsigned int i;
  3948. int err;
  3949. chip_info = device_get_match_data(dev);
  3950. if (!chip_info) {
  3951. dev_err(dev, "Unsupported SoC\n");
  3952. return -EINVAL;
  3953. }
  3954. jzpc = devm_kzalloc(dev, sizeof(*jzpc), GFP_KERNEL);
  3955. if (!jzpc)
  3956. return -ENOMEM;
  3957. base = devm_platform_ioremap_resource(pdev, 0);
  3958. if (IS_ERR(base))
  3959. return PTR_ERR(base);
  3960. regmap_config = ingenic_pinctrl_regmap_config;
  3961. if (chip_info->access_table) {
  3962. regmap_config.rd_table = chip_info->access_table;
  3963. regmap_config.wr_table = chip_info->access_table;
  3964. } else {
  3965. regmap_config.max_register = chip_info->num_chips * chip_info->reg_offset - 4;
  3966. }
  3967. jzpc->map = devm_regmap_init_mmio(dev, base, &regmap_config);
  3968. if (IS_ERR(jzpc->map)) {
  3969. dev_err(dev, "Failed to create regmap\n");
  3970. return PTR_ERR(jzpc->map);
  3971. }
  3972. jzpc->dev = dev;
  3973. jzpc->info = chip_info;
  3974. pctl_desc = devm_kzalloc(&pdev->dev, sizeof(*pctl_desc), GFP_KERNEL);
  3975. if (!pctl_desc)
  3976. return -ENOMEM;
  3977. /* fill in pinctrl_desc structure */
  3978. pctl_desc->name = dev_name(dev);
  3979. pctl_desc->owner = THIS_MODULE;
  3980. pctl_desc->pctlops = &ingenic_pctlops;
  3981. pctl_desc->pmxops = &ingenic_pmxops;
  3982. pctl_desc->confops = &ingenic_confops;
  3983. pctl_desc->npins = chip_info->num_chips * PINS_PER_GPIO_CHIP;
  3984. pctl_desc->pins = jzpc->pdesc = devm_kcalloc(&pdev->dev,
  3985. pctl_desc->npins, sizeof(*jzpc->pdesc), GFP_KERNEL);
  3986. if (!jzpc->pdesc)
  3987. return -ENOMEM;
  3988. for (i = 0; i < pctl_desc->npins; i++) {
  3989. jzpc->pdesc[i].number = i;
  3990. jzpc->pdesc[i].name = kasprintf(GFP_KERNEL, "P%c%d",
  3991. 'A' + (i / PINS_PER_GPIO_CHIP),
  3992. i % PINS_PER_GPIO_CHIP);
  3993. }
  3994. jzpc->pctl = devm_pinctrl_register(dev, pctl_desc, jzpc);
  3995. if (IS_ERR(jzpc->pctl)) {
  3996. dev_err(dev, "Failed to register pinctrl\n");
  3997. return PTR_ERR(jzpc->pctl);
  3998. }
  3999. for (i = 0; i < chip_info->num_groups; i++) {
  4000. const struct group_desc *group = &chip_info->groups[i];
  4001. const struct pingroup *grp = &group->grp;
  4002. err = pinctrl_generic_add_group(jzpc->pctl, grp->name, grp->pins, grp->npins,
  4003. group->data);
  4004. if (err < 0) {
  4005. dev_err(dev, "Failed to register group %s\n", grp->name);
  4006. return err;
  4007. }
  4008. }
  4009. for (i = 0; i < chip_info->num_functions; i++) {
  4010. const struct function_desc *function = &chip_info->functions[i];
  4011. const struct pinfunction *func = &function->func;
  4012. err = pinmux_generic_add_function(jzpc->pctl, func->name,
  4013. func->groups, func->ngroups,
  4014. function->data);
  4015. if (err < 0) {
  4016. dev_err(dev, "Failed to register function %s\n", func->name);
  4017. return err;
  4018. }
  4019. }
  4020. dev_set_drvdata(dev, jzpc->map);
  4021. device_for_each_child_node(dev, fwnode) {
  4022. if (of_match_node(ingenic_gpio_of_matches, to_of_node(fwnode))) {
  4023. err = ingenic_gpio_probe(jzpc, fwnode);
  4024. if (err) {
  4025. fwnode_handle_put(fwnode);
  4026. return err;
  4027. }
  4028. }
  4029. }
  4030. return 0;
  4031. }
  4032. #define IF_ENABLED(cfg, ptr) PTR_IF(IS_ENABLED(cfg), (ptr))
  4033. static const struct of_device_id ingenic_pinctrl_of_matches[] = {
  4034. {
  4035. .compatible = "ingenic,jz4730-pinctrl",
  4036. .data = IF_ENABLED(CONFIG_MACH_JZ4730, &jz4730_chip_info)
  4037. },
  4038. {
  4039. .compatible = "ingenic,jz4740-pinctrl",
  4040. .data = IF_ENABLED(CONFIG_MACH_JZ4740, &jz4740_chip_info)
  4041. },
  4042. {
  4043. .compatible = "ingenic,jz4725b-pinctrl",
  4044. .data = IF_ENABLED(CONFIG_MACH_JZ4725B, &jz4725b_chip_info)
  4045. },
  4046. {
  4047. .compatible = "ingenic,jz4750-pinctrl",
  4048. .data = IF_ENABLED(CONFIG_MACH_JZ4750, &jz4750_chip_info)
  4049. },
  4050. {
  4051. .compatible = "ingenic,jz4755-pinctrl",
  4052. .data = IF_ENABLED(CONFIG_MACH_JZ4755, &jz4755_chip_info)
  4053. },
  4054. {
  4055. .compatible = "ingenic,jz4760-pinctrl",
  4056. .data = IF_ENABLED(CONFIG_MACH_JZ4760, &jz4760_chip_info)
  4057. },
  4058. {
  4059. .compatible = "ingenic,jz4760b-pinctrl",
  4060. .data = IF_ENABLED(CONFIG_MACH_JZ4760, &jz4760_chip_info)
  4061. },
  4062. {
  4063. .compatible = "ingenic,jz4770-pinctrl",
  4064. .data = IF_ENABLED(CONFIG_MACH_JZ4770, &jz4770_chip_info)
  4065. },
  4066. {
  4067. .compatible = "ingenic,jz4775-pinctrl",
  4068. .data = IF_ENABLED(CONFIG_MACH_JZ4775, &jz4775_chip_info)
  4069. },
  4070. {
  4071. .compatible = "ingenic,jz4780-pinctrl",
  4072. .data = IF_ENABLED(CONFIG_MACH_JZ4780, &jz4780_chip_info)
  4073. },
  4074. {
  4075. .compatible = "ingenic,x1000-pinctrl",
  4076. .data = IF_ENABLED(CONFIG_MACH_X1000, &x1000_chip_info)
  4077. },
  4078. {
  4079. .compatible = "ingenic,x1000e-pinctrl",
  4080. .data = IF_ENABLED(CONFIG_MACH_X1000, &x1000_chip_info)
  4081. },
  4082. {
  4083. .compatible = "ingenic,x1500-pinctrl",
  4084. .data = IF_ENABLED(CONFIG_MACH_X1500, &x1500_chip_info)
  4085. },
  4086. {
  4087. .compatible = "ingenic,x1830-pinctrl",
  4088. .data = IF_ENABLED(CONFIG_MACH_X1830, &x1830_chip_info)
  4089. },
  4090. {
  4091. .compatible = "ingenic,x2000-pinctrl",
  4092. .data = IF_ENABLED(CONFIG_MACH_X2000, &x2000_chip_info)
  4093. },
  4094. {
  4095. .compatible = "ingenic,x2000e-pinctrl",
  4096. .data = IF_ENABLED(CONFIG_MACH_X2000, &x2000_chip_info)
  4097. },
  4098. {
  4099. .compatible = "ingenic,x2100-pinctrl",
  4100. .data = IF_ENABLED(CONFIG_MACH_X2100, &x2100_chip_info)
  4101. },
  4102. { /* sentinel */ },
  4103. };
  4104. static struct platform_driver ingenic_pinctrl_driver = {
  4105. .driver = {
  4106. .name = "pinctrl-ingenic",
  4107. .of_match_table = ingenic_pinctrl_of_matches,
  4108. },
  4109. };
  4110. static int __init ingenic_pinctrl_drv_register(void)
  4111. {
  4112. return platform_driver_probe(&ingenic_pinctrl_driver,
  4113. ingenic_pinctrl_probe);
  4114. }
  4115. subsys_initcall(ingenic_pinctrl_drv_register);