210-dt-sun8i-add-orangepi-2.patch 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. --- a/arch/arm/boot/dts/Makefile
  2. +++ b/arch/arm/boot/dts/Makefile
  3. @@ -662,6 +662,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
  4. sun8i-a33-ippo-q8h-v1.2.dtb \
  5. sun8i-a33-q8-tablet.dtb \
  6. sun8i-a33-sinlinx-sina33.dtb \
  7. + sun8i-h3-orangepi-2.dtb \
  8. sun8i-h3-orangepi-plus.dtb
  9. dtb-$(CONFIG_MACH_SUN9I) += \
  10. sun9i-a80-optimus.dtb \
  11. --- /dev/null
  12. +++ b/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
  13. @@ -0,0 +1,186 @@
  14. +/*
  15. + * Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
  16. + *
  17. + * This file is dual-licensed: you can use it either under the terms
  18. + * of the GPL or the X11 license, at your option. Note that this dual
  19. + * licensing only applies to this file, and not this project as a
  20. + * whole.
  21. + *
  22. + * a) This file is free software; you can redistribute it and/or
  23. + * modify it under the terms of the GNU General Public License as
  24. + * published by the Free Software Foundation; either version 2 of the
  25. + * License, or (at your option) any later version.
  26. + *
  27. + * This file is distributed in the hope that it will be useful,
  28. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  30. + * GNU General Public License for more details.
  31. + *
  32. + * Or, alternatively,
  33. + *
  34. + * b) Permission is hereby granted, free of charge, to any person
  35. + * obtaining a copy of this software and associated documentation
  36. + * files (the "Software"), to deal in the Software without
  37. + * restriction, including without limitation the rights to use,
  38. + * copy, modify, merge, publish, distribute, sublicense, and/or
  39. + * sell copies of the Software, and to permit persons to whom the
  40. + * Software is furnished to do so, subject to the following
  41. + * conditions:
  42. + *
  43. + * The above copyright notice and this permission notice shall be
  44. + * included in all copies or substantial portions of the Software.
  45. + *
  46. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  47. + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  48. + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  49. + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  50. + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  51. + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  52. + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  53. + * OTHER DEALINGS IN THE SOFTWARE.
  54. + */
  55. +
  56. +/dts-v1/;
  57. +#include "sun8i-h3.dtsi"
  58. +#include "sunxi-common-regulators.dtsi"
  59. +
  60. +#include <dt-bindings/gpio/gpio.h>
  61. +#include <dt-bindings/input/input.h>
  62. +#include <dt-bindings/pinctrl/sun4i-a10.h>
  63. +
  64. +/ {
  65. + model = "Xunlong Orange Pi 2";
  66. + compatible = "xunlong,orangepi-2", "allwinner,sun8i-h3";
  67. +
  68. + aliases {
  69. + serial0 = &uart0;
  70. + };
  71. +
  72. + chosen {
  73. + stdout-path = "serial0:115200n8";
  74. + };
  75. +
  76. + leds {
  77. + compatible = "gpio-leds";
  78. + pinctrl-names = "default";
  79. + pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
  80. +
  81. + status_led {
  82. + label = "orangepi:red:status";
  83. + gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
  84. + };
  85. +
  86. + pwr_led {
  87. + label = "orangepi:green:pwr";
  88. + gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
  89. + default-state = "on";
  90. + };
  91. + };
  92. +
  93. + r_gpio_keys {
  94. + compatible = "gpio-keys";
  95. + pinctrl-names = "default";
  96. + pinctrl-0 = <&sw_r_opc>;
  97. +
  98. + sw2 {
  99. + label = "sw2";
  100. + linux,code = <BTN_1>;
  101. + gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>;
  102. + };
  103. +
  104. + sw4 {
  105. + label = "sw4";
  106. + linux,code = <BTN_0>;
  107. + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
  108. + };
  109. + };
  110. +
  111. + wifi_pwrseq: wifi_pwrseq {
  112. + compatible = "mmc-pwrseq-simple";
  113. + pinctrl-names = "default";
  114. + pinctrl-0 = <&wifi_pwrseq_pin_orangepi>;
  115. + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 WIFI_EN */
  116. + };
  117. +};
  118. +
  119. +&ehci1 {
  120. + status = "okay";
  121. +};
  122. +
  123. +&ir {
  124. + pinctrl-names = "default";
  125. + pinctrl-0 = <&ir_pins_a>;
  126. + status = "okay";
  127. +};
  128. +
  129. +&mmc0 {
  130. + pinctrl-names = "default";
  131. + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
  132. + vmmc-supply = <&reg_vcc3v3>;
  133. + bus-width = <4>;
  134. + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
  135. + cd-inverted;
  136. + status = "okay";
  137. +};
  138. +
  139. +&mmc1 {
  140. + pinctrl-names = "default";
  141. + pinctrl-0 = <&mmc1_pins_a>;
  142. + vmmc-supply = <&reg_vcc3v3>;
  143. + mmc-pwrseq = <&wifi_pwrseq>;
  144. + bus-width = <4>;
  145. + non-removable;
  146. + status = "okay";
  147. +};
  148. +
  149. +&pio {
  150. + leds_opc: led_pins@0 {
  151. + allwinner,pins = "PA15";
  152. + allwinner,function = "gpio_out";
  153. + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
  154. + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  155. + };
  156. +};
  157. +
  158. +&r_pio {
  159. + leds_r_opc: led_pins@0 {
  160. + allwinner,pins = "PL10";
  161. + allwinner,function = "gpio_out";
  162. + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
  163. + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  164. + };
  165. +
  166. + sw_r_opc: key_pins@0 {
  167. + allwinner,pins = "PL3", "PL4";
  168. + allwinner,function = "gpio_in";
  169. + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
  170. + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  171. + };
  172. +
  173. + wifi_pwrseq_pin_orangepi: wifi_pwrseq_pin@0 {
  174. + allwinner,pins = "PL7";
  175. + allwinner,function = "gpio_out";
  176. + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
  177. + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  178. + };
  179. +};
  180. +
  181. +&reg_usb1_vbus {
  182. + gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>;
  183. + status = "okay";
  184. +};
  185. +
  186. +&uart0 {
  187. + pinctrl-names = "default";
  188. + pinctrl-0 = <&uart0_pins_a>;
  189. + status = "okay";
  190. +};
  191. +
  192. +&usb1_vbus_pin_a {
  193. + allwinner,pins = "PG13";
  194. +};
  195. +
  196. +&usbphy {
  197. + usb1_vbus-supply = <&reg_usb1_vbus>;
  198. + status = "okay";
  199. +};
  200. --- a/arch/arm/boot/dts/sun8i-h3.dtsi
  201. +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
  202. @@ -288,6 +288,33 @@
  203. clocks = <&osc24M>, <&pll6 1>, <&pll5>;
  204. clock-output-names = "mbus";
  205. };
  206. +
  207. + apb0: apb0_clk {
  208. + compatible = "fixed-factor-clock";
  209. + #clock-cells = <0>;
  210. + clock-div = <1>;
  211. + clock-mult = <1>;
  212. + clocks = <&osc24M>;
  213. + clock-output-names = "apb0";
  214. + };
  215. +
  216. + apb0_gates: clk@01f01428 {
  217. + compatible = "allwinner,sun8i-h3-apb0-gates-clk",
  218. + "allwinner,sun4i-a10-gates-clk";
  219. + reg = <0x01f01428 0x4>;
  220. + #clock-cells = <1>;
  221. + clocks = <&apb0>;
  222. + clock-indices = <0>, <1>;
  223. + clock-output-names = "apb0_pio", "apb0_ir";
  224. + };
  225. +
  226. + ir_clk: ir_clk@01f01454 {
  227. + compatible = "allwinner,sun4i-a10-mod0-clk";
  228. + reg = <0x01f01454 0x4>;
  229. + #clock-cells = <0>;
  230. + clocks = <&osc32k>, <&osc24M>;
  231. + clock-output-names = "ir";
  232. + };
  233. };
  234. soc {
  235. @@ -472,7 +499,7 @@
  236. gpio-controller;
  237. #gpio-cells = <3>;
  238. interrupt-controller;
  239. - #interrupt-cells = <2>;
  240. + #interrupt-cells = <3>;
  241. uart0_pins_a: uart0@0 {
  242. allwinner,pins = "PA4", "PA5";
  243. @@ -503,6 +530,16 @@
  244. allwinner,drive = <SUN4I_PINCTRL_30_MA>;
  245. allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  246. };
  247. +
  248. + mmc2_8bit_pins: mmc2_8bit {
  249. + allwinner,pins = "PC5", "PC6", "PC8",
  250. + "PC9", "PC10", "PC11",
  251. + "PC12", "PC13", "PC14",
  252. + "PC15", "PC16";
  253. + allwinner,function = "mmc2";
  254. + allwinner,drive = <SUN4I_PINCTRL_30_MA>;
  255. + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  256. + };
  257. };
  258. ahb_rst: reset@01c202c0 {
  259. @@ -606,5 +643,40 @@
  260. interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
  261. <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
  262. };
  263. +
  264. + apb0_reset: reset@01f014b0 {
  265. + reg = <0x01f014b0 0x4>;
  266. + compatible = "allwinner,sun6i-a31-clock-reset";
  267. + #reset-cells = <1>;
  268. + };
  269. +
  270. + ir: ir@01f02000 {
  271. + compatible = "allwinner,sun5i-a13-ir";
  272. + clocks = <&apb0_gates 1>, <&ir_clk>;
  273. + clock-names = "apb", "ir";
  274. + resets = <&apb0_reset 1>;
  275. + interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
  276. + reg = <0x01f02000 0x40>;
  277. + status = "disabled";
  278. + };
  279. +
  280. + r_pio: pinctrl@01f02c00 {
  281. + compatible = "allwinner,sun8i-h3-r-pinctrl";
  282. + reg = <0x01f02c00 0x400>;
  283. + interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
  284. + clocks = <&apb0_gates 0>;
  285. + resets = <&apb0_reset 0>;
  286. + gpio-controller;
  287. + #gpio-cells = <3>;
  288. + interrupt-controller;
  289. + #interrupt-cells = <3>;
  290. +
  291. + ir_pins_a: ir@0 {
  292. + allwinner,pins = "PL11";
  293. + allwinner,function = "s_cir_rx";
  294. + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
  295. + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
  296. + };
  297. + };
  298. };
  299. };