410-sunxi-add-bananapi-p2-zero.patch 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. --- a/arch/arm/boot/dts/Makefile
  2. +++ b/arch/arm/boot/dts/Makefile
  3. @@ -1348,6 +1348,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
  4. sun8i-a83t-cubietruck-plus.dtb \
  5. sun8i-a83t-tbs-a711.dtb \
  6. sun8i-h2-plus-bananapi-m2-zero.dtb \
  7. + sun8i-h2-plus-bananapi-p2-zero.dtb \
  8. sun8i-h2-plus-libretech-all-h3-cc.dtb \
  9. sun8i-h2-plus-orangepi-r1.dtb \
  10. sun8i-h2-plus-orangepi-zero.dtb \
  11. --- /dev/null
  12. +++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-p2-zero.dts
  13. @@ -0,0 +1,279 @@
  14. +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  15. +/*
  16. + * Copyright (C) 2023 Zoltan HERPAI <[email protected]>
  17. + *
  18. + * Based on sun8i-h2-plus-bananapi-m2-zero.dts, which is:
  19. + * Copyright (C) 2017 Icenowy Zheng <[email protected]>
  20. + */
  21. +
  22. +/dts-v1/;
  23. +#include "sun8i-h3.dtsi"
  24. +#include "sunxi-common-regulators.dtsi"
  25. +
  26. +#include <dt-bindings/gpio/gpio.h>
  27. +#include <dt-bindings/input/input.h>
  28. +
  29. +/ {
  30. + model = "Banana Pi BPI-P2-Zero";
  31. + compatible = "sinovoip,bpi-p2-zero", "allwinner,sun8i-h2-plus";
  32. +
  33. + aliases {
  34. + serial0 = &uart0;
  35. + serial1 = &uart1;
  36. + };
  37. +
  38. + chosen {
  39. + stdout-path = "serial0:115200n8";
  40. + };
  41. +
  42. + connector {
  43. + compatible = "hdmi-connector";
  44. + type = "c";
  45. +
  46. + port {
  47. + hdmi_con_in: endpoint {
  48. + remote-endpoint = <&hdmi_out_con>;
  49. + };
  50. + };
  51. + };
  52. +
  53. + leds {
  54. + compatible = "gpio-leds";
  55. +
  56. + pwr_led {
  57. + label = "bananapi-p2-zero:red:pwr";
  58. + gpios = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */
  59. + default-state = "on";
  60. + };
  61. + };
  62. +
  63. + gpio_keys {
  64. + compatible = "gpio-keys";
  65. +
  66. + sw4 {
  67. + label = "power";
  68. + linux,code = <BTN_0>;
  69. + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
  70. + };
  71. + };
  72. +
  73. + reg_vdd_cpux: vdd-cpux-regulator {
  74. + compatible = "regulator-gpio";
  75. + regulator-name = "vdd-cpux";
  76. + regulator-type = "voltage";
  77. + regulator-boot-on;
  78. + regulator-always-on;
  79. + regulator-min-microvolt = <1100000>;
  80. + regulator-max-microvolt = <1300000>;
  81. + regulator-ramp-delay = <50>; /* 4ms */
  82. +
  83. + gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */
  84. + enable-active-high;
  85. + gpios-states = <0x1>;
  86. + states = <1100000 0>, <1300000 1>;
  87. + };
  88. +
  89. + reg_vcc_dram: vcc-dram {
  90. + compatible = "regulator-fixed";
  91. + regulator-name = "vcc-dram";
  92. + regulator-min-microvolt = <1500000>;
  93. + regulator-max-microvolt = <1500000>;
  94. + regulator-always-on;
  95. + regulator-boot-on;
  96. + enable-active-high;
  97. + gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
  98. + vin-supply = <&reg_vcc5v0>;
  99. + };
  100. +
  101. + reg_vcc1v2: vcc1v2 {
  102. + compatible = "regulator-fixed";
  103. + regulator-name = "vcc1v2";
  104. + regulator-min-microvolt = <1200000>;
  105. + regulator-max-microvolt = <1200000>;
  106. + regulator-always-on;
  107. + regulator-boot-on;
  108. + enable-active-high;
  109. + gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
  110. + vin-supply = <&reg_vcc5v0>;
  111. + };
  112. +
  113. + poweroff {
  114. + compatible = "regulator-poweroff";
  115. + cpu-supply = <&reg_vcc1v2>;
  116. + };
  117. +
  118. + wifi_pwrseq: wifi_pwrseq {
  119. + compatible = "mmc-pwrseq-simple";
  120. + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
  121. + clocks = <&rtc 1>;
  122. + clock-names = "ext_clock";
  123. + };
  124. +};
  125. +
  126. +&cpu0 {
  127. + cpu-supply = <&reg_vdd_cpux>;
  128. +};
  129. +
  130. +&de {
  131. + status = "okay";
  132. +};
  133. +
  134. +&ehci0 {
  135. + status = "okay";
  136. +};
  137. +
  138. +&emac {
  139. + phy-handle = <&int_mii_phy>;
  140. + phy-mode = "mii";
  141. + allwinner,leds-active-low;
  142. + status = "okay";
  143. +};
  144. +
  145. +&hdmi {
  146. + status = "okay";
  147. +};
  148. +
  149. +&hdmi_out {
  150. + hdmi_out_con: endpoint {
  151. + remote-endpoint = <&hdmi_con_in>;
  152. + };
  153. +};
  154. +
  155. +&mmc0 {
  156. + vmmc-supply = <&reg_vcc3v3>;
  157. + bus-width = <4>;
  158. + /*
  159. + * On the production batch of this board the card detect GPIO is
  160. + * high active (card inserted), although on the early samples it's
  161. + * low active.
  162. + */
  163. + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
  164. + status = "okay";
  165. +};
  166. +
  167. +&mmc1 {
  168. + vmmc-supply = <&reg_vcc3v3>;
  169. + vqmmc-supply = <&reg_vcc3v3>;
  170. + mmc-pwrseq = <&wifi_pwrseq>;
  171. + bus-width = <4>;
  172. + non-removable;
  173. + status = "okay";
  174. +
  175. + brcmf: wifi@1 {
  176. + reg = <1>;
  177. + compatible = "brcm,bcm4329-fmac";
  178. + interrupt-parent = <&pio>;
  179. + interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
  180. + interrupt-names = "host-wake";
  181. + };
  182. +};
  183. +
  184. +&ohci0 {
  185. + status = "okay";
  186. +};
  187. +
  188. +&uart0 {
  189. + pinctrl-names = "default";
  190. + pinctrl-0 = <&uart0_pa_pins>;
  191. + status = "okay";
  192. +};
  193. +
  194. +&uart1 {
  195. + pinctrl-names = "default";
  196. + pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
  197. + uart-has-rtscts;
  198. + status = "okay";
  199. +
  200. + bluetooth {
  201. + compatible = "brcm,bcm43438-bt";
  202. + max-speed = <1500000>;
  203. + clocks = <&rtc 1>;
  204. + clock-names = "lpo";
  205. + vbat-supply = <&reg_vcc3v3>;
  206. + vddio-supply = <&reg_vcc3v3>;
  207. + device-wakeup-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
  208. + host-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
  209. + shutdown-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
  210. + };
  211. +
  212. +};
  213. +
  214. +&pio {
  215. + gpio-line-names =
  216. + /* PA */
  217. + "CON2-P13", "CON2-P11", "CON2-P22", "CON2-P15",
  218. + "CON3-P03", "CON3-P02", "CON2-P07", "CON2-P29",
  219. + "CON2-P31", "CON2-P33", "CON2-P35", "CON2-P05",
  220. + "CON2-P03", "CON2-P08", "CON2-P10", "CON2-P16",
  221. + "CON2-P12", "CON2-P37", "CON2-P28", "CON2-P27",
  222. + "CON2-P40", "CON2-P38", "", "",
  223. + "", "", "", "", "", "", "", "",
  224. +
  225. + /* PB */
  226. + "", "", "", "", "", "", "", "",
  227. + "", "", "", "", "", "", "", "",
  228. + "", "", "", "", "", "", "", "",
  229. + "", "", "", "", "", "", "", "",
  230. +
  231. + /* PC */
  232. + "CON2-P19", "CON2-P21", "CON2-P23", "CON2-P24",
  233. + "CON2-P18", "", "", "CON2-P26",
  234. + "", "", "", "", "", "", "", "",
  235. + "", "", "", "", "", "", "", "",
  236. + "", "", "", "", "", "", "", "",
  237. +
  238. + /* PD */
  239. + "", "", "", "", "", "", "", "",
  240. + "", "", "", "", "", "", "CSI-PWR-EN", "",
  241. + "", "", "", "", "", "", "", "",
  242. + "", "", "", "", "", "", "", "",
  243. +
  244. + /* PE */
  245. + "CN3-P17", "CN3-P13", "CN3-P09", "CN3-P07",
  246. + "CN3-P19", "CN3-P21", "CN3-P22", "CN3-P20",
  247. + "CN3-P18", "CN3-P16", "CN3-P14", "CN3-P12",
  248. + "CN3-P05", "CN3-P03", "CN3-P06", "CN3-P08",
  249. + "", "", "", "", "", "", "", "",
  250. + "", "", "", "", "", "", "", "",
  251. +
  252. + /* PF */
  253. + "SDC0-D1", "SDC0-D0", "SDC0-CLK", "SDC0-CMD", "SDC0-D3",
  254. + "SDC0-D2", "SDC0-DET", "",
  255. + "", "", "", "", "", "", "", "",
  256. + "", "", "", "", "", "", "", "",
  257. + "", "", "", "", "", "", "", "",
  258. +
  259. + /* PG */
  260. + "WL-SDIO-CLK", "WL-SDIO-CMD", "WL-SDIO-D0", "WL-SDIO-D1",
  261. + "WL-SDIO-D2", "WL-SDIO-D3", "BT-UART-TX", "BT-UART-RX",
  262. + "BT-UART-RTS", "BT-UART-CTS", "WL-WAKE-AP", "BT-WAKE-AP",
  263. + "BT-RST-N", "AP-WAKE-BT", "", "",
  264. + "", "", "", "", "", "", "", "",
  265. + "", "", "", "", "", "", "", "";
  266. +};
  267. +
  268. +&r_pio {
  269. + gpio-line-names =
  270. + /* PL */
  271. + "", "CPUX-SET", "CON2-P32", "POWER-KEY", "CON2-P36",
  272. + "VCC-IO-EN", "USB0-ID", "WL-PWR-EN",
  273. + "PWR-STB", "PWR-DRAM", "PWR-LED", "IR-RX", "", "", "", "",
  274. + "", "", "", "", "", "", "", "",
  275. + "", "", "", "", "", "", "", "";
  276. +};
  277. +
  278. +&usb_otg {
  279. + dr_mode = "otg";
  280. + status = "okay";
  281. +};
  282. +
  283. +&usbphy {
  284. + usb0_id_det-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
  285. + /*
  286. + * There're two micro-USB connectors, one is power-only and another is
  287. + * OTG. The Vbus of these two connectors are connected together, so
  288. + * the external USB device will be powered just by the power input
  289. + * from the power-only USB port.
  290. + */
  291. + status = "okay";
  292. +};