2
0

0033-riscv-dts-allwinner-Add-ClockworkPi-and-DevTerm-devi.patch 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. From 11f692c6b009f36b9a91d5ceb5998ae15e57f18c Mon Sep 17 00:00:00 2001
  2. From: Samuel Holland <[email protected]>
  3. Date: Sun, 10 Jul 2022 23:43:49 -0500
  4. Subject: [PATCH 033/117] riscv: dts: allwinner: Add ClockworkPi and DevTerm
  5. devicetrees
  6. Clockwork Tech manufactures several SoMs for their RasPi CM3-compatible
  7. "ClockworkPi" mainboard. Their R-01 SoM features the Allwinner D1 SoC.
  8. The R-01 contains only the CPU, DRAM, and always-on voltage regulation;
  9. it does not merit a separate devicetree.
  10. The ClockworkPi mainboard features analog audio, a MIPI-DSI panel, USB
  11. host and peripheral ports, an Ampak AP6256 WiFi/Bluetooth module, and an
  12. X-Powers AXP228 PMIC for managing a Li-ion battery.
  13. The DevTerm is a complete system which extends the ClockworkPi mainboard
  14. with a pair of expansion boards. These expansion boards provide a fan, a
  15. keyboard, speakers, and a thermal printer.
  16. Signed-off-by: Samuel Holland <[email protected]>
  17. ---
  18. arch/riscv/boot/dts/allwinner/Makefile | 2 +
  19. .../allwinner/sun20i-d1-clockworkpi-v3.14.dts | 242 ++++++++++++++++++
  20. .../dts/allwinner/sun20i-d1-devterm-v3.14.dts | 37 +++
  21. 3 files changed, 281 insertions(+)
  22. create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-clockworkpi-v3.14.dts
  23. create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-devterm-v3.14.dts
  24. --- a/arch/riscv/boot/dts/allwinner/Makefile
  25. +++ b/arch/riscv/boot/dts/allwinner/Makefile
  26. @@ -1,4 +1,6 @@
  27. # SPDX-License-Identifier: GPL-2.0
  28. +dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-clockworkpi-v3.14.dtb
  29. +dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-devterm-v3.14.dtb
  30. dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-dongshan-nezha-stu.dtb
  31. dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-86-panel-480p.dtb
  32. dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-86-panel-720p.dtb
  33. --- /dev/null
  34. +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-clockworkpi-v3.14.dts
  35. @@ -0,0 +1,242 @@
  36. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  37. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  38. +
  39. +/dts-v1/;
  40. +
  41. +#include <dt-bindings/gpio/gpio.h>
  42. +
  43. +#include "sun20i-d1.dtsi"
  44. +#include "sun20i-d1-common-regulators.dtsi"
  45. +
  46. +/ {
  47. + model = "ClockworkPi v3.14 (R-01)";
  48. + compatible = "clockwork,r-01-clockworkpi-v3.14", "allwinner,sun20i-d1";
  49. +
  50. + aliases {
  51. + ethernet0 = &ap6256;
  52. + mmc0 = &mmc0;
  53. + serial0 = &uart0;
  54. + };
  55. +
  56. + chosen {
  57. + stdout-path = "serial0:115200n8";
  58. + };
  59. +
  60. + /*
  61. + * This regulator is PWM-controlled, but the PWM controller is not
  62. + * yet supported, so fix the regulator to its default voltage.
  63. + */
  64. + reg_vdd_cpu: vdd-cpu {
  65. + compatible = "regulator-fixed";
  66. + regulator-name = "vdd-cpu";
  67. + regulator-min-microvolt = <1100000>;
  68. + regulator-max-microvolt = <1100000>;
  69. + vin-supply = <&reg_vcc>;
  70. + };
  71. +
  72. + wifi_pwrseq: wifi-pwrseq {
  73. + compatible = "mmc-pwrseq-simple";
  74. + reset-gpios = <&pio 6 11 GPIO_ACTIVE_LOW>; /* PG11/GPIO3 */
  75. + };
  76. +};
  77. +
  78. +&cpu0 {
  79. + cpu-supply = <&reg_vdd_cpu>;
  80. +};
  81. +
  82. +&ehci1 {
  83. + status = "okay";
  84. +};
  85. +
  86. +&i2c0 {
  87. + pinctrl-0 = <&i2c0_pb10_pins>;
  88. + pinctrl-names = "default";
  89. + status = "okay";
  90. +
  91. + axp221: pmic@34 {
  92. + compatible = "x-powers,axp228", "x-powers,axp221";
  93. + reg = <0x34>;
  94. + interrupt-parent = <&pio>;
  95. + interrupts = <4 9 IRQ_TYPE_LEVEL_LOW>; /* PE9/GPIO2 */
  96. + interrupt-controller;
  97. + #interrupt-cells = <1>;
  98. +
  99. + ac_power_supply: ac-power {
  100. + compatible = "x-powers,axp221-ac-power-supply";
  101. + };
  102. +
  103. + axp_adc: adc {
  104. + compatible = "x-powers,axp221-adc";
  105. + #io-channel-cells = <1>;
  106. + };
  107. +
  108. + battery_power_supply: battery-power {
  109. + compatible = "x-powers,axp221-battery-power-supply";
  110. + };
  111. +
  112. + regulators {
  113. + x-powers,dcdc-freq = <3000>;
  114. +
  115. + reg_dcdc1: dcdc1 {
  116. + regulator-name = "sys-3v3";
  117. + regulator-always-on;
  118. + regulator-min-microvolt = <3300000>;
  119. + regulator-max-microvolt = <3300000>;
  120. + };
  121. +
  122. + reg_dcdc3: dcdc3 {
  123. + regulator-name = "sys-1v8";
  124. + regulator-always-on;
  125. + regulator-min-microvolt = <1800000>;
  126. + regulator-max-microvolt = <1800000>;
  127. + };
  128. +
  129. + reg_aldo1: aldo1 {
  130. + regulator-name = "aud-3v3";
  131. + regulator-min-microvolt = <3300000>;
  132. + regulator-max-microvolt = <3300000>;
  133. + };
  134. +
  135. + reg_aldo2: aldo2 {
  136. + regulator-name = "disp-3v3";
  137. + regulator-always-on;
  138. + regulator-min-microvolt = <3300000>;
  139. + regulator-max-microvolt = <3300000>;
  140. + };
  141. +
  142. + reg_aldo3: aldo3 {
  143. + regulator-name = "vdd-wifi";
  144. + regulator-min-microvolt = <1800000>;
  145. + regulator-max-microvolt = <1800000>;
  146. + };
  147. +
  148. + /* DLDO1 and ELDO1-3 are connected in parallel. */
  149. + reg_dldo1: dldo1 {
  150. + regulator-name = "vbat-wifi-a";
  151. + regulator-always-on;
  152. + regulator-min-microvolt = <3300000>;
  153. + regulator-max-microvolt = <3300000>;
  154. + };
  155. +
  156. + /* DLDO2-DLDO4 are connected in parallel. */
  157. + reg_dldo2: dldo2 {
  158. + regulator-name = "vcc-3v3-ext-a";
  159. + regulator-always-on;
  160. + regulator-min-microvolt = <3300000>;
  161. + regulator-max-microvolt = <3300000>;
  162. + };
  163. +
  164. + reg_dldo3: dldo3 {
  165. + regulator-name = "vcc-3v3-ext-b";
  166. + regulator-always-on;
  167. + regulator-min-microvolt = <3300000>;
  168. + regulator-max-microvolt = <3300000>;
  169. + };
  170. +
  171. + reg_dldo4: dldo4 {
  172. + regulator-name = "vcc-3v3-ext-c";
  173. + regulator-always-on;
  174. + regulator-min-microvolt = <3300000>;
  175. + regulator-max-microvolt = <3300000>;
  176. + };
  177. +
  178. + reg_eldo1: eldo1 {
  179. + regulator-name = "vbat-wifi-b";
  180. + regulator-always-on;
  181. + regulator-min-microvolt = <3300000>;
  182. + regulator-max-microvolt = <3300000>;
  183. + };
  184. +
  185. + reg_eldo2: eldo2 {
  186. + regulator-name = "vbat-wifi-c";
  187. + regulator-always-on;
  188. + regulator-min-microvolt = <3300000>;
  189. + regulator-max-microvolt = <3300000>;
  190. + };
  191. +
  192. + reg_eldo3: eldo3 {
  193. + regulator-name = "vbat-wifi-d";
  194. + regulator-always-on;
  195. + regulator-min-microvolt = <3300000>;
  196. + regulator-max-microvolt = <3300000>;
  197. + };
  198. + };
  199. +
  200. + usb_power_supply: usb-power {
  201. + compatible = "x-powers,axp221-usb-power-supply";
  202. + status = "disabled";
  203. + };
  204. + };
  205. +};
  206. +
  207. +&mmc0 {
  208. + broken-cd;
  209. + bus-width = <4>;
  210. + disable-wp;
  211. + vmmc-supply = <&reg_dcdc1>;
  212. + vqmmc-supply = <&reg_vcc_3v3>;
  213. + pinctrl-0 = <&mmc0_pins>;
  214. + pinctrl-names = "default";
  215. + status = "okay";
  216. +};
  217. +
  218. +&mmc1 {
  219. + bus-width = <4>;
  220. + mmc-pwrseq = <&wifi_pwrseq>;
  221. + non-removable;
  222. + vmmc-supply = <&reg_dldo1>;
  223. + vqmmc-supply = <&reg_aldo3>;
  224. + pinctrl-0 = <&mmc1_pins>;
  225. + pinctrl-names = "default";
  226. + status = "okay";
  227. +
  228. + ap6256: wifi@1 {
  229. + compatible = "brcm,bcm43456-fmac", "brcm,bcm4329-fmac";
  230. + reg = <1>;
  231. + interrupt-parent = <&pio>;
  232. + interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10/GPIO4 */
  233. + interrupt-names = "host-wake";
  234. + };
  235. +};
  236. +
  237. +&ohci1 {
  238. + status = "okay";
  239. +};
  240. +
  241. +&pio {
  242. + vcc-pg-supply = <&reg_ldoa>;
  243. +};
  244. +
  245. +&uart0 {
  246. + pinctrl-0 = <&uart0_pb8_pins>;
  247. + pinctrl-names = "default";
  248. + status = "okay";
  249. +};
  250. +
  251. +&uart1 {
  252. + uart-has-rtscts;
  253. + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
  254. + pinctrl-names = "default";
  255. + status = "okay";
  256. +
  257. + bluetooth {
  258. + compatible = "brcm,bcm4345c5";
  259. + interrupt-parent = <&pio>;
  260. + interrupts = <6 17 IRQ_TYPE_LEVEL_HIGH>; /* PG17/GPIO6 */
  261. + device-wakeup-gpios = <&pio 6 16 GPIO_ACTIVE_HIGH>; /* PG16/GPIO7 */
  262. + shutdown-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18/GPIO5 */
  263. + max-speed = <1500000>;
  264. + vbat-supply = <&reg_dldo1>;
  265. + vddio-supply = <&reg_aldo3>;
  266. + };
  267. +};
  268. +
  269. +&usb_otg {
  270. + dr_mode = "peripheral";
  271. + status = "okay";
  272. +};
  273. +
  274. +&usbphy {
  275. + usb0_vbus_power-supply = <&ac_power_supply>;
  276. + status = "okay";
  277. +};
  278. --- /dev/null
  279. +++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-devterm-v3.14.dts
  280. @@ -0,0 +1,37 @@
  281. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  282. +// Copyright (C) 2022 Samuel Holland <[email protected]>
  283. +
  284. +/dts-v1/;
  285. +
  286. +#include "sun20i-d1-clockworkpi-v3.14.dts"
  287. +
  288. +/ {
  289. + model = "Clockwork DevTerm (R-01)";
  290. + compatible = "clockwork,r-01-devterm-v3.14",
  291. + "clockwork,r-01-clockworkpi-v3.14",
  292. + "allwinner,sun20i-d1";
  293. +
  294. + fan {
  295. + compatible = "gpio-fan";
  296. + gpios = <&pio 3 10 GPIO_ACTIVE_HIGH>; /* PD10/GPIO41 */
  297. + gpio-fan,speed-map = <0 0>,
  298. + <6000 1>;
  299. + #cooling-cells = <2>;
  300. + };
  301. +
  302. + i2c-gpio-0 {
  303. + compatible = "i2c-gpio";
  304. + sda-gpios = <&pio 3 14 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD14/GPIO44 */
  305. + scl-gpios = <&pio 3 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD15/GPIO45 */
  306. + #address-cells = <1>;
  307. + #size-cells = <0>;
  308. +
  309. + adc@54 {
  310. + compatible = "ti,adc101c";
  311. + reg = <0x54>;
  312. + interrupt-parent = <&pio>;
  313. + interrupts = <4 12 IRQ_TYPE_LEVEL_LOW>; /* PE12/GPIO35 */
  314. + vref-supply = <&reg_dldo2>;
  315. + };
  316. + };
  317. +};