pinctrl-ingenic.c 185 KB

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