OrangePi_zero2.patch.b 108 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357
  1. diff --git a/package/boot/arm-trusted-firmware-sunxi/Makefile b/package/boot/arm-trusted-firmware-sunxi/Makefile
  2. index 0abfbae750142..9608ce39a1d2a 100644
  3. --- a/package/boot/arm-trusted-firmware-sunxi/Makefile
  4. +++ b/package/boot/arm-trusted-firmware-sunxi/Makefile
  5. @@ -12,9 +12,9 @@ PKG_RELEASE:=1
  6. PKG_SOURCE_PROTO:=git
  7. PKG_SOURCE_URL=https://github.com/ARM-software/arm-trusted-firmware
  8. -PKG_SOURCE_DATE:=2020-11-17
  9. -PKG_SOURCE_VERSION:=e2c509a39c6cc4dda8734e6509cdbe6e3603cdfc
  10. -PKG_MIRROR_HASH:=b212d369a5286ebbf6a5616486efa05fa54d4294fd6e9ba2e54fdfae9eda918d
  11. +PKG_SOURCE_DATE:=2022-06-01
  12. +PKG_SOURCE_VERSION:=35f4c7295bafeb32c8bcbdfb6a3f2e74a57e732b
  13. +PKG_MIRROR_HASH:=88a282242ca5c921ce43eb913112e964ae87ddf85a87f2d4d6d192d1fe943370
  14. PKG_LICENSE:=BSD-3-Clause
  15. PKG_LICENSE_FILES:=license.md
  16. @@ -42,6 +42,11 @@ define Package/arm-trusted-firmware-sunxi-h6
  17. VARIANT:=sun50i_h6
  18. endef
  19. +define Package/arm-trusted-firmware-sunxi-h616
  20. + $(call Package/arm-trusted-firmware-sunxi/Default)
  21. + VARIANT:=sun50i_h616
  22. +endef
  23. +
  24. export GCC_HONOUR_COPTS=s
  25. MAKE_VARS = \
  26. @@ -61,3 +66,4 @@ endef
  27. $(eval $(call BuildPackage,arm-trusted-firmware-sunxi-a64))
  28. $(eval $(call BuildPackage,arm-trusted-firmware-sunxi-h6))
  29. +$(eval $(call BuildPackage,arm-trusted-firmware-sunxi-h616))
  30. diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile
  31. index 5c27407d15511..1e3c8ea4da0e4 100644
  32. --- a/package/boot/uboot-sunxi/Makefile
  33. +++ b/package/boot/uboot-sunxi/Makefile
  34. @@ -322,6 +322,15 @@ define U-Boot/orangepi_pc2
  35. ATF:=a64
  36. endef
  37. +define U-Boot/orangepi_zero2
  38. + BUILD_SUBTARGET:=cortexa53
  39. + NAME:=Xunlong Orange Pi Zero2
  40. + BUILD_DEVICES:=xunlong_orangepi-zero2
  41. + DEPENDS:=+PACKAGE_u-boot-orangepi_zero2:arm-trusted-firmware-sunxi-h616
  42. + UENV:=h616
  43. + ATF:=h616
  44. +endef
  45. +
  46. define U-Boot/Bananapi_M2_Ultra
  47. BUILD_SUBTARGET:=cortexa7
  48. NAME:=Bananapi M2 Ultra
  49. @@ -376,6 +385,7 @@ UBOOT_TARGETS := \
  50. orangepi_plus \
  51. orangepi_2 \
  52. orangepi_pc2 \
  53. + orangepi_zero2 \
  54. pangolin \
  55. pine64_plus \
  56. sopine_baseboard \
  57. diff --git a/package/boot/uboot-sunxi/uEnv-h616.txt b/package/boot/uboot-sunxi/uEnv-h616.txt
  58. new file mode 100644
  59. index 0000000000000..78810ff223cce
  60. --- /dev/null
  61. +++ b/package/boot/uboot-sunxi/uEnv-h616.txt
  62. @@ -0,0 +1,7 @@
  63. +setenv mmc_rootpart 2
  64. +part uuid mmc ${mmc_bootdev}:${mmc_rootpart} uuid
  65. +setenv loadkernel fatload mmc \$mmc_bootdev \$kernel_addr_r uImage
  66. +setenv loaddtb fatload mmc \$mmc_bootdev \$fdt_addr_r dtb
  67. +setenv bootargs console=ttyS0,115200 earlyprintk root=PARTUUID=${uuid} rootwait
  68. +setenv uenvcmd run loadkernel \&\& run loaddtb \&\& booti \$kernel_addr_r - \$fdt_addr_r
  69. +run uenvcmd
  70. diff --git a/target/linux/sunxi/image/cortexa53.mk b/target/linux/sunxi/image/cortexa53.mk
  71. index a00bac2c81c76..ba36f75533b99 100644
  72. --- a/target/linux/sunxi/image/cortexa53.mk
  73. +++ b/target/linux/sunxi/image/cortexa53.mk
  74. @@ -24,6 +24,11 @@ define Device/sun50i-h6
  75. $(Device/sun50i)
  76. endef
  77. +define Device/sun50i-h616
  78. + SOC := sun50i-h616
  79. + $(Device/sun50i)
  80. +endef
  81. +
  82. define Device/friendlyarm_nanopi-neo-plus2
  83. DEVICE_VENDOR := FriendlyARM
  84. DEVICE_MODEL := NanoPi NEO Plus2
  85. @@ -101,6 +106,14 @@ define Device/xunlong_orangepi-one-plus
  86. endef
  87. TARGET_DEVICES += xunlong_orangepi-one-plus
  88. +define Device/xunlong_orangepi-zero2
  89. + $(Device/sun50i-h616)
  90. + DEVICE_VENDOR := Xunlong
  91. + DEVICE_MODEL := Orange Pi Zero2
  92. + SUNXI_DTS_DIR := allwinner/
  93. +endef
  94. +TARGET_DEVICES += xunlong_orangepi-zero2
  95. +
  96. define Device/xunlong_orangepi-pc2
  97. DEVICE_VENDOR := Xunlong
  98. DEVICE_MODEL := Orange Pi PC 2
  99. diff --git a/target/linux/sunxi/patches-5.10/502-Add-support-for-the-Allwinner-H616-pin-controller.patch b/target/linux/sunxi/patches-5.10/502-Add-support-for-the-Allwinner-H616-pin-controller.patch
  100. new file mode 100644
  101. index 0000000000000..1759077ff33fd
  102. --- /dev/null
  103. +++ b/target/linux/sunxi/patches-5.10/502-Add-support-for-the-Allwinner-H616-pin-controller.patch
  104. @@ -0,0 +1,580 @@
  105. +diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig
  106. +index 593293584ecc..73e88ce71a48 100644
  107. +--- a/drivers/pinctrl/sunxi/Kconfig
  108. ++++ b/drivers/pinctrl/sunxi/Kconfig
  109. +@@ -119,4 +119,9 @@ config PINCTRL_SUN50I_H6_R
  110. + default ARM64 && ARCH_SUNXI
  111. + select PINCTRL_SUNXI
  112. +
  113. ++config PINCTRL_SUN50I_H616
  114. ++ bool "Support for the Allwinner H616 PIO"
  115. ++ default ARM64 && ARCH_SUNXI
  116. ++ select PINCTRL_SUNXI
  117. ++
  118. + endif
  119. +diff --git a/drivers/pinctrl/sunxi/Makefile b/drivers/pinctrl/sunxi/Makefile
  120. +index 8b7ff0dc3bdf..5359327a3c8f 100644
  121. +--- a/drivers/pinctrl/sunxi/Makefile
  122. ++++ b/drivers/pinctrl/sunxi/Makefile
  123. +@@ -23,5 +23,6 @@ obj-$(CONFIG_PINCTRL_SUN8I_V3S) += pinctrl-sun8i-v3s.o
  124. + obj-$(CONFIG_PINCTRL_SUN50I_H5) += pinctrl-sun50i-h5.o
  125. + obj-$(CONFIG_PINCTRL_SUN50I_H6) += pinctrl-sun50i-h6.o
  126. + obj-$(CONFIG_PINCTRL_SUN50I_H6_R) += pinctrl-sun50i-h6-r.o
  127. ++obj-$(CONFIG_PINCTRL_SUN50I_H616) += pinctrl-sun50i-h616.o
  128. + obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o
  129. + obj-$(CONFIG_PINCTRL_SUN9I_A80_R) += pinctrl-sun9i-a80-r.o
  130. +diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c
  131. +new file mode 100644
  132. +index 000000000000..734f63eb08dd
  133. +--- /dev/null
  134. ++++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616.c
  135. +@@ -0,0 +1,549 @@
  136. ++// SPDX-License-Identifier: GPL-2.0
  137. ++/*
  138. ++ * Allwinner H616 SoC pinctrl driver.
  139. ++ *
  140. ++ * Copyright (C) 2020 Arm Ltd.
  141. ++ * based on the H6 pinctrl driver
  142. ++ * Copyright (C) 2017 Icenowy Zheng <[email protected]>
  143. ++ */
  144. ++
  145. ++#include <linux/module.h>
  146. ++#include <linux/platform_device.h>
  147. ++#include <linux/of.h>
  148. ++#include <linux/of_device.h>
  149. ++#include <linux/pinctrl/pinctrl.h>
  150. ++
  151. ++#include "pinctrl-sunxi.h"
  152. ++
  153. ++static const struct sunxi_desc_pin h616_pins[] = {
  154. ++ /* Internal connection to the AC200 part */
  155. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0),
  156. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ERXD1 */
  157. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 1),
  158. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ERXD0 */
  159. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 2),
  160. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ECRS_DV */
  161. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 3),
  162. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ERXERR */
  163. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 4),
  164. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ETXD1 */
  165. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 5),
  166. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ETXD0 */
  167. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 6),
  168. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ETXCK */
  169. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7),
  170. ++ SUNXI_FUNCTION(0x2, "emac1")), /* ETXEN */
  171. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 8),
  172. ++ SUNXI_FUNCTION(0x2, "emac1")), /* EMDC */
  173. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 9),
  174. ++ SUNXI_FUNCTION(0x2, "emac1")), /* EMDIO */
  175. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 10),
  176. ++ SUNXI_FUNCTION(0x2, "i2c3")), /* SCK */
  177. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 11),
  178. ++ SUNXI_FUNCTION(0x2, "i2c3")), /* SDA */
  179. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 12),
  180. ++ SUNXI_FUNCTION(0x2, "pwm5")),
  181. ++ /* Hole */
  182. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 0),
  183. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  184. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  185. ++ SUNXI_FUNCTION(0x2, "nand0"), /* WE */
  186. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* DS */
  187. ++ SUNXI_FUNCTION(0x4, "spi0"), /* CLK */
  188. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)), /* PC_EINT0 */
  189. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 1),
  190. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  191. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  192. ++ SUNXI_FUNCTION(0x2, "nand0"), /* ALE */
  193. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* RST */
  194. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)), /* PC_EINT1 */
  195. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 2),
  196. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  197. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  198. ++ SUNXI_FUNCTION(0x2, "nand0"), /* CLE */
  199. ++ SUNXI_FUNCTION(0x4, "spi0"), /* MOSI */
  200. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)), /* PC_EINT2 */
  201. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 3),
  202. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  203. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  204. ++ SUNXI_FUNCTION(0x2, "nand0"), /* CE1 */
  205. ++ SUNXI_FUNCTION(0x4, "spi0"), /* CS0 */
  206. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)), /* PC_EINT3 */
  207. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
  208. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  209. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  210. ++ SUNXI_FUNCTION(0x2, "nand0"), /* CE0 */
  211. ++ SUNXI_FUNCTION(0x4, "spi0"), /* MISO */
  212. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)), /* PC_EINT4 */
  213. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
  214. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  215. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  216. ++ SUNXI_FUNCTION(0x2, "nand0"), /* RE */
  217. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* CLK */
  218. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)), /* PC_EINT5 */
  219. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
  220. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  221. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  222. ++ SUNXI_FUNCTION(0x2, "nand0"), /* RB0 */
  223. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* CMD */
  224. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)), /* PC_EINT6 */
  225. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
  226. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  227. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  228. ++ SUNXI_FUNCTION(0x2, "nand0"), /* RB1 */
  229. ++ SUNXI_FUNCTION(0x4, "spi0"), /* CS1 */
  230. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)), /* PC_EINT7 */
  231. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
  232. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  233. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  234. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ7 */
  235. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D3 */
  236. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)), /* PC_EINT8 */
  237. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
  238. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  239. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  240. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ6 */
  241. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D4 */
  242. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)), /* PC_EINT9 */
  243. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
  244. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  245. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  246. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ5 */
  247. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D0 */
  248. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)), /* PC_EINT10 */
  249. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 11),
  250. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  251. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  252. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ4 */
  253. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D5 */
  254. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)), /* PC_EINT11 */
  255. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 12),
  256. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  257. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  258. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQS */
  259. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 12)), /* PC_EINT12 */
  260. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 13),
  261. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  262. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  263. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ3 */
  264. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D1 */
  265. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 13)), /* PC_EINT13 */
  266. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 14),
  267. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  268. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  269. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ2 */
  270. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D6 */
  271. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 14)), /* PC_EINT14 */
  272. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 15),
  273. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  274. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  275. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ1 */
  276. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D2 */
  277. ++ SUNXI_FUNCTION(0x4, "spi0"), /* WP */
  278. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 15)), /* PC_EINT15 */
  279. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 16),
  280. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  281. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  282. ++ SUNXI_FUNCTION(0x2, "nand0"), /* DQ0 */
  283. ++ SUNXI_FUNCTION(0x3, "mmc2"), /* D7 */
  284. ++ SUNXI_FUNCTION(0x4, "spi0"), /* HOLD */
  285. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 16)), /* PC_EINT16 */
  286. ++ /* Hole */
  287. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 0),
  288. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  289. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  290. ++ SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
  291. ++ SUNXI_FUNCTION(0x3, "jtag"), /* MS */
  292. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 0)), /* PF_EINT0 */
  293. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 1),
  294. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  295. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  296. ++ SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
  297. ++ SUNXI_FUNCTION(0x3, "jtag"), /* DI */
  298. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 1)), /* PF_EINT1 */
  299. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 2),
  300. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  301. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  302. ++ SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
  303. ++ SUNXI_FUNCTION(0x3, "uart0"), /* TX */
  304. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 2)), /* PF_EINT2 */
  305. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 3),
  306. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  307. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  308. ++ SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
  309. ++ SUNXI_FUNCTION(0x3, "jtag"), /* DO */
  310. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 3)), /* PF_EINT3 */
  311. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 4),
  312. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  313. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  314. ++ SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
  315. ++ SUNXI_FUNCTION(0x3, "uart0"), /* RX */
  316. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 4)), /* PF_EINT4 */
  317. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 5),
  318. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  319. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  320. ++ SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
  321. ++ SUNXI_FUNCTION(0x3, "jtag"), /* CK */
  322. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 5)), /* PF_EINT5 */
  323. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(F, 6),
  324. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  325. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  326. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 1, 6)), /* PF_EINT6 */
  327. ++ /* Hole */
  328. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
  329. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  330. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  331. ++ SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
  332. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 0)), /* PG_EINT0 */
  333. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
  334. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  335. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  336. ++ SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
  337. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 1)), /* PG_EINT1 */
  338. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
  339. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  340. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  341. ++ SUNXI_FUNCTION(0x2, "mmc1"), /* D0 */
  342. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 2)), /* PG_EINT2 */
  343. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
  344. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  345. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  346. ++ SUNXI_FUNCTION(0x2, "mmc1"), /* D1 */
  347. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 3)), /* PG_EINT3 */
  348. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
  349. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  350. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  351. ++ SUNXI_FUNCTION(0x2, "mmc1"), /* D2 */
  352. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 4)), /* PG_EINT4 */
  353. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
  354. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  355. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  356. ++ SUNXI_FUNCTION(0x2, "mmc1"), /* D3 */
  357. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 5)), /* PG_EINT5 */
  358. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
  359. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  360. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  361. ++ SUNXI_FUNCTION(0x2, "uart1"), /* TX */
  362. ++ SUNXI_FUNCTION(0x4, "jtag"), /* MS */
  363. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 6)), /* PG_EINT6 */
  364. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
  365. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  366. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  367. ++ SUNXI_FUNCTION(0x2, "uart1"), /* RX */
  368. ++ SUNXI_FUNCTION(0x4, "jtag"), /* CK */
  369. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 7)), /* PG_EINT7 */
  370. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
  371. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  372. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  373. ++ SUNXI_FUNCTION(0x2, "uart1"), /* RTS */
  374. ++ SUNXI_FUNCTION(0x3, "clock"), /* PLL_LOCK_DEBUG */
  375. ++ SUNXI_FUNCTION(0x4, "jtag"), /* DO */
  376. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 8)), /* PG_EINT8 */
  377. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
  378. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  379. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  380. ++ SUNXI_FUNCTION(0x2, "uart1"), /* CTS */
  381. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 9)), /* PG_EINT9 */
  382. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
  383. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  384. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  385. ++ SUNXI_FUNCTION(0x2, "h_i2s2"), /* MCLK */
  386. ++ SUNXI_FUNCTION(0x3, "clock"), /* X32KFOUT */
  387. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 10)), /* PG_EINT10 */
  388. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
  389. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  390. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  391. ++ SUNXI_FUNCTION(0x2, "h_i2s2"), /* BCLK */
  392. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 11)), /* PG_EINT11 */
  393. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
  394. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  395. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  396. ++ SUNXI_FUNCTION(0x2, "h_i2s2"), /* SYNC */
  397. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 12)), /* PG_EINT12 */
  398. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
  399. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  400. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  401. ++ SUNXI_FUNCTION(0x2, "h_i2s2"), /* DOUT */
  402. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 13)), /* PG_EINT13 */
  403. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 14),
  404. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  405. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  406. ++ SUNXI_FUNCTION(0x2, "h_i2s2"), /* DIN */
  407. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 14)), /* PG_EINT14 */
  408. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 15),
  409. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  410. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  411. ++ SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  412. ++ SUNXI_FUNCTION(0x5, "i2c4"), /* SCK */
  413. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 15)), /* PG_EINT15 */
  414. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 16),
  415. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  416. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  417. ++ SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  418. ++ SUNXI_FUNCTION(0x5, "i2c4"), /* SDA */
  419. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 16)), /* PG_EINT16 */
  420. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 17),
  421. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  422. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  423. ++ SUNXI_FUNCTION(0x2, "uart2"), /* RTS */
  424. ++ SUNXI_FUNCTION(0x5, "i2c3"), /* SCK */
  425. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 17)), /* PG_EINT17 */
  426. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 18),
  427. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  428. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  429. ++ SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
  430. ++ SUNXI_FUNCTION(0x5, "i2c3"), /* SDA */
  431. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 18)), /* PG_EINT18 */
  432. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 19),
  433. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  434. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  435. ++ SUNXI_FUNCTION(0x4, "pwm1"),
  436. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 2, 19)), /* PG_EINT19 */
  437. ++ /* Hole */
  438. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 0),
  439. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  440. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  441. ++ SUNXI_FUNCTION(0x2, "uart0"), /* TX */
  442. ++ SUNXI_FUNCTION(0x4, "pwm3"),
  443. ++ SUNXI_FUNCTION(0x5, "i2c1"), /* SCK */
  444. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 0)), /* PH_EINT0 */
  445. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 1),
  446. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  447. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  448. ++ SUNXI_FUNCTION(0x2, "uart0"), /* RX */
  449. ++ SUNXI_FUNCTION(0x4, "pwm4"),
  450. ++ SUNXI_FUNCTION(0x5, "i2c1"), /* SDA */
  451. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 1)), /* PH_EINT1 */
  452. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 2),
  453. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  454. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  455. ++ SUNXI_FUNCTION(0x2, "uart5"), /* TX */
  456. ++ SUNXI_FUNCTION(0x3, "spdif"), /* MCLK */
  457. ++ SUNXI_FUNCTION(0x4, "pwm2"),
  458. ++ SUNXI_FUNCTION(0x5, "i2c2"), /* SCK */
  459. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 2)), /* PH_EINT2 */
  460. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 3),
  461. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  462. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  463. ++ SUNXI_FUNCTION(0x2, "uart5"), /* RX */
  464. ++ SUNXI_FUNCTION(0x4, "pwm1"),
  465. ++ SUNXI_FUNCTION(0x5, "i2c2"), /* SDA */
  466. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 3)), /* PH_EINT3 */
  467. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 4),
  468. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  469. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  470. ++ SUNXI_FUNCTION(0x3, "spdif"), /* OUT */
  471. ++ SUNXI_FUNCTION(0x5, "i2c3"), /* SCK */
  472. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 4)), /* PH_EINT4 */
  473. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 5),
  474. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  475. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  476. ++ SUNXI_FUNCTION(0x2, "uart2"), /* TX */
  477. ++ SUNXI_FUNCTION(0x3, "h_i2s3"), /* MCLK */
  478. ++ SUNXI_FUNCTION(0x4, "spi1"), /* CS0 */
  479. ++ SUNXI_FUNCTION(0x5, "i2c3"), /* SDA */
  480. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 5)), /* PH_EINT5 */
  481. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 6),
  482. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  483. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  484. ++ SUNXI_FUNCTION(0x2, "uart2"), /* RX */
  485. ++ SUNXI_FUNCTION(0x3, "h_i2s3"), /* BCLK */
  486. ++ SUNXI_FUNCTION(0x4, "spi1"), /* CLK */
  487. ++ SUNXI_FUNCTION(0x5, "i2c4"), /* SCK */
  488. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 6)), /* PH_EINT6 */
  489. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 7),
  490. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  491. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  492. ++ SUNXI_FUNCTION(0x2, "uart2"), /* RTS */
  493. ++ SUNXI_FUNCTION(0x3, "h_i2s3"), /* SYNC */
  494. ++ SUNXI_FUNCTION(0x4, "spi1"), /* MOSI */
  495. ++ SUNXI_FUNCTION(0x5, "i2c4"), /* SDA */
  496. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 7)), /* PH_EINT7 */
  497. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 8),
  498. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  499. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  500. ++ SUNXI_FUNCTION(0x2, "uart2"), /* CTS */
  501. ++ SUNXI_FUNCTION(0x3, "h_i2s3"), /* DO0 */
  502. ++ SUNXI_FUNCTION(0x4, "spi1"), /* MISO */
  503. ++ SUNXI_FUNCTION(0x5, "h_i2s3"), /* DI1 */
  504. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 8)), /* PH_EINT8 */
  505. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 9),
  506. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  507. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  508. ++ SUNXI_FUNCTION(0x3, "h_i2s3"), /* DI0 */
  509. ++ SUNXI_FUNCTION(0x4, "spi1"), /* CS1 */
  510. ++ SUNXI_FUNCTION(0x3, "h_i2s3"), /* DO1 */
  511. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 9)), /* PH_EINT9 */
  512. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 10),
  513. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  514. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  515. ++ SUNXI_FUNCTION(0x3, "ir_rx"),
  516. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 3, 10)), /* PH_EINT10 */
  517. ++ /* Hole */
  518. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 0),
  519. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  520. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  521. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ERXD3 */
  522. ++ SUNXI_FUNCTION(0x3, "dmic"), /* CLK */
  523. ++ SUNXI_FUNCTION(0x4, "h_i2s0"), /* MCLK */
  524. ++ SUNXI_FUNCTION(0x5, "hdmi"), /* HSCL */
  525. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 0)), /* PI_EINT0 */
  526. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 1),
  527. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  528. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  529. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ERXD2 */
  530. ++ SUNXI_FUNCTION(0x3, "dmic"), /* DATA0 */
  531. ++ SUNXI_FUNCTION(0x4, "h_i2s0"), /* BCLK */
  532. ++ SUNXI_FUNCTION(0x5, "hdmi"), /* HSDA */
  533. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 1)), /* PI_EINT1 */
  534. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 2),
  535. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  536. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  537. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ERXD1 */
  538. ++ SUNXI_FUNCTION(0x3, "dmic"), /* DATA1 */
  539. ++ SUNXI_FUNCTION(0x4, "h_i2s0"), /* SYNC */
  540. ++ SUNXI_FUNCTION(0x5, "hdmi"), /* HCEC */
  541. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 2)), /* PI_EINT2 */
  542. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 3),
  543. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  544. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  545. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ERXD0 */
  546. ++ SUNXI_FUNCTION(0x3, "dmic"), /* DATA2 */
  547. ++ SUNXI_FUNCTION(0x4, "h_i2s0"), /* DO0 */
  548. ++ SUNXI_FUNCTION(0x5, "h_i2s0"), /* DI1 */
  549. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 3)), /* PI_EINT3 */
  550. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 4),
  551. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  552. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  553. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ERXCK */
  554. ++ SUNXI_FUNCTION(0x3, "dmic"), /* DATA3 */
  555. ++ SUNXI_FUNCTION(0x4, "h_i2s0"), /* DI0 */
  556. ++ SUNXI_FUNCTION(0x5, "h_i2s0"), /* DO1 */
  557. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 4)), /* PI_EINT4 */
  558. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 5),
  559. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  560. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  561. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ERXCTL */
  562. ++ SUNXI_FUNCTION(0x3, "uart2"), /* TX */
  563. ++ SUNXI_FUNCTION(0x4, "ts0"), /* CLK */
  564. ++ SUNXI_FUNCTION(0x5, "i2c0"), /* SCK */
  565. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 5)), /* PI_EINT5 */
  566. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 6),
  567. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  568. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  569. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ENULL */
  570. ++ SUNXI_FUNCTION(0x3, "uart2"), /* RX */
  571. ++ SUNXI_FUNCTION(0x4, "ts0"), /* ERR */
  572. ++ SUNXI_FUNCTION(0x5, "i2c0"), /* SDA */
  573. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 6)), /* PI_EINT6 */
  574. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 7),
  575. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  576. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  577. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ETXD3 */
  578. ++ SUNXI_FUNCTION(0x3, "uart2"), /* RTS */
  579. ++ SUNXI_FUNCTION(0x4, "ts0"), /* SYNC */
  580. ++ SUNXI_FUNCTION(0x5, "i2c1"), /* SCK */
  581. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 7)), /* PI_EINT7 */
  582. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 8),
  583. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  584. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  585. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ETXD2 */
  586. ++ SUNXI_FUNCTION(0x3, "uart2"), /* CTS */
  587. ++ SUNXI_FUNCTION(0x4, "ts0"), /* DVLD */
  588. ++ SUNXI_FUNCTION(0x5, "i2c1"), /* SDA */
  589. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 8)), /* PI_EINT8 */
  590. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 9),
  591. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  592. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  593. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ETXD1 */
  594. ++ SUNXI_FUNCTION(0x3, "uart3"), /* TX */
  595. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D0 */
  596. ++ SUNXI_FUNCTION(0x5, "i2c2"), /* SCK */
  597. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 9)), /* PI_EINT9 */
  598. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 10),
  599. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  600. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  601. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ETXD0 */
  602. ++ SUNXI_FUNCTION(0x3, "uart3"), /* RX */
  603. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D1 */
  604. ++ SUNXI_FUNCTION(0x5, "i2c2"), /* SDA */
  605. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 10)), /* PI_EINT10 */
  606. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 11),
  607. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  608. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  609. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ETXCK */
  610. ++ SUNXI_FUNCTION(0x3, "uart3"), /* RTS */
  611. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D2 */
  612. ++ SUNXI_FUNCTION(0x5, "pwm1"),
  613. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 11)), /* PI_EINT11 */
  614. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 12),
  615. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  616. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  617. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ETXCTL */
  618. ++ SUNXI_FUNCTION(0x3, "uart3"), /* CTS */
  619. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D3 */
  620. ++ SUNXI_FUNCTION(0x5, "pwm2"),
  621. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 12)), /* PI_EINT12 */
  622. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 13),
  623. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  624. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  625. ++ SUNXI_FUNCTION(0x2, "emac0"), /* ECLKIN */
  626. ++ SUNXI_FUNCTION(0x3, "uart4"), /* TX */
  627. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D4 */
  628. ++ SUNXI_FUNCTION(0x5, "pwm3"),
  629. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 13)), /* PI_EINT13 */
  630. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 14),
  631. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  632. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  633. ++ SUNXI_FUNCTION(0x2, "emac0"), /* MDC */
  634. ++ SUNXI_FUNCTION(0x3, "uart4"), /* RX */
  635. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D5 */
  636. ++ SUNXI_FUNCTION(0x5, "pwm4"),
  637. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 14)), /* PI_EINT14 */
  638. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 15),
  639. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  640. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  641. ++ SUNXI_FUNCTION(0x2, "emac0"), /* MDIO */
  642. ++ SUNXI_FUNCTION(0x3, "uart4"), /* RTS */
  643. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D6 */
  644. ++ SUNXI_FUNCTION(0x5, "clock"), /* CLK_FANOUT0 */
  645. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 15)), /* PI_EINT15 */
  646. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(I, 16),
  647. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  648. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  649. ++ SUNXI_FUNCTION(0x2, "emac0"), /* EPHY_CLK */
  650. ++ SUNXI_FUNCTION(0x3, "uart4"), /* CTS */
  651. ++ SUNXI_FUNCTION(0x4, "ts0"), /* D7 */
  652. ++ SUNXI_FUNCTION(0x5, "clock"), /* CLK_FANOUT1 */
  653. ++ SUNXI_FUNCTION_IRQ_BANK(0x6, 4, 16)), /* PI_EINT16 */
  654. ++};
  655. ++static const unsigned int h616_irq_bank_map[] = { 2, 5, 6, 7, 8 };
  656. ++
  657. ++static const struct sunxi_pinctrl_desc h616_pinctrl_data = {
  658. ++ .pins = h616_pins,
  659. ++ .npins = ARRAY_SIZE(h616_pins),
  660. ++ .irq_banks = 5,
  661. ++ .irq_bank_map = h616_irq_bank_map,
  662. ++ .irq_read_needs_mux = true,
  663. ++ .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL,
  664. ++};
  665. ++
  666. ++static int h616_pinctrl_probe(struct platform_device *pdev)
  667. ++{
  668. ++ return sunxi_pinctrl_init(pdev,
  669. ++ &h616_pinctrl_data);
  670. ++}
  671. ++
  672. ++static const struct of_device_id h616_pinctrl_match[] = {
  673. ++ { .compatible = "allwinner,sun50i-h616-pinctrl", },
  674. ++ {}
  675. ++};
  676. ++
  677. ++static struct platform_driver h616_pinctrl_driver = {
  678. ++ .probe = h616_pinctrl_probe,
  679. ++ .driver = {
  680. ++ .name = "sun50i-h616-pinctrl",
  681. ++ .of_match_table = h616_pinctrl_match,
  682. ++ },
  683. ++};
  684. ++builtin_platform_driver(h616_pinctrl_driver);
  685. diff --git a/target/linux/sunxi/patches-5.10/503-Add-support-for-the-Allwinner-H616-R-pin-controller.patch b/target/linux/sunxi/patches-5.10/503-Add-support-for-the-Allwinner-H616-R-pin-controller.patch
  686. new file mode 100644
  687. index 0000000000000..b876452508a27
  688. --- /dev/null
  689. +++ b/target/linux/sunxi/patches-5.10/503-Add-support-for-the-Allwinner-H616-R-pin-controller.patch
  690. @@ -0,0 +1,89 @@
  691. +diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig
  692. +index 73e88ce71a48..33751a6a0757 100644
  693. +--- a/drivers/pinctrl/sunxi/Kconfig
  694. ++++ b/drivers/pinctrl/sunxi/Kconfig
  695. +@@ -124,4 +124,9 @@ config PINCTRL_SUN50I_H616
  696. + default ARM64 && ARCH_SUNXI
  697. + select PINCTRL_SUNXI
  698. +
  699. ++config PINCTRL_SUN50I_H616_R
  700. ++ bool "Support for the Allwinner H616 R-PIO"
  701. ++ default ARM64 && ARCH_SUNXI
  702. ++ select PINCTRL_SUNXI
  703. ++
  704. + endif
  705. +diff --git a/drivers/pinctrl/sunxi/Makefile b/drivers/pinctrl/sunxi/Makefile
  706. +index 5359327a3c8f..d3440c42b9d6 100644
  707. +--- a/drivers/pinctrl/sunxi/Makefile
  708. ++++ b/drivers/pinctrl/sunxi/Makefile
  709. +@@ -24,5 +24,6 @@ obj-$(CONFIG_PINCTRL_SUN50I_H5) += pinctrl-sun50i-h5.o
  710. + obj-$(CONFIG_PINCTRL_SUN50I_H6) += pinctrl-sun50i-h6.o
  711. + obj-$(CONFIG_PINCTRL_SUN50I_H6_R) += pinctrl-sun50i-h6-r.o
  712. + obj-$(CONFIG_PINCTRL_SUN50I_H616) += pinctrl-sun50i-h616.o
  713. ++obj-$(CONFIG_PINCTRL_SUN50I_H616_R) += pinctrl-sun50i-h616-r.o
  714. + obj-$(CONFIG_PINCTRL_SUN9I_A80) += pinctrl-sun9i-a80.o
  715. + obj-$(CONFIG_PINCTRL_SUN9I_A80_R) += pinctrl-sun9i-a80-r.o
  716. +diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-h616-r.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616-r.c
  717. +new file mode 100644
  718. +index 000000000000..eb76c009bf24
  719. +--- /dev/null
  720. ++++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-h616-r.c
  721. +@@ -0,0 +1,58 @@
  722. ++// SPDX-License-Identifier: GPL-2.0
  723. ++/*
  724. ++ * Allwinner H616 R_PIO pin controller driver
  725. ++ *
  726. ++ * Copyright (C) 2020 Arm Ltd.
  727. ++ * Based on former work, which is:
  728. ++ * Copyright (C) 2017 Icenowy Zheng <[email protected]>
  729. ++ * Copyright (C) 2014 Boris Brezillon
  730. ++ * Boris Brezillon <[email protected]>
  731. ++ * Copyright (C) 2014 Maxime Ripard
  732. ++ * Maxime Ripard <[email protected]>
  733. ++ */
  734. ++
  735. ++#include <linux/init.h>
  736. ++#include <linux/platform_device.h>
  737. ++#include <linux/of.h>
  738. ++#include <linux/of_device.h>
  739. ++#include <linux/pinctrl/pinctrl.h>
  740. ++#include <linux/reset.h>
  741. ++
  742. ++#include "pinctrl-sunxi.h"
  743. ++
  744. ++static const struct sunxi_desc_pin sun50i_h616_r_pins[] = {
  745. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0),
  746. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  747. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  748. ++ SUNXI_FUNCTION(0x3, "s_i2c")), /* SCK */
  749. ++ SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1),
  750. ++ SUNXI_FUNCTION(0x0, "gpio_in"),
  751. ++ SUNXI_FUNCTION(0x1, "gpio_out"),
  752. ++ SUNXI_FUNCTION(0x3, "s_i2c")), /* SDA */
  753. ++};
  754. ++
  755. ++static const struct sunxi_pinctrl_desc sun50i_h616_r_pinctrl_data = {
  756. ++ .pins = sun50i_h616_r_pins,
  757. ++ .npins = ARRAY_SIZE(sun50i_h616_r_pins),
  758. ++ .pin_base = PL_BASE,
  759. ++};
  760. ++
  761. ++static int sun50i_h616_r_pinctrl_probe(struct platform_device *pdev)
  762. ++{
  763. ++ return sunxi_pinctrl_init(pdev,
  764. ++ &sun50i_h616_r_pinctrl_data);
  765. ++}
  766. ++
  767. ++static const struct of_device_id sun50i_h616_r_pinctrl_match[] = {
  768. ++ { .compatible = "allwinner,sun50i-h616-r-pinctrl", },
  769. ++ {}
  770. ++};
  771. ++
  772. ++static struct platform_driver sun50i_h616_r_pinctrl_driver = {
  773. ++ .probe = sun50i_h616_r_pinctrl_probe,
  774. ++ .driver = {
  775. ++ .name = "sun50i-h616-r-pinctrl",
  776. ++ .of_match_table = sun50i_h616_r_pinctrl_match,
  777. ++ },
  778. ++};
  779. ++builtin_platform_driver(sun50i_h616_r_pinctrl_driver);
  780. diff --git a/target/linux/sunxi/patches-5.10/504-Add-support-for-the-Allwinner-H616-R-CCU.patch b/target/linux/sunxi/patches-5.10/504-Add-support-for-the-Allwinner-H616-R-CCU.patch
  781. new file mode 100644
  782. index 0000000000000..f7bfe45706a90
  783. --- /dev/null
  784. +++ b/target/linux/sunxi/patches-5.10/504-Add-support-for-the-Allwinner-H616-R-CCU.patch
  785. @@ -0,0 +1,96 @@
  786. +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
  787. +index 50f8d1bc7046..119d1797f501 100644
  788. +--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
  789. ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
  790. +@@ -136,6 +136,15 @@ static struct ccu_common *sun50i_h6_r_ccu_clks[] = {
  791. + &w1_clk.common,
  792. + };
  793. +
  794. ++static struct ccu_common *sun50i_h616_r_ccu_clks[] = {
  795. ++ &r_apb1_clk.common,
  796. ++ &r_apb2_clk.common,
  797. ++ &r_apb1_twd_clk.common,
  798. ++ &r_apb2_i2c_clk.common,
  799. ++ &r_apb1_ir_clk.common,
  800. ++ &ir_clk.common,
  801. ++};
  802. ++
  803. + static struct clk_hw_onecell_data sun50i_h6_r_hw_clks = {
  804. + .hws = {
  805. + [CLK_AR100] = &ar100_clk.common.hw,
  806. +@@ -152,7 +161,20 @@ static struct clk_hw_onecell_data sun50i_h6_r_hw_clks = {
  807. + [CLK_IR] = &ir_clk.common.hw,
  808. + [CLK_W1] = &w1_clk.common.hw,
  809. + },
  810. +- .num = CLK_NUMBER,
  811. ++ .num = CLK_NUMBER_H616,
  812. ++};
  813. ++
  814. ++static struct clk_hw_onecell_data sun50i_h616_r_hw_clks = {
  815. ++ .hws = {
  816. ++ [CLK_R_AHB] = &r_ahb_clk.hw,
  817. ++ [CLK_R_APB1] = &r_apb1_clk.common.hw,
  818. ++ [CLK_R_APB2] = &r_apb2_clk.common.hw,
  819. ++ [CLK_R_APB1_TWD] = &r_apb1_twd_clk.common.hw,
  820. ++ [CLK_R_APB2_I2C] = &r_apb2_i2c_clk.common.hw,
  821. ++ [CLK_R_APB1_IR] = &r_apb1_ir_clk.common.hw,
  822. ++ [CLK_IR] = &ir_clk.common.hw,
  823. ++ },
  824. ++ .num = CLK_NUMBER_H616,
  825. + };
  826. +
  827. + static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
  828. +@@ -165,6 +187,12 @@ static struct ccu_reset_map sun50i_h6_r_ccu_resets[] = {
  829. + [RST_R_APB1_W1] = { 0x1ec, BIT(16) },
  830. + };
  831. +
  832. ++static struct ccu_reset_map sun50i_h616_r_ccu_resets[] = {
  833. ++ [RST_R_APB1_TWD] = { 0x12c, BIT(16) },
  834. ++ [RST_R_APB2_I2C] = { 0x19c, BIT(16) },
  835. ++ [RST_R_APB1_IR] = { 0x1cc, BIT(16) },
  836. ++};
  837. ++
  838. + static const struct sunxi_ccu_desc sun50i_h6_r_ccu_desc = {
  839. + .ccu_clks = sun50i_h6_r_ccu_clks,
  840. + .num_ccu_clks = ARRAY_SIZE(sun50i_h6_r_ccu_clks),
  841. +@@ -175,6 +203,16 @@ static const struct sunxi_ccu_desc sun50i_h6_r_ccu_desc = {
  842. + .num_resets = ARRAY_SIZE(sun50i_h6_r_ccu_resets),
  843. + };
  844. +
  845. ++static const struct sunxi_ccu_desc sun50i_h616_r_ccu_desc = {
  846. ++ .ccu_clks = sun50i_h616_r_ccu_clks,
  847. ++ .num_ccu_clks = ARRAY_SIZE(sun50i_h616_r_ccu_clks),
  848. ++
  849. ++ .hw_clks = &sun50i_h616_r_hw_clks,
  850. ++
  851. ++ .resets = sun50i_h616_r_ccu_resets,
  852. ++ .num_resets = ARRAY_SIZE(sun50i_h616_r_ccu_resets),
  853. ++};
  854. ++
  855. + static void __init sunxi_r_ccu_init(struct device_node *node,
  856. + const struct sunxi_ccu_desc *desc)
  857. + {
  858. +@@ -195,3 +233,10 @@ static void __init sun50i_h6_r_ccu_setup(struct device_node *node)
  859. + }
  860. + CLK_OF_DECLARE(sun50i_h6_r_ccu, "allwinner,sun50i-h6-r-ccu",
  861. + sun50i_h6_r_ccu_setup);
  862. ++
  863. ++static void __init sun50i_h616_r_ccu_setup(struct device_node *node)
  864. ++{
  865. ++ sunxi_r_ccu_init(node, &sun50i_h616_r_ccu_desc);
  866. ++}
  867. ++CLK_OF_DECLARE(sun50i_h616_r_ccu, "allwinner,sun50i-h616-r-ccu",
  868. ++ sun50i_h616_r_ccu_setup);
  869. +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h
  870. +index 782117dc0b28..128302696ca1 100644
  871. +--- a/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h
  872. ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h6-r.h
  873. +@@ -14,6 +14,7 @@
  874. +
  875. + #define CLK_R_APB2 3
  876. +
  877. +-#define CLK_NUMBER (CLK_W1 + 1)
  878. ++#define CLK_NUMBER_H6 (CLK_W1 + 1)
  879. ++#define CLK_NUMBER_H616 (CLK_IR + 1)
  880. +
  881. + #endif /* _CCU_SUN50I_H6_R_H */
  882. diff --git a/target/linux/sunxi/patches-5.10/505-Add-support-for-the-Allwinner-H616-CCU.patch b/target/linux/sunxi/patches-5.10/505-Add-support-for-the-Allwinner-H616-CCU.patch
  883. new file mode 100644
  884. index 0000000000000..488d3cee3e02a
  885. --- /dev/null
  886. +++ b/target/linux/sunxi/patches-5.10/505-Add-support-for-the-Allwinner-H616-CCU.patch
  887. @@ -0,0 +1,1424 @@
  888. +diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig
  889. +index ce5f5847d5d3..cd46d8853876 100644
  890. +--- a/drivers/clk/sunxi-ng/Kconfig
  891. ++++ b/drivers/clk/sunxi-ng/Kconfig
  892. +@@ -32,8 +32,13 @@ config SUN50I_H6_CCU
  893. + default ARM64 && ARCH_SUNXI
  894. + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
  895. +
  896. ++config SUN50I_H616_CCU
  897. ++ bool "Support for the Allwinner H616 CCU"
  898. ++ default ARM64 && ARCH_SUNXI
  899. ++ depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
  900. ++
  901. + config SUN50I_H6_R_CCU
  902. +- bool "Support for the Allwinner H6 PRCM CCU"
  903. ++ bool "Support for the Allwinner H6 and H616 PRCM CCU"
  904. + default ARM64 && ARCH_SUNXI
  905. + depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
  906. +
  907. +diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
  908. +index 3eb5cff40eac..96c324306d97 100644
  909. +--- a/drivers/clk/sunxi-ng/Makefile
  910. ++++ b/drivers/clk/sunxi-ng/Makefile
  911. +@@ -26,6 +26,7 @@ obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o
  912. + obj-$(CONFIG_SUN50I_A100_CCU) += ccu-sun50i-a100.o
  913. + obj-$(CONFIG_SUN50I_A100_R_CCU) += ccu-sun50i-a100-r.o
  914. + obj-$(CONFIG_SUN50I_H6_CCU) += ccu-sun50i-h6.o
  915. ++obj-$(CONFIG_SUN50I_H616_CCU) += ccu-sun50i-h616.o
  916. + obj-$(CONFIG_SUN50I_H6_R_CCU) += ccu-sun50i-h6-r.o
  917. + obj-$(CONFIG_SUN4I_A10_CCU) += ccu-sun4i-a10.o
  918. + obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o
  919. +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c b/drivers/clk/sunxi-ng/ccu-sun50i-h616.c
  920. +new file mode 100644
  921. +index 000000000000..3fbb258f0354
  922. +--- /dev/null
  923. ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h616.c
  924. +@@ -0,0 +1,1134 @@
  925. ++// SPDX-License-Identifier: GPL-2.0
  926. ++/*
  927. ++ * Copyright (c) 2020 Arm Ltd.
  928. ++ * Based on the H6 CCU driver, which is:
  929. ++ * Copyright (c) 2017 Icenowy Zheng <[email protected]>
  930. ++ */
  931. ++
  932. ++#include <linux/clk-provider.h>
  933. ++#include <linux/io.h>
  934. ++#include <linux/of_address.h>
  935. ++#include <linux/platform_device.h>
  936. ++
  937. ++#include "ccu_common.h"
  938. ++#include "ccu_reset.h"
  939. ++
  940. ++#include "ccu_div.h"
  941. ++#include "ccu_gate.h"
  942. ++#include "ccu_mp.h"
  943. ++#include "ccu_mult.h"
  944. ++#include "ccu_nk.h"
  945. ++#include "ccu_nkm.h"
  946. ++#include "ccu_nkmp.h"
  947. ++#include "ccu_nm.h"
  948. ++
  949. ++#include "ccu-sun50i-h616.h"
  950. ++
  951. ++/*
  952. ++ * The CPU PLL is actually NP clock, with P being /1, /2 or /4. However
  953. ++ * P should only be used for output frequencies lower than 288 MHz.
  954. ++ *
  955. ++ * For now we can just model it as a multiplier clock, and force P to /1.
  956. ++ *
  957. ++ * The M factor is present in the register's description, but not in the
  958. ++ * frequency formula, and it's documented as "M is only used for backdoor
  959. ++ * testing", so it's not modelled and then force to 0.
  960. ++ */
  961. ++#define SUN50I_H616_PLL_CPUX_REG 0x000
  962. ++static struct ccu_mult pll_cpux_clk = {
  963. ++ .enable = BIT(31),
  964. ++ .lock = BIT(28),
  965. ++ .mult = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  966. ++ .common = {
  967. ++ .reg = 0x000,
  968. ++ .hw.init = CLK_HW_INIT("pll-cpux", "osc24M",
  969. ++ &ccu_mult_ops,
  970. ++ CLK_SET_RATE_UNGATE),
  971. ++ },
  972. ++};
  973. ++
  974. ++/* Some PLLs are input * N / div1 / P. Model them as NKMP with no K */
  975. ++#define SUN50I_H616_PLL_DDR0_REG 0x010
  976. ++static struct ccu_nkmp pll_ddr0_clk = {
  977. ++ .enable = BIT(31),
  978. ++ .lock = BIT(28),
  979. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  980. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  981. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  982. ++ .common = {
  983. ++ .reg = 0x010,
  984. ++ .hw.init = CLK_HW_INIT("pll-ddr0", "osc24M",
  985. ++ &ccu_nkmp_ops,
  986. ++ CLK_SET_RATE_UNGATE),
  987. ++ },
  988. ++};
  989. ++
  990. ++#define SUN50I_H616_PLL_DDR1_REG 0x018
  991. ++static struct ccu_nkmp pll_ddr1_clk = {
  992. ++ .enable = BIT(31),
  993. ++ .lock = BIT(28),
  994. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  995. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  996. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  997. ++ .common = {
  998. ++ .reg = 0x018,
  999. ++ .hw.init = CLK_HW_INIT("pll-ddr1", "osc24M",
  1000. ++ &ccu_nkmp_ops,
  1001. ++ CLK_SET_RATE_UNGATE),
  1002. ++ },
  1003. ++};
  1004. ++
  1005. ++#define SUN50I_H616_PLL_PERIPH0_REG 0x020
  1006. ++static struct ccu_nkmp pll_periph0_clk = {
  1007. ++ .enable = BIT(31),
  1008. ++ .lock = BIT(28),
  1009. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1010. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1011. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  1012. ++ .fixed_post_div = 4,
  1013. ++ .common = {
  1014. ++ .reg = 0x020,
  1015. ++ .features = CCU_FEATURE_FIXED_POSTDIV,
  1016. ++ .hw.init = CLK_HW_INIT("pll-periph0", "osc24M",
  1017. ++ &ccu_nkmp_ops,
  1018. ++ CLK_SET_RATE_UNGATE),
  1019. ++ },
  1020. ++};
  1021. ++
  1022. ++#define SUN50I_H616_PLL_PERIPH1_REG 0x028
  1023. ++static struct ccu_nkmp pll_periph1_clk = {
  1024. ++ .enable = BIT(31),
  1025. ++ .lock = BIT(28),
  1026. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1027. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1028. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  1029. ++ .fixed_post_div = 4,
  1030. ++ .common = {
  1031. ++ .reg = 0x028,
  1032. ++ .features = CCU_FEATURE_FIXED_POSTDIV,
  1033. ++ .hw.init = CLK_HW_INIT("pll-periph1", "osc24M",
  1034. ++ &ccu_nkmp_ops,
  1035. ++ CLK_SET_RATE_UNGATE),
  1036. ++ },
  1037. ++};
  1038. ++
  1039. ++#define SUN50I_H616_PLL_GPU_REG 0x030
  1040. ++static struct ccu_nkmp pll_gpu_clk = {
  1041. ++ .enable = BIT(31),
  1042. ++ .lock = BIT(28),
  1043. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1044. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1045. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  1046. ++ .common = {
  1047. ++ .reg = 0x030,
  1048. ++ .hw.init = CLK_HW_INIT("pll-gpu", "osc24M",
  1049. ++ &ccu_nkmp_ops,
  1050. ++ CLK_SET_RATE_UNGATE),
  1051. ++ },
  1052. ++};
  1053. ++
  1054. ++/*
  1055. ++ * For Video PLLs, the output divider is described as "used for testing"
  1056. ++ * in the user manual. So it's not modelled and forced to 0.
  1057. ++ */
  1058. ++#define SUN50I_H616_PLL_VIDEO0_REG 0x040
  1059. ++static struct ccu_nm pll_video0_clk = {
  1060. ++ .enable = BIT(31),
  1061. ++ .lock = BIT(28),
  1062. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1063. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1064. ++ .fixed_post_div = 4,
  1065. ++ .min_rate = 288000000,
  1066. ++ .max_rate = 2400000000UL,
  1067. ++ .common = {
  1068. ++ .reg = 0x040,
  1069. ++ .features = CCU_FEATURE_FIXED_POSTDIV,
  1070. ++ .hw.init = CLK_HW_INIT("pll-video0", "osc24M",
  1071. ++ &ccu_nm_ops,
  1072. ++ CLK_SET_RATE_UNGATE),
  1073. ++ },
  1074. ++};
  1075. ++
  1076. ++#define SUN50I_H616_PLL_VIDEO1_REG 0x048
  1077. ++static struct ccu_nm pll_video1_clk = {
  1078. ++ .enable = BIT(31),
  1079. ++ .lock = BIT(28),
  1080. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1081. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1082. ++ .fixed_post_div = 4,
  1083. ++ .min_rate = 288000000,
  1084. ++ .max_rate = 2400000000UL,
  1085. ++ .common = {
  1086. ++ .reg = 0x048,
  1087. ++ .features = CCU_FEATURE_FIXED_POSTDIV,
  1088. ++ .hw.init = CLK_HW_INIT("pll-video1", "osc24M",
  1089. ++ &ccu_nm_ops,
  1090. ++ CLK_SET_RATE_UNGATE),
  1091. ++ },
  1092. ++};
  1093. ++
  1094. ++#define SUN50I_H616_PLL_VIDEO2_REG 0x050
  1095. ++static struct ccu_nm pll_video2_clk = {
  1096. ++ .enable = BIT(31),
  1097. ++ .lock = BIT(28),
  1098. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1099. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1100. ++ .fixed_post_div = 4,
  1101. ++ .min_rate = 288000000,
  1102. ++ .max_rate = 2400000000UL,
  1103. ++ .common = {
  1104. ++ .reg = 0x050,
  1105. ++ .features = CCU_FEATURE_FIXED_POSTDIV,
  1106. ++ .hw.init = CLK_HW_INIT("pll-video2", "osc24M",
  1107. ++ &ccu_nm_ops,
  1108. ++ CLK_SET_RATE_UNGATE),
  1109. ++ },
  1110. ++};
  1111. ++
  1112. ++#define SUN50I_H616_PLL_VE_REG 0x058
  1113. ++static struct ccu_nkmp pll_ve_clk = {
  1114. ++ .enable = BIT(31),
  1115. ++ .lock = BIT(28),
  1116. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1117. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1118. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  1119. ++ .common = {
  1120. ++ .reg = 0x058,
  1121. ++ .hw.init = CLK_HW_INIT("pll-ve", "osc24M",
  1122. ++ &ccu_nkmp_ops,
  1123. ++ CLK_SET_RATE_UNGATE),
  1124. ++ },
  1125. ++};
  1126. ++
  1127. ++#define SUN50I_H616_PLL_DE_REG 0x060
  1128. ++static struct ccu_nkmp pll_de_clk = {
  1129. ++ .enable = BIT(31),
  1130. ++ .lock = BIT(28),
  1131. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1132. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1133. ++ .p = _SUNXI_CCU_DIV(0, 1), /* output divider */
  1134. ++ .common = {
  1135. ++ .reg = 0x060,
  1136. ++ .hw.init = CLK_HW_INIT("pll-de", "osc24M",
  1137. ++ &ccu_nkmp_ops,
  1138. ++ CLK_SET_RATE_UNGATE),
  1139. ++ },
  1140. ++};
  1141. ++
  1142. ++/*
  1143. ++ * TODO: Determine SDM settings for the audio PLL. The manual suggests
  1144. ++ * PLL_FACTOR_N=16, PLL_POST_DIV_P=2, OUTPUT_DIV=2, pattern=0xe000c49b
  1145. ++ * for 24.576 MHz, and PLL_FACTOR_N=22, PLL_POST_DIV_P=3, OUTPUT_DIV=2,
  1146. ++ * pattern=0xe001288c for 22.5792 MHz.
  1147. ++ * This clashes with our fixed PLL_POST_DIV_P.
  1148. ++ */
  1149. ++#define SUN50I_H616_PLL_AUDIO_REG 0x078
  1150. ++static struct ccu_nm pll_audio_hs_clk = {
  1151. ++ .enable = BIT(31),
  1152. ++ .lock = BIT(28),
  1153. ++ .n = _SUNXI_CCU_MULT_MIN(8, 8, 12),
  1154. ++ .m = _SUNXI_CCU_DIV(1, 1), /* input divider */
  1155. ++ .common = {
  1156. ++ .reg = 0x078,
  1157. ++ .hw.init = CLK_HW_INIT("pll-audio-hs", "osc24M",
  1158. ++ &ccu_nm_ops,
  1159. ++ CLK_SET_RATE_UNGATE),
  1160. ++ },
  1161. ++};
  1162. ++
  1163. ++static const char * const cpux_parents[] = { "osc24M", "osc32k",
  1164. ++ "iosc", "pll-cpux", "pll-periph0" };
  1165. ++static SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents,
  1166. ++ 0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL);
  1167. ++static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x500, 0, 2, 0);
  1168. ++static SUNXI_CCU_M(cpux_apb_clk, "cpux-apb", "cpux", 0x500, 8, 2, 0);
  1169. ++
  1170. ++static const char * const psi_ahb1_ahb2_parents[] = { "osc24M", "osc32k",
  1171. ++ "iosc", "pll-periph0" };
  1172. ++static SUNXI_CCU_MP_WITH_MUX(psi_ahb1_ahb2_clk, "psi-ahb1-ahb2",
  1173. ++ psi_ahb1_ahb2_parents,
  1174. ++ 0x510,
  1175. ++ 0, 2, /* M */
  1176. ++ 8, 2, /* P */
  1177. ++ 24, 2, /* mux */
  1178. ++ 0);
  1179. ++
  1180. ++static const char * const ahb3_apb1_apb2_parents[] = { "osc24M", "osc32k",
  1181. ++ "psi-ahb1-ahb2",
  1182. ++ "pll-periph0" };
  1183. ++static SUNXI_CCU_MP_WITH_MUX(ahb3_clk, "ahb3", ahb3_apb1_apb2_parents, 0x51c,
  1184. ++ 0, 2, /* M */
  1185. ++ 8, 2, /* P */
  1186. ++ 24, 2, /* mux */
  1187. ++ 0);
  1188. ++
  1189. ++static SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", ahb3_apb1_apb2_parents, 0x520,
  1190. ++ 0, 2, /* M */
  1191. ++ 8, 2, /* P */
  1192. ++ 24, 2, /* mux */
  1193. ++ 0);
  1194. ++
  1195. ++static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", ahb3_apb1_apb2_parents, 0x524,
  1196. ++ 0, 2, /* M */
  1197. ++ 8, 2, /* P */
  1198. ++ 24, 2, /* mux */
  1199. ++ 0);
  1200. ++
  1201. ++static const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x",
  1202. ++ "pll-ddr0", "pll-ddr1" };
  1203. ++static SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 0x540,
  1204. ++ 0, 3, /* M */
  1205. ++ 24, 2, /* mux */
  1206. ++ BIT(31), /* gate */
  1207. ++ CLK_IS_CRITICAL);
  1208. ++
  1209. ++static const char * const de_parents[] = { "pll-de", "pll-periph0-2x" };
  1210. ++static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, 0x600,
  1211. ++ 0, 4, /* M */
  1212. ++ 24, 1, /* mux */
  1213. ++ BIT(31), /* gate */
  1214. ++ CLK_SET_RATE_PARENT);
  1215. ++
  1216. ++static SUNXI_CCU_GATE(bus_de_clk, "bus-de", "psi-ahb1-ahb2",
  1217. ++ 0x60c, BIT(0), 0);
  1218. ++
  1219. ++static SUNXI_CCU_M_WITH_MUX_GATE(deinterlace_clk, "deinterlace",
  1220. ++ de_parents,
  1221. ++ 0x620,
  1222. ++ 0, 4, /* M */
  1223. ++ 24, 1, /* mux */
  1224. ++ BIT(31), /* gate */
  1225. ++ 0);
  1226. ++
  1227. ++static SUNXI_CCU_GATE(bus_deinterlace_clk, "bus-deinterlace", "psi-ahb1-ahb2",
  1228. ++ 0x62c, BIT(0), 0);
  1229. ++
  1230. ++static SUNXI_CCU_M_WITH_MUX_GATE(g2d_clk, "g2d", de_parents, 0x630,
  1231. ++ 0, 4, /* M */
  1232. ++ 24, 1, /* mux */
  1233. ++ BIT(31), /* gate */
  1234. ++ 0);
  1235. ++
  1236. ++static SUNXI_CCU_GATE(bus_g2d_clk, "bus-g2d", "psi-ahb1-ahb2",
  1237. ++ 0x63c, BIT(0), 0);
  1238. ++
  1239. ++static const char * const gpu0_parents[] = { "pll-gpu", "gpu1" };
  1240. ++static SUNXI_CCU_M_WITH_MUX_GATE(gpu0_clk, "gpu0", gpu0_parents, 0x670,
  1241. ++ 0, 2, /* M */
  1242. ++ 24, 1, /* mux */
  1243. ++ BIT(31), /* gate */
  1244. ++ CLK_SET_RATE_PARENT);
  1245. ++static SUNXI_CCU_M_WITH_GATE(gpu1_clk, "gpu1", "pll-periph0-2x", 0x674,
  1246. ++ 0, 3, /* M */
  1247. ++ BIT(31),/* gate */
  1248. ++ 0);
  1249. ++
  1250. ++static SUNXI_CCU_GATE(bus_gpu_clk, "bus-gpu", "psi-ahb1-ahb2",
  1251. ++ 0x67c, BIT(0), 0);
  1252. ++
  1253. ++static const char * const ce_parents[] = { "osc24M", "pll-periph0-2x" };
  1254. ++static SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x680,
  1255. ++ 0, 4, /* M */
  1256. ++ 8, 2, /* N */
  1257. ++ 24, 1, /* mux */
  1258. ++ BIT(31),/* gate */
  1259. ++ 0);
  1260. ++
  1261. ++static SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "psi-ahb1-ahb2",
  1262. ++ 0x68c, BIT(0), 0);
  1263. ++
  1264. ++static const char * const ve_parents[] = { "pll-ve" };
  1265. ++static SUNXI_CCU_M_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690,
  1266. ++ 0, 3, /* M */
  1267. ++ 24, 1, /* mux */
  1268. ++ BIT(31), /* gate */
  1269. ++ CLK_SET_RATE_PARENT);
  1270. ++
  1271. ++static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "psi-ahb1-ahb2",
  1272. ++ 0x69c, BIT(0), 0);
  1273. ++
  1274. ++static SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "psi-ahb1-ahb2",
  1275. ++ 0x70c, BIT(0), 0);
  1276. ++
  1277. ++static SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "psi-ahb1-ahb2",
  1278. ++ 0x73c, BIT(0), 0);
  1279. ++
  1280. ++static SUNXI_CCU_GATE(avs_clk, "avs", "osc24M", 0x740, BIT(31), 0);
  1281. ++
  1282. ++static SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "psi-ahb1-ahb2",
  1283. ++ 0x78c, BIT(0), 0);
  1284. ++
  1285. ++static SUNXI_CCU_GATE(bus_psi_clk, "bus-psi", "psi-ahb1-ahb2",
  1286. ++ 0x79c, BIT(0), 0);
  1287. ++
  1288. ++static SUNXI_CCU_GATE(bus_pwm_clk, "bus-pwm", "apb1", 0x7ac, BIT(0), 0);
  1289. ++
  1290. ++static SUNXI_CCU_GATE(bus_iommu_clk, "bus-iommu", "apb1", 0x7bc, BIT(0), 0);
  1291. ++
  1292. ++static const char * const dram_parents[] = { "pll-ddr0", "pll-ddr1" };
  1293. ++static struct ccu_div dram_clk = {
  1294. ++ .div = _SUNXI_CCU_DIV(0, 2),
  1295. ++ .mux = _SUNXI_CCU_MUX(24, 2),
  1296. ++ .common = {
  1297. ++ .reg = 0x800,
  1298. ++ .hw.init = CLK_HW_INIT_PARENTS("dram",
  1299. ++ dram_parents,
  1300. ++ &ccu_div_ops,
  1301. ++ CLK_IS_CRITICAL),
  1302. ++ },
  1303. ++};
  1304. ++
  1305. ++static SUNXI_CCU_GATE(mbus_dma_clk, "mbus-dma", "mbus",
  1306. ++ 0x804, BIT(0), 0);
  1307. ++static SUNXI_CCU_GATE(mbus_ve_clk, "mbus-ve", "mbus",
  1308. ++ 0x804, BIT(1), 0);
  1309. ++static SUNXI_CCU_GATE(mbus_ce_clk, "mbus-ce", "mbus",
  1310. ++ 0x804, BIT(2), 0);
  1311. ++static SUNXI_CCU_GATE(mbus_ts_clk, "mbus-ts", "mbus",
  1312. ++ 0x804, BIT(3), 0);
  1313. ++static SUNXI_CCU_GATE(mbus_nand_clk, "mbus-nand", "mbus",
  1314. ++ 0x804, BIT(5), 0);
  1315. ++static SUNXI_CCU_GATE(mbus_g2d_clk, "mbus-g2d", "mbus",
  1316. ++ 0x804, BIT(10), 0);
  1317. ++
  1318. ++static SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "psi-ahb1-ahb2",
  1319. ++ 0x80c, BIT(0), CLK_IS_CRITICAL);
  1320. ++
  1321. ++static const char * const nand_spi_parents[] = { "osc24M", "pll-periph0",
  1322. ++ "pll-periph1", "pll-periph0-2x",
  1323. ++ "pll-periph1-2x" };
  1324. ++static SUNXI_CCU_MP_WITH_MUX_GATE(nand0_clk, "nand0", nand_spi_parents, 0x810,
  1325. ++ 0, 4, /* M */
  1326. ++ 8, 2, /* N */
  1327. ++ 24, 3, /* mux */
  1328. ++ BIT(31),/* gate */
  1329. ++ 0);
  1330. ++
  1331. ++static SUNXI_CCU_MP_WITH_MUX_GATE(nand1_clk, "nand1", nand_spi_parents, 0x814,
  1332. ++ 0, 4, /* M */
  1333. ++ 8, 2, /* N */
  1334. ++ 24, 3, /* mux */
  1335. ++ BIT(31),/* gate */
  1336. ++ 0);
  1337. ++
  1338. ++static SUNXI_CCU_GATE(bus_nand_clk, "bus-nand", "ahb3", 0x82c, BIT(0), 0);
  1339. ++
  1340. ++static const char * const mmc_parents[] = { "osc24M", "pll-periph0-2x",
  1341. ++ "pll-periph1-2x" };
  1342. ++static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc0_clk, "mmc0", mmc_parents, 0x830,
  1343. ++ 0, 4, /* M */
  1344. ++ 8, 2, /* N */
  1345. ++ 24, 2, /* mux */
  1346. ++ BIT(31), /* gate */
  1347. ++ 2, /* post-div */
  1348. ++ 0);
  1349. ++
  1350. ++static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", mmc_parents, 0x834,
  1351. ++ 0, 4, /* M */
  1352. ++ 8, 2, /* N */
  1353. ++ 24, 2, /* mux */
  1354. ++ BIT(31), /* gate */
  1355. ++ 2, /* post-div */
  1356. ++ 0);
  1357. ++
  1358. ++static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc_parents, 0x838,
  1359. ++ 0, 4, /* M */
  1360. ++ 8, 2, /* N */
  1361. ++ 24, 2, /* mux */
  1362. ++ BIT(31), /* gate */
  1363. ++ 2, /* post-div */
  1364. ++ 0);
  1365. ++
  1366. ++static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0);
  1367. ++static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0);
  1368. ++static SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb3", 0x84c, BIT(2), 0);
  1369. ++
  1370. ++static SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2", 0x90c, BIT(0), 0);
  1371. ++static SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2", 0x90c, BIT(1), 0);
  1372. ++static SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2", 0x90c, BIT(2), 0);
  1373. ++static SUNXI_CCU_GATE(bus_uart3_clk, "bus-uart3", "apb2", 0x90c, BIT(3), 0);
  1374. ++static SUNXI_CCU_GATE(bus_uart4_clk, "bus-uart4", "apb2", 0x90c, BIT(4), 0);
  1375. ++static SUNXI_CCU_GATE(bus_uart5_clk, "bus-uart5", "apb2", 0x90c, BIT(5), 0);
  1376. ++
  1377. ++static SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2", 0x91c, BIT(0), 0);
  1378. ++static SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2", 0x91c, BIT(1), 0);
  1379. ++static SUNXI_CCU_GATE(bus_i2c2_clk, "bus-i2c2", "apb2", 0x91c, BIT(2), 0);
  1380. ++static SUNXI_CCU_GATE(bus_i2c3_clk, "bus-i2c3", "apb2", 0x91c, BIT(3), 0);
  1381. ++static SUNXI_CCU_GATE(bus_i2c4_clk, "bus-i2c4", "apb2", 0x91c, BIT(4), 0);
  1382. ++
  1383. ++static SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", nand_spi_parents, 0x940,
  1384. ++ 0, 4, /* M */
  1385. ++ 8, 2, /* N */
  1386. ++ 24, 3, /* mux */
  1387. ++ BIT(31),/* gate */
  1388. ++ 0);
  1389. ++
  1390. ++static SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", nand_spi_parents, 0x944,
  1391. ++ 0, 4, /* M */
  1392. ++ 8, 2, /* N */
  1393. ++ 24, 3, /* mux */
  1394. ++ BIT(31),/* gate */
  1395. ++ 0);
  1396. ++
  1397. ++static SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb3", 0x96c, BIT(0), 0);
  1398. ++static SUNXI_CCU_GATE(bus_spi1_clk, "bus-spi1", "ahb3", 0x96c, BIT(1), 0);
  1399. ++
  1400. ++static SUNXI_CCU_GATE(emac_25m_clk, "emac-25m", "ahb3", 0x970,
  1401. ++ BIT(31) | BIT(30), 0);
  1402. ++
  1403. ++static SUNXI_CCU_GATE(bus_emac0_clk, "bus-emac0", "ahb3", 0x97c, BIT(0), 0);
  1404. ++static SUNXI_CCU_GATE(bus_emac1_clk, "bus-emac1", "ahb3", 0x97c, BIT(1), 0);
  1405. ++
  1406. ++static const char * const ts_parents[] = { "osc24M", "pll-periph0" };
  1407. ++static SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", ts_parents, 0x9b0,
  1408. ++ 0, 4, /* M */
  1409. ++ 8, 2, /* N */
  1410. ++ 24, 1, /* mux */
  1411. ++ BIT(31),/* gate */
  1412. ++ 0);
  1413. ++
  1414. ++static SUNXI_CCU_GATE(bus_ts_clk, "bus-ts", "ahb3", 0x9bc, BIT(0), 0);
  1415. ++
  1416. ++static SUNXI_CCU_GATE(bus_ths_clk, "bus-ths", "apb1", 0x9fc, BIT(0), 0);
  1417. ++
  1418. ++static const char * const audio_parents[] = { "pll-audio-1x", "pll-audio-2x",
  1419. ++ "pll-audio-4x", "pll-audio-hs" };
  1420. ++static struct ccu_div spdif_clk = {
  1421. ++ .enable = BIT(31),
  1422. ++ .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO),
  1423. ++ .mux = _SUNXI_CCU_MUX(24, 2),
  1424. ++ .common = {
  1425. ++ .reg = 0xa20,
  1426. ++ .hw.init = CLK_HW_INIT_PARENTS("spdif",
  1427. ++ audio_parents,
  1428. ++ &ccu_div_ops,
  1429. ++ 0),
  1430. ++ },
  1431. ++};
  1432. ++
  1433. ++static SUNXI_CCU_GATE(bus_spdif_clk, "bus-spdif", "apb1", 0xa2c, BIT(0), 0);
  1434. ++
  1435. ++static struct ccu_div dmic_clk = {
  1436. ++ .enable = BIT(31),
  1437. ++ .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO),
  1438. ++ .mux = _SUNXI_CCU_MUX(24, 2),
  1439. ++ .common = {
  1440. ++ .reg = 0xa40,
  1441. ++ .hw.init = CLK_HW_INIT_PARENTS("dmic",
  1442. ++ audio_parents,
  1443. ++ &ccu_div_ops,
  1444. ++ 0),
  1445. ++ },
  1446. ++};
  1447. ++
  1448. ++static SUNXI_CCU_GATE(bus_dmic_clk, "bus-dmic", "apb1", 0xa4c, BIT(0), 0);
  1449. ++
  1450. ++static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_1x_clk, "audio-codec-1x",
  1451. ++ audio_parents, 0xa50,
  1452. ++ 0, 4, /* M */
  1453. ++ 24, 2, /* mux */
  1454. ++ BIT(31), /* gate */
  1455. ++ CLK_SET_RATE_PARENT);
  1456. ++static SUNXI_CCU_M_WITH_MUX_GATE(audio_codec_4x_clk, "audio-codec-4x",
  1457. ++ audio_parents, 0xa54,
  1458. ++ 0, 4, /* M */
  1459. ++ 24, 2, /* mux */
  1460. ++ BIT(31), /* gate */
  1461. ++ CLK_SET_RATE_PARENT);
  1462. ++
  1463. ++static SUNXI_CCU_GATE(bus_audio_codec_clk, "bus-audio-codec", "apb1", 0xa5c,
  1464. ++ BIT(0), 0);
  1465. ++
  1466. ++static struct ccu_div audio_hub_clk = {
  1467. ++ .enable = BIT(31),
  1468. ++ .div = _SUNXI_CCU_DIV_FLAGS(8, 2, CLK_DIVIDER_POWER_OF_TWO),
  1469. ++ .mux = _SUNXI_CCU_MUX(24, 2),
  1470. ++ .common = {
  1471. ++ .reg = 0xa60,
  1472. ++ .hw.init = CLK_HW_INIT_PARENTS("audio-hub",
  1473. ++ audio_parents,
  1474. ++ &ccu_div_ops,
  1475. ++ 0),
  1476. ++ },
  1477. ++};
  1478. ++
  1479. ++static SUNXI_CCU_GATE(bus_audio_hub_clk, "bus-audio-hub", "apb1", 0xa6c, BIT(0), 0);
  1480. ++
  1481. ++/*
  1482. ++ * There are OHCI 12M clock source selection bits for 2 USB 2.0 ports.
  1483. ++ * We will force them to 0 (12M divided from 48M).
  1484. ++ */
  1485. ++#define SUN50I_H616_USB0_CLK_REG 0xa70
  1486. ++#define SUN50I_H616_USB1_CLK_REG 0xa74
  1487. ++#define SUN50I_H616_USB2_CLK_REG 0xa78
  1488. ++#define SUN50I_H616_USB3_CLK_REG 0xa7c
  1489. ++
  1490. ++static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc12M", 0xa70, BIT(31), 0);
  1491. ++static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", 0xa70, BIT(29), 0);
  1492. ++
  1493. ++static SUNXI_CCU_GATE(usb_ohci1_clk, "usb-ohci1", "osc12M", 0xa74, BIT(31), 0);
  1494. ++static SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "osc24M", 0xa74, BIT(29), 0);
  1495. ++
  1496. ++static SUNXI_CCU_GATE(usb_ohci2_clk, "usb-ohci2", "osc12M", 0xa78, BIT(31), 0);
  1497. ++static SUNXI_CCU_GATE(usb_phy2_clk, "usb-phy2", "osc24M", 0xa78, BIT(29), 0);
  1498. ++
  1499. ++static SUNXI_CCU_GATE(usb_ohci3_clk, "usb-ohci3", "osc12M", 0xa7c, BIT(31), 0);
  1500. ++static SUNXI_CCU_GATE(usb_phy3_clk, "usb-phy3", "osc12M", 0xa7c, BIT(29), 0);
  1501. ++
  1502. ++static SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb3", 0xa8c, BIT(0), 0);
  1503. ++static SUNXI_CCU_GATE(bus_ohci1_clk, "bus-ohci1", "ahb3", 0xa8c, BIT(1), 0);
  1504. ++static SUNXI_CCU_GATE(bus_ohci2_clk, "bus-ohci2", "ahb3", 0xa8c, BIT(2), 0);
  1505. ++static SUNXI_CCU_GATE(bus_ohci3_clk, "bus-ohci3", "ahb3", 0xa8c, BIT(3), 0);
  1506. ++static SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb3", 0xa8c, BIT(4), 0);
  1507. ++static SUNXI_CCU_GATE(bus_ehci1_clk, "bus-ehci1", "ahb3", 0xa8c, BIT(5), 0);
  1508. ++static SUNXI_CCU_GATE(bus_ehci2_clk, "bus-ehci2", "ahb3", 0xa8c, BIT(6), 0);
  1509. ++static SUNXI_CCU_GATE(bus_ehci3_clk, "bus-ehci3", "ahb3", 0xa8c, BIT(7), 0);
  1510. ++static SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb3", 0xa8c, BIT(8), 0);
  1511. ++
  1512. ++static SUNXI_CCU_GATE(bus_keyadc_clk, "bus-keyadc", "apb1", 0xa9c, BIT(0), 0);
  1513. ++
  1514. ++static struct clk_fixed_factor pll_periph0_4x_clk;
  1515. ++
  1516. ++static const char * const hdmi_parents[] = { "pll-video0", "pll-video0-4x",
  1517. ++ "pll-video2", "pll-video2-4x" };
  1518. ++static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", hdmi_parents, 0xb00,
  1519. ++ 0, 4, /* M */
  1520. ++ 24, 2, /* mux */
  1521. ++ BIT(31), /* gate */
  1522. ++ 0);
  1523. ++
  1524. ++static SUNXI_CCU_GATE(hdmi_slow_clk, "hdmi-slow", "osc24M", 0xb04, BIT(31), 0);
  1525. ++
  1526. ++static const char * const hdmi_cec_parents[] = { "osc32k", "pll-periph0-2x" };
  1527. ++static const struct ccu_mux_fixed_prediv hdmi_cec_predivs[] = {
  1528. ++ { .index = 1, .div = 36621 },
  1529. ++};
  1530. ++
  1531. ++#define SUN50I_H616_HDMI_CEC_CLK_REG 0xb10
  1532. ++static struct ccu_mux hdmi_cec_clk = {
  1533. ++ .enable = BIT(31),
  1534. ++
  1535. ++ .mux = {
  1536. ++ .shift = 24,
  1537. ++ .width = 2,
  1538. ++
  1539. ++ .fixed_predivs = hdmi_cec_predivs,
  1540. ++ .n_predivs = ARRAY_SIZE(hdmi_cec_predivs),
  1541. ++ },
  1542. ++
  1543. ++ .common = {
  1544. ++ .reg = 0xb10,
  1545. ++ .features = CCU_FEATURE_VARIABLE_PREDIV,
  1546. ++ .hw.init = CLK_HW_INIT_PARENTS("hdmi-cec",
  1547. ++ hdmi_cec_parents,
  1548. ++ &ccu_mux_ops,
  1549. ++ 0),
  1550. ++ },
  1551. ++};
  1552. ++
  1553. ++static SUNXI_CCU_GATE(bus_hdmi_clk, "bus-hdmi", "ahb3", 0xb1c, BIT(0), 0);
  1554. ++
  1555. ++static SUNXI_CCU_GATE(bus_tcon_top_clk, "bus-tcon-top", "ahb3",
  1556. ++ 0xb5c, BIT(0), 0);
  1557. ++
  1558. ++static const char * const tcon_tv0_parents[] = { "pll-video0",
  1559. ++ "pll-video0-4x",
  1560. ++ "pll-video1",
  1561. ++ "pll-video1-4x" };
  1562. ++static SUNXI_CCU_MP_WITH_MUX_GATE(tcon_tv0_clk, "tcon-tv0",
  1563. ++ tcon_tv0_parents, 0xb80,
  1564. ++ 0, 4, /* M */
  1565. ++ 8, 2, /* P */
  1566. ++ 24, 3, /* mux */
  1567. ++ BIT(31), /* gate */
  1568. ++ CLK_SET_RATE_PARENT);
  1569. ++
  1570. ++static SUNXI_CCU_GATE(bus_tcon_tv0_clk, "bus-tcon-tv0", "ahb3",
  1571. ++ 0xb9c, BIT(0), 0);
  1572. ++
  1573. ++static const char * const hdcp_parents[] = { "pll-periph0", "pll-periph1" };
  1574. ++static SUNXI_CCU_M_WITH_MUX_GATE(hdcp_clk, "hdcp", hdcp_parents, 0xc40,
  1575. ++ 0, 4, /* M */
  1576. ++ 24, 2, /* mux */
  1577. ++ BIT(31), /* gate */
  1578. ++ 0);
  1579. ++
  1580. ++static SUNXI_CCU_GATE(bus_hdcp_clk, "bus-hdcp", "ahb3", 0xc4c, BIT(0), 0);
  1581. ++
  1582. ++/* Fixed factor clocks */
  1583. ++static CLK_FIXED_FACTOR_FW_NAME(osc12M_clk, "osc12M", "hosc", 2, 1, 0);
  1584. ++
  1585. ++static const struct clk_hw *clk_parent_pll_audio[] = {
  1586. ++ &pll_audio_hs_clk.common.hw
  1587. ++};
  1588. ++
  1589. ++/*
  1590. ++ * The divider of pll-audio is fixed to 24 for now, so 24576000 and 22579200
  1591. ++ * rates can be set exactly in conjunction with sigma-delta modulation.
  1592. ++ */
  1593. ++static CLK_FIXED_FACTOR_HWS(pll_audio_1x_clk, "pll-audio-1x",
  1594. ++ clk_parent_pll_audio,
  1595. ++ 96, 1, CLK_SET_RATE_PARENT);
  1596. ++static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
  1597. ++ clk_parent_pll_audio,
  1598. ++ 48, 1, CLK_SET_RATE_PARENT);
  1599. ++static CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x",
  1600. ++ clk_parent_pll_audio,
  1601. ++ 24, 1, CLK_SET_RATE_PARENT);
  1602. ++
  1603. ++static const struct clk_hw *pll_periph0_parents[] = {
  1604. ++ &pll_periph0_clk.common.hw
  1605. ++};
  1606. ++static CLK_FIXED_FACTOR_HWS(pll_periph0_4x_clk, "pll-periph0-4x",
  1607. ++ pll_periph0_parents,
  1608. ++ 1, 4, 0);
  1609. ++static CLK_FIXED_FACTOR_HWS(pll_periph0_2x_clk, "pll-periph0-2x",
  1610. ++ pll_periph0_parents,
  1611. ++ 1, 2, 0);
  1612. ++
  1613. ++static const struct clk_hw *pll_periph1_parents[] = {
  1614. ++ &pll_periph1_clk.common.hw
  1615. ++};
  1616. ++static CLK_FIXED_FACTOR_HWS(pll_periph1_4x_clk, "pll-periph1-4x",
  1617. ++ pll_periph1_parents,
  1618. ++ 1, 4, 0);
  1619. ++static CLK_FIXED_FACTOR_HWS(pll_periph1_2x_clk, "pll-periph1-2x",
  1620. ++ pll_periph1_parents,
  1621. ++ 1, 2, 0);
  1622. ++
  1623. ++static CLK_FIXED_FACTOR_HW(pll_video0_4x_clk, "pll-video0-4x",
  1624. ++ &pll_video0_clk.common.hw,
  1625. ++ 1, 4, CLK_SET_RATE_PARENT);
  1626. ++static CLK_FIXED_FACTOR_HW(pll_video1_4x_clk, "pll-video1-4x",
  1627. ++ &pll_video1_clk.common.hw,
  1628. ++ 1, 4, CLK_SET_RATE_PARENT);
  1629. ++static CLK_FIXED_FACTOR_HW(pll_video2_4x_clk, "pll-video2-4x",
  1630. ++ &pll_video2_clk.common.hw,
  1631. ++ 1, 4, CLK_SET_RATE_PARENT);
  1632. ++
  1633. ++static struct ccu_common *sun50i_h616_ccu_clks[] = {
  1634. ++ &pll_cpux_clk.common,
  1635. ++ &pll_ddr0_clk.common,
  1636. ++ &pll_ddr1_clk.common,
  1637. ++ &pll_periph0_clk.common,
  1638. ++ &pll_periph1_clk.common,
  1639. ++ &pll_gpu_clk.common,
  1640. ++ &pll_video0_clk.common,
  1641. ++ &pll_video1_clk.common,
  1642. ++ &pll_video2_clk.common,
  1643. ++ &pll_ve_clk.common,
  1644. ++ &pll_de_clk.common,
  1645. ++ &pll_audio_hs_clk.common,
  1646. ++ &cpux_clk.common,
  1647. ++ &axi_clk.common,
  1648. ++ &cpux_apb_clk.common,
  1649. ++ &psi_ahb1_ahb2_clk.common,
  1650. ++ &ahb3_clk.common,
  1651. ++ &apb1_clk.common,
  1652. ++ &apb2_clk.common,
  1653. ++ &mbus_clk.common,
  1654. ++ &de_clk.common,
  1655. ++ &bus_de_clk.common,
  1656. ++ &deinterlace_clk.common,
  1657. ++ &bus_deinterlace_clk.common,
  1658. ++ &g2d_clk.common,
  1659. ++ &bus_g2d_clk.common,
  1660. ++ &gpu0_clk.common,
  1661. ++ &bus_gpu_clk.common,
  1662. ++ &gpu1_clk.common,
  1663. ++ &ce_clk.common,
  1664. ++ &bus_ce_clk.common,
  1665. ++ &ve_clk.common,
  1666. ++ &bus_ve_clk.common,
  1667. ++ &bus_dma_clk.common,
  1668. ++ &bus_hstimer_clk.common,
  1669. ++ &avs_clk.common,
  1670. ++ &bus_dbg_clk.common,
  1671. ++ &bus_psi_clk.common,
  1672. ++ &bus_pwm_clk.common,
  1673. ++ &bus_iommu_clk.common,
  1674. ++ &dram_clk.common,
  1675. ++ &mbus_dma_clk.common,
  1676. ++ &mbus_ve_clk.common,
  1677. ++ &mbus_ce_clk.common,
  1678. ++ &mbus_ts_clk.common,
  1679. ++ &mbus_nand_clk.common,
  1680. ++ &mbus_g2d_clk.common,
  1681. ++ &bus_dram_clk.common,
  1682. ++ &nand0_clk.common,
  1683. ++ &nand1_clk.common,
  1684. ++ &bus_nand_clk.common,
  1685. ++ &mmc0_clk.common,
  1686. ++ &mmc1_clk.common,
  1687. ++ &mmc2_clk.common,
  1688. ++ &bus_mmc0_clk.common,
  1689. ++ &bus_mmc1_clk.common,
  1690. ++ &bus_mmc2_clk.common,
  1691. ++ &bus_uart0_clk.common,
  1692. ++ &bus_uart1_clk.common,
  1693. ++ &bus_uart2_clk.common,
  1694. ++ &bus_uart3_clk.common,
  1695. ++ &bus_uart4_clk.common,
  1696. ++ &bus_uart5_clk.common,
  1697. ++ &bus_i2c0_clk.common,
  1698. ++ &bus_i2c1_clk.common,
  1699. ++ &bus_i2c2_clk.common,
  1700. ++ &bus_i2c3_clk.common,
  1701. ++ &bus_i2c4_clk.common,
  1702. ++ &spi0_clk.common,
  1703. ++ &spi1_clk.common,
  1704. ++ &bus_spi0_clk.common,
  1705. ++ &bus_spi1_clk.common,
  1706. ++ &emac_25m_clk.common,
  1707. ++ &bus_emac0_clk.common,
  1708. ++ &bus_emac1_clk.common,
  1709. ++ &ts_clk.common,
  1710. ++ &bus_ts_clk.common,
  1711. ++ &bus_ths_clk.common,
  1712. ++ &spdif_clk.common,
  1713. ++ &bus_spdif_clk.common,
  1714. ++ &dmic_clk.common,
  1715. ++ &bus_dmic_clk.common,
  1716. ++ &audio_codec_1x_clk.common,
  1717. ++ &audio_codec_4x_clk.common,
  1718. ++ &bus_audio_codec_clk.common,
  1719. ++ &audio_hub_clk.common,
  1720. ++ &bus_audio_hub_clk.common,
  1721. ++ &usb_ohci0_clk.common,
  1722. ++ &usb_phy0_clk.common,
  1723. ++ &usb_ohci1_clk.common,
  1724. ++ &usb_phy1_clk.common,
  1725. ++ &usb_ohci2_clk.common,
  1726. ++ &usb_phy2_clk.common,
  1727. ++ &usb_ohci3_clk.common,
  1728. ++ &usb_phy3_clk.common,
  1729. ++ &bus_ohci0_clk.common,
  1730. ++ &bus_ohci1_clk.common,
  1731. ++ &bus_ohci2_clk.common,
  1732. ++ &bus_ohci3_clk.common,
  1733. ++ &bus_ehci0_clk.common,
  1734. ++ &bus_ehci1_clk.common,
  1735. ++ &bus_ehci2_clk.common,
  1736. ++ &bus_ehci3_clk.common,
  1737. ++ &bus_otg_clk.common,
  1738. ++ &bus_keyadc_clk.common,
  1739. ++ &hdmi_clk.common,
  1740. ++ &hdmi_slow_clk.common,
  1741. ++ &hdmi_cec_clk.common,
  1742. ++ &bus_hdmi_clk.common,
  1743. ++ &bus_tcon_top_clk.common,
  1744. ++ &tcon_tv0_clk.common,
  1745. ++ &bus_tcon_tv0_clk.common,
  1746. ++ &hdcp_clk.common,
  1747. ++ &bus_hdcp_clk.common,
  1748. ++};
  1749. ++
  1750. ++static struct clk_hw_onecell_data sun50i_h616_hw_clks = {
  1751. ++ .hws = {
  1752. ++ [CLK_OSC12M] = &osc12M_clk.hw,
  1753. ++ [CLK_PLL_CPUX] = &pll_cpux_clk.common.hw,
  1754. ++ [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw,
  1755. ++ [CLK_PLL_DDR1] = &pll_ddr1_clk.common.hw,
  1756. ++ [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw,
  1757. ++ [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw,
  1758. ++ [CLK_PLL_PERIPH0_4X] = &pll_periph0_4x_clk.hw,
  1759. ++ [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw,
  1760. ++ [CLK_PLL_PERIPH1_2X] = &pll_periph1_2x_clk.hw,
  1761. ++ [CLK_PLL_PERIPH1_4X] = &pll_periph1_4x_clk.hw,
  1762. ++ [CLK_PLL_GPU] = &pll_gpu_clk.common.hw,
  1763. ++ [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw,
  1764. ++ [CLK_PLL_VIDEO0_4X] = &pll_video0_4x_clk.hw,
  1765. ++ [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw,
  1766. ++ [CLK_PLL_VIDEO1_4X] = &pll_video1_4x_clk.hw,
  1767. ++ [CLK_PLL_VIDEO2] = &pll_video2_clk.common.hw,
  1768. ++ [CLK_PLL_VIDEO2_4X] = &pll_video2_4x_clk.hw,
  1769. ++ [CLK_PLL_VE] = &pll_ve_clk.common.hw,
  1770. ++ [CLK_PLL_DE] = &pll_de_clk.common.hw,
  1771. ++ [CLK_PLL_AUDIO_HS] = &pll_audio_hs_clk.common.hw,
  1772. ++ [CLK_PLL_AUDIO_1X] = &pll_audio_1x_clk.hw,
  1773. ++ [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw,
  1774. ++ [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw,
  1775. ++ [CLK_CPUX] = &cpux_clk.common.hw,
  1776. ++ [CLK_AXI] = &axi_clk.common.hw,
  1777. ++ [CLK_CPUX_APB] = &cpux_apb_clk.common.hw,
  1778. ++ [CLK_PSI_AHB1_AHB2] = &psi_ahb1_ahb2_clk.common.hw,
  1779. ++ [CLK_AHB3] = &ahb3_clk.common.hw,
  1780. ++ [CLK_APB1] = &apb1_clk.common.hw,
  1781. ++ [CLK_APB2] = &apb2_clk.common.hw,
  1782. ++ [CLK_MBUS] = &mbus_clk.common.hw,
  1783. ++ [CLK_DE] = &de_clk.common.hw,
  1784. ++ [CLK_BUS_DE] = &bus_de_clk.common.hw,
  1785. ++ [CLK_DEINTERLACE] = &deinterlace_clk.common.hw,
  1786. ++ [CLK_BUS_DEINTERLACE] = &bus_deinterlace_clk.common.hw,
  1787. ++ [CLK_G2D] = &g2d_clk.common.hw,
  1788. ++ [CLK_BUS_G2D] = &bus_g2d_clk.common.hw,
  1789. ++ [CLK_GPU0] = &gpu0_clk.common.hw,
  1790. ++ [CLK_BUS_GPU] = &bus_gpu_clk.common.hw,
  1791. ++ [CLK_GPU1] = &gpu1_clk.common.hw,
  1792. ++ [CLK_CE] = &ce_clk.common.hw,
  1793. ++ [CLK_BUS_CE] = &bus_ce_clk.common.hw,
  1794. ++ [CLK_VE] = &ve_clk.common.hw,
  1795. ++ [CLK_BUS_VE] = &bus_ve_clk.common.hw,
  1796. ++ [CLK_BUS_DMA] = &bus_dma_clk.common.hw,
  1797. ++ [CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw,
  1798. ++ [CLK_AVS] = &avs_clk.common.hw,
  1799. ++ [CLK_BUS_DBG] = &bus_dbg_clk.common.hw,
  1800. ++ [CLK_BUS_PSI] = &bus_psi_clk.common.hw,
  1801. ++ [CLK_BUS_PWM] = &bus_pwm_clk.common.hw,
  1802. ++ [CLK_BUS_IOMMU] = &bus_iommu_clk.common.hw,
  1803. ++ [CLK_DRAM] = &dram_clk.common.hw,
  1804. ++ [CLK_MBUS_DMA] = &mbus_dma_clk.common.hw,
  1805. ++ [CLK_MBUS_VE] = &mbus_ve_clk.common.hw,
  1806. ++ [CLK_MBUS_CE] = &mbus_ce_clk.common.hw,
  1807. ++ [CLK_MBUS_TS] = &mbus_ts_clk.common.hw,
  1808. ++ [CLK_MBUS_NAND] = &mbus_nand_clk.common.hw,
  1809. ++ [CLK_MBUS_G2D] = &mbus_g2d_clk.common.hw,
  1810. ++ [CLK_BUS_DRAM] = &bus_dram_clk.common.hw,
  1811. ++ [CLK_NAND0] = &nand0_clk.common.hw,
  1812. ++ [CLK_NAND1] = &nand1_clk.common.hw,
  1813. ++ [CLK_BUS_NAND] = &bus_nand_clk.common.hw,
  1814. ++ [CLK_MMC0] = &mmc0_clk.common.hw,
  1815. ++ [CLK_MMC1] = &mmc1_clk.common.hw,
  1816. ++ [CLK_MMC2] = &mmc2_clk.common.hw,
  1817. ++ [CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw,
  1818. ++ [CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw,
  1819. ++ [CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw,
  1820. ++ [CLK_BUS_UART0] = &bus_uart0_clk.common.hw,
  1821. ++ [CLK_BUS_UART1] = &bus_uart1_clk.common.hw,
  1822. ++ [CLK_BUS_UART2] = &bus_uart2_clk.common.hw,
  1823. ++ [CLK_BUS_UART3] = &bus_uart3_clk.common.hw,
  1824. ++ [CLK_BUS_UART4] = &bus_uart4_clk.common.hw,
  1825. ++ [CLK_BUS_UART5] = &bus_uart5_clk.common.hw,
  1826. ++ [CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw,
  1827. ++ [CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw,
  1828. ++ [CLK_BUS_I2C2] = &bus_i2c2_clk.common.hw,
  1829. ++ [CLK_BUS_I2C3] = &bus_i2c3_clk.common.hw,
  1830. ++ [CLK_BUS_I2C4] = &bus_i2c4_clk.common.hw,
  1831. ++ [CLK_SPI0] = &spi0_clk.common.hw,
  1832. ++ [CLK_SPI1] = &spi1_clk.common.hw,
  1833. ++ [CLK_BUS_SPI0] = &bus_spi0_clk.common.hw,
  1834. ++ [CLK_BUS_SPI1] = &bus_spi1_clk.common.hw,
  1835. ++ [CLK_EMAC_25M] = &emac_25m_clk.common.hw,
  1836. ++ [CLK_BUS_EMAC0] = &bus_emac0_clk.common.hw,
  1837. ++ [CLK_BUS_EMAC1] = &bus_emac1_clk.common.hw,
  1838. ++ [CLK_TS] = &ts_clk.common.hw,
  1839. ++ [CLK_BUS_TS] = &bus_ts_clk.common.hw,
  1840. ++ [CLK_BUS_THS] = &bus_ths_clk.common.hw,
  1841. ++ [CLK_SPDIF] = &spdif_clk.common.hw,
  1842. ++ [CLK_BUS_SPDIF] = &bus_spdif_clk.common.hw,
  1843. ++ [CLK_DMIC] = &dmic_clk.common.hw,
  1844. ++ [CLK_BUS_DMIC] = &bus_dmic_clk.common.hw,
  1845. ++ [CLK_AUDIO_CODEC_1X] = &audio_codec_1x_clk.common.hw,
  1846. ++ [CLK_AUDIO_CODEC_4X] = &audio_codec_4x_clk.common.hw,
  1847. ++ [CLK_BUS_AUDIO_CODEC] = &bus_audio_codec_clk.common.hw,
  1848. ++ [CLK_AUDIO_HUB] = &audio_hub_clk.common.hw,
  1849. ++ [CLK_BUS_AUDIO_HUB] = &bus_audio_hub_clk.common.hw,
  1850. ++ [CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw,
  1851. ++ [CLK_USB_PHY0] = &usb_phy0_clk.common.hw,
  1852. ++ [CLK_USB_OHCI1] = &usb_ohci1_clk.common.hw,
  1853. ++ [CLK_USB_PHY1] = &usb_phy1_clk.common.hw,
  1854. ++ [CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw,
  1855. ++ [CLK_USB_PHY2] = &usb_phy2_clk.common.hw,
  1856. ++ [CLK_USB_OHCI3] = &usb_ohci3_clk.common.hw,
  1857. ++ [CLK_USB_PHY3] = &usb_phy3_clk.common.hw,
  1858. ++ [CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw,
  1859. ++ [CLK_BUS_OHCI1] = &bus_ohci1_clk.common.hw,
  1860. ++ [CLK_BUS_OHCI2] = &bus_ohci2_clk.common.hw,
  1861. ++ [CLK_BUS_OHCI3] = &bus_ohci3_clk.common.hw,
  1862. ++ [CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw,
  1863. ++ [CLK_BUS_EHCI1] = &bus_ehci1_clk.common.hw,
  1864. ++ [CLK_BUS_EHCI2] = &bus_ehci2_clk.common.hw,
  1865. ++ [CLK_BUS_EHCI3] = &bus_ehci3_clk.common.hw,
  1866. ++ [CLK_BUS_OTG] = &bus_otg_clk.common.hw,
  1867. ++ [CLK_BUS_KEYADC] = &bus_keyadc_clk.common.hw,
  1868. ++ [CLK_HDMI] = &hdmi_clk.common.hw,
  1869. ++ [CLK_HDMI_SLOW] = &hdmi_slow_clk.common.hw,
  1870. ++ [CLK_HDMI_CEC] = &hdmi_cec_clk.common.hw,
  1871. ++ [CLK_BUS_HDMI] = &bus_hdmi_clk.common.hw,
  1872. ++ [CLK_BUS_TCON_TOP] = &bus_tcon_top_clk.common.hw,
  1873. ++ [CLK_TCON_TV0] = &tcon_tv0_clk.common.hw,
  1874. ++ [CLK_BUS_TCON_TV0] = &bus_tcon_tv0_clk.common.hw,
  1875. ++ [CLK_HDCP] = &hdcp_clk.common.hw,
  1876. ++ [CLK_BUS_HDCP] = &bus_hdcp_clk.common.hw,
  1877. ++ },
  1878. ++ .num = CLK_NUMBER,
  1879. ++};
  1880. ++
  1881. ++static struct ccu_reset_map sun50i_h616_ccu_resets[] = {
  1882. ++ [RST_MBUS] = { 0x540, BIT(30) },
  1883. ++
  1884. ++ [RST_BUS_DE] = { 0x60c, BIT(16) },
  1885. ++ [RST_BUS_DEINTERLACE] = { 0x62c, BIT(16) },
  1886. ++ [RST_BUS_GPU] = { 0x67c, BIT(16) },
  1887. ++ [RST_BUS_CE] = { 0x68c, BIT(16) },
  1888. ++ [RST_BUS_VE] = { 0x69c, BIT(16) },
  1889. ++ [RST_BUS_DMA] = { 0x70c, BIT(16) },
  1890. ++ [RST_BUS_HSTIMER] = { 0x73c, BIT(16) },
  1891. ++ [RST_BUS_DBG] = { 0x78c, BIT(16) },
  1892. ++ [RST_BUS_PSI] = { 0x79c, BIT(16) },
  1893. ++ [RST_BUS_PWM] = { 0x7ac, BIT(16) },
  1894. ++ [RST_BUS_IOMMU] = { 0x7bc, BIT(16) },
  1895. ++ [RST_BUS_DRAM] = { 0x80c, BIT(16) },
  1896. ++ [RST_BUS_NAND] = { 0x82c, BIT(16) },
  1897. ++ [RST_BUS_MMC0] = { 0x84c, BIT(16) },
  1898. ++ [RST_BUS_MMC1] = { 0x84c, BIT(17) },
  1899. ++ [RST_BUS_MMC2] = { 0x84c, BIT(18) },
  1900. ++ [RST_BUS_UART0] = { 0x90c, BIT(16) },
  1901. ++ [RST_BUS_UART1] = { 0x90c, BIT(17) },
  1902. ++ [RST_BUS_UART2] = { 0x90c, BIT(18) },
  1903. ++ [RST_BUS_UART3] = { 0x90c, BIT(19) },
  1904. ++ [RST_BUS_UART4] = { 0x90c, BIT(20) },
  1905. ++ [RST_BUS_UART5] = { 0x90c, BIT(21) },
  1906. ++ [RST_BUS_I2C0] = { 0x91c, BIT(16) },
  1907. ++ [RST_BUS_I2C1] = { 0x91c, BIT(17) },
  1908. ++ [RST_BUS_I2C2] = { 0x91c, BIT(18) },
  1909. ++ [RST_BUS_I2C3] = { 0x91c, BIT(19) },
  1910. ++ [RST_BUS_I2C4] = { 0x91c, BIT(20) },
  1911. ++ [RST_BUS_SPI0] = { 0x96c, BIT(16) },
  1912. ++ [RST_BUS_SPI1] = { 0x96c, BIT(17) },
  1913. ++ [RST_BUS_EMAC0] = { 0x97c, BIT(16) },
  1914. ++ [RST_BUS_EMAC1] = { 0x97c, BIT(17) },
  1915. ++ [RST_BUS_TS] = { 0x9bc, BIT(16) },
  1916. ++ [RST_BUS_THS] = { 0x9fc, BIT(16) },
  1917. ++ [RST_BUS_SPDIF] = { 0xa2c, BIT(16) },
  1918. ++ [RST_BUS_DMIC] = { 0xa4c, BIT(16) },
  1919. ++ [RST_BUS_AUDIO_CODEC] = { 0xa5c, BIT(16) },
  1920. ++ [RST_BUS_AUDIO_HUB] = { 0xa6c, BIT(16) },
  1921. ++
  1922. ++ [RST_USB_PHY0] = { 0xa70, BIT(30) },
  1923. ++ [RST_USB_PHY1] = { 0xa74, BIT(30) },
  1924. ++ [RST_USB_PHY2] = { 0xa78, BIT(30) },
  1925. ++ [RST_USB_PHY3] = { 0xa7c, BIT(30) },
  1926. ++
  1927. ++ [RST_BUS_OHCI0] = { 0xa8c, BIT(16) },
  1928. ++ [RST_BUS_OHCI1] = { 0xa8c, BIT(17) },
  1929. ++ [RST_BUS_OHCI2] = { 0xa8c, BIT(18) },
  1930. ++ [RST_BUS_OHCI3] = { 0xa8c, BIT(19) },
  1931. ++ [RST_BUS_EHCI0] = { 0xa8c, BIT(20) },
  1932. ++ [RST_BUS_EHCI1] = { 0xa8c, BIT(21) },
  1933. ++ [RST_BUS_EHCI2] = { 0xa8c, BIT(22) },
  1934. ++ [RST_BUS_EHCI3] = { 0xa8c, BIT(23) },
  1935. ++ [RST_BUS_OTG] = { 0xa8c, BIT(24) },
  1936. ++ [RST_BUS_KEYADC] = { 0xa9c, BIT(16) },
  1937. ++
  1938. ++ [RST_BUS_HDMI] = { 0xb1c, BIT(16) },
  1939. ++ [RST_BUS_HDMI_SUB] = { 0xb1c, BIT(17) },
  1940. ++ [RST_BUS_TCON_TOP] = { 0xb5c, BIT(16) },
  1941. ++ [RST_BUS_TCON_TV0] = { 0xb9c, BIT(16) },
  1942. ++ [RST_BUS_HDCP] = { 0xc4c, BIT(16) },
  1943. ++};
  1944. ++
  1945. ++static const struct sunxi_ccu_desc sun50i_h616_ccu_desc = {
  1946. ++ .ccu_clks = sun50i_h616_ccu_clks,
  1947. ++ .num_ccu_clks = ARRAY_SIZE(sun50i_h616_ccu_clks),
  1948. ++
  1949. ++ .hw_clks = &sun50i_h616_hw_clks,
  1950. ++
  1951. ++ .resets = sun50i_h616_ccu_resets,
  1952. ++ .num_resets = ARRAY_SIZE(sun50i_h616_ccu_resets),
  1953. ++};
  1954. ++
  1955. ++static const u32 pll_regs[] = {
  1956. ++ SUN50I_H616_PLL_CPUX_REG,
  1957. ++ SUN50I_H616_PLL_DDR0_REG,
  1958. ++ SUN50I_H616_PLL_DDR1_REG,
  1959. ++ SUN50I_H616_PLL_PERIPH0_REG,
  1960. ++ SUN50I_H616_PLL_PERIPH1_REG,
  1961. ++ SUN50I_H616_PLL_GPU_REG,
  1962. ++ SUN50I_H616_PLL_VIDEO0_REG,
  1963. ++ SUN50I_H616_PLL_VIDEO1_REG,
  1964. ++ SUN50I_H616_PLL_VIDEO2_REG,
  1965. ++ SUN50I_H616_PLL_VE_REG,
  1966. ++ SUN50I_H616_PLL_DE_REG,
  1967. ++ SUN50I_H616_PLL_AUDIO_REG,
  1968. ++};
  1969. ++
  1970. ++static const u32 pll_video_regs[] = {
  1971. ++ SUN50I_H616_PLL_VIDEO0_REG,
  1972. ++ SUN50I_H616_PLL_VIDEO1_REG,
  1973. ++ SUN50I_H616_PLL_VIDEO2_REG,
  1974. ++};
  1975. ++
  1976. ++static const u32 usb2_clk_regs[] = {
  1977. ++ SUN50I_H616_USB0_CLK_REG,
  1978. ++ SUN50I_H616_USB1_CLK_REG,
  1979. ++ SUN50I_H616_USB2_CLK_REG,
  1980. ++ SUN50I_H616_USB3_CLK_REG,
  1981. ++};
  1982. ++
  1983. ++static int sun50i_h616_ccu_probe(struct platform_device *pdev)
  1984. ++{
  1985. ++ struct resource *res;
  1986. ++ void __iomem *reg;
  1987. ++ u32 val;
  1988. ++ int i;
  1989. ++
  1990. ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  1991. ++ reg = devm_ioremap_resource(&pdev->dev, res);
  1992. ++ if (IS_ERR(reg))
  1993. ++ return PTR_ERR(reg);
  1994. ++
  1995. ++ /* Enable the lock bits on all PLLs */
  1996. ++ for (i = 0; i < ARRAY_SIZE(pll_regs); i++) {
  1997. ++ val = readl(reg + pll_regs[i]);
  1998. ++ val |= BIT(29);
  1999. ++ writel(val, reg + pll_regs[i]);
  2000. ++ }
  2001. ++
  2002. ++ /*
  2003. ++ * Force the output divider of video PLLs to 0.
  2004. ++ *
  2005. ++ * See the comment before pll-video0 definition for the reason.
  2006. ++ */
  2007. ++ for (i = 0; i < ARRAY_SIZE(pll_video_regs); i++) {
  2008. ++ val = readl(reg + pll_video_regs[i]);
  2009. ++ val &= ~BIT(0);
  2010. ++ writel(val, reg + pll_video_regs[i]);
  2011. ++ }
  2012. ++
  2013. ++ /*
  2014. ++ * Force OHCI 12M clock sources to 00 (12MHz divided from 48MHz)
  2015. ++ *
  2016. ++ * This clock mux is still mysterious, and the code just enforces
  2017. ++ * it to have a valid clock parent.
  2018. ++ */
  2019. ++ for (i = 0; i < ARRAY_SIZE(usb2_clk_regs); i++) {
  2020. ++ val = readl(reg + usb2_clk_regs[i]);
  2021. ++ val &= ~GENMASK(25, 24);
  2022. ++ writel (val, reg + usb2_clk_regs[i]);
  2023. ++ }
  2024. ++
  2025. ++ /*
  2026. ++ * Force the post-divider of pll-audio to 12 and the output divider
  2027. ++ * of it to 2, so 24576000 and 22579200 rates can be set exactly.
  2028. ++ */
  2029. ++ val = readl(reg + SUN50I_H616_PLL_AUDIO_REG);
  2030. ++ val &= ~(GENMASK(21, 16) | BIT(0));
  2031. ++ writel(val | (11 << 16) | BIT(0), reg + SUN50I_H616_PLL_AUDIO_REG);
  2032. ++
  2033. ++ /*
  2034. ++ * First clock parent (osc32K) is unusable for CEC. But since there
  2035. ++ * is no good way to force parent switch (both run with same frequency),
  2036. ++ * just set second clock parent here.
  2037. ++ */
  2038. ++ val = readl(reg + SUN50I_H616_HDMI_CEC_CLK_REG);
  2039. ++ val |= BIT(24);
  2040. ++ writel(val, reg + SUN50I_H616_HDMI_CEC_CLK_REG);
  2041. ++
  2042. ++ return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_h616_ccu_desc);
  2043. ++}
  2044. ++
  2045. ++static const struct of_device_id sun50i_h616_ccu_ids[] = {
  2046. ++ { .compatible = "allwinner,sun50i-h616-ccu",
  2047. ++ .data = &sun50i_h616_ccu_desc },
  2048. ++ { }
  2049. ++};
  2050. ++
  2051. ++static struct platform_driver sun50i_h616_ccu_driver = {
  2052. ++ .probe = sun50i_h616_ccu_probe,
  2053. ++ .driver = {
  2054. ++ .name = "sun50i-h616-ccu",
  2055. ++ .of_match_table = sun50i_h616_ccu_ids,
  2056. ++ },
  2057. ++};
  2058. ++builtin_platform_driver(sun50i_h616_ccu_driver);
  2059. +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h616.h b/drivers/clk/sunxi-ng/ccu-sun50i-h616.h
  2060. +new file mode 100644
  2061. +index 000000000000..da8f0b1206f9
  2062. +--- /dev/null
  2063. ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-h616.h
  2064. +@@ -0,0 +1,58 @@
  2065. ++/* SPDX-License-Identifier: GPL-2.0 */
  2066. ++/*
  2067. ++ * Copyright 2020 Arm Ltd.
  2068. ++ */
  2069. ++
  2070. ++#ifndef _CCU_SUN50I_H616_H_
  2071. ++#define _CCU_SUN50I_H616_H_
  2072. ++
  2073. ++#include <dt-bindings/clock/sun50i-h616-ccu.h>
  2074. ++#include <dt-bindings/reset/sun50i-h616-ccu.h>
  2075. ++
  2076. ++#define CLK_OSC12M 0
  2077. ++#define CLK_PLL_CPUX 1
  2078. ++#define CLK_PLL_DDR0 2
  2079. ++#define CLK_PLL_DDR1 3
  2080. ++
  2081. ++/* PLL_PERIPH0 exported for PRCM */
  2082. ++
  2083. ++#define CLK_PLL_PERIPH0_2X 5
  2084. ++#define CLK_PLL_PERIPH0_4X 6
  2085. ++#define CLK_PLL_PERIPH1 7
  2086. ++#define CLK_PLL_PERIPH1_2X 8
  2087. ++#define CLK_PLL_PERIPH1_4X 9
  2088. ++#define CLK_PLL_GPU 10
  2089. ++#define CLK_PLL_VIDEO0 11
  2090. ++#define CLK_PLL_VIDEO0_4X 12
  2091. ++#define CLK_PLL_VIDEO1 13
  2092. ++#define CLK_PLL_VIDEO1_4X 14
  2093. ++#define CLK_PLL_VIDEO2 15
  2094. ++#define CLK_PLL_VIDEO2_4X 16
  2095. ++#define CLK_PLL_VE 17
  2096. ++#define CLK_PLL_DE 18
  2097. ++#define CLK_PLL_AUDIO_HS 19
  2098. ++#define CLK_PLL_AUDIO_1X 20
  2099. ++#define CLK_PLL_AUDIO_2X 21
  2100. ++#define CLK_PLL_AUDIO_4X 22
  2101. ++
  2102. ++/* CPUX clock exported for DVFS */
  2103. ++
  2104. ++#define CLK_AXI 24
  2105. ++#define CLK_CPUX_APB 25
  2106. ++#define CLK_PSI_AHB1_AHB2 26
  2107. ++#define CLK_AHB3 27
  2108. ++
  2109. ++/* APB1 clock exported for PIO */
  2110. ++
  2111. ++#define CLK_APB2 29
  2112. ++#define CLK_MBUS 30
  2113. ++
  2114. ++/* All module clocks and bus gates are exported except DRAM */
  2115. ++
  2116. ++#define CLK_DRAM 51
  2117. ++
  2118. ++#define CLK_BUS_DRAM 58
  2119. ++
  2120. ++#define CLK_NUMBER (CLK_BUS_HDCP + 1)
  2121. ++
  2122. ++#endif /* _CCU_SUN50I_H616_H_ */
  2123. +diff --git a/include/dt-bindings/clock/sun50i-h616-ccu.h b/include/dt-bindings/clock/sun50i-h616-ccu.h
  2124. +new file mode 100644
  2125. +index 000000000000..a9cc8844e3a9
  2126. +--- /dev/null
  2127. ++++ b/include/dt-bindings/clock/sun50i-h616-ccu.h
  2128. +@@ -0,0 +1,110 @@
  2129. ++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  2130. ++/*
  2131. ++ * Copyright (C) 2020 Arm Ltd.
  2132. ++ */
  2133. ++
  2134. ++#ifndef _DT_BINDINGS_CLK_SUN50I_H616_H_
  2135. ++#define _DT_BINDINGS_CLK_SUN50I_H616_H_
  2136. ++
  2137. ++#define CLK_PLL_PERIPH0 4
  2138. ++
  2139. ++#define CLK_CPUX 23
  2140. ++
  2141. ++#define CLK_APB1 28
  2142. ++
  2143. ++#define CLK_DE 31
  2144. ++#define CLK_BUS_DE 32
  2145. ++#define CLK_DEINTERLACE 33
  2146. ++#define CLK_BUS_DEINTERLACE 34
  2147. ++#define CLK_G2D 35
  2148. ++#define CLK_BUS_G2D 36
  2149. ++#define CLK_GPU0 37
  2150. ++#define CLK_BUS_GPU 38
  2151. ++#define CLK_GPU1 39
  2152. ++#define CLK_CE 40
  2153. ++#define CLK_BUS_CE 41
  2154. ++#define CLK_VE 42
  2155. ++#define CLK_BUS_VE 43
  2156. ++#define CLK_BUS_DMA 44
  2157. ++#define CLK_BUS_HSTIMER 45
  2158. ++#define CLK_AVS 46
  2159. ++#define CLK_BUS_DBG 47
  2160. ++#define CLK_BUS_PSI 48
  2161. ++#define CLK_BUS_PWM 49
  2162. ++#define CLK_BUS_IOMMU 50
  2163. ++
  2164. ++#define CLK_MBUS_DMA 52
  2165. ++#define CLK_MBUS_VE 53
  2166. ++#define CLK_MBUS_CE 54
  2167. ++#define CLK_MBUS_TS 55
  2168. ++#define CLK_MBUS_NAND 56
  2169. ++#define CLK_MBUS_G2D 57
  2170. ++
  2171. ++#define CLK_NAND0 59
  2172. ++#define CLK_NAND1 60
  2173. ++#define CLK_BUS_NAND 61
  2174. ++#define CLK_MMC0 62
  2175. ++#define CLK_MMC1 63
  2176. ++#define CLK_MMC2 64
  2177. ++#define CLK_BUS_MMC0 65
  2178. ++#define CLK_BUS_MMC1 66
  2179. ++#define CLK_BUS_MMC2 67
  2180. ++#define CLK_BUS_UART0 68
  2181. ++#define CLK_BUS_UART1 69
  2182. ++#define CLK_BUS_UART2 70
  2183. ++#define CLK_BUS_UART3 71
  2184. ++#define CLK_BUS_UART4 72
  2185. ++#define CLK_BUS_UART5 73
  2186. ++#define CLK_BUS_I2C0 74
  2187. ++#define CLK_BUS_I2C1 75
  2188. ++#define CLK_BUS_I2C2 76
  2189. ++#define CLK_BUS_I2C3 77
  2190. ++#define CLK_BUS_I2C4 78
  2191. ++#define CLK_SPI0 79
  2192. ++#define CLK_SPI1 80
  2193. ++#define CLK_BUS_SPI0 81
  2194. ++#define CLK_BUS_SPI1 82
  2195. ++#define CLK_EMAC_25M 83
  2196. ++#define CLK_BUS_EMAC0 84
  2197. ++#define CLK_BUS_EMAC1 85
  2198. ++#define CLK_TS 86
  2199. ++#define CLK_BUS_TS 87
  2200. ++#define CLK_BUS_THS 88
  2201. ++#define CLK_SPDIF 89
  2202. ++#define CLK_BUS_SPDIF 90
  2203. ++#define CLK_DMIC 91
  2204. ++#define CLK_BUS_DMIC 92
  2205. ++#define CLK_AUDIO_CODEC_1X 93
  2206. ++#define CLK_AUDIO_CODEC_4X 94
  2207. ++#define CLK_BUS_AUDIO_CODEC 95
  2208. ++#define CLK_AUDIO_HUB 96
  2209. ++#define CLK_BUS_AUDIO_HUB 97
  2210. ++#define CLK_USB_OHCI0 98
  2211. ++#define CLK_USB_PHY0 99
  2212. ++#define CLK_USB_OHCI1 100
  2213. ++#define CLK_USB_PHY1 101
  2214. ++#define CLK_USB_OHCI2 102
  2215. ++#define CLK_USB_PHY2 103
  2216. ++#define CLK_USB_OHCI3 104
  2217. ++#define CLK_USB_PHY3 105
  2218. ++#define CLK_BUS_OHCI0 106
  2219. ++#define CLK_BUS_OHCI1 107
  2220. ++#define CLK_BUS_OHCI2 108
  2221. ++#define CLK_BUS_OHCI3 109
  2222. ++#define CLK_BUS_EHCI0 110
  2223. ++#define CLK_BUS_EHCI1 111
  2224. ++#define CLK_BUS_EHCI2 112
  2225. ++#define CLK_BUS_EHCI3 113
  2226. ++#define CLK_BUS_OTG 114
  2227. ++#define CLK_BUS_KEYADC 115
  2228. ++#define CLK_HDMI 116
  2229. ++#define CLK_HDMI_SLOW 117
  2230. ++#define CLK_HDMI_CEC 118
  2231. ++#define CLK_BUS_HDMI 119
  2232. ++#define CLK_BUS_TCON_TOP 120
  2233. ++#define CLK_TCON_TV0 121
  2234. ++#define CLK_BUS_TCON_TV0 122
  2235. ++#define CLK_HDCP 123
  2236. ++#define CLK_BUS_HDCP 124
  2237. ++
  2238. ++#endif /* _DT_BINDINGS_CLK_SUN50I_H616_H_ */
  2239. +diff --git a/include/dt-bindings/reset/sun50i-h616-ccu.h b/include/dt-bindings/reset/sun50i-h616-ccu.h
  2240. +new file mode 100644
  2241. +index 000000000000..1c992cfbbbab
  2242. +--- /dev/null
  2243. ++++ b/include/dt-bindings/reset/sun50i-h616-ccu.h
  2244. +@@ -0,0 +1,67 @@
  2245. ++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  2246. ++/*
  2247. ++ * Copyright (C) 2017 Icenowy Zheng <[email protected]>
  2248. ++ */
  2249. ++
  2250. ++#ifndef _DT_BINDINGS_RESET_SUN50I_H616_H_
  2251. ++#define _DT_BINDINGS_RESET_SUN50I_H616_H_
  2252. ++
  2253. ++#define RST_MBUS 0
  2254. ++#define RST_BUS_DE 1
  2255. ++#define RST_BUS_DEINTERLACE 2
  2256. ++#define RST_BUS_GPU 3
  2257. ++#define RST_BUS_CE 4
  2258. ++#define RST_BUS_VE 5
  2259. ++#define RST_BUS_DMA 6
  2260. ++#define RST_BUS_HSTIMER 7
  2261. ++#define RST_BUS_DBG 8
  2262. ++#define RST_BUS_PSI 9
  2263. ++#define RST_BUS_PWM 10
  2264. ++#define RST_BUS_IOMMU 11
  2265. ++#define RST_BUS_DRAM 12
  2266. ++#define RST_BUS_NAND 13
  2267. ++#define RST_BUS_MMC0 14
  2268. ++#define RST_BUS_MMC1 15
  2269. ++#define RST_BUS_MMC2 16
  2270. ++#define RST_BUS_UART0 17
  2271. ++#define RST_BUS_UART1 18
  2272. ++#define RST_BUS_UART2 19
  2273. ++#define RST_BUS_UART3 20
  2274. ++#define RST_BUS_UART4 21
  2275. ++#define RST_BUS_UART5 22
  2276. ++#define RST_BUS_I2C0 23
  2277. ++#define RST_BUS_I2C1 24
  2278. ++#define RST_BUS_I2C2 25
  2279. ++#define RST_BUS_I2C3 26
  2280. ++#define RST_BUS_I2C4 27
  2281. ++#define RST_BUS_SPI0 28
  2282. ++#define RST_BUS_SPI1 29
  2283. ++#define RST_BUS_EMAC0 30
  2284. ++#define RST_BUS_EMAC1 31
  2285. ++#define RST_BUS_TS 32
  2286. ++#define RST_BUS_THS 33
  2287. ++#define RST_BUS_SPDIF 34
  2288. ++#define RST_BUS_DMIC 35
  2289. ++#define RST_BUS_AUDIO_CODEC 36
  2290. ++#define RST_BUS_AUDIO_HUB 37
  2291. ++#define RST_USB_PHY0 38
  2292. ++#define RST_USB_PHY1 39
  2293. ++#define RST_USB_PHY2 40
  2294. ++#define RST_USB_PHY3 41
  2295. ++#define RST_BUS_OHCI0 42
  2296. ++#define RST_BUS_OHCI1 43
  2297. ++#define RST_BUS_OHCI2 44
  2298. ++#define RST_BUS_OHCI3 45
  2299. ++#define RST_BUS_EHCI0 46
  2300. ++#define RST_BUS_EHCI1 47
  2301. ++#define RST_BUS_EHCI2 48
  2302. ++#define RST_BUS_EHCI3 49
  2303. ++#define RST_BUS_OTG 50
  2304. ++#define RST_BUS_HDMI 51
  2305. ++#define RST_BUS_HDMI_SUB 52
  2306. ++#define RST_BUS_TCON_TOP 53
  2307. ++#define RST_BUS_TCON_TV0 54
  2308. ++#define RST_BUS_HDCP 55
  2309. ++#define RST_BUS_KEYADC 56
  2310. ++
  2311. ++#endif /* _DT_BINDINGS_RESET_SUN50I_H616_H_ */
  2312. diff --git a/target/linux/sunxi/patches-5.10/506-add-support-for-A100-mmc-controller.patch b/target/linux/sunxi/patches-5.10/506-add-support-for-A100-mmc-controller.patch
  2313. new file mode 100644
  2314. index 0000000000000..fd03037553125
  2315. --- /dev/null
  2316. +++ b/target/linux/sunxi/patches-5.10/506-add-support-for-A100-mmc-controller.patch
  2317. @@ -0,0 +1,65 @@
  2318. +diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
  2319. +index fc62773602ec..1518b64112b7 100644
  2320. +@@ -244,6 +244,7 @@
  2321. +
  2322. + struct sunxi_mmc_cfg {
  2323. + u32 idma_des_size_bits;
  2324. ++ u32 idma_des_shift;
  2325. + const struct sunxi_mmc_clk_delay *clk_delays;
  2326. +
  2327. + /* does the IP block support autocalibration? */
  2328. +@@ -343,7 +344,7 @@
  2329. + /* Enable CEATA support */
  2330. + mmc_writel(host, REG_FUNS, SDXC_CEATA_ON);
  2331. + /* Set DMA descriptor list base address */
  2332. +- mmc_writel(host, REG_DLBA, host->sg_dma);
  2333. ++ mmc_writel(host, REG_DLBA, host->sg_dma >> host->cfg->idma_des_shift);
  2334. +
  2335. + rval = mmc_readl(host, REG_GCTRL);
  2336. + rval |= SDXC_INTERRUPT_ENABLE_BIT;
  2337. +@@ -373,8 +374,10 @@
  2338. +
  2339. + next_desc += sizeof(struct sunxi_idma_des);
  2340. + pdes[i].buf_addr_ptr1 =
  2341. +- cpu_to_le32(sg_dma_address(&data->sg[i]));
  2342. +- pdes[i].buf_addr_ptr2 = cpu_to_le32((u32)next_desc);
  2343. ++ cpu_to_le32(sg_dma_address(&data->sg[i]) >>
  2344. ++ host->cfg->idma_des_shift);
  2345. ++ pdes[i].buf_addr_ptr2 = cpu_to_le32((u32)next_desc >>
  2346. ++ host->cfg->idma_des_shift);
  2347. + }
  2348. +
  2349. + pdes[0].config |= cpu_to_le32(SDXC_IDMAC_DES0_FD);
  2350. +@@ -1178,6 +1181,23 @@
  2351. + .needs_new_timings = true,
  2352. + };
  2353. +
  2354. ++static const struct sunxi_mmc_cfg sun50i_a100_cfg = {
  2355. ++ .idma_des_size_bits = 16,
  2356. ++ .idma_des_shift = 2,
  2357. ++ .clk_delays = NULL,
  2358. ++ .can_calibrate = true,
  2359. ++ .mask_data0 = true,
  2360. ++ .needs_new_timings = true,
  2361. ++};
  2362. ++
  2363. ++static const struct sunxi_mmc_cfg sun50i_a100_emmc_cfg = {
  2364. ++ .idma_des_size_bits = 13,
  2365. ++ .idma_des_shift = 2,
  2366. ++ .clk_delays = NULL,
  2367. ++ .can_calibrate = true,
  2368. ++ .needs_new_timings = true,
  2369. ++};
  2370. ++
  2371. + static const struct of_device_id sunxi_mmc_of_match[] = {
  2372. + { .compatible = "allwinner,sun4i-a10-mmc", .data = &sun4i_a10_cfg },
  2373. + { .compatible = "allwinner,sun5i-a13-mmc", .data = &sun5i_a13_cfg },
  2374. +@@ -1186,6 +1206,8 @@
  2375. + { .compatible = "allwinner,sun9i-a80-mmc", .data = &sun9i_a80_cfg },
  2376. + { .compatible = "allwinner,sun50i-a64-mmc", .data = &sun50i_a64_cfg },
  2377. + { .compatible = "allwinner,sun50i-a64-emmc", .data = &sun50i_a64_emmc_cfg },
  2378. ++ { .compatible = "allwinner,sun50i-a100-mmc", .data = &sun50i_a100_cfg },
  2379. ++ { .compatible = "allwinner,sun50i-a100-emmc", .data = &sun50i_a100_emmc_cfg },
  2380. + { /* sentinel */ }
  2381. + };
  2382. + MODULE_DEVICE_TABLE(of, sunxi_mmc_of_match);
  2383. diff --git a/target/linux/sunxi/patches-5.10/507-Add-Allwinner-H616-.dtsi-file.patch b/target/linux/sunxi/patches-5.10/507-Add-Allwinner-H616-.dtsi-file.patch
  2384. new file mode 100644
  2385. index 0000000000000..32bf6471606b1
  2386. --- /dev/null
  2387. +++ b/target/linux/sunxi/patches-5.10/507-Add-Allwinner-H616-.dtsi-file.patch
  2388. @@ -0,0 +1,710 @@
  2389. +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
  2390. +new file mode 100644
  2391. +index 000000000000..dcffbfdcd26b
  2392. +--- /dev/null
  2393. ++++ b/arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi
  2394. +@@ -0,0 +1,704 @@
  2395. ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  2396. ++// Copyright (C) 2020 Arm Ltd.
  2397. ++// based on the H6 dtsi, which is:
  2398. ++// Copyright (C) 2017 Icenowy Zheng <[email protected]>
  2399. ++
  2400. ++#include <dt-bindings/interrupt-controller/arm-gic.h>
  2401. ++#include <dt-bindings/clock/sun50i-h616-ccu.h>
  2402. ++#include <dt-bindings/clock/sun50i-h6-r-ccu.h>
  2403. ++#include <dt-bindings/reset/sun50i-h616-ccu.h>
  2404. ++#include <dt-bindings/reset/sun50i-h6-r-ccu.h>
  2405. ++
  2406. ++/ {
  2407. ++ interrupt-parent = <&gic>;
  2408. ++ #address-cells = <2>;
  2409. ++ #size-cells = <2>;
  2410. ++
  2411. ++ cpus {
  2412. ++ #address-cells = <1>;
  2413. ++ #size-cells = <0>;
  2414. ++
  2415. ++ cpu0: cpu@0 {
  2416. ++ compatible = "arm,cortex-a53";
  2417. ++ device_type = "cpu";
  2418. ++ reg = <0>;
  2419. ++ enable-method = "psci";
  2420. ++ clocks = <&ccu CLK_CPUX>;
  2421. ++ };
  2422. ++
  2423. ++ cpu1: cpu@1 {
  2424. ++ compatible = "arm,cortex-a53";
  2425. ++ device_type = "cpu";
  2426. ++ reg = <1>;
  2427. ++ enable-method = "psci";
  2428. ++ clocks = <&ccu CLK_CPUX>;
  2429. ++ };
  2430. ++
  2431. ++ cpu2: cpu@2 {
  2432. ++ compatible = "arm,cortex-a53";
  2433. ++ device_type = "cpu";
  2434. ++ reg = <2>;
  2435. ++ enable-method = "psci";
  2436. ++ clocks = <&ccu CLK_CPUX>;
  2437. ++ };
  2438. ++
  2439. ++ cpu3: cpu@3 {
  2440. ++ compatible = "arm,cortex-a53";
  2441. ++ device_type = "cpu";
  2442. ++ reg = <3>;
  2443. ++ enable-method = "psci";
  2444. ++ clocks = <&ccu CLK_CPUX>;
  2445. ++ };
  2446. ++ };
  2447. ++
  2448. ++ reserved-memory {
  2449. ++ #address-cells = <2>;
  2450. ++ #size-cells = <2>;
  2451. ++ ranges;
  2452. ++
  2453. ++ /* 512KiB reserved for ARM Trusted Firmware (BL31) */
  2454. ++ secmon_reserved: secmon@40000000 {
  2455. ++ reg = <0x0 0x40000000 0x0 0x80000>;
  2456. ++ no-map;
  2457. ++ };
  2458. ++ };
  2459. ++
  2460. ++ osc24M: osc24M_clk {
  2461. ++ #clock-cells = <0>;
  2462. ++ compatible = "fixed-clock";
  2463. ++ clock-frequency = <24000000>;
  2464. ++ clock-output-names = "osc24M";
  2465. ++ };
  2466. ++
  2467. ++ pmu {
  2468. ++ compatible = "arm,cortex-a53-pmu";
  2469. ++ interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
  2470. ++ <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
  2471. ++ <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
  2472. ++ <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
  2473. ++ interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
  2474. ++ };
  2475. ++
  2476. ++ psci {
  2477. ++ compatible = "arm,psci-0.2";
  2478. ++ method = "smc";
  2479. ++ };
  2480. ++
  2481. ++ timer {
  2482. ++ compatible = "arm,armv8-timer";
  2483. ++ arm,no-tick-in-suspend;
  2484. ++ interrupts = <GIC_PPI 13
  2485. ++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
  2486. ++ <GIC_PPI 14
  2487. ++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
  2488. ++ <GIC_PPI 11
  2489. ++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
  2490. ++ <GIC_PPI 10
  2491. ++ (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
  2492. ++ };
  2493. ++
  2494. ++ soc {
  2495. ++ compatible = "simple-bus";
  2496. ++ #address-cells = <1>;
  2497. ++ #size-cells = <1>;
  2498. ++ ranges = <0x0 0x0 0x0 0x40000000>;
  2499. ++
  2500. ++ syscon: syscon@3000000 {
  2501. ++ compatible = "allwinner,sun50i-h616-system-control",
  2502. ++ "allwinner,sun50i-a64-system-control";
  2503. ++ reg = <0x03000000 0x1000>;
  2504. ++ #address-cells = <1>;
  2505. ++ #size-cells = <1>;
  2506. ++ ranges;
  2507. ++
  2508. ++ sram_c: sram@28000 {
  2509. ++ compatible = "mmio-sram";
  2510. ++ reg = <0x00028000 0x30000>;
  2511. ++ #address-cells = <1>;
  2512. ++ #size-cells = <1>;
  2513. ++ ranges = <0 0x00028000 0x30000>;
  2514. ++ };
  2515. ++
  2516. ++ sram_c1: sram@1a00000 {
  2517. ++ compatible = "mmio-sram";
  2518. ++ reg = <0x01a00000 0x200000>;
  2519. ++ #address-cells = <1>;
  2520. ++ #size-cells = <1>;
  2521. ++ ranges = <0 0x01a00000 0x200000>;
  2522. ++
  2523. ++ ve_sram: sram-section@0 {
  2524. ++ compatible = "allwinner,sun50i-h616-sram-c1",
  2525. ++ "allwinner,sun4i-a10-sram-c1";
  2526. ++ reg = <0x000000 0x200000>;
  2527. ++ };
  2528. ++ };
  2529. ++ };
  2530. ++
  2531. ++ ccu: clock@3001000 {
  2532. ++ compatible = "allwinner,sun50i-h616-ccu";
  2533. ++ reg = <0x03001000 0x1000>;
  2534. ++ clocks = <&osc24M>, <&rtc 0>, <&rtc 2>;
  2535. ++ clock-names = "hosc", "losc", "iosc";
  2536. ++ #clock-cells = <1>;
  2537. ++ #reset-cells = <1>;
  2538. ++ };
  2539. ++
  2540. ++ watchdog: watchdog@30090a0 {
  2541. ++ compatible = "allwinner,sun50i-h616-wdt",
  2542. ++ "allwinner,sun6i-a31-wdt";
  2543. ++ reg = <0x030090a0 0x20>;
  2544. ++ interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
  2545. ++ clocks = <&osc24M>;
  2546. ++ status = "disabled";
  2547. ++ };
  2548. ++
  2549. ++ pio: pinctrl@300b000 {
  2550. ++ compatible = "allwinner,sun50i-h616-pinctrl";
  2551. ++ reg = <0x0300b000 0x400>;
  2552. ++ interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>,
  2553. ++ <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
  2554. ++ <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
  2555. ++ <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
  2556. ++ <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
  2557. ++ clocks = <&ccu CLK_APB1>, <&osc24M>, <&rtc 0>;
  2558. ++ clock-names = "apb", "hosc", "losc";
  2559. ++ gpio-controller;
  2560. ++ #gpio-cells = <3>;
  2561. ++ interrupt-controller;
  2562. ++ #interrupt-cells = <3>;
  2563. ++
  2564. ++ ext_rgmii_pins: rgmii-pins {
  2565. ++ pins = "PI0", "PI1", "PI2", "PI3", "PI4",
  2566. ++ "PI5", "PI7", "PI8", "PI9", "PI10",
  2567. ++ "PI11", "PI12", "PI13", "PI14", "PI15",
  2568. ++ "PI16";
  2569. ++ function = "emac0";
  2570. ++ drive-strength = <40>;
  2571. ++ };
  2572. ++
  2573. ++ i2c0_pins: i2c0-pins {
  2574. ++ pins = "PI6", "PI7";
  2575. ++ function = "i2c0";
  2576. ++ };
  2577. ++
  2578. ++ i2c3_pins_a: i2c1-pins-a {
  2579. ++ pins = "PH4", "PH5";
  2580. ++ function = "i2c3";
  2581. ++ };
  2582. ++
  2583. ++ ir_rx_pin: ir_rx_pin {
  2584. ++ pins = "PH10";
  2585. ++ function = "ir_rx";
  2586. ++ };
  2587. ++
  2588. ++ mmc0_pins: mmc0-pins {
  2589. ++ pins = "PF0", "PF1", "PF2", "PF3",
  2590. ++ "PF4", "PF5";
  2591. ++ function = "mmc0";
  2592. ++ drive-strength = <30>;
  2593. ++ bias-pull-up;
  2594. ++ };
  2595. ++
  2596. ++ mmc1_pins: mmc1-pins {
  2597. ++ pins = "PG0", "PG1", "PG2", "PG3",
  2598. ++ "PG4", "PG5";
  2599. ++ function = "mmc1";
  2600. ++ drive-strength = <30>;
  2601. ++ bias-pull-up;
  2602. ++ };
  2603. ++
  2604. ++ mmc2_pins: mmc2-pins {
  2605. ++ pins = "PC0", "PC1", "PC5", "PC6",
  2606. ++ "PC8", "PC9", "PC10", "PC11",
  2607. ++ "PC13", "PC14", "PC15", "PC16";
  2608. ++ function = "mmc2";
  2609. ++ drive-strength = <30>;
  2610. ++ bias-pull-up;
  2611. ++ };
  2612. ++
  2613. ++ spi0_pins: spi0-pins {
  2614. ++ pins = "PC0", "PC2", "PC3", "PC4";
  2615. ++ function = "spi0";
  2616. ++ };
  2617. ++
  2618. ++ spi1_pins: spi1-pins {
  2619. ++ pins = "PH6", "PH7", "PH8";
  2620. ++ function = "spi1";
  2621. ++ };
  2622. ++
  2623. ++ spi1_cs_pin: spi1-cs-pin {
  2624. ++ pins = "PH5";
  2625. ++ function = "spi1";
  2626. ++ };
  2627. ++
  2628. ++ uart0_ph_pins: uart0-ph-pins {
  2629. ++ pins = "PH0", "PH1";
  2630. ++ function = "uart0";
  2631. ++ };
  2632. ++
  2633. ++ uart1_pins: uart1-pins {
  2634. ++ pins = "PG6", "PG7";
  2635. ++ function = "uart1";
  2636. ++ };
  2637. ++
  2638. ++ uart1_rts_cts_pins: uart1-rts-cts-pins {
  2639. ++ pins = "PG8", "PG9";
  2640. ++ function = "uart1";
  2641. ++ };
  2642. ++ };
  2643. ++
  2644. ++ gic: interrupt-controller@3021000 {
  2645. ++ compatible = "arm,gic-400";
  2646. ++ reg = <0x03021000 0x1000>,
  2647. ++ <0x03022000 0x2000>,
  2648. ++ <0x03024000 0x2000>,
  2649. ++ <0x03026000 0x2000>;
  2650. ++ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
  2651. ++ interrupt-controller;
  2652. ++ #interrupt-cells = <3>;
  2653. ++ };
  2654. ++
  2655. ++ mmc0: mmc@4020000 {
  2656. ++ compatible = "allwinner,sun50i-h616-mmc",
  2657. ++ "allwinner,sun50i-a100-mmc";
  2658. ++ reg = <0x04020000 0x1000>;
  2659. ++ clocks = <&ccu CLK_BUS_MMC0>, <&ccu CLK_MMC0>;
  2660. ++ clock-names = "ahb", "mmc";
  2661. ++ resets = <&ccu RST_BUS_MMC0>;
  2662. ++ reset-names = "ahb";
  2663. ++ interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
  2664. ++ pinctrl-names = "default";
  2665. ++ pinctrl-0 = <&mmc0_pins>;
  2666. ++ status = "disabled";
  2667. ++ #address-cells = <1>;
  2668. ++ #size-cells = <0>;
  2669. ++ };
  2670. ++
  2671. ++ mmc1: mmc@4021000 {
  2672. ++ compatible = "allwinner,sun50i-h616-mmc",
  2673. ++ "allwinner,sun50i-a100-mmc";
  2674. ++ reg = <0x04021000 0x1000>;
  2675. ++ clocks = <&ccu CLK_BUS_MMC1>, <&ccu CLK_MMC1>;
  2676. ++ clock-names = "ahb", "mmc";
  2677. ++ resets = <&ccu RST_BUS_MMC1>;
  2678. ++ reset-names = "ahb";
  2679. ++ interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
  2680. ++ pinctrl-names = "default";
  2681. ++ pinctrl-0 = <&mmc1_pins>;
  2682. ++ status = "disabled";
  2683. ++ #address-cells = <1>;
  2684. ++ #size-cells = <0>;
  2685. ++ };
  2686. ++
  2687. ++ mmc2: mmc@4022000 {
  2688. ++ compatible = "allwinner,sun50i-h616-emmc",
  2689. ++ "allwinner,sun50i-a64-emmc";
  2690. ++ reg = <0x04022000 0x1000>;
  2691. ++ clocks = <&ccu CLK_BUS_MMC2>, <&ccu CLK_MMC2>;
  2692. ++ clock-names = "ahb", "mmc";
  2693. ++ resets = <&ccu RST_BUS_MMC2>;
  2694. ++ reset-names = "ahb";
  2695. ++ interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
  2696. ++ pinctrl-names = "default";
  2697. ++ pinctrl-0 = <&mmc2_pins>;
  2698. ++ status = "disabled";
  2699. ++ #address-cells = <1>;
  2700. ++ #size-cells = <0>;
  2701. ++ };
  2702. ++
  2703. ++ uart0: serial@5000000 {
  2704. ++ compatible = "snps,dw-apb-uart";
  2705. ++ reg = <0x05000000 0x400>;
  2706. ++ interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
  2707. ++ reg-shift = <2>;
  2708. ++ reg-io-width = <4>;
  2709. ++ clocks = <&ccu CLK_BUS_UART0>;
  2710. ++ resets = <&ccu RST_BUS_UART0>;
  2711. ++ status = "disabled";
  2712. ++ };
  2713. ++
  2714. ++ uart1: serial@5000400 {
  2715. ++ compatible = "snps,dw-apb-uart";
  2716. ++ reg = <0x05000400 0x400>;
  2717. ++ interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
  2718. ++ reg-shift = <2>;
  2719. ++ reg-io-width = <4>;
  2720. ++ clocks = <&ccu CLK_BUS_UART1>;
  2721. ++ resets = <&ccu RST_BUS_UART1>;
  2722. ++ status = "disabled";
  2723. ++ };
  2724. ++
  2725. ++ uart2: serial@5000800 {
  2726. ++ compatible = "snps,dw-apb-uart";
  2727. ++ reg = <0x05000800 0x400>;
  2728. ++ interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
  2729. ++ reg-shift = <2>;
  2730. ++ reg-io-width = <4>;
  2731. ++ clocks = <&ccu CLK_BUS_UART2>;
  2732. ++ resets = <&ccu RST_BUS_UART2>;
  2733. ++ status = "disabled";
  2734. ++ };
  2735. ++
  2736. ++ uart3: serial@5000c00 {
  2737. ++ compatible = "snps,dw-apb-uart";
  2738. ++ reg = <0x05000c00 0x400>;
  2739. ++ interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
  2740. ++ reg-shift = <2>;
  2741. ++ reg-io-width = <4>;
  2742. ++ clocks = <&ccu CLK_BUS_UART3>;
  2743. ++ resets = <&ccu RST_BUS_UART3>;
  2744. ++ status = "disabled";
  2745. ++ };
  2746. ++
  2747. ++ uart4: serial@5001000 {
  2748. ++ compatible = "snps,dw-apb-uart";
  2749. ++ reg = <0x05001000 0x400>;
  2750. ++ interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
  2751. ++ reg-shift = <2>;
  2752. ++ reg-io-width = <4>;
  2753. ++ clocks = <&ccu CLK_BUS_UART4>;
  2754. ++ resets = <&ccu RST_BUS_UART4>;
  2755. ++ status = "disabled";
  2756. ++ };
  2757. ++
  2758. ++ uart5: serial@5001400 {
  2759. ++ compatible = "snps,dw-apb-uart";
  2760. ++ reg = <0x05001400 0x400>;
  2761. ++ interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
  2762. ++ reg-shift = <2>;
  2763. ++ reg-io-width = <4>;
  2764. ++ clocks = <&ccu CLK_BUS_UART5>;
  2765. ++ resets = <&ccu RST_BUS_UART5>;
  2766. ++ status = "disabled";
  2767. ++ };
  2768. ++
  2769. ++ i2c0: i2c@5002000 {
  2770. ++ compatible = "allwinner,sun50i-h616-i2c",
  2771. ++ "allwinner,sun6i-a31-i2c";
  2772. ++ reg = <0x05002000 0x400>;
  2773. ++ interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
  2774. ++ clocks = <&ccu CLK_BUS_I2C0>;
  2775. ++ resets = <&ccu RST_BUS_I2C0>;
  2776. ++ pinctrl-names = "default";
  2777. ++ pinctrl-0 = <&i2c0_pins>;
  2778. ++ status = "disabled";
  2779. ++ #address-cells = <1>;
  2780. ++ #size-cells = <0>;
  2781. ++ };
  2782. ++
  2783. ++ i2c1: i2c@5002400 {
  2784. ++ compatible = "allwinner,sun50i-h616-i2c",
  2785. ++ "allwinner,sun6i-a31-i2c";
  2786. ++ reg = <0x05002400 0x400>;
  2787. ++ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
  2788. ++ clocks = <&ccu CLK_BUS_I2C1>;
  2789. ++ resets = <&ccu RST_BUS_I2C1>;
  2790. ++ status = "disabled";
  2791. ++ #address-cells = <1>;
  2792. ++ #size-cells = <0>;
  2793. ++ };
  2794. ++
  2795. ++ i2c2: i2c@5002800 {
  2796. ++ compatible = "allwinner,sun50i-h616-i2c",
  2797. ++ "allwinner,sun6i-a31-i2c";
  2798. ++ reg = <0x05002800 0x400>;
  2799. ++ interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
  2800. ++ clocks = <&ccu CLK_BUS_I2C2>;
  2801. ++ resets = <&ccu RST_BUS_I2C2>;
  2802. ++ status = "disabled";
  2803. ++ #address-cells = <1>;
  2804. ++ #size-cells = <0>;
  2805. ++ };
  2806. ++
  2807. ++ i2c3: i2c@5002c00 {
  2808. ++ compatible = "allwinner,sun50i-h616-i2c",
  2809. ++ "allwinner,sun6i-a31-i2c";
  2810. ++ reg = <0x05002c00 0x400>;
  2811. ++ interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
  2812. ++ clocks = <&ccu CLK_BUS_I2C3>;
  2813. ++ resets = <&ccu RST_BUS_I2C3>;
  2814. ++ status = "disabled";
  2815. ++ #address-cells = <1>;
  2816. ++ #size-cells = <0>;
  2817. ++ };
  2818. ++
  2819. ++ i2c4: i2c@5003000 {
  2820. ++ compatible = "allwinner,sun50i-h616-i2c",
  2821. ++ "allwinner,sun6i-a31-i2c";
  2822. ++ reg = <0x05003000 0x400>;
  2823. ++ interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
  2824. ++ clocks = <&ccu CLK_BUS_I2C4>;
  2825. ++ resets = <&ccu RST_BUS_I2C4>;
  2826. ++ status = "disabled";
  2827. ++ #address-cells = <1>;
  2828. ++ #size-cells = <0>;
  2829. ++ };
  2830. ++
  2831. ++ spi0: spi@5010000 {
  2832. ++ compatible = "allwinner,sun50i-h616-spi",
  2833. ++ "allwinner,sun8i-h3-spi";
  2834. ++ reg = <0x05010000 0x1000>;
  2835. ++ interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
  2836. ++ clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
  2837. ++ clock-names = "ahb", "mod";
  2838. ++ resets = <&ccu RST_BUS_SPI0>;
  2839. ++ pinctrl-names = "default";
  2840. ++ pinctrl-0 = <&spi0_pins>;
  2841. ++ status = "disabled";
  2842. ++ #address-cells = <1>;
  2843. ++ #size-cells = <0>;
  2844. ++ };
  2845. ++
  2846. ++ spi1: spi@5011000 {
  2847. ++ compatible = "allwinner,sun50i-h616-spi",
  2848. ++ "allwinner,sun8i-h3-spi";
  2849. ++ reg = <0x05011000 0x1000>;
  2850. ++ interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
  2851. ++ clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
  2852. ++ clock-names = "ahb", "mod";
  2853. ++ resets = <&ccu RST_BUS_SPI1>;
  2854. ++ pinctrl-names = "default";
  2855. ++ pinctrl-0 = <&spi1_pins>;
  2856. ++ status = "disabled";
  2857. ++ #address-cells = <1>;
  2858. ++ #size-cells = <0>;
  2859. ++ };
  2860. ++
  2861. ++ emac0: ethernet@5020000 {
  2862. ++ compatible = "allwinner,sun50i-h616-emac",
  2863. ++ "allwinner,sun50i-a64-emac";
  2864. ++ syscon = <&syscon>;
  2865. ++ reg = <0x05020000 0x10000>;
  2866. ++ interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
  2867. ++ interrupt-names = "macirq";
  2868. ++ resets = <&ccu RST_BUS_EMAC0>;
  2869. ++ reset-names = "stmmaceth";
  2870. ++ clocks = <&ccu CLK_BUS_EMAC0>;
  2871. ++ clock-names = "stmmaceth";
  2872. ++ status = "disabled";
  2873. ++
  2874. ++ mdio: mdio {
  2875. ++ compatible = "snps,dwmac-mdio";
  2876. ++ #address-cells = <1>;
  2877. ++ #size-cells = <0>;
  2878. ++ };
  2879. ++ };
  2880. ++
  2881. ++ usbotg: usb@5100000 {
  2882. ++ compatible = "allwinner,sun50i-h616-musb",
  2883. ++ "allwinner,sun8i-a33-musb";
  2884. ++ reg = <0x05100000 0x0400>;
  2885. ++ clocks = <&ccu CLK_BUS_OTG>;
  2886. ++ resets = <&ccu RST_BUS_OTG>;
  2887. ++ interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
  2888. ++ interrupt-names = "mc";
  2889. ++ phys = <&usbphy 0>;
  2890. ++ phy-names = "usb";
  2891. ++ extcon = <&usbphy 0>;
  2892. ++ status = "disabled";
  2893. ++ };
  2894. ++
  2895. ++ usbphy: phy@5100400 {
  2896. ++ compatible = "allwinner,sun50i-h616-usb-phy";
  2897. ++ reg = <0x05100400 0x24>,
  2898. ++ <0x05101800 0x4>,
  2899. ++ <0x05200800 0x4>,
  2900. ++ <0x05310800 0x4>,
  2901. ++ <0x05311800 0x4>;
  2902. ++ reg-names = "phy_ctrl",
  2903. ++ "pmu0",
  2904. ++ "pmu1",
  2905. ++ "pmu2",
  2906. ++ "pmu3";
  2907. ++ clocks = <&ccu CLK_USB_PHY0>,
  2908. ++ <&ccu CLK_USB_PHY1>,
  2909. ++ <&ccu CLK_USB_PHY2>,
  2910. ++ <&ccu CLK_USB_PHY3>;
  2911. ++ clock-names = "usb0_phy",
  2912. ++ "usb1_phy",
  2913. ++ "usb2_phy",
  2914. ++ "usb3_phy";
  2915. ++ resets = <&ccu RST_USB_PHY0>,
  2916. ++ <&ccu RST_USB_PHY1>,
  2917. ++ <&ccu RST_USB_PHY2>,
  2918. ++ <&ccu RST_USB_PHY3>;
  2919. ++ reset-names = "usb0_reset",
  2920. ++ "usb1_reset",
  2921. ++ "usb2_reset",
  2922. ++ "usb3_reset";
  2923. ++ status = "disabled";
  2924. ++ #phy-cells = <1>;
  2925. ++ };
  2926. ++
  2927. ++ ehci0: usb@5101000 {
  2928. ++ compatible = "allwinner,sun50i-h616-ehci",
  2929. ++ "generic-ehci";
  2930. ++ reg = <0x05101000 0x100>;
  2931. ++ interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
  2932. ++ clocks = <&ccu CLK_BUS_OHCI0>,
  2933. ++ <&ccu CLK_BUS_EHCI0>,
  2934. ++ <&ccu CLK_USB_OHCI0>;
  2935. ++ resets = <&ccu RST_BUS_OHCI0>,
  2936. ++ <&ccu RST_BUS_EHCI0>;
  2937. ++ status = "disabled";
  2938. ++ };
  2939. ++
  2940. ++ ohci0: usb@5101400 {
  2941. ++ compatible = "allwinner,sun50i-h616-ohci",
  2942. ++ "generic-ohci";
  2943. ++ reg = <0x05101400 0x100>;
  2944. ++ interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>;
  2945. ++ clocks = <&ccu CLK_BUS_OHCI0>,
  2946. ++ <&ccu CLK_USB_OHCI0>;
  2947. ++ resets = <&ccu RST_BUS_OHCI0>;
  2948. ++ status = "disabled";
  2949. ++ };
  2950. ++
  2951. ++ ehci1: usb@5200000 {
  2952. ++ compatible = "allwinner,sun50i-h616-ehci",
  2953. ++ "generic-ehci";
  2954. ++ reg = <0x05200000 0x100>;
  2955. ++ interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
  2956. ++ clocks = <&ccu CLK_BUS_OHCI1>,
  2957. ++ <&ccu CLK_BUS_EHCI1>,
  2958. ++ <&ccu CLK_USB_OHCI1>;
  2959. ++ resets = <&ccu RST_BUS_OHCI1>,
  2960. ++ <&ccu RST_BUS_EHCI1>;
  2961. ++ phys = <&usbphy 1>;
  2962. ++ phy-names = "usb";
  2963. ++ status = "disabled";
  2964. ++ };
  2965. ++
  2966. ++ ohci1: usb@5200400 {
  2967. ++ compatible = "allwinner,sun50i-h616-ohci",
  2968. ++ "generic-ohci";
  2969. ++ reg = <0x05200400 0x100>;
  2970. ++ interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
  2971. ++ clocks = <&ccu CLK_BUS_OHCI1>,
  2972. ++ <&ccu CLK_USB_OHCI1>;
  2973. ++ resets = <&ccu RST_BUS_OHCI1>;
  2974. ++ phys = <&usbphy 1>;
  2975. ++ phy-names = "usb";
  2976. ++ status = "disabled";
  2977. ++ };
  2978. ++
  2979. ++ ehci2: usb@5310000 {
  2980. ++ compatible = "allwinner,sun50i-h616-ehci",
  2981. ++ "generic-ehci";
  2982. ++ reg = <0x05310000 0x100>;
  2983. ++ interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
  2984. ++ clocks = <&ccu CLK_BUS_OHCI2>,
  2985. ++ <&ccu CLK_BUS_EHCI2>,
  2986. ++ <&ccu CLK_USB_OHCI2>;
  2987. ++ resets = <&ccu RST_BUS_OHCI2>,
  2988. ++ <&ccu RST_BUS_EHCI2>;
  2989. ++ phys = <&usbphy 2>;
  2990. ++ phy-names = "usb";
  2991. ++ status = "disabled";
  2992. ++ };
  2993. ++
  2994. ++ ohci2: usb@5310400 {
  2995. ++ compatible = "allwinner,sun50i-h616-ohci",
  2996. ++ "generic-ohci";
  2997. ++ reg = <0x05310400 0x100>;
  2998. ++ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
  2999. ++ clocks = <&ccu CLK_BUS_OHCI2>,
  3000. ++ <&ccu CLK_USB_OHCI2>;
  3001. ++ resets = <&ccu RST_BUS_OHCI2>;
  3002. ++ phys = <&usbphy 2>;
  3003. ++ phy-names = "usb";
  3004. ++ status = "disabled";
  3005. ++ };
  3006. ++
  3007. ++ ehci3: usb@5311000 {
  3008. ++ compatible = "allwinner,sun50i-h616-ehci",
  3009. ++ "generic-ehci";
  3010. ++ reg = <0x05311000 0x100>;
  3011. ++ interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
  3012. ++ clocks = <&ccu CLK_BUS_OHCI3>,
  3013. ++ <&ccu CLK_BUS_EHCI3>,
  3014. ++ <&ccu CLK_USB_OHCI3>;
  3015. ++ resets = <&ccu RST_BUS_OHCI3>,
  3016. ++ <&ccu RST_BUS_EHCI3>;
  3017. ++ phys = <&usbphy 3>;
  3018. ++ phy-names = "usb";
  3019. ++ status = "disabled";
  3020. ++ };
  3021. ++
  3022. ++ ohci3: usb@5311400 {
  3023. ++ compatible = "allwinner,sun50i-h616-ohci",
  3024. ++ "generic-ohci";
  3025. ++ reg = <0x05311400 0x100>;
  3026. ++ interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
  3027. ++ clocks = <&ccu CLK_BUS_OHCI3>,
  3028. ++ <&ccu CLK_USB_OHCI3>;
  3029. ++ resets = <&ccu RST_BUS_OHCI3>;
  3030. ++ phys = <&usbphy 3>;
  3031. ++ phy-names = "usb";
  3032. ++ status = "disabled";
  3033. ++ };
  3034. ++
  3035. ++ rtc: rtc@7000000 {
  3036. ++ compatible = "allwinner,sun50i-h616-rtc",
  3037. ++ "allwinner,sun50i-h6-rtc";
  3038. ++ reg = <0x07000000 0x400>;
  3039. ++ interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>,
  3040. ++ <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
  3041. ++ clock-output-names = "osc32k", "osc32k-out", "iosc";
  3042. ++ #clock-cells = <1>;
  3043. ++ };
  3044. ++
  3045. ++ r_ccu: clock@7010000 {
  3046. ++ compatible = "allwinner,sun50i-h616-r-ccu";
  3047. ++ reg = <0x07010000 0x400>;
  3048. ++ clocks = <&osc24M>, <&rtc 0>, <&rtc 2>,
  3049. ++ <&ccu CLK_PLL_PERIPH0>;
  3050. ++ clock-names = "hosc", "losc", "iosc", "pll-periph";
  3051. ++ #clock-cells = <1>;
  3052. ++ #reset-cells = <1>;
  3053. ++ };
  3054. ++
  3055. ++ r_pio: pinctrl@7022000 {
  3056. ++ compatible = "allwinner,sun50i-h616-r-pinctrl";
  3057. ++ reg = <0x07022000 0x400>;
  3058. ++ interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
  3059. ++ clocks = <&r_ccu CLK_R_APB1>, <&osc24M>, <&rtc 0>;
  3060. ++ clock-names = "apb", "hosc", "losc";
  3061. ++ gpio-controller;
  3062. ++ #gpio-cells = <3>;
  3063. ++ interrupt-controller;
  3064. ++ #interrupt-cells = <3>;
  3065. ++
  3066. ++ r_i2c_pins: r-i2c-pins {
  3067. ++ pins = "PL0", "PL1";
  3068. ++ function = "s_i2c";
  3069. ++ };
  3070. ++ };
  3071. ++
  3072. ++ ir: ir@7040000 {
  3073. ++ compatible = "allwinner,sun50i-h616-ir",
  3074. ++ "allwinner,sun6i-a31-ir";
  3075. ++ reg = <0x07040000 0x400>;
  3076. ++ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
  3077. ++ clocks = <&ccu CLK_R_APB1_IR>,
  3078. ++ <&ccu CLK_IR>;
  3079. ++ clock-names = "apb", "ir";
  3080. ++ resets = <&ccu RST_R_APB1_IR>;
  3081. ++ pinctrl-names = "default";
  3082. ++ pinctrl-0 = <&ir_rx_pin>;
  3083. ++ status = "disabled";
  3084. ++ };
  3085. ++
  3086. ++ r_i2c: i2c@7081400 {
  3087. ++ compatible = "allwinner,sun50i-h616-i2c",
  3088. ++ "allwinner,sun6i-a31-i2c";
  3089. ++ reg = <0x07081400 0x400>;
  3090. ++ interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
  3091. ++ clocks = <&r_ccu CLK_R_APB2_I2C>;
  3092. ++ resets = <&r_ccu RST_R_APB2_I2C>;
  3093. ++ status = "disabled";
  3094. ++ #address-cells = <1>;
  3095. ++ #size-cells = <0>;
  3096. ++ };
  3097. ++ };
  3098. ++};
  3099. diff --git a/target/linux/sunxi/patches-5.10/508-Add-OrangePi-Zero-2-.dts.patch b/target/linux/sunxi/patches-5.10/508-Add-OrangePi-Zero-2-.dts.patch
  3100. new file mode 100644
  3101. index 0000000000000..870c00efe3d14
  3102. --- /dev/null
  3103. +++ b/target/linux/sunxi/patches-5.10/508-Add-OrangePi-Zero-2-.dts.patch
  3104. @@ -0,0 +1,244 @@
  3105. +diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
  3106. +index 211d1e9d4701..0cf8299b1ce7 100644
  3107. +--- a/arch/arm64/boot/dts/allwinner/Makefile
  3108. ++++ b/arch/arm64/boot/dts/allwinner/Makefile
  3109. +@@ -36,3 +36,4 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-orangepi-one-plus.dtb
  3110. + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-pine-h64.dtb
  3111. + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-pine-h64-model-b.dtb
  3112. + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-tanix-tx6.dtb
  3113. ++dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb
  3114. +
  3115. +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
  3116. +new file mode 100644
  3117. +index 000000000000..814f5b4fec7c
  3118. +--- /dev/null
  3119. ++++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
  3120. +@@ -0,0 +1,228 @@
  3121. ++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  3122. ++/*
  3123. ++ * Copyright (C) 2020 Arm Ltd.
  3124. ++ */
  3125. ++
  3126. ++/dts-v1/;
  3127. ++
  3128. ++#include "sun50i-h616.dtsi"
  3129. ++
  3130. ++#include <dt-bindings/gpio/gpio.h>
  3131. ++#include <dt-bindings/interrupt-controller/arm-gic.h>
  3132. ++
  3133. ++/ {
  3134. ++ model = "OrangePi Zero2";
  3135. ++ compatible = "xunlong,orangepi-zero2", "allwinner,sun50i-h616";
  3136. ++
  3137. ++ aliases {
  3138. ++ ethernet0 = &emac0;
  3139. ++ serial0 = &uart0;
  3140. ++ };
  3141. ++
  3142. ++ chosen {
  3143. ++ stdout-path = "serial0:115200n8";
  3144. ++ };
  3145. ++
  3146. ++ leds {
  3147. ++ compatible = "gpio-leds";
  3148. ++
  3149. ++ power {
  3150. ++ label = "orangepi:red:power";
  3151. ++ gpios = <&pio 2 13 GPIO_ACTIVE_HIGH>; /* PC13 */
  3152. ++ default-state = "on";
  3153. ++ };
  3154. ++
  3155. ++ status {
  3156. ++ label = "orangepi:green:status";
  3157. ++ gpios = <&pio 2 12 GPIO_ACTIVE_HIGH>; /* PC12 */
  3158. ++ };
  3159. ++ };
  3160. ++
  3161. ++ reg_vcc5v: vcc5v {
  3162. ++ /* board wide 5V supply directly from the USB-C socket */
  3163. ++ compatible = "regulator-fixed";
  3164. ++ regulator-name = "vcc-5v";
  3165. ++ regulator-min-microvolt = <5000000>;
  3166. ++ regulator-max-microvolt = <5000000>;
  3167. ++ regulator-always-on;
  3168. ++ };
  3169. ++
  3170. ++ reg_usb1_vbus: usb1-vbus {
  3171. ++ compatible = "regulator-fixed";
  3172. ++ regulator-name = "usb1-vbus";
  3173. ++ regulator-min-microvolt = <5000000>;
  3174. ++ regulator-max-microvolt = <5000000>;
  3175. ++ enable-active-high;
  3176. ++ gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */
  3177. ++ status = "okay";
  3178. ++ };
  3179. ++};
  3180. ++
  3181. ++&ehci0 {
  3182. ++ status = "okay";
  3183. ++};
  3184. ++
  3185. ++&ehci1 {
  3186. ++ status = "okay";
  3187. ++};
  3188. ++
  3189. ++/* USB 2 & 3 are on headers only. */
  3190. ++
  3191. ++&emac0 {
  3192. ++ pinctrl-names = "default";
  3193. ++ pinctrl-0 = <&ext_rgmii_pins>;
  3194. ++ phy-mode = "rgmii-id";
  3195. ++ phy-handle = <&ext_rgmii_phy>;
  3196. ++ phy-supply = <&reg_dcdce>;
  3197. ++ allwinner,rx-delay-ps = <3100>;
  3198. ++ allwinner,tx-delay-ps = <700>;
  3199. ++ status = "okay";
  3200. ++};
  3201. ++
  3202. ++&mdio {
  3203. ++ ext_rgmii_phy: ethernet-phy@1 {
  3204. ++ compatible = "ethernet-phy-ieee802.3-c22";
  3205. ++ reg = <1>;
  3206. ++ };
  3207. ++};
  3208. ++
  3209. ++&mmc0 {
  3210. ++ vmmc-supply = <&reg_dcdce>;
  3211. ++ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
  3212. ++ bus-width = <4>;
  3213. ++ status = "okay";
  3214. ++};
  3215. ++
  3216. ++&ohci0 {
  3217. ++ status = "okay";
  3218. ++};
  3219. ++
  3220. ++&ohci1 {
  3221. ++ status = "okay";
  3222. ++};
  3223. ++
  3224. ++&r_i2c {
  3225. ++ status = "okay";
  3226. ++
  3227. ++ axp305: pmic@36 {
  3228. ++ compatible = "x-powers,axp305", "x-powers,axp805",
  3229. ++ "x-powers,axp806";
  3230. ++ reg = <0x36>;
  3231. ++
  3232. ++ /* dummy interrupt to appease the driver for now */
  3233. ++ interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
  3234. ++ interrupt-controller;
  3235. ++ #interrupt-cells = <1>;
  3236. ++
  3237. ++ x-powers,self-working-mode;
  3238. ++ vina-supply = <&reg_vcc5v>;
  3239. ++ vinb-supply = <&reg_vcc5v>;
  3240. ++ vinc-supply = <&reg_vcc5v>;
  3241. ++ vind-supply = <&reg_vcc5v>;
  3242. ++ vine-supply = <&reg_vcc5v>;
  3243. ++ aldoin-supply = <&reg_vcc5v>;
  3244. ++ bldoin-supply = <&reg_vcc5v>;
  3245. ++ cldoin-supply = <&reg_vcc5v>;
  3246. ++
  3247. ++ regulators {
  3248. ++ reg_aldo1: aldo1 {
  3249. ++ regulator-always-on;
  3250. ++ regulator-min-microvolt = <3300000>;
  3251. ++ regulator-max-microvolt = <3300000>;
  3252. ++ regulator-name = "vcc-sys";
  3253. ++ };
  3254. ++
  3255. ++ reg_aldo2: aldo2 {
  3256. ++ regulator-min-microvolt = <3300000>;
  3257. ++ regulator-max-microvolt = <3300000>;
  3258. ++ regulator-name = "vcc3v3-ext";
  3259. ++ };
  3260. ++
  3261. ++ reg_aldo3: aldo3 {
  3262. ++ regulator-min-microvolt = <3300000>;
  3263. ++ regulator-max-microvolt = <3300000>;
  3264. ++ regulator-name = "vcc3v3-ext2";
  3265. ++ };
  3266. ++
  3267. ++ reg_bldo1: bldo1 {
  3268. ++ regulator-always-on;
  3269. ++ regulator-min-microvolt = <1800000>;
  3270. ++ regulator-max-microvolt = <1800000>;
  3271. ++ regulator-name = "vcc1v8";
  3272. ++ };
  3273. ++
  3274. ++ bldo2 {
  3275. ++ /* unused */
  3276. ++ };
  3277. ++
  3278. ++ bldo3 {
  3279. ++ /* unused */
  3280. ++ };
  3281. ++
  3282. ++ bldo4 {
  3283. ++ /* unused */
  3284. ++ };
  3285. ++
  3286. ++ cldo1 {
  3287. ++ /* reserved */
  3288. ++ };
  3289. ++
  3290. ++ cldo2 {
  3291. ++ /* unused */
  3292. ++ };
  3293. ++
  3294. ++ cldo3 {
  3295. ++ /* unused */
  3296. ++ };
  3297. ++
  3298. ++ reg_dcdca: dcdca {
  3299. ++ regulator-always-on;
  3300. ++ regulator-min-microvolt = <810000>;
  3301. ++ regulator-max-microvolt = <1080000>;
  3302. ++ regulator-name = "vdd-cpu";
  3303. ++ };
  3304. ++
  3305. ++ reg_dcdcc: dcdcc {
  3306. ++ regulator-always-on;
  3307. ++ regulator-min-microvolt = <810000>;
  3308. ++ regulator-max-microvolt = <1080000>;
  3309. ++ regulator-name = "vdd-gpu-sys";
  3310. ++ };
  3311. ++
  3312. ++ reg_dcdcd: dcdcd {
  3313. ++ regulator-always-on;
  3314. ++ regulator-min-microvolt = <1500000>;
  3315. ++ regulator-max-microvolt = <1500000>;
  3316. ++ regulator-name = "vdd-dram";
  3317. ++ };
  3318. ++
  3319. ++ reg_dcdce: dcdce {
  3320. ++ regulator-boot-on;
  3321. ++ regulator-min-microvolt = <3300000>;
  3322. ++ regulator-max-microvolt = <3300000>;
  3323. ++ regulator-name = "vcc-eth-mmc";
  3324. ++ };
  3325. ++
  3326. ++ sw {
  3327. ++ /* unused */
  3328. ++ };
  3329. ++ };
  3330. ++ };
  3331. ++};
  3332. ++
  3333. ++&uart0 {
  3334. ++ pinctrl-names = "default";
  3335. ++ pinctrl-0 = <&uart0_ph_pins>;
  3336. ++ status = "okay";
  3337. ++};
  3338. ++
  3339. ++&usbotg {
  3340. ++ dr_mode = "otg";
  3341. ++ status = "okay";
  3342. ++};
  3343. ++
  3344. ++&usbphy {
  3345. ++ usb0_vbus-supply = <&reg_vcc5v>;
  3346. ++ usb1_vbus-supply = <&reg_usb1_vbus>;
  3347. ++ status = "okay";
  3348. ++};