2
0

0078-riscv-Add-Allwinner-D1-devicetrees.patch 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138
  1. From ce792f7abd4294ebba76f76d9d7aa90c7970de8e Mon Sep 17 00:00:00 2001
  2. From: Samuel Holland <[email protected]>
  3. Date: Thu, 4 Aug 2022 23:35:09 -0500
  4. Subject: [PATCH 78/90] riscv: Add Allwinner D1 devicetrees
  5. Signed-off-by: Samuel Holland <[email protected]>
  6. ---
  7. arch/riscv/dts/Makefile | 9 +
  8. .../riscv/dts/sun20i-d1-clockworkpi-v3.14.dts | 242 +++++
  9. .../dts/sun20i-d1-common-regulators.dtsi | 51 +
  10. arch/riscv/dts/sun20i-d1-devterm-v3.14.dts | 37 +
  11. .../dts/sun20i-d1-dongshan-nezha-stu.dts | 114 +++
  12. .../dts/sun20i-d1-lichee-rv-86-panel-480p.dts | 29 +
  13. .../dts/sun20i-d1-lichee-rv-86-panel-720p.dts | 10 +
  14. .../dts/sun20i-d1-lichee-rv-86-panel.dtsi | 92 ++
  15. arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts | 74 ++
  16. arch/riscv/dts/sun20i-d1-lichee-rv.dts | 84 ++
  17. arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts | 128 +++
  18. arch/riscv/dts/sun20i-d1-nezha.dts | 171 ++++
  19. arch/riscv/dts/sun20i-d1.dtsi | 900 ++++++++++++++++++
  20. arch/riscv/dts/sunxi-u-boot.dtsi | 68 ++
  21. include/dt-bindings/clock/sun20i-d1-r-ccu.h | 19 +
  22. include/dt-bindings/reset/sun20i-d1-r-ccu.h | 16 +
  23. 16 files changed, 2044 insertions(+)
  24. create mode 100644 arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts
  25. create mode 100644 arch/riscv/dts/sun20i-d1-common-regulators.dtsi
  26. create mode 100644 arch/riscv/dts/sun20i-d1-devterm-v3.14.dts
  27. create mode 100644 arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts
  28. create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts
  29. create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-720p.dts
  30. create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi
  31. create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts
  32. create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv.dts
  33. create mode 100644 arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts
  34. create mode 100644 arch/riscv/dts/sun20i-d1-nezha.dts
  35. create mode 100644 arch/riscv/dts/sun20i-d1.dtsi
  36. create mode 100644 arch/riscv/dts/sunxi-u-boot.dtsi
  37. create mode 100644 include/dt-bindings/clock/sun20i-d1-r-ccu.h
  38. create mode 100644 include/dt-bindings/reset/sun20i-d1-r-ccu.h
  39. --- a/arch/riscv/dts/Makefile
  40. +++ b/arch/riscv/dts/Makefile
  41. @@ -7,6 +7,15 @@ dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) +
  42. dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb
  43. dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb
  44. dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb
  45. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-clockworkpi-v3.14.dtb
  46. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-devterm-v3.14.dtb
  47. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-dongshan-nezha-stu.dtb
  48. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv-86-panel-480p.dtb
  49. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv-86-panel-720p.dtb
  50. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv-dock.dtb
  51. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv.dtb
  52. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-mangopi-mq-pro.dtb
  53. +dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-nezha.dtb
  54. include $(srctree)/scripts/Makefile.dts
  55. --- /dev/null
  56. +++ b/arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts
  57. @@ -0,0 +1,242 @@
  58. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  59. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  60. +
  61. +/dts-v1/;
  62. +
  63. +#include <dt-bindings/gpio/gpio.h>
  64. +
  65. +#include "sun20i-d1.dtsi"
  66. +#include "sun20i-d1-common-regulators.dtsi"
  67. +
  68. +/ {
  69. + model = "ClockworkPi v3.14 (R-01)";
  70. + compatible = "clockwork,r-01-clockworkpi-v3.14", "allwinner,sun20i-d1";
  71. +
  72. + aliases {
  73. + ethernet0 = &ap6256;
  74. + mmc0 = &mmc0;
  75. + serial0 = &uart0;
  76. + };
  77. +
  78. + chosen {
  79. + stdout-path = "serial0:115200n8";
  80. + };
  81. +
  82. + /*
  83. + * This regulator is PWM-controlled, but the PWM controller is not
  84. + * yet supported, so fix the regulator to its default voltage.
  85. + */
  86. + reg_vdd_cpu: vdd-cpu {
  87. + compatible = "regulator-fixed";
  88. + regulator-name = "vdd-cpu";
  89. + regulator-min-microvolt = <1100000>;
  90. + regulator-max-microvolt = <1100000>;
  91. + vin-supply = <&reg_vcc>;
  92. + };
  93. +
  94. + wifi_pwrseq: wifi-pwrseq {
  95. + compatible = "mmc-pwrseq-simple";
  96. + reset-gpios = <&pio 6 11 GPIO_ACTIVE_LOW>; /* PG11/GPIO3 */
  97. + };
  98. +};
  99. +
  100. +&cpu0 {
  101. + cpu-supply = <&reg_vdd_cpu>;
  102. +};
  103. +
  104. +&ehci1 {
  105. + status = "okay";
  106. +};
  107. +
  108. +&i2c0 {
  109. + pinctrl-0 = <&i2c0_pb10_pins>;
  110. + pinctrl-names = "default";
  111. + status = "okay";
  112. +
  113. + axp221: pmic@34 {
  114. + compatible = "x-powers,axp228", "x-powers,axp221";
  115. + reg = <0x34>;
  116. + interrupt-parent = <&pio>;
  117. + interrupts = <4 9 IRQ_TYPE_LEVEL_LOW>; /* PE9/GPIO2 */
  118. + interrupt-controller;
  119. + #interrupt-cells = <1>;
  120. +
  121. + ac_power_supply: ac-power {
  122. + compatible = "x-powers,axp221-ac-power-supply";
  123. + };
  124. +
  125. + axp_adc: adc {
  126. + compatible = "x-powers,axp221-adc";
  127. + #io-channel-cells = <1>;
  128. + };
  129. +
  130. + battery_power_supply: battery-power {
  131. + compatible = "x-powers,axp221-battery-power-supply";
  132. + };
  133. +
  134. + regulators {
  135. + x-powers,dcdc-freq = <3000>;
  136. +
  137. + reg_dcdc1: dcdc1 {
  138. + regulator-name = "sys-3v3";
  139. + regulator-always-on;
  140. + regulator-min-microvolt = <3300000>;
  141. + regulator-max-microvolt = <3300000>;
  142. + };
  143. +
  144. + reg_dcdc3: dcdc3 {
  145. + regulator-name = "sys-1v8";
  146. + regulator-always-on;
  147. + regulator-min-microvolt = <1800000>;
  148. + regulator-max-microvolt = <1800000>;
  149. + };
  150. +
  151. + reg_aldo1: aldo1 {
  152. + regulator-name = "aud-3v3";
  153. + regulator-min-microvolt = <3300000>;
  154. + regulator-max-microvolt = <3300000>;
  155. + };
  156. +
  157. + reg_aldo2: aldo2 {
  158. + regulator-name = "disp-3v3";
  159. + regulator-always-on;
  160. + regulator-min-microvolt = <3300000>;
  161. + regulator-max-microvolt = <3300000>;
  162. + };
  163. +
  164. + reg_aldo3: aldo3 {
  165. + regulator-name = "vdd-wifi";
  166. + regulator-min-microvolt = <1800000>;
  167. + regulator-max-microvolt = <1800000>;
  168. + };
  169. +
  170. + /* DLDO1 and ELDO1-3 are connected in parallel. */
  171. + reg_dldo1: dldo1 {
  172. + regulator-name = "vbat-wifi-a";
  173. + regulator-always-on;
  174. + regulator-min-microvolt = <3300000>;
  175. + regulator-max-microvolt = <3300000>;
  176. + };
  177. +
  178. + /* DLDO2-DLDO4 are connected in parallel. */
  179. + reg_dldo2: dldo2 {
  180. + regulator-name = "vcc-3v3-ext-a";
  181. + regulator-always-on;
  182. + regulator-min-microvolt = <3300000>;
  183. + regulator-max-microvolt = <3300000>;
  184. + };
  185. +
  186. + reg_dldo3: dldo3 {
  187. + regulator-name = "vcc-3v3-ext-b";
  188. + regulator-always-on;
  189. + regulator-min-microvolt = <3300000>;
  190. + regulator-max-microvolt = <3300000>;
  191. + };
  192. +
  193. + reg_dldo4: dldo4 {
  194. + regulator-name = "vcc-3v3-ext-c";
  195. + regulator-always-on;
  196. + regulator-min-microvolt = <3300000>;
  197. + regulator-max-microvolt = <3300000>;
  198. + };
  199. +
  200. + reg_eldo1: eldo1 {
  201. + regulator-name = "vbat-wifi-b";
  202. + regulator-always-on;
  203. + regulator-min-microvolt = <3300000>;
  204. + regulator-max-microvolt = <3300000>;
  205. + };
  206. +
  207. + reg_eldo2: eldo2 {
  208. + regulator-name = "vbat-wifi-c";
  209. + regulator-always-on;
  210. + regulator-min-microvolt = <3300000>;
  211. + regulator-max-microvolt = <3300000>;
  212. + };
  213. +
  214. + reg_eldo3: eldo3 {
  215. + regulator-name = "vbat-wifi-d";
  216. + regulator-always-on;
  217. + regulator-min-microvolt = <3300000>;
  218. + regulator-max-microvolt = <3300000>;
  219. + };
  220. + };
  221. +
  222. + usb_power_supply: usb-power {
  223. + compatible = "x-powers,axp221-usb-power-supply";
  224. + status = "disabled";
  225. + };
  226. + };
  227. +};
  228. +
  229. +&mmc0 {
  230. + broken-cd;
  231. + bus-width = <4>;
  232. + disable-wp;
  233. + vmmc-supply = <&reg_dcdc1>;
  234. + vqmmc-supply = <&reg_vcc_3v3>;
  235. + pinctrl-0 = <&mmc0_pins>;
  236. + pinctrl-names = "default";
  237. + status = "okay";
  238. +};
  239. +
  240. +&mmc1 {
  241. + bus-width = <4>;
  242. + mmc-pwrseq = <&wifi_pwrseq>;
  243. + non-removable;
  244. + vmmc-supply = <&reg_dldo1>;
  245. + vqmmc-supply = <&reg_aldo3>;
  246. + pinctrl-0 = <&mmc1_pins>;
  247. + pinctrl-names = "default";
  248. + status = "okay";
  249. +
  250. + ap6256: wifi@1 {
  251. + compatible = "brcm,bcm43456-fmac", "brcm,bcm4329-fmac";
  252. + reg = <1>;
  253. + interrupt-parent = <&pio>;
  254. + interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10/GPIO4 */
  255. + interrupt-names = "host-wake";
  256. + };
  257. +};
  258. +
  259. +&ohci1 {
  260. + status = "okay";
  261. +};
  262. +
  263. +&pio {
  264. + vcc-pg-supply = <&reg_ldoa>;
  265. +};
  266. +
  267. +&uart0 {
  268. + pinctrl-0 = <&uart0_pb8_pins>;
  269. + pinctrl-names = "default";
  270. + status = "okay";
  271. +};
  272. +
  273. +&uart1 {
  274. + uart-has-rtscts;
  275. + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
  276. + pinctrl-names = "default";
  277. + status = "okay";
  278. +
  279. + bluetooth {
  280. + compatible = "brcm,bcm4345c5";
  281. + interrupt-parent = <&pio>;
  282. + interrupts = <6 17 IRQ_TYPE_LEVEL_HIGH>; /* PG17/GPIO6 */
  283. + device-wakeup-gpios = <&pio 6 16 GPIO_ACTIVE_HIGH>; /* PG16/GPIO7 */
  284. + shutdown-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18/GPIO5 */
  285. + max-speed = <1500000>;
  286. + vbat-supply = <&reg_dldo1>;
  287. + vddio-supply = <&reg_aldo3>;
  288. + };
  289. +};
  290. +
  291. +&usb_otg {
  292. + dr_mode = "peripheral";
  293. + status = "okay";
  294. +};
  295. +
  296. +&usbphy {
  297. + usb0_vbus_power-supply = <&ac_power_supply>;
  298. + status = "okay";
  299. +};
  300. --- /dev/null
  301. +++ b/arch/riscv/dts/sun20i-d1-common-regulators.dtsi
  302. @@ -0,0 +1,51 @@
  303. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  304. +// Copyright (C) 2021-2022 Samuel Holland <[email protected]>
  305. +
  306. +/ {
  307. + reg_vcc: vcc {
  308. + compatible = "regulator-fixed";
  309. + regulator-name = "vcc";
  310. + regulator-min-microvolt = <5000000>;
  311. + regulator-max-microvolt = <5000000>;
  312. + };
  313. +
  314. + reg_vcc_3v3: vcc-3v3 {
  315. + compatible = "regulator-fixed";
  316. + regulator-name = "vcc-3v3";
  317. + regulator-min-microvolt = <3300000>;
  318. + regulator-max-microvolt = <3300000>;
  319. + vin-supply = <&reg_vcc>;
  320. + };
  321. +};
  322. +
  323. +&lradc {
  324. + vref-supply = <&reg_aldo>;
  325. +};
  326. +
  327. +&pio {
  328. + vcc-pb-supply = <&reg_vcc_3v3>;
  329. + vcc-pc-supply = <&reg_vcc_3v3>;
  330. + vcc-pd-supply = <&reg_vcc_3v3>;
  331. + vcc-pe-supply = <&reg_vcc_3v3>;
  332. + vcc-pf-supply = <&reg_vcc_3v3>;
  333. + vcc-pg-supply = <&reg_vcc_3v3>;
  334. +};
  335. +
  336. +&reg_aldo {
  337. + regulator-min-microvolt = <1800000>;
  338. + regulator-max-microvolt = <1800000>;
  339. + vdd33-supply = <&reg_vcc_3v3>;
  340. +};
  341. +
  342. +&reg_hpldo {
  343. + regulator-min-microvolt = <1800000>;
  344. + regulator-max-microvolt = <1800000>;
  345. + hpldoin-supply = <&reg_vcc_3v3>;
  346. +};
  347. +
  348. +&reg_ldoa {
  349. + regulator-always-on;
  350. + regulator-min-microvolt = <1800000>;
  351. + regulator-max-microvolt = <1800000>;
  352. + ldo-in-supply = <&reg_vcc_3v3>;
  353. +};
  354. --- /dev/null
  355. +++ b/arch/riscv/dts/sun20i-d1-devterm-v3.14.dts
  356. @@ -0,0 +1,37 @@
  357. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  358. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  359. +
  360. +/dts-v1/;
  361. +
  362. +#include "sun20i-d1-clockworkpi-v3.14.dts"
  363. +
  364. +/ {
  365. + model = "Clockwork DevTerm (R-01)";
  366. + compatible = "clockwork,r-01-devterm-v3.14",
  367. + "clockwork,r-01-clockworkpi-v3.14",
  368. + "allwinner,sun20i-d1";
  369. +
  370. + fan {
  371. + compatible = "gpio-fan";
  372. + gpios = <&pio 3 10 GPIO_ACTIVE_HIGH>; /* PD10/GPIO41 */
  373. + gpio-fan,speed-map = <0 0>,
  374. + <6000 1>;
  375. + #cooling-cells = <2>;
  376. + };
  377. +
  378. + i2c-gpio-0 {
  379. + compatible = "i2c-gpio";
  380. + sda-gpios = <&pio 3 14 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD14/GPIO44 */
  381. + scl-gpios = <&pio 3 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD15/GPIO45 */
  382. + #address-cells = <1>;
  383. + #size-cells = <0>;
  384. +
  385. + adc@54 {
  386. + compatible = "ti,adc101c";
  387. + reg = <0x54>;
  388. + interrupt-parent = <&pio>;
  389. + interrupts = <4 12 IRQ_TYPE_LEVEL_LOW>; /* PE12/GPIO35 */
  390. + vref-supply = <&reg_dldo2>;
  391. + };
  392. + };
  393. +};
  394. --- /dev/null
  395. +++ b/arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts
  396. @@ -0,0 +1,114 @@
  397. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  398. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  399. +
  400. +/dts-v1/;
  401. +
  402. +#include <dt-bindings/gpio/gpio.h>
  403. +#include <dt-bindings/leds/common.h>
  404. +
  405. +#include "sun20i-d1.dtsi"
  406. +#include "sun20i-d1-common-regulators.dtsi"
  407. +
  408. +/ {
  409. + model = "Dongshan Nezha STU";
  410. + compatible = "100ask,dongshan-nezha-stu", "allwinner,sun20i-d1";
  411. +
  412. + aliases {
  413. + ethernet0 = &emac;
  414. + mmc0 = &mmc0;
  415. + serial0 = &uart0;
  416. + };
  417. +
  418. + chosen {
  419. + stdout-path = "serial0:115200n8";
  420. + };
  421. +
  422. + leds {
  423. + compatible = "gpio-leds";
  424. +
  425. + led-0 {
  426. + color = <LED_COLOR_ID_GREEN>;
  427. + function = LED_FUNCTION_STATUS;
  428. + gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */
  429. + };
  430. + };
  431. +
  432. + reg_usbvbus: usbvbus {
  433. + compatible = "regulator-fixed";
  434. + regulator-name = "usbvbus";
  435. + regulator-min-microvolt = <5000000>;
  436. + regulator-max-microvolt = <5000000>;
  437. + gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
  438. + enable-active-high;
  439. + vin-supply = <&reg_vcc>;
  440. + };
  441. +
  442. + /*
  443. + * This regulator is PWM-controlled, but the PWM controller is not
  444. + * yet supported, so fix the regulator to its default voltage.
  445. + */
  446. + reg_vdd_cpu: vdd-cpu {
  447. + compatible = "regulator-fixed";
  448. + regulator-name = "vdd-cpu";
  449. + regulator-min-microvolt = <1100000>;
  450. + regulator-max-microvolt = <1100000>;
  451. + vin-supply = <&reg_vcc>;
  452. + };
  453. +};
  454. +
  455. +&cpu0 {
  456. + cpu-supply = <&reg_vdd_cpu>;
  457. +};
  458. +
  459. +&ehci0 {
  460. + status = "okay";
  461. +};
  462. +
  463. +&emac {
  464. + pinctrl-0 = <&rgmii_pe_pins>;
  465. + pinctrl-names = "default";
  466. + phy-handle = <&ext_rgmii_phy>;
  467. + phy-mode = "rgmii-id";
  468. + phy-supply = <&reg_vcc_3v3>;
  469. + status = "okay";
  470. +};
  471. +
  472. +&mdio {
  473. + ext_rgmii_phy: ethernet-phy@1 {
  474. + compatible = "ethernet-phy-ieee802.3-c22";
  475. + reg = <1>;
  476. + };
  477. +};
  478. +
  479. +&mmc0 {
  480. + broken-cd;
  481. + bus-width = <4>;
  482. + disable-wp;
  483. + vmmc-supply = <&reg_vcc_3v3>;
  484. + vqmmc-supply = <&reg_vcc_3v3>;
  485. + pinctrl-0 = <&mmc0_pins>;
  486. + pinctrl-names = "default";
  487. + status = "okay";
  488. +};
  489. +
  490. +&ohci0 {
  491. + status = "okay";
  492. +};
  493. +
  494. +&uart0 {
  495. + pinctrl-0 = <&uart0_pb8_pins>;
  496. + pinctrl-names = "default";
  497. + status = "okay";
  498. +};
  499. +
  500. +&usb_otg {
  501. + dr_mode = "otg";
  502. + status = "okay";
  503. +};
  504. +
  505. +&usbphy {
  506. + usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
  507. + usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
  508. + usb0_vbus-supply = <&reg_usbvbus>;
  509. + status = "okay";
  510. +};
  511. --- /dev/null
  512. +++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts
  513. @@ -0,0 +1,29 @@
  514. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  515. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  516. +
  517. +#include "sun20i-d1-lichee-rv-86-panel.dtsi"
  518. +
  519. +/ {
  520. + model = "Sipeed Lichee RV 86 Panel (480p)";
  521. + compatible = "sipeed,lichee-rv-86-panel-480p", "sipeed,lichee-rv",
  522. + "allwinner,sun20i-d1";
  523. +};
  524. +
  525. +&i2c2 {
  526. + pinctrl-0 = <&i2c2_pb0_pins>;
  527. + pinctrl-names = "default";
  528. + status = "okay";
  529. +
  530. + touchscreen@48 {
  531. + compatible = "focaltech,ft6236";
  532. + reg = <0x48>;
  533. + interrupt-parent = <&pio>;
  534. + interrupts = <6 14 IRQ_TYPE_LEVEL_LOW>; /* PG14 */
  535. + iovcc-supply = <&reg_vcc_3v3>;
  536. + reset-gpios = <&pio 6 15 GPIO_ACTIVE_LOW>; /* PG15 */
  537. + touchscreen-size-x = <480>;
  538. + touchscreen-size-y = <480>;
  539. + vcc-supply = <&reg_vcc_3v3>;
  540. + wakeup-source;
  541. + };
  542. +};
  543. --- /dev/null
  544. +++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-720p.dts
  545. @@ -0,0 +1,10 @@
  546. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  547. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  548. +
  549. +#include "sun20i-d1-lichee-rv-86-panel.dtsi"
  550. +
  551. +/ {
  552. + model = "Sipeed Lichee RV 86 Panel (720p)";
  553. + compatible = "sipeed,lichee-rv-86-panel-720p", "sipeed,lichee-rv",
  554. + "allwinner,sun20i-d1";
  555. +};
  556. --- /dev/null
  557. +++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi
  558. @@ -0,0 +1,92 @@
  559. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  560. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  561. +
  562. +#include "sun20i-d1-lichee-rv.dts"
  563. +
  564. +/ {
  565. + aliases {
  566. + ethernet0 = &emac;
  567. + ethernet1 = &xr829;
  568. + };
  569. +
  570. + /* PC1 is repurposed as BT_WAKE_AP */
  571. + /delete-node/ leds;
  572. +
  573. + wifi_pwrseq: wifi-pwrseq {
  574. + compatible = "mmc-pwrseq-simple";
  575. + clocks = <&ccu CLK_FANOUT1>;
  576. + clock-names = "ext_clock";
  577. + reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
  578. + assigned-clocks = <&ccu CLK_FANOUT1>;
  579. + assigned-clock-rates = <32768>;
  580. + pinctrl-0 = <&clk_pg11_pin>;
  581. + pinctrl-names = "default";
  582. + };
  583. +};
  584. +
  585. +&ehci1 {
  586. + status = "okay";
  587. +};
  588. +
  589. +&emac {
  590. + pinctrl-0 = <&rmii_pe_pins>;
  591. + pinctrl-names = "default";
  592. + phy-handle = <&ext_rmii_phy>;
  593. + phy-mode = "rmii";
  594. + phy-supply = <&reg_vcc_3v3>;
  595. + status = "okay";
  596. +};
  597. +
  598. +&mdio {
  599. + ext_rmii_phy: ethernet-phy@1 {
  600. + compatible = "ethernet-phy-ieee802.3-c22";
  601. + reg = <1>;
  602. + reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
  603. + };
  604. +};
  605. +
  606. +&mmc1 {
  607. + bus-width = <4>;
  608. + mmc-pwrseq = <&wifi_pwrseq>;
  609. + non-removable;
  610. + vmmc-supply = <&reg_vcc_3v3>;
  611. + vqmmc-supply = <&reg_vcc_3v3>;
  612. + pinctrl-0 = <&mmc1_pins>;
  613. + pinctrl-names = "default";
  614. + status = "okay";
  615. +
  616. + xr829: wifi@1 {
  617. + reg = <1>;
  618. + };
  619. +};
  620. +
  621. +&ohci1 {
  622. + status = "okay";
  623. +};
  624. +
  625. +&pio {
  626. + clk_pg11_pin: clk-pg11-pin {
  627. + pins = "PG11";
  628. + function = "clk";
  629. + };
  630. +};
  631. +
  632. +&uart1 {
  633. + uart-has-rtscts;
  634. + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
  635. + pinctrl-names = "default";
  636. + status = "okay";
  637. +
  638. + /* XR829 bluetooth is connected here */
  639. +};
  640. +
  641. +&usb_otg {
  642. + status = "disabled";
  643. +};
  644. +
  645. +&usbphy {
  646. + /* PD20 and PD21 are repurposed for the LCD panel */
  647. + /delete-property/ usb0_id_det-gpios;
  648. + /delete-property/ usb0_vbus_det-gpios;
  649. + usb1_vbus-supply = <&reg_vcc>;
  650. +};
  651. --- /dev/null
  652. +++ b/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts
  653. @@ -0,0 +1,74 @@
  654. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  655. +// Copyright (C) 2022 Jisheng Zhang <[email protected]>
  656. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  657. +
  658. +#include <dt-bindings/input/input.h>
  659. +
  660. +#include "sun20i-d1-lichee-rv.dts"
  661. +
  662. +/ {
  663. + model = "Sipeed Lichee RV Dock";
  664. + compatible = "sipeed,lichee-rv-dock", "sipeed,lichee-rv",
  665. + "allwinner,sun20i-d1";
  666. +
  667. + aliases {
  668. + ethernet1 = &rtl8723ds;
  669. + };
  670. +
  671. + wifi_pwrseq: wifi-pwrseq {
  672. + compatible = "mmc-pwrseq-simple";
  673. + reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
  674. + };
  675. +};
  676. +
  677. +&ehci1 {
  678. + status = "okay";
  679. +};
  680. +
  681. +&lradc {
  682. + status = "okay";
  683. +
  684. + button-220 {
  685. + label = "OK";
  686. + linux,code = <KEY_OK>;
  687. + channel = <0>;
  688. + voltage = <220000>;
  689. + };
  690. +};
  691. +
  692. +&mmc1 {
  693. + bus-width = <4>;
  694. + mmc-pwrseq = <&wifi_pwrseq>;
  695. + non-removable;
  696. + vmmc-supply = <&reg_vcc_3v3>;
  697. + vqmmc-supply = <&reg_vcc_3v3>;
  698. + pinctrl-0 = <&mmc1_pins>;
  699. + pinctrl-names = "default";
  700. + status = "okay";
  701. +
  702. + rtl8723ds: wifi@1 {
  703. + reg = <1>;
  704. + };
  705. +};
  706. +
  707. +&ohci1 {
  708. + status = "okay";
  709. +};
  710. +
  711. +&uart1 {
  712. + uart-has-rtscts;
  713. + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
  714. + pinctrl-names = "default";
  715. + status = "okay";
  716. +
  717. + bluetooth {
  718. + compatible = "realtek,rtl8723ds-bt";
  719. + device-wake-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG16 */
  720. + enable-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */
  721. + host-wake-gpios = <&pio 6 17 GPIO_ACTIVE_HIGH>; /* PG17 */
  722. + };
  723. +};
  724. +
  725. +&usbphy {
  726. + usb1_vbus-supply = <&reg_vcc>;
  727. +};
  728. --- /dev/null
  729. +++ b/arch/riscv/dts/sun20i-d1-lichee-rv.dts
  730. @@ -0,0 +1,84 @@
  731. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  732. +// Copyright (C) 2022 Jisheng Zhang <[email protected]>
  733. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  734. +
  735. +/dts-v1/;
  736. +
  737. +#include <dt-bindings/gpio/gpio.h>
  738. +#include <dt-bindings/leds/common.h>
  739. +
  740. +#include "sun20i-d1.dtsi"
  741. +#include "sun20i-d1-common-regulators.dtsi"
  742. +
  743. +/ {
  744. + model = "Sipeed Lichee RV";
  745. + compatible = "sipeed,lichee-rv", "allwinner,sun20i-d1";
  746. +
  747. + aliases {
  748. + mmc0 = &mmc0;
  749. + serial0 = &uart0;
  750. + };
  751. +
  752. + chosen {
  753. + stdout-path = "serial0:115200n8";
  754. + };
  755. +
  756. + leds {
  757. + compatible = "gpio-leds";
  758. +
  759. + led-0 {
  760. + color = <LED_COLOR_ID_GREEN>;
  761. + function = LED_FUNCTION_STATUS;
  762. + gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */
  763. + };
  764. + };
  765. +
  766. + reg_vdd_cpu: vdd-cpu {
  767. + compatible = "regulator-fixed";
  768. + regulator-name = "vdd-cpu";
  769. + regulator-min-microvolt = <900000>;
  770. + regulator-max-microvolt = <900000>;
  771. + vin-supply = <&reg_vcc>;
  772. + };
  773. +};
  774. +
  775. +&cpu0 {
  776. + cpu-supply = <&reg_vdd_cpu>;
  777. +};
  778. +
  779. +&ehci0 {
  780. + status = "okay";
  781. +};
  782. +
  783. +&mmc0 {
  784. + broken-cd;
  785. + bus-width = <4>;
  786. + disable-wp;
  787. + vmmc-supply = <&reg_vcc_3v3>;
  788. + vqmmc-supply = <&reg_vcc_3v3>;
  789. + pinctrl-0 = <&mmc0_pins>;
  790. + pinctrl-names = "default";
  791. + status = "okay";
  792. +};
  793. +
  794. +&ohci0 {
  795. + status = "okay";
  796. +};
  797. +
  798. +&uart0 {
  799. + pinctrl-0 = <&uart0_pb8_pins>;
  800. + pinctrl-names = "default";
  801. + status = "okay";
  802. +};
  803. +
  804. +&usb_otg {
  805. + dr_mode = "otg";
  806. + status = "okay";
  807. +};
  808. +
  809. +&usbphy {
  810. + usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
  811. + usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
  812. + usb0_vbus-supply = <&reg_vcc>;
  813. + status = "okay";
  814. +};
  815. --- /dev/null
  816. +++ b/arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts
  817. @@ -0,0 +1,128 @@
  818. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  819. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  820. +
  821. +/dts-v1/;
  822. +
  823. +#include <dt-bindings/gpio/gpio.h>
  824. +
  825. +#include "sun20i-d1.dtsi"
  826. +#include "sun20i-d1-common-regulators.dtsi"
  827. +
  828. +/ {
  829. + model = "MangoPi MQ Pro";
  830. + compatible = "widora,mangopi-mq-pro", "allwinner,sun20i-d1";
  831. +
  832. + aliases {
  833. + ethernet0 = &rtl8723ds;
  834. + mmc0 = &mmc0;
  835. + serial0 = &uart0;
  836. + };
  837. +
  838. + chosen {
  839. + stdout-path = "serial0:115200n8";
  840. + };
  841. +
  842. + reg_avdd2v8: avdd2v8 {
  843. + compatible = "regulator-fixed";
  844. + regulator-name = "avdd2v8";
  845. + regulator-min-microvolt = <2800000>;
  846. + regulator-max-microvolt = <2800000>;
  847. + vin-supply = <&reg_vcc_3v3>;
  848. + };
  849. +
  850. + reg_dvdd: dvdd {
  851. + compatible = "regulator-fixed";
  852. + regulator-name = "dvdd";
  853. + regulator-min-microvolt = <1200000>;
  854. + regulator-max-microvolt = <1200000>;
  855. + vin-supply = <&reg_vcc_3v3>;
  856. + };
  857. +
  858. + reg_vdd_cpu: vdd-cpu {
  859. + compatible = "regulator-fixed";
  860. + regulator-name = "vdd-cpu";
  861. + regulator-min-microvolt = <1100000>;
  862. + regulator-max-microvolt = <1100000>;
  863. + vin-supply = <&reg_vcc>;
  864. + };
  865. +
  866. + wifi_pwrseq: wifi-pwrseq {
  867. + compatible = "mmc-pwrseq-simple";
  868. + reset-gpios = <&pio 6 17 GPIO_ACTIVE_LOW>; /* PG17 */
  869. + };
  870. +};
  871. +
  872. +&cpu0 {
  873. + cpu-supply = <&reg_vdd_cpu>;
  874. +};
  875. +
  876. +&ehci1 {
  877. + status = "okay";
  878. +};
  879. +
  880. +&mmc0 {
  881. + bus-width = <4>;
  882. + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
  883. + disable-wp;
  884. + vmmc-supply = <&reg_vcc_3v3>;
  885. + vqmmc-supply = <&reg_vcc_3v3>;
  886. + pinctrl-0 = <&mmc0_pins>;
  887. + pinctrl-names = "default";
  888. + status = "okay";
  889. +};
  890. +
  891. +&mmc1 {
  892. + bus-width = <4>;
  893. + mmc-pwrseq = <&wifi_pwrseq>;
  894. + non-removable;
  895. + vmmc-supply = <&reg_vcc_3v3>;
  896. + vqmmc-supply = <&reg_vcc_3v3>;
  897. + pinctrl-0 = <&mmc1_pins>;
  898. + pinctrl-names = "default";
  899. + status = "okay";
  900. +
  901. + rtl8723ds: wifi@1 {
  902. + reg = <1>;
  903. + interrupt-parent = <&pio>;
  904. + interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
  905. + interrupt-names = "host-wake";
  906. + };
  907. +};
  908. +
  909. +&ohci1 {
  910. + status = "okay";
  911. +};
  912. +
  913. +&pio {
  914. + vcc-pe-supply = <&reg_avdd2v8>;
  915. +};
  916. +
  917. +&uart0 {
  918. + pinctrl-0 = <&uart0_pb8_pins>;
  919. + pinctrl-names = "default";
  920. + status = "okay";
  921. +};
  922. +
  923. +&uart1 {
  924. + uart-has-rtscts;
  925. + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
  926. + pinctrl-names = "default";
  927. + status = "okay";
  928. +
  929. + bluetooth {
  930. + compatible = "realtek,rtl8723ds-bt";
  931. + device-wake-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */
  932. + enable-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG15 */
  933. + host-wake-gpios = <&pio 6 14 GPIO_ACTIVE_HIGH>; /* PG14 */
  934. + };
  935. +};
  936. +
  937. +&usb_otg {
  938. + dr_mode = "peripheral";
  939. + status = "okay";
  940. +};
  941. +
  942. +&usbphy {
  943. + usb0_vbus-supply = <&reg_vcc>;
  944. + status = "okay";
  945. +};
  946. --- /dev/null
  947. +++ b/arch/riscv/dts/sun20i-d1-nezha.dts
  948. @@ -0,0 +1,171 @@
  949. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  950. +// Copyright (C) 2021-2022 Samuel Holland <[email protected]>
  951. +
  952. +/dts-v1/;
  953. +
  954. +#include <dt-bindings/gpio/gpio.h>
  955. +#include <dt-bindings/input/input.h>
  956. +
  957. +#include "sun20i-d1.dtsi"
  958. +#include "sun20i-d1-common-regulators.dtsi"
  959. +
  960. +/ {
  961. + model = "Allwinner D1 Nezha";
  962. + compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
  963. +
  964. + aliases {
  965. + ethernet0 = &emac;
  966. + ethernet1 = &xr829;
  967. + mmc0 = &mmc0;
  968. + serial0 = &uart0;
  969. + };
  970. +
  971. + chosen {
  972. + stdout-path = "serial0:115200n8";
  973. + };
  974. +
  975. + reg_usbvbus: usbvbus {
  976. + compatible = "regulator-fixed";
  977. + regulator-name = "usbvbus";
  978. + regulator-min-microvolt = <5000000>;
  979. + regulator-max-microvolt = <5000000>;
  980. + gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
  981. + enable-active-high;
  982. + vin-supply = <&reg_vcc>;
  983. + };
  984. +
  985. + /*
  986. + * This regulator is PWM-controlled, but the PWM controller is not
  987. + * yet supported, so fix the regulator to its default voltage.
  988. + */
  989. + reg_vdd_cpu: vdd-cpu {
  990. + compatible = "regulator-fixed";
  991. + regulator-name = "vdd-cpu";
  992. + regulator-min-microvolt = <1100000>;
  993. + regulator-max-microvolt = <1100000>;
  994. + vin-supply = <&reg_vcc>;
  995. + };
  996. +
  997. + wifi_pwrseq: wifi-pwrseq {
  998. + compatible = "mmc-pwrseq-simple";
  999. + reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
  1000. + };
  1001. +};
  1002. +
  1003. +&cpu0 {
  1004. + cpu-supply = <&reg_vdd_cpu>;
  1005. +};
  1006. +
  1007. +&ehci0 {
  1008. + status = "okay";
  1009. +};
  1010. +
  1011. +&ehci1 {
  1012. + status = "okay";
  1013. +};
  1014. +
  1015. +&emac {
  1016. + pinctrl-0 = <&rgmii_pe_pins>;
  1017. + pinctrl-names = "default";
  1018. + phy-handle = <&ext_rgmii_phy>;
  1019. + phy-mode = "rgmii-id";
  1020. + phy-supply = <&reg_vcc_3v3>;
  1021. + status = "okay";
  1022. +};
  1023. +
  1024. +&i2c2 {
  1025. + pinctrl-0 = <&i2c2_pb0_pins>;
  1026. + pinctrl-names = "default";
  1027. + status = "okay";
  1028. +
  1029. + pcf8574a: gpio@38 {
  1030. + compatible = "nxp,pcf8574a";
  1031. + reg = <0x38>;
  1032. + interrupt-parent = <&pio>;
  1033. + interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */
  1034. + interrupt-controller;
  1035. + gpio-controller;
  1036. + #gpio-cells = <2>;
  1037. + #interrupt-cells = <2>;
  1038. + };
  1039. +};
  1040. +
  1041. +&lradc {
  1042. + status = "okay";
  1043. +
  1044. + button-160 {
  1045. + label = "OK";
  1046. + linux,code = <KEY_OK>;
  1047. + channel = <0>;
  1048. + voltage = <160000>;
  1049. + };
  1050. +};
  1051. +
  1052. +&mdio {
  1053. + ext_rgmii_phy: ethernet-phy@1 {
  1054. + compatible = "ethernet-phy-ieee802.3-c22";
  1055. + reg = <1>;
  1056. + };
  1057. +};
  1058. +
  1059. +&mmc0 {
  1060. + bus-width = <4>;
  1061. + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
  1062. + disable-wp;
  1063. + vmmc-supply = <&reg_vcc_3v3>;
  1064. + vqmmc-supply = <&reg_vcc_3v3>;
  1065. + pinctrl-0 = <&mmc0_pins>;
  1066. + pinctrl-names = "default";
  1067. + status = "okay";
  1068. +};
  1069. +
  1070. +&mmc1 {
  1071. + bus-width = <4>;
  1072. + mmc-pwrseq = <&wifi_pwrseq>;
  1073. + non-removable;
  1074. + vmmc-supply = <&reg_vcc_3v3>;
  1075. + vqmmc-supply = <&reg_vcc_3v3>;
  1076. + pinctrl-0 = <&mmc1_pins>;
  1077. + pinctrl-names = "default";
  1078. + status = "okay";
  1079. +
  1080. + xr829: wifi@1 {
  1081. + reg = <1>;
  1082. + };
  1083. +};
  1084. +
  1085. +&ohci0 {
  1086. + status = "okay";
  1087. +};
  1088. +
  1089. +&ohci1 {
  1090. + status = "okay";
  1091. +};
  1092. +
  1093. +&uart0 {
  1094. + pinctrl-0 = <&uart0_pb8_pins>;
  1095. + pinctrl-names = "default";
  1096. + status = "okay";
  1097. +};
  1098. +
  1099. +&uart1 {
  1100. + uart-has-rtscts;
  1101. + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
  1102. + pinctrl-names = "default";
  1103. + status = "okay";
  1104. +
  1105. + /* XR829 bluetooth is connected here */
  1106. +};
  1107. +
  1108. +&usb_otg {
  1109. + dr_mode = "otg";
  1110. + status = "okay";
  1111. +};
  1112. +
  1113. +&usbphy {
  1114. + usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
  1115. + usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
  1116. + usb0_vbus-supply = <&reg_usbvbus>;
  1117. + usb1_vbus-supply = <&reg_vcc>;
  1118. + status = "okay";
  1119. +};
  1120. --- /dev/null
  1121. +++ b/arch/riscv/dts/sun20i-d1.dtsi
  1122. @@ -0,0 +1,900 @@
  1123. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  1124. +// Copyright (C) 2021-2022 Samuel Holland <[email protected]>
  1125. +
  1126. +#include <dt-bindings/clock/sun6i-rtc.h>
  1127. +#include <dt-bindings/clock/sun8i-de2.h>
  1128. +#include <dt-bindings/clock/sun8i-tcon-top.h>
  1129. +#include <dt-bindings/clock/sun20i-d1-ccu.h>
  1130. +#include <dt-bindings/clock/sun20i-d1-r-ccu.h>
  1131. +#include <dt-bindings/interrupt-controller/irq.h>
  1132. +#include <dt-bindings/reset/sun8i-de2.h>
  1133. +#include <dt-bindings/reset/sun20i-d1-ccu.h>
  1134. +#include <dt-bindings/reset/sun20i-d1-r-ccu.h>
  1135. +#include <dt-bindings/thermal/thermal.h>
  1136. +
  1137. +/ {
  1138. + #address-cells = <1>;
  1139. + #size-cells = <1>;
  1140. +
  1141. + cpus {
  1142. + timebase-frequency = <24000000>;
  1143. + #address-cells = <1>;
  1144. + #size-cells = <0>;
  1145. +
  1146. + cpu0: cpu@0 {
  1147. + compatible = "thead,c906", "riscv";
  1148. + device_type = "cpu";
  1149. + reg = <0>;
  1150. + clocks = <&ccu CLK_RISCV>;
  1151. + clock-frequency = <24000000>;
  1152. + d-cache-block-size = <64>;
  1153. + d-cache-sets = <256>;
  1154. + d-cache-size = <32768>;
  1155. + i-cache-block-size = <64>;
  1156. + i-cache-sets = <128>;
  1157. + i-cache-size = <32768>;
  1158. + mmu-type = "riscv,sv39";
  1159. + riscv,isa = "rv64imafdc";
  1160. + #cooling-cells = <2>;
  1161. +
  1162. + cpu0_intc: interrupt-controller {
  1163. + compatible = "riscv,cpu-intc";
  1164. + interrupt-controller;
  1165. + #address-cells = <0>;
  1166. + #interrupt-cells = <1>;
  1167. + };
  1168. + };
  1169. + };
  1170. +
  1171. + de: display-engine {
  1172. + compatible = "allwinner,sun20i-d1-display-engine";
  1173. + allwinner,pipelines = <&mixer0>, <&mixer1>;
  1174. + status = "disabled";
  1175. + };
  1176. +
  1177. + osc24M: osc24M-clk {
  1178. + compatible = "fixed-clock";
  1179. + clock-frequency = <24000000>;
  1180. + clock-output-names = "osc24M";
  1181. + #clock-cells = <0>;
  1182. + };
  1183. +
  1184. + soc {
  1185. + compatible = "simple-bus";
  1186. + ranges;
  1187. + interrupt-parent = <&plic>;
  1188. + dma-noncoherent;
  1189. + #address-cells = <1>;
  1190. + #size-cells = <1>;
  1191. +
  1192. + dsp_wdt: watchdog@1700400 {
  1193. + compatible = "allwinner,sun20i-d1-wdt";
  1194. + reg = <0x1700400 0x20>;
  1195. + interrupts = <138 IRQ_TYPE_LEVEL_HIGH>;
  1196. + clocks = <&osc24M>, <&rtc CLK_OSC32K>;
  1197. + clock-names = "hosc", "losc";
  1198. + status = "reserved";
  1199. + };
  1200. +
  1201. + pio: pinctrl@2000000 {
  1202. + compatible = "allwinner,sun20i-d1-pinctrl";
  1203. + reg = <0x2000000 0x800>;
  1204. + interrupts = <85 IRQ_TYPE_LEVEL_HIGH>,
  1205. + <87 IRQ_TYPE_LEVEL_HIGH>,
  1206. + <89 IRQ_TYPE_LEVEL_HIGH>,
  1207. + <91 IRQ_TYPE_LEVEL_HIGH>,
  1208. + <93 IRQ_TYPE_LEVEL_HIGH>,
  1209. + <95 IRQ_TYPE_LEVEL_HIGH>;
  1210. + clocks = <&ccu CLK_APB0>,
  1211. + <&osc24M>,
  1212. + <&rtc CLK_OSC32K>;
  1213. + clock-names = "apb", "hosc", "losc";
  1214. + gpio-controller;
  1215. + interrupt-controller;
  1216. + #gpio-cells = <3>;
  1217. + #interrupt-cells = <3>;
  1218. +
  1219. + /omit-if-no-ref/
  1220. + i2c0_pb10_pins: i2c0-pb10-pins {
  1221. + pins = "PB10", "PB11";
  1222. + function = "i2c0";
  1223. + };
  1224. +
  1225. + /omit-if-no-ref/
  1226. + i2c2_pb0_pins: i2c2-pb0-pins {
  1227. + pins = "PB0", "PB1";
  1228. + function = "i2c2";
  1229. + };
  1230. +
  1231. + /omit-if-no-ref/
  1232. + lcd_rgb666_pins: lcd-rgb666-pins {
  1233. + pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5",
  1234. + "PD6", "PD7", "PD8", "PD9", "PD10", "PD11",
  1235. + "PD12", "PD13", "PD14", "PD15", "PD16", "PD17",
  1236. + "PD18", "PD19", "PD20", "PD21";
  1237. + function = "lcd0";
  1238. + };
  1239. +
  1240. + /omit-if-no-ref/
  1241. + mmc0_pins: mmc0-pins {
  1242. + pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
  1243. + function = "mmc0";
  1244. + };
  1245. +
  1246. + /omit-if-no-ref/
  1247. + mmc1_pins: mmc1-pins {
  1248. + pins = "PG0", "PG1", "PG2", "PG3", "PG4", "PG5";
  1249. + function = "mmc1";
  1250. + };
  1251. +
  1252. + /omit-if-no-ref/
  1253. + mmc2_pins: mmc2-pins {
  1254. + pins = "PC2", "PC3", "PC4", "PC5", "PC6", "PC7";
  1255. + function = "mmc2";
  1256. + };
  1257. +
  1258. + /omit-if-no-ref/
  1259. + rgmii_pe_pins: rgmii-pe-pins {
  1260. + pins = "PE0", "PE1", "PE2", "PE3", "PE4",
  1261. + "PE5", "PE6", "PE7", "PE8", "PE9",
  1262. + "PE11", "PE12", "PE13", "PE14", "PE15";
  1263. + function = "emac";
  1264. + };
  1265. +
  1266. + /omit-if-no-ref/
  1267. + rmii_pe_pins: rmii-pe-pins {
  1268. + pins = "PE0", "PE1", "PE2", "PE3", "PE4",
  1269. + "PE5", "PE6", "PE7", "PE8", "PE9";
  1270. + function = "emac";
  1271. + };
  1272. +
  1273. + /omit-if-no-ref/
  1274. + uart0_pb8_pins: uart0-pb8-pins {
  1275. + pins = "PB8", "PB9";
  1276. + function = "uart0";
  1277. + };
  1278. +
  1279. + /omit-if-no-ref/
  1280. + uart1_pg6_pins: uart1-pg6-pins {
  1281. + pins = "PG6", "PG7";
  1282. + function = "uart1";
  1283. + };
  1284. +
  1285. + /omit-if-no-ref/
  1286. + uart1_pg8_rts_cts_pins: uart1-pg8-rts-cts-pins {
  1287. + pins = "PG8", "PG9";
  1288. + function = "uart1";
  1289. + };
  1290. + };
  1291. +
  1292. + ccu: clock-controller@2001000 {
  1293. + compatible = "allwinner,sun20i-d1-ccu";
  1294. + reg = <0x2001000 0x1000>;
  1295. + clocks = <&osc24M>,
  1296. + <&rtc CLK_OSC32K>,
  1297. + <&rtc CLK_IOSC>;
  1298. + clock-names = "hosc", "losc", "iosc";
  1299. + #clock-cells = <1>;
  1300. + #reset-cells = <1>;
  1301. + };
  1302. +
  1303. + lradc: keys@2009800 {
  1304. + compatible = "allwinner,sun20i-d1-lradc",
  1305. + "allwinner,sun50i-r329-lradc";
  1306. + reg = <0x2009800 0x400>;
  1307. + interrupts = <77 IRQ_TYPE_LEVEL_HIGH>;
  1308. + clocks = <&ccu CLK_BUS_LRADC>;
  1309. + resets = <&ccu RST_BUS_LRADC>;
  1310. + status = "disabled";
  1311. + };
  1312. +
  1313. + codec: audio-codec@2030000 {
  1314. + compatible = "simple-mfd", "syscon";
  1315. + reg = <0x2030000 0x1000>;
  1316. + #address-cells = <1>;
  1317. + #size-cells = <1>;
  1318. +
  1319. + regulators@2030348 {
  1320. + compatible = "allwinner,sun20i-d1-analog-ldos";
  1321. + reg = <0x2030348 0x4>;
  1322. + nvmem-cells = <&bg_trim>;
  1323. + nvmem-cell-names = "bg_trim";
  1324. +
  1325. + reg_aldo: aldo {
  1326. + };
  1327. +
  1328. + reg_hpldo: hpldo {
  1329. + };
  1330. + };
  1331. + };
  1332. +
  1333. + i2s0: i2s@2032000 {
  1334. + compatible = "allwinner,sun20i-d1-i2s",
  1335. + "allwinner,sun50i-r329-i2s";
  1336. + reg = <0x2032000 0x1000>;
  1337. + interrupts = <42 IRQ_TYPE_LEVEL_HIGH>;
  1338. + clocks = <&ccu CLK_BUS_I2S0>,
  1339. + <&ccu CLK_I2S0>;
  1340. + clock-names = "apb", "mod";
  1341. + resets = <&ccu RST_BUS_I2S0>;
  1342. + dmas = <&dma 3>, <&dma 3>;
  1343. + dma-names = "rx", "tx";
  1344. + status = "disabled";
  1345. + #sound-dai-cells = <0>;
  1346. + };
  1347. +
  1348. + i2s1: i2s@2033000 {
  1349. + compatible = "allwinner,sun20i-d1-i2s",
  1350. + "allwinner,sun50i-r329-i2s";
  1351. + reg = <0x2033000 0x1000>;
  1352. + interrupts = <43 IRQ_TYPE_LEVEL_HIGH>;
  1353. + clocks = <&ccu CLK_BUS_I2S1>,
  1354. + <&ccu CLK_I2S1>;
  1355. + clock-names = "apb", "mod";
  1356. + resets = <&ccu RST_BUS_I2S1>;
  1357. + dmas = <&dma 4>, <&dma 4>;
  1358. + dma-names = "rx", "tx";
  1359. + status = "disabled";
  1360. + #sound-dai-cells = <0>;
  1361. + };
  1362. +
  1363. + i2s2: i2s@2034000 {
  1364. + compatible = "allwinner,sun20i-d1-i2s",
  1365. + "allwinner,sun50i-r329-i2s";
  1366. + reg = <0x2034000 0x1000>;
  1367. + interrupts = <44 IRQ_TYPE_LEVEL_HIGH>;
  1368. + clocks = <&ccu CLK_BUS_I2S2>,
  1369. + <&ccu CLK_I2S2>;
  1370. + clock-names = "apb", "mod";
  1371. + resets = <&ccu RST_BUS_I2S2>;
  1372. + dmas = <&dma 5>, <&dma 5>;
  1373. + dma-names = "rx", "tx";
  1374. + status = "disabled";
  1375. + #sound-dai-cells = <0>;
  1376. + };
  1377. +
  1378. + timer: timer@2050000 {
  1379. + compatible = "allwinner,sun20i-d1-timer",
  1380. + "allwinner,sun8i-a23-timer";
  1381. + reg = <0x2050000 0xa0>;
  1382. + interrupts = <75 IRQ_TYPE_LEVEL_HIGH>,
  1383. + <76 IRQ_TYPE_LEVEL_HIGH>;
  1384. + clocks = <&osc24M>;
  1385. + };
  1386. +
  1387. + wdt: watchdog@20500a0 {
  1388. + compatible = "allwinner,sun20i-d1-wdt-reset",
  1389. + "allwinner,sun20i-d1-wdt";
  1390. + reg = <0x20500a0 0x20>;
  1391. + interrupts = <79 IRQ_TYPE_LEVEL_HIGH>;
  1392. + clocks = <&osc24M>, <&rtc CLK_OSC32K>;
  1393. + clock-names = "hosc", "losc";
  1394. + status = "reserved";
  1395. + };
  1396. +
  1397. + uart0: serial@2500000 {
  1398. + compatible = "snps,dw-apb-uart";
  1399. + reg = <0x2500000 0x400>;
  1400. + reg-io-width = <4>;
  1401. + reg-shift = <2>;
  1402. + interrupts = <18 IRQ_TYPE_LEVEL_HIGH>;
  1403. + clocks = <&ccu CLK_BUS_UART0>;
  1404. + resets = <&ccu RST_BUS_UART0>;
  1405. + dmas = <&dma 14>, <&dma 14>;
  1406. + dma-names = "rx", "tx";
  1407. + status = "disabled";
  1408. + };
  1409. +
  1410. + uart1: serial@2500400 {
  1411. + compatible = "snps,dw-apb-uart";
  1412. + reg = <0x2500400 0x400>;
  1413. + reg-io-width = <4>;
  1414. + reg-shift = <2>;
  1415. + interrupts = <19 IRQ_TYPE_LEVEL_HIGH>;
  1416. + clocks = <&ccu CLK_BUS_UART1>;
  1417. + resets = <&ccu RST_BUS_UART1>;
  1418. + dmas = <&dma 15>, <&dma 15>;
  1419. + dma-names = "rx", "tx";
  1420. + status = "disabled";
  1421. + };
  1422. +
  1423. + uart2: serial@2500800 {
  1424. + compatible = "snps,dw-apb-uart";
  1425. + reg = <0x2500800 0x400>;
  1426. + reg-io-width = <4>;
  1427. + reg-shift = <2>;
  1428. + interrupts = <20 IRQ_TYPE_LEVEL_HIGH>;
  1429. + clocks = <&ccu CLK_BUS_UART2>;
  1430. + resets = <&ccu RST_BUS_UART2>;
  1431. + dmas = <&dma 16>, <&dma 16>;
  1432. + dma-names = "rx", "tx";
  1433. + status = "disabled";
  1434. + };
  1435. +
  1436. + uart3: serial@2500c00 {
  1437. + compatible = "snps,dw-apb-uart";
  1438. + reg = <0x2500c00 0x400>;
  1439. + reg-io-width = <4>;
  1440. + reg-shift = <2>;
  1441. + interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
  1442. + clocks = <&ccu CLK_BUS_UART3>;
  1443. + resets = <&ccu RST_BUS_UART3>;
  1444. + dmas = <&dma 17>, <&dma 17>;
  1445. + dma-names = "rx", "tx";
  1446. + status = "disabled";
  1447. + };
  1448. +
  1449. + uart4: serial@2501000 {
  1450. + compatible = "snps,dw-apb-uart";
  1451. + reg = <0x2501000 0x400>;
  1452. + reg-io-width = <4>;
  1453. + reg-shift = <2>;
  1454. + interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
  1455. + clocks = <&ccu CLK_BUS_UART4>;
  1456. + resets = <&ccu RST_BUS_UART4>;
  1457. + dmas = <&dma 18>, <&dma 18>;
  1458. + dma-names = "rx", "tx";
  1459. + status = "disabled";
  1460. + };
  1461. +
  1462. + uart5: serial@2501400 {
  1463. + compatible = "snps,dw-apb-uart";
  1464. + reg = <0x2501400 0x400>;
  1465. + reg-io-width = <4>;
  1466. + reg-shift = <2>;
  1467. + interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
  1468. + clocks = <&ccu CLK_BUS_UART5>;
  1469. + resets = <&ccu RST_BUS_UART5>;
  1470. + dmas = <&dma 19>, <&dma 19>;
  1471. + dma-names = "rx", "tx";
  1472. + status = "disabled";
  1473. + };
  1474. +
  1475. + i2c0: i2c@2502000 {
  1476. + compatible = "allwinner,sun20i-d1-i2c",
  1477. + "allwinner,sun8i-v536-i2c",
  1478. + "allwinner,sun6i-a31-i2c";
  1479. + reg = <0x2502000 0x400>;
  1480. + interrupts = <25 IRQ_TYPE_LEVEL_HIGH>;
  1481. + clocks = <&ccu CLK_BUS_I2C0>;
  1482. + resets = <&ccu RST_BUS_I2C0>;
  1483. + dmas = <&dma 43>, <&dma 43>;
  1484. + dma-names = "rx", "tx";
  1485. + status = "disabled";
  1486. + #address-cells = <1>;
  1487. + #size-cells = <0>;
  1488. + };
  1489. +
  1490. + i2c1: i2c@2502400 {
  1491. + compatible = "allwinner,sun20i-d1-i2c",
  1492. + "allwinner,sun8i-v536-i2c",
  1493. + "allwinner,sun6i-a31-i2c";
  1494. + reg = <0x2502400 0x400>;
  1495. + interrupts = <26 IRQ_TYPE_LEVEL_HIGH>;
  1496. + clocks = <&ccu CLK_BUS_I2C1>;
  1497. + resets = <&ccu RST_BUS_I2C1>;
  1498. + dmas = <&dma 44>, <&dma 44>;
  1499. + dma-names = "rx", "tx";
  1500. + status = "disabled";
  1501. + #address-cells = <1>;
  1502. + #size-cells = <0>;
  1503. + };
  1504. +
  1505. + i2c2: i2c@2502800 {
  1506. + compatible = "allwinner,sun20i-d1-i2c",
  1507. + "allwinner,sun8i-v536-i2c",
  1508. + "allwinner,sun6i-a31-i2c";
  1509. + reg = <0x2502800 0x400>;
  1510. + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>;
  1511. + clocks = <&ccu CLK_BUS_I2C2>;
  1512. + resets = <&ccu RST_BUS_I2C2>;
  1513. + dmas = <&dma 45>, <&dma 45>;
  1514. + dma-names = "rx", "tx";
  1515. + status = "disabled";
  1516. + #address-cells = <1>;
  1517. + #size-cells = <0>;
  1518. + };
  1519. +
  1520. + i2c3: i2c@2502c00 {
  1521. + compatible = "allwinner,sun20i-d1-i2c",
  1522. + "allwinner,sun8i-v536-i2c",
  1523. + "allwinner,sun6i-a31-i2c";
  1524. + reg = <0x2502c00 0x400>;
  1525. + interrupts = <28 IRQ_TYPE_LEVEL_HIGH>;
  1526. + clocks = <&ccu CLK_BUS_I2C3>;
  1527. + resets = <&ccu RST_BUS_I2C3>;
  1528. + dmas = <&dma 46>, <&dma 46>;
  1529. + dma-names = "rx", "tx";
  1530. + status = "disabled";
  1531. + #address-cells = <1>;
  1532. + #size-cells = <0>;
  1533. + };
  1534. +
  1535. + syscon: syscon@3000000 {
  1536. + compatible = "allwinner,sun20i-d1-system-control";
  1537. + reg = <0x3000000 0x1000>;
  1538. + ranges;
  1539. + #address-cells = <1>;
  1540. + #size-cells = <1>;
  1541. +
  1542. + regulators@3000150 {
  1543. + compatible = "allwinner,sun20i-d1-system-ldos";
  1544. + reg = <0x3000150 0x4>;
  1545. +
  1546. + reg_ldoa: ldoa {
  1547. + };
  1548. +
  1549. + reg_ldob: ldob {
  1550. + };
  1551. + };
  1552. + };
  1553. +
  1554. + dma: dma-controller@3002000 {
  1555. + compatible = "allwinner,sun20i-d1-dma";
  1556. + reg = <0x3002000 0x1000>;
  1557. + interrupts = <66 IRQ_TYPE_LEVEL_HIGH>;
  1558. + clocks = <&ccu CLK_BUS_DMA>, <&ccu CLK_MBUS_DMA>;
  1559. + clock-names = "bus", "mbus";
  1560. + resets = <&ccu RST_BUS_DMA>;
  1561. + dma-channels = <16>;
  1562. + dma-requests = <48>;
  1563. + #dma-cells = <1>;
  1564. + };
  1565. +
  1566. + sid: efuse@3006000 {
  1567. + compatible = "allwinner,sun20i-d1-sid";
  1568. + reg = <0x3006000 0x1000>;
  1569. + #address-cells = <1>;
  1570. + #size-cells = <1>;
  1571. +
  1572. + ths_calib: ths-calib@14 {
  1573. + reg = <0x14 0x4>;
  1574. + };
  1575. +
  1576. + bg_trim: bg-trim@28 {
  1577. + reg = <0x28 0x4>;
  1578. + bits = <16 8>;
  1579. + };
  1580. + };
  1581. +
  1582. + mbus: dram-controller@3102000 {
  1583. + compatible = "allwinner,sun20i-d1-mbus";
  1584. + reg = <0x3102000 0x1000>,
  1585. + <0x3103000 0x1000>;
  1586. + reg-names = "mbus", "dram";
  1587. + interrupts = <59 IRQ_TYPE_LEVEL_HIGH>;
  1588. + clocks = <&ccu CLK_MBUS>,
  1589. + <&ccu CLK_DRAM>,
  1590. + <&ccu CLK_BUS_DRAM>;
  1591. + clock-names = "mbus", "dram", "bus";
  1592. + dma-ranges = <0 0x40000000 0x80000000>;
  1593. + #address-cells = <1>;
  1594. + #size-cells = <1>;
  1595. + #interconnect-cells = <1>;
  1596. + };
  1597. +
  1598. + mmc0: mmc@4020000 {
  1599. + compatible = "allwinner,sun20i-d1-mmc";
  1600. + reg = <0x4020000 0x1000>;
  1601. + interrupts = <56 IRQ_TYPE_LEVEL_HIGH>;
  1602. + clocks = <&ccu CLK_BUS_MMC0>, <&ccu CLK_MMC0>;
  1603. + clock-names = "ahb", "mmc";
  1604. + resets = <&ccu RST_BUS_MMC0>;
  1605. + reset-names = "ahb";
  1606. + cap-sd-highspeed;
  1607. + max-frequency = <150000000>;
  1608. + no-mmc;
  1609. + status = "disabled";
  1610. + #address-cells = <1>;
  1611. + #size-cells = <0>;
  1612. + };
  1613. +
  1614. + mmc1: mmc@4021000 {
  1615. + compatible = "allwinner,sun20i-d1-mmc";
  1616. + reg = <0x4021000 0x1000>;
  1617. + interrupts = <57 IRQ_TYPE_LEVEL_HIGH>;
  1618. + clocks = <&ccu CLK_BUS_MMC1>, <&ccu CLK_MMC1>;
  1619. + clock-names = "ahb", "mmc";
  1620. + resets = <&ccu RST_BUS_MMC1>;
  1621. + reset-names = "ahb";
  1622. + cap-sd-highspeed;
  1623. + max-frequency = <150000000>;
  1624. + no-mmc;
  1625. + status = "disabled";
  1626. + #address-cells = <1>;
  1627. + #size-cells = <0>;
  1628. + };
  1629. +
  1630. + mmc2: mmc@4022000 {
  1631. + compatible = "allwinner,sun20i-d1-emmc",
  1632. + "allwinner,sun50i-a100-emmc";
  1633. + reg = <0x4022000 0x1000>;
  1634. + interrupts = <58 IRQ_TYPE_LEVEL_HIGH>;
  1635. + clocks = <&ccu CLK_BUS_MMC2>, <&ccu CLK_MMC2>;
  1636. + clock-names = "ahb", "mmc";
  1637. + resets = <&ccu RST_BUS_MMC2>;
  1638. + reset-names = "ahb";
  1639. + cap-mmc-highspeed;
  1640. + max-frequency = <150000000>;
  1641. + mmc-ddr-1_8v;
  1642. + mmc-ddr-3_3v;
  1643. + no-sd;
  1644. + no-sdio;
  1645. + status = "disabled";
  1646. + #address-cells = <1>;
  1647. + #size-cells = <0>;
  1648. + };
  1649. +
  1650. + usb_otg: usb@4100000 {
  1651. + compatible = "allwinner,sun20i-d1-musb",
  1652. + "allwinner,sun8i-a33-musb";
  1653. + reg = <0x4100000 0x400>;
  1654. + interrupts = <45 IRQ_TYPE_LEVEL_HIGH>;
  1655. + interrupt-names = "mc";
  1656. + clocks = <&ccu CLK_BUS_OTG>;
  1657. + resets = <&ccu RST_BUS_OTG>;
  1658. + extcon = <&usbphy 0>;
  1659. + phys = <&usbphy 0>;
  1660. + phy-names = "usb";
  1661. + status = "disabled";
  1662. + };
  1663. +
  1664. + usbphy: phy@4100400 {
  1665. + compatible = "allwinner,sun20i-d1-usb-phy";
  1666. + reg = <0x4100400 0x100>,
  1667. + <0x4101800 0x100>,
  1668. + <0x4200800 0x100>;
  1669. + reg-names = "phy_ctrl",
  1670. + "pmu0",
  1671. + "pmu1";
  1672. + clocks = <&osc24M>,
  1673. + <&osc24M>;
  1674. + clock-names = "usb0_phy",
  1675. + "usb1_phy";
  1676. + resets = <&ccu RST_USB_PHY0>,
  1677. + <&ccu RST_USB_PHY1>;
  1678. + reset-names = "usb0_reset",
  1679. + "usb1_reset";
  1680. + status = "disabled";
  1681. + #phy-cells = <1>;
  1682. + };
  1683. +
  1684. + ehci0: usb@4101000 {
  1685. + compatible = "allwinner,sun20i-d1-ehci",
  1686. + "generic-ehci";
  1687. + reg = <0x4101000 0x100>;
  1688. + interrupts = <46 IRQ_TYPE_LEVEL_HIGH>;
  1689. + clocks = <&ccu CLK_BUS_OHCI0>,
  1690. + <&ccu CLK_BUS_EHCI0>,
  1691. + <&ccu CLK_USB_OHCI0>;
  1692. + resets = <&ccu RST_BUS_OHCI0>,
  1693. + <&ccu RST_BUS_EHCI0>;
  1694. + phys = <&usbphy 0>;
  1695. + phy-names = "usb";
  1696. + status = "disabled";
  1697. + };
  1698. +
  1699. + ohci0: usb@4101400 {
  1700. + compatible = "allwinner,sun20i-d1-ohci",
  1701. + "generic-ohci";
  1702. + reg = <0x4101400 0x100>;
  1703. + interrupts = <47 IRQ_TYPE_LEVEL_HIGH>;
  1704. + clocks = <&ccu CLK_BUS_OHCI0>,
  1705. + <&ccu CLK_USB_OHCI0>;
  1706. + resets = <&ccu RST_BUS_OHCI0>;
  1707. + phys = <&usbphy 0>;
  1708. + phy-names = "usb";
  1709. + status = "disabled";
  1710. + };
  1711. +
  1712. + ehci1: usb@4200000 {
  1713. + compatible = "allwinner,sun20i-d1-ehci",
  1714. + "generic-ehci";
  1715. + reg = <0x4200000 0x100>;
  1716. + interrupts = <49 IRQ_TYPE_LEVEL_HIGH>;
  1717. + clocks = <&ccu CLK_BUS_OHCI1>,
  1718. + <&ccu CLK_BUS_EHCI1>,
  1719. + <&ccu CLK_USB_OHCI1>;
  1720. + resets = <&ccu RST_BUS_OHCI1>,
  1721. + <&ccu RST_BUS_EHCI1>;
  1722. + phys = <&usbphy 1>;
  1723. + phy-names = "usb";
  1724. + status = "disabled";
  1725. + };
  1726. +
  1727. + ohci1: usb@4200400 {
  1728. + compatible = "allwinner,sun20i-d1-ohci",
  1729. + "generic-ohci";
  1730. + reg = <0x4200400 0x100>;
  1731. + interrupts = <50 IRQ_TYPE_LEVEL_HIGH>;
  1732. + clocks = <&ccu CLK_BUS_OHCI1>,
  1733. + <&ccu CLK_USB_OHCI1>;
  1734. + resets = <&ccu RST_BUS_OHCI1>;
  1735. + phys = <&usbphy 1>;
  1736. + phy-names = "usb";
  1737. + status = "disabled";
  1738. + };
  1739. +
  1740. + emac: ethernet@4500000 {
  1741. + compatible = "allwinner,sun20i-d1-emac",
  1742. + "allwinner,sun50i-a64-emac";
  1743. + reg = <0x4500000 0x10000>;
  1744. + interrupts = <62 IRQ_TYPE_LEVEL_HIGH>;
  1745. + interrupt-names = "macirq";
  1746. + clocks = <&ccu CLK_BUS_EMAC>;
  1747. + clock-names = "stmmaceth";
  1748. + resets = <&ccu RST_BUS_EMAC>;
  1749. + reset-names = "stmmaceth";
  1750. + syscon = <&syscon>;
  1751. + status = "disabled";
  1752. +
  1753. + mdio: mdio {
  1754. + compatible = "snps,dwmac-mdio";
  1755. + #address-cells = <1>;
  1756. + #size-cells = <0>;
  1757. + };
  1758. + };
  1759. +
  1760. + display_clocks: clock-controller@5000000 {
  1761. + compatible = "allwinner,sun20i-d1-de2-clk",
  1762. + "allwinner,sun50i-h5-de2-clk";
  1763. + reg = <0x5000000 0x10000>;
  1764. + clocks = <&ccu CLK_BUS_DE>, <&ccu CLK_DE>;
  1765. + clock-names = "bus", "mod";
  1766. + resets = <&ccu RST_BUS_DE>;
  1767. + #clock-cells = <1>;
  1768. + #reset-cells = <1>;
  1769. + };
  1770. +
  1771. + mixer0: mixer@5100000 {
  1772. + compatible = "allwinner,sun20i-d1-de2-mixer-0";
  1773. + reg = <0x5100000 0x100000>;
  1774. + clocks = <&display_clocks CLK_BUS_MIXER0>,
  1775. + <&display_clocks CLK_MIXER0>;
  1776. + clock-names = "bus", "mod";
  1777. + resets = <&display_clocks RST_MIXER0>;
  1778. +
  1779. + ports {
  1780. + #address-cells = <1>;
  1781. + #size-cells = <0>;
  1782. +
  1783. + mixer0_out: port@1 {
  1784. + reg = <1>;
  1785. +
  1786. + mixer0_out_tcon_top_mixer0: endpoint {
  1787. + remote-endpoint = <&tcon_top_mixer0_in_mixer0>;
  1788. + };
  1789. + };
  1790. + };
  1791. + };
  1792. +
  1793. + mixer1: mixer@5200000 {
  1794. + compatible = "allwinner,sun20i-d1-de2-mixer-1";
  1795. + reg = <0x5200000 0x100000>;
  1796. + clocks = <&display_clocks CLK_BUS_MIXER1>,
  1797. + <&display_clocks CLK_MIXER1>;
  1798. + clock-names = "bus", "mod";
  1799. + resets = <&display_clocks RST_MIXER1>;
  1800. +
  1801. + ports {
  1802. + #address-cells = <1>;
  1803. + #size-cells = <0>;
  1804. +
  1805. + mixer1_out: port@1 {
  1806. + reg = <1>;
  1807. +
  1808. + mixer1_out_tcon_top_mixer1: endpoint {
  1809. + remote-endpoint = <&tcon_top_mixer1_in_mixer1>;
  1810. + };
  1811. + };
  1812. + };
  1813. + };
  1814. +
  1815. + tcon_top: tcon-top@5460000 {
  1816. + compatible = "allwinner,sun20i-d1-tcon-top";
  1817. + reg = <0x5460000 0x1000>;
  1818. + clocks = <&ccu CLK_BUS_DPSS_TOP>,
  1819. + <&ccu CLK_TCON_TV>,
  1820. + <&ccu CLK_TVE>,
  1821. + <&ccu CLK_TCON_LCD0>;
  1822. + clock-names = "bus", "tcon-tv0", "tve0", "dsi";
  1823. + clock-output-names = "tcon-top-tv0", "tcon-top-dsi";
  1824. + resets = <&ccu RST_BUS_DPSS_TOP>;
  1825. + #clock-cells = <1>;
  1826. +
  1827. + ports {
  1828. + #address-cells = <1>;
  1829. + #size-cells = <0>;
  1830. +
  1831. + tcon_top_mixer0_in: port@0 {
  1832. + reg = <0>;
  1833. + #address-cells = <1>;
  1834. + #size-cells = <0>;
  1835. +
  1836. + tcon_top_mixer0_in_mixer0: endpoint@0 {
  1837. + reg = <0>;
  1838. + remote-endpoint = <&mixer0_out_tcon_top_mixer0>;
  1839. + };
  1840. + };
  1841. +
  1842. + tcon_top_mixer0_out: port@1 {
  1843. + reg = <1>;
  1844. + #address-cells = <1>;
  1845. + #size-cells = <0>;
  1846. +
  1847. + tcon_top_mixer0_out_tcon_lcd0: endpoint@0 {
  1848. + reg = <0>;
  1849. + remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer0>;
  1850. + };
  1851. +
  1852. + tcon_top_mixer0_out_tcon_tv0: endpoint@2 {
  1853. + reg = <2>;
  1854. + remote-endpoint = <&tcon_tv0_in_tcon_top_mixer0>;
  1855. + };
  1856. + };
  1857. +
  1858. + tcon_top_mixer1_in: port@2 {
  1859. + reg = <2>;
  1860. + #address-cells = <1>;
  1861. + #size-cells = <0>;
  1862. +
  1863. + tcon_top_mixer1_in_mixer1: endpoint@1 {
  1864. + reg = <1>;
  1865. + remote-endpoint = <&mixer1_out_tcon_top_mixer1>;
  1866. + };
  1867. + };
  1868. +
  1869. + tcon_top_mixer1_out: port@3 {
  1870. + reg = <3>;
  1871. + #address-cells = <1>;
  1872. + #size-cells = <0>;
  1873. +
  1874. + tcon_top_mixer1_out_tcon_lcd0: endpoint@0 {
  1875. + reg = <0>;
  1876. + remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer1>;
  1877. + };
  1878. +
  1879. + tcon_top_mixer1_out_tcon_tv0: endpoint@2 {
  1880. + reg = <2>;
  1881. + remote-endpoint = <&tcon_tv0_in_tcon_top_mixer1>;
  1882. + };
  1883. + };
  1884. +
  1885. + tcon_top_hdmi_in: port@4 {
  1886. + reg = <4>;
  1887. +
  1888. + tcon_top_hdmi_in_tcon_tv0: endpoint {
  1889. + remote-endpoint = <&tcon_tv0_out_tcon_top_hdmi>;
  1890. + };
  1891. + };
  1892. +
  1893. + tcon_top_hdmi_out: port@5 {
  1894. + reg = <5>;
  1895. + };
  1896. + };
  1897. + };
  1898. +
  1899. + tcon_lcd0: lcd-controller@5461000 {
  1900. + compatible = "allwinner,sun20i-d1-tcon-lcd";
  1901. + reg = <0x5461000 0x1000>;
  1902. + interrupts = <106 IRQ_TYPE_LEVEL_HIGH>;
  1903. + clocks = <&ccu CLK_BUS_TCON_LCD0>,
  1904. + <&ccu CLK_TCON_LCD0>;
  1905. + clock-names = "ahb", "tcon-ch0";
  1906. + clock-output-names = "tcon-pixel-clock";
  1907. + resets = <&ccu RST_BUS_TCON_LCD0>,
  1908. + <&ccu RST_BUS_LVDS0>;
  1909. + reset-names = "lcd", "lvds";
  1910. + #clock-cells = <0>;
  1911. +
  1912. + ports {
  1913. + #address-cells = <1>;
  1914. + #size-cells = <0>;
  1915. +
  1916. + tcon_lcd0_in: port@0 {
  1917. + reg = <0>;
  1918. + #address-cells = <1>;
  1919. + #size-cells = <0>;
  1920. +
  1921. + tcon_lcd0_in_tcon_top_mixer0: endpoint@0 {
  1922. + reg = <0>;
  1923. + remote-endpoint = <&tcon_top_mixer0_out_tcon_lcd0>;
  1924. + };
  1925. +
  1926. + tcon_lcd0_in_tcon_top_mixer1: endpoint@1 {
  1927. + reg = <1>;
  1928. + remote-endpoint = <&tcon_top_mixer1_out_tcon_lcd0>;
  1929. + };
  1930. + };
  1931. +
  1932. + tcon_lcd0_out: port@1 {
  1933. + reg = <1>;
  1934. + };
  1935. + };
  1936. + };
  1937. +
  1938. + tcon_tv0: lcd-controller@5470000 {
  1939. + compatible = "allwinner,sun20i-d1-tcon-tv";
  1940. + reg = <0x5470000 0x1000>;
  1941. + interrupts = <107 IRQ_TYPE_LEVEL_HIGH>;
  1942. + clocks = <&ccu CLK_BUS_TCON_TV>,
  1943. + <&tcon_top CLK_TCON_TOP_TV0>;
  1944. + clock-names = "ahb", "tcon-ch1";
  1945. + resets = <&ccu RST_BUS_TCON_TV>;
  1946. + reset-names = "lcd";
  1947. +
  1948. + ports {
  1949. + #address-cells = <1>;
  1950. + #size-cells = <0>;
  1951. +
  1952. + tcon_tv0_in: port@0 {
  1953. + reg = <0>;
  1954. + #address-cells = <1>;
  1955. + #size-cells = <0>;
  1956. +
  1957. + tcon_tv0_in_tcon_top_mixer0: endpoint@0 {
  1958. + reg = <0>;
  1959. + remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>;
  1960. + };
  1961. +
  1962. + tcon_tv0_in_tcon_top_mixer1: endpoint@1 {
  1963. + reg = <1>;
  1964. + remote-endpoint = <&tcon_top_mixer1_out_tcon_tv0>;
  1965. + };
  1966. + };
  1967. +
  1968. + tcon_tv0_out: port@1 {
  1969. + reg = <1>;
  1970. +
  1971. + tcon_tv0_out_tcon_top_hdmi: endpoint {
  1972. + remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>;
  1973. + };
  1974. + };
  1975. + };
  1976. + };
  1977. +
  1978. + riscv_wdt: watchdog@6011000 {
  1979. + compatible = "allwinner,sun20i-d1-wdt";
  1980. + reg = <0x6011000 0x20>;
  1981. + interrupts = <147 IRQ_TYPE_LEVEL_HIGH>;
  1982. + clocks = <&osc24M>, <&rtc CLK_OSC32K>;
  1983. + clock-names = "hosc", "losc";
  1984. + };
  1985. +
  1986. + r_ccu: clock-controller@7010000 {
  1987. + compatible = "allwinner,sun20i-d1-r-ccu";
  1988. + reg = <0x7010000 0x400>;
  1989. + clocks = <&osc24M>,
  1990. + <&rtc CLK_OSC32K>,
  1991. + <&rtc CLK_IOSC>,
  1992. + <&ccu CLK_PLL_PERIPH0_DIV3>;
  1993. + clock-names = "hosc", "losc", "iosc", "pll-periph";
  1994. + #clock-cells = <1>;
  1995. + #reset-cells = <1>;
  1996. + };
  1997. +
  1998. + rtc: rtc@7090000 {
  1999. + compatible = "allwinner,sun20i-d1-rtc",
  2000. + "allwinner,sun50i-r329-rtc";
  2001. + reg = <0x7090000 0x400>;
  2002. + interrupts = <160 IRQ_TYPE_LEVEL_HIGH>;
  2003. + clocks = <&r_ccu CLK_BUS_R_RTC>,
  2004. + <&osc24M>,
  2005. + <&r_ccu CLK_R_AHB>;
  2006. + clock-names = "bus", "hosc", "ahb";
  2007. + #clock-cells = <1>;
  2008. + };
  2009. +
  2010. + plic: interrupt-controller@10000000 {
  2011. + compatible = "allwinner,sun20i-d1-plic",
  2012. + "thead,c900-plic";
  2013. + reg = <0x10000000 0x4000000>;
  2014. + interrupts-extended = <&cpu0_intc 11>,
  2015. + <&cpu0_intc 9>;
  2016. + interrupt-controller;
  2017. + riscv,ndev = <176>;
  2018. + #address-cells = <0>;
  2019. + #interrupt-cells = <2>;
  2020. + };
  2021. + };
  2022. +};
  2023. --- /dev/null
  2024. +++ b/arch/riscv/dts/sunxi-u-boot.dtsi
  2025. @@ -0,0 +1,68 @@
  2026. +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
  2027. +
  2028. +#include "binman.dtsi"
  2029. +
  2030. +/ {
  2031. + cpus {
  2032. + u-boot,dm-spl;
  2033. + };
  2034. +
  2035. + soc {
  2036. + u-boot,dm-spl;
  2037. + };
  2038. +};
  2039. +
  2040. +&binman {
  2041. + u-boot-sunxi-with-spl {
  2042. + filename = "u-boot-sunxi-with-spl.bin";
  2043. + pad-byte = <0xff>;
  2044. +
  2045. + blob@0 {
  2046. + filename = "spl/sunxi-spl.bin";
  2047. + };
  2048. +
  2049. + blob@1 {
  2050. + filename = "u-boot.itb";
  2051. + };
  2052. + };
  2053. +};
  2054. +
  2055. +&ccu {
  2056. + u-boot,dm-spl;
  2057. +};
  2058. +
  2059. +&cpu0 {
  2060. + u-boot,dm-spl;
  2061. +};
  2062. +
  2063. +&mbus {
  2064. + u-boot,dm-spl;
  2065. +};
  2066. +
  2067. +&mmc0 {
  2068. + u-boot,dm-spl;
  2069. +};
  2070. +
  2071. +&mmc0_pins {
  2072. + u-boot,dm-spl;
  2073. +};
  2074. +
  2075. +&osc24M {
  2076. + u-boot,dm-spl;
  2077. +};
  2078. +
  2079. +&pio {
  2080. + u-boot,dm-spl;
  2081. +};
  2082. +
  2083. +&rtc {
  2084. + u-boot,dm-spl;
  2085. +};
  2086. +
  2087. +&uart0 {
  2088. + u-boot,dm-spl;
  2089. +};
  2090. +
  2091. +&uart0_pb8_pins {
  2092. + u-boot,dm-spl;
  2093. +};
  2094. --- /dev/null
  2095. +++ b/include/dt-bindings/clock/sun20i-d1-r-ccu.h
  2096. @@ -0,0 +1,19 @@
  2097. +/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
  2098. +/*
  2099. + * Copyright (C) 2021 Samuel Holland <[email protected]>
  2100. + */
  2101. +
  2102. +#ifndef _DT_BINDINGS_CLK_SUN20I_D1_R_CCU_H_
  2103. +#define _DT_BINDINGS_CLK_SUN20I_D1_R_CCU_H_
  2104. +
  2105. +#define CLK_R_AHB 0
  2106. +
  2107. +#define CLK_BUS_R_TIMER 2
  2108. +#define CLK_BUS_R_TWD 3
  2109. +#define CLK_BUS_R_PPU 4
  2110. +#define CLK_R_IR_RX 5
  2111. +#define CLK_BUS_R_IR_RX 6
  2112. +#define CLK_BUS_R_RTC 7
  2113. +#define CLK_BUS_R_CPUCFG 8
  2114. +
  2115. +#endif /* _DT_BINDINGS_CLK_SUN20I_D1_R_CCU_H_ */
  2116. --- /dev/null
  2117. +++ b/include/dt-bindings/reset/sun20i-d1-r-ccu.h
  2118. @@ -0,0 +1,16 @@
  2119. +/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
  2120. +/*
  2121. + * Copyright (C) 2021 Samuel Holland <[email protected]>
  2122. + */
  2123. +
  2124. +#ifndef _DT_BINDINGS_RST_SUN20I_D1_R_CCU_H_
  2125. +#define _DT_BINDINGS_RST_SUN20I_D1_R_CCU_H_
  2126. +
  2127. +#define RST_BUS_R_TIMER 0
  2128. +#define RST_BUS_R_TWD 1
  2129. +#define RST_BUS_R_PPU 2
  2130. +#define RST_BUS_R_IR_RX 3
  2131. +#define RST_BUS_R_RTC 4
  2132. +#define RST_BUS_R_CPUCFG 5
  2133. +
  2134. +#endif /* _DT_BINDINGS_RST_SUN20I_D1_R_CCU_H_ */