pinctrl-spear320.c 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468
  1. /*
  2. * Driver for the ST Microelectronics SPEAr320 pinmux
  3. *
  4. * Copyright (C) 2012 ST Microelectronics
  5. * Viresh Kumar <vireshk@kernel.org>
  6. *
  7. * This file is licensed under the terms of the GNU General Public
  8. * License version 2. This program is licensed "as is" without any
  9. * warranty of any kind, whether express or implied.
  10. */
  11. #include <linux/err.h>
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/of_device.h>
  15. #include <linux/platform_device.h>
  16. #include "pinctrl-spear3xx.h"
  17. #define DRIVER_NAME "spear320-pinmux"
  18. /* addresses */
  19. #define PMX_CONFIG_REG 0x0C
  20. #define MODE_CONFIG_REG 0x10
  21. #define MODE_EXT_CONFIG_REG 0x18
  22. /* modes */
  23. #define AUTO_NET_SMII_MODE (1 << 0)
  24. #define AUTO_NET_MII_MODE (1 << 1)
  25. #define AUTO_EXP_MODE (1 << 2)
  26. #define SMALL_PRINTERS_MODE (1 << 3)
  27. #define EXTENDED_MODE (1 << 4)
  28. static struct spear_pmx_mode pmx_mode_auto_net_smii = {
  29. .name = "Automation Networking SMII mode",
  30. .mode = AUTO_NET_SMII_MODE,
  31. .reg = MODE_CONFIG_REG,
  32. .mask = 0x00000007,
  33. .val = 0x0,
  34. };
  35. static struct spear_pmx_mode pmx_mode_auto_net_mii = {
  36. .name = "Automation Networking MII mode",
  37. .mode = AUTO_NET_MII_MODE,
  38. .reg = MODE_CONFIG_REG,
  39. .mask = 0x00000007,
  40. .val = 0x1,
  41. };
  42. static struct spear_pmx_mode pmx_mode_auto_exp = {
  43. .name = "Automation Expanded mode",
  44. .mode = AUTO_EXP_MODE,
  45. .reg = MODE_CONFIG_REG,
  46. .mask = 0x00000007,
  47. .val = 0x2,
  48. };
  49. static struct spear_pmx_mode pmx_mode_small_printers = {
  50. .name = "Small Printers mode",
  51. .mode = SMALL_PRINTERS_MODE,
  52. .reg = MODE_CONFIG_REG,
  53. .mask = 0x00000007,
  54. .val = 0x3,
  55. };
  56. static struct spear_pmx_mode pmx_mode_extended = {
  57. .name = "extended mode",
  58. .mode = EXTENDED_MODE,
  59. .reg = MODE_EXT_CONFIG_REG,
  60. .mask = 0x00000001,
  61. .val = 0x1,
  62. };
  63. static struct spear_pmx_mode *spear320_pmx_modes[] = {
  64. &pmx_mode_auto_net_smii,
  65. &pmx_mode_auto_net_mii,
  66. &pmx_mode_auto_exp,
  67. &pmx_mode_small_printers,
  68. &pmx_mode_extended,
  69. };
  70. /* Extended mode registers and their offsets */
  71. #define EXT_CTRL_REG 0x0018
  72. #define MII_MDIO_MASK (1 << 4)
  73. #define MII_MDIO_10_11_VAL 0
  74. #define MII_MDIO_81_VAL (1 << 4)
  75. #define EMI_FSMC_DYNAMIC_MUX_MASK (1 << 5)
  76. #define MAC_MODE_MII 0
  77. #define MAC_MODE_RMII 1
  78. #define MAC_MODE_SMII 2
  79. #define MAC_MODE_SS_SMII 3
  80. #define MAC_MODE_MASK 0x3
  81. #define MAC1_MODE_SHIFT 16
  82. #define MAC2_MODE_SHIFT 18
  83. #define IP_SEL_PAD_0_9_REG 0x00A4
  84. #define PMX_PL_0_1_MASK (0x3F << 0)
  85. #define PMX_UART2_PL_0_1_VAL 0x0
  86. #define PMX_I2C2_PL_0_1_VAL (0x4 | (0x4 << 3))
  87. #define PMX_PL_2_3_MASK (0x3F << 6)
  88. #define PMX_I2C2_PL_2_3_VAL 0x0
  89. #define PMX_UART6_PL_2_3_VAL ((0x1 << 6) | (0x1 << 9))
  90. #define PMX_UART1_ENH_PL_2_3_VAL ((0x4 << 6) | (0x4 << 9))
  91. #define PMX_PL_4_5_MASK (0x3F << 12)
  92. #define PMX_UART5_PL_4_5_VAL ((0x1 << 12) | (0x1 << 15))
  93. #define PMX_UART1_ENH_PL_4_5_VAL ((0x4 << 12) | (0x4 << 15))
  94. #define PMX_PL_5_MASK (0x7 << 15)
  95. #define PMX_TOUCH_Y_PL_5_VAL 0x0
  96. #define PMX_PL_6_7_MASK (0x3F << 18)
  97. #define PMX_PL_6_MASK (0x7 << 18)
  98. #define PMX_PL_7_MASK (0x7 << 21)
  99. #define PMX_UART4_PL_6_7_VAL ((0x1 << 18) | (0x1 << 21))
  100. #define PMX_PWM_3_PL_6_VAL (0x2 << 18)
  101. #define PMX_PWM_2_PL_7_VAL (0x2 << 21)
  102. #define PMX_UART1_ENH_PL_6_7_VAL ((0x4 << 18) | (0x4 << 21))
  103. #define PMX_PL_8_9_MASK (0x3F << 24)
  104. #define PMX_UART3_PL_8_9_VAL ((0x1 << 24) | (0x1 << 27))
  105. #define PMX_PWM_0_1_PL_8_9_VAL ((0x2 << 24) | (0x2 << 27))
  106. #define PMX_I2C1_PL_8_9_VAL ((0x4 << 24) | (0x4 << 27))
  107. #define IP_SEL_PAD_10_19_REG 0x00A8
  108. #define PMX_PL_10_11_MASK (0x3F << 0)
  109. #define PMX_SMII_PL_10_11_VAL 0
  110. #define PMX_RMII_PL_10_11_VAL ((0x4 << 0) | (0x4 << 3))
  111. #define PMX_PL_12_MASK (0x7 << 6)
  112. #define PMX_PWM3_PL_12_VAL 0
  113. #define PMX_SDHCI_CD_PL_12_VAL (0x4 << 6)
  114. #define PMX_PL_13_14_MASK (0x3F << 9)
  115. #define PMX_PL_13_MASK (0x7 << 9)
  116. #define PMX_PL_14_MASK (0x7 << 12)
  117. #define PMX_SSP2_PL_13_14_15_16_VAL 0
  118. #define PMX_UART4_PL_13_14_VAL ((0x1 << 9) | (0x1 << 12))
  119. #define PMX_RMII_PL_13_14_VAL ((0x4 << 9) | (0x4 << 12))
  120. #define PMX_PWM2_PL_13_VAL (0x2 << 9)
  121. #define PMX_PWM1_PL_14_VAL (0x2 << 12)
  122. #define PMX_PL_15_MASK (0x7 << 15)
  123. #define PMX_PWM0_PL_15_VAL (0x2 << 15)
  124. #define PMX_PL_15_16_MASK (0x3F << 15)
  125. #define PMX_UART3_PL_15_16_VAL ((0x1 << 15) | (0x1 << 18))
  126. #define PMX_RMII_PL_15_16_VAL ((0x4 << 15) | (0x4 << 18))
  127. #define PMX_PL_17_18_MASK (0x3F << 21)
  128. #define PMX_SSP1_PL_17_18_19_20_VAL 0
  129. #define PMX_RMII_PL_17_18_VAL ((0x4 << 21) | (0x4 << 24))
  130. #define PMX_PL_19_MASK (0x7 << 27)
  131. #define PMX_I2C2_PL_19_VAL (0x1 << 27)
  132. #define PMX_RMII_PL_19_VAL (0x4 << 27)
  133. #define IP_SEL_PAD_20_29_REG 0x00AC
  134. #define PMX_PL_20_MASK (0x7 << 0)
  135. #define PMX_I2C2_PL_20_VAL (0x1 << 0)
  136. #define PMX_RMII_PL_20_VAL (0x4 << 0)
  137. #define PMX_PL_21_TO_27_MASK (0x1FFFFF << 3)
  138. #define PMX_SMII_PL_21_TO_27_VAL 0
  139. #define PMX_RMII_PL_21_TO_27_VAL ((0x4 << 3) | (0x4 << 6) | (0x4 << 9) | (0x4 << 12) | (0x4 << 15) | (0x4 << 18) | (0x4 << 21))
  140. #define PMX_PL_28_29_MASK (0x3F << 24)
  141. #define PMX_PL_28_MASK (0x7 << 24)
  142. #define PMX_PL_29_MASK (0x7 << 27)
  143. #define PMX_UART1_PL_28_29_VAL 0
  144. #define PMX_PWM_3_PL_28_VAL (0x4 << 24)
  145. #define PMX_PWM_2_PL_29_VAL (0x4 << 27)
  146. #define IP_SEL_PAD_30_39_REG 0x00B0
  147. #define PMX_PL_30_31_MASK (0x3F << 0)
  148. #define PMX_CAN1_PL_30_31_VAL (0)
  149. #define PMX_PL_30_MASK (0x7 << 0)
  150. #define PMX_PL_31_MASK (0x7 << 3)
  151. #define PMX_PWM1_EXT_PL_30_VAL (0x4 << 0)
  152. #define PMX_PWM0_EXT_PL_31_VAL (0x4 << 3)
  153. #define PMX_UART1_ENH_PL_31_VAL (0x3 << 3)
  154. #define PMX_PL_32_33_MASK (0x3F << 6)
  155. #define PMX_CAN0_PL_32_33_VAL 0
  156. #define PMX_UART1_ENH_PL_32_33_VAL ((0x3 << 6) | (0x3 << 9))
  157. #define PMX_SSP2_PL_32_33_VAL ((0x4 << 6) | (0x4 << 9))
  158. #define PMX_PL_34_MASK (0x7 << 12)
  159. #define PMX_PWM2_PL_34_VAL 0
  160. #define PMX_UART1_ENH_PL_34_VAL (0x2 << 12)
  161. #define PMX_SSP2_PL_34_VAL (0x4 << 12)
  162. #define PMX_PL_35_MASK (0x7 << 15)
  163. #define PMX_I2S_REF_CLK_PL_35_VAL 0
  164. #define PMX_UART1_ENH_PL_35_VAL (0x2 << 15)
  165. #define PMX_SSP2_PL_35_VAL (0x4 << 15)
  166. #define PMX_PL_36_MASK (0x7 << 18)
  167. #define PMX_TOUCH_X_PL_36_VAL 0
  168. #define PMX_UART1_ENH_PL_36_VAL (0x2 << 18)
  169. #define PMX_SSP1_PL_36_VAL (0x4 << 18)
  170. #define PMX_PL_37_38_MASK (0x3F << 21)
  171. #define PMX_PWM0_1_PL_37_38_VAL 0
  172. #define PMX_UART5_PL_37_38_VAL ((0x2 << 21) | (0x2 << 24))
  173. #define PMX_SSP1_PL_37_38_VAL ((0x4 << 21) | (0x4 << 24))
  174. #define PMX_PL_39_MASK (0x7 << 27)
  175. #define PMX_I2S_PL_39_VAL 0
  176. #define PMX_UART4_PL_39_VAL (0x2 << 27)
  177. #define PMX_SSP1_PL_39_VAL (0x4 << 27)
  178. #define IP_SEL_PAD_40_49_REG 0x00B4
  179. #define PMX_PL_40_MASK (0x7 << 0)
  180. #define PMX_I2S_PL_40_VAL 0
  181. #define PMX_UART4_PL_40_VAL (0x2 << 0)
  182. #define PMX_PWM3_PL_40_VAL (0x4 << 0)
  183. #define PMX_PL_41_42_MASK (0x3F << 3)
  184. #define PMX_PL_41_MASK (0x7 << 3)
  185. #define PMX_PL_42_MASK (0x7 << 6)
  186. #define PMX_I2S_PL_41_42_VAL 0
  187. #define PMX_UART3_PL_41_42_VAL ((0x2 << 3) | (0x2 << 6))
  188. #define PMX_PWM2_PL_41_VAL (0x4 << 3)
  189. #define PMX_PWM1_PL_42_VAL (0x4 << 6)
  190. #define PMX_PL_43_MASK (0x7 << 9)
  191. #define PMX_SDHCI_PL_43_VAL 0
  192. #define PMX_UART1_ENH_PL_43_VAL (0x2 << 9)
  193. #define PMX_PWM0_PL_43_VAL (0x4 << 9)
  194. #define PMX_PL_44_45_MASK (0x3F << 12)
  195. #define PMX_SDHCI_PL_44_45_VAL 0
  196. #define PMX_UART1_ENH_PL_44_45_VAL ((0x2 << 12) | (0x2 << 15))
  197. #define PMX_SSP2_PL_44_45_VAL ((0x4 << 12) | (0x4 << 15))
  198. #define PMX_PL_46_47_MASK (0x3F << 18)
  199. #define PMX_SDHCI_PL_46_47_VAL 0
  200. #define PMX_FSMC_EMI_PL_46_47_VAL ((0x2 << 18) | (0x2 << 21))
  201. #define PMX_SSP2_PL_46_47_VAL ((0x4 << 18) | (0x4 << 21))
  202. #define PMX_PL_48_49_MASK (0x3F << 24)
  203. #define PMX_SDHCI_PL_48_49_VAL 0
  204. #define PMX_FSMC_EMI_PL_48_49_VAL ((0x2 << 24) | (0x2 << 27))
  205. #define PMX_SSP1_PL_48_49_VAL ((0x4 << 24) | (0x4 << 27))
  206. #define IP_SEL_PAD_50_59_REG 0x00B8
  207. #define PMX_PL_50_51_MASK (0x3F << 0)
  208. #define PMX_EMI_PL_50_51_VAL ((0x2 << 0) | (0x2 << 3))
  209. #define PMX_SSP1_PL_50_51_VAL ((0x4 << 0) | (0x4 << 3))
  210. #define PMX_PL_50_MASK (0x7 << 0)
  211. #define PMX_PL_51_MASK (0x7 << 3)
  212. #define PMX_SDHCI_PL_50_VAL 0
  213. #define PMX_SDHCI_CD_PL_51_VAL 0
  214. #define PMX_PL_52_53_MASK (0x3F << 6)
  215. #define PMX_FSMC_PL_52_53_VAL 0
  216. #define PMX_EMI_PL_52_53_VAL ((0x2 << 6) | (0x2 << 9))
  217. #define PMX_UART3_PL_52_53_VAL ((0x4 << 6) | (0x4 << 9))
  218. #define PMX_PL_54_55_56_MASK (0x1FF << 12)
  219. #define PMX_FSMC_EMI_PL_54_55_56_VAL ((0x2 << 12) | (0x2 << 15) | (0x2 << 18))
  220. #define PMX_PL_57_MASK (0x7 << 21)
  221. #define PMX_FSMC_PL_57_VAL 0
  222. #define PMX_PWM3_PL_57_VAL (0x4 << 21)
  223. #define PMX_PL_58_59_MASK (0x3F << 24)
  224. #define PMX_PL_58_MASK (0x7 << 24)
  225. #define PMX_PL_59_MASK (0x7 << 27)
  226. #define PMX_FSMC_EMI_PL_58_59_VAL ((0x2 << 24) | (0x2 << 27))
  227. #define PMX_PWM2_PL_58_VAL (0x4 << 24)
  228. #define PMX_PWM1_PL_59_VAL (0x4 << 27)
  229. #define IP_SEL_PAD_60_69_REG 0x00BC
  230. #define PMX_PL_60_MASK (0x7 << 0)
  231. #define PMX_FSMC_PL_60_VAL 0
  232. #define PMX_PWM0_PL_60_VAL (0x4 << 0)
  233. #define PMX_PL_61_TO_64_MASK (0xFFF << 3)
  234. #define PMX_FSMC_PL_61_TO_64_VAL ((0x2 << 3) | (0x2 << 6) | (0x2 << 9) | (0x2 << 12))
  235. #define PMX_SSP2_PL_61_TO_64_VAL ((0x4 << 3) | (0x4 << 6) | (0x4 << 9) | (0x4 << 12))
  236. #define PMX_PL_65_TO_68_MASK (0xFFF << 15)
  237. #define PMX_FSMC_PL_65_TO_68_VAL ((0x2 << 15) | (0x2 << 18) | (0x2 << 21) | (0x2 << 24))
  238. #define PMX_SSP1_PL_65_TO_68_VAL ((0x4 << 15) | (0x4 << 18) | (0x4 << 21) | (0x4 << 24))
  239. #define PMX_PL_69_MASK (0x7 << 27)
  240. #define PMX_CLCD_PL_69_VAL (0)
  241. #define PMX_EMI_PL_69_VAL (0x2 << 27)
  242. #define PMX_SPP_PL_69_VAL (0x3 << 27)
  243. #define PMX_UART5_PL_69_VAL (0x4 << 27)
  244. #define IP_SEL_PAD_70_79_REG 0x00C0
  245. #define PMX_PL_70_MASK (0x7 << 0)
  246. #define PMX_CLCD_PL_70_VAL (0)
  247. #define PMX_FSMC_EMI_PL_70_VAL (0x2 << 0)
  248. #define PMX_SPP_PL_70_VAL (0x3 << 0)
  249. #define PMX_UART5_PL_70_VAL (0x4 << 0)
  250. #define PMX_PL_71_72_MASK (0x3F << 3)
  251. #define PMX_CLCD_PL_71_72_VAL (0)
  252. #define PMX_FSMC_EMI_PL_71_72_VAL ((0x2 << 3) | (0x2 << 6))
  253. #define PMX_SPP_PL_71_72_VAL ((0x3 << 3) | (0x3 << 6))
  254. #define PMX_UART4_PL_71_72_VAL ((0x4 << 3) | (0x4 << 6))
  255. #define PMX_PL_73_MASK (0x7 << 9)
  256. #define PMX_CLCD_PL_73_VAL (0)
  257. #define PMX_FSMC_EMI_PL_73_VAL (0x2 << 9)
  258. #define PMX_SPP_PL_73_VAL (0x3 << 9)
  259. #define PMX_UART3_PL_73_VAL (0x4 << 9)
  260. #define PMX_PL_74_MASK (0x7 << 12)
  261. #define PMX_CLCD_PL_74_VAL (0)
  262. #define PMX_EMI_PL_74_VAL (0x2 << 12)
  263. #define PMX_SPP_PL_74_VAL (0x3 << 12)
  264. #define PMX_UART3_PL_74_VAL (0x4 << 12)
  265. #define PMX_PL_75_76_MASK (0x3F << 15)
  266. #define PMX_CLCD_PL_75_76_VAL (0)
  267. #define PMX_EMI_PL_75_76_VAL ((0x2 << 15) | (0x2 << 18))
  268. #define PMX_SPP_PL_75_76_VAL ((0x3 << 15) | (0x3 << 18))
  269. #define PMX_I2C2_PL_75_76_VAL ((0x4 << 15) | (0x4 << 18))
  270. #define PMX_PL_77_78_79_MASK (0x1FF << 21)
  271. #define PMX_CLCD_PL_77_78_79_VAL (0)
  272. #define PMX_EMI_PL_77_78_79_VAL ((0x2 << 21) | (0x2 << 24) | (0x2 << 27))
  273. #define PMX_SPP_PL_77_78_79_VAL ((0x3 << 21) | (0x3 << 24) | (0x3 << 27))
  274. #define PMX_RS485_PL_77_78_79_VAL ((0x4 << 21) | (0x4 << 24) | (0x4 << 27))
  275. #define IP_SEL_PAD_80_89_REG 0x00C4
  276. #define PMX_PL_80_TO_85_MASK (0x3FFFF << 0)
  277. #define PMX_CLCD_PL_80_TO_85_VAL 0
  278. #define PMX_MII2_PL_80_TO_85_VAL ((0x1 << 0) | (0x1 << 3) | (0x1 << 6) | (0x1 << 9) | (0x1 << 12) | (0x1 << 15))
  279. #define PMX_EMI_PL_80_TO_85_VAL ((0x2 << 0) | (0x2 << 3) | (0x2 << 6) | (0x2 << 9) | (0x2 << 12) | (0x2 << 15))
  280. #define PMX_SPP_PL_80_TO_85_VAL ((0x3 << 0) | (0x3 << 3) | (0x3 << 6) | (0x3 << 9) | (0x3 << 12) | (0x3 << 15))
  281. #define PMX_UART1_ENH_PL_80_TO_85_VAL ((0x4 << 0) | (0x4 << 3) | (0x4 << 6) | (0x4 << 9) | (0x4 << 12) | (0x4 << 15))
  282. #define PMX_PL_86_87_MASK (0x3F << 18)
  283. #define PMX_PL_86_MASK (0x7 << 18)
  284. #define PMX_PL_87_MASK (0x7 << 21)
  285. #define PMX_CLCD_PL_86_87_VAL 0
  286. #define PMX_MII2_PL_86_87_VAL ((0x1 << 18) | (0x1 << 21))
  287. #define PMX_EMI_PL_86_87_VAL ((0x2 << 18) | (0x2 << 21))
  288. #define PMX_PWM3_PL_86_VAL (0x4 << 18)
  289. #define PMX_PWM2_PL_87_VAL (0x4 << 21)
  290. #define PMX_PL_88_89_MASK (0x3F << 24)
  291. #define PMX_CLCD_PL_88_89_VAL 0
  292. #define PMX_MII2_PL_88_89_VAL ((0x1 << 24) | (0x1 << 27))
  293. #define PMX_EMI_PL_88_89_VAL ((0x2 << 24) | (0x2 << 27))
  294. #define PMX_UART6_PL_88_89_VAL ((0x3 << 24) | (0x3 << 27))
  295. #define PMX_PWM0_1_PL_88_89_VAL ((0x4 << 24) | (0x4 << 27))
  296. #define IP_SEL_PAD_90_99_REG 0x00C8
  297. #define PMX_PL_90_91_MASK (0x3F << 0)
  298. #define PMX_CLCD_PL_90_91_VAL 0
  299. #define PMX_MII2_PL_90_91_VAL ((0x1 << 0) | (0x1 << 3))
  300. #define PMX_EMI1_PL_90_91_VAL ((0x2 << 0) | (0x2 << 3))
  301. #define PMX_UART5_PL_90_91_VAL ((0x3 << 0) | (0x3 << 3))
  302. #define PMX_SSP2_PL_90_91_VAL ((0x4 << 0) | (0x4 << 3))
  303. #define PMX_PL_92_93_MASK (0x3F << 6)
  304. #define PMX_CLCD_PL_92_93_VAL 0
  305. #define PMX_MII2_PL_92_93_VAL ((0x1 << 6) | (0x1 << 9))
  306. #define PMX_EMI1_PL_92_93_VAL ((0x2 << 6) | (0x2 << 9))
  307. #define PMX_UART4_PL_92_93_VAL ((0x3 << 6) | (0x3 << 9))
  308. #define PMX_SSP2_PL_92_93_VAL ((0x4 << 6) | (0x4 << 9))
  309. #define PMX_PL_94_95_MASK (0x3F << 12)
  310. #define PMX_CLCD_PL_94_95_VAL 0
  311. #define PMX_MII2_PL_94_95_VAL ((0x1 << 12) | (0x1 << 15))
  312. #define PMX_EMI1_PL_94_95_VAL ((0x2 << 12) | (0x2 << 15))
  313. #define PMX_UART3_PL_94_95_VAL ((0x3 << 12) | (0x3 << 15))
  314. #define PMX_SSP1_PL_94_95_VAL ((0x4 << 12) | (0x4 << 15))
  315. #define PMX_PL_96_97_MASK (0x3F << 18)
  316. #define PMX_CLCD_PL_96_97_VAL 0
  317. #define PMX_MII2_PL_96_97_VAL ((0x1 << 18) | (0x1 << 21))
  318. #define PMX_EMI1_PL_96_97_VAL ((0x2 << 18) | (0x2 << 21))
  319. #define PMX_I2C2_PL_96_97_VAL ((0x3 << 18) | (0x3 << 21))
  320. #define PMX_SSP1_PL_96_97_VAL ((0x4 << 18) | (0x4 << 21))
  321. #define PMX_PL_98_MASK (0x7 << 24)
  322. #define PMX_CLCD_PL_98_VAL 0
  323. #define PMX_I2C1_PL_98_VAL (0x2 << 24)
  324. #define PMX_UART3_PL_98_VAL (0x4 << 24)
  325. #define PMX_PL_99_MASK (0x7 << 27)
  326. #define PMX_SDHCI_PL_99_VAL 0
  327. #define PMX_I2C1_PL_99_VAL (0x2 << 27)
  328. #define PMX_UART3_PL_99_VAL (0x4 << 27)
  329. #define IP_SEL_MIX_PAD_REG 0x00CC
  330. #define PMX_PL_100_101_MASK (0x3F << 0)
  331. #define PMX_SDHCI_PL_100_101_VAL 0
  332. #define PMX_UART4_PL_100_101_VAL ((0x4 << 0) | (0x4 << 3))
  333. #define PMX_SSP1_PORT_SEL_MASK (0x7 << 8)
  334. #define PMX_SSP1_PORT_94_TO_97_VAL 0
  335. #define PMX_SSP1_PORT_65_TO_68_VAL (0x1 << 8)
  336. #define PMX_SSP1_PORT_48_TO_51_VAL (0x2 << 8)
  337. #define PMX_SSP1_PORT_36_TO_39_VAL (0x3 << 8)
  338. #define PMX_SSP1_PORT_17_TO_20_VAL (0x4 << 8)
  339. #define PMX_SSP2_PORT_SEL_MASK (0x7 << 11)
  340. #define PMX_SSP2_PORT_90_TO_93_VAL 0
  341. #define PMX_SSP2_PORT_61_TO_64_VAL (0x1 << 11)
  342. #define PMX_SSP2_PORT_44_TO_47_VAL (0x2 << 11)
  343. #define PMX_SSP2_PORT_32_TO_35_VAL (0x3 << 11)
  344. #define PMX_SSP2_PORT_13_TO_16_VAL (0x4 << 11)
  345. #define PMX_UART1_ENH_PORT_SEL_MASK (0x3 << 14)
  346. #define PMX_UART1_ENH_PORT_81_TO_85_VAL 0
  347. #define PMX_UART1_ENH_PORT_44_45_34_36_VAL (0x1 << 14)
  348. #define PMX_UART1_ENH_PORT_32_TO_34_36_VAL (0x2 << 14)
  349. #define PMX_UART1_ENH_PORT_3_TO_5_7_VAL (0x3 << 14)
  350. #define PMX_UART3_PORT_SEL_MASK (0x7 << 16)
  351. #define PMX_UART3_PORT_94_VAL 0
  352. #define PMX_UART3_PORT_73_VAL (0x1 << 16)
  353. #define PMX_UART3_PORT_52_VAL (0x2 << 16)
  354. #define PMX_UART3_PORT_41_VAL (0x3 << 16)
  355. #define PMX_UART3_PORT_15_VAL (0x4 << 16)
  356. #define PMX_UART3_PORT_8_VAL (0x5 << 16)
  357. #define PMX_UART3_PORT_99_VAL (0x6 << 16)
  358. #define PMX_UART4_PORT_SEL_MASK (0x7 << 19)
  359. #define PMX_UART4_PORT_92_VAL 0
  360. #define PMX_UART4_PORT_71_VAL (0x1 << 19)
  361. #define PMX_UART4_PORT_39_VAL (0x2 << 19)
  362. #define PMX_UART4_PORT_13_VAL (0x3 << 19)
  363. #define PMX_UART4_PORT_6_VAL (0x4 << 19)
  364. #define PMX_UART4_PORT_101_VAL (0x5 << 19)
  365. #define PMX_UART5_PORT_SEL_MASK (0x3 << 22)
  366. #define PMX_UART5_PORT_90_VAL 0
  367. #define PMX_UART5_PORT_69_VAL (0x1 << 22)
  368. #define PMX_UART5_PORT_37_VAL (0x2 << 22)
  369. #define PMX_UART5_PORT_4_VAL (0x3 << 22)
  370. #define PMX_UART6_PORT_SEL_MASK (0x1 << 24)
  371. #define PMX_UART6_PORT_88_VAL 0
  372. #define PMX_UART6_PORT_2_VAL (0x1 << 24)
  373. #define PMX_I2C1_PORT_SEL_MASK (0x1 << 25)
  374. #define PMX_I2C1_PORT_8_9_VAL 0
  375. #define PMX_I2C1_PORT_98_99_VAL (0x1 << 25)
  376. #define PMX_I2C2_PORT_SEL_MASK (0x3 << 26)
  377. #define PMX_I2C2_PORT_96_97_VAL 0
  378. #define PMX_I2C2_PORT_75_76_VAL (0x1 << 26)
  379. #define PMX_I2C2_PORT_19_20_VAL (0x2 << 26)
  380. #define PMX_I2C2_PORT_2_3_VAL (0x3 << 26)
  381. #define PMX_I2C2_PORT_0_1_VAL (0x4 << 26)
  382. #define PMX_SDHCI_CD_PORT_SEL_MASK (0x1 << 29)
  383. #define PMX_SDHCI_CD_PORT_12_VAL 0
  384. #define PMX_SDHCI_CD_PORT_51_VAL (0x1 << 29)
  385. /* Pad multiplexing for CLCD device */
  386. static const unsigned clcd_pins[] = { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
  387. 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  388. 97 };
  389. static struct spear_muxreg clcd_muxreg[] = {
  390. {
  391. .reg = IP_SEL_PAD_60_69_REG,
  392. .mask = PMX_PL_69_MASK,
  393. .val = PMX_CLCD_PL_69_VAL,
  394. }, {
  395. .reg = IP_SEL_PAD_70_79_REG,
  396. .mask = PMX_PL_70_MASK | PMX_PL_71_72_MASK | PMX_PL_73_MASK |
  397. PMX_PL_74_MASK | PMX_PL_75_76_MASK |
  398. PMX_PL_77_78_79_MASK,
  399. .val = PMX_CLCD_PL_70_VAL | PMX_CLCD_PL_71_72_VAL |
  400. PMX_CLCD_PL_73_VAL | PMX_CLCD_PL_74_VAL |
  401. PMX_CLCD_PL_75_76_VAL | PMX_CLCD_PL_77_78_79_VAL,
  402. }, {
  403. .reg = IP_SEL_PAD_80_89_REG,
  404. .mask = PMX_PL_80_TO_85_MASK | PMX_PL_86_87_MASK |
  405. PMX_PL_88_89_MASK,
  406. .val = PMX_CLCD_PL_80_TO_85_VAL | PMX_CLCD_PL_86_87_VAL |
  407. PMX_CLCD_PL_88_89_VAL,
  408. }, {
  409. .reg = IP_SEL_PAD_90_99_REG,
  410. .mask = PMX_PL_90_91_MASK | PMX_PL_92_93_MASK |
  411. PMX_PL_94_95_MASK | PMX_PL_96_97_MASK | PMX_PL_98_MASK,
  412. .val = PMX_CLCD_PL_90_91_VAL | PMX_CLCD_PL_92_93_VAL |
  413. PMX_CLCD_PL_94_95_VAL | PMX_CLCD_PL_96_97_VAL |
  414. PMX_CLCD_PL_98_VAL,
  415. },
  416. };
  417. static struct spear_modemux clcd_modemux[] = {
  418. {
  419. .modes = EXTENDED_MODE,
  420. .muxregs = clcd_muxreg,
  421. .nmuxregs = ARRAY_SIZE(clcd_muxreg),
  422. },
  423. };
  424. static struct spear_pingroup clcd_pingroup = {
  425. .name = "clcd_grp",
  426. .pins = clcd_pins,
  427. .npins = ARRAY_SIZE(clcd_pins),
  428. .modemuxs = clcd_modemux,
  429. .nmodemuxs = ARRAY_SIZE(clcd_modemux),
  430. };
  431. static const char *const clcd_grps[] = { "clcd_grp" };
  432. static struct spear_function clcd_function = {
  433. .name = "clcd",
  434. .groups = clcd_grps,
  435. .ngroups = ARRAY_SIZE(clcd_grps),
  436. };
  437. /* Pad multiplexing for EMI (Parallel NOR flash) device */
  438. static const unsigned emi_pins[] = { 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
  439. 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
  440. 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
  441. 93, 94, 95, 96, 97 };
  442. static struct spear_muxreg emi_muxreg[] = {
  443. {
  444. .reg = PMX_CONFIG_REG,
  445. .mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK,
  446. .val = 0,
  447. },
  448. };
  449. static struct spear_muxreg emi_ext_muxreg[] = {
  450. {
  451. .reg = IP_SEL_PAD_40_49_REG,
  452. .mask = PMX_PL_46_47_MASK | PMX_PL_48_49_MASK,
  453. .val = PMX_FSMC_EMI_PL_46_47_VAL | PMX_FSMC_EMI_PL_48_49_VAL,
  454. }, {
  455. .reg = IP_SEL_PAD_50_59_REG,
  456. .mask = PMX_PL_50_51_MASK | PMX_PL_52_53_MASK |
  457. PMX_PL_54_55_56_MASK | PMX_PL_58_59_MASK,
  458. .val = PMX_EMI_PL_50_51_VAL | PMX_EMI_PL_52_53_VAL |
  459. PMX_FSMC_EMI_PL_54_55_56_VAL |
  460. PMX_FSMC_EMI_PL_58_59_VAL,
  461. }, {
  462. .reg = IP_SEL_PAD_60_69_REG,
  463. .mask = PMX_PL_69_MASK,
  464. .val = PMX_EMI_PL_69_VAL,
  465. }, {
  466. .reg = IP_SEL_PAD_70_79_REG,
  467. .mask = PMX_PL_70_MASK | PMX_PL_71_72_MASK | PMX_PL_73_MASK |
  468. PMX_PL_74_MASK | PMX_PL_75_76_MASK |
  469. PMX_PL_77_78_79_MASK,
  470. .val = PMX_FSMC_EMI_PL_70_VAL | PMX_FSMC_EMI_PL_71_72_VAL |
  471. PMX_FSMC_EMI_PL_73_VAL | PMX_EMI_PL_74_VAL |
  472. PMX_EMI_PL_75_76_VAL | PMX_EMI_PL_77_78_79_VAL,
  473. }, {
  474. .reg = IP_SEL_PAD_80_89_REG,
  475. .mask = PMX_PL_80_TO_85_MASK | PMX_PL_86_87_MASK |
  476. PMX_PL_88_89_MASK,
  477. .val = PMX_EMI_PL_80_TO_85_VAL | PMX_EMI_PL_86_87_VAL |
  478. PMX_EMI_PL_88_89_VAL,
  479. }, {
  480. .reg = IP_SEL_PAD_90_99_REG,
  481. .mask = PMX_PL_90_91_MASK | PMX_PL_92_93_MASK |
  482. PMX_PL_94_95_MASK | PMX_PL_96_97_MASK,
  483. .val = PMX_EMI1_PL_90_91_VAL | PMX_EMI1_PL_92_93_VAL |
  484. PMX_EMI1_PL_94_95_VAL | PMX_EMI1_PL_96_97_VAL,
  485. }, {
  486. .reg = EXT_CTRL_REG,
  487. .mask = EMI_FSMC_DYNAMIC_MUX_MASK,
  488. .val = EMI_FSMC_DYNAMIC_MUX_MASK,
  489. },
  490. };
  491. static struct spear_modemux emi_modemux[] = {
  492. {
  493. .modes = AUTO_EXP_MODE | EXTENDED_MODE,
  494. .muxregs = emi_muxreg,
  495. .nmuxregs = ARRAY_SIZE(emi_muxreg),
  496. }, {
  497. .modes = EXTENDED_MODE,
  498. .muxregs = emi_ext_muxreg,
  499. .nmuxregs = ARRAY_SIZE(emi_ext_muxreg),
  500. },
  501. };
  502. static struct spear_pingroup emi_pingroup = {
  503. .name = "emi_grp",
  504. .pins = emi_pins,
  505. .npins = ARRAY_SIZE(emi_pins),
  506. .modemuxs = emi_modemux,
  507. .nmodemuxs = ARRAY_SIZE(emi_modemux),
  508. };
  509. static const char *const emi_grps[] = { "emi_grp" };
  510. static struct spear_function emi_function = {
  511. .name = "emi",
  512. .groups = emi_grps,
  513. .ngroups = ARRAY_SIZE(emi_grps),
  514. };
  515. /* Pad multiplexing for FSMC (NAND flash) device */
  516. static const unsigned fsmc_8bit_pins[] = { 52, 53, 54, 55, 56, 57, 58, 59, 60,
  517. 61, 62, 63, 64, 65, 66, 67, 68 };
  518. static struct spear_muxreg fsmc_8bit_muxreg[] = {
  519. {
  520. .reg = IP_SEL_PAD_50_59_REG,
  521. .mask = PMX_PL_52_53_MASK | PMX_PL_54_55_56_MASK |
  522. PMX_PL_57_MASK | PMX_PL_58_59_MASK,
  523. .val = PMX_FSMC_PL_52_53_VAL | PMX_FSMC_EMI_PL_54_55_56_VAL |
  524. PMX_FSMC_PL_57_VAL | PMX_FSMC_EMI_PL_58_59_VAL,
  525. }, {
  526. .reg = IP_SEL_PAD_60_69_REG,
  527. .mask = PMX_PL_60_MASK | PMX_PL_61_TO_64_MASK |
  528. PMX_PL_65_TO_68_MASK,
  529. .val = PMX_FSMC_PL_60_VAL | PMX_FSMC_PL_61_TO_64_VAL |
  530. PMX_FSMC_PL_65_TO_68_VAL,
  531. }, {
  532. .reg = EXT_CTRL_REG,
  533. .mask = EMI_FSMC_DYNAMIC_MUX_MASK,
  534. .val = EMI_FSMC_DYNAMIC_MUX_MASK,
  535. },
  536. };
  537. static struct spear_modemux fsmc_8bit_modemux[] = {
  538. {
  539. .modes = EXTENDED_MODE,
  540. .muxregs = fsmc_8bit_muxreg,
  541. .nmuxregs = ARRAY_SIZE(fsmc_8bit_muxreg),
  542. },
  543. };
  544. static struct spear_pingroup fsmc_8bit_pingroup = {
  545. .name = "fsmc_8bit_grp",
  546. .pins = fsmc_8bit_pins,
  547. .npins = ARRAY_SIZE(fsmc_8bit_pins),
  548. .modemuxs = fsmc_8bit_modemux,
  549. .nmodemuxs = ARRAY_SIZE(fsmc_8bit_modemux),
  550. };
  551. static const unsigned fsmc_16bit_pins[] = { 46, 47, 48, 49, 52, 53, 54, 55, 56,
  552. 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73 };
  553. static struct spear_muxreg fsmc_16bit_autoexp_muxreg[] = {
  554. {
  555. .reg = PMX_CONFIG_REG,
  556. .mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK,
  557. .val = 0,
  558. },
  559. };
  560. static struct spear_muxreg fsmc_16bit_muxreg[] = {
  561. {
  562. .reg = IP_SEL_PAD_40_49_REG,
  563. .mask = PMX_PL_46_47_MASK | PMX_PL_48_49_MASK,
  564. .val = PMX_FSMC_EMI_PL_46_47_VAL | PMX_FSMC_EMI_PL_48_49_VAL,
  565. }, {
  566. .reg = IP_SEL_PAD_70_79_REG,
  567. .mask = PMX_PL_70_MASK | PMX_PL_71_72_MASK | PMX_PL_73_MASK,
  568. .val = PMX_FSMC_EMI_PL_70_VAL | PMX_FSMC_EMI_PL_71_72_VAL |
  569. PMX_FSMC_EMI_PL_73_VAL,
  570. }
  571. };
  572. static struct spear_modemux fsmc_16bit_modemux[] = {
  573. {
  574. .modes = EXTENDED_MODE,
  575. .muxregs = fsmc_8bit_muxreg,
  576. .nmuxregs = ARRAY_SIZE(fsmc_8bit_muxreg),
  577. }, {
  578. .modes = AUTO_EXP_MODE | EXTENDED_MODE,
  579. .muxregs = fsmc_16bit_autoexp_muxreg,
  580. .nmuxregs = ARRAY_SIZE(fsmc_16bit_autoexp_muxreg),
  581. }, {
  582. .modes = EXTENDED_MODE,
  583. .muxregs = fsmc_16bit_muxreg,
  584. .nmuxregs = ARRAY_SIZE(fsmc_16bit_muxreg),
  585. },
  586. };
  587. static struct spear_pingroup fsmc_16bit_pingroup = {
  588. .name = "fsmc_16bit_grp",
  589. .pins = fsmc_16bit_pins,
  590. .npins = ARRAY_SIZE(fsmc_16bit_pins),
  591. .modemuxs = fsmc_16bit_modemux,
  592. .nmodemuxs = ARRAY_SIZE(fsmc_16bit_modemux),
  593. };
  594. static const char *const fsmc_grps[] = { "fsmc_8bit_grp", "fsmc_16bit_grp" };
  595. static struct spear_function fsmc_function = {
  596. .name = "fsmc",
  597. .groups = fsmc_grps,
  598. .ngroups = ARRAY_SIZE(fsmc_grps),
  599. };
  600. /* Pad multiplexing for SPP device */
  601. static const unsigned spp_pins[] = { 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
  602. 80, 81, 82, 83, 84, 85 };
  603. static struct spear_muxreg spp_muxreg[] = {
  604. {
  605. .reg = IP_SEL_PAD_60_69_REG,
  606. .mask = PMX_PL_69_MASK,
  607. .val = PMX_SPP_PL_69_VAL,
  608. }, {
  609. .reg = IP_SEL_PAD_70_79_REG,
  610. .mask = PMX_PL_70_MASK | PMX_PL_71_72_MASK | PMX_PL_73_MASK |
  611. PMX_PL_74_MASK | PMX_PL_75_76_MASK |
  612. PMX_PL_77_78_79_MASK,
  613. .val = PMX_SPP_PL_70_VAL | PMX_SPP_PL_71_72_VAL |
  614. PMX_SPP_PL_73_VAL | PMX_SPP_PL_74_VAL |
  615. PMX_SPP_PL_75_76_VAL | PMX_SPP_PL_77_78_79_VAL,
  616. }, {
  617. .reg = IP_SEL_PAD_80_89_REG,
  618. .mask = PMX_PL_80_TO_85_MASK,
  619. .val = PMX_SPP_PL_80_TO_85_VAL,
  620. },
  621. };
  622. static struct spear_modemux spp_modemux[] = {
  623. {
  624. .modes = EXTENDED_MODE,
  625. .muxregs = spp_muxreg,
  626. .nmuxregs = ARRAY_SIZE(spp_muxreg),
  627. },
  628. };
  629. static struct spear_pingroup spp_pingroup = {
  630. .name = "spp_grp",
  631. .pins = spp_pins,
  632. .npins = ARRAY_SIZE(spp_pins),
  633. .modemuxs = spp_modemux,
  634. .nmodemuxs = ARRAY_SIZE(spp_modemux),
  635. };
  636. static const char *const spp_grps[] = { "spp_grp" };
  637. static struct spear_function spp_function = {
  638. .name = "spp",
  639. .groups = spp_grps,
  640. .ngroups = ARRAY_SIZE(spp_grps),
  641. };
  642. /* Pad multiplexing for SDHCI device */
  643. static const unsigned sdhci_led_pins[] = { 34 };
  644. static struct spear_muxreg sdhci_led_muxreg[] = {
  645. {
  646. .reg = PMX_CONFIG_REG,
  647. .mask = PMX_SSP_CS_MASK,
  648. .val = 0,
  649. },
  650. };
  651. static struct spear_muxreg sdhci_led_ext_muxreg[] = {
  652. {
  653. .reg = IP_SEL_PAD_30_39_REG,
  654. .mask = PMX_PL_34_MASK,
  655. .val = PMX_PWM2_PL_34_VAL,
  656. },
  657. };
  658. static struct spear_modemux sdhci_led_modemux[] = {
  659. {
  660. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | EXTENDED_MODE,
  661. .muxregs = sdhci_led_muxreg,
  662. .nmuxregs = ARRAY_SIZE(sdhci_led_muxreg),
  663. }, {
  664. .modes = EXTENDED_MODE,
  665. .muxregs = sdhci_led_ext_muxreg,
  666. .nmuxregs = ARRAY_SIZE(sdhci_led_ext_muxreg),
  667. },
  668. };
  669. static struct spear_pingroup sdhci_led_pingroup = {
  670. .name = "sdhci_led_grp",
  671. .pins = sdhci_led_pins,
  672. .npins = ARRAY_SIZE(sdhci_led_pins),
  673. .modemuxs = sdhci_led_modemux,
  674. .nmodemuxs = ARRAY_SIZE(sdhci_led_modemux),
  675. };
  676. static const unsigned sdhci_cd_12_pins[] = { 12, 43, 44, 45, 46, 47, 48, 49,
  677. 50};
  678. static const unsigned sdhci_cd_51_pins[] = { 43, 44, 45, 46, 47, 48, 49, 50, 51
  679. };
  680. static struct spear_muxreg sdhci_muxreg[] = {
  681. {
  682. .reg = PMX_CONFIG_REG,
  683. .mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK,
  684. .val = 0,
  685. },
  686. };
  687. static struct spear_muxreg sdhci_ext_muxreg[] = {
  688. {
  689. .reg = IP_SEL_PAD_40_49_REG,
  690. .mask = PMX_PL_43_MASK | PMX_PL_44_45_MASK | PMX_PL_46_47_MASK |
  691. PMX_PL_48_49_MASK,
  692. .val = PMX_SDHCI_PL_43_VAL | PMX_SDHCI_PL_44_45_VAL |
  693. PMX_SDHCI_PL_46_47_VAL | PMX_SDHCI_PL_48_49_VAL,
  694. }, {
  695. .reg = IP_SEL_PAD_50_59_REG,
  696. .mask = PMX_PL_50_MASK,
  697. .val = PMX_SDHCI_PL_50_VAL,
  698. }, {
  699. .reg = IP_SEL_PAD_90_99_REG,
  700. .mask = PMX_PL_99_MASK,
  701. .val = PMX_SDHCI_PL_99_VAL,
  702. }, {
  703. .reg = IP_SEL_MIX_PAD_REG,
  704. .mask = PMX_PL_100_101_MASK,
  705. .val = PMX_SDHCI_PL_100_101_VAL,
  706. },
  707. };
  708. static struct spear_muxreg sdhci_cd_12_muxreg[] = {
  709. {
  710. .reg = PMX_CONFIG_REG,
  711. .mask = PMX_MII_MASK,
  712. .val = 0,
  713. }, {
  714. .reg = IP_SEL_PAD_10_19_REG,
  715. .mask = PMX_PL_12_MASK,
  716. .val = PMX_SDHCI_CD_PL_12_VAL,
  717. }, {
  718. .reg = IP_SEL_MIX_PAD_REG,
  719. .mask = PMX_SDHCI_CD_PORT_SEL_MASK,
  720. .val = PMX_SDHCI_CD_PORT_12_VAL,
  721. },
  722. };
  723. static struct spear_muxreg sdhci_cd_51_muxreg[] = {
  724. {
  725. .reg = IP_SEL_PAD_50_59_REG,
  726. .mask = PMX_PL_51_MASK,
  727. .val = PMX_SDHCI_CD_PL_51_VAL,
  728. }, {
  729. .reg = IP_SEL_MIX_PAD_REG,
  730. .mask = PMX_SDHCI_CD_PORT_SEL_MASK,
  731. .val = PMX_SDHCI_CD_PORT_51_VAL,
  732. },
  733. };
  734. #define pmx_sdhci_common_modemux \
  735. { \
  736. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | \
  737. SMALL_PRINTERS_MODE | EXTENDED_MODE, \
  738. .muxregs = sdhci_muxreg, \
  739. .nmuxregs = ARRAY_SIZE(sdhci_muxreg), \
  740. }, { \
  741. .modes = EXTENDED_MODE, \
  742. .muxregs = sdhci_ext_muxreg, \
  743. .nmuxregs = ARRAY_SIZE(sdhci_ext_muxreg), \
  744. }
  745. static struct spear_modemux sdhci_modemux[][3] = {
  746. {
  747. /* select pin 12 for cd */
  748. pmx_sdhci_common_modemux,
  749. {
  750. .modes = EXTENDED_MODE,
  751. .muxregs = sdhci_cd_12_muxreg,
  752. .nmuxregs = ARRAY_SIZE(sdhci_cd_12_muxreg),
  753. },
  754. }, {
  755. /* select pin 51 for cd */
  756. pmx_sdhci_common_modemux,
  757. {
  758. .modes = EXTENDED_MODE,
  759. .muxregs = sdhci_cd_51_muxreg,
  760. .nmuxregs = ARRAY_SIZE(sdhci_cd_51_muxreg),
  761. },
  762. }
  763. };
  764. static struct spear_pingroup sdhci_pingroup[] = {
  765. {
  766. .name = "sdhci_cd_12_grp",
  767. .pins = sdhci_cd_12_pins,
  768. .npins = ARRAY_SIZE(sdhci_cd_12_pins),
  769. .modemuxs = sdhci_modemux[0],
  770. .nmodemuxs = ARRAY_SIZE(sdhci_modemux[0]),
  771. }, {
  772. .name = "sdhci_cd_51_grp",
  773. .pins = sdhci_cd_51_pins,
  774. .npins = ARRAY_SIZE(sdhci_cd_51_pins),
  775. .modemuxs = sdhci_modemux[1],
  776. .nmodemuxs = ARRAY_SIZE(sdhci_modemux[1]),
  777. },
  778. };
  779. static const char *const sdhci_grps[] = { "sdhci_cd_12_grp", "sdhci_cd_51_grp",
  780. "sdhci_led_grp" };
  781. static struct spear_function sdhci_function = {
  782. .name = "sdhci",
  783. .groups = sdhci_grps,
  784. .ngroups = ARRAY_SIZE(sdhci_grps),
  785. };
  786. /* Pad multiplexing for I2S device */
  787. static const unsigned i2s_pins[] = { 35, 39, 40, 41, 42 };
  788. static struct spear_muxreg i2s_muxreg[] = {
  789. {
  790. .reg = PMX_CONFIG_REG,
  791. .mask = PMX_SSP_CS_MASK,
  792. .val = 0,
  793. }, {
  794. .reg = PMX_CONFIG_REG,
  795. .mask = PMX_UART0_MODEM_MASK,
  796. .val = 0,
  797. },
  798. };
  799. static struct spear_muxreg i2s_ext_muxreg[] = {
  800. {
  801. .reg = IP_SEL_PAD_30_39_REG,
  802. .mask = PMX_PL_35_MASK | PMX_PL_39_MASK,
  803. .val = PMX_I2S_REF_CLK_PL_35_VAL | PMX_I2S_PL_39_VAL,
  804. }, {
  805. .reg = IP_SEL_PAD_40_49_REG,
  806. .mask = PMX_PL_40_MASK | PMX_PL_41_42_MASK,
  807. .val = PMX_I2S_PL_40_VAL | PMX_I2S_PL_41_42_VAL,
  808. },
  809. };
  810. static struct spear_modemux i2s_modemux[] = {
  811. {
  812. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | EXTENDED_MODE,
  813. .muxregs = i2s_muxreg,
  814. .nmuxregs = ARRAY_SIZE(i2s_muxreg),
  815. }, {
  816. .modes = EXTENDED_MODE,
  817. .muxregs = i2s_ext_muxreg,
  818. .nmuxregs = ARRAY_SIZE(i2s_ext_muxreg),
  819. },
  820. };
  821. static struct spear_pingroup i2s_pingroup = {
  822. .name = "i2s_grp",
  823. .pins = i2s_pins,
  824. .npins = ARRAY_SIZE(i2s_pins),
  825. .modemuxs = i2s_modemux,
  826. .nmodemuxs = ARRAY_SIZE(i2s_modemux),
  827. };
  828. static const char *const i2s_grps[] = { "i2s_grp" };
  829. static struct spear_function i2s_function = {
  830. .name = "i2s",
  831. .groups = i2s_grps,
  832. .ngroups = ARRAY_SIZE(i2s_grps),
  833. };
  834. /* Pad multiplexing for UART1 device */
  835. static const unsigned uart1_pins[] = { 28, 29 };
  836. static struct spear_muxreg uart1_muxreg[] = {
  837. {
  838. .reg = PMX_CONFIG_REG,
  839. .mask = PMX_GPIO_PIN0_MASK | PMX_GPIO_PIN1_MASK,
  840. .val = 0,
  841. },
  842. };
  843. static struct spear_muxreg uart1_ext_muxreg[] = {
  844. {
  845. .reg = IP_SEL_PAD_20_29_REG,
  846. .mask = PMX_PL_28_29_MASK,
  847. .val = PMX_UART1_PL_28_29_VAL,
  848. },
  849. };
  850. static struct spear_modemux uart1_modemux[] = {
  851. {
  852. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE
  853. | SMALL_PRINTERS_MODE | EXTENDED_MODE,
  854. .muxregs = uart1_muxreg,
  855. .nmuxregs = ARRAY_SIZE(uart1_muxreg),
  856. }, {
  857. .modes = EXTENDED_MODE,
  858. .muxregs = uart1_ext_muxreg,
  859. .nmuxregs = ARRAY_SIZE(uart1_ext_muxreg),
  860. },
  861. };
  862. static struct spear_pingroup uart1_pingroup = {
  863. .name = "uart1_grp",
  864. .pins = uart1_pins,
  865. .npins = ARRAY_SIZE(uart1_pins),
  866. .modemuxs = uart1_modemux,
  867. .nmodemuxs = ARRAY_SIZE(uart1_modemux),
  868. };
  869. static const char *const uart1_grps[] = { "uart1_grp" };
  870. static struct spear_function uart1_function = {
  871. .name = "uart1",
  872. .groups = uart1_grps,
  873. .ngroups = ARRAY_SIZE(uart1_grps),
  874. };
  875. /* Pad multiplexing for UART1 Modem device */
  876. static const unsigned uart1_modem_2_to_7_pins[] = { 2, 3, 4, 5, 6, 7 };
  877. static const unsigned uart1_modem_31_to_36_pins[] = { 31, 32, 33, 34, 35, 36 };
  878. static const unsigned uart1_modem_34_to_45_pins[] = { 34, 35, 36, 43, 44, 45 };
  879. static const unsigned uart1_modem_80_to_85_pins[] = { 80, 81, 82, 83, 84, 85 };
  880. static struct spear_muxreg uart1_modem_ext_2_to_7_muxreg[] = {
  881. {
  882. .reg = PMX_CONFIG_REG,
  883. .mask = PMX_UART0_MASK | PMX_I2C_MASK | PMX_SSP_MASK,
  884. .val = 0,
  885. }, {
  886. .reg = IP_SEL_PAD_0_9_REG,
  887. .mask = PMX_PL_2_3_MASK | PMX_PL_6_7_MASK,
  888. .val = PMX_UART1_ENH_PL_2_3_VAL | PMX_UART1_ENH_PL_4_5_VAL |
  889. PMX_UART1_ENH_PL_6_7_VAL,
  890. }, {
  891. .reg = IP_SEL_MIX_PAD_REG,
  892. .mask = PMX_UART1_ENH_PORT_SEL_MASK,
  893. .val = PMX_UART1_ENH_PORT_3_TO_5_7_VAL,
  894. },
  895. };
  896. static struct spear_muxreg uart1_modem_31_to_36_muxreg[] = {
  897. {
  898. .reg = PMX_CONFIG_REG,
  899. .mask = PMX_GPIO_PIN3_MASK | PMX_GPIO_PIN4_MASK |
  900. PMX_GPIO_PIN5_MASK | PMX_SSP_CS_MASK,
  901. .val = 0,
  902. },
  903. };
  904. static struct spear_muxreg uart1_modem_ext_31_to_36_muxreg[] = {
  905. {
  906. .reg = IP_SEL_PAD_30_39_REG,
  907. .mask = PMX_PL_31_MASK | PMX_PL_32_33_MASK | PMX_PL_34_MASK |
  908. PMX_PL_35_MASK | PMX_PL_36_MASK,
  909. .val = PMX_UART1_ENH_PL_31_VAL | PMX_UART1_ENH_PL_32_33_VAL |
  910. PMX_UART1_ENH_PL_34_VAL | PMX_UART1_ENH_PL_35_VAL |
  911. PMX_UART1_ENH_PL_36_VAL,
  912. }, {
  913. .reg = IP_SEL_MIX_PAD_REG,
  914. .mask = PMX_UART1_ENH_PORT_SEL_MASK,
  915. .val = PMX_UART1_ENH_PORT_32_TO_34_36_VAL,
  916. },
  917. };
  918. static struct spear_muxreg uart1_modem_34_to_45_muxreg[] = {
  919. {
  920. .reg = PMX_CONFIG_REG,
  921. .mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK |
  922. PMX_SSP_CS_MASK,
  923. .val = 0,
  924. },
  925. };
  926. static struct spear_muxreg uart1_modem_ext_34_to_45_muxreg[] = {
  927. {
  928. .reg = IP_SEL_PAD_30_39_REG,
  929. .mask = PMX_PL_34_MASK | PMX_PL_35_MASK | PMX_PL_36_MASK,
  930. .val = PMX_UART1_ENH_PL_34_VAL | PMX_UART1_ENH_PL_35_VAL |
  931. PMX_UART1_ENH_PL_36_VAL,
  932. }, {
  933. .reg = IP_SEL_PAD_40_49_REG,
  934. .mask = PMX_PL_43_MASK | PMX_PL_44_45_MASK,
  935. .val = PMX_UART1_ENH_PL_43_VAL | PMX_UART1_ENH_PL_44_45_VAL,
  936. }, {
  937. .reg = IP_SEL_MIX_PAD_REG,
  938. .mask = PMX_UART1_ENH_PORT_SEL_MASK,
  939. .val = PMX_UART1_ENH_PORT_44_45_34_36_VAL,
  940. },
  941. };
  942. static struct spear_muxreg uart1_modem_ext_80_to_85_muxreg[] = {
  943. {
  944. .reg = IP_SEL_PAD_80_89_REG,
  945. .mask = PMX_PL_80_TO_85_MASK,
  946. .val = PMX_UART1_ENH_PL_80_TO_85_VAL,
  947. }, {
  948. .reg = IP_SEL_PAD_40_49_REG,
  949. .mask = PMX_PL_43_MASK | PMX_PL_44_45_MASK,
  950. .val = PMX_UART1_ENH_PL_43_VAL | PMX_UART1_ENH_PL_44_45_VAL,
  951. }, {
  952. .reg = IP_SEL_MIX_PAD_REG,
  953. .mask = PMX_UART1_ENH_PORT_SEL_MASK,
  954. .val = PMX_UART1_ENH_PORT_81_TO_85_VAL,
  955. },
  956. };
  957. static struct spear_modemux uart1_modem_2_to_7_modemux[] = {
  958. {
  959. .modes = EXTENDED_MODE,
  960. .muxregs = uart1_modem_ext_2_to_7_muxreg,
  961. .nmuxregs = ARRAY_SIZE(uart1_modem_ext_2_to_7_muxreg),
  962. },
  963. };
  964. static struct spear_modemux uart1_modem_31_to_36_modemux[] = {
  965. {
  966. .modes = SMALL_PRINTERS_MODE | EXTENDED_MODE,
  967. .muxregs = uart1_modem_31_to_36_muxreg,
  968. .nmuxregs = ARRAY_SIZE(uart1_modem_31_to_36_muxreg),
  969. }, {
  970. .modes = EXTENDED_MODE,
  971. .muxregs = uart1_modem_ext_31_to_36_muxreg,
  972. .nmuxregs = ARRAY_SIZE(uart1_modem_ext_31_to_36_muxreg),
  973. },
  974. };
  975. static struct spear_modemux uart1_modem_34_to_45_modemux[] = {
  976. {
  977. .modes = AUTO_EXP_MODE | EXTENDED_MODE,
  978. .muxregs = uart1_modem_34_to_45_muxreg,
  979. .nmuxregs = ARRAY_SIZE(uart1_modem_34_to_45_muxreg),
  980. }, {
  981. .modes = EXTENDED_MODE,
  982. .muxregs = uart1_modem_ext_34_to_45_muxreg,
  983. .nmuxregs = ARRAY_SIZE(uart1_modem_ext_34_to_45_muxreg),
  984. },
  985. };
  986. static struct spear_modemux uart1_modem_80_to_85_modemux[] = {
  987. {
  988. .modes = EXTENDED_MODE,
  989. .muxregs = uart1_modem_ext_80_to_85_muxreg,
  990. .nmuxregs = ARRAY_SIZE(uart1_modem_ext_80_to_85_muxreg),
  991. },
  992. };
  993. static struct spear_pingroup uart1_modem_pingroup[] = {
  994. {
  995. .name = "uart1_modem_2_to_7_grp",
  996. .pins = uart1_modem_2_to_7_pins,
  997. .npins = ARRAY_SIZE(uart1_modem_2_to_7_pins),
  998. .modemuxs = uart1_modem_2_to_7_modemux,
  999. .nmodemuxs = ARRAY_SIZE(uart1_modem_2_to_7_modemux),
  1000. }, {
  1001. .name = "uart1_modem_31_to_36_grp",
  1002. .pins = uart1_modem_31_to_36_pins,
  1003. .npins = ARRAY_SIZE(uart1_modem_31_to_36_pins),
  1004. .modemuxs = uart1_modem_31_to_36_modemux,
  1005. .nmodemuxs = ARRAY_SIZE(uart1_modem_31_to_36_modemux),
  1006. }, {
  1007. .name = "uart1_modem_34_to_45_grp",
  1008. .pins = uart1_modem_34_to_45_pins,
  1009. .npins = ARRAY_SIZE(uart1_modem_34_to_45_pins),
  1010. .modemuxs = uart1_modem_34_to_45_modemux,
  1011. .nmodemuxs = ARRAY_SIZE(uart1_modem_34_to_45_modemux),
  1012. }, {
  1013. .name = "uart1_modem_80_to_85_grp",
  1014. .pins = uart1_modem_80_to_85_pins,
  1015. .npins = ARRAY_SIZE(uart1_modem_80_to_85_pins),
  1016. .modemuxs = uart1_modem_80_to_85_modemux,
  1017. .nmodemuxs = ARRAY_SIZE(uart1_modem_80_to_85_modemux),
  1018. },
  1019. };
  1020. static const char *const uart1_modem_grps[] = { "uart1_modem_2_to_7_grp",
  1021. "uart1_modem_31_to_36_grp", "uart1_modem_34_to_45_grp",
  1022. "uart1_modem_80_to_85_grp" };
  1023. static struct spear_function uart1_modem_function = {
  1024. .name = "uart1_modem",
  1025. .groups = uart1_modem_grps,
  1026. .ngroups = ARRAY_SIZE(uart1_modem_grps),
  1027. };
  1028. /* Pad multiplexing for UART2 device */
  1029. static const unsigned uart2_pins[] = { 0, 1 };
  1030. static struct spear_muxreg uart2_muxreg[] = {
  1031. {
  1032. .reg = PMX_CONFIG_REG,
  1033. .mask = PMX_FIRDA_MASK,
  1034. .val = 0,
  1035. },
  1036. };
  1037. static struct spear_muxreg uart2_ext_muxreg[] = {
  1038. {
  1039. .reg = IP_SEL_PAD_0_9_REG,
  1040. .mask = PMX_PL_0_1_MASK,
  1041. .val = PMX_UART2_PL_0_1_VAL,
  1042. },
  1043. };
  1044. static struct spear_modemux uart2_modemux[] = {
  1045. {
  1046. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE
  1047. | SMALL_PRINTERS_MODE | EXTENDED_MODE,
  1048. .muxregs = uart2_muxreg,
  1049. .nmuxregs = ARRAY_SIZE(uart2_muxreg),
  1050. }, {
  1051. .modes = EXTENDED_MODE,
  1052. .muxregs = uart2_ext_muxreg,
  1053. .nmuxregs = ARRAY_SIZE(uart2_ext_muxreg),
  1054. },
  1055. };
  1056. static struct spear_pingroup uart2_pingroup = {
  1057. .name = "uart2_grp",
  1058. .pins = uart2_pins,
  1059. .npins = ARRAY_SIZE(uart2_pins),
  1060. .modemuxs = uart2_modemux,
  1061. .nmodemuxs = ARRAY_SIZE(uart2_modemux),
  1062. };
  1063. static const char *const uart2_grps[] = { "uart2_grp" };
  1064. static struct spear_function uart2_function = {
  1065. .name = "uart2",
  1066. .groups = uart2_grps,
  1067. .ngroups = ARRAY_SIZE(uart2_grps),
  1068. };
  1069. /* Pad multiplexing for uart3 device */
  1070. static const unsigned uart3_pins[][2] = { { 8, 9 }, { 15, 16 }, { 41, 42 },
  1071. { 52, 53 }, { 73, 74 }, { 94, 95 }, { 98, 99 } };
  1072. static struct spear_muxreg uart3_ext_8_9_muxreg[] = {
  1073. {
  1074. .reg = PMX_CONFIG_REG,
  1075. .mask = PMX_SSP_MASK,
  1076. .val = 0,
  1077. }, {
  1078. .reg = IP_SEL_PAD_0_9_REG,
  1079. .mask = PMX_PL_8_9_MASK,
  1080. .val = PMX_UART3_PL_8_9_VAL,
  1081. }, {
  1082. .reg = IP_SEL_MIX_PAD_REG,
  1083. .mask = PMX_UART3_PORT_SEL_MASK,
  1084. .val = PMX_UART3_PORT_8_VAL,
  1085. },
  1086. };
  1087. static struct spear_muxreg uart3_ext_15_16_muxreg[] = {
  1088. {
  1089. .reg = PMX_CONFIG_REG,
  1090. .mask = PMX_MII_MASK,
  1091. .val = 0,
  1092. }, {
  1093. .reg = IP_SEL_PAD_10_19_REG,
  1094. .mask = PMX_PL_15_16_MASK,
  1095. .val = PMX_UART3_PL_15_16_VAL,
  1096. }, {
  1097. .reg = IP_SEL_MIX_PAD_REG,
  1098. .mask = PMX_UART3_PORT_SEL_MASK,
  1099. .val = PMX_UART3_PORT_15_VAL,
  1100. },
  1101. };
  1102. static struct spear_muxreg uart3_ext_41_42_muxreg[] = {
  1103. {
  1104. .reg = PMX_CONFIG_REG,
  1105. .mask = PMX_UART0_MODEM_MASK,
  1106. .val = 0,
  1107. }, {
  1108. .reg = IP_SEL_PAD_40_49_REG,
  1109. .mask = PMX_PL_41_42_MASK,
  1110. .val = PMX_UART3_PL_41_42_VAL,
  1111. }, {
  1112. .reg = IP_SEL_MIX_PAD_REG,
  1113. .mask = PMX_UART3_PORT_SEL_MASK,
  1114. .val = PMX_UART3_PORT_41_VAL,
  1115. },
  1116. };
  1117. static struct spear_muxreg uart3_ext_52_53_muxreg[] = {
  1118. {
  1119. .reg = IP_SEL_PAD_50_59_REG,
  1120. .mask = PMX_PL_52_53_MASK,
  1121. .val = PMX_UART3_PL_52_53_VAL,
  1122. }, {
  1123. .reg = IP_SEL_MIX_PAD_REG,
  1124. .mask = PMX_UART3_PORT_SEL_MASK,
  1125. .val = PMX_UART3_PORT_52_VAL,
  1126. },
  1127. };
  1128. static struct spear_muxreg uart3_ext_73_74_muxreg[] = {
  1129. {
  1130. .reg = IP_SEL_PAD_70_79_REG,
  1131. .mask = PMX_PL_73_MASK | PMX_PL_74_MASK,
  1132. .val = PMX_UART3_PL_73_VAL | PMX_UART3_PL_74_VAL,
  1133. }, {
  1134. .reg = IP_SEL_MIX_PAD_REG,
  1135. .mask = PMX_UART3_PORT_SEL_MASK,
  1136. .val = PMX_UART3_PORT_73_VAL,
  1137. },
  1138. };
  1139. static struct spear_muxreg uart3_ext_94_95_muxreg[] = {
  1140. {
  1141. .reg = IP_SEL_PAD_90_99_REG,
  1142. .mask = PMX_PL_94_95_MASK,
  1143. .val = PMX_UART3_PL_94_95_VAL,
  1144. }, {
  1145. .reg = IP_SEL_MIX_PAD_REG,
  1146. .mask = PMX_UART3_PORT_SEL_MASK,
  1147. .val = PMX_UART3_PORT_94_VAL,
  1148. },
  1149. };
  1150. static struct spear_muxreg uart3_ext_98_99_muxreg[] = {
  1151. {
  1152. .reg = IP_SEL_PAD_90_99_REG,
  1153. .mask = PMX_PL_98_MASK | PMX_PL_99_MASK,
  1154. .val = PMX_UART3_PL_98_VAL | PMX_UART3_PL_99_VAL,
  1155. }, {
  1156. .reg = IP_SEL_MIX_PAD_REG,
  1157. .mask = PMX_UART3_PORT_SEL_MASK,
  1158. .val = PMX_UART3_PORT_99_VAL,
  1159. },
  1160. };
  1161. static struct spear_modemux uart3_modemux[][1] = {
  1162. {
  1163. /* Select signals on pins 8_9 */
  1164. {
  1165. .modes = EXTENDED_MODE,
  1166. .muxregs = uart3_ext_8_9_muxreg,
  1167. .nmuxregs = ARRAY_SIZE(uart3_ext_8_9_muxreg),
  1168. },
  1169. }, {
  1170. /* Select signals on pins 15_16 */
  1171. {
  1172. .modes = EXTENDED_MODE,
  1173. .muxregs = uart3_ext_15_16_muxreg,
  1174. .nmuxregs = ARRAY_SIZE(uart3_ext_15_16_muxreg),
  1175. },
  1176. }, {
  1177. /* Select signals on pins 41_42 */
  1178. {
  1179. .modes = EXTENDED_MODE,
  1180. .muxregs = uart3_ext_41_42_muxreg,
  1181. .nmuxregs = ARRAY_SIZE(uart3_ext_41_42_muxreg),
  1182. },
  1183. }, {
  1184. /* Select signals on pins 52_53 */
  1185. {
  1186. .modes = EXTENDED_MODE,
  1187. .muxregs = uart3_ext_52_53_muxreg,
  1188. .nmuxregs = ARRAY_SIZE(uart3_ext_52_53_muxreg),
  1189. },
  1190. }, {
  1191. /* Select signals on pins 73_74 */
  1192. {
  1193. .modes = EXTENDED_MODE,
  1194. .muxregs = uart3_ext_73_74_muxreg,
  1195. .nmuxregs = ARRAY_SIZE(uart3_ext_73_74_muxreg),
  1196. },
  1197. }, {
  1198. /* Select signals on pins 94_95 */
  1199. {
  1200. .modes = EXTENDED_MODE,
  1201. .muxregs = uart3_ext_94_95_muxreg,
  1202. .nmuxregs = ARRAY_SIZE(uart3_ext_94_95_muxreg),
  1203. },
  1204. }, {
  1205. /* Select signals on pins 98_99 */
  1206. {
  1207. .modes = EXTENDED_MODE,
  1208. .muxregs = uart3_ext_98_99_muxreg,
  1209. .nmuxregs = ARRAY_SIZE(uart3_ext_98_99_muxreg),
  1210. },
  1211. },
  1212. };
  1213. static struct spear_pingroup uart3_pingroup[] = {
  1214. {
  1215. .name = "uart3_8_9_grp",
  1216. .pins = uart3_pins[0],
  1217. .npins = ARRAY_SIZE(uart3_pins[0]),
  1218. .modemuxs = uart3_modemux[0],
  1219. .nmodemuxs = ARRAY_SIZE(uart3_modemux[0]),
  1220. }, {
  1221. .name = "uart3_15_16_grp",
  1222. .pins = uart3_pins[1],
  1223. .npins = ARRAY_SIZE(uart3_pins[1]),
  1224. .modemuxs = uart3_modemux[1],
  1225. .nmodemuxs = ARRAY_SIZE(uart3_modemux[1]),
  1226. }, {
  1227. .name = "uart3_41_42_grp",
  1228. .pins = uart3_pins[2],
  1229. .npins = ARRAY_SIZE(uart3_pins[2]),
  1230. .modemuxs = uart3_modemux[2],
  1231. .nmodemuxs = ARRAY_SIZE(uart3_modemux[2]),
  1232. }, {
  1233. .name = "uart3_52_53_grp",
  1234. .pins = uart3_pins[3],
  1235. .npins = ARRAY_SIZE(uart3_pins[3]),
  1236. .modemuxs = uart3_modemux[3],
  1237. .nmodemuxs = ARRAY_SIZE(uart3_modemux[3]),
  1238. }, {
  1239. .name = "uart3_73_74_grp",
  1240. .pins = uart3_pins[4],
  1241. .npins = ARRAY_SIZE(uart3_pins[4]),
  1242. .modemuxs = uart3_modemux[4],
  1243. .nmodemuxs = ARRAY_SIZE(uart3_modemux[4]),
  1244. }, {
  1245. .name = "uart3_94_95_grp",
  1246. .pins = uart3_pins[5],
  1247. .npins = ARRAY_SIZE(uart3_pins[5]),
  1248. .modemuxs = uart3_modemux[5],
  1249. .nmodemuxs = ARRAY_SIZE(uart3_modemux[5]),
  1250. }, {
  1251. .name = "uart3_98_99_grp",
  1252. .pins = uart3_pins[6],
  1253. .npins = ARRAY_SIZE(uart3_pins[6]),
  1254. .modemuxs = uart3_modemux[6],
  1255. .nmodemuxs = ARRAY_SIZE(uart3_modemux[6]),
  1256. },
  1257. };
  1258. static const char *const uart3_grps[] = { "uart3_8_9_grp", "uart3_15_16_grp",
  1259. "uart3_41_42_grp", "uart3_52_53_grp", "uart3_73_74_grp",
  1260. "uart3_94_95_grp", "uart3_98_99_grp" };
  1261. static struct spear_function uart3_function = {
  1262. .name = "uart3",
  1263. .groups = uart3_grps,
  1264. .ngroups = ARRAY_SIZE(uart3_grps),
  1265. };
  1266. /* Pad multiplexing for uart4 device */
  1267. static const unsigned uart4_pins[][2] = { { 6, 7 }, { 13, 14 }, { 39, 40 },
  1268. { 71, 72 }, { 92, 93 }, { 100, 101 } };
  1269. static struct spear_muxreg uart4_ext_6_7_muxreg[] = {
  1270. {
  1271. .reg = PMX_CONFIG_REG,
  1272. .mask = PMX_SSP_MASK,
  1273. .val = 0,
  1274. }, {
  1275. .reg = IP_SEL_PAD_0_9_REG,
  1276. .mask = PMX_PL_6_7_MASK,
  1277. .val = PMX_UART4_PL_6_7_VAL,
  1278. }, {
  1279. .reg = IP_SEL_MIX_PAD_REG,
  1280. .mask = PMX_UART4_PORT_SEL_MASK,
  1281. .val = PMX_UART4_PORT_6_VAL,
  1282. },
  1283. };
  1284. static struct spear_muxreg uart4_ext_13_14_muxreg[] = {
  1285. {
  1286. .reg = PMX_CONFIG_REG,
  1287. .mask = PMX_MII_MASK,
  1288. .val = 0,
  1289. }, {
  1290. .reg = IP_SEL_PAD_10_19_REG,
  1291. .mask = PMX_PL_13_14_MASK,
  1292. .val = PMX_UART4_PL_13_14_VAL,
  1293. }, {
  1294. .reg = IP_SEL_MIX_PAD_REG,
  1295. .mask = PMX_UART4_PORT_SEL_MASK,
  1296. .val = PMX_UART4_PORT_13_VAL,
  1297. },
  1298. };
  1299. static struct spear_muxreg uart4_ext_39_40_muxreg[] = {
  1300. {
  1301. .reg = PMX_CONFIG_REG,
  1302. .mask = PMX_UART0_MODEM_MASK,
  1303. .val = 0,
  1304. }, {
  1305. .reg = IP_SEL_PAD_30_39_REG,
  1306. .mask = PMX_PL_39_MASK,
  1307. .val = PMX_UART4_PL_39_VAL,
  1308. }, {
  1309. .reg = IP_SEL_PAD_40_49_REG,
  1310. .mask = PMX_PL_40_MASK,
  1311. .val = PMX_UART4_PL_40_VAL,
  1312. }, {
  1313. .reg = IP_SEL_MIX_PAD_REG,
  1314. .mask = PMX_UART4_PORT_SEL_MASK,
  1315. .val = PMX_UART4_PORT_39_VAL,
  1316. },
  1317. };
  1318. static struct spear_muxreg uart4_ext_71_72_muxreg[] = {
  1319. {
  1320. .reg = IP_SEL_PAD_70_79_REG,
  1321. .mask = PMX_PL_71_72_MASK,
  1322. .val = PMX_UART4_PL_71_72_VAL,
  1323. }, {
  1324. .reg = IP_SEL_MIX_PAD_REG,
  1325. .mask = PMX_UART4_PORT_SEL_MASK,
  1326. .val = PMX_UART4_PORT_71_VAL,
  1327. },
  1328. };
  1329. static struct spear_muxreg uart4_ext_92_93_muxreg[] = {
  1330. {
  1331. .reg = IP_SEL_PAD_90_99_REG,
  1332. .mask = PMX_PL_92_93_MASK,
  1333. .val = PMX_UART4_PL_92_93_VAL,
  1334. }, {
  1335. .reg = IP_SEL_MIX_PAD_REG,
  1336. .mask = PMX_UART4_PORT_SEL_MASK,
  1337. .val = PMX_UART4_PORT_92_VAL,
  1338. },
  1339. };
  1340. static struct spear_muxreg uart4_ext_100_101_muxreg[] = {
  1341. {
  1342. .reg = IP_SEL_MIX_PAD_REG,
  1343. .mask = PMX_PL_100_101_MASK |
  1344. PMX_UART4_PORT_SEL_MASK,
  1345. .val = PMX_UART4_PL_100_101_VAL |
  1346. PMX_UART4_PORT_101_VAL,
  1347. },
  1348. };
  1349. static struct spear_modemux uart4_modemux[][1] = {
  1350. {
  1351. /* Select signals on pins 6_7 */
  1352. {
  1353. .modes = EXTENDED_MODE,
  1354. .muxregs = uart4_ext_6_7_muxreg,
  1355. .nmuxregs = ARRAY_SIZE(uart4_ext_6_7_muxreg),
  1356. },
  1357. }, {
  1358. /* Select signals on pins 13_14 */
  1359. {
  1360. .modes = EXTENDED_MODE,
  1361. .muxregs = uart4_ext_13_14_muxreg,
  1362. .nmuxregs = ARRAY_SIZE(uart4_ext_13_14_muxreg),
  1363. },
  1364. }, {
  1365. /* Select signals on pins 39_40 */
  1366. {
  1367. .modes = EXTENDED_MODE,
  1368. .muxregs = uart4_ext_39_40_muxreg,
  1369. .nmuxregs = ARRAY_SIZE(uart4_ext_39_40_muxreg),
  1370. },
  1371. }, {
  1372. /* Select signals on pins 71_72 */
  1373. {
  1374. .modes = EXTENDED_MODE,
  1375. .muxregs = uart4_ext_71_72_muxreg,
  1376. .nmuxregs = ARRAY_SIZE(uart4_ext_71_72_muxreg),
  1377. },
  1378. }, {
  1379. /* Select signals on pins 92_93 */
  1380. {
  1381. .modes = EXTENDED_MODE,
  1382. .muxregs = uart4_ext_92_93_muxreg,
  1383. .nmuxregs = ARRAY_SIZE(uart4_ext_92_93_muxreg),
  1384. },
  1385. }, {
  1386. /* Select signals on pins 100_101_ */
  1387. {
  1388. .modes = EXTENDED_MODE,
  1389. .muxregs = uart4_ext_100_101_muxreg,
  1390. .nmuxregs = ARRAY_SIZE(uart4_ext_100_101_muxreg),
  1391. },
  1392. },
  1393. };
  1394. static struct spear_pingroup uart4_pingroup[] = {
  1395. {
  1396. .name = "uart4_6_7_grp",
  1397. .pins = uart4_pins[0],
  1398. .npins = ARRAY_SIZE(uart4_pins[0]),
  1399. .modemuxs = uart4_modemux[0],
  1400. .nmodemuxs = ARRAY_SIZE(uart4_modemux[0]),
  1401. }, {
  1402. .name = "uart4_13_14_grp",
  1403. .pins = uart4_pins[1],
  1404. .npins = ARRAY_SIZE(uart4_pins[1]),
  1405. .modemuxs = uart4_modemux[1],
  1406. .nmodemuxs = ARRAY_SIZE(uart4_modemux[1]),
  1407. }, {
  1408. .name = "uart4_39_40_grp",
  1409. .pins = uart4_pins[2],
  1410. .npins = ARRAY_SIZE(uart4_pins[2]),
  1411. .modemuxs = uart4_modemux[2],
  1412. .nmodemuxs = ARRAY_SIZE(uart4_modemux[2]),
  1413. }, {
  1414. .name = "uart4_71_72_grp",
  1415. .pins = uart4_pins[3],
  1416. .npins = ARRAY_SIZE(uart4_pins[3]),
  1417. .modemuxs = uart4_modemux[3],
  1418. .nmodemuxs = ARRAY_SIZE(uart4_modemux[3]),
  1419. }, {
  1420. .name = "uart4_92_93_grp",
  1421. .pins = uart4_pins[4],
  1422. .npins = ARRAY_SIZE(uart4_pins[4]),
  1423. .modemuxs = uart4_modemux[4],
  1424. .nmodemuxs = ARRAY_SIZE(uart4_modemux[4]),
  1425. }, {
  1426. .name = "uart4_100_101_grp",
  1427. .pins = uart4_pins[5],
  1428. .npins = ARRAY_SIZE(uart4_pins[5]),
  1429. .modemuxs = uart4_modemux[5],
  1430. .nmodemuxs = ARRAY_SIZE(uart4_modemux[5]),
  1431. },
  1432. };
  1433. static const char *const uart4_grps[] = { "uart4_6_7_grp", "uart4_13_14_grp",
  1434. "uart4_39_40_grp", "uart4_71_72_grp", "uart4_92_93_grp",
  1435. "uart4_100_101_grp" };
  1436. static struct spear_function uart4_function = {
  1437. .name = "uart4",
  1438. .groups = uart4_grps,
  1439. .ngroups = ARRAY_SIZE(uart4_grps),
  1440. };
  1441. /* Pad multiplexing for uart5 device */
  1442. static const unsigned uart5_pins[][2] = { { 4, 5 }, { 37, 38 }, { 69, 70 },
  1443. { 90, 91 } };
  1444. static struct spear_muxreg uart5_ext_4_5_muxreg[] = {
  1445. {
  1446. .reg = PMX_CONFIG_REG,
  1447. .mask = PMX_I2C_MASK,
  1448. .val = 0,
  1449. }, {
  1450. .reg = IP_SEL_PAD_0_9_REG,
  1451. .mask = PMX_PL_4_5_MASK,
  1452. .val = PMX_UART5_PL_4_5_VAL,
  1453. }, {
  1454. .reg = IP_SEL_MIX_PAD_REG,
  1455. .mask = PMX_UART5_PORT_SEL_MASK,
  1456. .val = PMX_UART5_PORT_4_VAL,
  1457. },
  1458. };
  1459. static struct spear_muxreg uart5_ext_37_38_muxreg[] = {
  1460. {
  1461. .reg = PMX_CONFIG_REG,
  1462. .mask = PMX_UART0_MODEM_MASK,
  1463. .val = 0,
  1464. }, {
  1465. .reg = IP_SEL_PAD_30_39_REG,
  1466. .mask = PMX_PL_37_38_MASK,
  1467. .val = PMX_UART5_PL_37_38_VAL,
  1468. }, {
  1469. .reg = IP_SEL_MIX_PAD_REG,
  1470. .mask = PMX_UART5_PORT_SEL_MASK,
  1471. .val = PMX_UART5_PORT_37_VAL,
  1472. },
  1473. };
  1474. static struct spear_muxreg uart5_ext_69_70_muxreg[] = {
  1475. {
  1476. .reg = IP_SEL_PAD_60_69_REG,
  1477. .mask = PMX_PL_69_MASK,
  1478. .val = PMX_UART5_PL_69_VAL,
  1479. }, {
  1480. .reg = IP_SEL_PAD_70_79_REG,
  1481. .mask = PMX_PL_70_MASK,
  1482. .val = PMX_UART5_PL_70_VAL,
  1483. }, {
  1484. .reg = IP_SEL_MIX_PAD_REG,
  1485. .mask = PMX_UART5_PORT_SEL_MASK,
  1486. .val = PMX_UART5_PORT_69_VAL,
  1487. },
  1488. };
  1489. static struct spear_muxreg uart5_ext_90_91_muxreg[] = {
  1490. {
  1491. .reg = IP_SEL_PAD_90_99_REG,
  1492. .mask = PMX_PL_90_91_MASK,
  1493. .val = PMX_UART5_PL_90_91_VAL,
  1494. }, {
  1495. .reg = IP_SEL_MIX_PAD_REG,
  1496. .mask = PMX_UART5_PORT_SEL_MASK,
  1497. .val = PMX_UART5_PORT_90_VAL,
  1498. },
  1499. };
  1500. static struct spear_modemux uart5_modemux[][1] = {
  1501. {
  1502. /* Select signals on pins 4_5 */
  1503. {
  1504. .modes = EXTENDED_MODE,
  1505. .muxregs = uart5_ext_4_5_muxreg,
  1506. .nmuxregs = ARRAY_SIZE(uart5_ext_4_5_muxreg),
  1507. },
  1508. }, {
  1509. /* Select signals on pins 37_38 */
  1510. {
  1511. .modes = EXTENDED_MODE,
  1512. .muxregs = uart5_ext_37_38_muxreg,
  1513. .nmuxregs = ARRAY_SIZE(uart5_ext_37_38_muxreg),
  1514. },
  1515. }, {
  1516. /* Select signals on pins 69_70 */
  1517. {
  1518. .modes = EXTENDED_MODE,
  1519. .muxregs = uart5_ext_69_70_muxreg,
  1520. .nmuxregs = ARRAY_SIZE(uart5_ext_69_70_muxreg),
  1521. },
  1522. }, {
  1523. /* Select signals on pins 90_91 */
  1524. {
  1525. .modes = EXTENDED_MODE,
  1526. .muxregs = uart5_ext_90_91_muxreg,
  1527. .nmuxregs = ARRAY_SIZE(uart5_ext_90_91_muxreg),
  1528. },
  1529. },
  1530. };
  1531. static struct spear_pingroup uart5_pingroup[] = {
  1532. {
  1533. .name = "uart5_4_5_grp",
  1534. .pins = uart5_pins[0],
  1535. .npins = ARRAY_SIZE(uart5_pins[0]),
  1536. .modemuxs = uart5_modemux[0],
  1537. .nmodemuxs = ARRAY_SIZE(uart5_modemux[0]),
  1538. }, {
  1539. .name = "uart5_37_38_grp",
  1540. .pins = uart5_pins[1],
  1541. .npins = ARRAY_SIZE(uart5_pins[1]),
  1542. .modemuxs = uart5_modemux[1],
  1543. .nmodemuxs = ARRAY_SIZE(uart5_modemux[1]),
  1544. }, {
  1545. .name = "uart5_69_70_grp",
  1546. .pins = uart5_pins[2],
  1547. .npins = ARRAY_SIZE(uart5_pins[2]),
  1548. .modemuxs = uart5_modemux[2],
  1549. .nmodemuxs = ARRAY_SIZE(uart5_modemux[2]),
  1550. }, {
  1551. .name = "uart5_90_91_grp",
  1552. .pins = uart5_pins[3],
  1553. .npins = ARRAY_SIZE(uart5_pins[3]),
  1554. .modemuxs = uart5_modemux[3],
  1555. .nmodemuxs = ARRAY_SIZE(uart5_modemux[3]),
  1556. },
  1557. };
  1558. static const char *const uart5_grps[] = { "uart5_4_5_grp", "uart5_37_38_grp",
  1559. "uart5_69_70_grp", "uart5_90_91_grp" };
  1560. static struct spear_function uart5_function = {
  1561. .name = "uart5",
  1562. .groups = uart5_grps,
  1563. .ngroups = ARRAY_SIZE(uart5_grps),
  1564. };
  1565. /* Pad multiplexing for uart6 device */
  1566. static const unsigned uart6_pins[][2] = { { 2, 3 }, { 88, 89 } };
  1567. static struct spear_muxreg uart6_ext_2_3_muxreg[] = {
  1568. {
  1569. .reg = PMX_CONFIG_REG,
  1570. .mask = PMX_UART0_MASK,
  1571. .val = 0,
  1572. }, {
  1573. .reg = IP_SEL_PAD_0_9_REG,
  1574. .mask = PMX_PL_2_3_MASK,
  1575. .val = PMX_UART6_PL_2_3_VAL,
  1576. }, {
  1577. .reg = IP_SEL_MIX_PAD_REG,
  1578. .mask = PMX_UART6_PORT_SEL_MASK,
  1579. .val = PMX_UART6_PORT_2_VAL,
  1580. },
  1581. };
  1582. static struct spear_muxreg uart6_ext_88_89_muxreg[] = {
  1583. {
  1584. .reg = IP_SEL_PAD_80_89_REG,
  1585. .mask = PMX_PL_88_89_MASK,
  1586. .val = PMX_UART6_PL_88_89_VAL,
  1587. }, {
  1588. .reg = IP_SEL_MIX_PAD_REG,
  1589. .mask = PMX_UART6_PORT_SEL_MASK,
  1590. .val = PMX_UART6_PORT_88_VAL,
  1591. },
  1592. };
  1593. static struct spear_modemux uart6_modemux[][1] = {
  1594. {
  1595. /* Select signals on pins 2_3 */
  1596. {
  1597. .modes = EXTENDED_MODE,
  1598. .muxregs = uart6_ext_2_3_muxreg,
  1599. .nmuxregs = ARRAY_SIZE(uart6_ext_2_3_muxreg),
  1600. },
  1601. }, {
  1602. /* Select signals on pins 88_89 */
  1603. {
  1604. .modes = EXTENDED_MODE,
  1605. .muxregs = uart6_ext_88_89_muxreg,
  1606. .nmuxregs = ARRAY_SIZE(uart6_ext_88_89_muxreg),
  1607. },
  1608. },
  1609. };
  1610. static struct spear_pingroup uart6_pingroup[] = {
  1611. {
  1612. .name = "uart6_2_3_grp",
  1613. .pins = uart6_pins[0],
  1614. .npins = ARRAY_SIZE(uart6_pins[0]),
  1615. .modemuxs = uart6_modemux[0],
  1616. .nmodemuxs = ARRAY_SIZE(uart6_modemux[0]),
  1617. }, {
  1618. .name = "uart6_88_89_grp",
  1619. .pins = uart6_pins[1],
  1620. .npins = ARRAY_SIZE(uart6_pins[1]),
  1621. .modemuxs = uart6_modemux[1],
  1622. .nmodemuxs = ARRAY_SIZE(uart6_modemux[1]),
  1623. },
  1624. };
  1625. static const char *const uart6_grps[] = { "uart6_2_3_grp", "uart6_88_89_grp" };
  1626. static struct spear_function uart6_function = {
  1627. .name = "uart6",
  1628. .groups = uart6_grps,
  1629. .ngroups = ARRAY_SIZE(uart6_grps),
  1630. };
  1631. /* UART - RS485 pmx */
  1632. static const unsigned rs485_pins[] = { 77, 78, 79 };
  1633. static struct spear_muxreg rs485_muxreg[] = {
  1634. {
  1635. .reg = IP_SEL_PAD_70_79_REG,
  1636. .mask = PMX_PL_77_78_79_MASK,
  1637. .val = PMX_RS485_PL_77_78_79_VAL,
  1638. },
  1639. };
  1640. static struct spear_modemux rs485_modemux[] = {
  1641. {
  1642. .modes = EXTENDED_MODE,
  1643. .muxregs = rs485_muxreg,
  1644. .nmuxregs = ARRAY_SIZE(rs485_muxreg),
  1645. },
  1646. };
  1647. static struct spear_pingroup rs485_pingroup = {
  1648. .name = "rs485_grp",
  1649. .pins = rs485_pins,
  1650. .npins = ARRAY_SIZE(rs485_pins),
  1651. .modemuxs = rs485_modemux,
  1652. .nmodemuxs = ARRAY_SIZE(rs485_modemux),
  1653. };
  1654. static const char *const rs485_grps[] = { "rs485_grp" };
  1655. static struct spear_function rs485_function = {
  1656. .name = "rs485",
  1657. .groups = rs485_grps,
  1658. .ngroups = ARRAY_SIZE(rs485_grps),
  1659. };
  1660. /* Pad multiplexing for Touchscreen device */
  1661. static const unsigned touchscreen_pins[] = { 5, 36 };
  1662. static struct spear_muxreg touchscreen_muxreg[] = {
  1663. {
  1664. .reg = PMX_CONFIG_REG,
  1665. .mask = PMX_I2C_MASK | PMX_SSP_CS_MASK,
  1666. .val = 0,
  1667. },
  1668. };
  1669. static struct spear_muxreg touchscreen_ext_muxreg[] = {
  1670. {
  1671. .reg = IP_SEL_PAD_0_9_REG,
  1672. .mask = PMX_PL_5_MASK,
  1673. .val = PMX_TOUCH_Y_PL_5_VAL,
  1674. }, {
  1675. .reg = IP_SEL_PAD_30_39_REG,
  1676. .mask = PMX_PL_36_MASK,
  1677. .val = PMX_TOUCH_X_PL_36_VAL,
  1678. },
  1679. };
  1680. static struct spear_modemux touchscreen_modemux[] = {
  1681. {
  1682. .modes = AUTO_NET_SMII_MODE | EXTENDED_MODE,
  1683. .muxregs = touchscreen_muxreg,
  1684. .nmuxregs = ARRAY_SIZE(touchscreen_muxreg),
  1685. }, {
  1686. .modes = EXTENDED_MODE,
  1687. .muxregs = touchscreen_ext_muxreg,
  1688. .nmuxregs = ARRAY_SIZE(touchscreen_ext_muxreg),
  1689. },
  1690. };
  1691. static struct spear_pingroup touchscreen_pingroup = {
  1692. .name = "touchscreen_grp",
  1693. .pins = touchscreen_pins,
  1694. .npins = ARRAY_SIZE(touchscreen_pins),
  1695. .modemuxs = touchscreen_modemux,
  1696. .nmodemuxs = ARRAY_SIZE(touchscreen_modemux),
  1697. };
  1698. static const char *const touchscreen_grps[] = { "touchscreen_grp" };
  1699. static struct spear_function touchscreen_function = {
  1700. .name = "touchscreen",
  1701. .groups = touchscreen_grps,
  1702. .ngroups = ARRAY_SIZE(touchscreen_grps),
  1703. };
  1704. /* Pad multiplexing for CAN device */
  1705. static const unsigned can0_pins[] = { 32, 33 };
  1706. static struct spear_muxreg can0_muxreg[] = {
  1707. {
  1708. .reg = PMX_CONFIG_REG,
  1709. .mask = PMX_GPIO_PIN4_MASK | PMX_GPIO_PIN5_MASK,
  1710. .val = 0,
  1711. },
  1712. };
  1713. static struct spear_muxreg can0_ext_muxreg[] = {
  1714. {
  1715. .reg = IP_SEL_PAD_30_39_REG,
  1716. .mask = PMX_PL_32_33_MASK,
  1717. .val = PMX_CAN0_PL_32_33_VAL,
  1718. },
  1719. };
  1720. static struct spear_modemux can0_modemux[] = {
  1721. {
  1722. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE
  1723. | EXTENDED_MODE,
  1724. .muxregs = can0_muxreg,
  1725. .nmuxregs = ARRAY_SIZE(can0_muxreg),
  1726. }, {
  1727. .modes = EXTENDED_MODE,
  1728. .muxregs = can0_ext_muxreg,
  1729. .nmuxregs = ARRAY_SIZE(can0_ext_muxreg),
  1730. },
  1731. };
  1732. static struct spear_pingroup can0_pingroup = {
  1733. .name = "can0_grp",
  1734. .pins = can0_pins,
  1735. .npins = ARRAY_SIZE(can0_pins),
  1736. .modemuxs = can0_modemux,
  1737. .nmodemuxs = ARRAY_SIZE(can0_modemux),
  1738. };
  1739. static const char *const can0_grps[] = { "can0_grp" };
  1740. static struct spear_function can0_function = {
  1741. .name = "can0",
  1742. .groups = can0_grps,
  1743. .ngroups = ARRAY_SIZE(can0_grps),
  1744. };
  1745. static const unsigned can1_pins[] = { 30, 31 };
  1746. static struct spear_muxreg can1_muxreg[] = {
  1747. {
  1748. .reg = PMX_CONFIG_REG,
  1749. .mask = PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK,
  1750. .val = 0,
  1751. },
  1752. };
  1753. static struct spear_muxreg can1_ext_muxreg[] = {
  1754. {
  1755. .reg = IP_SEL_PAD_30_39_REG,
  1756. .mask = PMX_PL_30_31_MASK,
  1757. .val = PMX_CAN1_PL_30_31_VAL,
  1758. },
  1759. };
  1760. static struct spear_modemux can1_modemux[] = {
  1761. {
  1762. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | AUTO_EXP_MODE
  1763. | EXTENDED_MODE,
  1764. .muxregs = can1_muxreg,
  1765. .nmuxregs = ARRAY_SIZE(can1_muxreg),
  1766. }, {
  1767. .modes = EXTENDED_MODE,
  1768. .muxregs = can1_ext_muxreg,
  1769. .nmuxregs = ARRAY_SIZE(can1_ext_muxreg),
  1770. },
  1771. };
  1772. static struct spear_pingroup can1_pingroup = {
  1773. .name = "can1_grp",
  1774. .pins = can1_pins,
  1775. .npins = ARRAY_SIZE(can1_pins),
  1776. .modemuxs = can1_modemux,
  1777. .nmodemuxs = ARRAY_SIZE(can1_modemux),
  1778. };
  1779. static const char *const can1_grps[] = { "can1_grp" };
  1780. static struct spear_function can1_function = {
  1781. .name = "can1",
  1782. .groups = can1_grps,
  1783. .ngroups = ARRAY_SIZE(can1_grps),
  1784. };
  1785. /* Pad multiplexing for PWM0_1 device */
  1786. static const unsigned pwm0_1_pins[][2] = { { 37, 38 }, { 14, 15 }, { 8, 9 },
  1787. { 30, 31 }, { 42, 43 }, { 59, 60 }, { 88, 89 } };
  1788. static struct spear_muxreg pwm0_1_pin_8_9_muxreg[] = {
  1789. {
  1790. .reg = PMX_CONFIG_REG,
  1791. .mask = PMX_SSP_MASK,
  1792. .val = 0,
  1793. }, {
  1794. .reg = IP_SEL_PAD_0_9_REG,
  1795. .mask = PMX_PL_8_9_MASK,
  1796. .val = PMX_PWM_0_1_PL_8_9_VAL,
  1797. },
  1798. };
  1799. static struct spear_muxreg pwm0_1_autoexpsmallpri_muxreg[] = {
  1800. {
  1801. .reg = PMX_CONFIG_REG,
  1802. .mask = PMX_MII_MASK,
  1803. .val = 0,
  1804. },
  1805. };
  1806. static struct spear_muxreg pwm0_1_pin_14_15_muxreg[] = {
  1807. {
  1808. .reg = IP_SEL_PAD_10_19_REG,
  1809. .mask = PMX_PL_14_MASK | PMX_PL_15_MASK,
  1810. .val = PMX_PWM1_PL_14_VAL | PMX_PWM0_PL_15_VAL,
  1811. },
  1812. };
  1813. static struct spear_muxreg pwm0_1_pin_30_31_muxreg[] = {
  1814. {
  1815. .reg = PMX_CONFIG_REG,
  1816. .mask = PMX_GPIO_PIN2_MASK | PMX_GPIO_PIN3_MASK,
  1817. .val = 0,
  1818. }, {
  1819. .reg = IP_SEL_PAD_30_39_REG,
  1820. .mask = PMX_PL_30_MASK | PMX_PL_31_MASK,
  1821. .val = PMX_PWM1_EXT_PL_30_VAL | PMX_PWM0_EXT_PL_31_VAL,
  1822. },
  1823. };
  1824. static struct spear_muxreg pwm0_1_net_muxreg[] = {
  1825. {
  1826. .reg = PMX_CONFIG_REG,
  1827. .mask = PMX_UART0_MODEM_MASK,
  1828. .val = 0,
  1829. },
  1830. };
  1831. static struct spear_muxreg pwm0_1_pin_37_38_muxreg[] = {
  1832. {
  1833. .reg = IP_SEL_PAD_30_39_REG,
  1834. .mask = PMX_PL_37_38_MASK,
  1835. .val = PMX_PWM0_1_PL_37_38_VAL,
  1836. },
  1837. };
  1838. static struct spear_muxreg pwm0_1_pin_42_43_muxreg[] = {
  1839. {
  1840. .reg = PMX_CONFIG_REG,
  1841. .mask = PMX_UART0_MODEM_MASK | PMX_TIMER_0_1_MASK ,
  1842. .val = 0,
  1843. }, {
  1844. .reg = IP_SEL_PAD_40_49_REG,
  1845. .mask = PMX_PL_42_MASK | PMX_PL_43_MASK,
  1846. .val = PMX_PWM1_PL_42_VAL |
  1847. PMX_PWM0_PL_43_VAL,
  1848. },
  1849. };
  1850. static struct spear_muxreg pwm0_1_pin_59_60_muxreg[] = {
  1851. {
  1852. .reg = IP_SEL_PAD_50_59_REG,
  1853. .mask = PMX_PL_59_MASK,
  1854. .val = PMX_PWM1_PL_59_VAL,
  1855. }, {
  1856. .reg = IP_SEL_PAD_60_69_REG,
  1857. .mask = PMX_PL_60_MASK,
  1858. .val = PMX_PWM0_PL_60_VAL,
  1859. },
  1860. };
  1861. static struct spear_muxreg pwm0_1_pin_88_89_muxreg[] = {
  1862. {
  1863. .reg = IP_SEL_PAD_80_89_REG,
  1864. .mask = PMX_PL_88_89_MASK,
  1865. .val = PMX_PWM0_1_PL_88_89_VAL,
  1866. },
  1867. };
  1868. static struct spear_modemux pwm0_1_pin_8_9_modemux[] = {
  1869. {
  1870. .modes = EXTENDED_MODE,
  1871. .muxregs = pwm0_1_pin_8_9_muxreg,
  1872. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_8_9_muxreg),
  1873. },
  1874. };
  1875. static struct spear_modemux pwm0_1_pin_14_15_modemux[] = {
  1876. {
  1877. .modes = AUTO_EXP_MODE | SMALL_PRINTERS_MODE | EXTENDED_MODE,
  1878. .muxregs = pwm0_1_autoexpsmallpri_muxreg,
  1879. .nmuxregs = ARRAY_SIZE(pwm0_1_autoexpsmallpri_muxreg),
  1880. }, {
  1881. .modes = EXTENDED_MODE,
  1882. .muxregs = pwm0_1_pin_14_15_muxreg,
  1883. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_14_15_muxreg),
  1884. },
  1885. };
  1886. static struct spear_modemux pwm0_1_pin_30_31_modemux[] = {
  1887. {
  1888. .modes = EXTENDED_MODE,
  1889. .muxregs = pwm0_1_pin_30_31_muxreg,
  1890. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_30_31_muxreg),
  1891. },
  1892. };
  1893. static struct spear_modemux pwm0_1_pin_37_38_modemux[] = {
  1894. {
  1895. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | EXTENDED_MODE,
  1896. .muxregs = pwm0_1_net_muxreg,
  1897. .nmuxregs = ARRAY_SIZE(pwm0_1_net_muxreg),
  1898. }, {
  1899. .modes = EXTENDED_MODE,
  1900. .muxregs = pwm0_1_pin_37_38_muxreg,
  1901. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_37_38_muxreg),
  1902. },
  1903. };
  1904. static struct spear_modemux pwm0_1_pin_42_43_modemux[] = {
  1905. {
  1906. .modes = EXTENDED_MODE,
  1907. .muxregs = pwm0_1_pin_42_43_muxreg,
  1908. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_42_43_muxreg),
  1909. },
  1910. };
  1911. static struct spear_modemux pwm0_1_pin_59_60_modemux[] = {
  1912. {
  1913. .modes = EXTENDED_MODE,
  1914. .muxregs = pwm0_1_pin_59_60_muxreg,
  1915. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_59_60_muxreg),
  1916. },
  1917. };
  1918. static struct spear_modemux pwm0_1_pin_88_89_modemux[] = {
  1919. {
  1920. .modes = EXTENDED_MODE,
  1921. .muxregs = pwm0_1_pin_88_89_muxreg,
  1922. .nmuxregs = ARRAY_SIZE(pwm0_1_pin_88_89_muxreg),
  1923. },
  1924. };
  1925. static struct spear_pingroup pwm0_1_pingroup[] = {
  1926. {
  1927. .name = "pwm0_1_pin_8_9_grp",
  1928. .pins = pwm0_1_pins[0],
  1929. .npins = ARRAY_SIZE(pwm0_1_pins[0]),
  1930. .modemuxs = pwm0_1_pin_8_9_modemux,
  1931. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_8_9_modemux),
  1932. }, {
  1933. .name = "pwm0_1_pin_14_15_grp",
  1934. .pins = pwm0_1_pins[1],
  1935. .npins = ARRAY_SIZE(pwm0_1_pins[1]),
  1936. .modemuxs = pwm0_1_pin_14_15_modemux,
  1937. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_14_15_modemux),
  1938. }, {
  1939. .name = "pwm0_1_pin_30_31_grp",
  1940. .pins = pwm0_1_pins[2],
  1941. .npins = ARRAY_SIZE(pwm0_1_pins[2]),
  1942. .modemuxs = pwm0_1_pin_30_31_modemux,
  1943. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_30_31_modemux),
  1944. }, {
  1945. .name = "pwm0_1_pin_37_38_grp",
  1946. .pins = pwm0_1_pins[3],
  1947. .npins = ARRAY_SIZE(pwm0_1_pins[3]),
  1948. .modemuxs = pwm0_1_pin_37_38_modemux,
  1949. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_37_38_modemux),
  1950. }, {
  1951. .name = "pwm0_1_pin_42_43_grp",
  1952. .pins = pwm0_1_pins[4],
  1953. .npins = ARRAY_SIZE(pwm0_1_pins[4]),
  1954. .modemuxs = pwm0_1_pin_42_43_modemux,
  1955. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_42_43_modemux),
  1956. }, {
  1957. .name = "pwm0_1_pin_59_60_grp",
  1958. .pins = pwm0_1_pins[5],
  1959. .npins = ARRAY_SIZE(pwm0_1_pins[5]),
  1960. .modemuxs = pwm0_1_pin_59_60_modemux,
  1961. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_59_60_modemux),
  1962. }, {
  1963. .name = "pwm0_1_pin_88_89_grp",
  1964. .pins = pwm0_1_pins[6],
  1965. .npins = ARRAY_SIZE(pwm0_1_pins[6]),
  1966. .modemuxs = pwm0_1_pin_88_89_modemux,
  1967. .nmodemuxs = ARRAY_SIZE(pwm0_1_pin_88_89_modemux),
  1968. },
  1969. };
  1970. static const char *const pwm0_1_grps[] = { "pwm0_1_pin_8_9_grp",
  1971. "pwm0_1_pin_14_15_grp", "pwm0_1_pin_30_31_grp", "pwm0_1_pin_37_38_grp",
  1972. "pwm0_1_pin_42_43_grp", "pwm0_1_pin_59_60_grp", "pwm0_1_pin_88_89_grp"
  1973. };
  1974. static struct spear_function pwm0_1_function = {
  1975. .name = "pwm0_1",
  1976. .groups = pwm0_1_grps,
  1977. .ngroups = ARRAY_SIZE(pwm0_1_grps),
  1978. };
  1979. /* Pad multiplexing for PWM2 device */
  1980. static const unsigned pwm2_pins[][1] = { { 7 }, { 13 }, { 29 }, { 34 }, { 41 },
  1981. { 58 }, { 87 } };
  1982. static struct spear_muxreg pwm2_net_muxreg[] = {
  1983. {
  1984. .reg = PMX_CONFIG_REG,
  1985. .mask = PMX_SSP_CS_MASK,
  1986. .val = 0,
  1987. },
  1988. };
  1989. static struct spear_muxreg pwm2_pin_7_muxreg[] = {
  1990. {
  1991. .reg = IP_SEL_PAD_0_9_REG,
  1992. .mask = PMX_PL_7_MASK,
  1993. .val = PMX_PWM_2_PL_7_VAL,
  1994. },
  1995. };
  1996. static struct spear_muxreg pwm2_autoexpsmallpri_muxreg[] = {
  1997. {
  1998. .reg = PMX_CONFIG_REG,
  1999. .mask = PMX_MII_MASK,
  2000. .val = 0,
  2001. },
  2002. };
  2003. static struct spear_muxreg pwm2_pin_13_muxreg[] = {
  2004. {
  2005. .reg = IP_SEL_PAD_10_19_REG,
  2006. .mask = PMX_PL_13_MASK,
  2007. .val = PMX_PWM2_PL_13_VAL,
  2008. },
  2009. };
  2010. static struct spear_muxreg pwm2_pin_29_muxreg[] = {
  2011. {
  2012. .reg = PMX_CONFIG_REG,
  2013. .mask = PMX_GPIO_PIN1_MASK,
  2014. .val = 0,
  2015. }, {
  2016. .reg = IP_SEL_PAD_20_29_REG,
  2017. .mask = PMX_PL_29_MASK,
  2018. .val = PMX_PWM_2_PL_29_VAL,
  2019. },
  2020. };
  2021. static struct spear_muxreg pwm2_pin_34_muxreg[] = {
  2022. {
  2023. .reg = PMX_CONFIG_REG,
  2024. .mask = PMX_SSP_CS_MASK,
  2025. .val = 0,
  2026. }, {
  2027. .reg = MODE_CONFIG_REG,
  2028. .mask = PMX_PWM_MASK,
  2029. .val = PMX_PWM_MASK,
  2030. }, {
  2031. .reg = IP_SEL_PAD_30_39_REG,
  2032. .mask = PMX_PL_34_MASK,
  2033. .val = PMX_PWM2_PL_34_VAL,
  2034. },
  2035. };
  2036. static struct spear_muxreg pwm2_pin_41_muxreg[] = {
  2037. {
  2038. .reg = PMX_CONFIG_REG,
  2039. .mask = PMX_UART0_MODEM_MASK,
  2040. .val = 0,
  2041. }, {
  2042. .reg = IP_SEL_PAD_40_49_REG,
  2043. .mask = PMX_PL_41_MASK,
  2044. .val = PMX_PWM2_PL_41_VAL,
  2045. },
  2046. };
  2047. static struct spear_muxreg pwm2_pin_58_muxreg[] = {
  2048. {
  2049. .reg = IP_SEL_PAD_50_59_REG,
  2050. .mask = PMX_PL_58_MASK,
  2051. .val = PMX_PWM2_PL_58_VAL,
  2052. },
  2053. };
  2054. static struct spear_muxreg pwm2_pin_87_muxreg[] = {
  2055. {
  2056. .reg = IP_SEL_PAD_80_89_REG,
  2057. .mask = PMX_PL_87_MASK,
  2058. .val = PMX_PWM2_PL_87_VAL,
  2059. },
  2060. };
  2061. static struct spear_modemux pwm2_pin_7_modemux[] = {
  2062. {
  2063. .modes = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | EXTENDED_MODE,
  2064. .muxregs = pwm2_net_muxreg,
  2065. .nmuxregs = ARRAY_SIZE(pwm2_net_muxreg),
  2066. }, {
  2067. .modes = EXTENDED_MODE,
  2068. .muxregs = pwm2_pin_7_muxreg,
  2069. .nmuxregs = ARRAY_SIZE(pwm2_pin_7_muxreg),
  2070. },
  2071. };
  2072. static struct spear_modemux pwm2_pin_13_modemux[] = {
  2073. {
  2074. .modes = AUTO_EXP_MODE | SMALL_PRINTERS_MODE | EXTENDED_MODE,
  2075. .muxregs = pwm2_autoexpsmallpri_muxreg,
  2076. .nmuxregs = ARRAY_SIZE(pwm2_autoexpsmallpri_muxreg),
  2077. }, {
  2078. .modes = EXTENDED_MODE,
  2079. .muxregs = pwm2_pin_13_muxreg,
  2080. .nmuxregs = ARRAY_SIZE(pwm2_pin_13_muxreg),
  2081. },
  2082. };
  2083. static struct spear_modemux pwm2_pin_29_modemux[] = {
  2084. {
  2085. .modes = EXTENDED_MODE,
  2086. .muxregs = pwm2_pin_29_muxreg,
  2087. .nmuxregs = ARRAY_SIZE(pwm2_pin_29_muxreg),
  2088. },
  2089. };
  2090. static struct spear_modemux pwm2_pin_34_modemux[] = {
  2091. {
  2092. .modes = EXTENDED_MODE,
  2093. .muxregs = pwm2_pin_34_muxreg,
  2094. .nmuxregs = ARRAY_SIZE(pwm2_pin_34_muxreg),
  2095. },
  2096. };
  2097. static struct spear_modemux pwm2_pin_41_modemux[] = {
  2098. {
  2099. .modes = EXTENDED_MODE,
  2100. .muxregs = pwm2_pin_41_muxreg,
  2101. .nmuxregs = ARRAY_SIZE(pwm2_pin_41_muxreg),
  2102. },
  2103. };
  2104. static struct spear_modemux pwm2_pin_58_modemux[] = {
  2105. {
  2106. .modes = EXTENDED_MODE,
  2107. .muxregs = pwm2_pin_58_muxreg,
  2108. .nmuxregs = ARRAY_SIZE(pwm2_pin_58_muxreg),
  2109. },
  2110. };
  2111. static struct spear_modemux pwm2_pin_87_modemux[] = {
  2112. {
  2113. .modes = EXTENDED_MODE,
  2114. .muxregs = pwm2_pin_87_muxreg,
  2115. .nmuxregs = ARRAY_SIZE(pwm2_pin_87_muxreg),
  2116. },
  2117. };
  2118. static struct spear_pingroup pwm2_pingroup[] = {
  2119. {
  2120. .name = "pwm2_pin_7_grp",
  2121. .pins = pwm2_pins[0],
  2122. .npins = ARRAY_SIZE(pwm2_pins[0]),
  2123. .modemuxs = pwm2_pin_7_modemux,
  2124. .nmodemuxs = ARRAY_SIZE(pwm2_pin_7_modemux),
  2125. }, {
  2126. .name = "pwm2_pin_13_grp",
  2127. .pins = pwm2_pins[1],
  2128. .npins = ARRAY_SIZE(pwm2_pins[1]),
  2129. .modemuxs = pwm2_pin_13_modemux,
  2130. .nmodemuxs = ARRAY_SIZE(pwm2_pin_13_modemux),
  2131. }, {
  2132. .name = "pwm2_pin_29_grp",
  2133. .pins = pwm2_pins[2],
  2134. .npins = ARRAY_SIZE(pwm2_pins[2]),
  2135. .modemuxs = pwm2_pin_29_modemux,
  2136. .nmodemuxs = ARRAY_SIZE(pwm2_pin_29_modemux),
  2137. }, {
  2138. .name = "pwm2_pin_34_grp",
  2139. .pins = pwm2_pins[3],
  2140. .npins = ARRAY_SIZE(pwm2_pins[3]),
  2141. .modemuxs = pwm2_pin_34_modemux,
  2142. .nmodemuxs = ARRAY_SIZE(pwm2_pin_34_modemux),
  2143. }, {
  2144. .name = "pwm2_pin_41_grp",
  2145. .pins = pwm2_pins[4],
  2146. .npins = ARRAY_SIZE(pwm2_pins[4]),
  2147. .modemuxs = pwm2_pin_41_modemux,
  2148. .nmodemuxs = ARRAY_SIZE(pwm2_pin_41_modemux),
  2149. }, {
  2150. .name = "pwm2_pin_58_grp",
  2151. .pins = pwm2_pins[5],
  2152. .npins = ARRAY_SIZE(pwm2_pins[5]),
  2153. .modemuxs = pwm2_pin_58_modemux,
  2154. .nmodemuxs = ARRAY_SIZE(pwm2_pin_58_modemux),
  2155. }, {
  2156. .name = "pwm2_pin_87_grp",
  2157. .pins = pwm2_pins[6],
  2158. .npins = ARRAY_SIZE(pwm2_pins[6]),
  2159. .modemuxs = pwm2_pin_87_modemux,
  2160. .nmodemuxs = ARRAY_SIZE(pwm2_pin_87_modemux),
  2161. },
  2162. };
  2163. static const char *const pwm2_grps[] = { "pwm2_pin_7_grp", "pwm2_pin_13_grp",
  2164. "pwm2_pin_29_grp", "pwm2_pin_34_grp", "pwm2_pin_41_grp",
  2165. "pwm2_pin_58_grp", "pwm2_pin_87_grp" };
  2166. static struct spear_function pwm2_function = {
  2167. .name = "pwm2",
  2168. .groups = pwm2_grps,
  2169. .ngroups = ARRAY_SIZE(pwm2_grps),
  2170. };
  2171. /* Pad multiplexing for PWM3 device */
  2172. static const unsigned pwm3_pins[][1] = { { 6 }, { 12 }, { 28 }, { 40 }, { 57 },
  2173. { 86 } };
  2174. static struct spear_muxreg pwm3_pin_6_muxreg[] = {
  2175. {
  2176. .reg = PMX_CONFIG_REG,
  2177. .mask = PMX_SSP_MASK,
  2178. .val = 0,
  2179. }, {
  2180. .reg = IP_SEL_PAD_0_9_REG,
  2181. .mask = PMX_PL_6_MASK,
  2182. .val = PMX_PWM_3_PL_6_VAL,
  2183. },
  2184. };
  2185. static struct spear_muxreg pwm3_muxreg[] = {
  2186. {
  2187. .reg = PMX_CONFIG_REG,
  2188. .mask = PMX_MII_MASK,
  2189. .val = 0,
  2190. },
  2191. };
  2192. static struct spear_muxreg pwm3_pin_12_muxreg[] = {
  2193. {
  2194. .reg = IP_SEL_PAD_10_19_REG,
  2195. .mask = PMX_PL_12_MASK,
  2196. .val = PMX_PWM3_PL_12_VAL,
  2197. },
  2198. };
  2199. static struct spear_muxreg pwm3_pin_28_muxreg[] = {
  2200. {
  2201. .reg = PMX_CONFIG_REG,
  2202. .mask = PMX_GPIO_PIN0_MASK,
  2203. .val = 0,
  2204. }, {
  2205. .reg = IP_SEL_PAD_20_29_REG,
  2206. .mask = PMX_PL_28_MASK,
  2207. .val = PMX_PWM_3_PL_28_VAL,
  2208. },
  2209. };
  2210. static struct spear_muxreg pwm3_pin_40_muxreg[] = {
  2211. {
  2212. .reg = PMX_CONFIG_REG,
  2213. .mask = PMX_UART0_MODEM_MASK,
  2214. .val = 0,
  2215. }, {
  2216. .reg = IP_SEL_PAD_40_49_REG,
  2217. .mask = PMX_PL_40_MASK,
  2218. .val = PMX_PWM3_PL_40_VAL,
  2219. },
  2220. };
  2221. static struct spear_muxreg pwm3_pin_57_muxreg[] = {
  2222. {
  2223. .reg = IP_SEL_PAD_50_59_REG,
  2224. .mask = PMX_PL_57_MASK,
  2225. .val = PMX_PWM3_PL_57_VAL,
  2226. },
  2227. };
  2228. static struct spear_muxreg pwm3_pin_86_muxreg[] = {
  2229. {
  2230. .reg = IP_SEL_PAD_80_89_REG,
  2231. .mask = PMX_PL_86_MASK,
  2232. .val = PMX_PWM3_PL_86_VAL,
  2233. },
  2234. };
  2235. static struct spear_modemux pwm3_pin_6_modemux[] = {
  2236. {
  2237. .modes = EXTENDED_MODE,
  2238. .muxregs = pwm3_pin_6_muxreg,
  2239. .nmuxregs = ARRAY_SIZE(pwm3_pin_6_muxreg),
  2240. },
  2241. };
  2242. static struct spear_modemux pwm3_pin_12_modemux[] = {
  2243. {
  2244. .modes = AUTO_EXP_MODE | SMALL_PRINTERS_MODE |
  2245. AUTO_NET_SMII_MODE | EXTENDED_MODE,
  2246. .muxregs = pwm3_muxreg,
  2247. .nmuxregs = ARRAY_SIZE(pwm3_muxreg),
  2248. }, {
  2249. .modes = EXTENDED_MODE,
  2250. .muxregs = pwm3_pin_12_muxreg,
  2251. .nmuxregs = ARRAY_SIZE(pwm3_pin_12_muxreg),
  2252. },
  2253. };
  2254. static struct spear_modemux pwm3_pin_28_modemux[] = {
  2255. {
  2256. .modes = EXTENDED_MODE,
  2257. .muxregs = pwm3_pin_28_muxreg,
  2258. .nmuxregs = ARRAY_SIZE(pwm3_pin_28_muxreg),
  2259. },
  2260. };
  2261. static struct spear_modemux pwm3_pin_40_modemux[] = {
  2262. {
  2263. .modes = EXTENDED_MODE,
  2264. .muxregs = pwm3_pin_40_muxreg,
  2265. .nmuxregs = ARRAY_SIZE(pwm3_pin_40_muxreg),
  2266. },
  2267. };
  2268. static struct spear_modemux pwm3_pin_57_modemux[] = {
  2269. {
  2270. .modes = EXTENDED_MODE,
  2271. .muxregs = pwm3_pin_57_muxreg,
  2272. .nmuxregs = ARRAY_SIZE(pwm3_pin_57_muxreg),
  2273. },
  2274. };
  2275. static struct spear_modemux pwm3_pin_86_modemux[] = {
  2276. {
  2277. .modes = EXTENDED_MODE,
  2278. .muxregs = pwm3_pin_86_muxreg,
  2279. .nmuxregs = ARRAY_SIZE(pwm3_pin_86_muxreg),
  2280. },
  2281. };
  2282. static struct spear_pingroup pwm3_pingroup[] = {
  2283. {
  2284. .name = "pwm3_pin_6_grp",
  2285. .pins = pwm3_pins[0],
  2286. .npins = ARRAY_SIZE(pwm3_pins[0]),
  2287. .modemuxs = pwm3_pin_6_modemux,
  2288. .nmodemuxs = ARRAY_SIZE(pwm3_pin_6_modemux),
  2289. }, {
  2290. .name = "pwm3_pin_12_grp",
  2291. .pins = pwm3_pins[1],
  2292. .npins = ARRAY_SIZE(pwm3_pins[1]),
  2293. .modemuxs = pwm3_pin_12_modemux,
  2294. .nmodemuxs = ARRAY_SIZE(pwm3_pin_12_modemux),
  2295. }, {
  2296. .name = "pwm3_pin_28_grp",
  2297. .pins = pwm3_pins[2],
  2298. .npins = ARRAY_SIZE(pwm3_pins[2]),
  2299. .modemuxs = pwm3_pin_28_modemux,
  2300. .nmodemuxs = ARRAY_SIZE(pwm3_pin_28_modemux),
  2301. }, {
  2302. .name = "pwm3_pin_40_grp",
  2303. .pins = pwm3_pins[3],
  2304. .npins = ARRAY_SIZE(pwm3_pins[3]),
  2305. .modemuxs = pwm3_pin_40_modemux,
  2306. .nmodemuxs = ARRAY_SIZE(pwm3_pin_40_modemux),
  2307. }, {
  2308. .name = "pwm3_pin_57_grp",
  2309. .pins = pwm3_pins[4],
  2310. .npins = ARRAY_SIZE(pwm3_pins[4]),
  2311. .modemuxs = pwm3_pin_57_modemux,
  2312. .nmodemuxs = ARRAY_SIZE(pwm3_pin_57_modemux),
  2313. }, {
  2314. .name = "pwm3_pin_86_grp",
  2315. .pins = pwm3_pins[5],
  2316. .npins = ARRAY_SIZE(pwm3_pins[5]),
  2317. .modemuxs = pwm3_pin_86_modemux,
  2318. .nmodemuxs = ARRAY_SIZE(pwm3_pin_86_modemux),
  2319. },
  2320. };
  2321. static const char *const pwm3_grps[] = { "pwm3_pin_6_grp", "pwm3_pin_12_grp",
  2322. "pwm3_pin_28_grp", "pwm3_pin_40_grp", "pwm3_pin_57_grp",
  2323. "pwm3_pin_86_grp" };
  2324. static struct spear_function pwm3_function = {
  2325. .name = "pwm3",
  2326. .groups = pwm3_grps,
  2327. .ngroups = ARRAY_SIZE(pwm3_grps),
  2328. };
  2329. /* Pad multiplexing for SSP1 device */
  2330. static const unsigned ssp1_pins[][2] = { { 17, 20 }, { 36, 39 }, { 48, 51 },
  2331. { 65, 68 }, { 94, 97 } };
  2332. static struct spear_muxreg ssp1_muxreg[] = {
  2333. {
  2334. .reg = PMX_CONFIG_REG,
  2335. .mask = PMX_MII_MASK,
  2336. .val = 0,
  2337. },
  2338. };
  2339. static struct spear_muxreg ssp1_ext_17_20_muxreg[] = {
  2340. {
  2341. .reg = IP_SEL_PAD_10_19_REG,
  2342. .mask = PMX_PL_17_18_MASK | PMX_PL_19_MASK,
  2343. .val = PMX_SSP1_PL_17_18_19_20_VAL,
  2344. }, {
  2345. .reg = IP_SEL_PAD_20_29_REG,
  2346. .mask = PMX_PL_20_MASK,
  2347. .val = PMX_SSP1_PL_17_18_19_20_VAL,
  2348. }, {
  2349. .reg = IP_SEL_MIX_PAD_REG,
  2350. .mask = PMX_SSP1_PORT_SEL_MASK,
  2351. .val = PMX_SSP1_PORT_17_TO_20_VAL,
  2352. },
  2353. };
  2354. static struct spear_muxreg ssp1_ext_36_39_muxreg[] = {
  2355. {
  2356. .reg = PMX_CONFIG_REG,
  2357. .mask = PMX_UART0_MODEM_MASK | PMX_SSP_CS_MASK,
  2358. .val = 0,
  2359. }, {
  2360. .reg = IP_SEL_PAD_30_39_REG,
  2361. .mask = PMX_PL_36_MASK | PMX_PL_37_38_MASK | PMX_PL_39_MASK,
  2362. .val = PMX_SSP1_PL_36_VAL | PMX_SSP1_PL_37_38_VAL |
  2363. PMX_SSP1_PL_39_VAL,
  2364. }, {
  2365. .reg = IP_SEL_MIX_PAD_REG,
  2366. .mask = PMX_SSP1_PORT_SEL_MASK,
  2367. .val = PMX_SSP1_PORT_36_TO_39_VAL,
  2368. },
  2369. };
  2370. static struct spear_muxreg ssp1_ext_48_51_muxreg[] = {
  2371. {
  2372. .reg = PMX_CONFIG_REG,
  2373. .mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK,
  2374. .val = 0,
  2375. }, {
  2376. .reg = IP_SEL_PAD_40_49_REG,
  2377. .mask = PMX_PL_48_49_MASK,
  2378. .val = PMX_SSP1_PL_48_49_VAL,
  2379. }, {
  2380. .reg = IP_SEL_PAD_50_59_REG,
  2381. .mask = PMX_PL_50_51_MASK,
  2382. .val = PMX_SSP1_PL_50_51_VAL,
  2383. }, {
  2384. .reg = IP_SEL_MIX_PAD_REG,
  2385. .mask = PMX_SSP1_PORT_SEL_MASK,
  2386. .val = PMX_SSP1_PORT_48_TO_51_VAL,
  2387. },
  2388. };
  2389. static struct spear_muxreg ssp1_ext_65_68_muxreg[] = {
  2390. {
  2391. .reg = IP_SEL_PAD_60_69_REG,
  2392. .mask = PMX_PL_65_TO_68_MASK,
  2393. .val = PMX_SSP1_PL_65_TO_68_VAL,
  2394. }, {
  2395. .reg = IP_SEL_MIX_PAD_REG,
  2396. .mask = PMX_SSP1_PORT_SEL_MASK,
  2397. .val = PMX_SSP1_PORT_65_TO_68_VAL,
  2398. },
  2399. };
  2400. static struct spear_muxreg ssp1_ext_94_97_muxreg[] = {
  2401. {
  2402. .reg = IP_SEL_PAD_90_99_REG,
  2403. .mask = PMX_PL_94_95_MASK | PMX_PL_96_97_MASK,
  2404. .val = PMX_SSP1_PL_94_95_VAL | PMX_SSP1_PL_96_97_VAL,
  2405. }, {
  2406. .reg = IP_SEL_MIX_PAD_REG,
  2407. .mask = PMX_SSP1_PORT_SEL_MASK,
  2408. .val = PMX_SSP1_PORT_94_TO_97_VAL,
  2409. },
  2410. };
  2411. static struct spear_modemux ssp1_17_20_modemux[] = {
  2412. {
  2413. .modes = SMALL_PRINTERS_MODE | AUTO_NET_SMII_MODE |
  2414. EXTENDED_MODE,
  2415. .muxregs = ssp1_muxreg,
  2416. .nmuxregs = ARRAY_SIZE(ssp1_muxreg),
  2417. }, {
  2418. .modes = EXTENDED_MODE,
  2419. .muxregs = ssp1_ext_17_20_muxreg,
  2420. .nmuxregs = ARRAY_SIZE(ssp1_ext_17_20_muxreg),
  2421. },
  2422. };
  2423. static struct spear_modemux ssp1_36_39_modemux[] = {
  2424. {
  2425. .modes = EXTENDED_MODE,
  2426. .muxregs = ssp1_ext_36_39_muxreg,
  2427. .nmuxregs = ARRAY_SIZE(ssp1_ext_36_39_muxreg),
  2428. },
  2429. };
  2430. static struct spear_modemux ssp1_48_51_modemux[] = {
  2431. {
  2432. .modes = EXTENDED_MODE,
  2433. .muxregs = ssp1_ext_48_51_muxreg,
  2434. .nmuxregs = ARRAY_SIZE(ssp1_ext_48_51_muxreg),
  2435. },
  2436. };
  2437. static struct spear_modemux ssp1_65_68_modemux[] = {
  2438. {
  2439. .modes = EXTENDED_MODE,
  2440. .muxregs = ssp1_ext_65_68_muxreg,
  2441. .nmuxregs = ARRAY_SIZE(ssp1_ext_65_68_muxreg),
  2442. },
  2443. };
  2444. static struct spear_modemux ssp1_94_97_modemux[] = {
  2445. {
  2446. .modes = EXTENDED_MODE,
  2447. .muxregs = ssp1_ext_94_97_muxreg,
  2448. .nmuxregs = ARRAY_SIZE(ssp1_ext_94_97_muxreg),
  2449. },
  2450. };
  2451. static struct spear_pingroup ssp1_pingroup[] = {
  2452. {
  2453. .name = "ssp1_17_20_grp",
  2454. .pins = ssp1_pins[0],
  2455. .npins = ARRAY_SIZE(ssp1_pins[0]),
  2456. .modemuxs = ssp1_17_20_modemux,
  2457. .nmodemuxs = ARRAY_SIZE(ssp1_17_20_modemux),
  2458. }, {
  2459. .name = "ssp1_36_39_grp",
  2460. .pins = ssp1_pins[1],
  2461. .npins = ARRAY_SIZE(ssp1_pins[1]),
  2462. .modemuxs = ssp1_36_39_modemux,
  2463. .nmodemuxs = ARRAY_SIZE(ssp1_36_39_modemux),
  2464. }, {
  2465. .name = "ssp1_48_51_grp",
  2466. .pins = ssp1_pins[2],
  2467. .npins = ARRAY_SIZE(ssp1_pins[2]),
  2468. .modemuxs = ssp1_48_51_modemux,
  2469. .nmodemuxs = ARRAY_SIZE(ssp1_48_51_modemux),
  2470. }, {
  2471. .name = "ssp1_65_68_grp",
  2472. .pins = ssp1_pins[3],
  2473. .npins = ARRAY_SIZE(ssp1_pins[3]),
  2474. .modemuxs = ssp1_65_68_modemux,
  2475. .nmodemuxs = ARRAY_SIZE(ssp1_65_68_modemux),
  2476. }, {
  2477. .name = "ssp1_94_97_grp",
  2478. .pins = ssp1_pins[4],
  2479. .npins = ARRAY_SIZE(ssp1_pins[4]),
  2480. .modemuxs = ssp1_94_97_modemux,
  2481. .nmodemuxs = ARRAY_SIZE(ssp1_94_97_modemux),
  2482. },
  2483. };
  2484. static const char *const ssp1_grps[] = { "ssp1_17_20_grp", "ssp1_36_39_grp",
  2485. "ssp1_48_51_grp", "ssp1_65_68_grp", "ssp1_94_97_grp"
  2486. };
  2487. static struct spear_function ssp1_function = {
  2488. .name = "ssp1",
  2489. .groups = ssp1_grps,
  2490. .ngroups = ARRAY_SIZE(ssp1_grps),
  2491. };
  2492. /* Pad multiplexing for SSP2 device */
  2493. static const unsigned ssp2_pins[][2] = { { 13, 16 }, { 32, 35 }, { 44, 47 },
  2494. { 61, 64 }, { 90, 93 } };
  2495. static struct spear_muxreg ssp2_muxreg[] = {
  2496. {
  2497. .reg = PMX_CONFIG_REG,
  2498. .mask = PMX_MII_MASK,
  2499. .val = 0,
  2500. },
  2501. };
  2502. static struct spear_muxreg ssp2_ext_13_16_muxreg[] = {
  2503. {
  2504. .reg = IP_SEL_PAD_10_19_REG,
  2505. .mask = PMX_PL_13_14_MASK | PMX_PL_15_16_MASK,
  2506. .val = PMX_SSP2_PL_13_14_15_16_VAL,
  2507. }, {
  2508. .reg = IP_SEL_MIX_PAD_REG,
  2509. .mask = PMX_SSP2_PORT_SEL_MASK,
  2510. .val = PMX_SSP2_PORT_13_TO_16_VAL,
  2511. },
  2512. };
  2513. static struct spear_muxreg ssp2_ext_32_35_muxreg[] = {
  2514. {
  2515. .reg = PMX_CONFIG_REG,
  2516. .mask = PMX_SSP_CS_MASK | PMX_GPIO_PIN4_MASK |
  2517. PMX_GPIO_PIN5_MASK,
  2518. .val = 0,
  2519. }, {
  2520. .reg = IP_SEL_PAD_30_39_REG,
  2521. .mask = PMX_PL_32_33_MASK | PMX_PL_34_MASK | PMX_PL_35_MASK,
  2522. .val = PMX_SSP2_PL_32_33_VAL | PMX_SSP2_PL_34_VAL |
  2523. PMX_SSP2_PL_35_VAL,
  2524. }, {
  2525. .reg = IP_SEL_MIX_PAD_REG,
  2526. .mask = PMX_SSP2_PORT_SEL_MASK,
  2527. .val = PMX_SSP2_PORT_32_TO_35_VAL,
  2528. },
  2529. };
  2530. static struct spear_muxreg ssp2_ext_44_47_muxreg[] = {
  2531. {
  2532. .reg = PMX_CONFIG_REG,
  2533. .mask = PMX_TIMER_0_1_MASK | PMX_TIMER_2_3_MASK,
  2534. .val = 0,
  2535. }, {
  2536. .reg = IP_SEL_PAD_40_49_REG,
  2537. .mask = PMX_PL_44_45_MASK | PMX_PL_46_47_MASK,
  2538. .val = PMX_SSP2_PL_44_45_VAL | PMX_SSP2_PL_46_47_VAL,
  2539. }, {
  2540. .reg = IP_SEL_MIX_PAD_REG,
  2541. .mask = PMX_SSP2_PORT_SEL_MASK,
  2542. .val = PMX_SSP2_PORT_44_TO_47_VAL,
  2543. },
  2544. };
  2545. static struct spear_muxreg ssp2_ext_61_64_muxreg[] = {
  2546. {
  2547. .reg = IP_SEL_PAD_60_69_REG,
  2548. .mask = PMX_PL_61_TO_64_MASK,
  2549. .val = PMX_SSP2_PL_61_TO_64_VAL,
  2550. }, {
  2551. .reg = IP_SEL_MIX_PAD_REG,
  2552. .mask = PMX_SSP2_PORT_SEL_MASK,
  2553. .val = PMX_SSP2_PORT_61_TO_64_VAL,
  2554. },
  2555. };
  2556. static struct spear_muxreg ssp2_ext_90_93_muxreg[] = {
  2557. {
  2558. .reg = IP_SEL_PAD_90_99_REG,
  2559. .mask = PMX_PL_90_91_MASK | PMX_PL_92_93_MASK,
  2560. .val = PMX_SSP2_PL_90_91_VAL | PMX_SSP2_PL_92_93_VAL,
  2561. }, {
  2562. .reg = IP_SEL_MIX_PAD_REG,
  2563. .mask = PMX_SSP2_PORT_SEL_MASK,
  2564. .val = PMX_SSP2_PORT_90_TO_93_VAL,
  2565. },
  2566. };
  2567. static struct spear_modemux ssp2_13_16_modemux[] = {
  2568. {
  2569. .modes = AUTO_NET_SMII_MODE | EXTENDED_MODE,
  2570. .muxregs = ssp2_muxreg,
  2571. .nmuxregs = ARRAY_SIZE(ssp2_muxreg),
  2572. }, {
  2573. .modes = EXTENDED_MODE,
  2574. .muxregs = ssp2_ext_13_16_muxreg,
  2575. .nmuxregs = ARRAY_SIZE(ssp2_ext_13_16_muxreg),
  2576. },
  2577. };
  2578. static struct spear_modemux ssp2_32_35_modemux[] = {
  2579. {
  2580. .modes = EXTENDED_MODE,
  2581. .muxregs = ssp2_ext_32_35_muxreg,
  2582. .nmuxregs = ARRAY_SIZE(ssp2_ext_32_35_muxreg),
  2583. },
  2584. };
  2585. static struct spear_modemux ssp2_44_47_modemux[] = {
  2586. {
  2587. .modes = EXTENDED_MODE,
  2588. .muxregs = ssp2_ext_44_47_muxreg,
  2589. .nmuxregs = ARRAY_SIZE(ssp2_ext_44_47_muxreg),
  2590. },
  2591. };
  2592. static struct spear_modemux ssp2_61_64_modemux[] = {
  2593. {
  2594. .modes = EXTENDED_MODE,
  2595. .muxregs = ssp2_ext_61_64_muxreg,
  2596. .nmuxregs = ARRAY_SIZE(ssp2_ext_61_64_muxreg),
  2597. },
  2598. };
  2599. static struct spear_modemux ssp2_90_93_modemux[] = {
  2600. {
  2601. .modes = EXTENDED_MODE,
  2602. .muxregs = ssp2_ext_90_93_muxreg,
  2603. .nmuxregs = ARRAY_SIZE(ssp2_ext_90_93_muxreg),
  2604. },
  2605. };
  2606. static struct spear_pingroup ssp2_pingroup[] = {
  2607. {
  2608. .name = "ssp2_13_16_grp",
  2609. .pins = ssp2_pins[0],
  2610. .npins = ARRAY_SIZE(ssp2_pins[0]),
  2611. .modemuxs = ssp2_13_16_modemux,
  2612. .nmodemuxs = ARRAY_SIZE(ssp2_13_16_modemux),
  2613. }, {
  2614. .name = "ssp2_32_35_grp",
  2615. .pins = ssp2_pins[1],
  2616. .npins = ARRAY_SIZE(ssp2_pins[1]),
  2617. .modemuxs = ssp2_32_35_modemux,
  2618. .nmodemuxs = ARRAY_SIZE(ssp2_32_35_modemux),
  2619. }, {
  2620. .name = "ssp2_44_47_grp",
  2621. .pins = ssp2_pins[2],
  2622. .npins = ARRAY_SIZE(ssp2_pins[2]),
  2623. .modemuxs = ssp2_44_47_modemux,
  2624. .nmodemuxs = ARRAY_SIZE(ssp2_44_47_modemux),
  2625. }, {
  2626. .name = "ssp2_61_64_grp",
  2627. .pins = ssp2_pins[3],
  2628. .npins = ARRAY_SIZE(ssp2_pins[3]),
  2629. .modemuxs = ssp2_61_64_modemux,
  2630. .nmodemuxs = ARRAY_SIZE(ssp2_61_64_modemux),
  2631. }, {
  2632. .name = "ssp2_90_93_grp",
  2633. .pins = ssp2_pins[4],
  2634. .npins = ARRAY_SIZE(ssp2_pins[4]),
  2635. .modemuxs = ssp2_90_93_modemux,
  2636. .nmodemuxs = ARRAY_SIZE(ssp2_90_93_modemux),
  2637. },
  2638. };
  2639. static const char *const ssp2_grps[] = { "ssp2_13_16_grp", "ssp2_32_35_grp",
  2640. "ssp2_44_47_grp", "ssp2_61_64_grp", "ssp2_90_93_grp" };
  2641. static struct spear_function ssp2_function = {
  2642. .name = "ssp2",
  2643. .groups = ssp2_grps,
  2644. .ngroups = ARRAY_SIZE(ssp2_grps),
  2645. };
  2646. /* Pad multiplexing for cadence mii2 as mii device */
  2647. static const unsigned mii2_pins[] = { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
  2648. 90, 91, 92, 93, 94, 95, 96, 97 };
  2649. static struct spear_muxreg mii2_muxreg[] = {
  2650. {
  2651. .reg = IP_SEL_PAD_80_89_REG,
  2652. .mask = PMX_PL_80_TO_85_MASK | PMX_PL_86_87_MASK |
  2653. PMX_PL_88_89_MASK,
  2654. .val = PMX_MII2_PL_80_TO_85_VAL | PMX_MII2_PL_86_87_VAL |
  2655. PMX_MII2_PL_88_89_VAL,
  2656. }, {
  2657. .reg = IP_SEL_PAD_90_99_REG,
  2658. .mask = PMX_PL_90_91_MASK | PMX_PL_92_93_MASK |
  2659. PMX_PL_94_95_MASK | PMX_PL_96_97_MASK,
  2660. .val = PMX_MII2_PL_90_91_VAL | PMX_MII2_PL_92_93_VAL |
  2661. PMX_MII2_PL_94_95_VAL | PMX_MII2_PL_96_97_VAL,
  2662. }, {
  2663. .reg = EXT_CTRL_REG,
  2664. .mask = (MAC_MODE_MASK << MAC2_MODE_SHIFT) |
  2665. (MAC_MODE_MASK << MAC1_MODE_SHIFT) |
  2666. MII_MDIO_MASK,
  2667. .val = (MAC_MODE_MII << MAC2_MODE_SHIFT) |
  2668. (MAC_MODE_MII << MAC1_MODE_SHIFT) |
  2669. MII_MDIO_81_VAL,
  2670. },
  2671. };
  2672. static struct spear_modemux mii2_modemux[] = {
  2673. {
  2674. .modes = EXTENDED_MODE,
  2675. .muxregs = mii2_muxreg,
  2676. .nmuxregs = ARRAY_SIZE(mii2_muxreg),
  2677. },
  2678. };
  2679. static struct spear_pingroup mii2_pingroup = {
  2680. .name = "mii2_grp",
  2681. .pins = mii2_pins,
  2682. .npins = ARRAY_SIZE(mii2_pins),
  2683. .modemuxs = mii2_modemux,
  2684. .nmodemuxs = ARRAY_SIZE(mii2_modemux),
  2685. };
  2686. static const char *const mii2_grps[] = { "mii2_grp" };
  2687. static struct spear_function mii2_function = {
  2688. .name = "mii2",
  2689. .groups = mii2_grps,
  2690. .ngroups = ARRAY_SIZE(mii2_grps),
  2691. };
  2692. /* Pad multiplexing for cadence mii 1_2 as smii or rmii device */
  2693. static const unsigned rmii0_1_pins[] = { 10, 11, 13, 14, 15, 16, 17, 18, 19, 20,
  2694. 21, 22, 23, 24, 25, 26, 27 };
  2695. static const unsigned smii0_1_pins[] = { 10, 11, 21, 22, 23, 24, 25, 26, 27 };
  2696. static struct spear_muxreg mii0_1_muxreg[] = {
  2697. {
  2698. .reg = PMX_CONFIG_REG,
  2699. .mask = PMX_MII_MASK,
  2700. .val = 0,
  2701. },
  2702. };
  2703. static struct spear_muxreg smii0_1_ext_muxreg[] = {
  2704. {
  2705. .reg = IP_SEL_PAD_10_19_REG,
  2706. .mask = PMX_PL_10_11_MASK,
  2707. .val = PMX_SMII_PL_10_11_VAL,
  2708. }, {
  2709. .reg = IP_SEL_PAD_20_29_REG,
  2710. .mask = PMX_PL_21_TO_27_MASK,
  2711. .val = PMX_SMII_PL_21_TO_27_VAL,
  2712. }, {
  2713. .reg = EXT_CTRL_REG,
  2714. .mask = (MAC_MODE_MASK << MAC2_MODE_SHIFT) |
  2715. (MAC_MODE_MASK << MAC1_MODE_SHIFT) |
  2716. MII_MDIO_MASK,
  2717. .val = (MAC_MODE_SMII << MAC2_MODE_SHIFT)
  2718. | (MAC_MODE_SMII << MAC1_MODE_SHIFT)
  2719. | MII_MDIO_10_11_VAL,
  2720. },
  2721. };
  2722. static struct spear_muxreg rmii0_1_ext_muxreg[] = {
  2723. {
  2724. .reg = IP_SEL_PAD_10_19_REG,
  2725. .mask = PMX_PL_10_11_MASK | PMX_PL_13_14_MASK |
  2726. PMX_PL_15_16_MASK | PMX_PL_17_18_MASK | PMX_PL_19_MASK,
  2727. .val = PMX_RMII_PL_10_11_VAL | PMX_RMII_PL_13_14_VAL |
  2728. PMX_RMII_PL_15_16_VAL | PMX_RMII_PL_17_18_VAL |
  2729. PMX_RMII_PL_19_VAL,
  2730. }, {
  2731. .reg = IP_SEL_PAD_20_29_REG,
  2732. .mask = PMX_PL_20_MASK | PMX_PL_21_TO_27_MASK,
  2733. .val = PMX_RMII_PL_20_VAL | PMX_RMII_PL_21_TO_27_VAL,
  2734. }, {
  2735. .reg = EXT_CTRL_REG,
  2736. .mask = (MAC_MODE_MASK << MAC2_MODE_SHIFT) |
  2737. (MAC_MODE_MASK << MAC1_MODE_SHIFT) |
  2738. MII_MDIO_MASK,
  2739. .val = (MAC_MODE_RMII << MAC2_MODE_SHIFT)
  2740. | (MAC_MODE_RMII << MAC1_MODE_SHIFT)
  2741. | MII_MDIO_10_11_VAL,
  2742. },
  2743. };
  2744. static struct spear_modemux mii0_1_modemux[][2] = {
  2745. {
  2746. /* configure as smii */
  2747. {
  2748. .modes = AUTO_NET_SMII_MODE | AUTO_EXP_MODE |
  2749. SMALL_PRINTERS_MODE | EXTENDED_MODE,
  2750. .muxregs = mii0_1_muxreg,
  2751. .nmuxregs = ARRAY_SIZE(mii0_1_muxreg),
  2752. }, {
  2753. .modes = EXTENDED_MODE,
  2754. .muxregs = smii0_1_ext_muxreg,
  2755. .nmuxregs = ARRAY_SIZE(smii0_1_ext_muxreg),
  2756. },
  2757. }, {
  2758. /* configure as rmii */
  2759. {
  2760. .modes = AUTO_NET_SMII_MODE | AUTO_EXP_MODE |
  2761. SMALL_PRINTERS_MODE | EXTENDED_MODE,
  2762. .muxregs = mii0_1_muxreg,
  2763. .nmuxregs = ARRAY_SIZE(mii0_1_muxreg),
  2764. }, {
  2765. .modes = EXTENDED_MODE,
  2766. .muxregs = rmii0_1_ext_muxreg,
  2767. .nmuxregs = ARRAY_SIZE(rmii0_1_ext_muxreg),
  2768. },
  2769. },
  2770. };
  2771. static struct spear_pingroup mii0_1_pingroup[] = {
  2772. {
  2773. .name = "smii0_1_grp",
  2774. .pins = smii0_1_pins,
  2775. .npins = ARRAY_SIZE(smii0_1_pins),
  2776. .modemuxs = mii0_1_modemux[0],
  2777. .nmodemuxs = ARRAY_SIZE(mii0_1_modemux[0]),
  2778. }, {
  2779. .name = "rmii0_1_grp",
  2780. .pins = rmii0_1_pins,
  2781. .npins = ARRAY_SIZE(rmii0_1_pins),
  2782. .modemuxs = mii0_1_modemux[1],
  2783. .nmodemuxs = ARRAY_SIZE(mii0_1_modemux[1]),
  2784. },
  2785. };
  2786. static const char *const mii0_1_grps[] = { "smii0_1_grp", "rmii0_1_grp" };
  2787. static struct spear_function mii0_1_function = {
  2788. .name = "mii0_1",
  2789. .groups = mii0_1_grps,
  2790. .ngroups = ARRAY_SIZE(mii0_1_grps),
  2791. };
  2792. /* Pad multiplexing for i2c1 device */
  2793. static const unsigned i2c1_pins[][2] = { { 8, 9 }, { 98, 99 } };
  2794. static struct spear_muxreg i2c1_ext_8_9_muxreg[] = {
  2795. {
  2796. .reg = PMX_CONFIG_REG,
  2797. .mask = PMX_SSP_CS_MASK,
  2798. .val = 0,
  2799. }, {
  2800. .reg = IP_SEL_PAD_0_9_REG,
  2801. .mask = PMX_PL_8_9_MASK,
  2802. .val = PMX_I2C1_PL_8_9_VAL,
  2803. }, {
  2804. .reg = IP_SEL_MIX_PAD_REG,
  2805. .mask = PMX_I2C1_PORT_SEL_MASK,
  2806. .val = PMX_I2C1_PORT_8_9_VAL,
  2807. },
  2808. };
  2809. static struct spear_muxreg i2c1_ext_98_99_muxreg[] = {
  2810. {
  2811. .reg = IP_SEL_PAD_90_99_REG,
  2812. .mask = PMX_PL_98_MASK | PMX_PL_99_MASK,
  2813. .val = PMX_I2C1_PL_98_VAL | PMX_I2C1_PL_99_VAL,
  2814. }, {
  2815. .reg = IP_SEL_MIX_PAD_REG,
  2816. .mask = PMX_I2C1_PORT_SEL_MASK,
  2817. .val = PMX_I2C1_PORT_98_99_VAL,
  2818. },
  2819. };
  2820. static struct spear_modemux i2c1_modemux[][1] = {
  2821. {
  2822. /* Select signals on pins 8-9 */
  2823. {
  2824. .modes = EXTENDED_MODE,
  2825. .muxregs = i2c1_ext_8_9_muxreg,
  2826. .nmuxregs = ARRAY_SIZE(i2c1_ext_8_9_muxreg),
  2827. },
  2828. }, {
  2829. /* Select signals on pins 98-99 */
  2830. {
  2831. .modes = EXTENDED_MODE,
  2832. .muxregs = i2c1_ext_98_99_muxreg,
  2833. .nmuxregs = ARRAY_SIZE(i2c1_ext_98_99_muxreg),
  2834. },
  2835. },
  2836. };
  2837. static struct spear_pingroup i2c1_pingroup[] = {
  2838. {
  2839. .name = "i2c1_8_9_grp",
  2840. .pins = i2c1_pins[0],
  2841. .npins = ARRAY_SIZE(i2c1_pins[0]),
  2842. .modemuxs = i2c1_modemux[0],
  2843. .nmodemuxs = ARRAY_SIZE(i2c1_modemux[0]),
  2844. }, {
  2845. .name = "i2c1_98_99_grp",
  2846. .pins = i2c1_pins[1],
  2847. .npins = ARRAY_SIZE(i2c1_pins[1]),
  2848. .modemuxs = i2c1_modemux[1],
  2849. .nmodemuxs = ARRAY_SIZE(i2c1_modemux[1]),
  2850. },
  2851. };
  2852. static const char *const i2c1_grps[] = { "i2c1_8_9_grp", "i2c1_98_99_grp" };
  2853. static struct spear_function i2c1_function = {
  2854. .name = "i2c1",
  2855. .groups = i2c1_grps,
  2856. .ngroups = ARRAY_SIZE(i2c1_grps),
  2857. };
  2858. /* Pad multiplexing for i2c2 device */
  2859. static const unsigned i2c2_pins[][2] = { { 0, 1 }, { 2, 3 }, { 19, 20 },
  2860. { 75, 76 }, { 96, 97 } };
  2861. static struct spear_muxreg i2c2_ext_0_1_muxreg[] = {
  2862. {
  2863. .reg = PMX_CONFIG_REG,
  2864. .mask = PMX_FIRDA_MASK,
  2865. .val = 0,
  2866. }, {
  2867. .reg = IP_SEL_PAD_0_9_REG,
  2868. .mask = PMX_PL_0_1_MASK,
  2869. .val = PMX_I2C2_PL_0_1_VAL,
  2870. }, {
  2871. .reg = IP_SEL_MIX_PAD_REG,
  2872. .mask = PMX_I2C2_PORT_SEL_MASK,
  2873. .val = PMX_I2C2_PORT_0_1_VAL,
  2874. },
  2875. };
  2876. static struct spear_muxreg i2c2_ext_2_3_muxreg[] = {
  2877. {
  2878. .reg = PMX_CONFIG_REG,
  2879. .mask = PMX_UART0_MASK,
  2880. .val = 0,
  2881. }, {
  2882. .reg = IP_SEL_PAD_0_9_REG,
  2883. .mask = PMX_PL_2_3_MASK,
  2884. .val = PMX_I2C2_PL_2_3_VAL,
  2885. }, {
  2886. .reg = IP_SEL_MIX_PAD_REG,
  2887. .mask = PMX_I2C2_PORT_SEL_MASK,
  2888. .val = PMX_I2C2_PORT_2_3_VAL,
  2889. },
  2890. };
  2891. static struct spear_muxreg i2c2_ext_19_20_muxreg[] = {
  2892. {
  2893. .reg = PMX_CONFIG_REG,
  2894. .mask = PMX_MII_MASK,
  2895. .val = 0,
  2896. }, {
  2897. .reg = IP_SEL_PAD_10_19_REG,
  2898. .mask = PMX_PL_19_MASK,
  2899. .val = PMX_I2C2_PL_19_VAL,
  2900. }, {
  2901. .reg = IP_SEL_PAD_20_29_REG,
  2902. .mask = PMX_PL_20_MASK,
  2903. .val = PMX_I2C2_PL_20_VAL,
  2904. }, {
  2905. .reg = IP_SEL_MIX_PAD_REG,
  2906. .mask = PMX_I2C2_PORT_SEL_MASK,
  2907. .val = PMX_I2C2_PORT_19_20_VAL,
  2908. },
  2909. };
  2910. static struct spear_muxreg i2c2_ext_75_76_muxreg[] = {
  2911. {
  2912. .reg = IP_SEL_PAD_70_79_REG,
  2913. .mask = PMX_PL_75_76_MASK,
  2914. .val = PMX_I2C2_PL_75_76_VAL,
  2915. }, {
  2916. .reg = IP_SEL_MIX_PAD_REG,
  2917. .mask = PMX_I2C2_PORT_SEL_MASK,
  2918. .val = PMX_I2C2_PORT_75_76_VAL,
  2919. },
  2920. };
  2921. static struct spear_muxreg i2c2_ext_96_97_muxreg[] = {
  2922. {
  2923. .reg = IP_SEL_PAD_90_99_REG,
  2924. .mask = PMX_PL_96_97_MASK,
  2925. .val = PMX_I2C2_PL_96_97_VAL,
  2926. }, {
  2927. .reg = IP_SEL_MIX_PAD_REG,
  2928. .mask = PMX_I2C2_PORT_SEL_MASK,
  2929. .val = PMX_I2C2_PORT_96_97_VAL,
  2930. },
  2931. };
  2932. static struct spear_modemux i2c2_modemux[][1] = {
  2933. {
  2934. /* Select signals on pins 0_1 */
  2935. {
  2936. .modes = EXTENDED_MODE,
  2937. .muxregs = i2c2_ext_0_1_muxreg,
  2938. .nmuxregs = ARRAY_SIZE(i2c2_ext_0_1_muxreg),
  2939. },
  2940. }, {
  2941. /* Select signals on pins 2_3 */
  2942. {
  2943. .modes = EXTENDED_MODE,
  2944. .muxregs = i2c2_ext_2_3_muxreg,
  2945. .nmuxregs = ARRAY_SIZE(i2c2_ext_2_3_muxreg),
  2946. },
  2947. }, {
  2948. /* Select signals on pins 19_20 */
  2949. {
  2950. .modes = EXTENDED_MODE,
  2951. .muxregs = i2c2_ext_19_20_muxreg,
  2952. .nmuxregs = ARRAY_SIZE(i2c2_ext_19_20_muxreg),
  2953. },
  2954. }, {
  2955. /* Select signals on pins 75_76 */
  2956. {
  2957. .modes = EXTENDED_MODE,
  2958. .muxregs = i2c2_ext_75_76_muxreg,
  2959. .nmuxregs = ARRAY_SIZE(i2c2_ext_75_76_muxreg),
  2960. },
  2961. }, {
  2962. /* Select signals on pins 96_97 */
  2963. {
  2964. .modes = EXTENDED_MODE,
  2965. .muxregs = i2c2_ext_96_97_muxreg,
  2966. .nmuxregs = ARRAY_SIZE(i2c2_ext_96_97_muxreg),
  2967. },
  2968. },
  2969. };
  2970. static struct spear_pingroup i2c2_pingroup[] = {
  2971. {
  2972. .name = "i2c2_0_1_grp",
  2973. .pins = i2c2_pins[0],
  2974. .npins = ARRAY_SIZE(i2c2_pins[0]),
  2975. .modemuxs = i2c2_modemux[0],
  2976. .nmodemuxs = ARRAY_SIZE(i2c2_modemux[0]),
  2977. }, {
  2978. .name = "i2c2_2_3_grp",
  2979. .pins = i2c2_pins[1],
  2980. .npins = ARRAY_SIZE(i2c2_pins[1]),
  2981. .modemuxs = i2c2_modemux[1],
  2982. .nmodemuxs = ARRAY_SIZE(i2c2_modemux[1]),
  2983. }, {
  2984. .name = "i2c2_19_20_grp",
  2985. .pins = i2c2_pins[2],
  2986. .npins = ARRAY_SIZE(i2c2_pins[2]),
  2987. .modemuxs = i2c2_modemux[2],
  2988. .nmodemuxs = ARRAY_SIZE(i2c2_modemux[2]),
  2989. }, {
  2990. .name = "i2c2_75_76_grp",
  2991. .pins = i2c2_pins[3],
  2992. .npins = ARRAY_SIZE(i2c2_pins[3]),
  2993. .modemuxs = i2c2_modemux[3],
  2994. .nmodemuxs = ARRAY_SIZE(i2c2_modemux[3]),
  2995. }, {
  2996. .name = "i2c2_96_97_grp",
  2997. .pins = i2c2_pins[4],
  2998. .npins = ARRAY_SIZE(i2c2_pins[4]),
  2999. .modemuxs = i2c2_modemux[4],
  3000. .nmodemuxs = ARRAY_SIZE(i2c2_modemux[4]),
  3001. },
  3002. };
  3003. static const char *const i2c2_grps[] = { "i2c2_0_1_grp", "i2c2_2_3_grp",
  3004. "i2c2_19_20_grp", "i2c2_75_76_grp", "i2c2_96_97_grp" };
  3005. static struct spear_function i2c2_function = {
  3006. .name = "i2c2",
  3007. .groups = i2c2_grps,
  3008. .ngroups = ARRAY_SIZE(i2c2_grps),
  3009. };
  3010. /* pingroups */
  3011. static struct spear_pingroup *spear320_pingroups[] = {
  3012. SPEAR3XX_COMMON_PINGROUPS,
  3013. &clcd_pingroup,
  3014. &emi_pingroup,
  3015. &fsmc_8bit_pingroup,
  3016. &fsmc_16bit_pingroup,
  3017. &spp_pingroup,
  3018. &sdhci_led_pingroup,
  3019. &sdhci_pingroup[0],
  3020. &sdhci_pingroup[1],
  3021. &i2s_pingroup,
  3022. &uart1_pingroup,
  3023. &uart1_modem_pingroup[0],
  3024. &uart1_modem_pingroup[1],
  3025. &uart1_modem_pingroup[2],
  3026. &uart1_modem_pingroup[3],
  3027. &uart2_pingroup,
  3028. &uart3_pingroup[0],
  3029. &uart3_pingroup[1],
  3030. &uart3_pingroup[2],
  3031. &uart3_pingroup[3],
  3032. &uart3_pingroup[4],
  3033. &uart3_pingroup[5],
  3034. &uart3_pingroup[6],
  3035. &uart4_pingroup[0],
  3036. &uart4_pingroup[1],
  3037. &uart4_pingroup[2],
  3038. &uart4_pingroup[3],
  3039. &uart4_pingroup[4],
  3040. &uart4_pingroup[5],
  3041. &uart5_pingroup[0],
  3042. &uart5_pingroup[1],
  3043. &uart5_pingroup[2],
  3044. &uart5_pingroup[3],
  3045. &uart6_pingroup[0],
  3046. &uart6_pingroup[1],
  3047. &rs485_pingroup,
  3048. &touchscreen_pingroup,
  3049. &can0_pingroup,
  3050. &can1_pingroup,
  3051. &pwm0_1_pingroup[0],
  3052. &pwm0_1_pingroup[1],
  3053. &pwm0_1_pingroup[2],
  3054. &pwm0_1_pingroup[3],
  3055. &pwm0_1_pingroup[4],
  3056. &pwm0_1_pingroup[5],
  3057. &pwm0_1_pingroup[6],
  3058. &pwm2_pingroup[0],
  3059. &pwm2_pingroup[1],
  3060. &pwm2_pingroup[2],
  3061. &pwm2_pingroup[3],
  3062. &pwm2_pingroup[4],
  3063. &pwm2_pingroup[5],
  3064. &pwm2_pingroup[6],
  3065. &pwm3_pingroup[0],
  3066. &pwm3_pingroup[1],
  3067. &pwm3_pingroup[2],
  3068. &pwm3_pingroup[3],
  3069. &pwm3_pingroup[4],
  3070. &pwm3_pingroup[5],
  3071. &ssp1_pingroup[0],
  3072. &ssp1_pingroup[1],
  3073. &ssp1_pingroup[2],
  3074. &ssp1_pingroup[3],
  3075. &ssp1_pingroup[4],
  3076. &ssp2_pingroup[0],
  3077. &ssp2_pingroup[1],
  3078. &ssp2_pingroup[2],
  3079. &ssp2_pingroup[3],
  3080. &ssp2_pingroup[4],
  3081. &mii2_pingroup,
  3082. &mii0_1_pingroup[0],
  3083. &mii0_1_pingroup[1],
  3084. &i2c1_pingroup[0],
  3085. &i2c1_pingroup[1],
  3086. &i2c2_pingroup[0],
  3087. &i2c2_pingroup[1],
  3088. &i2c2_pingroup[2],
  3089. &i2c2_pingroup[3],
  3090. &i2c2_pingroup[4],
  3091. };
  3092. /* functions */
  3093. static struct spear_function *spear320_functions[] = {
  3094. SPEAR3XX_COMMON_FUNCTIONS,
  3095. &clcd_function,
  3096. &emi_function,
  3097. &fsmc_function,
  3098. &spp_function,
  3099. &sdhci_function,
  3100. &i2s_function,
  3101. &uart1_function,
  3102. &uart1_modem_function,
  3103. &uart2_function,
  3104. &uart3_function,
  3105. &uart4_function,
  3106. &uart5_function,
  3107. &uart6_function,
  3108. &rs485_function,
  3109. &touchscreen_function,
  3110. &can0_function,
  3111. &can1_function,
  3112. &pwm0_1_function,
  3113. &pwm2_function,
  3114. &pwm3_function,
  3115. &ssp1_function,
  3116. &ssp2_function,
  3117. &mii2_function,
  3118. &mii0_1_function,
  3119. &i2c1_function,
  3120. &i2c2_function,
  3121. };
  3122. static const struct of_device_id spear320_pinctrl_of_match[] = {
  3123. {
  3124. .compatible = "st,spear320-pinmux",
  3125. },
  3126. {},
  3127. };
  3128. static int spear320_pinctrl_probe(struct platform_device *pdev)
  3129. {
  3130. int ret;
  3131. spear3xx_machdata.groups = spear320_pingroups;
  3132. spear3xx_machdata.ngroups = ARRAY_SIZE(spear320_pingroups);
  3133. spear3xx_machdata.functions = spear320_functions;
  3134. spear3xx_machdata.nfunctions = ARRAY_SIZE(spear320_functions);
  3135. spear3xx_machdata.modes_supported = true;
  3136. spear3xx_machdata.pmx_modes = spear320_pmx_modes;
  3137. spear3xx_machdata.npmx_modes = ARRAY_SIZE(spear320_pmx_modes);
  3138. pmx_init_addr(&spear3xx_machdata, PMX_CONFIG_REG);
  3139. pmx_init_gpio_pingroup_addr(spear3xx_machdata.gpio_pingroups,
  3140. spear3xx_machdata.ngpio_pingroups, PMX_CONFIG_REG);
  3141. ret = spear_pinctrl_probe(pdev, &spear3xx_machdata);
  3142. if (ret)
  3143. return ret;
  3144. return 0;
  3145. }
  3146. static struct platform_driver spear320_pinctrl_driver = {
  3147. .driver = {
  3148. .name = DRIVER_NAME,
  3149. .of_match_table = spear320_pinctrl_of_match,
  3150. },
  3151. .probe = spear320_pinctrl_probe,
  3152. };
  3153. static int __init spear320_pinctrl_init(void)
  3154. {
  3155. return platform_driver_register(&spear320_pinctrl_driver);
  3156. }
  3157. arch_initcall(spear320_pinctrl_init);
  3158. static void __exit spear320_pinctrl_exit(void)
  3159. {
  3160. platform_driver_unregister(&spear320_pinctrl_driver);
  3161. }
  3162. module_exit(spear320_pinctrl_exit);
  3163. MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
  3164. MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver");
  3165. MODULE_LICENSE("GPL v2");
  3166. MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match);